Annotation of pkgsrc/doc/pkgsrc.html, revision 1.60
1.1 grant 1: <html xmlns="http://www.w3.org/1999/xhtml">
2: <head>
3: <meta name="generator" content=
1.59 rillig 4: "HTML Tidy for NetBSD (vers 1st August 2004), see www.w3.org" />
1.1 grant 5: <meta http-equiv="Content-Type" content=
6: "text/html; charset=us-ascii" />
7:
8: <title>The pkgsrc guide</title>
9: <link rel="stylesheet" href="/NetBSD.css" type="text/css" />
10: <meta name="generator" content=
1.23 wiz 11: "DocBook XSL Stylesheets VX.X.X" />
1.1 grant 12: <meta name="description" content=
13: "Information about using the NetBSD package system (pkgsrc) from both a user view for installing packages as well as from a pkgsrc developers' view for creating new packages." />
14: </head>
15:
16: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084"
17: alink="#0000FF">
1.59 rillig 18: <div class="book" lang="en" xml:lang="en">
1.1 grant 19: <div class="titlepage">
20: <div>
21: <div>
1.59 rillig 22: <h1 class="title"><a name="the-pkgsrc-guide" id=
23: "the-pkgsrc-guide"></a>The pkgsrc guide</h1>
1.1 grant 24: </div>
25:
26: <div>
1.2 hubertf 27: <h2 class="subtitle">Documentation on the NetBSD packages
1.1 grant 28: system</h2>
29: </div>
30:
31: <div>
32: <div class="authorgroup">
33: <div class="author">
34: <h3 class="author"><span class=
35: "firstname">Alistair</span> <span class=
36: "surname">Crooks</span></h3>
37:
38: <div class="affiliation">
39: <div class="address">
1.14 xtraeme 40: <p><code class="email"><<a href=
41: "mailto:agc@NetBSD.org">agc@NetBSD.org</a>></code></p>
1.1 grant 42: </div>
43: </div>
44: </div>
45:
46: <div class="author">
47: <h3 class="author"><span class=
48: "firstname">Hubert</span> <span class=
49: "surname">Feyrer</span></h3>
50:
51: <div class="affiliation">
52: <div class="address">
1.14 xtraeme 53: <p><code class="email"><<a href=
54: "mailto:hubertf@NetBSD.org">hubertf@NetBSD.org</a>></code></p>
1.1 grant 55: </div>
56: </div>
57: </div>
1.2 hubertf 58:
1.3 hubertf 59: <h3 class="corpauthor">The pkgsrc Developers</h3>
1.1 grant 60: </div>
61: </div>
62:
63: <div>
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.48 dillo 69: <p xmlns="" class="pubdate">$NetBSD: pkgsrc.xml,v 1.10
70: 2005/10/05 13:59:56 dillo 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.38 dillo 655: "#shells-disable">12.5.1. Disabling handling of
1.35 jmmv 656: configuration files</a></span></dt>
657: </dl>
658: </dd>
659: </dl>
660: </dd>
661:
1.38 dillo 662: <dt><span class="chapter"><a href="#options">13.
1.1 grant 663: Options handling</a></span></dt>
664:
665: <dd>
666: <dl>
1.30 wiz 667: <dt><span class="sect1"><a href=
1.38 dillo 668: "#global-default-options">13.1. Global default
1.30 wiz 669: options</a></span></dt>
1.1 grant 670:
1.30 wiz 671: <dt><span class="sect1"><a href=
1.38 dillo 672: "#converting-to-options">13.2. Converting packages
1.45 wiz 673: to use <code xmlns=
674: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 675: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 676:
677: <dt><span class="sect1"><a href=
678: "#option-names">13.3. Option Names</a></span></dt>
1.1 grant 679: </dl>
680: </dd>
681:
1.38 dillo 682: <dt><span class="chapter"><a href="#build">14. The
1.1 grant 683: build process</a></span></dt>
684:
685: <dd>
686: <dl>
687: <dt><span class="sect1"><a href=
1.56 rillig 688: "#build.intro">14.1. Introduction</a></span></dt>
689:
690: <dt><span class="sect1"><a href=
691: "#build.prefix">14.2. Program
1.1 grant 692: location</a></span></dt>
693:
1.30 wiz 694: <dt><span class="sect1"><a href=
1.56 rillig 695: "#build.builddirs">14.3. Directories used during
696: the build process</a></span></dt>
697:
698: <dt><span class="sect1"><a href=
699: "#build.running">14.4. Running a
700: phase</a></span></dt>
701:
702: <dt><span class="sect1"><a href=
703: "#build.fetch">14.5. The <span class=
704: "emphasis"><em>fetch</em></span>
705: phase</a></span></dt>
706:
707: <dt><span class="sect1"><a href=
708: "#build.checksum">14.6. The <span class=
709: "emphasis"><em>checksum</em></span>
710: phase</a></span></dt>
711:
712: <dt><span class="sect1"><a href=
713: "#build.extract">14.7. The <span class=
714: "emphasis"><em>extract</em></span>
715: phase</a></span></dt>
716:
717: <dt><span class="sect1"><a href=
718: "#build.patch">14.8. The <span class=
719: "emphasis"><em>patch</em></span>
720: phase</a></span></dt>
721:
722: <dt><span class="sect1"><a href=
723: "#build.tools">14.9. The <span class=
724: "emphasis"><em>tools</em></span>
725: phase</a></span></dt>
726:
727: <dt><span class="sect1"><a href=
728: "#build.wrapper">14.10. The <span class=
729: "emphasis"><em>wrapper</em></span>
730: phase</a></span></dt>
731:
732: <dt><span class="sect1"><a href=
733: "#build.configure">14.11. The <span class=
734: "emphasis"><em>configure</em></span>
735: phase</a></span></dt>
736:
737: <dt><span class="sect1"><a href=
738: "#build.build">14.12. The <span class=
739: "emphasis"><em>build</em></span>
740: phase</a></span></dt>
741:
742: <dt><span class="sect1"><a href=
743: "#build.test">14.13. The <span class=
744: "emphasis"><em>test</em></span>
745: phase</a></span></dt>
746:
747: <dt><span class="sect1"><a href=
748: "#build.install">14.14. The <span class=
749: "emphasis"><em>install</em></span>
750: phase</a></span></dt>
1.1 grant 751:
752: <dt><span class="sect1"><a href=
1.56 rillig 753: "#build.package">14.15. The <span class=
754: "emphasis"><em>package</em></span>
755: phase</a></span></dt>
756:
757: <dt><span class="sect1"><a href=
758: "#build.helpful-targets">14.16. Other helpful
1.1 grant 759: targets</a></span></dt>
760: </dl>
761: </dd>
762:
1.55 rillig 763: <dt><span class="chapter"><a href="#fixes">15. Making
764: your package work</a></span></dt>
1.1 grant 765:
766: <dd>
767: <dl>
1.30 wiz 768: <dt><span class="sect1"><a href=
1.38 dillo 769: "#general-operation">15.1. General
1.30 wiz 770: operation</a></span></dt>
1.1 grant 771:
772: <dd>
773: <dl>
774: <dt><span class="sect2"><a href=
1.38 dillo 775: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 776: pull in variables from
777: /etc/mk.conf</a></span></dt>
1.1 grant 778:
779: <dt><span class="sect2"><a href=
1.38 dillo 780: "#where-to-install-documentation">15.1.2. Where
1.31 wiz 781: to install documentation</a></span></dt>
782:
783: <dt><span class="sect2"><a href=
1.38 dillo 784: "#restricted-packages">15.1.3. Restricted
1.1 grant 785: packages</a></span></dt>
786:
787: <dt><span class="sect2"><a href=
1.38 dillo 788: "#dependencies">15.1.4. Handling
1.1 grant 789: dependencies</a></span></dt>
790:
791: <dt><span class="sect2"><a href=
1.38 dillo 792: "#conflicts">15.1.5. Handling conflicts with
1.1 grant 793: other packages</a></span></dt>
794:
795: <dt><span class="sect2"><a href=
1.38 dillo 796: "#not-building-packages">15.1.6. Packages that
1.30 wiz 797: cannot or should not be built</a></span></dt>
1.1 grant 798:
799: <dt><span class="sect2"><a href=
1.38 dillo 800: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 801: should not be deleted, once
802: installed</a></span></dt>
1.1 grant 803:
804: <dt><span class="sect2"><a href=
1.38 dillo 805: "#security-handling">15.1.8. Handling packages
1.1 grant 806: with security problems</a></span></dt>
807:
808: <dt><span class="sect2"><a href=
1.38 dillo 809: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 810: bugs</a></span></dt>
811:
812: <dt><span class="sect2"><a href=
1.38 dillo 813: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 814: incrementing versions when fixing an existing
1.1 grant 815: package</a></span></dt>
816:
817: <dt><span class="sect2"><a href=
1.38 dillo 818: "#portability-of-packages">15.1.11. Portability
1.30 wiz 819: of packages</a></span></dt>
1.1 grant 820: </dl>
821: </dd>
822:
1.30 wiz 823: <dt><span class="sect1"><a href=
1.38 dillo 824: "#downloading-issues">15.2. Possible downloading
1.30 wiz 825: issues</a></span></dt>
1.1 grant 826:
827: <dd>
828: <dl>
829: <dt><span class="sect2"><a href=
1.38 dillo 830: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 831: distfiles aren't available for plain
1.1 grant 832: downloading</a></span></dt>
833:
834: <dt><span class="sect2"><a href=
1.38 dillo 835: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 836: handle modified distfiles with the 'old'
837: name</a></span></dt>
1.1 grant 838: </dl>
839: </dd>
840:
1.30 wiz 841: <dt><span class="sect1"><a href=
1.38 dillo 842: "#configuration-gotchas">15.3. Configuration
1.30 wiz 843: gotchas</a></span></dt>
1.1 grant 844:
845: <dd>
846: <dl>
847: <dt><span class="sect2"><a href=
1.38 dillo 848: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 849: libtool</a></span></dt>
850:
851: <dt><span class="sect2"><a href=
1.38 dillo 852: "#using-libtool">15.3.2. Using libtool on GNU
1.1 grant 853: packages that already support
854: libtool</a></span></dt>
855:
856: <dt><span class="sect2"><a href=
1.38 dillo 857: "#autoconf-automake">15.3.3. GNU
1.1 grant 858: Autoconf/Automake</a></span></dt>
859: </dl>
860: </dd>
861:
1.30 wiz 862: <dt><span class="sect1"><a href=
1.55 rillig 863: "#fixes-build">15.4. Building the
864: package</a></span></dt>
1.1 grant 865:
866: <dd>
867: <dl>
868: <dt><span class="sect2"><a href=
1.38 dillo 869: "#cpp-defines">15.4.1. CPP
1.1 grant 870: defines</a></span></dt>
1.51 rillig 871:
872: <dt><span class="sect2"><a href=
1.60 ! rillig 873: "#cpp-list-examples">15.4.2. Examples of CPP
! 874: defines for some platforms</a></span></dt>
! 875:
! 876: <dt><span class="sect2"><a href=
! 877: "#cpp-list">15.4.3. Getting a list of CPP
1.51 rillig 878: defines</a></span></dt>
1.1 grant 879: </dl>
880: </dd>
881:
1.30 wiz 882: <dt><span class="sect1"><a href=
1.38 dillo 883: "#package-specific-actions">15.5. Package specific
1.30 wiz 884: actions</a></span></dt>
1.1 grant 885:
886: <dd>
887: <dl>
888: <dt><span class="sect2"><a href=
1.38 dillo 889: "#user-interaction">15.5.1. User
1.2 hubertf 890: interaction</a></span></dt>
1.1 grant 891:
892: <dt><span class="sect2"><a href=
1.38 dillo 893: "#handling-licenses">15.5.2. Handling
1.1 grant 894: licenses</a></span></dt>
895:
896: <dt><span class="sect2"><a href=
1.38 dillo 897: "#installing-score-files">15.5.3. Installing
1.30 wiz 898: score files</a></span></dt>
1.1 grant 899:
900: <dt><span class="sect2"><a href=
1.38 dillo 901: "#perl-scripts">15.5.4. Packages containing
1.30 wiz 902: perl scripts</a></span></dt>
1.1 grant 903:
904: <dt><span class="sect2"><a href=
1.38 dillo 905: "#hardcoded-paths">15.5.5. Packages with
1.30 wiz 906: hardcoded paths to other
907: interpreters</a></span></dt>
1.1 grant 908:
909: <dt><span class="sect2"><a href=
1.38 dillo 910: "#perl-modules">15.5.6. Packages installing
1.30 wiz 911: perl modules</a></span></dt>
1.1 grant 912:
913: <dt><span class="sect2"><a href=
1.38 dillo 914: "#faq.info-files">15.5.7. Packages installing
1.1 grant 915: info files</a></span></dt>
916:
917: <dt><span class="sect2"><a href=
1.57 minskim 918: "#manpages">15.5.8. Packages installing man
919: pages</a></span></dt>
920:
921: <dt><span class="sect2"><a href=
922: "#gconf2-data-files">15.5.9. Packages
1.30 wiz 923: installing GConf2 data files</a></span></dt>
1.1 grant 924:
925: <dt><span class="sect2"><a href=
1.57 minskim 926: "#scrollkeeper-data-files">15.5.10. Packages
1.30 wiz 927: installing scrollkeeper data
928: files</a></span></dt>
1.1 grant 929:
930: <dt><span class="sect2"><a href=
1.57 minskim 931: "#x11-fonts">15.5.11. Packages installing X11
1.1 grant 932: fonts</a></span></dt>
933:
934: <dt><span class="sect2"><a href=
1.57 minskim 935: "#gtk2-modules">15.5.12. Packages installing
1.30 wiz 936: GTK2 modules</a></span></dt>
1.1 grant 937:
938: <dt><span class="sect2"><a href=
1.57 minskim 939: "#sgml-xml-data">15.5.13. Packages installing
1.30 wiz 940: SGML or XML data</a></span></dt>
1.1 grant 941:
942: <dt><span class="sect2"><a href=
1.57 minskim 943: "#mime-database">15.5.14. Packages installing
1.1 grant 944: extensions to the MIME database</a></span></dt>
945:
946: <dt><span class="sect2"><a href=
1.57 minskim 947: "#intltool">15.5.15. Packages using
1.1 grant 948: intltool</a></span></dt>
1.18 xtraeme 949:
950: <dt><span class="sect2"><a href=
1.57 minskim 951: "#startup-scripts">15.5.16. Packages installing
1.18 xtraeme 952: startup scripts</a></span></dt>
1.57 minskim 953:
954: <dt><span class="sect2"><a href=
955: "#tex-packages">15.5.17. Packages installing
956: TeX modules</a></span></dt>
1.1 grant 957: </dl>
958: </dd>
959:
1.30 wiz 960: <dt><span class="sect1"><a href=
1.38 dillo 961: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 962: author</a></span></dt>
1.1 grant 963: </dl>
964: </dd>
965:
1.38 dillo 966: <dt><span class="chapter"><a href="#debug">16.
1.1 grant 967: Debugging</a></span></dt>
968:
1.38 dillo 969: <dt><span class="chapter"><a href="#submit">17.
1.1 grant 970: Submitting and Committing</a></span></dt>
971:
972: <dd>
973: <dl>
1.30 wiz 974: <dt><span class="sect1"><a href=
1.38 dillo 975: "#submitting-your-package">17.1. Submitting your
1.30 wiz 976: packages</a></span></dt>
1.1 grant 977:
1.30 wiz 978: <dt><span class="sect1"><a href=
1.41 wiz 979: "#general-notes-for-changes">17.2. General notes
980: when adding, updating, or removing
981: packages</a></span></dt>
982:
983: <dt><span class="sect1"><a href=
984: "#committing-importing">17.3. Committing: Importing
1.30 wiz 985: a package into CVS</a></span></dt>
1.1 grant 986:
1.30 wiz 987: <dt><span class="sect1"><a href=
1.41 wiz 988: "#updating-package">17.4. Updating a package to a
1.30 wiz 989: newer version</a></span></dt>
1.1 grant 990:
1.30 wiz 991: <dt><span class="sect1"><a href=
1.41 wiz 992: "#moving-package">17.5. Moving a package in
1.30 wiz 993: pkgsrc</a></span></dt>
1.1 grant 994: </dl>
995: </dd>
996: </dl>
997: </dd>
998:
1.46 gdt 999: <dt><span class="appendix"><a href="#examples">A. A simple
1.1 grant 1000: example package: bison</a></span></dt>
1001:
1002: <dd>
1003: <dl>
1.46 gdt 1004: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 1005: files</a></span></dt>
1006:
1007: <dd>
1008: <dl>
1.30 wiz 1009: <dt><span class="sect2"><a href=
1.46 gdt 1010: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 1011:
1.30 wiz 1012: <dt><span class="sect2"><a href=
1.46 gdt 1013: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 1014:
1.30 wiz 1015: <dt><span class="sect2"><a href=
1.46 gdt 1016: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 1017:
1.30 wiz 1018: <dt><span class="sect2"><a href=
1.46 gdt 1019: "#checking-package-with-pkglint">A.1.4. Checking a
1.30 wiz 1020: package with <span><strong class=
1.14 xtraeme 1021: "command">pkglint</strong></span></a></span></dt>
1.1 grant 1022: </dl>
1023: </dd>
1024:
1.46 gdt 1025: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30 wiz 1026: Steps for building, installing,
1027: packaging</a></span></dt>
1.1 grant 1028: </dl>
1029: </dd>
1030:
1.46 gdt 1031: <dt><span class="appendix"><a href="#logs">B. Build
1.1 grant 1032: logs</a></span></dt>
1033:
1034: <dd>
1035: <dl>
1.46 gdt 1036: <dt><span class="sect1"><a href="#logs.building">B.1.
1.1 grant 1037: Building figlet</a></span></dt>
1038:
1.46 gdt 1039: <dt><span class="sect1"><a href="#logs.package">B.2.
1.1 grant 1040: Packaging figlet</a></span></dt>
1041: </dl>
1042: </dd>
1043:
1.46 gdt 1044: <dt><span class="appendix"><a href="#ftp-layout">C. Layout
1.1 grant 1045: of the FTP server's package archive</a></span></dt>
1.2 hubertf 1046:
1.46 gdt 1047: <dt><span class="appendix"><a href="#editing">D. Editing
1.2 hubertf 1048: guidelines for the pkgsrc guide</a></span></dt>
1049:
1050: <dd>
1051: <dl>
1.46 gdt 1052: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 1053: Targets</a></span></dt>
1054:
1.46 gdt 1055: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 1056: Procedure</a></span></dt>
1057: </dl>
1058: </dd>
1.1 grant 1059: </dl>
1060: </div>
1061:
1.59 rillig 1062: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 1063: <div class="titlepage">
1064: <div>
1065: <div>
1.59 rillig 1066: <h2 class="title"><a name="introduction" id=
1.51 rillig 1067: "introduction"></a>Chapter 1. What is
1068: pkgsrc?</h2>
1.1 grant 1069: </div>
1070: </div>
1071: </div>
1072:
1073: <div class="toc">
1074: <p><b>Table of Contents</b></p>
1075:
1076: <dl>
1.30 wiz 1077: <dt><span class="sect1"><a href=
1078: "#introduction-section">1.1. Introduction</a></span></dt>
1.1 grant 1079:
1080: <dt><span class="sect1"><a href="#overview">1.2.
1081: Overview</a></span></dt>
1082:
1083: <dt><span class="sect1"><a href="#terminology">1.3.
1084: Terminology</a></span></dt>
1085:
1086: <dt><span class="sect1"><a href="#typography">1.4.
1087: Typography</a></span></dt>
1088: </dl>
1089: </div>
1090:
1.59 rillig 1091: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 1092: <div class="titlepage">
1093: <div>
1094: <div>
1095: <h2 class="title" style="clear: both"><a name=
1.59 rillig 1096: "introduction-section" id=
1.30 wiz 1097: "introduction-section"></a>1.1. Introduction</h2>
1.1 grant 1098: </div>
1099: </div>
1100: </div>
1101:
1.47 reed 1102: <p>There is a lot of software freely available for
1103: Unix-based systems, which usually runs on NetBSD and other
1.1 grant 1104: Unix-flavoured systems, too, sometimes with some
1105: modifications. The NetBSD Packages Collection (pkgsrc)
1106: incorporates any such changes necessary to make that
1107: software run, and makes the installation (and
1108: de-installation) of the software package easy by means of a
1109: single command.</p>
1110:
1111: <p>Once the software has been built, it is manipulated with
1.14 xtraeme 1112: the <span><strong class="command">pkg_*</strong></span>
1113: tools so that installation and de-installation, printing of
1114: an inventory of all installed packages and retrieval of
1115: one-line comments or more verbose descriptions are all
1116: simple.</p>
1.1 grant 1117:
1118: <p>pkgsrc currently contains several thousand packages,
1119: including:</p>
1120:
1121: <div class="itemizedlist">
1122: <ul type="disc">
1123: <li>
1124: <p><a xmlns=
1125: "http://www.w3.org/TR/xhtml1/transitional" href=
1126: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.45 wiz 1127: target="_top"><code xmlns="" class=
1128: "filename">www/apache</code></a> - The Apache web
1.20 ben 1129: server</p>
1.1 grant 1130: </li>
1131:
1132: <li>
1133: <p><a xmlns=
1134: "http://www.w3.org/TR/xhtml1/transitional" href=
1135: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 wiz 1136: target="_top"><code xmlns="" class=
1137: "filename">www/mozilla</code></a> - The Mozilla web
1.20 ben 1138: browser</p>
1.1 grant 1139: </li>
1140:
1141: <li>
1142: <p><a xmlns=
1143: "http://www.w3.org/TR/xhtml1/transitional" href=
1144: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.45 wiz 1145: target="_top"><code xmlns="" class=
1146: "filename">meta-pkgs/gnome</code></a> - The GNOME
1.20 ben 1147: Desktop Environment</p>
1.1 grant 1148: </li>
1149:
1150: <li>
1151: <p><a xmlns=
1152: "http://www.w3.org/TR/xhtml1/transitional" href=
1153: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.45 wiz 1154: target="_top"><code xmlns="" class=
1155: "filename">meta-pkgs/kde3</code></a> - The K Desktop
1.20 ben 1156: Environment</p>
1.1 grant 1157: </li>
1158: </ul>
1159: </div>
1160:
1161: <p>...just to name a few.</p>
1162:
1163: <p>pkgsrc has built-in support for handling varying
1164: dependencies, such as pthreads and X11, and extended
1165: features such as IPv6 support on a range of platforms.</p>
1166:
1167: <p>pkgsrc was derived from FreeBSD's ports system, and
1168: initially developed for NetBSD only. Since then, pkgsrc has
1169: grown a lot, and now supports the following platforms:</p>
1170:
1171: <div class="itemizedlist">
1172: <ul type="disc">
1173: <li>
1174: <p><a href="http://developer.apple.com/darwin/"
1175: target="_top">Darwin</a> (<a href=
1176: "http://www.apple.com/macosx/" target="_top">Mac OS
1177: X</a>)</p>
1178: </li>
1179:
1180: <li>
1.3 hubertf 1181: <p><a href="http://www.DragonFlyBSD.org/" target=
1182: "_top">DragonFlyBSD</a></p>
1183: </li>
1184:
1185: <li>
1.1 grant 1186: <p><a href="http://www.FreeBSD.org/" target=
1187: "_top">FreeBSD</a></p>
1188: </li>
1189:
1190: <li>
1.3 hubertf 1191: <p>Microsoft Windows, via <a href=
1192: "http://www.microsoft.com/windows/sfu/" target=
1193: "_top">Interix</a></p>
1.1 grant 1194: </li>
1195:
1196: <li>
1197: <p><a href="http://www.sgi.com/software/irix6.5/"
1198: target="_top">IRIX</a></p>
1199: </li>
1200:
1201: <li>
1202: <p><a href="http://www.linux.org/" target=
1203: "_top">Linux</a></p>
1204: </li>
1205:
1206: <li>
1207: <p><a href="http://www.NetBSD.org/" target=
1208: "_top">NetBSD</a> (of course)</p>
1209: </li>
1210:
1211: <li>
1.17 sketch 1212: <p><a href="http://h30097.www3.hp.com/" target=
1213: "_top">Tru64</a> (Digital UNIX, OSF1)</p>
1214: </li>
1215:
1216: <li>
1.1 grant 1217: <p><a href="http://www.openbsd.org/" target=
1218: "_top">OpenBSD</a></p>
1219: </li>
1220:
1221: <li>
1222: <p><a href="http://www.sun.com/solaris/" target=
1223: "_top">Solaris</a></p>
1224: </li>
1225: </ul>
1226: </div>
1227: </div>
1228:
1.59 rillig 1229: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 1230: <div class="titlepage">
1231: <div>
1232: <div>
1233: <h2 class="title" style="clear: both"><a name=
1.59 rillig 1234: "overview" id="overview"></a>1.2. Overview</h2>
1.1 grant 1235: </div>
1236: </div>
1237: </div>
1238:
1239: <p>This document is divided into two parts. The first,
1240: <a href="#users-guide" title=
1.46 gdt 1241: "Part I. The pkgsrc user's guide">The pkgsrc
1.2 hubertf 1242: user's guide</a>, describes how one can use one of the
1243: packages in the Package Collection, either by installing a
1244: precompiled binary package, or by building one's own copy
1245: using the NetBSD package system. The second part, <a href=
1.1 grant 1246: "#developers-guide" title=
1.46 gdt 1247: "Part II. The pkgsrc developer's guide">The
1248: pkgsrc developer's guide</a>, explains how to prepare a
1249: package so it can be easily built by other NetBSD users
1250: without knowing about the package's building details.</p>
1.1 grant 1251:
1252: <p>This document is available in various formats:</p>
1253:
1254: <div class="itemizedlist">
1255: <ul type="disc">
1256: <li>
1257: <p><a href="index.html" target="_top">HTML</a></p>
1258: </li>
1259:
1260: <li>
1261: <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
1262: </li>
1263:
1264: <li>
1265: <p><a href="pkgsrc.ps" target="_top">PS</a></p>
1266: </li>
1267:
1268: <li>
1269: <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
1270: </li>
1271: </ul>
1272: </div>
1273: </div>
1274:
1.59 rillig 1275: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 1276: <div class="titlepage">
1277: <div>
1278: <div>
1279: <h2 class="title" style="clear: both"><a name=
1.59 rillig 1280: "terminology" id=
1.1 grant 1281: "terminology"></a>1.3. Terminology</h2>
1282: </div>
1283: </div>
1284: </div>
1285:
1286: <p>There has been a lot of talk about “<span class=
1287: "quote">ports</span>”, “<span class=
1288: "quote">packages</span>”, etc. so far. Here is a
1289: description of all the terminology used within this
1290: document.</p>
1291:
1292: <div class="variablelist">
1293: <dl>
1294: <dt><span class="term">Package</span></dt>
1295:
1296: <dd>
1297: <p>A set of files and building instructions that
1298: describe what's necessary to build a certain piece of
1299: software using pkgsrc. Packages are traditionally
1.45 wiz 1300: stored under <code xmlns=
1301: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1302: "filename">/usr/pkgsrc</code>.</p>
1.1 grant 1303: </dd>
1304:
1305: <dt><span class="term">The NetBSD package
1306: system</span></dt>
1307:
1308: <dd>
1309: <p>This is the former name of “<span class=
1310: "quote">pkgsrc</span>”. It is part of the
1.27 rillig 1311: NetBSD operating system and can be bootstrapped to
1312: run on non-NetBSD operating systems as well. It
1313: handles building (compiling), installing, and
1314: removing of packages.</p>
1.1 grant 1315: </dd>
1316:
1317: <dt><span class="term">Distfile</span></dt>
1318:
1319: <dd>
1320: <p>This term describes the file or files that are
1321: provided by the author of the piece of software to
1322: distribute his work. All the changes necessary to
1323: build on NetBSD are reflected in the corresponding
1324: package. Usually the distfile is in the form of a
1325: compressed tar-archive, but other types are possible,
1.45 wiz 1326: too. Distfiles are usually stored below <code xmlns=
1327: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1328: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 1329: </dd>
1330:
1331: <dt><span class="term">Port</span></dt>
1332:
1333: <dd>
1334: <p>This is the term used by FreeBSD and OpenBSD
1335: people for what we call a package. In NetBSD
1336: terminology, “<span class=
1337: "quote">port</span>” refers to a different
1338: architecture.</p>
1339: </dd>
1340:
1341: <dt><span class="term">Precompiled/binary
1342: package</span></dt>
1343:
1344: <dd>
1345: <p>A set of binaries built with pkgsrc from a
1.14 xtraeme 1346: distfile and stuffed together in a single
1.45 wiz 1347: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
1348: class="filename">.tgz</code> file so it can be
1.14 xtraeme 1349: installed on machines of the same machine
1350: architecture without the need to recompile. Packages
1.45 wiz 1351: are usually generated in <code xmlns=
1352: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1353: "filename">/usr/pkgsrc/packages</code>; there is also
1354: an archive on <a href=
1.1 grant 1355: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
1356: "_top">ftp.NetBSD.org</a>.</p>
1357:
1358: <p>Sometimes, this is referred to by the term
1359: “<span class="quote">package</span>” too,
1360: especially in the context of precompiled
1361: packages.</p>
1362: </dd>
1363:
1364: <dt><span class="term">Program</span></dt>
1365:
1366: <dd>
1367: <p>The piece of software to be installed which will
1.47 reed 1368: be constructed from all the files in the distfile by
1.1 grant 1369: the actions defined in the corresponding package.</p>
1370: </dd>
1371: </dl>
1372: </div>
1373: </div>
1374:
1.59 rillig 1375: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 1376: <div class="titlepage">
1377: <div>
1378: <div>
1379: <h2 class="title" style="clear: both"><a name=
1.59 rillig 1380: "typography" id=
1.1 grant 1381: "typography"></a>1.4. Typography</h2>
1382: </div>
1383: </div>
1384: </div>
1385:
1386: <p>When giving examples for commands, shell prompts are
1387: used to show if the command should/can be issued as root,
1388: or if “<span class="quote">normal</span>” user
1.14 xtraeme 1389: privileges are sufficient. We use a <code class=
1390: "prompt">#</code> for root's shell prompt, and a
1.27 rillig 1391: <code class="prompt">%</code> for users' shell prompt,
1.14 xtraeme 1392: assuming they use the C-shell or tcsh.</p>
1.1 grant 1393: </div>
1394: </div>
1395:
1.59 rillig 1396: <div class="part" lang="en" xml:lang="en">
1.1 grant 1397: <div class="titlepage">
1398: <div>
1399: <div>
1.59 rillig 1400: <h1 class="title"><a name="users-guide" id=
1.48 dillo 1401: "users-guide"></a>Part I. The pkgsrc user's
1402: guide</h1>
1.1 grant 1403: </div>
1404: </div>
1405: </div>
1406:
1407: <div class="toc">
1408: <p><b>Table of Contents</b></p>
1409:
1410: <dl>
1411: <dt><span class="chapter"><a href="#getting">2. Where to
1.59 rillig 1412: get pkgsrc and how to keep it up-to-date</a></span></dt>
1.1 grant 1413:
1414: <dd>
1415: <dl>
1.30 wiz 1416: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1417: As tar file</a></span></dt>
1.1 grant 1418:
1.30 wiz 1419: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1420: SUP</a></span></dt>
1421:
1.30 wiz 1422: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1423: CVS</a></span></dt>
1.59 rillig 1424:
1425: <dt><span class="sect1"><a href="#uptodate-cvs">2.4.
1426: Keeping pkgsrc up-to-date via CVS</a></span></dt>
1.1 grant 1427: </dl>
1428: </dd>
1429:
1430: <dt><span class="chapter"><a href="#platforms">3. Using
1431: pkgsrc on systems other than NetBSD</a></span></dt>
1432:
1433: <dd>
1434: <dl>
1.30 wiz 1435: <dt><span class="sect1"><a href=
1436: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1437: pkgsrc</a></span></dt>
1.1 grant 1438:
1.30 wiz 1439: <dt><span class="sect1"><a href=
1.47 reed 1440: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 1441: notes</a></span></dt>
1.1 grant 1442:
1443: <dd>
1444: <dl>
1.30 wiz 1445: <dt><span class="sect2"><a href="#darwin">3.2.1.
1446: Darwin (Mac OS X)</a></span></dt>
1.1 grant 1447:
1.30 wiz 1448: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1449: FreeBSD</a></span></dt>
1.22 tv 1450:
1.30 wiz 1451: <dt><span class="sect2"><a href="#interix">3.2.3.
1452: Interix</a></span></dt>
1.1 grant 1453:
1.30 wiz 1454: <dt><span class="sect2"><a href="#irix">3.2.4.
1455: IRIX</a></span></dt>
1.1 grant 1456:
1.30 wiz 1457: <dt><span class="sect2"><a href="#linux">3.2.5.
1458: Linux</a></span></dt>
1.1 grant 1459:
1.30 wiz 1460: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1461: OpenBSD</a></span></dt>
1.1 grant 1462:
1.30 wiz 1463: <dt><span class="sect2"><a href="#solaris">3.2.7.
1464: Solaris</a></span></dt>
1.1 grant 1465: </dl>
1466: </dd>
1467: </dl>
1468: </dd>
1469:
1470: <dt><span class="chapter"><a href="#using">4. Using
1471: pkgsrc</a></span></dt>
1472:
1473: <dd>
1474: <dl>
1475: <dt><span class="sect1"><a href=
1476: "#getting-started">4.1. Working with binary
1477: packages</a></span></dt>
1478:
1479: <dd>
1480: <dl>
1481: <dt><span class="sect2"><a href=
1.30 wiz 1482: "#where-to-get-binary-packages">4.1.1. Where to
1483: get binary packages</a></span></dt>
1.1 grant 1484:
1485: <dt><span class="sect2"><a href=
1.30 wiz 1486: "#how-to-use-binary-packages">4.1.2. How to use
1487: binary packages</a></span></dt>
1.1 grant 1488:
1489: <dt><span class="sect2"><a href=
1.30 wiz 1490: "#a-word-of-warning">4.1.3. A word of
1.1 grant 1491: warning</a></span></dt>
1492: </dl>
1493: </dd>
1494:
1.30 wiz 1495: <dt><span class="sect1"><a href=
1496: "#building-packages-from-source">4.2. Building
1497: packages from source</a></span></dt>
1.1 grant 1498:
1499: <dd>
1500: <dl>
1501: <dt><span class="sect2"><a href=
1.30 wiz 1502: "#requirements">4.2.1.
1503: Requirements</a></span></dt>
1.1 grant 1504:
1505: <dt><span class="sect2"><a href=
1.30 wiz 1506: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 1507: distfiles</a></span></dt>
1508:
1509: <dt><span class="sect2"><a href=
1.30 wiz 1510: "#how-to-build-and-install">4.2.3. How to build
1511: and install</a></span></dt>
1.1 grant 1512:
1513: <dt><span class="sect2"><a href=
1.30 wiz 1514: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 1515: compiler</a></span></dt>
1516: </dl>
1517: </dd>
1518: </dl>
1519: </dd>
1520:
1.38 dillo 1521: <dt><span class="chapter"><a href="#configuring">5.
1522: Configuring pkgsrc</a></span></dt>
1523:
1524: <dd>
1525: <dl>
1526: <dt><span class="sect1"><a href=
1.45 wiz 1527: "#general-configuration">5.1. General
1528: configuration</a></span></dt>
1529:
1530: <dt><span class="sect1"><a href=
1531: "#variables-affecting-build">5.2. Variables affecting
1532: the build process</a></span></dt>
1533:
1534: <dt><span class="sect1"><a href=
1535: "#developer-advanced-settings">5.3.
1536: Developer/advanced settings</a></span></dt>
1537:
1538: <dt><span class="sect1"><a href=
1539: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 1540: Options</a></span></dt>
1.38 dillo 1541: </dl>
1542: </dd>
1543:
1544: <dt><span class="chapter"><a href="#binary">6. Creating
1.1 grant 1545: binary packages</a></span></dt>
1546:
1547: <dd>
1548: <dl>
1.30 wiz 1549: <dt><span class="sect1"><a href=
1.38 dillo 1550: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 1551: single binary package</a></span></dt>
1.1 grant 1552:
1.30 wiz 1553: <dt><span class="sect1"><a href=
1.38 dillo 1554: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 1555: Settings for creation of binary
1556: packages</a></span></dt>
1557:
1.38 dillo 1558: <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1 grant 1559: Doing a bulk build of all packages</a></span></dt>
1560:
1561: <dd>
1562: <dl>
1563: <dt><span class="sect2"><a href=
1.38 dillo 1564: "#binary.configuration">6.3.1.
1.1 grant 1565: Configuration</a></span></dt>
1566:
1567: <dt><span class="sect2"><a href=
1.38 dillo 1568: "#other-environmental-considerations">6.3.2.
1.30 wiz 1569: Other environmental
1.1 grant 1570: considerations</a></span></dt>
1571:
1572: <dt><span class="sect2"><a href=
1.38 dillo 1573: "#operation">6.3.3. Operation</a></span></dt>
1.1 grant 1574:
1575: <dt><span class="sect2"><a href=
1.38 dillo 1576: "#what-it-does">6.3.4. What it
1.30 wiz 1577: does</a></span></dt>
1.1 grant 1578:
1579: <dt><span class="sect2"><a href=
1.38 dillo 1580: "#disk-space-requirements">6.3.5. Disk space
1.1 grant 1581: requirements</a></span></dt>
1582:
1583: <dt><span class="sect2"><a href=
1.38 dillo 1584: "#setting-up-a-sandbox">6.3.6. Setting up a
1.47 reed 1585: sandbox for chrooted builds</a></span></dt>
1.1 grant 1586:
1587: <dt><span class="sect2"><a href=
1.38 dillo 1588: "#building-a-partial-set">6.3.7. Building a
1.30 wiz 1589: partial set of packages</a></span></dt>
1.13 hubertf 1590:
1591: <dt><span class="sect2"><a href=
1.38 dillo 1592: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 1593: build</a></span></dt>
1.1 grant 1594: </dl>
1595: </dd>
1596:
1.30 wiz 1597: <dt><span class="sect1"><a href=
1.38 dillo 1598: "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30 wiz 1599: packages collection</a></span></dt>
1.1 grant 1600:
1601: <dd>
1602: <dl>
1603: <dt><span class="sect2"><a href=
1.38 dillo 1604: "#cdpack-example">6.4.1. Example of
1.1 grant 1605: cdpack</a></span></dt>
1606: </dl>
1607: </dd>
1608: </dl>
1609: </dd>
1610:
1.38 dillo 1611: <dt><span class="chapter"><a href="#faq">7. Frequently
1.1 grant 1612: Asked Questions</a></span></dt>
1613:
1614: <dd>
1615: <dl>
1.30 wiz 1616: <dt><span class="sect1"><a href=
1.38 dillo 1617: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 1618: lists for pkg-related discussion?</a></span></dt>
1.1 grant 1619:
1.38 dillo 1620: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 1621: Where's the pkgviews documentation?</a></span></dt>
1622:
1.38 dillo 1623: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 1624: Utilities for package management
1625: (pkgtools)</a></span></dt>
1626:
1.30 wiz 1627: <dt><span class="sect1"><a href=
1.38 dillo 1628: "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30 wiz 1629: non-root</a></span></dt>
1.1 grant 1630:
1.30 wiz 1631: <dt><span class="sect1"><a href=
1.38 dillo 1632: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 1633: fetching distfiles?</a></span></dt>
1.14 xtraeme 1634:
1.30 wiz 1635: <dt><span class="sect1"><a href=
1.38 dillo 1636: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 1637: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 1638:
1.30 wiz 1639: <dt><span class="sect1"><a href=
1.38 dillo 1640: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 1641: from pkgsrc?</a></span></dt>
1.1 grant 1642:
1.30 wiz 1643: <dt><span class="sect1"><a href=
1.38 dillo 1644: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 1645: behind a firewall</a></span></dt>
1.1 grant 1646:
1.38 dillo 1647: <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.30 wiz 1648: How do I tell <span><strong class="command">make
1.14 xtraeme 1649: fetch</strong></span> to do passive
1.1 grant 1650: FTP?</a></span></dt>
1651:
1.30 wiz 1652: <dt><span class="sect1"><a href=
1.38 dillo 1653: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 1654: distfiles at once</a></span></dt>
1.1 grant 1655:
1.30 wiz 1656: <dt><span class="sect1"><a href=
1.38 dillo 1657: "#tmac.andoc-missing">7.11. What does
1.30 wiz 1658: “<span class="quote">Don't know how to make
1659: /usr/share/tmac/tmac.andoc</span>”
1.14 xtraeme 1660: mean?</a></span></dt>
1.13 hubertf 1661:
1.30 wiz 1662: <dt><span class="sect1"><a href=
1.38 dillo 1663: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 1664: “<span class="quote">Could not find
1.14 xtraeme 1665: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 1666:
1.30 wiz 1667: <dt><span class="sect1"><a href=
1.38 dillo 1668: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 1669: pkgsrc</a></span></dt>
1.1 grant 1670:
1.38 dillo 1671: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 1672: do I change the location of configuration
1673: files?</a></span></dt>
1.1 grant 1674:
1675: <dt><span class="sect1"><a href=
1.38 dillo 1676: "#audit-packages">7.15. Automated security
1.1 grant 1677: checks</a></span></dt>
1678: </dl>
1679: </dd>
1680: </dl>
1681: </div>
1682:
1.59 rillig 1683: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 1684: <div class="titlepage">
1685: <div>
1686: <div>
1.59 rillig 1687: <h2 class="title"><a name="getting" id=
1.1 grant 1688: "getting"></a>Chapter 2. Where to get
1.59 rillig 1689: pkgsrc and how to keep it up-to-date</h2>
1.1 grant 1690: </div>
1691: </div>
1692: </div>
1693:
1694: <div class="toc">
1695: <p><b>Table of Contents</b></p>
1696:
1697: <dl>
1.30 wiz 1698: <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1 grant 1699: tar file</a></span></dt>
1700:
1.30 wiz 1701: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1702: SUP</a></span></dt>
1703:
1.30 wiz 1704: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1705: CVS</a></span></dt>
1.59 rillig 1706:
1707: <dt><span class="sect1"><a href="#uptodate-cvs">2.4.
1708: Keeping pkgsrc up-to-date via CVS</a></span></dt>
1.1 grant 1709: </dl>
1710: </div>
1711:
1712: <p>There are three ways to get pkgsrc. Either as a tar
1713: file, via SUP, or via CVS. All three ways are described
1714: here.</p>
1715:
1.59 rillig 1716: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 1717: <div class="titlepage">
1718: <div>
1719: <div>
1720: <h2 class="title" style="clear: both"><a name=
1.59 rillig 1721: "as-tar-file" id="as-tar-file"></a>2.1. As tar
1722: file</h2>
1.1 grant 1723: </div>
1724: </div>
1725: </div>
1726:
1727: <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
1728: file from <a href=
1.11 ben 1729: "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20 ben 1730: target="_top">ftp.NetBSD.org</a> and unpack it into
1.45 wiz 1731: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
1732: class="filename">/usr/pkgsrc</code>.</p>
1.1 grant 1733: </div>
1734:
1.59 rillig 1735: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 1736: <div class="titlepage">
1737: <div>
1738: <div>
1739: <h2 class="title" style="clear: both"><a name=
1.59 rillig 1740: "via-sup" id="via-sup"></a>2.2. Via SUP</h2>
1.1 grant 1741: </div>
1742: </div>
1743: </div>
1744:
1745: <p>As an alternative to the tar file, you can get pkgsrc
1746: via the Software Update Protocol, SUP. To do so, make
1747: sure your supfile has a line</p>
1748: <pre class="programlisting">
1.51 rillig 1749: release=pkgsrc
1.1 grant 1750: </pre>
1751:
1.45 wiz 1752: <p>in it, see the examples in <code xmlns=
1753: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1754: "filename">/usr/share/examples/supfiles</code>, and that
1.45 wiz 1755: the <code xmlns=
1756: "http://www.w3.org/TR/xhtml1/transitional" class=
1757: "filename">/usr/pkgsrc</code> directory exists. Then,
1758: simply run <span><strong class="command">sup -v
1759: <em class="replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1 grant 1760: </div>
1761:
1.59 rillig 1762: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 1763: <div class="titlepage">
1764: <div>
1765: <div>
1766: <h2 class="title" style="clear: both"><a name=
1.59 rillig 1767: "via-cvs" id="via-cvs"></a>2.3. Via CVS</h2>
1.1 grant 1768: </div>
1769: </div>
1770: </div>
1771:
1772: <p>To get pkgsrc via CVS, make sure you have
1773: “<span class="quote">cvs</span>” installed.
1.27 rillig 1774: To do an initial (full) checkout of pkgsrc, do the
1775: following steps:</p>
1.1 grant 1776: <pre class="screen">
1.14 xtraeme 1777: <code class="prompt">%</code> <strong class=
1778: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
1779: <code class="prompt">%</code> <strong class=
1780: "userinput"><code>setenv CVS_RSH ssh</code></strong>
1781: <code class="prompt">%</code> <strong class=
1782: "userinput"><code>cd /usr</code></strong>
1783: <code class="prompt">%</code> <strong class=
1784: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
1785: </pre>
1786:
1.45 wiz 1787: <p>This will create the <code xmlns=
1788: "http://www.w3.org/TR/xhtml1/transitional" class=
1789: "filename">pkgsrc</code> directory in your <code xmlns=
1790: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1791: "filename">/usr</code>, and all the package source will
1.45 wiz 1792: be stored under <code xmlns=
1793: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1794: "filename">/usr/pkgsrc</code>. To update pkgsrc after the
1795: initial checkout, make sure you have <code class=
1796: "varname">CVS_RSH</code> set as above, then do:</p>
1.1 grant 1797: <pre class="screen">
1.14 xtraeme 1798: <code class="prompt">%</code> <strong class=
1799: "userinput"><code>cd /usr/pkgsrc</code></strong>
1800: <code class="prompt">%</code> <strong class=
1801: "userinput"><code>cvs -q update -dP</code></strong>
1.1 grant 1802: </pre>
1803:
1804: <p>Please also note that it is possible to have multiple
1805: copies of the pkgsrc hierarchy in use at any one time -
1806: all work is done relatively within the pkgsrc tree.</p>
1807: </div>
1.59 rillig 1808:
1809: <div class="sect1" lang="en" xml:lang="en">
1810: <div class="titlepage">
1811: <div>
1812: <div>
1813: <h2 class="title" style="clear: both"><a name=
1814: "uptodate-cvs" id=
1815: "uptodate-cvs"></a>2.4. Keeping pkgsrc
1816: up-to-date via CVS</h2>
1817: </div>
1818: </div>
1819: </div>
1820:
1821: <p>If your copy of pkgsrc contains a lot of <code xmlns=
1822: "http://www.w3.org/TR/xhtml1/transitional" class=
1823: "filename">CVS</code> directories, you can update it
1824: using the <a href=
1825: "http://netbsd.gw.com/cgi-bin/man-cgi?cvs+1+NetBSD-current">
1826: <span class="citerefentry"><span class=
1827: "refentrytitle">cvs</span>(1)</span></a> program. First,
1828: <span><strong class="command">cd</strong></span> to the
1829: top level directory of pkgsrc. Then run
1830: <span><strong class="command">cvs -q update
1831: -dP</strong></span>, and you're done.</p>
1832:
1833: <p>If that doesn't work and the file <code xmlns=
1834: "http://www.w3.org/TR/xhtml1/transitional" class=
1835: "filename">CVS/Root</code> contains the string
1836: “<span class="quote">:pserver:</span>”, you
1837: have to run <span><strong class="command">cvs
1838: login</strong></span> once to get known to the NetBSD CVS
1839: server. The <span><strong class=
1840: "command">cvs</strong></span> utility will then ask you
1841: for a password. Just enter “<span class=
1842: "quote">anoncvs</span>”. Then try again to
1843: update.</p>
1844: </div>
1.1 grant 1845: </div>
1846:
1.59 rillig 1847: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 1848: <div class="titlepage">
1849: <div>
1850: <div>
1.59 rillig 1851: <h2 class="title"><a name="platforms" id=
1.1 grant 1852: "platforms"></a>Chapter 3. Using pkgsrc on
1853: systems other than NetBSD</h2>
1854: </div>
1855: </div>
1856: </div>
1857:
1858: <div class="toc">
1859: <p><b>Table of Contents</b></p>
1860:
1861: <dl>
1.30 wiz 1862: <dt><span class="sect1"><a href=
1863: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1864: pkgsrc</a></span></dt>
1.1 grant 1865:
1.30 wiz 1866: <dt><span class="sect1"><a href=
1.47 reed 1867: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 1868: notes</a></span></dt>
1.1 grant 1869:
1870: <dd>
1871: <dl>
1.30 wiz 1872: <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1 grant 1873: Darwin (Mac OS X)</a></span></dt>
1874:
1.30 wiz 1875: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1 grant 1876: FreeBSD</a></span></dt>
1877:
1.30 wiz 1878: <dt><span class="sect2"><a href="#interix">3.2.3.
1.1 grant 1879: Interix</a></span></dt>
1880:
1.30 wiz 1881: <dt><span class="sect2"><a href="#irix">3.2.4.
1.1 grant 1882: IRIX</a></span></dt>
1883:
1.30 wiz 1884: <dt><span class="sect2"><a href="#linux">3.2.5.
1.22 tv 1885: Linux</a></span></dt>
1886:
1.30 wiz 1887: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1 grant 1888: OpenBSD</a></span></dt>
1889:
1.30 wiz 1890: <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1 grant 1891: Solaris</a></span></dt>
1892: </dl>
1893: </dd>
1894: </dl>
1895: </div>
1896:
1.59 rillig 1897: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 1898: <div class="titlepage">
1899: <div>
1900: <div>
1901: <h2 class="title" style="clear: both"><a name=
1.59 rillig 1902: "bootstrapping-pkgsrc" id=
1.30 wiz 1903: "bootstrapping-pkgsrc"></a>3.1. Bootstrapping
1904: pkgsrc</h2>
1.1 grant 1905: </div>
1906: </div>
1907: </div>
1908:
1.27 rillig 1909: <p>For operating systems other than NetBSD, we provide a
1.1 grant 1910: bootstrap kit to build the required tools to use pkgsrc
1911: on your platform. Besides support for native NetBSD,
1912: pkgsrc and the bootstrap kit have support for the
1913: following operating systems:</p>
1914:
1915: <div class="itemizedlist">
1916: <ul type="disc">
1917: <li>
1918: <p>Darwin (Mac OS X)</p>
1919: </li>
1920:
1921: <li>
1.16 grant 1922: <p>DragonFlyBSD</p>
1923: </li>
1924:
1925: <li>
1.1 grant 1926: <p>FreeBSD</p>
1927: </li>
1928:
1929: <li>
1930: <p>Interix (Windows 2000, XP, 2003)</p>
1931: </li>
1932:
1933: <li>
1934: <p>IRIX</p>
1935: </li>
1936:
1937: <li>
1938: <p>Linux</p>
1939: </li>
1940:
1941: <li>
1942: <p>OpenBSD</p>
1943: </li>
1944:
1945: <li>
1946: <p>Solaris</p>
1947: </li>
1.16 grant 1948:
1949: <li>
1950: <p>Tru64 (Digital UNIX/OSF1)</p>
1951: </li>
1.1 grant 1952: </ul>
1953: </div>
1954:
1955: <p>Support for other platforms is under development.</p>
1956:
1957: <p>Installing the bootstrap kit should be as simple
1958: as:</p>
1959: <pre class="screen">
1.14 xtraeme 1960: <code class="prompt">#</code> <strong class=
1961: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
1962: <code class="prompt">#</code> <strong class=
1963: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1964: <code class="prompt">#</code> <strong class=
1965: "userinput"><code>./bootstrap</code></strong>
1.1 grant 1966: </pre>
1967:
1968: <p>See <a href="#getting" title=
1.59 rillig 1969: "Chapter 2. Where to get pkgsrc and how to keep it up-to-date">
1970: Chapter 2, <i>Where to get pkgsrc and how to keep it
1971: up-to-date</i></a> for other ways to get pkgsrc before
1972: bootstrapping. The given <span><strong class=
1973: "command">bootstrap</strong></span> command will use the
1974: defaults of <code xmlns=
1.45 wiz 1975: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1976: "filename">/usr/pkg</code> for the <span class=
1977: "emphasis"><em>prefix</em></span> where programs will be
1.45 wiz 1978: installed in, and <code xmlns=
1979: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1980: "filename">/var/db/pkg</code> for the package database
1.27 rillig 1981: directory where pkgsrc will do its internal bookkeeping.
1.1 grant 1982: However, these can also be set using command-line
1.27 rillig 1983: arguments.</p>
1.1 grant 1984:
1985: <p>Binary packages for the pkgsrc tools and an initial
1986: set of packages is available for supported platforms. An
1987: up-to-date list of these can be found on <a href=
1988: "http://www.pkgsrc.org/" target=
1989: "_top">www.pkgsrc.org</a>.</p>
1.47 reed 1990:
1991: <div class="note" style=
1992: "margin-left: 0.5in; margin-right: 0.5in;">
1993: <h3 class="title">Note</h3>
1994:
1995: <p>The bootstrap installs a <span><strong class=
1996: "command">bmake</strong></span> tool. Use this
1997: <span><strong class="command">bmake</strong></span>
1998: when building via pkgsrc. For examples in this guide,
1999: use <span><strong class="command">bmake</strong></span>
2000: instead of “<span class=
2001: "quote">make</span>”.</p>
2002: </div>
1.1 grant 2003: </div>
2004:
1.59 rillig 2005: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 2006: <div class="titlepage">
2007: <div>
2008: <div>
2009: <h2 class="title" style="clear: both"><a name=
1.59 rillig 2010: "platform-specific-notes" id=
1.47 reed 2011: "platform-specific-notes"></a>3.2. Platform-specific
2012: notes</h2>
1.1 grant 2013: </div>
2014: </div>
2015: </div>
2016:
2017: <p>Here are some platform-specific notes you should be
2018: aware of.</p>
2019:
1.59 rillig 2020: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 2021: <div class="titlepage">
2022: <div>
2023: <div>
1.59 rillig 2024: <h3 class="title"><a name="darwin" id=
1.30 wiz 2025: "darwin"></a>3.2.1. Darwin (Mac OS X)</h3>
1.1 grant 2026: </div>
2027: </div>
2028: </div>
2029:
2030: <p>Darwin 5.x and 6.x are supported. There are two
2031: methods of using pkgsrc on Mac OS X, by using a
2032: <a href="#platform.osx-image" title=
2033: "3.2.1.1. Using a disk image">disk image</a>, or a
2034: <a href="#platform.osx-ufs" title=
2035: "3.2.1.2. Using a UFS partition">UFS
2036: partition</a>.</p>
2037:
2038: <p>Before you start, you will need to download and
2039: install the Mac OS X Developer Tools from Apple's
2040: Developer Connection. See <a href=
2041: "http://developer.apple.com/macosx/" target=
2042: "_top">http://developer.apple.com/macosx/</a> for
2043: details. Also, make sure you install X11 for Mac OS X
2044: and the X11 SDK from <a href=
2045: "http://www.apple.com/macosx/x11/download/" target=
2046: "_top">http://www.apple.com/macosx/x11/download/</a> if
2047: you intend to build packages that use the X11 Window
2048: System.</p>
2049:
2050: <p>If you already have a UFS partition, or have a spare
2051: partition that you can format as UFS, it is recommended
2052: to use that instead of the disk image. It'll be
2053: somewhat faster and will mount automatically at boot
2054: time, where you must manually mount a disk image.</p>
2055:
2056: <div class="note" style=
2057: "margin-left: 0.5in; margin-right: 0.5in;">
2058: <h3 class="title">Note</h3>
2059:
2060: <p>You cannot use a HFS+ file system for pkgsrc,
1.47 reed 2061: because pkgsrc currently requires the file system to
1.1 grant 2062: be case-sensitive, and HFS+ is not.</p>
2063: </div>
2064:
1.59 rillig 2065: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 2066: <div class="titlepage">
2067: <div>
2068: <div>
1.59 rillig 2069: <h4 class="title"><a name="platform.osx-image"
2070: id="platform.osx-image"></a>3.2.1.1. Using
2071: a disk image</h4>
1.1 grant 2072: </div>
2073: </div>
2074: </div>
2075:
2076: <p>Create the disk image:</p>
2077: <pre class="screen">
1.14 xtraeme 2078: <code class="prompt">#</code> <strong class=
2079: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
2080: <code class="prompt">#</code> <strong class=
2081: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
2082: <code class="prompt">#</code> <strong class=
2083: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
2084: <code class="prompt">#</code> <strong class=
2085: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1 grant 2086: </pre>
2087:
2088: <p>That's it!</p>
2089: </div>
2090:
1.59 rillig 2091: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 2092: <div class="titlepage">
2093: <div>
2094: <div>
1.59 rillig 2095: <h4 class="title"><a name="platform.osx-ufs"
2096: id="platform.osx-ufs"></a>3.2.1.2. Using a
1.1 grant 2097: UFS partition</h4>
2098: </div>
2099: </div>
2100: </div>
2101:
1.45 wiz 2102: <p>By default, <code xmlns=
2103: "http://www.w3.org/TR/xhtml1/transitional" class=
2104: "filename">/usr</code> will be on your root file
2105: system, normally HFS+. It is possible to use the
2106: default <span class="emphasis"><em>prefix</em></span>
2107: of <code xmlns=
2108: "http://www.w3.org/TR/xhtml1/transitional" class=
2109: "filename">/usr/pkg</code> by symlinking <code xmlns=
2110: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2111: "filename">/usr/pkg</code> to a directory on a UFS
2112: file system. Obviously, another symlink is required
2113: if you want to place the package database directory
2114: outside the <span class=
2115: "emphasis"><em>prefix</em></span>. e.g.</p>
1.1 grant 2116: <pre class="screen">
1.14 xtraeme 2117: <code class="prompt">#</code> <strong class=
1.59 rillig 2118: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb</code></strong>
1.1 grant 2119: </pre>
2120:
2121: <p>If you created your partitions at the time of
2122: installing Mac OS X and formatted the target
2123: partition as UFS, it should automatically mount on
1.45 wiz 2124: <code xmlns=
2125: "http://www.w3.org/TR/xhtml1/transitional" class=
2126: "filename">/Volumes/<volume name></code> when
2127: the machine boots. If you are (re)formatting a
2128: partition as UFS, you need to ensure that the
2129: partition map correctly reflects “<span class=
2130: "quote">Apple_UFS</span>” and not
2131: “<span class=
1.1 grant 2132: "quote">Apple_HFS</span>”.</p>
2133:
2134: <p>The problem is that none of the disk tools will
2135: let you touch a disk that is booted from. You can
2136: unmount the partition, but even if you newfs it, the
2137: partition type will be incorrect and the automounter
2138: won't mount it. It can be mounted manually, but it
2139: won't appear in Finder.</p>
2140:
2141: <p>You'll need to boot off of the OS X Installation
2142: (User) CD. When the Installation program starts, go
2143: up to the menu and select Disk Utility. Now, you will
2144: be able to select the partition you want to be UFS,
2145: and Format it Apple UFS. Quit the Disk Utility, quit
2146: the installer which will reboot your machine. The new
2147: UFS file system will appear in Finder.</p>
2148:
2149: <p>Be aware that the permissions on the new file
2150: system will be writable by root only.</p>
2151:
2152: <p>This note is as of 10.2 (Jaguar) and applies to
2153: earlier versions. Hopefully Apple will fix Disk
2154: Utility in 10.3 (Panther).</p>
2155: </div>
2156: </div>
2157:
1.59 rillig 2158: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 2159: <div class="titlepage">
2160: <div>
2161: <div>
1.59 rillig 2162: <h3 class="title"><a name="freebsd" id=
1.30 wiz 2163: "freebsd"></a>3.2.2. FreeBSD</h3>
1.1 grant 2164: </div>
2165: </div>
2166: </div>
2167:
2168: <p>FreeBSD 4.7 and 5.0 have been tested and are
2169: supported, other versions may work.</p>
2170:
2171: <p>Care should be taken so that the tools that this kit
2172: installs do not conflict with the FreeBSD userland
2173: tools. There are several steps:</p>
2174:
2175: <div class="orderedlist">
2176: <ol type="1">
2177: <li>
2178: <p>FreeBSD stores its ports pkg database in
1.45 wiz 2179: <code xmlns=
2180: "http://www.w3.org/TR/xhtml1/transitional" class=
2181: "filename">/var/db/pkg</code>. It is therefore
2182: recommended that you choose a different location
2183: (e.g. <code xmlns=
2184: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2185: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2186: --pkgdbdir option to the bootstrap script.</p>
2187: </li>
2188:
2189: <li>
2190: <p>If you do not intend to use the FreeBSD ports
2191: tools, it's probably a good idea to move them out
2192: of the way to avoid confusion, e.g.</p>
2193: <pre class="screen">
1.14 xtraeme 2194: <code class="prompt">#</code> <strong class=
2195: "userinput"><code>cd /usr/sbin</code></strong>
2196: <code class="prompt">#</code> <strong class=
2197: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2198: <code class="prompt">#</code> <strong class=
2199: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2200: <code class="prompt">#</code> <strong class=
2201: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2202: <code class="prompt">#</code> <strong class=
2203: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2204: </pre>
2205: </li>
2206:
2207: <li>
1.45 wiz 2208: <p>An example <code xmlns=
2209: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2210: "filename">/etc/mk.conf</code> file will be
1.45 wiz 2211: placed in <code xmlns=
2212: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2213: "filename">/etc/mk.conf.example</code> file when
2214: you use the bootstrap script.</p>
1.1 grant 2215: </li>
2216: </ol>
2217: </div>
2218: </div>
2219:
1.59 rillig 2220: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 2221: <div class="titlepage">
2222: <div>
2223: <div>
1.59 rillig 2224: <h3 class="title"><a name="interix" id=
1.30 wiz 2225: "interix"></a>3.2.3. Interix</h3>
1.1 grant 2226: </div>
2227: </div>
2228: </div>
2229:
1.47 reed 2230: <p>Interix is a POSIX-compatible subsystem for the
1.1 grant 2231: Windows NT kernel, providing a Unix-like environment
2232: with a tighter kernel integration than available with
2233: Cygwin. It is part of the Windows Services for Unix
2234: package, available for free for any licensed copy of
1.22 tv 2235: Windows 2000, XP (not including XP Home), or 2003. SFU
2236: can be downloaded from <a href=
2237: "http://www.microsoft.com/windows/sfu/" target=
1.1 grant 2238: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
2239:
2240: <p>Services for Unix 3.5, current as of this writing,
2241: has been tested. 3.0 or 3.1 may work, but are not
2242: officially supported. (The main difference in 3.0/3.1
2243: is lack of pthreads.)</p>
2244:
1.59 rillig 2245: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 2246: <div class="titlepage">
2247: <div>
2248: <div>
2249: <h4 class="title"><a name=
1.59 rillig 2250: "platform.interix-sfu-install" id=
1.1 grant 2251: "platform.interix-sfu-install"></a>3.2.3.1. When
1.2 hubertf 2252: installing Interix/SFU</h4>
1.1 grant 2253: </div>
2254: </div>
2255: </div>
2256:
2257: <p>At an absolute minimum, the following packages
2258: must be installed from the Windows Services for Unix
2259: 3.5 distribution in order to use pkgsrc:</p>
2260:
2261: <div class="itemizedlist">
2262: <ul type="disc">
2263: <li>
2264: <p>Utilities -> Base Utilities</p>
2265: </li>
2266:
2267: <li>
2268: <p>Interix GNU Components -> (all)</p>
2269: </li>
2270:
2271: <li>
2272: <p>Remote Connectivity</p>
2273: </li>
2274:
2275: <li>
2276: <p>Interix SDK</p>
2277: </li>
2278: </ul>
2279: </div>
2280:
2281: <p>When using pkgsrc on Interix, DO NOT install the
2282: Utilities subcomponent "UNIX Perl". That is Perl 5.6
2283: without shared module support, installed to
2284: /usr/local, and will only cause confusion. Instead,
2285: install Perl 5.8 from pkgsrc (or from a binary
2286: package).</p>
2287:
2288: <p>The Remote Connectivity subcomponent "Windows
2289: Remote Shell Service" does not need to be installed,
2290: but Remote Connectivity itself should be installed in
2291: order to have a working inetd.</p>
2292:
1.52 tv 2293: <p>During installation you may be asked whether to
2294: enable setuid behavior for Interix programs, and
2295: whether to make pathnames default to case-sensitive.
2296: Setuid should be enabled, and case-sensitivity MUST
2297: be enabled. (Without case-sensitivity, a large number
2298: of packages including perl will not build.)</p>
2299:
2300: <p>NOTE: Newer Windows service packs change the way
2301: binary execution works (via the Data Execution
2302: Prevention feature). In order to use pkgsrc and other
2303: gcc-compiled binaries reliably, a hotfix containing
2304: POSIX.EXE, PSXDLL.DLL, PSXRUN.EXE, and PSXSS.EXE
2305: (899522 or newer) must be installed. Hotfixes are
2306: available from Microsoft through a support contract;
2307: however, a NetBSD developer has made most Interix
2308: hotfixes available for personal use from <a href=
2309: "http://www.duh.org/interix/hotfixes.php" target=
2310: "_top">http://www.duh.org/interix/hotfixes.php</a>.</p>
1.1 grant 2311: </div>
2312:
1.59 rillig 2313: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 2314: <div class="titlepage">
2315: <div>
2316: <div>
2317: <h4 class="title"><a name=
1.59 rillig 2318: "platform.interix-sfu-postinstall" id=
1.1 grant 2319: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
2320: to do if Interix/SFU is already installed</h4>
2321: </div>
2322: </div>
2323: </div>
2324:
2325: <p>If SFU is already installed and you wish to alter
2326: these settings to work with pkgsrc, note the
2327: following things.</p>
2328:
2329: <div class="itemizedlist">
2330: <ul type="disc">
2331: <li>
2332: <p>To uninstall UNIX Perl, use Add/Remove
2333: Programs, select Microsoft Windows Services for
2334: UNIX, then click Change. In the installer,
2335: choose Add or Remove, then uncheck
2336: Utilities->UNIX Perl.</p>
2337: </li>
2338:
2339: <li>
1.47 reed 2340: <p>To enable case-sensitivity for the file
2341: system, run REGEDIT.EXE, and change the
1.1 grant 2342: following registry key:</p>
2343:
2344: <p>
2345: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
2346: Manager\kernel</p>
2347:
2348: <p>Set the DWORD value "obcaseinsensitive" to
2349: 0; then reboot.</p>
2350: </li>
2351:
2352: <li>
2353: <p>To enable setuid binaries (optional), run
2354: REGEDIT.EXE, and change the following registry
2355: key:</p>
2356:
2357: <p>
2358: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
2359: for UNIX</p>
2360:
2361: <p>Set the DWORD value "EnableSetuidBinaries"
2362: to 1; then reboot.</p>
2363: </li>
2364: </ul>
2365: </div>
2366: </div>
2367:
1.59 rillig 2368: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 2369: <div class="titlepage">
2370: <div>
2371: <div>
2372: <h4 class="title"><a name=
1.59 rillig 2373: "platform.interix-notes" id=
1.1 grant 2374: "platform.interix-notes"></a>3.2.3.3. Important
2375: notes for using pkgsrc</h4>
2376: </div>
2377: </div>
2378: </div>
2379:
1.52 tv 2380: <p>The package manager (either the pkgsrc "su" user,
1.1 grant 2381: or the user running "pkg_add") must be a member of
2382: the local Administrators group. Such a user must also
2383: be used to run the bootstrap. This is slightly
2384: relaxed from the normal pkgsrc requirement of
2385: "root".</p>
2386:
2387: <p>The package manager should use a umask of 002.
2388: "make install" will automatically complain if this is
2389: not the case. This ensures that directories written
2390: in /var/db/pkg are Administrators-group
2391: writeable.</p>
2392:
2393: <p>The popular Interix binary packages from
2394: http://www.interopsystems.com/ use an older version
2395: of pkgsrc's pkg_* tools. Ideally, these should NOT be
2396: used in conjunction with pkgsrc. If you choose to use
2397: them at the same time as the pkgsrc packages, ensure
2398: that you use the proper pkg_* tools for each type of
2399: binary package.</p>
1.22 tv 2400:
2401: <p>The TERM setting used for DOS-type console windows
2402: (including those invoked by the csh and ksh startup
2403: shortcuts) is "interix". Most systems don't have a
2404: termcap/terminfo entry for it, but the following
2405: .termcap entry provides adequate emulation in most
2406: cases:</p>
2407: <pre class="programlisting">
1.51 rillig 2408: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
1.22 tv 2409: </pre>
1.1 grant 2410: </div>
1.52 tv 2411:
1.59 rillig 2412: <div class="sect3" lang="en" xml:lang="en">
1.52 tv 2413: <div class="titlepage">
2414: <div>
2415: <div>
2416: <h4 class="title"><a name=
1.59 rillig 2417: "platform.interix-limits" id=
1.52 tv 2418: "platform.interix-limits"></a>3.2.3.4. Limitations
2419: of the Interix platform</h4>
2420: </div>
2421: </div>
2422: </div>
2423:
2424: <p>Though Interix suffices as a familiar and flexible
2425: substitute for a full Unix-like platform, it has some
2426: drawbacks that should be noted for those desiring to
2427: make the most of Interix.</p>
2428:
2429: <div class="itemizedlist">
2430: <ul type="disc">
2431: <li>
1.54 tv 2432: <p><span class=
1.57 minskim 2433: "strong"><strong>X11:</strong></span></p>
1.52 tv 2434:
2435: <p>Interix comes with the standard set of X11R6
1.57 minskim 2436: client libraries, and can run X11 based
1.52 tv 2437: applications, but it does <span class=
2438: "emphasis"><em>not</em></span> come with an X
2439: server. Some options are <a href=
2440: "http://www.starnet.com/products/xwin32/"
2441: target="_top">StarNet X-Win32</a>, <a href=
2442: "http://connectivity.hummingbird.com/products/nc/exceed/"
1.57 minskim 2443: target="_top">Hummingbird Exceed</a> (available
2444: in a trimmed version for Interix from Interop
2445: Systems as the <a href=
2446: "http://www.interopsystems.com/InteropXserver.htm"
2447: target="_top">Interop X Server</a>), and the
2448: free X11 server included with <a href=
1.52 tv 2449: "http://x.cygwin.com/" target=
2450: "_top">Cygwin</a>.</p>
2451:
2452: <p>Also, StarNet Communications has graciously
2453: provided a free version of their X-Win32
2454: product that accepts connections only from
2455: localhost: <a href=
2456: "http://www.starnet.com/xwin32LX/get_xwin32LX.htm"
2457: target="_top">X-Win32 LX</a>, recommended by
2458: the maintainer of Interix pkgsrc support.</p>
2459: </li>
2460:
2461: <li>
1.57 minskim 2462: <p><span class="strong"><strong>X11
1.54 tv 2463: acceleration:</strong></span></p>
1.52 tv 2464:
2465: <p>Because Interix runs in a completely
2466: different NT subsystem from Win32 applications,
2467: it does not currently support various X11
2468: protocol extensions for acceleration (such as
2469: MIT-SHM or DGA). Most interactive applications
2470: to a local X server will run reasonably fast,
2471: but full motion video and other graphics
2472: intensive applications may require a
2473: faster-than-expected CPU.</p>
2474: </li>
2475:
2476: <li>
1.54 tv 2477: <p><span class=
2478: "strong"><strong>Audio:</strong></span></p>
1.52 tv 2479:
2480: <p>Interix has no native support for audio
1.53 tv 2481: output. For audio support, pkgsrc uses the
2482: <span><strong class=
1.52 tv 2483: "command">esound</strong></span> client/server
2484: audio system on Interix. Unlike on most
2485: platforms, the <a xmlns=
2486: "http://www.w3.org/TR/xhtml1/transitional"
2487: href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/esound/README.html"
2488: target="_top"><code xmlns="" class=
2489: "filename">audio/esound</code></a> package does
2490: <span class="emphasis"><em>not</em></span>
2491: contain the <span><strong class=
1.53 tv 2492: "command">esd</strong></span> server component.
2493: To output audio via an Interix host, the
2494: <a xmlns=
1.52 tv 2495: "http://www.w3.org/TR/xhtml1/transitional"
2496: href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/cygwin_esound/README.html"
2497: target="_top"><code xmlns="" class=
2498: "filename">emulators/cygwin_esound</code></a>
2499: package must also be installed.</p>
2500: </li>
2501:
2502: <li>
1.54 tv 2503: <p><span class="strong"><strong>CD/DVDs, USB,
2504: and SCSI:</strong></span></p>
1.52 tv 2505:
2506: <p>Direct device access is not currently
2507: supported in Interix, so it is not currently
2508: possible to access CD/DVD drives, USB devices,
2509: or SCSI devices through non-filesystem means.
2510: Among other things, this makes it impossible to
2511: use Interix directly for CD/DVD burning.</p>
2512: </li>
2513:
2514: <li>
1.54 tv 2515: <p><span class="strong"><strong>Tape
2516: drives:</strong></span></p>
1.52 tv 2517:
2518: <p>Due to the same limitations as for CD-ROMs
2519: and SCSI devices, tape drives are also not
2520: directly accessible in Interix. However,
2521: support is in work to make tape drive access
2522: possible by using Cygwin as a bridge (similarly
2523: to audio bridged via Cygwin's esound
2524: server).</p>
2525: </li>
2526: </ul>
2527: </div>
2528: </div>
2529:
1.59 rillig 2530: <div class="sect3" lang="en" xml:lang="en">
1.52 tv 2531: <div class="titlepage">
2532: <div>
2533: <div>
2534: <h4 class="title"><a name=
1.59 rillig 2535: "platform.interix-knownissues" id=
1.52 tv 2536: "platform.interix-knownissues"></a>3.2.3.5. Known
2537: issues for pkgsrc on Interix</h4>
2538: </div>
2539: </div>
2540: </div>
2541:
2542: <p>It is not necessary, in general, to have a "root"
2543: user on the Windows system; any member of the local
2544: Administrators group will suffice. However, some
2545: packages currently assume that the user named "root"
2546: is the privileged user. To accommodate these, you may
2547: create such a user; make sure it is in the local
2548: group Administrators (or your language
2549: equivalent).</p>
2550:
2551: <p>"pkg_add" creates directories of mode 0755, not
2552: 0775, in $PKG_DBDIR. For the time being, install
2553: packages as the local Administrator (or your language
2554: equivalent), or run the following command after
2555: installing a package to work around the issue:</p>
2556: <pre class="screen">
2557: <code class="prompt">#</code> <strong class=
2558: "userinput"><code>chmod -R g+w $PKG_DBDIR</code></strong>
2559: </pre>
2560: </div>
1.1 grant 2561: </div>
2562:
1.59 rillig 2563: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 2564: <div class="titlepage">
2565: <div>
2566: <div>
1.59 rillig 2567: <h3 class="title"><a name="irix" id=
1.30 wiz 2568: "irix"></a>3.2.4. IRIX</h3>
1.1 grant 2569: </div>
2570: </div>
2571: </div>
2572:
2573: <p>You will need a working C compiler, either gcc or
2574: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14 xtraeme 2575: the <code class="varname">CC</code> environment
2576: variable according to your preference. If you do not
2577: have a license for the MIPSpro compiler suite, you can
1.1 grant 2578: download a gcc tardist file from <a href=
2579: "http://freeware.sgi.com/" target=
2580: "_top">http://freeware.sgi.com/</a>.</p>
2581:
2582: <p>Please note that you will need IRIX 6.5.17 or
2583: higher, as this is the earliest version of IRIX
1.24 wiz 2584: providing support for <a href=
2585: "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
2586: <span class="citerefentry"><span class=
2587: "refentrytitle">if_indextoname</span>(3)</span></a>,
2588: <a href=
2589: "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
2590: <span class="citerefentry"><span class=
2591: "refentrytitle">if_nametoindex</span>(3)</span></a>,
2592: etc.</p>
1.1 grant 2593:
1.27 rillig 2594: <p>At this point in time, pkgsrc only supports one ABI
2595: at a time. That is, you can not switch between the old
2596: 32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
2597: you start out using "abi=n32", that's what all your
2598: packages will be built with.</p>
1.1 grant 2599:
2600: <p>Therefore, please make sure that you have no
1.14 xtraeme 2601: conflicting <code class="varname">CFLAGS</code> in your
1.45 wiz 2602: environment or the <code xmlns=
2603: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2604: "filename">/etc/mk.conf</code>. Particularly, make sure
1.1 grant 2605: that you do not try to link n32 object files with lib64
1.45 wiz 2606: or vice versa. Check your <code xmlns=
2607: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2608: "filename">/etc/compiler.defaults</code>!</p>
1.1 grant 2609:
2610: <p>If you have the actual pkgsrc tree mounted via NFS
2611: from a different host, please make sure to set
1.14 xtraeme 2612: <code class="varname">WRKOBJDIR</code> to a local
1.1 grant 2613: directory, as it appears that IRIX linker occasionally
1.47 reed 2614: runs into issues when trying to link over a
2615: network-mounted file system.</p>
1.1 grant 2616:
2617: <p>The bootstrapping process should set all the right
2618: options for programs such as imake(1), but you may want
2619: to set some options depending on your local setup.
1.45 wiz 2620: Please see <code xmlns=
2621: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2622: "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27 rillig 2623: course, your compiler's man pages for details.</p>
1.22 tv 2624:
2625: <p>If you are using SGI's MIPSPro compiler, please
2626: set</p>
2627: <pre class="programlisting">
1.51 rillig 2628: PKGSRC_COMPILER= mipspro
1.22 tv 2629: </pre>
2630:
1.45 wiz 2631: <p>in <code xmlns=
2632: "http://www.w3.org/TR/xhtml1/transitional" class=
2633: "filename">/etc/mk.conf</code>. Otherwise, pkgsrc will
2634: assume you are using gcc and may end up passing invalid
2635: flags to the compiler. Note that bootstrap should
2636: create an appropriate <code xmlns=
2637: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2638: "filename">mk.conf.example</code> by default.</p>
2639:
2640: <p>If you have both the MIPSPro compiler chain
2641: installed as well as gcc, but want to make sure that
2642: MIPRPro is used, please set your <code class=
2643: "varname">PATH</code> to <span class=
2644: "emphasis"><em>not</em></span> include the location of
1.45 wiz 2645: gcc (often <code xmlns=
2646: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2647: "filename">/usr/freeware/bin</code>), and (important)
2648: pass the '--preserve-path' flag.</p>
1.1 grant 2649: </div>
2650:
1.59 rillig 2651: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 2652: <div class="titlepage">
2653: <div>
2654: <div>
1.59 rillig 2655: <h3 class="title"><a name="linux" id=
1.30 wiz 2656: "linux"></a>3.2.5. Linux</h3>
1.22 tv 2657: </div>
2658: </div>
2659: </div>
2660:
2661: <p>Some versions of Linux (for example Debian
2662: GNU/Linux) need either libtermcap or libcurses
2663: (libncurses). Installing the distributions
2664: libncurses-dev package (or equivalent) should fix the
2665: problem.</p>
2666:
2667: <p>pkgsrc supports both gcc (GNU Compiler Collection)
2668: and icc (Intel C++ Compiler). gcc is the default. icc
2669: 8.0 and 8.1 on i386 have been tested.</p>
2670:
2671: <p>To bootstrap using icc, assuming the default icc
2672: installation directory:</p>
2673: <pre class="programlisting">
1.51 rillig 2674: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
2675: ac_cv___attribute__=yes ./bootstrap
1.22 tv 2676: </pre>
2677:
2678: <div class="note" style=
2679: "margin-left: 0.5in; margin-right: 0.5in;">
2680: <h3 class="title">Note</h3>
2681:
2682: <p>icc 8.1 needs the `-i-static' argument instead of
2683: -static-libcxa.</p>
2684: </div>
2685:
2686: <p>icc supports __attribute__, but the GNU configure
2687: test uses a nested function, which icc does not
2688: support. #undef'ing __attribute__ has the unfortunate
2689: side-effect of breaking many of the Linux header files,
2690: which cannot be compiled properly without
2691: __attribute__. The test must be overridden so that
2692: __attribute__ is assumed supported by the compiler.</p>
2693:
2694: <p>After bootstrapping, you should set <code class=
1.45 wiz 2695: "varname">PKGSRC_COMPILER</code> in <code xmlns=
2696: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2697: "filename">/etc/mk.conf</code>:</p>
2698: <pre class="programlisting">
1.51 rillig 2699: PKGSRC_COMPILER= icc
1.22 tv 2700: </pre>
2701:
2702: <p>The default installation directory for icc is
1.45 wiz 2703: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
2704: class="filename">/opt/intel_cc_80</code>, which is also
2705: the pkgsrc default. If you have installed it into a
2706: different directory, set <code class=
2707: "varname">ICCBASE</code> in <code xmlns=
2708: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2709: "filename">/etc/mk.conf</code>:</p>
2710: <pre class="programlisting">
1.51 rillig 2711: ICCBASE= /opt/icc
1.22 tv 2712: </pre>
2713:
2714: <p>pkgsrc uses the static linking method of the runtime
2715: libraries provided by icc, so binaries can be run on
2716: other systems which do not have the shared libraries
2717: installed.</p>
2718:
2719: <p>Libtool, however, extracts a list of libraries from
1.24 wiz 2720: the <a href=
2721: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
2722: <span class="citerefentry"><span class=
2723: "refentrytitle">ld</span>(1)</span></a> command run
2724: when linking a C++ shared library and records it,
2725: throwing away the -Bstatic and -Bdynamic options
2726: interspersed between the libraries. This means that
2727: libtool-linked C++ shared libraries will have a runtime
2728: dependency on the icc libraries until this is fixed in
2729: libtool.</p>
1.22 tv 2730: </div>
2731:
1.59 rillig 2732: <div class="sect2" lang="en" xml:lang="en">
1.22 tv 2733: <div class="titlepage">
2734: <div>
2735: <div>
1.59 rillig 2736: <h3 class="title"><a name="openbsd" id=
1.30 wiz 2737: "openbsd"></a>3.2.6. OpenBSD</h3>
1.1 grant 2738: </div>
2739: </div>
2740: </div>
2741:
2742: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
2743:
2744: <p>Care should be taken so that the tools that this kit
2745: installs do not conflict with the OpenBSD userland
2746: tools. There are several steps:</p>
2747:
2748: <div class="orderedlist">
2749: <ol type="1">
2750: <li>
2751: <p>OpenBSD stores its ports pkg database in
1.45 wiz 2752: <code xmlns=
2753: "http://www.w3.org/TR/xhtml1/transitional" class=
2754: "filename">/var/db/pkg</code>. It is therefore
2755: recommended that you choose a different location
2756: (e.g. <code xmlns=
2757: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2758: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2759: --pkgdbdir option to the bootstrap script.</p>
2760: </li>
2761:
2762: <li>
2763: <p>If you do not intend to use the OpenBSD ports
2764: tools, it's probably a good idea to move them out
2765: of the way to avoid confusion, e.g.</p>
2766: <pre class="screen">
1.14 xtraeme 2767: <code class="prompt">#</code> <strong class=
2768: "userinput"><code>cd /usr/sbin</code></strong>
2769: <code class="prompt">#</code> <strong class=
2770: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2771: <code class="prompt">#</code> <strong class=
2772: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2773: <code class="prompt">#</code> <strong class=
2774: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2775: <code class="prompt">#</code> <strong class=
2776: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2777: </pre>
2778: </li>
2779:
2780: <li>
1.45 wiz 2781: <p>An example <code xmlns=
2782: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2783: "filename">/etc/mk.conf</code> file will be
1.45 wiz 2784: placed in <code xmlns=
2785: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2786: "filename">/etc/mk.conf.example</code> file when
2787: you use the bootstrap script. OpenBSD's make
1.45 wiz 2788: program uses <code xmlns=
2789: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2790: "filename">/etc/mk.conf</code> as well. You can
1.47 reed 2791: work around this by enclosing all the
2792: pkgsrc-specific parts of the file with:</p>
1.1 grant 2793: <pre class="programlisting">
1.51 rillig 2794: .ifdef BSD_PKG_MK
2795: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
2796: .else
2797: # OpenBSD stuff
2798: .endif
1.1 grant 2799: </pre>
2800: </li>
2801: </ol>
2802: </div>
2803: </div>
2804:
1.59 rillig 2805: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 2806: <div class="titlepage">
2807: <div>
2808: <div>
1.59 rillig 2809: <h3 class="title"><a name="solaris" id=
1.30 wiz 2810: "solaris"></a>3.2.7. Solaris</h3>
1.1 grant 2811: </div>
2812: </div>
2813: </div>
2814:
2815: <p>Solaris 2.6 through 9 are supported on both x86 and
2816: sparc. You will need a working C compiler. Both gcc
2817: 2.95.3 and Sun WorkShop 5 have been tested.</p>
2818:
2819: <p>The following packages are required on Solaris 8 for
2820: the bootstrap process and to build packages.</p>
2821:
2822: <div class="itemizedlist">
2823: <ul type="disc">
2824: <li>
2825: <p>SUNWsprot</p>
2826: </li>
2827:
2828: <li>
2829: <p>SUNWarc</p>
2830: </li>
2831:
2832: <li>
2833: <p>SUNWbtool</p>
2834: </li>
2835:
2836: <li>
2837: <p>SUNWtoo</p>
2838: </li>
2839:
2840: <li>
2841: <p>SUNWlibm</p>
2842: </li>
2843: </ul>
2844: </div>
2845:
2846: <p>Please note the use of GNU binutils on Solaris is
2847: <span class="emphasis"><em>not</em></span>
2848: supported.</p>
2849:
1.59 rillig 2850: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 2851: <div class="titlepage">
2852: <div>
2853: <div>
1.59 rillig 2854: <h4 class="title"><a name="solaris-gcc-note"
2855: id="solaris-gcc-note"></a>3.2.7.1. If you
2856: are using gcc</h4>
1.1 grant 2857: </div>
2858: </div>
2859: </div>
2860:
2861: <p>It makes life much simpler if you only use the
2862: same gcc consistently for building all packages.</p>
2863:
2864: <p>It is recommended that an external gcc be used
2865: only for bootstrapping, then either build gcc from
2866: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
2867: href=
2868: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.45 wiz 2869: target="_top"><code xmlns="" class=
2870: "filename">lang/gcc</code></a> or install a binary
2871: gcc package, then remove gcc used during
1.20 ben 2872: bootstrapping.</p>
1.1 grant 2873:
2874: <p>Binary packages of gcc can be found through
2875: <a href=
2876: "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20 ben 2877: target=
2878: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1 grant 2879: </div>
2880:
1.59 rillig 2881: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 2882: <div class="titlepage">
2883: <div>
2884: <div>
1.30 wiz 2885: <h4 class="title"><a name=
1.59 rillig 2886: "solaris-sun-workshop-note" id=
1.30 wiz 2887: "solaris-sun-workshop-note"></a>3.2.7.2. If
2888: you are using Sun WorkShop</h4>
1.1 grant 2889: </div>
2890: </div>
2891: </div>
2892:
2893: <p>You will need at least the following packages
2894: installed (from WorkShop 5.0)</p>
2895:
2896: <div class="itemizedlist">
2897: <ul type="disc">
2898: <li>
2899: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
2900: </li>
2901:
2902: <li>
2903: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
2904: </li>
2905:
2906: <li>
2907: <p>SPROild - Sun WorkShop Incremental
2908: Linker</p>
2909: </li>
2910:
2911: <li>
2912: <p>SPROlang - Sun WorkShop Compilers common
2913: components</p>
2914: </li>
2915: </ul>
2916: </div>
2917:
1.14 xtraeme 2918: <p>You should set <code class="varname">CC</code>,
2919: <code class="varname">CXX</code> and optionally,
1.45 wiz 2920: <code class="varname">CPP</code> in <code xmlns=
2921: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 2922: "filename">/etc/mk.conf</code>, e.g.:</p>
1.1 grant 2923: <pre class="programlisting">
1.51 rillig 2924: CC= cc
2925: CXX= CC
2926: CPP= /usr/ccs/lib/cpp
1.1 grant 2927: </pre>
2928:
2929: <p>You may also want to build 64-bit binaries,
1.47 reed 2930: e.g.:</p>
1.1 grant 2931: <pre class="programlisting">
1.51 rillig 2932: CFLAGS= -xtarget=ultra -xarch=v9
1.1 grant 2933: </pre>
2934:
2935: <p>Whichever compiler you use, please ensure the
2936: compiler tools and your $prefix are in your
1.14 xtraeme 2937: <code class="varname">PATH</code>. This includes
1.45 wiz 2938: <code xmlns=
2939: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 2940: "filename">/usr/ccs/{bin,lib}</code> and e.g.
1.45 wiz 2941: <code xmlns=
2942: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2943: "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1 grant 2944: </div>
2945: </div>
2946: </div>
2947: </div>
2948:
1.59 rillig 2949: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 2950: <div class="titlepage">
2951: <div>
2952: <div>
1.59 rillig 2953: <h2 class="title"><a name="using" id=
1.1 grant 2954: "using"></a>Chapter 4. Using pkgsrc</h2>
2955: </div>
2956: </div>
2957: </div>
2958:
2959: <div class="toc">
2960: <p><b>Table of Contents</b></p>
2961:
2962: <dl>
2963: <dt><span class="sect1"><a href="#getting-started">4.1.
2964: Working with binary packages</a></span></dt>
2965:
2966: <dd>
2967: <dl>
1.30 wiz 2968: <dt><span class="sect2"><a href=
2969: "#where-to-get-binary-packages">4.1.1. Where to get
2970: binary packages</a></span></dt>
1.1 grant 2971:
1.30 wiz 2972: <dt><span class="sect2"><a href=
2973: "#how-to-use-binary-packages">4.1.2. How to use
2974: binary packages</a></span></dt>
1.1 grant 2975:
1.30 wiz 2976: <dt><span class="sect2"><a href=
2977: "#a-word-of-warning">4.1.3. A word of
2978: warning</a></span></dt>
1.1 grant 2979: </dl>
2980: </dd>
2981:
1.30 wiz 2982: <dt><span class="sect1"><a href=
2983: "#building-packages-from-source">4.2. Building packages
2984: from source</a></span></dt>
1.1 grant 2985:
2986: <dd>
2987: <dl>
1.30 wiz 2988: <dt><span class="sect2"><a href=
2989: "#requirements">4.2.1. Requirements</a></span></dt>
1.1 grant 2990:
1.30 wiz 2991: <dt><span class="sect2"><a href=
2992: "#fetching-distfiles">4.2.2. Fetching
2993: distfiles</a></span></dt>
1.1 grant 2994:
1.30 wiz 2995: <dt><span class="sect2"><a href=
2996: "#how-to-build-and-install">4.2.3. How to build and
2997: install</a></span></dt>
1.1 grant 2998:
1.30 wiz 2999: <dt><span class="sect2"><a href=
3000: "#selecting-the-compiler">4.2.4. Selecting the
3001: compiler</a></span></dt>
1.1 grant 3002: </dl>
3003: </dd>
3004: </dl>
3005: </div>
3006:
1.59 rillig 3007: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 3008: <div class="titlepage">
3009: <div>
3010: <div>
3011: <h2 class="title" style="clear: both"><a name=
1.59 rillig 3012: "getting-started" id=
1.1 grant 3013: "getting-started"></a>4.1. Working with binary
3014: packages</h2>
3015: </div>
3016: </div>
3017: </div>
3018:
3019: <p>This section describes how to find, retrieve and
3020: install a precompiled binary package that someone else
3021: already prepared for your type of machine.</p>
3022:
1.59 rillig 3023: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 3024: <div class="titlepage">
3025: <div>
3026: <div>
1.30 wiz 3027: <h3 class="title"><a name=
1.59 rillig 3028: "where-to-get-binary-packages" id=
1.30 wiz 3029: "where-to-get-binary-packages"></a>4.1.1. Where
3030: to get binary packages</h3>
1.1 grant 3031: </div>
3032: </div>
3033: </div>
3034:
3035: <p>Precompiled packages are stored on ftp.NetBSD.org
1.45 wiz 3036: and its mirrors in the directory <code xmlns=
3037: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 3038: "filename">/pub/NetBSD/packages/<OSVERSION>/<ARCH>/</code>
3039: for anonymous FTP access. <code class=
3040: "varname">OSVERSION</code> is the NetBSD version
3041: (<span><strong class="command">uname
3042: -r</strong></span>), <code class="varname">ARCH</code>
3043: is the architecture (<span><strong class=
3044: "command">uname -p</strong></span>). In that directory,
3045: there is a subdirectory for each category plus a
1.45 wiz 3046: subdirectory <code xmlns=
3047: "http://www.w3.org/TR/xhtml1/transitional" class=
3048: "filename">All</code> which includes the actual
3049: binaries in <code xmlns=
3050: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 3051: "filename">.tgz</code> files. The category
3052: subdirectories use symbolic links to those files (this
1.45 wiz 3053: is the same directory layout as in <code xmlns=
3054: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3055: "filename">/usr/pkgsrc/packages</code>).</p>
1.1 grant 3056:
1.47 reed 3057: <p>This same directory layout applies for CD-ROM
1.1 grant 3058: distributions, only that the directory may be rooted
1.45 wiz 3059: somewhere else, probably somewhere below <code xmlns=
3060: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 3061: "filename">/cdrom</code>. Please consult your CD-ROMs
1.1 grant 3062: documentation for the exact location.</p>
3063: </div>
3064:
1.59 rillig 3065: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 3066: <div class="titlepage">
3067: <div>
3068: <div>
1.30 wiz 3069: <h3 class="title"><a name=
1.59 rillig 3070: "how-to-use-binary-packages" id=
1.30 wiz 3071: "how-to-use-binary-packages"></a>4.1.2. How
3072: to use binary packages</h3>
1.1 grant 3073: </div>
3074: </div>
3075: </div>
3076:
1.47 reed 3077: <p>If you have the files on a CD-ROM or downloaded them
1.23 wiz 3078: to your hard disk, you can install them with the
1.27 rillig 3079: following command (be sure to <span><strong class=
1.14 xtraeme 3080: "command">su</strong></span> to root first):</p>
1.1 grant 3081: <pre class="screen">
1.14 xtraeme 3082: <code class="prompt">#</code> <strong class=
3083: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1 grant 3084: </pre>
3085:
3086: <p>If you have FTP access and you don't want to
3087: download the packages via FTP prior to installation,
1.14 xtraeme 3088: you can do this automatically by giving
3089: <span><strong class="command">pkg_add</strong></span>
3090: an FTP URL:</p>
1.1 grant 3091: <pre class="screen">
1.14 xtraeme 3092: <code class="prompt">#</code> <strong class=
1.27 rillig 3093: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSVERSION>/<ARCH>/All/package.tgz</code></strong>
1.1 grant 3094: </pre>
3095:
1.27 rillig 3096: <p>Note that any prerequisite packages needed to run
3097: the package in question will be installed, too,
1.1 grant 3098: assuming they are present where you install from.</p>
3099:
1.23 wiz 3100: <p>To save some typing, you can set the <code class=
3101: "varname">PKG_PATH</code> environment variable to a
1.47 reed 3102: semicolon-separated list of paths (including remote
1.23 wiz 3103: URLs); trailing slashes are not allowed.</p>
3104:
1.45 wiz 3105: <p>Additionally to the <code xmlns=
3106: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 3107: "filename">All</code> directory there exists a
1.45 wiz 3108: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3109: class="filename">vulnerable</code> directory to which
3110: binary packages with known vulnerabilities are moved,
3111: since removing them could cause missing dependencies.
3112: To use these packages, add the <code xmlns=
3113: "http://www.w3.org/TR/xhtml1/transitional" class=
3114: "filename">vulnerable</code> directory to your
3115: <code class="varname">PKG_PATH</code>. However, you
3116: should run <a xmlns=
1.23 wiz 3117: "http://www.w3.org/TR/xhtml1/transitional" href=
3118: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 3119: target="_top"><code xmlns="" class=
3120: "filename">security/audit-packages</code></a>
1.47 reed 3121: regularly, especially after installing new packages,
3122: and verify that the vulnerabilities are acceptable for
3123: your configuration. An example <code class=
3124: "varname">PKG_PATH</code> would be: <code xmlns=
3125: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 3126: "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 3127: Please note that semicolon (';') is a shell
3128: meta-character, so you'll probably have to quote
3129: it.</p>
3130:
1.1 grant 3131: <p>After you've installed packages, be sure to have
1.45 wiz 3132: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3133: class="filename">/usr/pkg/bin</code> and <code xmlns=
3134: "http://www.w3.org/TR/xhtml1/transitional" class=
3135: "filename">/usr/pkg/sbin</code> in your <code class=
3136: "varname">PATH</code> so you can actually start the
3137: just installed program.</p>
1.1 grant 3138: </div>
3139:
1.59 rillig 3140: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 3141: <div class="titlepage">
3142: <div>
3143: <div>
1.59 rillig 3144: <h3 class="title"><a name="a-word-of-warning" id=
1.30 wiz 3145: "a-word-of-warning"></a>4.1.3. A word of
1.1 grant 3146: warning</h3>
3147: </div>
3148: </div>
3149: </div>
3150:
3151: <p>Please pay very careful attention to the warnings
3152: expressed in the <a href=
3153: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3154: <span class="citerefentry"><span class=
3155: "refentrytitle">pkg_add</span>(1)</span></a> manual
3156: page about the inherent dangers of installing binary
3157: packages which you did not create yourself, and the
3158: security holes that can be introduced onto your system
3159: by indiscriminate adding of such files.</p>
3160: </div>
3161: </div>
3162:
1.59 rillig 3163: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 3164: <div class="titlepage">
3165: <div>
3166: <div>
3167: <h2 class="title" style="clear: both"><a name=
1.59 rillig 3168: "building-packages-from-source" id=
1.30 wiz 3169: "building-packages-from-source"></a>4.2. Building
1.1 grant 3170: packages from source</h2>
3171: </div>
3172: </div>
3173: </div>
3174:
3175: <p>This assumes that the package is already in pkgsrc. If
3176: it is not, see <a href="#developers-guide" title=
1.46 gdt 3177: "Part II. The pkgsrc developer's guide">Part II,
1.27 rillig 3178: “The pkgsrc developer's guide”</a> for
3179: instructions how to create your own packages.</p>
1.1 grant 3180:
1.59 rillig 3181: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 3182: <div class="titlepage">
3183: <div>
3184: <div>
1.59 rillig 3185: <h3 class="title"><a name="requirements" id=
1.30 wiz 3186: "requirements"></a>4.2.1. Requirements</h3>
1.1 grant 3187: </div>
3188: </div>
3189: </div>
3190:
3191: <p>To build packages from source on a NetBSD system the
3192: “<span class="quote">comp</span>” and the
3193: “<span class="quote">text</span>”
3194: distribution sets must be installed. If you want to
1.47 reed 3195: build X11-related packages the “<span class=
1.1 grant 3196: "quote">xbase</span>” and “<span class=
3197: "quote">xcomp</span>” distribution sets are
3198: required, too.</p>
3199: </div>
3200:
1.59 rillig 3201: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 3202: <div class="titlepage">
3203: <div>
3204: <div>
1.59 rillig 3205: <h3 class="title"><a name="fetching-distfiles"
3206: id="fetching-distfiles"></a>4.2.2. Fetching
1.1 grant 3207: distfiles</h3>
3208: </div>
3209: </div>
3210: </div>
3211:
1.27 rillig 3212: <p>The first step for building a package is downloading
3213: the distfiles (i.e. the unmodified source). If they
3214: have not yet been downloaded, pkgsrc will fetch them
1.1 grant 3215: automatically.</p>
3216:
3217: <p>You can overwrite some of the major distribution
3218: sites to fit to sites that are close to your own. Have
1.45 wiz 3219: a look at <code xmlns=
3220: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3221: "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27 rillig 3222: some examples — in particular, look for the
1.14 xtraeme 3223: <code class="varname">MASTER_SORT</code>, <code class=
3224: "varname">MASTER_SORT_REGEX</code> and <code class=
3225: "varname">INET_COUNTRY</code> definitions. This may
3226: save some of your bandwidth and time.</p>
1.1 grant 3227:
3228: <p>You can change these settings either in your shell's
3229: environment, or, if you want to keep the settings, by
1.45 wiz 3230: editing the <code xmlns=
3231: "http://www.w3.org/TR/xhtml1/transitional" class=
3232: "filename">/etc/mk.conf</code> file, and adding the
3233: definitions there.</p>
1.1 grant 3234:
3235: <p>If you don't have a permanent Internet connection
3236: and you want to know which files to download,
1.14 xtraeme 3237: <span><strong class="command">make
3238: fetch-list</strong></span> will tell you what you'll
1.45 wiz 3239: need. Put these distfiles into <code xmlns=
3240: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3241: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 3242: </div>
3243:
1.59 rillig 3244: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 3245: <div class="titlepage">
3246: <div>
3247: <div>
1.30 wiz 3248: <h3 class="title"><a name=
1.59 rillig 3249: "how-to-build-and-install" id=
1.30 wiz 3250: "how-to-build-and-install"></a>4.2.3. How to
3251: build and install</h3>
1.1 grant 3252: </div>
3253: </div>
3254: </div>
3255:
3256: <p>Assuming that the distfile has been fetched (see
3257: previous section), become root and change into the
1.47 reed 3258: relevant directory and run <span><strong class=
3259: "command">make</strong></span>.</p>
3260:
3261: <div class="note" style=
3262: "margin-left: 0.5in; margin-right: 0.5in;">
3263: <h3 class="title">Note</h3>
3264:
3265: <p>If using bootstrap or pkgsrc on a non-NetBSD
3266: system, use the pkgsrc <span><strong class=
3267: "command">bmake</strong></span> command instead of
3268: “<span class="quote">make</span>” in the
3269: examples in this guide.</p>
3270: </div>
3271:
3272: <p>For example, type</p>
1.1 grant 3273: <pre class="screen">
1.14 xtraeme 3274: <code class="prompt">%</code> <strong class=
3275: "userinput"><code>cd misc/figlet</code></strong>
3276: <code class="prompt">%</code> <strong class=
3277: "userinput"><code>make</code></strong>
1.1 grant 3278: </pre>
3279:
3280: <p>at the shell prompt to build the various components
3281: of the package, and</p>
3282: <pre class="screen">
1.14 xtraeme 3283: <code class="prompt">#</code> <strong class=
3284: "userinput"><code>make install</code></strong>
1.1 grant 3285: </pre>
3286:
3287: <p>to install the various components into the correct
3288: places on your system. Installing the package on your
3289: system requires you to be root. However, pkgsrc has a
3290: <span class="emphasis"><em>just-in-time-su</em></span>
3291: feature, which allows you to only become root for the
3292: actual installation step</p>
3293:
3294: <p>Taking the figlet utility as an example, we can
3295: install it on our system by building as shown in
3296: <a href="#logs" title=
1.59 rillig 3297: "Appendix B. Build logs">Appendix B, <i>Build
3298: logs</i></a>.</p>
1.1 grant 3299:
3300: <p>The program is installed under the default root of
1.45 wiz 3301: the packages tree - <code xmlns=
3302: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3303: "filename">/usr/pkg</code>. Should this not conform to
3304: your tastes, set the <code class=
3305: "varname">LOCALBASE</code> variable in your
1.1 grant 3306: environment, and it will use that value as the root of
1.45 wiz 3307: your packages tree. So, to use <code xmlns=
3308: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3309: "filename">/usr/local</code>, set <code class=
3310: "varname">LOCALBASE=/usr/local</code> in your
1.1 grant 3311: environment. Please note that you should use a
3312: directory which is dedicated to packages and not shared
1.47 reed 3313: with other programs (i.e., do not try and use
1.14 xtraeme 3314: <code class="varname">LOCALBASE=/usr</code>). Also, you
3315: should not try to add any of your own files or
1.45 wiz 3316: directories (such as <code xmlns=
3317: "http://www.w3.org/TR/xhtml1/transitional" class=
3318: "filename">src/</code>, <code xmlns=
3319: "http://www.w3.org/TR/xhtml1/transitional" class=
3320: "filename">obj/</code>, or <code xmlns=
3321: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3322: "filename">pkgsrc/</code>) below the <code class=
3323: "varname">LOCALBASE</code> tree. This is to prevent
1.1 grant 3324: possible conflicts between programs and other files
3325: installed by the package system and whatever else may
3326: have been installed there.</p>
3327:
1.45 wiz 3328: <p>Some packages look in <code xmlns=
3329: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3330: "filename">/etc/mk.conf</code> to alter some
1.1 grant 3331: configuration options at build time. Have a look at
1.45 wiz 3332: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3333: class="filename">pkgsrc/mk/defaults/mk.conf</code> to
3334: get an overview of what will be set there by default.
1.14 xtraeme 3335: Environment variables such as <code class=
1.45 wiz 3336: "varname">LOCALBASE</code> can be set in <code xmlns=
3337: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3338: "filename">/etc/mk.conf</code> to save having to
3339: remember to set them each time you want to use
3340: pkgsrc.</p>
1.1 grant 3341:
3342: <p>Occasionally, people want to “<span class=
3343: "quote">look under the covers</span>” to see what
3344: is going on when a package is building or being
3345: installed. This may be for debugging purposes, or out
3346: of simple curiosity. A number of utility values have
3347: been added to help with this.</p>
3348:
3349: <div class="orderedlist">
3350: <ol type="1">
3351: <li>
3352: <p>If you invoke the <a href=
3353: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3354: <span class="citerefentry"><span class=
3355: "refentrytitle">make</span>(1)</span></a> command
1.14 xtraeme 3356: with <code class=
3357: "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
3358: amount of information will be displayed. For
3359: example,</p>
1.1 grant 3360: <pre class="screen">
1.14 xtraeme 3361: <strong class=
3362: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1 grant 3363: </pre>
3364:
3365: <p>will show all the commands that are invoked,
3366: up to and including the “<span class=
3367: "quote">patch</span>” stage.</p>
3368: </li>
3369:
3370: <li>
3371: <p>If you want to know the value of a certain
1.22 tv 3372: <a href=
3373: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3374: <span class="citerefentry"><span class=
3375: "refentrytitle">make</span>(1)</span></a>
3376: definition, then the <code class=
1.14 xtraeme 3377: "varname">VARNAME</code> definition should be
3378: used, in conjunction with the show-var target.
3379: e.g. to show the expansion of the <a href=
1.1 grant 3380: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3381: <span class="citerefentry"><span class=
3382: "refentrytitle">make</span>(1)</span></a>
1.14 xtraeme 3383: variable <code class=
1.22 tv 3384: "varname">LOCALBASE</code>:</p>
1.1 grant 3385: <pre class="screen">
1.14 xtraeme 3386: <code class="prompt">%</code> <strong class=
3387: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1 grant 3388: /usr/pkg
1.14 xtraeme 3389: <code class="prompt">%</code>
1.1 grant 3390:
3391: </pre>
3392: </li>
3393: </ol>
3394: </div>
3395:
3396: <p>If you want to install a binary package that you've
3397: either created yourself (see next section), that you
3398: put into pkgsrc/packages manually or that is located on
1.8 wiz 3399: a remote FTP server, you can use the "bin-install"
1.1 grant 3400: target. This target will install a binary package - if
3401: available - via <a href=
3402: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3403: <span class="citerefentry"><span class=
3404: "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14 xtraeme 3405: <span><strong class="command">make
3406: package</strong></span>. The list of remote FTP sites
3407: searched is kept in the variable <code class=
3408: "varname">BINPKG_SITES</code>, which defaults to
3409: ftp.NetBSD.org. Any flags that should be added to
3410: <a href=
1.1 grant 3411: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3412: <span class="citerefentry"><span class=
3413: "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14 xtraeme 3414: into <code class="varname">BIN_INSTALL_FLAGS</code>.
1.45 wiz 3415: See <code xmlns=
3416: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3417: "filename">pkgsrc/mk/defaults/mk.conf</code> for more
3418: details.</p>
1.1 grant 3419:
1.47 reed 3420: <p>A final word of warning: If you set up a system that
1.14 xtraeme 3421: has a non-standard setting for <code class=
3422: "varname">LOCALBASE</code>, be sure to set that before
1.1 grant 3423: any packages are installed, as you can not use several
3424: directories for the same purpose. Doing so will result
3425: in pkgsrc not being able to properly detect your
3426: installed packages, and fail miserably. Note also that
3427: precompiled binary packages are usually built with the
1.14 xtraeme 3428: default <code class="varname">LOCALBASE</code> of
1.45 wiz 3429: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3430: class="filename">/usr/pkg</code>, and that you should
3431: <span class="emphasis"><em>not</em></span> install any
3432: if you use a non-standard <code class=
1.14 xtraeme 3433: "varname">LOCALBASE</code>.</p>
1.1 grant 3434: </div>
3435:
1.59 rillig 3436: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 3437: <div class="titlepage">
3438: <div>
3439: <div>
1.30 wiz 3440: <h3 class="title"><a name=
1.59 rillig 3441: "selecting-the-compiler" id=
1.30 wiz 3442: "selecting-the-compiler"></a>4.2.4. Selecting
3443: the compiler</h3>
1.1 grant 3444: </div>
3445: </div>
3446: </div>
3447:
3448: <p>By default, pkgsrc will use GCC to build packages.
3449: This may be overridden by setting the following
3450: variables in /etc/mk.conf:</p>
3451:
3452: <div class="variablelist">
3453: <dl>
1.14 xtraeme 3454: <dt><span class="term"><code class=
3455: "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1 grant 3456:
3457: <dd>
3458: <p>This is a list of values specifying the chain
3459: of compilers to invoke when building packages.
3460: Valid values are:</p>
3461:
3462: <div class="itemizedlist">
3463: <ul type="disc">
3464: <li>
1.14 xtraeme 3465: <p><code class="varname">distcc</code>:
1.1 grant 3466: distributed C/C++ (chainable)</p>
3467: </li>
3468:
3469: <li>
1.14 xtraeme 3470: <p><code class="varname">ccache</code>:
1.1 grant 3471: compiler cache (chainable)</p>
3472: </li>
3473:
3474: <li>
1.14 xtraeme 3475: <p><code class="varname">gcc</code>: GNU
3476: C/C++ Compiler</p>
1.1 grant 3477: </li>
3478:
3479: <li>
1.14 xtraeme 3480: <p><code class="varname">mipspro</code>:
1.1 grant 3481: Silicon Graphics, Inc. MIPSpro
3482: (n32/n64)</p>
3483: </li>
3484:
3485: <li>
1.14 xtraeme 3486: <p><code class="varname">mipspro</code>:
1.1 grant 3487: Silicon Graphics, Inc. MIPSpro (o32)</p>
3488: </li>
3489:
3490: <li>
1.14 xtraeme 3491: <p><code class="varname">sunpro</code>:
1.1 grant 3492: Microsystems, Inc. WorkShip/Forte/Sun ONE
3493: Studio</p>
3494: </li>
3495: </ul>
3496: </div>
3497:
3498: <p>The default is “<span class=
1.14 xtraeme 3499: "quote"><code class=
3500: "varname">gcc</code></span>”. You can use
3501: <code class="varname">ccache</code> and/or
3502: <code class="varname">distcc</code> with an
3503: appropriate <code class=
3504: "varname">PKGSRC_COMPILER</code> setting, e.g.
3505: “<span class="quote"><code class=
3506: "varname">ccache gcc</code></span>”. This
1.1 grant 3507: variable should always be terminated with a value
3508: for a real compiler.</p>
3509: </dd>
3510:
1.14 xtraeme 3511: <dt><span class="term"><code class=
3512: "varname">GCC_REQD</code>:</span></dt>
1.1 grant 3513:
3514: <dd>
3515: <p>This specifies the minimum version of GCC to
3516: use when building packages. If the system GCC
3517: doesn't satisfy this requirement, then pkgsrc
3518: will build and install one of the GCC packages to
3519: use instead.</p>
3520: </dd>
3521: </dl>
3522: </div>
3523: </div>
3524: </div>
3525: </div>
3526:
1.59 rillig 3527: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 3528: <div class="titlepage">
3529: <div>
3530: <div>
1.59 rillig 3531: <h2 class="title"><a name="configuring" id=
1.38 dillo 3532: "configuring"></a>Chapter 5. Configuring
3533: pkgsrc</h2>
3534: </div>
3535: </div>
3536: </div>
3537:
3538: <div class="toc">
3539: <p><b>Table of Contents</b></p>
3540:
3541: <dl>
3542: <dt><span class="sect1"><a href=
1.45 wiz 3543: "#general-configuration">5.1. General
3544: configuration</a></span></dt>
3545:
3546: <dt><span class="sect1"><a href=
3547: "#variables-affecting-build">5.2. Variables affecting
3548: the build process</a></span></dt>
3549:
3550: <dt><span class="sect1"><a href=
3551: "#developer-advanced-settings">5.3. Developer/advanced
3552: settings</a></span></dt>
3553:
3554: <dt><span class="sect1"><a href=
3555: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 3556: Options</a></span></dt>
1.38 dillo 3557: </dl>
3558: </div>
3559:
1.59 rillig 3560: <div class="sect1" lang="en" xml:lang="en">
1.38 dillo 3561: <div class="titlepage">
3562: <div>
3563: <div>
3564: <h2 class="title" style="clear: both"><a name=
1.59 rillig 3565: "general-configuration" id=
1.45 wiz 3566: "general-configuration"></a>5.1. General
3567: configuration</h2>
3568: </div>
3569: </div>
3570: </div>
3571:
1.47 reed 3572: <p>In this section, you can find some variables that
3573: apply to all pkgsrc packages. The preferred method of
3574: setting these variables is by setting them in
3575: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3576: class="filename">/etc/mk.conf</code>.</p>
1.45 wiz 3577:
3578: <div class="itemizedlist">
3579: <ul type="disc">
3580: <li>
3581: <p><code class="varname">LOCALBASE</code>: Where
3582: packages will be installed. The default is
3583: <code xmlns=
3584: "http://www.w3.org/TR/xhtml1/transitional" class=
3585: "filename">/usr/pkg</code>. Do not mix binary
3586: packages with different <code class=
3587: "varname">LOCALBASE</code>s!</p>
3588: </li>
3589:
3590: <li>
3591: <p><code class="varname">CROSSBASE</code>: Where
3592: “<span class="quote">cross</span>”
3593: category packages will be installed. The default is
3594: <code xmlns=
3595: "http://www.w3.org/TR/xhtml1/transitional" class=
3596: "filename">${LOCALBASE}/cross</code>.</p>
3597: </li>
3598:
3599: <li>
3600: <p><code class="varname">X11BASE</code>: Where X11
3601: is installed on the system. The default is
3602: <code xmlns=
3603: "http://www.w3.org/TR/xhtml1/transitional" class=
3604: "filename">/usr/X11R6</code>.</p>
3605: </li>
3606:
3607: <li>
3608: <p><code class="varname">DISTDIR</code>: Where to
3609: store the downloaded copies of the original source
3610: distributions used for building pkgsrc packages.
3611: The default is <code xmlns=
3612: "http://www.w3.org/TR/xhtml1/transitional" class=
3613: "filename">${PKGSRCDIR}/distfiles</code>.</p>
3614: </li>
3615:
3616: <li>
3617: <p><code class=
3618: "varname">MASTER_SITE_OVERRIDE</code>: If set,
3619: override the packages' <code class=
3620: "varname">MASTER_SITES</code> with this value.</p>
3621: </li>
3622:
3623: <li>
3624: <p><code class="varname">MASTER_SITE_BACKUP</code>:
3625: Backup location(s) for distribution files and patch
3626: files if not found locally or in <code xmlns=
3627: "http://www.w3.org/TR/xhtml1/transitional" class=
3628: "filename">${MASTER_SITES}</code> or <code xmlns=
3629: "http://www.w3.org/TR/xhtml1/transitional" class=
3630: "filename">${PATCH_SITES}</code> respectively. The
3631: defaults are <code xmlns=
3632: "http://www.w3.org/TR/xhtml1/transitional" class=
3633: "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/${DIST_SUBDIR}/</code>
3634: and <code xmlns=
3635: "http://www.w3.org/TR/xhtml1/transitional" class=
3636: "filename">ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/</code>.</p>
3637: </li>
3638:
3639: <li>
3640: <p><code class="varname">BINPKG_SITES</code>: List
3641: of sites carrying binary pkgs.</p>
3642: </li>
3643: </ul>
3644: </div>
3645: </div>
3646:
1.59 rillig 3647: <div class="sect1" lang="en" xml:lang="en">
1.45 wiz 3648: <div class="titlepage">
3649: <div>
3650: <div>
3651: <h2 class="title" style="clear: both"><a name=
1.59 rillig 3652: "variables-affecting-build" id=
1.45 wiz 3653: "variables-affecting-build"></a>5.2. Variables
3654: affecting the build process</h2>
3655: </div>
3656: </div>
3657: </div>
3658:
3659: <p>XXX</p>
3660:
3661: <div class="itemizedlist">
3662: <ul type="disc">
3663: <li>
3664: <p><code class="varname">PACKAGES</code>: The top
3665: level directory for the binary packages. The
3666: default is <code xmlns=
3667: "http://www.w3.org/TR/xhtml1/transitional" class=
3668: "filename">${PKGSRCDIR}/packages</code>.</p>
3669: </li>
3670:
3671: <li>
3672: <p><code class="varname">WRKOBJDIR</code>: The top
3673: level directory where, if defined, the separate
3674: working directories will get created, and
3675: symbolically linked to from <code xmlns=
3676: "http://www.w3.org/TR/xhtml1/transitional" class=
3677: "filename">${WRKDIR}</code> (see below). This is
3678: useful for building packages on several
3679: architectures, then <code xmlns=
3680: "http://www.w3.org/TR/xhtml1/transitional" class=
3681: "filename">${PKGSRCDIR}</code> can be NFS-mounted
3682: while <code xmlns=
3683: "http://www.w3.org/TR/xhtml1/transitional" class=
3684: "filename">${WRKOBJDIR}</code> is local to every
3685: architecture. (It should be noted that <code class=
3686: "varname">PKGSRCDIR</code> should not be set by the
3687: user — it is an internal definition which
3688: refers to the root of the pkgsrc tree. It is
3689: possible to have many pkgsrc tree instances.)</p>
3690: </li>
3691:
3692: <li>
3693: <p><code class="varname">LOCALPATCHES</code>:
3694: Directory for local patches that aren't part of
3695: pkgsrc. See <a href="#components.patches" title=
3696: "8.3. patches/*">Section 8.3,
3697: “patches/*”</a> for more information.
3698: <em class="replaceable"><code>rel</code></em> and
3699: <em class="replaceable"><code>arch</code></em> are
3700: replaced with OS release (“<span class=
3701: "quote">2.0</span>”, etc.) and architecture
3702: (“<span class="quote">mipsel</span>”,
3703: etc.).</p>
3704: </li>
3705:
3706: <li>
3707: <p><code class="varname">PKGMAKECONF</code>:
3708: Location of the <code xmlns=
3709: "http://www.w3.org/TR/xhtml1/transitional" class=
3710: "filename">mk.conf</code> file used by a package's
3711: BSD-style Makefile. If this is not set,
3712: <code class="varname">MAKECONF</code> is set to
3713: <code xmlns=
3714: "http://www.w3.org/TR/xhtml1/transitional" class=
3715: "filename">/dev/null</code> to avoid picking up
3716: settings used by builds in <code xmlns=
3717: "http://www.w3.org/TR/xhtml1/transitional" class=
3718: "filename">/usr/src</code>.</p>
3719: </li>
3720: </ul>
3721: </div>
3722: </div>
3723:
1.59 rillig 3724: <div class="sect1" lang="en" xml:lang="en">
1.45 wiz 3725: <div class="titlepage">
3726: <div>
3727: <div>
3728: <h2 class="title" style="clear: both"><a name=
1.59 rillig 3729: "developer-advanced-settings" id=
1.45 wiz 3730: "developer-advanced-settings"></a>5.3. Developer/advanced
3731: settings</h2>
3732: </div>
3733: </div>
3734: </div>
3735:
3736: <p>XXX</p>
3737:
3738: <div class="itemizedlist">
3739: <ul type="disc">
3740: <li>
3741: <p><code class="varname">PKG_DEVELOPER</code>: Run
3742: some sanity checks that package developers
3743: want:</p>
3744:
3745: <div class="itemizedlist">
3746: <ul type="circle">
3747: <li>
3748: <p>make sure patches apply with zero fuzz</p>
3749: </li>
3750:
3751: <li>
3752: <p>run check-shlibs to see that all binaries
3753: will find their shared libs.</p>
3754: </li>
3755: </ul>
3756: </div>
3757: </li>
3758:
3759: <li>
3760: <p><code class="varname">PKG_DEBUG_LEVEL</code>:
3761: The level of debugging output which is displayed
3762: whilst making and installing the package. The
3763: default value for this is 0, which will not display
3764: the commands as they are executed (normal, default,
3765: quiet operation); the value 1 will display all
3766: shell commands before their invocation, and the
3767: value 2 will display both the shell commands before
3768: their invocation, and their actual execution
3769: progress with <span><strong class="command">set
3770: -x</strong></span> will be displayed.</p>
3771: </li>
1.58 erh 3772:
3773: <li>
3774: <p><code class=
3775: "varname">ALLOW_VULNERABILITIES.<em class=
3776: "replaceable"><code>pkgbase</code></em></code>: A
3777: space separated list of vulnerability IDs that may
3778: be ignored when performing the automated security
3779: checks. These IDs are listed in the
3780: pkg-vulnerabilities file and are displayed by
3781: <span><strong class=
3782: "command">audit-packages</strong></span> when it
3783: finds a vulnerable package.</p>
3784: </li>
3785:
3786: <li>
3787: <p><code class=
3788: "varname">SKIP_AUDIT_PACKAGES</code>: If this is
3789: set to “<span class=
3790: "quote">yes</span>”, the automated security
3791: checks (which use the <a xmlns=
3792: "http://www.w3.org/TR/xhtml1/transitional" href=
3793: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
3794: target="_top"><code xmlns="" class=
3795: "filename">security/audit-packages</code></a>
3796: package) will be <span class=
3797: "strong"><strong>entirely</strong></span> skipped
3798: for <span class=
3799: "strong"><strong>all</strong></span> packages
3800: built. Normally you'll want to use
3801: ALLOW_VULNERABILITIES instead of this.</p>
3802: </li>
1.45 wiz 3803: </ul>
3804: </div>
3805: </div>
3806:
1.59 rillig 3807: <div class="sect1" lang="en" xml:lang="en">
1.45 wiz 3808: <div class="titlepage">
3809: <div>
3810: <div>
3811: <h2 class="title" style="clear: both"><a name=
1.59 rillig 3812: "selecting-build-options" id=
1.45 wiz 3813: "selecting-build-options"></a>5.4. Selecting
3814: Build Options</h2>
1.38 dillo 3815: </div>
3816: </div>
3817: </div>
3818:
3819: <p>Some packages have build time options, usually to
3820: select between different dependencies, enable optional
3821: support for big dependencies or enable experimental
3822: features.</p>
3823:
3824: <p>To see which options, if any, a package supports, and
3825: which options are mutually exclusive, run
3826: <span><strong class="command">make
3827: show-options</strong></span>, for example:</p>
3828: <pre class="programlisting">
1.51 rillig 3829: The following options are supported by this package:
3830: ssl Enable SSL support.
3831: Exactly one of the following gecko options is required:
3832: firefox Use firefox as gecko rendering engine.
3833: mozilla Use mozilla as gecko rendering engine.
3834: At most one of the following database options may be selected:
3835: mysql Enable support for MySQL database.
3836: pgsql Enable support for PostgreSQL database.
3837:
3838: These options are enabled by default: firefox
3839: These options are currently enabled: mozilla ssl
1.38 dillo 3840: </pre>
3841:
1.45 wiz 3842: <p>The following variables can be defined in <code xmlns=
3843: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 3844: "filename">/etc/mk.conf</code> to select which options to
3845: enable for a package: <code class=
3846: "varname">PKG_DEFAULT_OPTIONS</code>, which can be used
3847: to select or disable options for all packages that
3848: support them, and <code class=
3849: "varname">PKG_OPTIONS.<em class=
3850: "replaceable"><code>pkgbase</code></em></code>, which can
3851: be used to select or disable options specifically for
3852: package <em class=
3853: "replaceable"><code>pkgbase</code></em>. Options listed
3854: in these variables are selected, options preceded by
3855: “<span class="quote">-</span>” are
3856: disabled.</p>
3857:
1.39 dillo 3858: <p>The following settings are consulted in the order
3859: given, and the last setting that selects or disables an
3860: option is used:</p>
1.38 dillo 3861:
3862: <div class="orderedlist">
3863: <ol type="1">
3864: <li>
3865: <p>the default options as suggested by the package
3866: maintainer</p>
3867: </li>
3868:
3869: <li>
3870: <p>the options implied by the settings of legacy
3871: variables (see below)</p>
3872: </li>
3873:
3874: <li>
3875: <p><code class=
3876: "varname">PKG_DEFAULT_OPTIONS</code></p>
3877: </li>
3878:
3879: <li>
3880: <p><code class="varname">PKG_OPTIONS.<em class=
3881: "replaceable"><code>pkgbase</code></em></code></p>
3882: </li>
3883: </ol>
3884: </div>
3885:
3886: <p>For groups of mutually exclusive options, the last
3887: option selected is used, all others are automatically
3888: disabled. If an option of the group is explicitly
3889: disabled, the previously selected option, if any, is
3890: used. It is an error if no option from a required group
3891: of options is selected, and building the package will
3892: fail.</p>
3893:
3894: <p>Before the options framework was introduced, build
3895: options were selected by setting a variable in
1.45 wiz 3896: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3897: class="filename">/etc/mk.conf</code> for each option. To
3898: ease transition to the options framework for the user,
3899: these legacy variables are converted to the appropriate
3900: options setting automatically. A warning is issued to
3901: prompt the user to update <code xmlns=
3902: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 3903: "filename">/etc/mk.conf</code> to use the options
3904: framework directly. Support for these legacy variables
3905: will be removed eventually.</p>
3906: </div>
3907: </div>
3908:
1.59 rillig 3909: <div class="chapter" lang="en" xml:lang="en">
1.38 dillo 3910: <div class="titlepage">
3911: <div>
3912: <div>
1.59 rillig 3913: <h2 class="title"><a name="binary" id=
1.38 dillo 3914: "binary"></a>Chapter 6. Creating binary
1.1 grant 3915: packages</h2>
3916: </div>
3917: </div>
3918: </div>
3919:
3920: <div class="toc">
3921: <p><b>Table of Contents</b></p>
3922:
3923: <dl>
1.30 wiz 3924: <dt><span class="sect1"><a href=
1.38 dillo 3925: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 3926: single binary package</a></span></dt>
1.1 grant 3927:
1.30 wiz 3928: <dt><span class="sect1"><a href=
1.38 dillo 3929: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 3930: Settings for creation of binary
3931: packages</a></span></dt>
3932:
1.38 dillo 3933: <dt><span class="sect1"><a href="#bulkbuild">6.3. Doing
1.1 grant 3934: a bulk build of all packages</a></span></dt>
3935:
3936: <dd>
3937: <dl>
3938: <dt><span class="sect2"><a href=
1.38 dillo 3939: "#binary.configuration">6.3.1.
1.1 grant 3940: Configuration</a></span></dt>
3941:
1.30 wiz 3942: <dt><span class="sect2"><a href=
1.38 dillo 3943: "#other-environmental-considerations">6.3.2. Other
1.30 wiz 3944: environmental considerations</a></span></dt>
1.1 grant 3945:
1.38 dillo 3946: <dt><span class="sect2"><a href="#operation">6.3.3.
1.1 grant 3947: Operation</a></span></dt>
3948:
1.30 wiz 3949: <dt><span class="sect2"><a href=
1.38 dillo 3950: "#what-it-does">6.3.4. What it does</a></span></dt>
1.1 grant 3951:
1.30 wiz 3952: <dt><span class="sect2"><a href=
1.38 dillo 3953: "#disk-space-requirements">6.3.5. Disk space
1.30 wiz 3954: requirements</a></span></dt>
1.1 grant 3955:
1.30 wiz 3956: <dt><span class="sect2"><a href=
1.38 dillo 3957: "#setting-up-a-sandbox">6.3.6. Setting up a sandbox
1.47 reed 3958: for chrooted builds</a></span></dt>
1.1 grant 3959:
1.30 wiz 3960: <dt><span class="sect2"><a href=
1.38 dillo 3961: "#building-a-partial-set">6.3.7. Building a partial
1.30 wiz 3962: set of packages</a></span></dt>
1.13 hubertf 3963:
3964: <dt><span class="sect2"><a href=
1.38 dillo 3965: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 3966: build</a></span></dt>
1.1 grant 3967: </dl>
3968: </dd>
3969:
1.38 dillo 3970: <dt><span class="sect1"><a href="#creating-cdroms">6.4.
1.1 grant 3971: Creating a multiple CD-ROM packages
3972: collection</a></span></dt>
3973:
3974: <dd>
3975: <dl>
1.30 wiz 3976: <dt><span class="sect2"><a href=
1.38 dillo 3977: "#cdpack-example">6.4.1. Example of
1.30 wiz 3978: cdpack</a></span></dt>
1.1 grant 3979: </dl>
3980: </dd>
3981: </dl>
3982: </div>
3983:
1.59 rillig 3984: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 3985: <div class="titlepage">
3986: <div>
3987: <div>
3988: <h2 class="title" style="clear: both"><a name=
1.59 rillig 3989: "building-a-single-binary-package" id=
1.38 dillo 3990: "building-a-single-binary-package"></a>6.1. Building
1.30 wiz 3991: a single binary package</h2>
1.1 grant 3992: </div>
3993: </div>
3994: </div>
3995:
3996: <p>Once you have built and installed a package, you can
3997: create a <span class="emphasis"><em>binary
3998: package</em></span> which can be installed on another
3999: system with <a href=
4000: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4001: <span class="citerefentry"><span class=
1.47 reed 4002: "refentrytitle">pkg_add</span>(1)</span></a>. This saves
1.1 grant 4003: having to build the same package on a group of hosts and
4004: wasting CPU time. It also provides a simple means for
4005: others to install your package, should you distribute
4006: it.</p>
4007:
4008: <p>To create a binary package, change into the
1.14 xtraeme 4009: appropriate directory in pkgsrc, and run
4010: <span><strong class="command">make
4011: package</strong></span>:</p>
1.1 grant 4012: <pre class="screen">
1.14 xtraeme 4013: <code class="prompt">#</code> <strong class=
4014: "userinput"><code>cd misc/figlet</code></strong>
4015: <code class="prompt">#</code> <strong class=
4016: "userinput"><code>make package</code></strong>
1.1 grant 4017: </pre>
4018:
4019: <p>This will build and install your package (if not
4020: already done), and then build a binary package from what
1.14 xtraeme 4021: was installed. You can then use the <span><strong class=
4022: "command">pkg_*</strong></span> tools to manipulate it.
1.45 wiz 4023: Binary packages are created by default in <code xmlns=
4024: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4025: "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1 grant 4026: gzipped tar file. See <a href="#logs.package" title=
1.59 rillig 4027: "B.2. Packaging figlet">Section B.2,
1.1 grant 4028: “Packaging figlet”</a> for a continuation of
4029: the above <a xmlns=
4030: "http://www.w3.org/TR/xhtml1/transitional" href=
4031: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.45 wiz 4032: target="_top"><code xmlns="" class=
4033: "filename">misc/figlet</code></a> example.</p>
1.1 grant 4034:
4035: <p>See <a href="#submit" title=
1.59 rillig 4036: "Chapter 17. Submitting and Committing">Chapter
4037: 17, <i>Submitting and Committing</i></a> for information
4038: on how to submit such a binary package.</p>
1.1 grant 4039: </div>
4040:
1.59 rillig 4041: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 4042: <div class="titlepage">
4043: <div>
4044: <div>
4045: <h2 class="title" style="clear: both"><a name=
1.59 rillig 4046: "settings-for-creationg-of-binary-packages" id=
1.38 dillo 4047: "settings-for-creationg-of-binary-packages"></a>6.2. Settings
1.1 grant 4048: for creation of binary packages</h2>
4049: </div>
4050: </div>
4051: </div>
4052:
4053: <p>See <a href="#build.helpful-targets" title=
1.56 rillig 4054: "14.16. Other helpful targets">Section 14.16,
1.1 grant 4055: “Other helpful targets”</a>.</p>
4056: </div>
4057:
1.59 rillig 4058: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 4059: <div class="titlepage">
4060: <div>
4061: <div>
4062: <h2 class="title" style="clear: both"><a name=
1.59 rillig 4063: "bulkbuild" id="bulkbuild"></a>6.3. Doing a
4064: bulk build of all packages</h2>
1.1 grant 4065: </div>
4066: </div>
4067: </div>
4068:
4069: <p>If you want to get a full set of precompiled binary
4070: packages, this section describes how to get them. Beware
4071: that the bulk build will remove all currently installed
1.23 wiz 4072: packages from your system! Having an FTP server
4073: configured either on the machine doing the bulk builds or
4074: on a nearby NFS server can help to make the packages
4075: available to everyone. See <a href=
1.1 grant 4076: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
4077: <span class="citerefentry"><span class=
4078: "refentrytitle">ftpd</span>(8)</span></a> for more
4079: information. If you use a remote NFS server's storage, be
4080: sure to not actually compile on NFS storage, as this
4081: slows things down a lot.</p>
4082:
1.59 rillig 4083: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 4084: <div class="titlepage">
4085: <div>
4086: <div>
1.59 rillig 4087: <h3 class="title"><a name="binary.configuration"
4088: id=
1.38 dillo 4089: "binary.configuration"></a>6.3.1. Configuration</h3>
1.1 grant 4090: </div>
4091: </div>
4092: </div>
4093:
1.59 rillig 4094: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 4095: <div class="titlepage">
4096: <div>
4097: <div>
1.59 rillig 4098: <h4 class="title"><a name="binary.mk.conf" id=
1.38 dillo 4099: "binary.mk.conf"></a>6.3.1.1. /etc/mk.conf</h4>
1.1 grant 4100: </div>
4101: </div>
4102: </div>
4103:
1.45 wiz 4104: <p>You may want to set variables in <code xmlns=
4105: "http://www.w3.org/TR/xhtml1/transitional" class=
4106: "filename">/etc/mk.conf</code>. Look at <code xmlns=
4107: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4108: "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1 grant 4109: details of the default settings. You will want to
1.14 xtraeme 4110: ensure that <code class=
4111: "varname">ACCEPTABLE_LICENSES</code> meet your local
4112: policy. As used in this example, <code class=
4113: "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1 grant 4114: "emphasis"><em>all</em></span> licenses.</p>
4115: <pre class="programlisting">
1.51 rillig 4116: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
4117: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
4118: BSDSRCDIR= /usr/src
4119: BSDXSRCDIR= /usr/xsrc # for x11/xservers
4120: OBJHOSTNAME?= yes # use work.`hostname`
4121: FAILOVER_FETCH= yes # insist on the correct checksum
4122: PKG_DEVELOPER?= yes
4123: _ACCEPTABLE= yes
1.1 grant 4124: </pre>
4125: </div>
4126:
1.59 rillig 4127: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 4128: <div class="titlepage">
4129: <div>
4130: <div>
1.59 rillig 4131: <h4 class="title"><a name="build.conf" id=
1.45 wiz 4132: "build.conf"></a>6.3.1.2. <code xmlns=
4133: "http://www.w3.org/TR/xhtml1/transitional"
4134: class="filename">build.conf</code></h4>
1.1 grant 4135: </div>
4136: </div>
4137: </div>
4138:
1.45 wiz 4139: <p>In <code xmlns=
4140: "http://www.w3.org/TR/xhtml1/transitional" class=
4141: "filename">pkgsrc/mk/bulk</code>, copy <code xmlns=
4142: "http://www.w3.org/TR/xhtml1/transitional" class=
4143: "filename">build.conf-example</code> to <code xmlns=
4144: "http://www.w3.org/TR/xhtml1/transitional" class=
4145: "filename">build.conf</code> and edit it, following
4146: the comments in that file. This is the config file
4147: that determines where log files are generated after
4148: the build, where to mail the build report to, where
4149: your pkgsrc tree is located and the user to which
4150: user to <a href=
1.1 grant 4151: "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
4152: <span class="citerefentry"><span class=
1.23 wiz 4153: "refentrytitle">su</span>(8)</span></a> to do a
1.14 xtraeme 4154: <span><strong class="command">cvs
4155: update</strong></span>.</p>
1.1 grant 4156: </div>
4157:
1.59 rillig 4158: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 4159: <div class="titlepage">
4160: <div>
4161: <div>
1.59 rillig 4162: <h4 class="title"><a name="pre-build.local" id=
1.45 wiz 4163: "pre-build.local"></a>6.3.1.3. <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4164: class="filename">pre-build.local</code></h4>
1.1 grant 4165: </div>
4166: </div>
4167: </div>
4168:
4169: <p>It is possible to configure the bulk build to
1.47 reed 4170: perform certain site-specific tasks at the end of the
1.45 wiz 4171: pre-build stage. If the file <code xmlns=
4172: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4173: "filename">pre-build.local</code> exists in
1.45 wiz 4174: <code xmlns=
4175: "http://www.w3.org/TR/xhtml1/transitional" class=
4176: "filename">/usr/pkgsrc/mk/bulk</code>, it will be
4177: executed (as a <a href=
1.24 wiz 4178: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
4179: <span class="citerefentry"><span class=
4180: "refentrytitle">sh</span>(1)</span></a> script) at
4181: the end of the usual pre-build stage. An example use
1.45 wiz 4182: of <code xmlns=
4183: "http://www.w3.org/TR/xhtml1/transitional" class=
4184: "filename">pre-build.local</code> is to have the
4185: line:</p>
1.1 grant 4186: <pre class="screen">
1.14 xtraeme 4187: <code class="prompt">#</code> <strong class=
4188: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23 wiz 4189: > pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1 grant 4190: </pre>
4191:
4192: <p>to prevent the system from trying to build a
4193: particular package which requires nearly 3 GB of disk
4194: space.</p>
4195: </div>
4196: </div>
4197:
1.59 rillig 4198: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 4199: <div class="titlepage">
4200: <div>
4201: <div>
1.30 wiz 4202: <h3 class="title"><a name=
1.59 rillig 4203: "other-environmental-considerations" id=
1.38 dillo 4204: "other-environmental-considerations"></a>6.3.2. Other
1.30 wiz 4205: environmental considerations</h3>
1.1 grant 4206: </div>
4207: </div>
4208: </div>
4209:
1.45 wiz 4210: <p>As <code xmlns=
4211: "http://www.w3.org/TR/xhtml1/transitional" class=
4212: "filename">/usr/pkg</code> will be completely deleted
4213: at the start of bulk builds, make sure your login shell
4214: is placed somewhere else. Either drop it into
4215: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4216: class="filename">/usr/local/bin</code> (and adjust your
4217: login shell in the passwd file), or (re-)install it via
1.14 xtraeme 4218: <a href=
1.1 grant 4219: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4220: <span class="citerefentry"><span class=
4221: "refentrytitle">pkg_add</span>(1)</span></a> from
1.45 wiz 4222: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4223: class="filename">/etc/rc.local</code>, so you can login
4224: after a reboot (remember that your current process
4225: won't die if the package is removed, you just can't
4226: start any new instances of the shell any more). Also,
4227: if you use NetBSD earlier than 1.5, or you still want
4228: to use the pkgsrc version of ssh for some reason, be
4229: sure to install ssh before starting it from
4230: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4231: class="filename">rc.local</code>:</p>
1.1 grant 4232: <pre class="programlisting">
1.51 rillig 4233: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
4234: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
4235: /usr/pkg/etc/rc.d/sshd
4236: fi
1.1 grant 4237: </pre>
4238:
4239: <p>Not doing so will result in you being not able to
4240: log in via ssh after the bulk build is finished or if
4241: the machine gets rebooted or crashes. You have been
4242: warned! :)</p>
4243: </div>
4244:
1.59 rillig 4245: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 4246: <div class="titlepage">
4247: <div>
4248: <div>
1.59 rillig 4249: <h3 class="title"><a name="operation" id=
1.38 dillo 4250: "operation"></a>6.3.3. Operation</h3>
1.1 grant 4251: </div>
4252: </div>
4253: </div>
4254:
4255: <p>Make sure you don't need any of the packages still
4256: installed.</p>
4257:
4258: <div class="warning" style=
4259: "margin-left: 0.5in; margin-right: 0.5in;">
4260: <h3 class="title">Warning</h3>
4261:
4262: <p>During the bulk build, <span class=
4263: "emphasis"><em>all packages will be
4264: removed!</em></span></p>
4265: </div>
4266:
4267: <p>Be sure to remove all other things that might
4268: interfere with builds, like some libs installed in
1.45 wiz 4269: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4270: class="filename">/usr/local</code>, etc. then become
4271: root and type:</p>
1.1 grant 4272: <pre class="screen">
1.14 xtraeme 4273: <code class="prompt">#</code> <strong class=
4274: "userinput"><code>cd /usr/pkgsrc</code></strong>
4275: <code class="prompt">#</code> <strong class=
4276: "userinput"><code>sh mk/bulk/build</code></strong>
1.1 grant 4277: </pre>
4278:
4279: <p>If for some reason your last build didn't complete
4280: (power failure, system panic, ...), you can continue it
4281: by running:</p>
4282: <pre class="screen">
1.14 xtraeme 4283: <code class="prompt">#</code> <strong class=
4284: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1 grant 4285: </pre>
4286:
4287: <p>At the end of the bulk build, you will get a summary
4288: via mail, and find build logs in the directory
1.14 xtraeme 4289: specified by <code class="varname">FTP</code> in the
1.45 wiz 4290: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4291: class="filename">build.conf</code> file.</p>
1.1 grant 4292: </div>
4293:
1.59 rillig 4294: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 4295: <div class="titlepage">
4296: <div>
4297: <div>
1.59 rillig 4298: <h3 class="title"><a name="what-it-does" id=
1.38 dillo 4299: "what-it-does"></a>6.3.4. What it does</h3>
1.1 grant 4300: </div>
4301: </div>
4302: </div>
4303:
4304: <p>The bulk builds consist of three steps:</p>
4305:
4306: <div class="variablelist">
4307: <dl>
4308: <dt><span class="term">1. pre-build</span></dt>
4309:
4310: <dd>
4311: <p>The script updates your pkgsrc tree via
4312: (anon)cvs, then cleans out any broken distfiles,
4313: and removes all packages installed.</p>
4314: </dd>
4315:
4316: <dt><span class="term">2. the bulk
4317: build</span></dt>
4318:
4319: <dd>
4320: <p>This is basically “<span class=
4321: "quote">make bulk-package</span>” with an
4322: optimised order in which packages will be built.
4323: Packages that don't require other packages will
4324: be built first, and packages with many
4325: dependencies will be built later.</p>
4326: </dd>
4327:
4328: <dt><span class="term">3. post-build</span></dt>
4329:
4330: <dd>
4331: <p>Generates a report that's placed in the
1.45 wiz 4332: directory specified in the <code xmlns=
4333: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4334: "filename">build.conf</code> file named
1.45 wiz 4335: <code xmlns=
4336: "http://www.w3.org/TR/xhtml1/transitional" class=
4337: "filename">broken.html</code>, a short version of
4338: that report will also be mailed to the build's
4339: admin.</p>
1.1 grant 4340: </dd>
4341: </dl>
4342: </div>
4343:
4344: <p>During the build, a list of broken packages will be
1.45 wiz 4345: compiled in <code xmlns=
4346: "http://www.w3.org/TR/xhtml1/transitional" class=
4347: "filename">/usr/pkgsrc/.broken</code> (or <code xmlns=
4348: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4349: "filename">.../.broken.${MACHINE}</code> if
4350: <code class="varname">OBJMACHINE</code> is set),
4351: individual build logs of broken builds can be found in
4352: the package's directory. These files are used by the
4353: bulk-targets to mark broken builds to not waste time
4354: trying to rebuild them, and they can be used to debug
4355: these broken package builds later.</p>
1.1 grant 4356: </div>
4357:
1.59 rillig 4358: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 4359: <div class="titlepage">
4360: <div>
4361: <div>
1.30 wiz 4362: <h3 class="title"><a name=
1.59 rillig 4363: "disk-space-requirements" id=
1.38 dillo 4364: "disk-space-requirements"></a>6.3.5. Disk
1.30 wiz 4365: space requirements</h3>
1.1 grant 4366: </div>
4367: </div>
4368: </div>
4369:
4370: <p>Currently, roughly the following requirements are
4371: valid for NetBSD 2.0/i386:</p>
4372:
4373: <div class="itemizedlist">
4374: <ul type="disc">
4375: <li>
4376: <p>10 GB - distfiles (NFS ok)</p>
4377: </li>
4378:
4379: <li>
4380: <p>8 GB - full set of all binaries (NFS ok)</p>
4381: </li>
4382:
4383: <li>
4384: <p>5 GB - temp space for compiling (local disk
4385: recommended)</p>
4386: </li>
4387: </ul>
4388: </div>
4389:
4390: <p>Note that all pkgs will be de-installed as soon as
4391: they are turned into a binary package, and that sources
4392: are removed, so there is no excessively huge demand to
4393: disk space. Afterwards, if the package is needed again,
4394: it will be installed via <a href=
4395: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4396: <span class="citerefentry"><span class=
4397: "refentrytitle">pkg_add</span>(1)</span></a> instead of
4398: building again, so there are no cycles wasted by
4399: recompiling.</p>
4400: </div>
4401:
1.59 rillig 4402: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 4403: <div class="titlepage">
4404: <div>
4405: <div>
1.59 rillig 4406: <h3 class="title"><a name="setting-up-a-sandbox"
4407: id="setting-up-a-sandbox"></a>6.3.6. Setting
4408: up a sandbox for chrooted builds</h3>
1.1 grant 4409: </div>
4410: </div>
4411: </div>
4412:
1.12 agc 4413: <p>If you don't want all the packages nuked from a
4414: machine (rendering it useless for anything but pkg
1.23 wiz 4415: compiling), there is the possibility of doing the
4416: package bulk build inside a chroot environment.</p>
1.12 agc 4417:
4418: <p>The first step is to set up a chroot sandbox, e.g.
1.45 wiz 4419: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4420: class="filename">/usr/sandbox</code>. This can be done
4421: by using null mounts, or manually.</p>
1.12 agc 4422:
1.45 wiz 4423: <p>There is a shell script called <code xmlns=
4424: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4425: "filename">pkgsrc/mk/bulk/mksandbox</code> which will
4426: set up the sandbox environment using null mounts. It
1.45 wiz 4427: will also create a script called <code xmlns=
4428: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4429: "filename">sandbox</code> in the root of the sandbox
1.12 agc 4430: environment, which will allow the null mounts to be
1.14 xtraeme 4431: activated using the <span><strong class=
4432: "command">sandbox mount</strong></span> command and
4433: deactivated using the <span><strong class=
4434: "command">sandbox umount</strong></span> command.</p>
1.12 agc 4435:
4436: <p>To set up a sandbox environment by hand, after
4437: extracting all the sets from a NetBSD installation or
1.14 xtraeme 4438: doing a <span><strong class="command">make distribution
1.45 wiz 4439: DESTDIR=/usr/sandbox</strong></span> in <code xmlns=
4440: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4441: "filename">/usr/src/etc</code>, be sure the following
1.7 wiz 4442: items are present and properly configured:</p>
1.1 grant 4443:
4444: <div class="procedure">
4445: <ol type="1">
4446: <li>
4447: <p>Kernel</p>
4448: <pre class="screen">
1.14 xtraeme 4449: <code class="prompt">#</code> <strong class=
4450: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1 grant 4451: </pre>
4452: </li>
4453:
4454: <li>
1.45 wiz 4455: <p><code xmlns=
4456: "http://www.w3.org/TR/xhtml1/transitional" class=
4457: "filename">/dev/*</code></p>
1.1 grant 4458: <pre class="screen">
1.14 xtraeme 4459: <code class="prompt">#</code> <strong class=
4460: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1 grant 4461: </pre>
4462: </li>
4463:
4464: <li>
1.45 wiz 4465: <p><code xmlns=
4466: "http://www.w3.org/TR/xhtml1/transitional" class=
4467: "filename">/etc/resolv.conf</code> (for <a xmlns=
1.1 grant 4468: "http://www.w3.org/TR/xhtml1/transitional" href=
4469: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 wiz 4470: target="_top"><code xmlns="" class=
4471: "filename">security/smtpd</code></a> and
4472: mail):</p>
1.1 grant 4473: <pre class="screen">
1.14 xtraeme 4474: <code class="prompt">#</code> <strong class=
4475: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1 grant 4476: </pre>
4477: </li>
4478:
4479: <li>
4480: <p>Working(!) mail config (hostname,
4481: sendmail.cf):</p>
4482: <pre class="screen">
1.14 xtraeme 4483: <code class="prompt">#</code> <strong class=
4484: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1 grant 4485: </pre>
4486: </li>
4487:
4488: <li>
1.45 wiz 4489: <p><code xmlns=
4490: "http://www.w3.org/TR/xhtml1/transitional" class=
4491: "filename">/etc/localtime</code> (for <a xmlns=
1.1 grant 4492: "http://www.w3.org/TR/xhtml1/transitional" href=
4493: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 wiz 4494: target="_top"><code xmlns="" class=
4495: "filename">security/smtpd</code></a>):</p>
1.1 grant 4496: <pre class="screen">
1.14 xtraeme 4497: <code class="prompt">#</code> <strong class=
4498: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1 grant 4499: </pre>
4500: </li>
4501:
4502: <li>
1.45 wiz 4503: <p><code xmlns=
4504: "http://www.w3.org/TR/xhtml1/transitional" class=
4505: "filename">/usr/src</code> (system sources, for
4506: <a xmlns=
1.1 grant 4507: "http://www.w3.org/TR/xhtml1/transitional" href=
4508: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.45 wiz 4509: target="_top"><code xmlns="" class=
4510: "filename">sysutils/aperture</code></a>,
4511: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
4512: href=
1.20 ben 4513: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
1.45 wiz 4514: target="_top"><code xmlns="" class=
4515: "filename">net/ppp-mppe</code></a>):</p>
1.1 grant 4516: <pre class="screen">
1.14 xtraeme 4517: <code class="prompt">#</code> <strong class=
4518: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
4519: <code class="prompt">#</code> <strong class=
1.23 wiz 4520: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1 grant 4521: </pre>
4522: </li>
4523:
4524: <li>
1.45 wiz 4525: <p>Create <code xmlns=
4526: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4527: "filename">/var/db/pkg</code> (not part of
4528: default install):</p>
1.1 grant 4529: <pre class="screen">
1.14 xtraeme 4530: <code class="prompt">#</code> <strong class=
4531: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1 grant 4532: </pre>
4533: </li>
4534:
4535: <li>
1.45 wiz 4536: <p>Create <code xmlns=
4537: "http://www.w3.org/TR/xhtml1/transitional" class=
4538: "filename">/usr/pkg</code> (not part of default
4539: install):</p>
1.1 grant 4540: <pre class="screen">
1.14 xtraeme 4541: <code class="prompt">#</code> <strong class=
4542: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1 grant 4543: </pre>
4544: </li>
4545:
4546: <li>
1.45 wiz 4547: <p>Checkout pkgsrc via cvs into <code xmlns=
4548: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4549: "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1 grant 4550: <pre class="screen">
1.14 xtraeme 4551: <code class="prompt">#</code> <strong class=
4552: "userinput"><code>cd /usr/sandbox/usr</code></strong>
4553: <code class="prompt">#</code> <strong class=
4554: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1 grant 4555: </pre>
4556:
4557: <p>Do not mount/link this to the copy of your
4558: pkgsrc tree you do development in, as this will
4559: likely cause problems!</p>
4560: </li>
4561:
4562: <li>
1.45 wiz 4563: <p>Make <code xmlns=
4564: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4565: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.45 wiz 4566: and <code xmlns=
4567: "http://www.w3.org/TR/xhtml1/transitional" class=
4568: "filename">.../distfiles</code> point somewhere
4569: appropriate. NFS- and/or nullfs-mounts may come
4570: in handy!</p>
1.1 grant 4571: </li>
4572:
4573: <li>
1.45 wiz 4574: <p>Edit <code xmlns=
4575: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4576: "filename">/etc/mk.conf</code>, see <a href=
4577: "#binary.mk.conf" title=
1.38 dillo 4578: "6.3.1.1. /etc/mk.conf">Section 6.3.1.1,
1.1 grant 4579: “/etc/mk.conf”</a>.</p>
4580: </li>
4581:
4582: <li>
1.45 wiz 4583: <p>Adjust <code xmlns=
4584: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4585: "filename">mk/bulk/build.conf</code> to suit your
1.1 grant 4586: needs.</p>
4587: </li>
4588:
4589: <li>
1.14 xtraeme 4590: <p>If you have set <code class=
1.45 wiz 4591: "varname">CVS_USER</code> in <code xmlns=
4592: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4593: "filename">build.conf</code>, make sure that
4594: account exists and can do a <span><strong class=
4595: "command">cvs ${CVS_FLAGS} update</strong></span>
1.1 grant 4596: properly!</p>
4597: </li>
4598: </ol>
4599: </div>
4600:
1.47 reed 4601: <p>When the chroot sandbox is set up, you can start the
1.1 grant 4602: build with the following steps:</p>
4603: <pre class="screen">
1.14 xtraeme 4604: <code class="prompt">#</code> <strong class=
4605: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
4606: <code class="prompt">#</code> <strong class=
4607: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1 grant 4608: </pre>
4609:
4610: <p>This will just jump inside the sandbox and start
4611: building. At the end of the build, mail will be sent
4612: with the results of the build. Created binary pkgs will
1.45 wiz 4613: be in <code xmlns=
4614: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4615: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1 grant 4616: (wherever that points/mounts to/from).</p>
4617: </div>
4618:
1.59 rillig 4619: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 4620: <div class="titlepage">
4621: <div>
4622: <div>
1.30 wiz 4623: <h3 class="title"><a name=
1.59 rillig 4624: "building-a-partial-set" id=
1.38 dillo 4625: "building-a-partial-set"></a>6.3.7. Building
1.30 wiz 4626: a partial set of packages</h3>
1.1 grant 4627: </div>
4628: </div>
4629: </div>
4630:
4631: <p>In addition to building a complete set of all
1.45 wiz 4632: packages in pkgsrc, the <code xmlns=
4633: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4634: "filename">pkgsrc/mk/bulk/build</code> script may be
4635: used to build a subset of the packages contained in
1.47 reed 4636: pkgsrc. By setting <code class=
1.45 wiz 4637: "varname">SPECIFIC_PKGS</code> in <code xmlns=
4638: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4639: "filename">/etc/mk.conf</code>, the variables</p>
1.1 grant 4640:
4641: <div class="itemizedlist">
4642: <ul type="disc">
4643: <li>
4644: <p>SITE_SPECIFIC_PKGS</p>
4645: </li>
4646:
4647: <li>
4648: <p>HOST_SPECIFIC_PKGS</p>
4649: </li>
4650:
4651: <li>
4652: <p>GROUP_SPECIFIC_PKGS</p>
4653: </li>
4654:
4655: <li>
4656: <p>USER_SPECIFIC_PKGS</p>
4657: </li>
4658: </ul>
4659: </div>
4660:
4661: <p>will define the set of packages which should be
4662: built. The bulk build code will also include any
4663: packages which are needed as dependencies for the
4664: explicitly listed packages.</p>
4665:
4666: <p>One use of this is to do a bulk build with
1.14 xtraeme 4667: <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1 grant 4668: sandbox periodically to have a complete set of the
4669: binary packages needed for your site available without
4670: the overhead of building extra packages that are not
4671: needed.</p>
4672: </div>
1.13 hubertf 4673:
1.59 rillig 4674: <div class="sect2" lang="en" xml:lang="en">
1.13 hubertf 4675: <div class="titlepage">
4676: <div>
4677: <div>
1.59 rillig 4678: <h3 class="title"><a name="bulk-upload" id=
1.38 dillo 4679: "bulk-upload"></a>6.3.8. Uploading results
1.13 hubertf 4680: of a bulk build</h3>
4681: </div>
4682: </div>
4683: </div>
4684:
4685: <p>This section describes how pkgsrc developers can
4686: upload binary pkgs built by bulk builds to
4687: ftp.NetBSD.org.</p>
4688:
1.17 sketch 4689: <p>If you would like to automatically create checksum
4690: files for the binary packages you intend to upload,
4691: remember to set <code class="varname">MKSUMS=yes</code>
1.45 wiz 4692: in your <code xmlns=
4693: "http://www.w3.org/TR/xhtml1/transitional" class=
1.17 sketch 4694: "filename">mk/bulk/build.conf</code>.</p>
4695:
4696: <p>If you would like to PGP sign the checksum files
4697: (highly recommended!), remember to set <code class=
4698: "varname">SIGN_AS=username@NetBSD.org</code> in your
1.45 wiz 4699: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4700: class="filename">mk/bulk/build.conf</code>. This will
4701: prompt you for your GPG password to sign the files
1.17 sketch 4702: before uploading everything.</p>
4703:
4704: <p>Then, make sure that you have <code class=
1.14 xtraeme 4705: "varname">RSYNC_DST</code> set properly in your
1.45 wiz 4706: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4707: class="filename">mk/bulk/build.conf</code> file, i.e.
4708: adjust it to something like one of the following:</p>
1.13 hubertf 4709: <pre class="screen">
4710: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
4711: </pre>
4712:
1.47 reed 4713: <p>Please use appropriate values for "pkgsrc-200xQy",
1.13 hubertf 4714: "NetBSD-a.b.c" and "arch" here. If your login on
1.14 xtraeme 4715: ftp.NetBSD.org is different from <code class=
4716: "varname">CVS_USER</code>, write your login directly
4717: into the variable, e.g. my local account is "feyrer",
4718: but for my login "hubertf", I use:</p>
1.13 hubertf 4719: <pre class="screen">
4720: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
4721: </pre>
4722:
1.45 wiz 4723: <p>A separate <code xmlns=
4724: "http://www.w3.org/TR/xhtml1/transitional" class=
4725: "filename">upload</code> directory is used here to
4726: allow "closing" the directory during upload. To do so,
4727: run the following command on ftp.NetBSD.org next:</p>
1.13 hubertf 4728: <pre class="screen">
1.14 xtraeme 4729: nbftp% <strong class=
4730: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13 hubertf 4731: </pre>
4732:
1.45 wiz 4733: <p>Please note that <code xmlns=
4734: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4735: "filename">/pub/NetBSD/packages</code> is only
1.13 hubertf 4736: appropriate for packages for the NetBSD operating
4737: system. Binary packages for other operating systems
1.45 wiz 4738: should go into <code xmlns=
4739: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4740: "filename">/pub/pkgsrc</code>.</p>
1.13 hubertf 4741:
4742: <p>Before uploading the binary pkgs, ssh authentication
1.47 reed 4743: needs to be set up. This example shows how to set up
1.13 hubertf 4744: temporary keys for the root account <span class=
4745: "emphasis"><em>inside the sandbox</em></span> (assuming
4746: that no keys should be present there usually):</p>
4747: <pre class="screen">
1.14 xtraeme 4748: <code class="prompt">#</code> <strong class=
4749: "userinput"><code>chroot /usr/sandbox</code></strong>
4750: chroot-<code class="prompt">#</code> <strong class=
4751: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>
4752: chroot-<code class="prompt">#</code> <strong class=
4753: "userinput"><code>ssh-keygen -t dsa</code></strong>
4754: chroot-<code class="prompt">#</code> <strong class=
4755: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong>
1.13 hubertf 4756: </pre>
4757:
1.45 wiz 4758: <p>Now take the output of <code xmlns=
4759: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4760: "filename">id-dsa.pub</code> and append it to your
1.45 wiz 4761: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4762: class="filename">~/.ssh/authorized_keys</code> file on
4763: ftp.NetBSD.org. You can remove the key after the upload
4764: is done!</p>
1.13 hubertf 4765:
4766: <p>Next, test if your ssh connection really works:</p>
4767: <pre class="screen">
1.14 xtraeme 4768: chroot-<code class="prompt">#</code> <strong class=
4769: "userinput"><code>ssh ftp.NetBSD.org date</code></strong>
1.13 hubertf 4770: </pre>
4771:
4772: <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
4773:
4774: <p>Now after all this works, you can exit the sandbox
4775: and start the upload:</p>
4776: <pre class="screen">
1.14 xtraeme 4777: chroot-<code class="prompt">#</code> <strong class=
4778: "userinput"><code>exit</code></strong>
4779: <code class="prompt">#</code> <strong class=
4780: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
4781: <code class="prompt">#</code> <strong class=
4782: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong>
1.13 hubertf 4783: </pre>
4784:
4785: <p>The upload process may take quite some time. Use
1.24 wiz 4786: <a href=
4787: "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
4788: <span class="citerefentry"><span class=
4789: "refentrytitle">ls</span>(1)</span></a> or <a href=
4790: "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
4791: <span class="citerefentry"><span class=
4792: "refentrytitle">du</span>(1)</span></a> on the FTP
4793: server to monitor progress of the upload. The upload
4794: script will take care of not uploading restricted
4795: packages and putting vulnerable packages into the
1.45 wiz 4796: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4797: class="filename">vulnerable</code> subdirectory.</p>
1.13 hubertf 4798:
4799: <p>After the upload has ended, first thing is to revoke
4800: ssh access:</p>
4801: <pre class="screen">
1.14 xtraeme 4802: nbftp% <strong class=
4803: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13 hubertf 4804: Gdd:x!
4805: </pre>
4806:
4807: <p>Use whatever is needed to remove the key you've
4808: entered before! Last, move the uploaded packages out of
1.45 wiz 4809: the <code xmlns=
4810: "http://www.w3.org/TR/xhtml1/transitional" class=
4811: "filename">upload</code> directory to have them
4812: accessible to everyone:</p>
1.13 hubertf 4813: <pre class="screen">
1.14 xtraeme 4814: nbftp% <strong class=
4815: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
4816: nbftp% <strong class=
4817: "userinput"><code>mv upload/* .</code></strong>
4818: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
4819: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong>
1.13 hubertf 4820: </pre>
4821: </div>
1.1 grant 4822: </div>
4823:
1.59 rillig 4824: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 4825: <div class="titlepage">
4826: <div>
4827: <div>
4828: <h2 class="title" style="clear: both"><a name=
1.59 rillig 4829: "creating-cdroms" id=
1.38 dillo 4830: "creating-cdroms"></a>6.4. Creating a multiple
1.30 wiz 4831: CD-ROM packages collection</h2>
1.1 grant 4832: </div>
4833: </div>
4834: </div>
4835:
4836: <p>After your pkgsrc bulk-build has completed, you may
4837: wish to create a CD-ROM set of the resulting binary
4838: packages to assist in installing packages on other
4839: machines. The <a xmlns=
4840: "http://www.w3.org/TR/xhtml1/transitional" href=
4841: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.45 wiz 4842: target="_top"><code xmlns="" class=
4843: "filename">pkgtools/cdpack</code></a> package provides a
1.20 ben 4844: simple tool for creating the ISO 9660 images.
4845: <span><strong class="command">cdpack</strong></span>
4846: arranges the packages on the CD-ROMs in a way that keeps
1.47 reed 4847: all the dependencies for a given package on the same CD
4848: as that package.</p>
1.1 grant 4849:
1.59 rillig 4850: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 4851: <div class="titlepage">
4852: <div>
4853: <div>
1.59 rillig 4854: <h3 class="title"><a name="cdpack-example" id=
1.38 dillo 4855: "cdpack-example"></a>6.4.1. Example of
1.1 grant 4856: cdpack</h3>
4857: </div>
4858: </div>
4859: </div>
4860:
4861: <p>Complete documentation for cdpack is found in the
1.47 reed 4862: cdpack(1) man page. The following short example assumes
1.45 wiz 4863: that the binary packages are left in <code xmlns=
4864: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4865: "filename">/usr/pkgsrc/packages/All</code> and that
1.45 wiz 4866: sufficient disk space exists in <code xmlns=
4867: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4868: "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1 grant 4869: <pre class="screen">
1.14 xtraeme 4870: <code class="prompt">#</code> <strong class=
4871: "userinput"><code>mkdir /u2/images</code></strong>
4872: <code class="prompt">#</code> <strong class=
4873: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
4874: <code class="prompt">#</code> <strong class=
4875: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 4876: </pre>
4877:
4878: <p>If you wish to include a common set of files
1.45 wiz 4879: (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4880: class="filename">COPYRIGHT</code>, <code xmlns=
4881: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4882: "filename">README</code>, etc.) on each CD in the
1.1 grant 4883: collection, then you need to create a directory which
4884: contains these files. e.g.</p>
4885: <pre class="screen">
1.14 xtraeme 4886: <code class="prompt">#</code> <strong class=
4887: "userinput"><code>mkdir /tmp/common</code></strong>
4888: <code class="prompt">#</code> <strong class=
4889: "userinput"><code>echo "This is a README" > /tmp/common/README</code></strong>
4890: <code class="prompt">#</code> <strong class=
4891: "userinput"><code>echo "Another file" > /tmp/common/COPYING</code></strong>
4892: <code class="prompt">#</code> <strong class=
4893: "userinput"><code>mkdir /tmp/common/bin</code></strong>
4894: <code class="prompt">#</code> <strong class=
4895: "userinput"><code>echo "#!/bin/sh" > /tmp/common/bin/myscript</code></strong>
4896: <code class="prompt">#</code> <strong class=
4897: "userinput"><code>echo "echo Hello world" >> /tmp/common/bin/myscript</code></strong>
4898: <code class="prompt">#</code> <strong class=
4899: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1 grant 4900: </pre>
4901:
4902: <p>Now create the images:</p>
4903: <pre class="screen">
1.14 xtraeme 4904: <code class="prompt">#</code> <strong class=
4905: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 4906: </pre>
4907:
1.45 wiz 4908: <p>Each image will contain <code xmlns=
4909: "http://www.w3.org/TR/xhtml1/transitional" class=
4910: "filename">README</code>, <code xmlns=
4911: "http://www.w3.org/TR/xhtml1/transitional" class=
4912: "filename">COPYING</code>, and <code xmlns=
4913: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4914: "filename">bin/myscript</code> in their root
1.1 grant 4915: directories.</p>
4916: </div>
4917: </div>
4918: </div>
4919:
1.59 rillig 4920: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 4921: <div class="titlepage">
4922: <div>
4923: <div>
1.59 rillig 4924: <h2 class="title"><a name="faq" id=
1.38 dillo 4925: "faq"></a>Chapter 7. Frequently Asked
1.1 grant 4926: Questions</h2>
4927: </div>
4928: </div>
4929: </div>
4930:
4931: <div class="toc">
4932: <p><b>Table of Contents</b></p>
4933:
4934: <dl>
1.30 wiz 4935: <dt><span class="sect1"><a href=
1.38 dillo 4936: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 4937: lists for pkg-related discussion?</a></span></dt>
1.1 grant 4938:
1.38 dillo 4939: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 4940: Where's the pkgviews documentation?</a></span></dt>
4941:
1.38 dillo 4942: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 4943: Utilities for package management
4944: (pkgtools)</a></span></dt>
4945:
1.38 dillo 4946: <dt><span class="sect1"><a href="#non-root-pkgsrc">7.4.
1.30 wiz 4947: How to use pkgsrc as non-root</a></span></dt>
1.1 grant 4948:
1.30 wiz 4949: <dt><span class="sect1"><a href=
1.38 dillo 4950: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 4951: fetching distfiles?</a></span></dt>
1.14 xtraeme 4952:
1.30 wiz 4953: <dt><span class="sect1"><a href=
1.38 dillo 4954: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 4955: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 4956:
1.30 wiz 4957: <dt><span class="sect1"><a href=
1.38 dillo 4958: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 4959: from pkgsrc?</a></span></dt>
1.1 grant 4960:
1.30 wiz 4961: <dt><span class="sect1"><a href=
1.38 dillo 4962: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 4963: behind a firewall</a></span></dt>
1.1 grant 4964:
1.38 dillo 4965: <dt><span class="sect1"><a href="#passive-ftp">7.9. How
1.14 xtraeme 4966: do I tell <span><strong class="command">make
4967: fetch</strong></span> to do passive
4968: FTP?</a></span></dt>
1.1 grant 4969:
1.30 wiz 4970: <dt><span class="sect1"><a href=
1.38 dillo 4971: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 4972: distfiles at once</a></span></dt>
1.1 grant 4973:
1.30 wiz 4974: <dt><span class="sect1"><a href=
1.38 dillo 4975: "#tmac.andoc-missing">7.11. What does
1.30 wiz 4976: “<span class="quote">Don't know how to make
1.14 xtraeme 4977: /usr/share/tmac/tmac.andoc</span>”
1.1 grant 4978: mean?</a></span></dt>
4979:
1.30 wiz 4980: <dt><span class="sect1"><a href=
1.38 dillo 4981: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 4982: “<span class="quote">Could not find
1.14 xtraeme 4983: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 4984:
1.30 wiz 4985: <dt><span class="sect1"><a href=
1.38 dillo 4986: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 4987: pkgsrc</a></span></dt>
1.1 grant 4988:
1.38 dillo 4989: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 4990: do I change the location of configuration
4991: files?</a></span></dt>
1.1 grant 4992:
1.38 dillo 4993: <dt><span class="sect1"><a href="#audit-packages">7.15.
1.1 grant 4994: Automated security checks</a></span></dt>
4995: </dl>
4996: </div>
4997:
4998: <p>This section contains hints, tips & tricks on
4999: special things in pkgsrc that we didn't find a better place
5000: for in the previous chapters, and it contains items for
5001: both pkgsrc users and developers.</p>
5002:
1.59 rillig 5003: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5004: <div class="titlepage">
5005: <div>
5006: <div>
5007: <h2 class="title" style="clear: both"><a name=
1.59 rillig 5008: "mailing-list-pointers" id=
1.38 dillo 5009: "mailing-list-pointers"></a>7.1. Are there any
1.30 wiz 5010: mailing lists for pkg-related discussion?</h2>
1.1 grant 5011: </div>
5012: </div>
5013: </div>
5014:
1.18 xtraeme 5015: <p>The following mailing lists may be of interest to
5016: pkgsrc users:</p>
5017:
5018: <div class="itemizedlist">
5019: <ul type="disc">
5020: <li>
5021: <p><a href=
5022: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.34 wiz 5023: target="_top">pkgsrc-bugs</a>: A list where problem
5024: reports related to pkgsrc are sent and
5025: discussed.</p>
1.18 xtraeme 5026: </li>
5027:
5028: <li>
5029: <p><a href=
5030: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34 wiz 5031: target="_top">pkgsrc-bulk</a>: A list where the
1.20 ben 5032: results of pkgsrc bulk builds are sent and
1.34 wiz 5033: discussed.</p>
1.18 xtraeme 5034: </li>
5035:
5036: <li>
5037: <p><a href=
5038: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.34 wiz 5039: target="_top">pkgsrc-changes</a>: A list where all
5040: commit messages to pkgsrc are sent.</p>
1.18 xtraeme 5041: </li>
5042:
5043: <li>
5044: <p><a href=
5045: "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.34 wiz 5046: target="_top">tech-pkg</a>: A general discussion
5047: list for all things related to pkgsrc.</p>
1.18 xtraeme 5048: </li>
5049: </ul>
5050: </div>
5051:
5052: <p>To subscribe, do:</p>
1.1 grant 5053: <pre class="programlisting">
1.51 rillig 5054: <code class="prompt">%</code> echo subscribe <em class=
1.18 xtraeme 5055: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1 grant 5056: </pre>
5057:
1.18 xtraeme 5058: <p>Archives for all these mailing lists are available
5059: from <a href="http://mail-index.NetBSD.org/" target=
5060: "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1 grant 5061: </div>
5062:
1.59 rillig 5063: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5064: <div class="titlepage">
5065: <div>
5066: <div>
5067: <h2 class="title" style="clear: both"><a name=
1.59 rillig 5068: "pkgviews-docs" id=
1.38 dillo 5069: "pkgviews-docs"></a>7.2. Where's the pkgviews
1.30 wiz 5070: documentation?</h2>
1.1 grant 5071: </div>
5072: </div>
5073: </div>
5074:
5075: <p>Pkgviews is tightly integrated with buildlink. You can
1.45 wiz 5076: find a pkgviews User's guide in <code xmlns=
5077: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5078: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1 grant 5079: </div>
5080:
1.59 rillig 5081: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5082: <div class="titlepage">
5083: <div>
5084: <div>
5085: <h2 class="title" style="clear: both"><a name=
1.59 rillig 5086: "faq-pkgtools" id=
1.38 dillo 5087: "faq-pkgtools"></a>7.3. Utilities for package
1.5 hubertf 5088: management (pkgtools)</h2>
1.1 grant 5089: </div>
5090: </div>
5091: </div>
5092:
1.45 wiz 5093: <p>The <code xmlns=
5094: "http://www.w3.org/TR/xhtml1/transitional" class=
5095: "filename">pkgsrc/pkgtools</code> directory pkgtools
5096: contains a number of useful utilities for both users and
5097: developers of pkgsrc. This section attempts only to make
5098: the reader aware of the utilities and when they might be
5099: useful, and not to duplicate the documentation that comes
5100: with each package.</p>
1.1 grant 5101:
5102: <p>Utilities used by pkgsrc (automatically installed when
5103: needed):</p>
5104:
5105: <div class="itemizedlist">
5106: <ul type="disc">
5107: <li>
5108: <p><a xmlns=
5109: "http://www.w3.org/TR/xhtml1/transitional" href=
5110: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.45 wiz 5111: target="_top"><code xmlns="" class=
5112: "filename">pkgtools/x11-links</code></a>: Symlinks
1.34 wiz 5113: for use by buildlink.</p>
1.1 grant 5114: </li>
5115: </ul>
5116: </div>
5117:
5118: <p>OS tool augmentation (automatically installed when
5119: needed):</p>
5120:
5121: <div class="itemizedlist">
5122: <ul type="disc">
5123: <li>
5124: <p><a xmlns=
5125: "http://www.w3.org/TR/xhtml1/transitional" href=
5126: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.45 wiz 5127: target="_top"><code xmlns="" class=
5128: "filename">pkgtools/digest</code></a>: Calculates
1.34 wiz 5129: various kinds of checksums (including SHA1).</p>
1.1 grant 5130: </li>
5131:
5132: <li>
5133: <p><a xmlns=
5134: "http://www.w3.org/TR/xhtml1/transitional" href=
5135: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.45 wiz 5136: target="_top"><code xmlns="" class=
5137: "filename">pkgtools/libnbcompat</code></a>:
1.34 wiz 5138: Compatibility library for pkgsrc tools.</p>
1.1 grant 5139: </li>
5140:
5141: <li>
5142: <p><a xmlns=
5143: "http://www.w3.org/TR/xhtml1/transitional" href=
5144: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.45 wiz 5145: target="_top"><code xmlns="" class=
5146: "filename">pkgtools/mtree</code></a>: Installed on
1.34 wiz 5147: non-BSD systems due to lack of native mtree.</p>
1.1 grant 5148: </li>
5149:
5150: <li>
5151: <p><a xmlns=
5152: "http://www.w3.org/TR/xhtml1/transitional" href=
5153: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5154: target="_top"><code xmlns="" class=
5155: "filename">pkgtools/pkg_install</code></a>:
5156: Up-to-date replacement for <code xmlns=
5157: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 5158: "filename">/usr/sbin/pkg_install</code>, or for use
5159: on operating systems where pkg_install is not
5160: present.</p>
1.1 grant 5161: </li>
5162: </ul>
5163: </div>
5164:
5165: <p>Utilities used by pkgsrc (not automatically
5166: installed):</p>
5167:
5168: <div class="itemizedlist">
5169: <ul type="disc">
5170: <li>
5171: <p><a xmlns=
5172: "http://www.w3.org/TR/xhtml1/transitional" href=
5173: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.45 wiz 5174: target="_top"><code xmlns="" class=
5175: "filename">pkgtools/pkg_tarup</code></a>: Create a
1.20 ben 5176: binary package from an already-installed package.
1.34 wiz 5177: Used by <span><strong class="command">make
5178: replace</strong></span> to save the old
5179: package.</p>
1.1 grant 5180: </li>
5181:
5182: <li>
5183: <p><a xmlns=
5184: "http://www.w3.org/TR/xhtml1/transitional" href=
1.5 hubertf 5185: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.45 wiz 5186: target="_top"><code xmlns="" class=
5187: "filename">pkgtools/dfdisk</code></a>: Adds extra
1.20 ben 5188: functionality to pkgsrc, allowing it to fetch
5189: distfiles from multiple locations. It currently
5190: supports the following methods: multiple CD-ROMs
5191: and network FTP/HTTP connections.</p>
1.5 hubertf 5192: </li>
5193:
5194: <li>
5195: <p><a xmlns=
5196: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 5197: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 wiz 5198: target="_top"><code xmlns="" class=
5199: "filename">pkgtools/xpkgwedge</code></a>: Put X11
1.34 wiz 5200: packages someplace else (enabled by default).</p>
1.1 grant 5201: </li>
1.5 hubertf 5202:
5203: <li>
5204: <p><a xmlns=
5205: "http://www.w3.org/TR/xhtml1/transitional" href=
5206: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 wiz 5207: target="_top"><code xmlns="" class=
5208: "filename">devel/cpuflags</code></a>: Determine the
1.34 wiz 5209: best compiler flags to optimise code for your
1.20 ben 5210: current CPU and compiler.</p>
1.5 hubertf 5211: </li>
1.1 grant 5212: </ul>
5213: </div>
5214:
5215: <p>Utilities for keeping track of installed packages,
5216: being up to date, etc:</p>
5217:
5218: <div class="itemizedlist">
5219: <ul type="disc">
5220: <li>
5221: <p><a xmlns=
5222: "http://www.w3.org/TR/xhtml1/transitional" href=
5223: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.45 wiz 5224: target="_top"><code xmlns="" class=
5225: "filename">pkgtools/pkg_chk</code></a>: Reports on
1.27 rillig 5226: packages whose installed versions do not match the
1.34 wiz 5227: latest pkgsrc entries.</p>
1.1 grant 5228: </li>
5229:
5230: <li>
5231: <p><a xmlns=
5232: "http://www.w3.org/TR/xhtml1/transitional" href=
5233: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 wiz 5234: target="_top"><code xmlns="" class=
5235: "filename">pkgtools/pkgdep</code></a>: Makes
1.20 ben 5236: dependency graphs of packages, to aid in choosing a
1.34 wiz 5237: strategy for updating.</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/pkgdepgraph/README.html"
1.45 wiz 5244: target="_top"><code xmlns="" class=
5245: "filename">pkgtools/pkgdepgraph</code></a>: Makes
1.27 rillig 5246: graphs from the output of <a xmlns=
5247: "http://www.w3.org/TR/xhtml1/transitional" href=
5248: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 wiz 5249: target="_top"><code xmlns="" class=
5250: "filename">pkgtools/pkgdep</code></a> (uses
1.34 wiz 5251: graphviz).</p>
1.1 grant 5252: </li>
5253:
5254: <li>
5255: <p><a xmlns=
5256: "http://www.w3.org/TR/xhtml1/transitional" href=
5257: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 5258: target="_top"><code xmlns="" class=
5259: "filename">pkgtools/pkglint</code></a>: The
1.27 rillig 5260: pkglint(1) program checks a pkgsrc entry for
5261: errors, lintpkgsrc(1) does various checks on the
5262: complete pkgsrc system.</p>
1.1 grant 5263: </li>
5264:
5265: <li>
5266: <p><a xmlns=
5267: "http://www.w3.org/TR/xhtml1/transitional" href=
5268: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.45 wiz 5269: target="_top"><code xmlns="" class=
5270: "filename">pkgtools/pkgsurvey</code></a>: Report
5271: what packages you have installed.</p>
1.1 grant 5272: </li>
5273: </ul>
5274: </div>
5275:
5276: <p>Utilities for people maintaining or creating
5277: individual packages:</p>
5278:
5279: <div class="itemizedlist">
5280: <ul type="disc">
5281: <li>
5282: <p><a xmlns=
5283: "http://www.w3.org/TR/xhtml1/transitional" href=
5284: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 5285: target="_top"><code xmlns="" class=
5286: "filename">pkgtools/pkgdiff</code></a>: Automate
1.20 ben 5287: making and maintaining patches for a package
1.34 wiz 5288: (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1 grant 5289: </li>
5290:
5291: <li>
5292: <p><a xmlns=
5293: "http://www.w3.org/TR/xhtml1/transitional" href=
5294: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.45 wiz 5295: target="_top"><code xmlns="" class=
5296: "filename">pkgtools/rpm2pkg</code></a>, <a xmlns=
1.20 ben 5297: "http://www.w3.org/TR/xhtml1/transitional" href=
5298: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 wiz 5299: target="_top"><code xmlns="" class=
5300: "filename">pkgtools/url2pkg</code></a>: Aids in
1.34 wiz 5301: converting to pkgsrc.</p>
1.1 grant 5302: </li>
5303:
5304: <li>
5305: <p><a xmlns=
5306: "http://www.w3.org/TR/xhtml1/transitional" href=
5307: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.45 wiz 5308: target="_top"><code xmlns="" class=
5309: "filename">pkgtools/gensolpkg</code></a>: Convert
1.34 wiz 5310: pkgsrc to a Solaris package.</p>
1.1 grant 5311: </li>
5312: </ul>
5313: </div>
5314:
1.47 reed 5315: <p>Utilities for people maintaining pkgsrc (or: more
1.1 grant 5316: obscure pkg utilities)</p>
5317:
5318: <div class="itemizedlist">
5319: <ul type="disc">
5320: <li>
5321: <p><a xmlns=
5322: "http://www.w3.org/TR/xhtml1/transitional" href=
5323: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.45 wiz 5324: target="_top"><code xmlns="" class=
5325: "filename">pkgtools/pkg_comp</code></a>: Build
1.34 wiz 5326: packages in a chrooted area.</p>
1.1 grant 5327: </li>
5328:
5329: <li>
5330: <p><a xmlns=
5331: "http://www.w3.org/TR/xhtml1/transitional" href=
5332: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.45 wiz 5333: target="_top"><code xmlns="" class=
5334: "filename">pkgtools/libkver</code></a>: Spoof
5335: kernel version for chrooted cross builds.</p>
1.1 grant 5336: </li>
5337: </ul>
5338: </div>
5339: </div>
5340:
1.59 rillig 5341: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5342: <div class="titlepage">
5343: <div>
5344: <div>
5345: <h2 class="title" style="clear: both"><a name=
1.59 rillig 5346: "non-root-pkgsrc" id=
1.38 dillo 5347: "non-root-pkgsrc"></a>7.4. How to use pkgsrc
1.30 wiz 5348: as non-root</h2>
1.1 grant 5349: </div>
5350: </div>
5351: </div>
5352:
5353: <p>If you want to use pkgsrc as non-root user, you can
5354: set some variables to make pkgsrc work under these
1.33 jmmv 5355: conditions. At the very least, you need to set
5356: <code class="varname">UNPRIVILEGED</code> to
5357: “<span class="quote">yes</span>”; this will
5358: turn on unprivileged mode and set multiple related
5359: variables to allow installation of packages as
5360: non-root.</p>
5361:
5362: <p>In case the defaults are not enough, you may want to
5363: tune some other variables used. For example, if the
5364: automatic user/group detection leads to incorrect values
5365: (or not the ones you would like to use), you can change
5366: them by setting <code class=
5367: "varname">UNPRIVILEGED_USER</code> and <code class=
5368: "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
5369:
5370: <p>As regards bootstrapping, please note that the
5371: <span><strong class="command">bootstrap</strong></span>
5372: script will ease non-root configuration when given the
5373: “<span class=
5374: "quote">--ignore-user-check</span>” flag, as it
5375: will choose and use multiple default directories under
1.45 wiz 5376: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5377: class="filename">~/pkg</code> as the installation
1.33 jmmv 5378: targets. These directories can be overriden by the
5379: “<span class="quote">--prefix</span>” flag
5380: provided by the script, as well as some others that allow
5381: finer tuning of the tree layout.</p>
1.14 xtraeme 5382: </div>
5383:
1.59 rillig 5384: <div class="sect1" lang="en" xml:lang="en">
1.14 xtraeme 5385: <div class="titlepage">
5386: <div>
5387: <div>
5388: <h2 class="title" style="clear: both"><a name=
1.59 rillig 5389: "resume-transfers" id=
1.38 dillo 5390: "resume-transfers"></a>7.5. How to resume
1.30 wiz 5391: transfers when fetching distfiles?</h2>
1.14 xtraeme 5392: </div>
5393: </div>
5394: </div>
5395:
1.47 reed 5396: <p>By default, resuming transfers in pkgsrc is disabled,
1.15 xtraeme 5397: but you can enable this feature by adding the option
5398: <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
1.45 wiz 5399: into <code xmlns=
5400: "http://www.w3.org/TR/xhtml1/transitional" class=
5401: "filename">/etc/mk.conf</code>. If, during a fetch step,
5402: an incomplete distfile is found, pkgsrc will try to
5403: resume it.</p>
1.15 xtraeme 5404:
5405: <p>You can also use a different program than the default
1.24 wiz 5406: <a href=
5407: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
5408: <span class="citerefentry"><span class=
5409: "refentrytitle">ftp</span>(1)</span></a> by changing the
5410: <code class="varname">FETCH_CMD</code> variable. Don't
5411: forget to set <code class=
5412: "varname">FETCH_RESUME_ARGS</code> and <code class=
5413: "varname">FETCH_OUTPUT_ARGS</code> if you are not using
5414: default values.</p>
1.14 xtraeme 5415:
1.45 wiz 5416: <p>For example, if you want to use <code xmlns=
5417: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5418: "filename">wget</code> to resume downloads, you'll have
5419: to use something like:</p>
5420: <pre class="programlisting">
1.51 rillig 5421: FETCH_CMD= wget
5422: FETCH_BEFORE_ARGS= --passive-ftp
5423: FETCH_RESUME_ARGS= -c
5424: FETCH_OUTPUT_ARGS= -O
1.14 xtraeme 5425: </pre>
1.1 grant 5426: </div>
5427:
1.59 rillig 5428: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5429: <div class="titlepage">
5430: <div>
5431: <div>
5432: <h2 class="title" style="clear: both"><a name=
1.59 rillig 5433: "XFree86-from-pkgsrc" id=
1.38 dillo 5434: "XFree86-from-pkgsrc"></a>7.6. How can I
1.1 grant 5435: install/use XFree86 from pkgsrc?</h2>
5436: </div>
5437: </div>
5438: </div>
5439:
5440: <p>If you want to use XFree86 from pkgsrc instead of your
1.45 wiz 5441: system's own X11 (<code xmlns=
5442: "http://www.w3.org/TR/xhtml1/transitional" class=
5443: "filename">/usr/X11R6</code>, <code xmlns=
5444: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5445: "filename">/usr/openwin</code>, ...), you will have to
1.45 wiz 5446: add the following line into <code xmlns=
5447: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5448: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5449: <pre class="programlisting">
1.51 rillig 5450: X11_TYPE=XFree86
1.1 grant 5451: </pre>
5452: </div>
5453:
1.59 rillig 5454: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5455: <div class="titlepage">
5456: <div>
5457: <div>
5458: <h2 class="title" style="clear: both"><a name=
1.59 rillig 5459: "x.org-from-pkgsrc" id=
1.38 dillo 5460: "x.org-from-pkgsrc"></a>7.7. How can I
1.1 grant 5461: install/use X.org from pkgsrc?</h2>
5462: </div>
5463: </div>
5464: </div>
5465:
5466: <p>If you want to use X.org from pkgsrc instead of your
1.45 wiz 5467: system's own X11 (<code xmlns=
5468: "http://www.w3.org/TR/xhtml1/transitional" class=
5469: "filename">/usr/X11R6</code>, <code xmlns=
5470: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5471: "filename">/usr/openwin</code>, ...) you will have to add
1.45 wiz 5472: the following line into <code xmlns=
5473: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5474: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5475: <pre class="programlisting">
1.51 rillig 5476: X11_TYPE=xorg
1.1 grant 5477: </pre>
5478: </div>
5479:
1.59 rillig 5480: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5481: <div class="titlepage">
5482: <div>
5483: <div>
5484: <h2 class="title" style="clear: both"><a name=
1.59 rillig 5485: "fetch-behind-firewall" id=
1.38 dillo 5486: "fetch-behind-firewall"></a>7.8. How to fetch
1.30 wiz 5487: files from behind a firewall</h2>
1.1 grant 5488: </div>
5489: </div>
5490: </div>
5491:
5492: <p>If you are sitting behind a firewall which does not
5493: allow direct connections to Internet hosts (i.e.
5494: non-NAT), you may specify the relevant proxy hosts. This
5495: is done using an environment variable in the form of a
1.47 reed 5496: URL, e.g. in Amdahl, the machine “<span class=
1.1 grant 5497: "quote">orpheus.amdahl.com</span>” is one of the
5498: firewalls, and it uses port 80 as the proxy port number.
5499: So the proxy environment variables are:</p>
5500: <pre class="programlisting">
1.51 rillig 5501: ftp_proxy=ftp://orpheus.amdahl.com:80/
5502: http_proxy=http://orpheus.amdahl.com:80/
1.1 grant 5503: </pre>
5504: </div>
5505:
1.59 rillig 5506: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5507: <div class="titlepage">
5508: <div>
5509: <div>
5510: <h2 class="title" style="clear: both"><a name=
1.59 rillig 5511: "passive-ftp" id="passive-ftp"></a>7.9. How do
5512: I tell <span><strong class="command">make
1.14 xtraeme 5513: fetch</strong></span> to do passive FTP?</h2>
1.1 grant 5514: </div>
5515: </div>
5516: </div>
5517:
5518: <p>This depends on which utility is used to retrieve
1.45 wiz 5519: distfiles. From <code xmlns=
5520: "http://www.w3.org/TR/xhtml1/transitional" class=
5521: "filename">bsd.pkg.mk</code>, <code class=
5522: "varname">FETCH_CMD</code> is assigned the first
5523: available command from the following list:</p>
1.34 wiz 5524:
5525: <div class="itemizedlist">
5526: <ul type="disc">
5527: <li>
1.45 wiz 5528: <p><code xmlns=
5529: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 5530: "filename">${LOCALBASE}/bin/ftp</code></p>
5531: </li>
5532:
5533: <li>
1.45 wiz 5534: <p><code xmlns=
5535: "http://www.w3.org/TR/xhtml1/transitional" class=
5536: "filename">/usr/bin/ftp</code></p>
1.34 wiz 5537: </li>
5538: </ul>
5539: </div>
1.1 grant 5540:
5541: <p>On a default NetBSD installation, this will be
1.45 wiz 5542: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5543: class="filename">/usr/bin/ftp</code>, which automatically
5544: tries passive connections first, and falls back to active
5545: connections if the server refuses to do passive. For the
5546: other tools, add the following to your <code xmlns=
5547: "http://www.w3.org/TR/xhtml1/transitional" class=
5548: "filename">/etc/mk.conf</code> file: <code class=
5549: "varname">PASSIVE_FETCH=1</code>.</p>
1.1 grant 5550:
1.45 wiz 5551: <p>Having that option present will prevent <code xmlns=
5552: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5553: "filename">/usr/bin/ftp</code> from falling back to
5554: active transfers.</p>
1.1 grant 5555: </div>
5556:
1.59 rillig 5557: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5558: <div class="titlepage">
5559: <div>
5560: <div>
5561: <h2 class="title" style="clear: both"><a name=
1.59 rillig 5562: "fetching-all-distfiles" id=
1.38 dillo 5563: "fetching-all-distfiles"></a>7.10. How to
1.1 grant 5564: fetch all distfiles at once</h2>
5565: </div>
5566: </div>
5567: </div>
5568:
5569: <p>You would like to download all the distfiles in a
5570: single batch from work or university, where you can't run
1.14 xtraeme 5571: a <span><strong class="command">make
5572: fetch</strong></span>. There is an archive of distfiles
5573: on <a href=
1.1 grant 5574: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
5575: target="_top">ftp.NetBSD.org</a>, but downloading the
5576: entire directory may not be appropriate.</p>
5577:
1.14 xtraeme 5578: <p>The answer here is to do a <span><strong class=
1.45 wiz 5579: "command">make fetch-list</strong></span> in <code xmlns=
5580: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 5581: "filename">/usr/pkgsrc</code> or one of its
1.1 grant 5582: subdirectories, carry the resulting list to your machine
1.23 wiz 5583: at work/school and use it there. If you don't have a
1.24 wiz 5584: NetBSD-compatible <a href=
5585: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
5586: <span class="citerefentry"><span class=
5587: "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
5588: at work, don't forget to set <code class=
5589: "varname">FETCH_CMD</code> to something that fetches a
5590: URL:</p>
1.1 grant 5591:
5592: <p>At home:</p>
5593: <pre class="screen">
1.14 xtraeme 5594: <code class="prompt">%</code> <strong class=
5595: "userinput"><code>cd /usr/pkgsrc</code></strong>
5596: <code class="prompt">%</code> <strong class=
5597: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
5598: <code class="prompt">%</code> <strong class=
5599: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1 grant 5600: </pre>
5601:
5602: <p>At work:</p>
5603: <pre class="screen">
1.14 xtraeme 5604: <code class="prompt">%</code> <strong class=
5605: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1 grant 5606: </pre>
5607:
1.45 wiz 5608: <p>then tar up <code xmlns=
5609: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5610: "filename">/tmp/distfiles</code> and take it home.</p>
1.1 grant 5611:
5612: <p>If you have a machine running NetBSD, and you want to
5613: get <span class="emphasis"><em>all</em></span> distfiles
5614: (even ones that aren't for your machine architecture),
5615: you can do so by using the above-mentioned
1.14 xtraeme 5616: <span><strong class="command">make
5617: fetch-list</strong></span> approach, or fetch the
5618: distfiles directly by running:</p>
1.1 grant 5619: <pre class="screen">
1.14 xtraeme 5620: <code class="prompt">%</code> <strong class=
5621: "userinput"><code>make mirror-distfiles</code></strong>
1.1 grant 5622: </pre>
5623:
1.14 xtraeme 5624: <p>If you even decide to ignore <code class=
5625: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
5626: can get everything by running:</p>
1.1 grant 5627: <pre class="screen">
1.14 xtraeme 5628: <code class="prompt">%</code> <strong class=
5629: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1 grant 5630: </pre>
5631: </div>
5632:
1.59 rillig 5633: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5634: <div class="titlepage">
5635: <div>
5636: <div>
5637: <h2 class="title" style="clear: both"><a name=
1.59 rillig 5638: "tmac.andoc-missing" id=
1.38 dillo 5639: "tmac.andoc-missing"></a>7.11. What does
1.1 grant 5640: “<span class="quote">Don't know how to make
5641: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
5642: </div>
5643: </div>
5644: </div>
5645:
5646: <p>When compiling the <a xmlns=
5647: "http://www.w3.org/TR/xhtml1/transitional" href=
5648: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5649: target="_top"><code xmlns="" class=
5650: "filename">pkgtools/pkg_install</code></a> package, you
5651: get the error from make that it doesn't know how to make
5652: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5653: class="filename">/usr/share/tmac/tmac.andoc</code>? This
5654: indicates that you don't have installed the
1.23 wiz 5655: “<span class="quote">text</span>” set (nroff,
5656: ...) from the NetBSD base distribution on your machine.
1.47 reed 5657: It is recommended to do that to format man pages.</p>
1.1 grant 5658:
5659: <p>In the case of the <a xmlns=
5660: "http://www.w3.org/TR/xhtml1/transitional" href=
5661: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5662: target="_top"><code xmlns="" class=
5663: "filename">pkgtools/pkg_install</code></a> package, you
5664: can get away with setting <code class=
1.20 ben 5665: "varname">NOMAN=YES</code> either in the environment or
1.45 wiz 5666: in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5667: class="filename">/etc/mk.conf</code>.</p>
1.1 grant 5668: </div>
5669:
1.59 rillig 5670: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5671: <div class="titlepage">
5672: <div>
5673: <div>
5674: <h2 class="title" style="clear: both"><a name=
1.59 rillig 5675: "bsd.own.mk-missing" id=
1.38 dillo 5676: "bsd.own.mk-missing"></a>7.12. What does
1.1 grant 5677: “<span class="quote">Could not find
5678: bsd.own.mk</span>” mean?</h2>
5679: </div>
5680: </div>
5681: </div>
5682:
1.45 wiz 5683: <p>You didn't install the compiler set, <code xmlns=
5684: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5685: "filename">comp.tgz</code>, when you installed your
1.47 reed 5686: NetBSD machine. Please get and install it, by extracting
5687: it in <code xmlns=
1.45 wiz 5688: "http://www.w3.org/TR/xhtml1/transitional" class=
5689: "filename">/</code>:</p>
1.1 grant 5690: <pre class="screen">
1.14 xtraeme 5691: <code class="prompt">#</code> <strong class=
5692: "userinput"><code>cd /</code></strong>
5693: <code class="prompt">#</code> <strong class=
5694: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1 grant 5695: </pre>
5696:
1.45 wiz 5697: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5698: class="filename">comp.tgz</code> is part of every NetBSD
5699: release. Get the one that corresponds to your release
5700: (determine via <span><strong class="command">uname
5701: -r</strong></span>).</p>
1.1 grant 5702: </div>
5703:
1.59 rillig 5704: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5705: <div class="titlepage">
5706: <div>
5707: <div>
5708: <h2 class="title" style="clear: both"><a name=
1.59 rillig 5709: "using-sudo-with-pkgsrc" id=
1.38 dillo 5710: "using-sudo-with-pkgsrc"></a>7.13. Using
1.1 grant 5711: 'sudo' with pkgsrc</h2>
5712: </div>
5713: </div>
5714: </div>
5715:
5716: <p>When installing packages as non-root user and using
1.24 wiz 5717: the just-in-time <a href=
5718: "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
5719: <span class="citerefentry"><span class=
5720: "refentrytitle">su</span>(1)</span></a> feature of
5721: pkgsrc, it can become annoying to type in the root
5722: password for each required package installed. To avoid
5723: this, the sudo package can be used, which does password
5724: caching over a limited time. To use it, install sudo
5725: (either as binary package or from <a xmlns=
5726: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 5727: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.45 wiz 5728: target="_top"><code xmlns="" class=
5729: "filename">security/sudo</code></a>) and then put the
5730: following into your <code xmlns=
5731: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 5732: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5733: <pre class="programlisting">
1.51 rillig 5734: .if exists(${LOCALBASE}/bin/sudo)
5735: SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c
5736: .endif
1.1 grant 5737: </pre>
5738: </div>
5739:
1.59 rillig 5740: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5741: <div class="titlepage">
5742: <div>
5743: <div>
5744: <h2 class="title" style="clear: both"><a name=
1.59 rillig 5745: "faq.conf" id="faq.conf"></a>7.14. How do I
5746: change the location of configuration files?</h2>
1.1 grant 5747: </div>
5748: </div>
5749: </div>
5750:
1.35 jmmv 5751: <p>As the system administrator, you can choose where
5752: configuration files are installed. The default settings
1.45 wiz 5753: make all these files go into <code xmlns=
5754: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 5755: "filename">${PREFIX}/etc</code> or some of its
5756: subdirectories; this may be suboptimal depending on your
5757: expectations (e.g., a read-only, NFS-exported
5758: <code class="varname">PREFIX</code> with a need of
5759: per-machine configuration of the provided packages).</p>
5760:
5761: <p>In order to change the defaults, you can modify the
5762: <code class="varname">PKG_SYSCONFBASE</code> variable (in
1.45 wiz 5763: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5764: class="filename">/etc/mk.conf</code>) to point to your
5765: preferred configuration directory; some common examples
5766: include <code xmlns=
5767: "http://www.w3.org/TR/xhtml1/transitional" class=
5768: "filename">/etc</code> or <code xmlns=
5769: "http://www.w3.org/TR/xhtml1/transitional" class=
5770: "filename">/etc/pkg</code>.</p>
1.35 jmmv 5771:
5772: <p>Furthermore, you can change this value on a
5773: per-package basis by setting the <code class=
5774: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
5775: variable. <code class="varname">PKG_SYSCONFVAR</code>'s
5776: value usually matches the name of the package you would
5777: like to modify, that is, the contents of <code class=
5778: "varname">PKGBASE</code>.</p>
1.1 grant 5779:
1.47 reed 5780: <p>Note that after changing these settings, you must
1.35 jmmv 5781: rebuild and reinstall any affected packages.</p>
1.1 grant 5782: </div>
5783:
1.59 rillig 5784: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 5785: <div class="titlepage">
5786: <div>
5787: <div>
5788: <h2 class="title" style="clear: both"><a name=
1.59 rillig 5789: "audit-packages" id=
1.38 dillo 5790: "audit-packages"></a>7.15. Automated security
1.1 grant 5791: checks</h2>
5792: </div>
5793: </div>
5794: </div>
5795:
5796: <p>Please be aware that there can often be bugs in
5797: third-party software, and some of these bugs can leave a
5798: machine vulnerable to exploitation by attackers. In an
5799: effort to lessen the exposure, the NetBSD packages team
5800: maintains a database of known-exploits to packages which
5801: have at one time been included in pkgsrc. The database
5802: can be downloaded automatically, and a security audit of
5803: all packages installed on a system can take place. To do
5804: this, install the <a xmlns=
5805: "http://www.w3.org/TR/xhtml1/transitional" href=
5806: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 5807: target="_top"><code xmlns="" class=
5808: "filename">security/audit-packages</code></a> package. It
1.20 ben 5809: has two components:</p>
1.1 grant 5810:
5811: <div class="orderedlist">
5812: <ol type="1">
5813: <li>
1.34 wiz 5814: <p><span><strong class=
5815: "command">download-vulnerability-list</strong></span>,
1.1 grant 5816: an easy way to download a list of the security
5817: vulnerabilities information. This list is kept up
5818: to date by the NetBSD security officer and the
5819: NetBSD packages team, and is distributed from the
5820: NetBSD ftp server:</p>
5821:
5822: <p><a href=
5823: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20 ben 5824: target=
5825: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 5826: </li>
5827:
5828: <li>
1.34 wiz 5829: <p><span><strong class=
5830: "command">audit-packages</strong></span>, an easy
5831: way to audit the current machine, checking each
1.1 grant 5832: vulnerability which is known. If a vulnerable
5833: package is installed, it will be shown by output to
5834: stdout, including a description of the type of
5835: vulnerability, and a URL containing more
5836: information.</p>
5837: </li>
5838: </ol>
5839: </div>
5840:
1.23 wiz 5841: <p>Use of the <a xmlns=
5842: "http://www.w3.org/TR/xhtml1/transitional" href=
5843: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 5844: target="_top"><code xmlns="" class=
5845: "filename">security/audit-packages</code></a> package is
1.23 wiz 5846: strongly recommended! After “<span class=
5847: "quote">audit-packages</span>” is installed, please
5848: read the package's message, which you can get by running
5849: <strong class="userinput"><code>pkg_info -D
5850: audit-package</code></strong>.</p>
1.58 erh 5851:
5852: <p>If this package is installed, pkgsrc builds will use
5853: it to perform a security check before building any
5854: package. See <a href="#variables-affecting-build" title=
5855: "5.2. Variables affecting the build process">Section 5.2,
5856: “Variables affecting the build process”</a>
1.59 rillig 5857: for ways to control this check.</p>
1.1 grant 5858: </div>
5859: </div>
5860: </div>
5861:
1.59 rillig 5862: <div class="part" lang="en" xml:lang="en">
1.1 grant 5863: <div class="titlepage">
5864: <div>
5865: <div>
1.59 rillig 5866: <h1 class="title"><a name="developers-guide" id=
1.48 dillo 5867: "developers-guide"></a>Part II. The pkgsrc
5868: developer's guide</h1>
1.1 grant 5869: </div>
5870: </div>
5871: </div>
5872:
5873: <div class="toc">
5874: <p><b>Table of Contents</b></p>
5875:
5876: <dl>
1.38 dillo 5877: <dt><span class="chapter"><a href="#components">8.
1.27 rillig 5878: Package components - files, directories and
5879: contents</a></span></dt>
5880:
5881: <dd>
5882: <dl>
5883: <dt><span class="sect1"><a href=
1.45 wiz 5884: "#components.Makefile">8.1. <code xmlns=
5885: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 5886: "filename">Makefile</code></a></span></dt>
5887:
5888: <dt><span class="sect1"><a href=
1.45 wiz 5889: "#components.distinfo">8.2. <code xmlns=
5890: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 5891: "filename">distinfo</code></a></span></dt>
5892:
5893: <dt><span class="sect1"><a href=
1.38 dillo 5894: "#components.patches">8.3. patches/*</a></span></dt>
1.27 rillig 5895:
1.30 wiz 5896: <dt><span class="sect1"><a href=
1.38 dillo 5897: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 5898: files</a></span></dt>
1.27 rillig 5899:
5900: <dt><span class="sect1"><a href=
1.38 dillo 5901: "#components.optional">8.5. Optional
1.27 rillig 5902: files</a></span></dt>
5903:
1.38 dillo 5904: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 5905: <code xmlns=
5906: "http://www.w3.org/TR/xhtml1/transitional" class=
5907: "filename">work*</code></a></span></dt>
1.27 rillig 5908:
1.38 dillo 5909: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 5910: <code xmlns=
5911: "http://www.w3.org/TR/xhtml1/transitional" class=
5912: "filename">files/*</code></a></span></dt>
1.27 rillig 5913: </dl>
5914: </dd>
5915:
1.38 dillo 5916: <dt><span class="chapter"><a href="#makefile">9.
1.45 wiz 5917: Programming in <code xmlns=
5918: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 5919: "filename">Makefile</code>s</a></span></dt>
5920:
5921: <dd>
5922: <dl>
5923: <dt><span class="sect1"><a href=
1.45 wiz 5924: "#makefile.variables">9.1. <code xmlns=
5925: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 5926: "filename">Makefile</code> variables</a></span></dt>
5927:
1.27 rillig 5928: <dd>
5929: <dl>
5930: <dt><span class="sect2"><a href=
1.38 dillo 5931: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 5932: conventions</a></span></dt>
5933: </dl>
5934: </dd>
5935:
1.38 dillo 5936: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.25 rillig 5937: Code snippets</a></span></dt>
5938:
5939: <dd>
5940: <dl>
5941: <dt><span class="sect2"><a href=
1.38 dillo 5942: "#adding-to-list">9.2.1. Adding things to a
1.25 rillig 5943: list</a></span></dt>
5944:
5945: <dt><span class="sect2"><a href=
1.38 dillo 5946: "#converting-internal-to-external">9.2.2.
1.30 wiz 5947: Converting an internal list into an external
5948: list</a></span></dt>
1.25 rillig 5949:
5950: <dt><span class="sect2"><a href=
1.38 dillo 5951: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 5952: variables to a shell command</a></span></dt>
1.27 rillig 5953:
5954: <dt><span class="sect2"><a href=
1.38 dillo 5955: "#quoting-guideline">9.2.4. Quoting
1.27 rillig 5956: guideline</a></span></dt>
5957:
5958: <dt><span class="sect2"><a href=
1.38 dillo 5959: "#bsd-make-bug-workaround">9.2.5. Workaround for
1.30 wiz 5960: a bug in BSD Make</a></span></dt>
1.25 rillig 5961: </dl>
5962: </dd>
5963: </dl>
5964: </dd>
5965:
1.38 dillo 5966: <dt><span class="chapter"><a href="#plist">10. PLIST
1.1 grant 5967: issues</a></span></dt>
5968:
5969: <dd>
5970: <dl>
1.38 dillo 5971: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 5972: ID</a></span></dt>
5973:
1.30 wiz 5974: <dt><span class="sect1"><a href=
1.38 dillo 5975: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 5976: <code xmlns=
5977: "http://www.w3.org/TR/xhtml1/transitional" class=
5978: "filename">PLIST</code> generation</a></span></dt>
1.1 grant 5979:
1.38 dillo 5980: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 5981: Tweaking output of <span><strong class="command">make
5982: print-PLIST</strong></span></a></span></dt>
1.1 grant 5983:
1.38 dillo 5984: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 5985: Variable substitution in PLIST</a></span></dt>
5986:
1.30 wiz 5987: <dt><span class="sect1"><a href=
1.48 dillo 5988: "#manpage-compression">10.5. Man page
5989: compression</a></span></dt>
1.1 grant 5990:
1.30 wiz 5991: <dt><span class="sect1"><a href=
1.38 dillo 5992: "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30 wiz 5993: <code class=
1.14 xtraeme 5994: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 5995:
1.30 wiz 5996: <dt><span class="sect1"><a href=
1.47 reed 5997: "#platform-specific-plist">10.7. Platform-specific
1.38 dillo 5998: and differing PLISTs</a></span></dt>
1.1 grant 5999:
6000: <dt><span class="sect1"><a href=
1.38 dillo 6001: "#faq.common-dirs">10.8. Sharing directories between
1.1 grant 6002: packages</a></span></dt>
6003: </dl>
6004: </dd>
6005:
1.38 dillo 6006: <dt><span class="chapter"><a href="#buildlink">11.
1.1 grant 6007: Buildlink methodology</a></span></dt>
6008:
6009: <dd>
6010: <dl>
1.30 wiz 6011: <dt><span class="sect1"><a href=
1.38 dillo 6012: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 6013: to use buildlink3</a></span></dt>
1.1 grant 6014:
1.30 wiz 6015: <dt><span class="sect1"><a href=
1.45 wiz 6016: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
6017: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 6018: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 6019:
6020: <dd>
6021: <dl>
6022: <dt><span class="sect2"><a href=
1.38 dillo 6023: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 6024: buildlink3.mk file</a></span></dt>
1.1 grant 6025:
6026: <dt><span class="sect2"><a href=
1.38 dillo 6027: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 6028: <code class=
1.59 rillig 6029: "varname">BUILDLINK_DEPENDS.<em class="replaceable">
6030: <code>pkg</code></em></code> in <code xmlns=
1.45 wiz 6031: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 6032: "filename">buildlink3.mk</code>
1.1 grant 6033: files</a></span></dt>
6034: </dl>
6035: </dd>
6036:
1.30 wiz 6037: <dt><span class="sect1"><a href=
1.45 wiz 6038: "#writing-builtin.mk">11.3. Writing <code xmlns=
6039: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 6040: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 6041:
6042: <dd>
6043: <dl>
6044: <dt><span class="sect2"><a href=
1.38 dillo 6045: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 6046: <code xmlns=
6047: "http://www.w3.org/TR/xhtml1/transitional" class=
6048: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 6049:
6050: <dt><span class="sect2"><a href=
1.38 dillo 6051: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 6052: preferences for native or pkgsrc
6053: software</a></span></dt>
1.1 grant 6054: </dl>
6055: </dd>
6056: </dl>
6057: </dd>
6058:
1.38 dillo 6059: <dt><span class="chapter"><a href="#pkginstall">12. The
1.35 jmmv 6060: pkginstall framework</a></span></dt>
6061:
6062: <dd>
6063: <dl>
6064: <dt><span class="sect1"><a href=
1.38 dillo 6065: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 6066: directories outside the installation
6067: prefix</a></span></dt>
6068:
6069: <dd>
6070: <dl>
6071: <dt><span class="sect2"><a href=
1.38 dillo 6072: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 6073: manipulation</a></span></dt>
6074:
6075: <dt><span class="sect2"><a href=
1.38 dillo 6076: "#files-outside-prefix">12.1.2. File
1.35 jmmv 6077: manipulation</a></span></dt>
6078: </dl>
6079: </dd>
6080:
1.38 dillo 6081: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 6082: Configuration files</a></span></dt>
6083:
6084: <dd>
6085: <dl>
6086: <dt><span class="sect2"><a href=
1.38 dillo 6087: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 6088: "varname">PKG_SYSCONFDIR</code> is
6089: set</a></span></dt>
6090:
6091: <dt><span class="sect2"><a href=
1.38 dillo 6092: "#conf-files-configure">12.2.2. Telling the
1.47 reed 6093: software where configuration files
1.35 jmmv 6094: are</a></span></dt>
6095:
6096: <dt><span class="sect2"><a href=
1.38 dillo 6097: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 6098: installations</a></span></dt>
6099:
6100: <dt><span class="sect2"><a href=
1.38 dillo 6101: "#conf-files-disable">12.2.4. Disabling handling
1.35 jmmv 6102: of configuration files</a></span></dt>
6103: </dl>
6104: </dd>
6105:
1.38 dillo 6106: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 6107: System startup scripts</a></span></dt>
6108:
6109: <dd>
6110: <dl>
6111: <dt><span class="sect2"><a href=
1.38 dillo 6112: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 6113: of system startup scripts</a></span></dt>
6114: </dl>
6115: </dd>
6116:
6117: <dt><span class="sect1"><a href=
1.38 dillo 6118: "#users-and-groups">12.4. System users and
1.35 jmmv 6119: groups</a></span></dt>
6120:
1.38 dillo 6121: <dt><span class="sect1"><a href="#shells">12.5.
1.35 jmmv 6122: System shells</a></span></dt>
6123:
6124: <dd>
6125: <dl>
6126: <dt><span class="sect2"><a href=
1.38 dillo 6127: "#shells-disable">12.5.1. Disabling handling of
1.35 jmmv 6128: configuration files</a></span></dt>
6129: </dl>
6130: </dd>
6131: </dl>
6132: </dd>
6133:
1.38 dillo 6134: <dt><span class="chapter"><a href="#options">13. Options
1.1 grant 6135: handling</a></span></dt>
6136:
6137: <dd>
6138: <dl>
1.30 wiz 6139: <dt><span class="sect1"><a href=
1.38 dillo 6140: "#global-default-options">13.1. Global default
1.30 wiz 6141: options</a></span></dt>
1.1 grant 6142:
1.30 wiz 6143: <dt><span class="sect1"><a href=
1.38 dillo 6144: "#converting-to-options">13.2. Converting packages to
1.45 wiz 6145: use <code xmlns=
6146: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6147: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 6148:
6149: <dt><span class="sect1"><a href="#option-names">13.3.
6150: Option Names</a></span></dt>
1.1 grant 6151: </dl>
6152: </dd>
6153:
1.38 dillo 6154: <dt><span class="chapter"><a href="#build">14. The build
1.1 grant 6155: process</a></span></dt>
6156:
6157: <dd>
6158: <dl>
1.56 rillig 6159: <dt><span class="sect1"><a href="#build.intro">14.1.
6160: Introduction</a></span></dt>
6161:
6162: <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1 grant 6163: Program location</a></span></dt>
6164:
1.56 rillig 6165: <dt><span class="sect1"><a href=
6166: "#build.builddirs">14.3. Directories used during the
6167: build process</a></span></dt>
1.1 grant 6168:
6169: <dt><span class="sect1"><a href=
1.56 rillig 6170: "#build.running">14.4. Running a
6171: phase</a></span></dt>
6172:
6173: <dt><span class="sect1"><a href="#build.fetch">14.5.
6174: The <span class="emphasis"><em>fetch</em></span>
6175: phase</a></span></dt>
6176:
6177: <dt><span class="sect1"><a href=
6178: "#build.checksum">14.6. The <span class=
6179: "emphasis"><em>checksum</em></span>
6180: phase</a></span></dt>
6181:
6182: <dt><span class="sect1"><a href=
6183: "#build.extract">14.7. The <span class=
6184: "emphasis"><em>extract</em></span>
6185: phase</a></span></dt>
6186:
6187: <dt><span class="sect1"><a href="#build.patch">14.8.
6188: The <span class="emphasis"><em>patch</em></span>
6189: phase</a></span></dt>
6190:
6191: <dt><span class="sect1"><a href="#build.tools">14.9.
6192: The <span class="emphasis"><em>tools</em></span>
6193: phase</a></span></dt>
6194:
6195: <dt><span class="sect1"><a href=
6196: "#build.wrapper">14.10. The <span class=
6197: "emphasis"><em>wrapper</em></span>
6198: phase</a></span></dt>
6199:
6200: <dt><span class="sect1"><a href=
6201: "#build.configure">14.11. The <span class=
6202: "emphasis"><em>configure</em></span>
6203: phase</a></span></dt>
6204:
6205: <dt><span class="sect1"><a href="#build.build">14.12.
6206: The <span class="emphasis"><em>build</em></span>
6207: phase</a></span></dt>
6208:
6209: <dt><span class="sect1"><a href="#build.test">14.13.
6210: The <span class="emphasis"><em>test</em></span>
6211: phase</a></span></dt>
6212:
6213: <dt><span class="sect1"><a href=
6214: "#build.install">14.14. The <span class=
6215: "emphasis"><em>install</em></span>
6216: phase</a></span></dt>
6217:
6218: <dt><span class="sect1"><a href=
6219: "#build.package">14.15. The <span class=
6220: "emphasis"><em>package</em></span>
6221: phase</a></span></dt>
6222:
6223: <dt><span class="sect1"><a href=
6224: "#build.helpful-targets">14.16. Other helpful
1.1 grant 6225: targets</a></span></dt>
6226: </dl>
6227: </dd>
6228:
1.55 rillig 6229: <dt><span class="chapter"><a href="#fixes">15. Making
6230: your package work</a></span></dt>
1.1 grant 6231:
6232: <dd>
6233: <dl>
1.30 wiz 6234: <dt><span class="sect1"><a href=
1.38 dillo 6235: "#general-operation">15.1. General
1.30 wiz 6236: operation</a></span></dt>
1.1 grant 6237:
6238: <dd>
6239: <dl>
6240: <dt><span class="sect2"><a href=
1.38 dillo 6241: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 6242: pull in variables from
6243: /etc/mk.conf</a></span></dt>
1.1 grant 6244:
6245: <dt><span class="sect2"><a href=
1.38 dillo 6246: "#where-to-install-documentation">15.1.2. Where
1.31 wiz 6247: to install documentation</a></span></dt>
6248:
6249: <dt><span class="sect2"><a href=
1.38 dillo 6250: "#restricted-packages">15.1.3. Restricted
1.1 grant 6251: packages</a></span></dt>
6252:
6253: <dt><span class="sect2"><a href=
1.38 dillo 6254: "#dependencies">15.1.4. Handling
1.1 grant 6255: dependencies</a></span></dt>
6256:
6257: <dt><span class="sect2"><a href=
1.38 dillo 6258: "#conflicts">15.1.5. Handling conflicts with
1.1 grant 6259: other packages</a></span></dt>
6260:
6261: <dt><span class="sect2"><a href=
1.38 dillo 6262: "#not-building-packages">15.1.6. Packages that
1.30 wiz 6263: cannot or should not be built</a></span></dt>
1.1 grant 6264:
6265: <dt><span class="sect2"><a href=
1.38 dillo 6266: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 6267: should not be deleted, once
6268: installed</a></span></dt>
1.1 grant 6269:
6270: <dt><span class="sect2"><a href=
1.38 dillo 6271: "#security-handling">15.1.8. Handling packages
1.1 grant 6272: with security problems</a></span></dt>
6273:
6274: <dt><span class="sect2"><a href=
1.38 dillo 6275: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 6276: bugs</a></span></dt>
6277:
6278: <dt><span class="sect2"><a href=
1.38 dillo 6279: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 6280: incrementing versions when fixing an existing
1.1 grant 6281: package</a></span></dt>
6282:
6283: <dt><span class="sect2"><a href=
1.38 dillo 6284: "#portability-of-packages">15.1.11. Portability
1.30 wiz 6285: of packages</a></span></dt>
1.1 grant 6286: </dl>
6287: </dd>
6288:
1.30 wiz 6289: <dt><span class="sect1"><a href=
1.38 dillo 6290: "#downloading-issues">15.2. Possible downloading
1.30 wiz 6291: issues</a></span></dt>
1.1 grant 6292:
6293: <dd>
6294: <dl>
6295: <dt><span class="sect2"><a href=
1.38 dillo 6296: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 6297: distfiles aren't available for plain
1.1 grant 6298: downloading</a></span></dt>
6299:
6300: <dt><span class="sect2"><a href=
1.38 dillo 6301: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 6302: handle modified distfiles with the 'old'
6303: name</a></span></dt>
1.1 grant 6304: </dl>
6305: </dd>
6306:
1.30 wiz 6307: <dt><span class="sect1"><a href=
1.38 dillo 6308: "#configuration-gotchas">15.3. Configuration
1.30 wiz 6309: gotchas</a></span></dt>
1.1 grant 6310:
6311: <dd>
6312: <dl>
6313: <dt><span class="sect2"><a href=
1.38 dillo 6314: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 6315: libtool</a></span></dt>
6316:
6317: <dt><span class="sect2"><a href=
1.38 dillo 6318: "#using-libtool">15.3.2. Using libtool on GNU
1.1 grant 6319: packages that already support
6320: libtool</a></span></dt>
6321:
6322: <dt><span class="sect2"><a href=
1.38 dillo 6323: "#autoconf-automake">15.3.3. GNU
1.1 grant 6324: Autoconf/Automake</a></span></dt>
6325: </dl>
6326: </dd>
6327:
1.55 rillig 6328: <dt><span class="sect1"><a href="#fixes-build">15.4.
6329: Building the package</a></span></dt>
1.1 grant 6330:
6331: <dd>
6332: <dl>
6333: <dt><span class="sect2"><a href=
1.38 dillo 6334: "#cpp-defines">15.4.1. CPP
1.30 wiz 6335: defines</a></span></dt>
1.51 rillig 6336:
6337: <dt><span class="sect2"><a href=
1.60 ! rillig 6338: "#cpp-list-examples">15.4.2. Examples of CPP
! 6339: defines for some platforms</a></span></dt>
! 6340:
! 6341: <dt><span class="sect2"><a href=
! 6342: "#cpp-list">15.4.3. Getting a list of CPP
1.51 rillig 6343: defines</a></span></dt>
1.1 grant 6344: </dl>
6345: </dd>
6346:
1.30 wiz 6347: <dt><span class="sect1"><a href=
1.38 dillo 6348: "#package-specific-actions">15.5. Package specific
1.30 wiz 6349: actions</a></span></dt>
1.1 grant 6350:
6351: <dd>
6352: <dl>
6353: <dt><span class="sect2"><a href=
1.38 dillo 6354: "#user-interaction">15.5.1. User
1.2 hubertf 6355: interaction</a></span></dt>
1.1 grant 6356:
6357: <dt><span class="sect2"><a href=
1.38 dillo 6358: "#handling-licenses">15.5.2. Handling
1.1 grant 6359: licenses</a></span></dt>
6360:
6361: <dt><span class="sect2"><a href=
1.38 dillo 6362: "#installing-score-files">15.5.3. Installing
1.30 wiz 6363: score files</a></span></dt>
1.1 grant 6364:
6365: <dt><span class="sect2"><a href=
1.38 dillo 6366: "#perl-scripts">15.5.4. Packages containing perl
1.1 grant 6367: scripts</a></span></dt>
6368:
6369: <dt><span class="sect2"><a href=
1.38 dillo 6370: "#hardcoded-paths">15.5.5. Packages with
1.30 wiz 6371: hardcoded paths to other
6372: interpreters</a></span></dt>
1.1 grant 6373:
6374: <dt><span class="sect2"><a href=
1.38 dillo 6375: "#perl-modules">15.5.6. Packages installing perl
1.1 grant 6376: modules</a></span></dt>
6377:
6378: <dt><span class="sect2"><a href=
1.38 dillo 6379: "#faq.info-files">15.5.7. Packages installing
1.1 grant 6380: info files</a></span></dt>
6381:
6382: <dt><span class="sect2"><a href=
1.57 minskim 6383: "#manpages">15.5.8. Packages installing man
6384: pages</a></span></dt>
6385:
6386: <dt><span class="sect2"><a href=
6387: "#gconf2-data-files">15.5.9. Packages installing
1.30 wiz 6388: GConf2 data files</a></span></dt>
1.1 grant 6389:
6390: <dt><span class="sect2"><a href=
1.57 minskim 6391: "#scrollkeeper-data-files">15.5.10. Packages
1.30 wiz 6392: installing scrollkeeper data
6393: files</a></span></dt>
1.1 grant 6394:
6395: <dt><span class="sect2"><a href=
1.57 minskim 6396: "#x11-fonts">15.5.11. Packages installing X11
1.1 grant 6397: fonts</a></span></dt>
6398:
6399: <dt><span class="sect2"><a href=
1.57 minskim 6400: "#gtk2-modules">15.5.12. Packages installing GTK2
1.1 grant 6401: modules</a></span></dt>
6402:
6403: <dt><span class="sect2"><a href=
1.57 minskim 6404: "#sgml-xml-data">15.5.13. Packages installing
1.30 wiz 6405: SGML or XML data</a></span></dt>
1.1 grant 6406:
6407: <dt><span class="sect2"><a href=
1.57 minskim 6408: "#mime-database">15.5.14. Packages installing
1.1 grant 6409: extensions to the MIME database</a></span></dt>
6410:
6411: <dt><span class="sect2"><a href=
1.57 minskim 6412: "#intltool">15.5.15. Packages using
1.1 grant 6413: intltool</a></span></dt>
1.18 xtraeme 6414:
6415: <dt><span class="sect2"><a href=
1.57 minskim 6416: "#startup-scripts">15.5.16. Packages installing
1.30 wiz 6417: startup scripts</a></span></dt>
1.57 minskim 6418:
6419: <dt><span class="sect2"><a href=
6420: "#tex-packages">15.5.17. Packages installing TeX
6421: modules</a></span></dt>
1.1 grant 6422: </dl>
6423: </dd>
6424:
1.30 wiz 6425: <dt><span class="sect1"><a href=
1.38 dillo 6426: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 6427: author</a></span></dt>
1.1 grant 6428: </dl>
6429: </dd>
6430:
1.38 dillo 6431: <dt><span class="chapter"><a href="#debug">16.
1.1 grant 6432: Debugging</a></span></dt>
6433:
1.38 dillo 6434: <dt><span class="chapter"><a href="#submit">17.
1.1 grant 6435: Submitting and Committing</a></span></dt>
6436:
6437: <dd>
6438: <dl>
1.30 wiz 6439: <dt><span class="sect1"><a href=
1.38 dillo 6440: "#submitting-your-package">17.1. Submitting your
1.30 wiz 6441: packages</a></span></dt>
1.1 grant 6442:
1.30 wiz 6443: <dt><span class="sect1"><a href=
1.41 wiz 6444: "#general-notes-for-changes">17.2. General notes when
6445: adding, updating, or removing
6446: packages</a></span></dt>
6447:
6448: <dt><span class="sect1"><a href=
6449: "#committing-importing">17.3. Committing: Importing a
1.30 wiz 6450: package into CVS</a></span></dt>
1.1 grant 6451:
1.30 wiz 6452: <dt><span class="sect1"><a href=
1.41 wiz 6453: "#updating-package">17.4. Updating a package to a
1.30 wiz 6454: newer version</a></span></dt>
1.1 grant 6455:
1.30 wiz 6456: <dt><span class="sect1"><a href=
1.41 wiz 6457: "#moving-package">17.5. Moving a package in
1.30 wiz 6458: pkgsrc</a></span></dt>
1.1 grant 6459: </dl>
6460: </dd>
6461: </dl>
6462: </div>
6463:
1.59 rillig 6464: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 6465: <div class="titlepage">
6466: <div>
6467: <div>
1.59 rillig 6468: <h2 class="title"><a name="components" id=
1.38 dillo 6469: "components"></a>Chapter 8. Package
1.27 rillig 6470: components - files, directories and contents</h2>
1.25 rillig 6471: </div>
6472: </div>
6473: </div>
6474:
6475: <div class="toc">
6476: <p><b>Table of Contents</b></p>
6477:
6478: <dl>
6479: <dt><span class="sect1"><a href=
1.45 wiz 6480: "#components.Makefile">8.1. <code xmlns=
6481: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6482: "filename">Makefile</code></a></span></dt>
6483:
6484: <dt><span class="sect1"><a href=
1.45 wiz 6485: "#components.distinfo">8.2. <code xmlns=
6486: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6487: "filename">distinfo</code></a></span></dt>
6488:
6489: <dt><span class="sect1"><a href=
1.38 dillo 6490: "#components.patches">8.3. patches/*</a></span></dt>
1.25 rillig 6491:
1.30 wiz 6492: <dt><span class="sect1"><a href=
1.38 dillo 6493: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 6494: files</a></span></dt>
1.25 rillig 6495:
1.27 rillig 6496: <dt><span class="sect1"><a href=
1.38 dillo 6497: "#components.optional">8.5. Optional
1.27 rillig 6498: files</a></span></dt>
1.25 rillig 6499:
1.38 dillo 6500: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 6501: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6502: class="filename">work*</code></a></span></dt>
1.25 rillig 6503:
1.38 dillo 6504: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 6505: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6506: class="filename">files/*</code></a></span></dt>
1.25 rillig 6507: </dl>
6508: </div>
6509:
1.27 rillig 6510: <p>Whenever you're preparing a package, there are a number
6511: of files involved which are described in the following
6512: sections.</p>
1.25 rillig 6513:
1.59 rillig 6514: <div class="sect1" lang="en" xml:lang="en">
1.25 rillig 6515: <div class="titlepage">
6516: <div>
6517: <div>
6518: <h2 class="title" style="clear: both"><a name=
1.59 rillig 6519: "components.Makefile" id=
1.45 wiz 6520: "components.Makefile"></a>8.1. <code xmlns=
6521: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6522: "filename">Makefile</code></h2>
1.25 rillig 6523: </div>
6524: </div>
6525: </div>
6526:
1.27 rillig 6527: <p>Building, installation and creation of a binary
1.45 wiz 6528: package are all controlled by the package's <code xmlns=
6529: "http://www.w3.org/TR/xhtml1/transitional" class=
6530: "filename">Makefile</code>. The <code xmlns=
6531: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6532: "filename">Makefile</code> describes various things about
6533: a package, for example from where to get it, how to
6534: configure, build, and install it.</p>
6535:
1.45 wiz 6536: <p>A package <code xmlns=
6537: "http://www.w3.org/TR/xhtml1/transitional" class=
6538: "filename">Makefile</code> contains several sections that
6539: describe the package.</p>
1.25 rillig 6540:
1.27 rillig 6541: <p>In the first section there are the following
6542: variables, which should appear exactly in the order given
6543: here.</p>
1.25 rillig 6544:
6545: <div class="itemizedlist">
6546: <ul type="disc">
6547: <li>
1.27 rillig 6548: <p><code class="varname">DISTNAME</code> is the
6549: basename of the distribution file to be downloaded
6550: from the package's website.</p>
6551: </li>
6552:
6553: <li>
6554: <p><code class="varname">PKGNAME</code> is the name
6555: of the package, as used by pkgsrc. You only need to
1.50 rillig 6556: provide it if it differs from <code class=
6557: "varname">DISTNAME</code>. Usually it is the
6558: directory name together with the version number. It
6559: must match the regular expression <code class=
1.27 rillig 6560: "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
6561: that is, it starts with a letter or digit, and
6562: contains only letters, digits, dashes, underscores,
6563: dots and plus signs.</p>
1.25 rillig 6564: </li>
6565:
6566: <li>
1.27 rillig 6567: <p><code class="varname">CATEGORIES</code> is a
6568: list of categories which the package fits in. You
6569: can choose any of the top-level directories of
6570: pkgsrc for it.</p>
1.45 wiz 6571:
6572: <p>Currently the following values are available for
6573: <code class="varname">CATEGORIES</code>. If more
6574: than one is used, they need to be separated by
6575: spaces:</p>
6576: <pre class="programlisting">
1.51 rillig 6577: archivers cross geography meta-pkgs security
6578: audio databases graphics misc shells
6579: benchmarks devel ham multimedia sysutils
6580: biology editors inputmethod net textproc
6581: cad emulators lang news time
6582: chat finance mail parallel wm
6583: comms fonts math pkgtools www
6584: converters games mbone print x11
1.45 wiz 6585: </pre>
1.25 rillig 6586: </li>
6587:
6588: <li>
1.27 rillig 6589: <p><code class="varname">MASTER_SITES</code> is a
6590: list of URLs where the distribution files can be
6591: downloaded. Each URL must end with a slash.</p>
1.45 wiz 6592:
6593: <p>The <code class="varname">MASTER_SITES</code>
6594: may make use of the following predefined sites:</p>
6595: <pre class="programlisting">
1.51 rillig 6596: ${MASTER_SITE_APACHE}
6597: ${MASTER_SITE_BACKUP}
6598: ${MASTER_SITE_CYGWIN}
6599: ${MASTER_SITE_DEBIAN}
6600: ${MASTER_SITE_FREEBSD}
6601: ${MASTER_SITE_FREEBSD_LOCAL}
6602: ${MASTER_SITE_GNOME}
6603: ${MASTER_SITE_GNU}
6604: ${MASTER_SITE_GNUSTEP}
6605: ${MASTER_SITE_IFARCHIVE}
6606: ${MASTER_SITE_MOZILLA}
6607: ${MASTER_SITE_OPENOFFICE}
6608: ${MASTER_SITE_PERL_CPAN}
6609: ${MASTER_SITE_R_CRAN}
6610: ${MASTER_SITE_SOURCEFORGE}
6611: ${MASTER_SITE_SUNSITE}
6612: ${MASTER_SITE_SUSE}
6613: ${MASTER_SITE_TEX_CTAN}
6614: ${MASTER_SITE_XCONTRIB}
6615: ${MASTER_SITE_XEMACS}
1.45 wiz 6616: </pre>
6617:
6618: <p>If one of these predefined sites is chosen, you
6619: may want to specify a subdirectory of that site.
6620: Since these macros may expand to more than one
6621: actual site, you <span class=
6622: "emphasis"><em>must</em></span> use the following
6623: construct to specify a subdirectory:</p>
6624: <pre class="programlisting">
1.51 rillig 6625: ${MASTER_SITE_GNU:=subdirectory/name/}
6626: ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.45 wiz 6627: </pre>
6628:
6629: <p>Note the trailing slash after the subdirectory
6630: name.</p>
6631:
6632: <p>If the package has multiple <code class=
6633: "varname">DISTFILES</code> or multiple <code class=
6634: "varname">PATCHFILES</code> from different sites,
6635: set <code class="varname">SITES_foo</code> to a
1.47 reed 6636: list of URIs where file “<span class=
1.45 wiz 6637: "quote">foo</span>” may be found.
6638: “<span class="quote">foo</span>”
1.47 reed 6639: includes the suffix, e.g.:</p>
1.45 wiz 6640: <pre class="programlisting">
1.51 rillig 6641: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
6642: DISTFILES+= foo-file.tar.gz
6643: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
6644: http://www.somewhereelse.com/mirror/somehow/
1.45 wiz 6645: </pre>
6646: </li>
6647:
6648: <li>
6649: <p><code class="varname">DISTFILES</code>: Name(s)
6650: of archive file(s) containing distribution. The
6651: default is <code xmlns=
6652: "http://www.w3.org/TR/xhtml1/transitional" class=
6653: "filename">${DISTNAME}${EXTRACT_SUFX}</code>.
6654: Should only be set if you have more than one
6655: distfile.</p>
6656:
6657: <p>Note that the normal default setting of
6658: <code class="varname">DISTFILES</code> must be made
6659: explicit if you want to add to it (rather than
6660: replace it), as you usually would.</p>
6661: </li>
6662:
6663: <li>
6664: <p><code class="varname">EXTRACT_SUFX</code>:
6665: Suffix of the distribution file, will be appended
6666: to <code class="varname">DISTNAME</code>. Defaults
6667: to <code xmlns=
6668: "http://www.w3.org/TR/xhtml1/transitional" class=
6669: "filename">.tar.gz</code>.</p>
6670: </li>
6671: </ul>
6672: </div>
6673:
6674: <p>The second section contains information about
6675: separately downloaded patches, if any.</p>
6676:
6677: <div class="itemizedlist">
6678: <ul type="disc">
6679: <li>
1.47 reed 6680: <p><code class="varname">PATCHFILES:</code> Name(s)
1.45 wiz 6681: of additional files that contain distribution
6682: patches. There is no default. pkgsrc will look for
6683: them at <code class="varname">PATCH_SITES</code>.
6684: They will automatically be uncompressed before
6685: patching if the names end with <code xmlns=
6686: "http://www.w3.org/TR/xhtml1/transitional" class=
6687: "filename">.gz</code> or <code xmlns=
6688: "http://www.w3.org/TR/xhtml1/transitional" class=
6689: "filename">.Z</code>.</p>
6690: </li>
6691:
6692: <li>
6693: <p><code class="varname">PATCH_SITES</code>:
6694: Primary location(s) for distribution patch files
6695: (see <code class="varname">PATCHFILES</code> below)
6696: if not found locally.</p>
1.25 rillig 6697: </li>
6698: </ul>
6699: </div>
6700:
1.45 wiz 6701: <p>The third section contains the following
1.27 rillig 6702: variables.</p>
1.25 rillig 6703:
1.27 rillig 6704: <div class="itemizedlist">
6705: <ul type="disc">
6706: <li>
6707: <p><code class="varname">MAINTAINER</code> is the
1.50 rillig 6708: email address of the person who feels responsible
6709: for this package, and who is most likely to look at
6710: problems or questions regarding this package which
6711: have been reported with <a href=
1.45 wiz 6712: "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
6713: <span class="citerefentry"><span class=
1.50 rillig 6714: "refentrytitle">send-pr</span>(1)</span></a>. Other
6715: developers should contact the <code class=
6716: "varname">MAINTAINER</code> before making major
6717: changes to the package. When packaging a new
6718: program, set <code class=
6719: "varname">MAINTAINER</code> to yourself. If you
6720: really can't maintain the package for future
6721: updates, set it to <code class="email"><<a href=
1.45 wiz 6722: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></code>.</p>
1.27 rillig 6723: </li>
1.25 rillig 6724:
1.27 rillig 6725: <li>
6726: <p><code class="varname">HOMEPAGE</code> is a URL
6727: where users can find more information about the
1.23 wiz 6728: package.</p>
6729: </li>
1.1 grant 6730:
1.23 wiz 6731: <li>
6732: <p><code class="varname">COMMENT</code> is a
1.45 wiz 6733: one-line description of the package (should not
6734: include the package name).</p>
1.23 wiz 6735: </li>
6736: </ul>
6737: </div>
1.1 grant 6738:
1.45 wiz 6739: <p>Other variables that affect the build:</p>
1.1 grant 6740:
1.45 wiz 6741: <div class="itemizedlist">
6742: <ul type="disc">
6743: <li>
6744: <p><code class="varname">WRKSRC</code>: The
1.50 rillig 6745: directory where the interesting distribution files
6746: of the package are found. The default is
6747: <code xmlns=
6748: "http://www.w3.org/TR/xhtml1/transitional" class=
6749: "filename">${WRKDIR}/${DISTNAME}</code>, which
6750: works for most packages.</p>
6751:
6752: <p>If a package doesn't create a subdirectory for
6753: itself (most GNU software does, for instance), but
6754: extracts itself in the current directory, you
6755: should set <code class="varname">WRKSRC=
6756: ${WRKDIR}</code>.</p>
6757:
6758: <p>If a package doesn't create a subdirectory with
6759: the name of <code class="varname">DISTNAME</code>
6760: but some different name, set <code class=
6761: "varname">WRKSRC</code> to point to the proper name
6762: in <code xmlns=
6763: "http://www.w3.org/TR/xhtml1/transitional" class=
6764: "filename">${WRKDIR}</code>, for example
6765: <code class="varname">WRKSRC=
6766: ${WRKDIR}/${DISTNAME}/unix</code>. See <a xmlns=
6767: "http://www.w3.org/TR/xhtml1/transitional" href=
6768: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
6769: target="_top"><code xmlns="" class=
6770: "filename">lang/tcl</code></a> and <a xmlns=
6771: "http://www.w3.org/TR/xhtml1/transitional" href=
6772: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
6773: target="_top"><code xmlns="" class=
6774: "filename">x11/tk</code></a> for other
6775: examples.</p>
6776:
6777: <p>The name of the working directory created by
6778: pkgsrc is taken from the <code class=
6779: "varname">WRKDIR_BASENAME</code> variable. By
6780: default, its value is <code xmlns=
6781: "http://www.w3.org/TR/xhtml1/transitional" class=
6782: "filename">work</code>. If you want to use the same
6783: pkgsrc tree for building different kinds of binary
6784: packages, you can change the variable according to
6785: your needs. Two other variables handle common cases
6786: of setting <code class=
6787: "varname">WRKDIR_BASENAME</code> individually. If
6788: <code class="varname">OBJHOSTNAME</code> is defined
6789: in <code xmlns=
1.45 wiz 6790: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 6791: "filename">/etc/mk.conf</code>, the first component
6792: of the host's name is attached to the directory
6793: name. If <code class="varname">OBJMACHINE</code> is
6794: defined, the platform name is attached, which might
6795: look like <code xmlns=
6796: "http://www.w3.org/TR/xhtml1/transitional" class=
6797: "filename">work.i386</code> or <code xmlns=
1.45 wiz 6798: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 6799: "filename">work.sparc</code>.</p>
1.45 wiz 6800: </li>
6801: </ul>
1.1 grant 6802: </div>
6803:
6804: <p>Please pay attention to the following gotchas:</p>
6805:
6806: <div class="itemizedlist">
6807: <ul type="disc">
6808: <li>
1.14 xtraeme 6809: <p>Add <code class="varname">MANCOMPRESSED</code>
1.47 reed 6810: if man pages are installed in compressed form by
6811: the package; see comment in <code xmlns=
1.45 wiz 6812: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6813: "filename">bsd.pkg.mk</code>.</p>
1.1 grant 6814: </li>
6815:
6816: <li>
1.45 wiz 6817: <p>Replace <code xmlns=
6818: "http://www.w3.org/TR/xhtml1/transitional" class=
6819: "filename">/usr/local</code> with
6820: “<span class="quote">${PREFIX}</span>”
6821: in all files (see patches, below).</p>
1.1 grant 6822: </li>
6823:
6824: <li>
6825: <p>If the package installs any info files, see
6826: <a href="#faq.info-files" title=
1.45 wiz 6827: "15.5.7. Packages installing info files">Section 15.5.7,
6828: “Packages installing info
1.1 grant 6829: files”</a>.</p>
6830: </li>
6831: </ul>
6832: </div>
6833: </div>
6834:
1.59 rillig 6835: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 6836: <div class="titlepage">
6837: <div>
6838: <div>
6839: <h2 class="title" style="clear: both"><a name=
1.59 rillig 6840: "components.distinfo" id=
1.45 wiz 6841: "components.distinfo"></a>8.2. <code xmlns=
6842: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6843: "filename">distinfo</code></h2>
1.1 grant 6844: </div>
6845: </div>
6846: </div>
6847:
1.50 rillig 6848: <p>The <code xmlns=
6849: "http://www.w3.org/TR/xhtml1/transitional" class=
6850: "filename">distinfo</code> file contains the message
6851: digest, or checksum, of each distfile needed for the
6852: package. This ensures that the distfiles retrieved from
6853: the Internet have not been corrupted during transfer or
6854: altered by a malign force to introduce a security hole.
6855: Due to recent rumor about weaknesses of digest
6856: algorithms, all distfiles are protected using both SHA1
6857: and RMD160 message digests, as well as the file size.</p>
6858:
6859: <p>The <code xmlns=
6860: "http://www.w3.org/TR/xhtml1/transitional" class=
6861: "filename">distinfo</code> file also contains the
6862: checksums for all the patches found in the <code xmlns=
6863: "http://www.w3.org/TR/xhtml1/transitional" class=
6864: "filename">patches</code> directory (see <a href=
6865: "#components.patches" title=
6866: "8.3. patches/*">Section 8.3,
6867: “patches/*”</a>).</p>
6868:
6869: <p>To regenerate the <code xmlns=
6870: "http://www.w3.org/TR/xhtml1/transitional" class=
6871: "filename">distinfo</code> file, use the
1.14 xtraeme 6872: <span><strong class="command">make
1.50 rillig 6873: makedistinfo</strong></span> or <span><strong class=
6874: "command">make mdi</strong></span> command.</p>
1.1 grant 6875:
1.50 rillig 6876: <p>Some packages have different sets of distfiles
6877: depending on the platform, for example <a xmlns=
1.1 grant 6878: "http://www.w3.org/TR/xhtml1/transitional" href=
6879: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.45 wiz 6880: target="_top"><code xmlns="" class=
6881: "filename">www/navigator</code></a>). These are kept in
1.50 rillig 6882: the same <code xmlns=
1.45 wiz 6883: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 6884: "filename">distinfo</code> file and care should be taken
6885: when upgrading such a package to ensure distfile
6886: information is not lost.</p>
1.1 grant 6887: </div>
6888:
1.59 rillig 6889: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 6890: <div class="titlepage">
6891: <div>
6892: <div>
6893: <h2 class="title" style="clear: both"><a name=
1.59 rillig 6894: "components.patches" id=
1.38 dillo 6895: "components.patches"></a>8.3. patches/*</h2>
1.1 grant 6896: </div>
6897: </div>
6898: </div>
6899:
6900: <p>This directory contains files that are used by the
6901: <a href=
6902: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
6903: <span class="citerefentry"><span class=
6904: "refentrytitle">patch</span>(1)</span></a> command to
6905: modify the sources as distributed in the distribution
6906: file into a form that will compile and run perfectly on
6907: NetBSD. The files are applied successively in alphabetic
6908: order (as returned by a shell “<span class=
6909: "quote">patches/patch-*</span>” glob expansion), so
1.45 wiz 6910: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6911: class="filename">patch-aa</code> is applied before
6912: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6913: class="filename">patch-ab</code>, etc.</p>
6914:
6915: <p>The <code xmlns=
6916: "http://www.w3.org/TR/xhtml1/transitional" class=
6917: "filename">patch-*</code> files should be in
6918: <span><strong class="command">diff -bu</strong></span>
6919: format, and apply without a fuzz to avoid problems. (To
6920: force patches to apply with fuzz you can set <code class=
1.14 xtraeme 6921: "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1 grant 6922: not put changes for more than one file into a single
1.47 reed 6923: patch file, as this will make future modifications more
1.1 grant 6924: difficult.</p>
6925:
6926: <p>Similar, a file should be patched at most once, not
6927: several times by several different patches. If a file
6928: needs several patches, they should be combined into one
6929: file.</p>
6930:
6931: <p>One important thing to mention is to pay attention
6932: that no RCS IDs get stored in the patch files, as these
6933: will cause problems when later checked into the NetBSD
1.14 xtraeme 6934: CVS tree. Use the <span><strong class=
6935: "command">pkgdiff</strong></span> from the <a xmlns=
1.1 grant 6936: "http://www.w3.org/TR/xhtml1/transitional" href=
6937: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 6938: target="_top"><code xmlns="" class=
6939: "filename">pkgtools/pkgdiff</code></a> package to avoid
1.20 ben 6940: these problems.</p>
1.1 grant 6941:
6942: <p>For even more automation, we recommend using
1.14 xtraeme 6943: <span><strong class="command">mkpatches</strong></span>
6944: from the same package to make a whole set of patches. You
6945: just have to backup files before you edit them to
1.45 wiz 6946: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6947: class="filename">filename.orig</code>, e.g. with
1.14 xtraeme 6948: <span><strong class="command">cp -p filename
6949: filename.orig</strong></span> or, easier, by using
6950: <span><strong class="command">pkgvi</strong></span> again
6951: from the same package. If you upgrade a package this way,
6952: you can easily compare the new set of patches with the
6953: previously existing one with <span><strong class=
6954: "command">patchdiff</strong></span>.</p>
1.1 grant 6955:
6956: <p>When you have finished a package, remember to generate
6957: the checksums for the patch files by using the
1.14 xtraeme 6958: <span><strong class="command">make
6959: makepatchsum</strong></span> command, see <a href=
6960: "#components.distinfo" title=
1.38 dillo 6961: "8.2. distinfo">Section 8.2,
1.45 wiz 6962: “<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6963: class="filename">distinfo</code>”</a>.</p>
1.1 grant 6964:
1.46 gdt 6965: <p>When adding a patch that corrects a problem in the
6966: distfile (rather than e.g. enforcing pkgsrc's view of
6967: where man pages should go), send the patch as a bug
6968: report to the maintainer. This benefits non-pkgsrc users
6969: of the package, and usually enables removing the patch in
6970: future version.</p>
6971:
1.1 grant 6972: <p>Patch files that are distributed by the author or
1.14 xtraeme 6973: other maintainers can be listed in <code class=
6974: "varname">$PATCHFILES</code>.</p>
1.1 grant 6975:
6976: <p>If it is desired to store any patches that should not
6977: be committed into pkgsrc, they can be kept outside the
1.45 wiz 6978: pkgsrc tree in the <code xmlns=
6979: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6980: "filename">$LOCALPATCHES</code> directory. The directory
1.1 grant 6981: tree there is expected to have the same
6982: “<span class="quote">category/package</span>”
6983: structure as pkgsrc, and patches are expected to be
1.45 wiz 6984: stored inside these dirs (also known as <code xmlns=
6985: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 6986: "filename">$LOCALPATCHES/$PKGPATH</code>). For example,
6987: if you want to keep a private patch for <code xmlns=
1.45 wiz 6988: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6989: "filename">pkgsrc/graphics/png</code>, keep it in
1.45 wiz 6990: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6991: class=
1.14 xtraeme 6992: "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
6993: files in the named directory are expected to be patch
1.1 grant 6994: files, and <span class="emphasis"><em>they are applied
6995: after pkgsrc patches are applied</em></span>.</p>
1.27 rillig 6996: </div>
6997:
1.59 rillig 6998: <div class="sect1" lang="en" xml:lang="en">
1.27 rillig 6999: <div class="titlepage">
7000: <div>
7001: <div>
7002: <h2 class="title" style="clear: both"><a name=
1.59 rillig 7003: "other-mandatory-files" id=
1.38 dillo 7004: "other-mandatory-files"></a>8.4. Other
1.27 rillig 7005: mandatory files</h2>
7006: </div>
7007: </div>
7008: </div>
7009:
7010: <div class="variablelist">
7011: <dl>
1.45 wiz 7012: <dt><span class="term"><code xmlns=
7013: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7014: "filename">DESCR</code></span></dt>
7015:
7016: <dd>
7017: <p>A multi-line description of the piece of
7018: software. This should include any credits where
7019: they are due. Please bear in mind that others do
7020: not share your sense of humour (or spelling
7021: idiosyncrasies), and that others will read
7022: everything that you write here.</p>
7023: </dd>
7024:
1.45 wiz 7025: <dt><span class="term"><code xmlns=
7026: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7027: "filename">PLIST</code></span></dt>
7028:
7029: <dd>
7030: <p>This file governs the files that are installed
7031: on your system: all the binaries, manual pages,
7032: etc. There are other directives which may be
7033: entered in this file, to control the creation and
7034: deletion of directories, and the location of
7035: inserted files. See <a href="#plist" title=
1.38 dillo 7036: "Chapter 10. PLIST issues">Chapter 10,
1.27 rillig 7037: <i>PLIST issues</i></a> for more information.</p>
7038: </dd>
7039: </dl>
7040: </div>
7041: </div>
7042:
1.59 rillig 7043: <div class="sect1" lang="en" xml:lang="en">
1.27 rillig 7044: <div class="titlepage">
7045: <div>
7046: <div>
7047: <h2 class="title" style="clear: both"><a name=
1.59 rillig 7048: "components.optional" id=
1.38 dillo 7049: "components.optional"></a>8.5. Optional
1.27 rillig 7050: files</h2>
7051: </div>
7052: </div>
7053: </div>
7054:
7055: <div class="variablelist">
7056: <dl>
1.45 wiz 7057: <dt><span class="term"><code xmlns=
7058: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7059: "filename">INSTALL</code></span></dt>
7060:
7061: <dd>
7062: <p>This shell script is invoked twice by <a href=
7063: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7064: <span class="citerefentry"><span class=
7065: "refentrytitle">pkg_add</span>(1)</span></a>. First
7066: time after package extraction and before files are
7067: moved in place, the second time after the files to
7068: install are moved in place. This can be used to do
7069: any custom procedures not possible with @exec
1.45 wiz 7070: commands in <code xmlns=
7071: "http://www.w3.org/TR/xhtml1/transitional" class=
7072: "filename">PLIST</code>. See <a href=
1.27 rillig 7073: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7074: <span class="citerefentry"><span class=
7075: "refentrytitle">pkg_add</span>(1)</span></a> and
7076: <a href=
7077: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
7078: <span class="citerefentry"><span class=
7079: "refentrytitle">pkg_create</span>(1)</span></a> for
7080: more information.</p>
7081: </dd>
7082:
1.45 wiz 7083: <dt><span class="term"><code xmlns=
7084: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7085: "filename">DEINSTALL</code></span></dt>
7086:
7087: <dd>
7088: <p>This script is executed before and after any
7089: files are removed. It is this script's
7090: responsibility to clean up any additional messy
7091: details around the package's installation, since
7092: all pkg_delete knows is how to delete the files
7093: created in the original distribution. See <a href=
7094: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
7095: <span class="citerefentry"><span class=
7096: "refentrytitle">pkg_delete</span>(1)</span></a> and
7097: <a href=
7098: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
7099: <span class="citerefentry"><span class=
7100: "refentrytitle">pkg_create</span>(1)</span></a> for
7101: more information.</p>
7102: </dd>
7103:
1.45 wiz 7104: <dt><span class="term"><code xmlns=
7105: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7106: "filename">MESSAGE</code></span></dt>
7107:
7108: <dd>
1.50 rillig 7109: <p>This file is displayed after installation of the
1.27 rillig 7110: package. Useful for things like legal notices on
7111: almost-free software and hints for updating config
7112: files after installing modules for apache, PHP etc.
7113: Please note that you can modify variables in it
7114: easily by using <code class=
7115: "varname">MESSAGE_SUBST</code> in the package's
1.45 wiz 7116: <code xmlns=
7117: "http://www.w3.org/TR/xhtml1/transitional" class=
7118: "filename">Makefile</code>:</p>
1.27 rillig 7119: <pre class="programlisting">
1.51 rillig 7120: MESSAGE_SUBST+= SOMEVAR="somevalue"
1.27 rillig 7121: </pre>
7122:
7123: <p>replaces "${SOMEVAR}" with “<span class=
1.45 wiz 7124: "quote">somevalue</span>” in <code xmlns=
7125: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7126: "filename">MESSAGE</code>.</p>
7127: </dd>
7128: </dl>
7129: </div>
7130: </div>
7131:
1.59 rillig 7132: <div class="sect1" lang="en" xml:lang="en">
1.27 rillig 7133: <div class="titlepage">
7134: <div>
7135: <div>
7136: <h2 class="title" style="clear: both"><a name=
1.59 rillig 7137: "work-dir" id="work-dir"></a>8.6. <code xmlns=
1.45 wiz 7138: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7139: "filename">work*</code></h2>
7140: </div>
7141: </div>
7142: </div>
7143:
7144: <p>When you type <span><strong class=
1.47 reed 7145: "command">make</strong></span>, the distribution files
7146: are unpacked into the directory denoted by <code class=
1.45 wiz 7147: "varname">WRKDIR</code>. It can be removed by running
7148: <span><strong class="command">make clean</strong></span>.
7149: Besides the sources, this directory is also used to keep
7150: various timestamp files. The directory gets <span class=
7151: "emphasis"><em>removed completely</em></span> on clean.
7152: The default is <code xmlns=
7153: "http://www.w3.org/TR/xhtml1/transitional" class=
7154: "filename">${.CURDIR}/work</code> or <code xmlns=
7155: "http://www.w3.org/TR/xhtml1/transitional" class=
7156: "filename">${.CURDIR}/work.${MACHINE_ARCH}</code> if
7157: <code class="varname">OBJMACHINE</code> is set.</p>
1.27 rillig 7158: </div>
7159:
1.59 rillig 7160: <div class="sect1" lang="en" xml:lang="en">
1.27 rillig 7161: <div class="titlepage">
7162: <div>
7163: <div>
7164: <h2 class="title" style="clear: both"><a name=
1.59 rillig 7165: "files-dir" id=
1.45 wiz 7166: "files-dir"></a>8.7. <code xmlns=
7167: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7168: "filename">files/*</code></h2>
7169: </div>
7170: </div>
7171: </div>
7172:
7173: <p>If you have any files that you wish to be placed in
7174: the package prior to configuration or building, you could
7175: place these files here and use a “<span class=
7176: "quote">${CP}</span>” command in the
7177: “<span class="quote">pre-configure</span>”
7178: target to achieve this. Alternatively, you could simply
1.45 wiz 7179: diff the file against <code xmlns=
7180: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7181: "filename">/dev/null</code> and use the patch mechanism
7182: to manage the creation of this file.</p>
7183: </div>
7184: </div>
7185:
1.59 rillig 7186: <div class="chapter" lang="en" xml:lang="en">
1.27 rillig 7187: <div class="titlepage">
7188: <div>
7189: <div>
1.59 rillig 7190: <h2 class="title"><a name="makefile" id=
1.38 dillo 7191: "makefile"></a>Chapter 9. Programming in
1.45 wiz 7192: <code xmlns=
7193: "http://www.w3.org/TR/xhtml1/transitional" class=
7194: "filename">Makefile</code>s</h2>
1.27 rillig 7195: </div>
7196: </div>
7197: </div>
7198:
7199: <div class="toc">
7200: <p><b>Table of Contents</b></p>
7201:
7202: <dl>
7203: <dt><span class="sect1"><a href=
1.45 wiz 7204: "#makefile.variables">9.1. <code xmlns=
7205: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7206: "filename">Makefile</code> variables</a></span></dt>
7207:
7208: <dd>
7209: <dl>
7210: <dt><span class="sect2"><a href=
1.38 dillo 7211: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 7212: conventions</a></span></dt>
7213: </dl>
7214: </dd>
7215:
1.38 dillo 7216: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.27 rillig 7217: Code snippets</a></span></dt>
7218:
7219: <dd>
7220: <dl>
1.30 wiz 7221: <dt><span class="sect2"><a href=
1.38 dillo 7222: "#adding-to-list">9.2.1. Adding things to a
1.30 wiz 7223: list</a></span></dt>
1.27 rillig 7224:
1.30 wiz 7225: <dt><span class="sect2"><a href=
1.38 dillo 7226: "#converting-internal-to-external">9.2.2.
1.27 rillig 7227: Converting an internal list into an external
7228: list</a></span></dt>
7229:
1.30 wiz 7230: <dt><span class="sect2"><a href=
1.38 dillo 7231: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 7232: variables to a shell command</a></span></dt>
1.27 rillig 7233:
1.30 wiz 7234: <dt><span class="sect2"><a href=
1.38 dillo 7235: "#quoting-guideline">9.2.4. Quoting
1.30 wiz 7236: guideline</a></span></dt>
1.27 rillig 7237:
1.30 wiz 7238: <dt><span class="sect2"><a href=
1.38 dillo 7239: "#bsd-make-bug-workaround">9.2.5. Workaround for a
1.30 wiz 7240: bug in BSD Make</a></span></dt>
1.27 rillig 7241: </dl>
7242: </dd>
7243: </dl>
7244: </div>
7245:
1.45 wiz 7246: <p>Pkgsrc consists of many <code xmlns=
7247: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7248: "filename">Makefile</code> fragments, each of which forms a
7249: well-defined part of the pkgsrc system. Using the <a href=
7250: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7251: <span class="citerefentry"><span class=
7252: "refentrytitle">make</span>(1)</span></a> system as a
7253: programming language for a big system like pkgsrc requires
7254: some discipline to keep the code correct and
7255: understandable.</p>
7256:
1.45 wiz 7257: <p>The basic ingredients for <code xmlns=
7258: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7259: "filename">Makefile</code> programming are variables (which
7260: are actually macros) and shell commands. Among these shell
7261: commands may even be more complex ones like <a href=
7262: "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
7263: <span class="citerefentry"><span class=
7264: "refentrytitle">awk</span>(1)</span></a> programs. To make
7265: sure that every shell command runs as intended it is
7266: necessary to quote all variables correctly when they are
7267: used.</p>
7268:
7269: <p>This chapter describes some patterns, that appear quite
1.45 wiz 7270: often in <code xmlns=
7271: "http://www.w3.org/TR/xhtml1/transitional" class=
7272: "filename">Makefile</code>s, including the pitfalls that
7273: come along with them.</p>
1.27 rillig 7274:
1.59 rillig 7275: <div class="sect1" lang="en" xml:lang="en">
1.27 rillig 7276: <div class="titlepage">
7277: <div>
7278: <div>
7279: <h2 class="title" style="clear: both"><a name=
1.59 rillig 7280: "makefile.variables" id=
1.45 wiz 7281: "makefile.variables"></a>9.1. <code xmlns=
7282: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7283: "filename">Makefile</code> variables</h2>
7284: </div>
7285: </div>
7286: </div>
7287:
1.45 wiz 7288: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7289: class="filename">Makefile</code> variables contain
7290: strings that can be processed using the five operators
7291: ``='', ``+='', ``?='', ``:='', and ``!='', which are
7292: described in the <a href=
1.27 rillig 7293: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7294: <span class="citerefentry"><span class=
7295: "refentrytitle">make</span>(1)</span></a> man page.</p>
7296:
1.45 wiz 7297: <p>When a variable's value is parsed from a <code xmlns=
7298: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7299: "filename">Makefile</code>, the hash character ``#'' and
7300: the backslash character ``\'' are handled specially. If a
7301: backslash is followed by a newline, any whitespace
7302: immediately in front of the backslash, the backslash, the
7303: newline, and any whitespace immediately behind the
7304: newline are replaced with a single space. A backspace
7305: character and an immediately following hash character are
1.47 reed 7306: replaced with a single hash character. Otherwise, the
1.27 rillig 7307: backslash is passed as is. In a variable assignment, any
7308: hash character that is not preceded by a backslash starts
7309: a comment that continues upto the end of the logical
7310: line.</p>
7311:
7312: <p><span class="emphasis"><em>Note:</em></span> Because
7313: of this parsing algorithm the only way to create a
7314: variable consisting of a single backslash is using the
7315: ``!='' operator, for example: <code class=
7316: "varname">BACKSLASH!=echo "\\"</code>.</p>
7317:
7318: <p>So far for defining variables. The other thing you can
7319: do with variables is evaluating them. A variable is
7320: evaluated when it is part of the right side of the ``:=''
7321: or the ``!='' operator, or directly before executing a
7322: shell command which the variable is part of. In all other
1.47 reed 7323: cases, <a href=
1.27 rillig 7324: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7325: <span class="citerefentry"><span class=
7326: "refentrytitle">make</span>(1)</span></a> performs lazy
7327: evaluation, that is, variables are not evaluated until
7328: there's no other way. The ``modifiers'' mentioned in the
7329: man page also evaluate the variable.</p>
7330:
7331: <p>Some of the modifiers split the string into words and
7332: then operate on the words, others operate on the string
1.47 reed 7333: as a whole. When a string is split into words, it is
7334: split as you would expect it from <a href=
1.27 rillig 7335: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
7336: <span class="citerefentry"><span class=
7337: "refentrytitle">sh</span>(1)</span></a>.</p>
7338:
7339: <p>No rule without exception—the
7340: <span><strong class="command">.for</strong></span> loop
7341: does not follow the shell quoting rules but splits at
7342: sequences of whitespace.</p>
7343:
7344: <p>There are several types of variables that should be
7345: handled differently. Strings and two types of lists.</p>
7346:
7347: <div class="itemizedlist">
7348: <ul type="disc">
7349: <li>
7350: <p><span class="emphasis"><em>Strings</em></span>
1.47 reed 7351: can contain arbitrary characters. Nevertheless, you
1.27 rillig 7352: should restrict yourself to only using printable
7353: characters. Examples are <code class=
7354: "varname">PREFIX</code> and <code class=
7355: "varname">COMMENT</code>.</p>
7356: </li>
7357:
7358: <li>
7359: <p><span class="emphasis"><em>Internal
7360: lists</em></span> are lists that are never exported
7361: to any shell command. Their elements are separated
1.47 reed 7362: by whitespace. Therefore, the elements themselves
1.27 rillig 7363: cannot have embedded whitespace. Any other
7364: characters are allowed. Internal lists can be used
7365: in <span><strong class=
7366: "command">.for</strong></span> loops. Examples are
7367: <code class="varname">DEPENDS</code> and
7368: <code class="varname">BUILD_DEPENDS</code>.</p>
7369: </li>
7370:
7371: <li>
7372: <p><span class="emphasis"><em>External
7373: lists</em></span> are lists that may be exported to
7374: a shell command. Their elements can contain any
7375: characters, including whitespace. That's why they
7376: cannot be used in <span><strong class=
7377: "command">.for</strong></span> loops. Examples are
7378: <code class="varname">DISTFILES</code> and
7379: <code class="varname">MASTER_SITES</code>.</p>
7380: </li>
7381: </ul>
7382: </div>
7383:
1.59 rillig 7384: <div class="sect2" lang="en" xml:lang="en">
1.27 rillig 7385: <div class="titlepage">
7386: <div>
7387: <div>
7388: <h3 class="title"><a name=
1.59 rillig 7389: "makefile.variables.names" id=
1.38 dillo 7390: "makefile.variables.names"></a>9.1.1. Naming
1.27 rillig 7391: conventions</h3>
7392: </div>
7393: </div>
7394: </div>
7395:
7396: <div class="itemizedlist">
7397: <ul type="disc">
7398: <li>
7399: <p>All variable names starting with an underscore
7400: are reserved for use by the pkgsrc
7401: infrastructure. They shall not be used by package
1.45 wiz 7402: <code xmlns=
7403: "http://www.w3.org/TR/xhtml1/transitional" class=
7404: "filename">Makefile</code>s.</p>
1.27 rillig 7405: </li>
7406:
7407: <li>
7408: <p>In <span><strong class=
7409: "command">.for</strong></span> loops you should
7410: use lowercase variable names for the iteration
7411: variables.</p>
7412: </li>
7413:
7414: <li>
7415: <p>All list variables should have a ``plural''
7416: name, e.g. <code class=
7417: "varname">PKG_OPTIONS</code> or <code class=
7418: "varname">DISTFILES</code>.</p>
7419: </li>
7420: </ul>
7421: </div>
7422: </div>
7423: </div>
7424:
1.59 rillig 7425: <div class="sect1" lang="en" xml:lang="en">
1.27 rillig 7426: <div class="titlepage">
7427: <div>
7428: <div>
7429: <h2 class="title" style="clear: both"><a name=
1.59 rillig 7430: "makefile.code" id=
1.38 dillo 7431: "makefile.code"></a>9.2. Code snippets</h2>
1.27 rillig 7432: </div>
7433: </div>
7434: </div>
7435:
7436: <p>This section presents you with some code snippets you
7437: should use in your own code. If you don't find anything
7438: appropriate here, you should test your code and add it
7439: here.</p>
7440:
1.59 rillig 7441: <div class="sect2" lang="en" xml:lang="en">
1.27 rillig 7442: <div class="titlepage">
7443: <div>
7444: <div>
1.59 rillig 7445: <h3 class="title"><a name="adding-to-list" id=
1.38 dillo 7446: "adding-to-list"></a>9.2.1. Adding things to
1.30 wiz 7447: a list</h3>
1.27 rillig 7448: </div>
7449: </div>
7450: </div>
7451: <pre class="programlisting">
1.51 rillig 7452: STRING= foo * bar `date`
7453: INT_LIST= # empty
7454: ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache
7455: EXT_LIST= # empty
7456: ANOTHER_EXT_LIST= a=b c=d
7457:
7458: INT_LIST+= ${STRING} # 1
7459: INT_LIST+= ${ANOTHER_INT_LIST} # 2
7460: EXT_LIST+= ${STRING:Q} # 3
7461: EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
1.27 rillig 7462: </pre>
7463:
7464: <p>When you add a string to an external list (example
7465: 3), it must be quoted. In all other cases, you must not
7466: add a quoting level. You must not merge internal and
7467: external lists, unless you are sure that all entries
7468: are correctly interpreted in both lists.</p>
7469: </div>
7470:
1.59 rillig 7471: <div class="sect2" lang="en" xml:lang="en">
1.27 rillig 7472: <div class="titlepage">
7473: <div>
7474: <div>
1.30 wiz 7475: <h3 class="title"><a name=
1.59 rillig 7476: "converting-internal-to-external" id=
1.38 dillo 7477: "converting-internal-to-external"></a>9.2.2. Converting
1.30 wiz 7478: an internal list into an external list</h3>
1.27 rillig 7479: </div>
7480: </div>
7481: </div>
7482: <pre class="programlisting">
1.51 rillig 7483: EXT_LIST= # empty
7484: .for i in ${INT_LIST}
7485: EXT_LIST+= ${i:Q}""
7486: .endfor
1.27 rillig 7487: </pre>
7488:
7489: <p>This code converts the internal list <code class=
7490: "varname">INT_LIST</code> into the external list
7491: <code class="varname">EXT_LIST</code>. As the elements
7492: of an internal list are unquoted they must be quoted
7493: here. The reason for appending <code class=
7494: "varname">""</code> is explained below.</p>
7495: </div>
1.1 grant 7496:
1.59 rillig 7497: <div class="sect2" lang="en" xml:lang="en">
1.27 rillig 7498: <div class="titlepage">
1.1 grant 7499: <div>
1.27 rillig 7500: <div>
1.30 wiz 7501: <h3 class="title"><a name=
1.59 rillig 7502: "passing-variable-to-shell" id=
1.38 dillo 7503: "passing-variable-to-shell"></a>9.2.3. Passing
1.30 wiz 7504: variables to a shell command</h3>
1.27 rillig 7505: </div>
1.1 grant 7506: </div>
7507: </div>
1.27 rillig 7508: <pre class="programlisting">
1.51 rillig 7509: STRING= foo bar < > * `date` $$HOME ' "
7510: EXT_LIST= string=${STRING:Q} x=second\ item
1.27 rillig 7511:
1.51 rillig 7512: all:
7513: echo ${STRING} # 1
7514: echo "${STRING}" # 2
7515: echo "${STRING:Q}" # 3
7516: echo ${STRING:Q} # 4
7517: echo x${STRING:Q} | sed 1s,.,, # 5
7518: env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
1.27 rillig 7519: </pre>
7520:
7521: <p>Example 1 leads to a syntax error in the shell, as
7522: the characters are just copied.</p>
7523:
7524: <p>Example 2 leads to a syntax error too, and if you
7525: leave out the last " character from <code class=
7526: "varname">${STRING}</code>, <a href=
7527: "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
7528: <span class="citerefentry"><span class=
7529: "refentrytitle">date</span>(1)</span></a> will be
7530: executed. The <code class="varname">$HOME</code> shell
7531: variable would be evaluated, too.</p>
7532:
7533: <p>Example 3 outputs each space character preceded by a
7534: backslash (or not), depending on the implementation of
7535: the <a href=
7536: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7537: <span class="citerefentry"><span class=
7538: "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1 grant 7539:
1.27 rillig 7540: <p>Example 4 handles correctly every string that does
7541: not start with a dash. In that case, the result depends
7542: on the implementation of the <a href=
7543: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7544: <span class="citerefentry"><span class=
7545: "refentrytitle">echo</span>(1)</span></a> command. As
7546: long as you can guarantee that your input does not
1.47 reed 7547: start with a dash, this form is appropriate.</p>
1.1 grant 7548:
1.27 rillig 7549: <p>Example 5 handles even the case of a leading dash
7550: correctly.</p>
1.1 grant 7551:
1.27 rillig 7552: <p>The <code class="varname">EXT_LIST</code> does not
1.47 reed 7553: need to be quoted because the quoting has already been
1.27 rillig 7554: done when adding elements to the list.</p>
1.1 grant 7555:
1.27 rillig 7556: <p>As internal lists shall not be passed to the shell,
7557: there is no example for it.</p>
1.1 grant 7558: </div>
7559:
1.59 rillig 7560: <div class="sect2" lang="en" xml:lang="en">
1.27 rillig 7561: <div class="titlepage">
1.1 grant 7562: <div>
1.27 rillig 7563: <div>
1.59 rillig 7564: <h3 class="title"><a name="quoting-guideline" id=
1.38 dillo 7565: "quoting-guideline"></a>9.2.4. Quoting
1.27 rillig 7566: guideline</h3>
7567: </div>
1.1 grant 7568: </div>
7569: </div>
7570:
1.27 rillig 7571: <p>There are many possible sources of wrongly quoted
7572: variables. This section lists some of the commonly
7573: known ones.</p>
1.1 grant 7574:
1.27 rillig 7575: <div class="itemizedlist">
7576: <ul type="disc">
7577: <li>
7578: <p>Whenever you use the value of a list, think
7579: about what happens to leading or trailing
7580: whitespace. If the list is a well-formed shell
1.47 reed 7581: expression, you can apply the <code class=
1.27 rillig 7582: "varname">:M*</code> modifier to strip leading
7583: and trailing whitespace from each word. The
7584: <code class="varname">:M</code> operator first
7585: splits its argument according to the rules of the
7586: shell, and then creates a new list consisting of
7587: all words that match the shell glob expression
7588: <code class="varname">*</code>, that is: all. One
7589: class of situations where this is needed is when
7590: adding a variable like <code class=
7591: "varname">CPPFLAGS</code> to <code class=
7592: "varname">CONFIGURE_ARGS</code>. If the configure
1.47 reed 7593: script invokes other configure scripts, it strips
1.27 rillig 7594: the leading and trailing whitespace from the
7595: variable and then passes it to the other
7596: configure scripts. But these configure scripts
7597: expect the (child) <code class=
7598: "varname">CPPFLAGS</code> variable to be the same
7599: as the parent <code class=
7600: "varname">CPPFLAGS</code>. That's why we better
7601: pass the <code class="varname">CPPFLAGS</code>
7602: value properly trimmed. And here is how we do
7603: it:</p>
7604: <pre class="programlisting">
1.51 rillig 7605: CPPFLAGS= # empty
7606: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\"
7607: CPPFLAGS+= ${MY_CPPFLAGS}
7608:
7609: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
7610:
7611: all:
7612: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
7613: echo x${CONFIGURE_ARGS}x # properly trimmed
1.27 rillig 7614: </pre>
7615: </li>
1.1 grant 7616:
1.27 rillig 7617: <li>
7618: <p>The example above contains one bug: The
7619: <code class="varname">${PREFIX}</code> is a
7620: properly quoted shell expression, but there is
7621: the C compiler after it, which also expects a
7622: properly quoted string (this time in C syntax).
7623: The version above is therefore only correct if
7624: <code class="varname">${PREFIX}</code> does not
7625: have embedded backslashes or double quotes. If
7626: you want to allow these, you have to add another
7627: layer of quoting to each variable that is used as
7628: a C string literal. You cannot use the
7629: <code class="varname">:Q</code> operator for it,
7630: as this operator only works for the shell.</p>
7631: </li>
1.1 grant 7632:
1.27 rillig 7633: <li>
1.47 reed 7634: <p>Whenever a variable can be empty, the
1.27 rillig 7635: <code class="varname">:Q</code> operator can have
7636: surprising results. Here are two completely
7637: different cases which can be solved with the same
7638: trick.</p>
7639: <pre class="programlisting">
1.51 rillig 7640: EMPTY= # empty
7641: empty_test:
7642: for i in a ${EMPTY:Q} c; do \
7643: echo "$$i"; \
7644: done
7645:
7646: for_test:
7647: .for i in a:\ a:\test.txt
7648: echo ${i:Q}
7649: echo "foo"
7650: .endfor
1.1 grant 7651: </pre>
7652:
1.27 rillig 7653: <p>The first example will only print two of the
7654: three lines we might have expected. This is
7655: because <code class="varname">${EMPTY:Q}</code>
7656: expands to the empty string, which the shell
7657: cannot see. The workaround is to write
7658: <code class="varname">${EMPTY:Q}""</code>. This
7659: pattern can be often found as <code class=
7660: "varname">${TEST} -z ${VAR:Q}</code> or as
7661: <code class="varname">${TEST} -f
7662: ${FNAME:Q}</code> (both of these are wrong).</p>
7663:
7664: <p>The second example will only print three lines
7665: instead of four. The first line looks like
7666: <code class="varname">a:\ echo foo</code>. This
7667: is because the backslash of the value
7668: <code class="varname">a:\</code> is interpreted
7669: as a line-continuation by <a href=
7670: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7671: <span class="citerefentry"><span class=
7672: "refentrytitle">make</span>(1)</span></a>, which
7673: makes the second line the arguments of the
7674: <a href=
7675: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7676: <span class="citerefentry"><span class=
7677: "refentrytitle">echo</span>(1)</span></a> command
7678: from the first line. To avoid this, write
7679: <code class="varname">${i:Q}""</code>.</p>
7680: </li>
7681: </ul>
7682: </div>
1.1 grant 7683: </div>
7684:
1.59 rillig 7685: <div class="sect2" lang="en" xml:lang="en">
1.27 rillig 7686: <div class="titlepage">
1.1 grant 7687: <div>
1.27 rillig 7688: <div>
1.30 wiz 7689: <h3 class="title"><a name=
1.59 rillig 7690: "bsd-make-bug-workaround" id=
1.38 dillo 7691: "bsd-make-bug-workaround"></a>9.2.5. Workaround
1.30 wiz 7692: for a bug in BSD Make</h3>
1.27 rillig 7693: </div>
1.1 grant 7694: </div>
7695: </div>
7696:
1.27 rillig 7697: <p>The pkgsrc bmake program does not handle the
7698: following assignment correctly. In case <code class=
7699: "varname">_othervar_</code> contains a ``-'' character,
7700: one of the closing braces is included in <code class=
7701: "varname">${VAR}</code> after this code executes.</p>
7702: <pre class="programlisting">
1.51 rillig 7703: VAR:= ${VAR:N${_othervar_:C/-//}}
1.1 grant 7704: </pre>
7705:
1.27 rillig 7706: <p>For a more complex code snippet and a workaround,
7707: see the package <a xmlns=
7708: "http://www.w3.org/TR/xhtml1/transitional" href=
7709: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
1.45 wiz 7710: target="_top"><code xmlns="" class=
7711: "filename">regress/make-quoting</code></a>, testcase
1.27 rillig 7712: <code class="varname">bug1</code>.</p>
1.1 grant 7713: </div>
7714: </div>
7715: </div>
7716:
1.59 rillig 7717: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 7718: <div class="titlepage">
7719: <div>
7720: <div>
1.59 rillig 7721: <h2 class="title"><a name="plist" id=
1.38 dillo 7722: "plist"></a>Chapter 10. PLIST issues</h2>
1.1 grant 7723: </div>
7724: </div>
7725: </div>
7726:
7727: <div class="toc">
7728: <p><b>Table of Contents</b></p>
7729:
7730: <dl>
1.38 dillo 7731: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 7732: ID</a></span></dt>
7733:
1.30 wiz 7734: <dt><span class="sect1"><a href=
1.38 dillo 7735: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 7736: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7737: class="filename">PLIST</code>
1.14 xtraeme 7738: generation</a></span></dt>
1.1 grant 7739:
1.38 dillo 7740: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 7741: Tweaking output of <span><strong class="command">make
7742: print-PLIST</strong></span></a></span></dt>
1.1 grant 7743:
1.38 dillo 7744: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 7745: Variable substitution in PLIST</a></span></dt>
7746:
1.30 wiz 7747: <dt><span class="sect1"><a href=
1.48 dillo 7748: "#manpage-compression">10.5. Man page
7749: compression</a></span></dt>
1.1 grant 7750:
1.38 dillo 7751: <dt><span class="sect1"><a href=
7752: "#using-PLIST_SRC">10.6. Changing PLIST source with
7753: <code class="varname">PLIST_SRC</code></a></span></dt>
1.1 grant 7754:
1.30 wiz 7755: <dt><span class="sect1"><a href=
1.47 reed 7756: "#platform-specific-plist">10.7. Platform-specific and
1.30 wiz 7757: differing PLISTs</a></span></dt>
1.1 grant 7758:
1.38 dillo 7759: <dt><span class="sect1"><a href=
7760: "#faq.common-dirs">10.8. Sharing directories between
7761: packages</a></span></dt>
1.1 grant 7762: </dl>
7763: </div>
7764:
1.45 wiz 7765: <p>The <code xmlns=
7766: "http://www.w3.org/TR/xhtml1/transitional" class=
7767: "filename">PLIST</code> file contains a package's
7768: “<span class="quote">packing list</span>”, i.e.
7769: a list of files that belong to the package (relative to the
7770: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7771: class="filename">${PREFIX}</code> directory it's been
7772: installed in) plus some additional statements - see the
7773: <a href=
1.1 grant 7774: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
7775: <span class="citerefentry"><span class=
1.47 reed 7776: "refentrytitle">pkg_create</span>(1)</span></a> man page
7777: for a full list. This chapter addresses some issues that
7778: need attention when dealing with the <code xmlns=
1.45 wiz 7779: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7780: "filename">PLIST</code> file (or files, see below!).</p>
1.1 grant 7781:
1.59 rillig 7782: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 7783: <div class="titlepage">
7784: <div>
7785: <div>
7786: <h2 class="title" style="clear: both"><a name=
1.59 rillig 7787: "rcs-id" id="rcs-id"></a>10.1. RCS ID</h2>
1.1 grant 7788: </div>
7789: </div>
7790: </div>
7791:
7792: <p>Be sure to add a RCS ID line as the first thing in any
1.45 wiz 7793: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7794: class="filename">PLIST</code> file you write:</p>
1.1 grant 7795: <pre class="programlisting">
1.51 rillig 7796: @comment $NetBSD$
1.1 grant 7797: </pre>
7798: </div>
7799:
1.59 rillig 7800: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 7801: <div class="titlepage">
7802: <div>
7803: <div>
7804: <h2 class="title" style="clear: both"><a name=
1.59 rillig 7805: "automatic-plist-generation" id=
1.38 dillo 7806: "automatic-plist-generation"></a>10.2. Semi-automatic
1.45 wiz 7807: <code xmlns=
7808: "http://www.w3.org/TR/xhtml1/transitional" class=
7809: "filename">PLIST</code> generation</h2>
1.1 grant 7810: </div>
7811: </div>
7812: </div>
7813:
1.14 xtraeme 7814: <p>You can use the <span><strong class="command">make
7815: print-PLIST</strong></span> command to output a PLIST
7816: that matches any new files since the package was
7817: extracted. See <a href="#build.helpful-targets" title=
1.56 rillig 7818: "14.16. Other helpful targets">Section 14.16,
1.1 grant 7819: “Other helpful targets”</a> for more
7820: information on this target.</p>
7821: </div>
7822:
1.59 rillig 7823: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 7824: <div class="titlepage">
7825: <div>
7826: <div>
7827: <h2 class="title" style="clear: both"><a name=
1.59 rillig 7828: "print-PLIST" id=
1.38 dillo 7829: "print-PLIST"></a>10.3. Tweaking output of
1.14 xtraeme 7830: <span><strong class="command">make
7831: print-PLIST</strong></span></h2>
1.1 grant 7832: </div>
7833: </div>
7834: </div>
7835:
7836: <p>If you have used any of the *-dirs packages, as
7837: explained in <a href="#faq.common-dirs" title=
1.38 dillo 7838: "10.8. Sharing directories between packages">Section 10.8,
1.1 grant 7839: “Sharing directories between packages”</a>,
1.14 xtraeme 7840: you may have noticed that <span><strong class=
7841: "command">make print-PLIST</strong></span> outputs a set
7842: of <code class="varname">@comment</code>s instead of real
7843: <code class="varname">@dirrm</code> lines. You can also
7844: do this for specific directories and files, so that the
7845: results of that command are very close to reality. This
7846: helps <span class="emphasis"><em>a lot</em></span> during
7847: the update of packages.</p>
7848:
7849: <p>The <code class="varname">PRINT_PLIST_AWK</code>
7850: variable takes a set of AWK patterns and actions that are
7851: used to filter the output of print-PLIST. You can
7852: <span class="emphasis"><em>append</em></span> any chunk
7853: of AWK scripting you like to it, but be careful with
1.1 grant 7854: quoting.</p>
7855:
1.45 wiz 7856: <p>For example, to get all files inside the <code xmlns=
7857: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7858: "filename">libdata/foo</code> directory removed from the
1.1 grant 7859: resulting PLIST:</p>
7860: <pre class="programlisting">
1.51 rillig 7861: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
1.1 grant 7862: </pre>
7863:
1.14 xtraeme 7864: <p>And to get all the <code class="varname">@dirrm</code>
1.1 grant 7865: lines referring to a specific (shared) directory
1.14 xtraeme 7866: converted to <code class="varname">@comment</code>s:</p>
1.1 grant 7867: <pre class="programlisting">
1.51 rillig 7868: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
1.1 grant 7869: </pre>
7870: </div>
7871:
1.59 rillig 7872: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 7873: <div class="titlepage">
7874: <div>
7875: <div>
7876: <h2 class="title" style="clear: both"><a name=
1.59 rillig 7877: "plist.misc" id=
1.38 dillo 7878: "plist.misc"></a>10.4. Variable substitution
7879: in PLIST</h2>
1.1 grant 7880: </div>
7881: </div>
7882: </div>
7883:
7884: <p>A number of variables are substituted automatically in
7885: PLISTs when a package is installed on a system. This
7886: includes the following variables:</p>
7887:
7888: <div class="variablelist">
7889: <dl>
1.14 xtraeme 7890: <dt><span class="term"><code class=
7891: "varname">${MACHINE_ARCH}</code>, <code class=
7892: "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1 grant 7893:
7894: <dd>
7895: <p>Some packages like emacs and perl embed
7896: information about which architecture they were
7897: built on into the pathnames where they install
1.47 reed 7898: their files. To handle this case, PLIST will be
1.1 grant 7899: preprocessed before actually used, and the symbol
1.14 xtraeme 7900: “<span class="quote"><code class=
7901: "varname">${MACHINE_ARCH}</code></span>” will
7902: be replaced by what <span><strong class=
7903: "command">uname -p</strong></span> gives. The same
7904: is done if the string <code class=
7905: "varname">${MACHINE_GNU_ARCH}</code> is embedded in
7906: PLIST somewhere - use this on packages that have
1.47 reed 7907: GNU autoconf-created configure scripts.</p>
1.1 grant 7908:
7909: <div class="note" style=
7910: "margin-left: 0.5in; margin-right: 0.5in;">
7911: <h3 class="title">Legacy note</h3>
7912:
7913: <p>There used to be a symbol “<span class=
1.14 xtraeme 7914: "quote"><code class=
7915: "varname">$ARCH</code></span>” that was
7916: replaced by the output of <span><strong class=
7917: "command">uname -m</strong></span>, but that's no
1.1 grant 7918: longer supported and has been removed.</p>
7919: </div>
7920: </dd>
7921:
1.14 xtraeme 7922: <dt><span class="term"><code class=
7923: "varname">${OPSYS}</code>, <code class=
7924: "varname">${LOWER_OPSYS}</code>, <code class=
7925: "varname">${OS_VERSION}</code></span></dt>
1.1 grant 7926:
7927: <dd>
7928: <p>Some packages want to embed the OS name and
7929: version into some paths. To do this, use these
1.45 wiz 7930: variables in the <code xmlns=
7931: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7932: "filename">PLIST</code>:</p>
1.1 grant 7933:
7934: <div class="itemizedlist">
7935: <ul type="disc">
7936: <li>
1.14 xtraeme 7937: <p><code class="varname">${OPSYS}</code> -
7938: output of “<span class=
7939: "quote"><span><strong class="command">uname
7940: -s</strong></span></span>”</p>
1.1 grant 7941: </li>
7942:
7943: <li>
1.14 xtraeme 7944: <p><code class=
7945: "varname">${LOWER_OPSYS}</code> - lowercase
7946: common name (eg. “<span class=
7947: "quote">solaris</span>”)</p>
1.1 grant 7948: </li>
7949:
7950: <li>
1.14 xtraeme 7951: <p><code class="varname">${OS_VERSION}</code>
7952: - “<span class=
7953: "quote"><span><strong class="command">uname
7954: -r</strong></span></span>”</p>
1.1 grant 7955: </li>
7956: </ul>
7957: </div>
7958: </dd>
7959:
1.14 xtraeme 7960: <dt><span class="term"><code class=
7961: "varname">${PKGLOCALEDIR}</code></span></dt>
1.1 grant 7962:
7963: <dd>
7964: <p>Packages that install locale files should list
7965: them in the PLIST as “<span class=
7966: "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>”
7967: instead of “<span class=
7968: "quote">share/locale/de/LC_MESSAGES/...</span>”.
7969: This properly handles the fact that different
7970: operating systems expect locale files to be either
1.45 wiz 7971: in <code xmlns=
7972: "http://www.w3.org/TR/xhtml1/transitional" class=
7973: "filename">share</code> or <code xmlns=
7974: "http://www.w3.org/TR/xhtml1/transitional" class=
7975: "filename">lib</code> by default.</p>
1.1 grant 7976: </dd>
7977: </dl>
7978: </div>
7979:
7980: <p>For a complete list of values which are replaced by
1.45 wiz 7981: default, please look in <code xmlns=
7982: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7983: "filename">bsd.pkg.mk</code> (and search for <span class=
1.1 grant 7984: "emphasis"><em>PLIST_SUBST</em></span>).</p>
7985:
7986: <p>If you want to change other variables not listed
7987: above, you can add variables and their expansions to this
1.14 xtraeme 7988: variable in the following way, similar to <code class=
7989: "varname">MESSAGE_SUBST</code> (see <a href=
1.1 grant 7990: "#components.optional" title=
1.38 dillo 7991: "8.5. Optional files">Section 8.5,
1.1 grant 7992: “Optional files”</a>):</p>
7993: <pre class="programlisting">
1.51 rillig 7994: PLIST_SUBST+= SOMEVAR="somevalue"
1.1 grant 7995: </pre>
7996:
7997: <p>This replaces all occurrences of “<span class=
7998: "quote">${SOMEVAR}</span>” in the PLIST with
7999: “<span class="quote">somevalue</span>”.</p>
8000: </div>
8001:
1.59 rillig 8002: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 8003: <div class="titlepage">
8004: <div>
8005: <div>
8006: <h2 class="title" style="clear: both"><a name=
1.59 rillig 8007: "manpage-compression" id=
1.48 dillo 8008: "manpage-compression"></a>10.5. Man page
8009: compression</h2>
1.1 grant 8010: </div>
8011: </div>
8012: </div>
8013:
1.47 reed 8014: <p>Man pages should be installed in compressed form if
1.45 wiz 8015: <code class="varname">MANZ</code> is set (in <code xmlns=
8016: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8017: "filename">bsd.own.mk</code>), and uncompressed
1.45 wiz 8018: otherwise. To handle this in the <code xmlns=
8019: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8020: "filename">PLIST</code> file, the suffix
8021: “<span class="quote">.gz</span>” is
1.47 reed 8022: appended/removed automatically for man pages according to
1.14 xtraeme 8023: <code class="varname">MANZ</code> and <code class=
8024: "varname">MANCOMPRESSED</code> being set or not, see
1.45 wiz 8025: above for details. This modification of the <code xmlns=
8026: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8027: "filename">PLIST</code> file is done on a copy of it, not
1.45 wiz 8028: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8029: class="filename">PLIST</code> itself.</p>
1.1 grant 8030: </div>
8031:
1.59 rillig 8032: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 8033: <div class="titlepage">
8034: <div>
8035: <div>
8036: <h2 class="title" style="clear: both"><a name=
1.59 rillig 8037: "using-PLIST_SRC" id=
1.38 dillo 8038: "using-PLIST_SRC"></a>10.6. Changing PLIST
1.30 wiz 8039: source with <code class=
1.14 xtraeme 8040: "varname">PLIST_SRC</code></h2>
1.1 grant 8041: </div>
8042: </div>
8043: </div>
8044:
1.14 xtraeme 8045: <p>To use one or more files as source for the
1.45 wiz 8046: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8047: class="filename">PLIST</code> used in generating the
8048: binary package, set the variable <code class=
1.14 xtraeme 8049: "varname">PLIST_SRC</code> to the names of that file(s).
1.24 wiz 8050: The files are later concatenated using <a href=
8051: "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
8052: <span class="citerefentry"><span class=
8053: "refentrytitle">cat</span>(1)</span></a>, and order of
8054: things is important.</p>
1.1 grant 8055: </div>
8056:
1.59 rillig 8057: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 8058: <div class="titlepage">
8059: <div>
8060: <div>
8061: <h2 class="title" style="clear: both"><a name=
1.59 rillig 8062: "platform-specific-plist" id=
1.47 reed 8063: "platform-specific-plist"></a>10.7. Platform-specific
8064: and differing PLISTs</h2>
1.1 grant 8065: </div>
8066: </div>
8067: </div>
8068:
8069: <p>Some packages decide to install a different set of
8070: files based on the operating system being used. These
8071: differences can be automatically handled by using the
8072: following files:</p>
8073:
8074: <div class="itemizedlist">
8075: <ul type="disc">
8076: <li>
1.45 wiz 8077: <p><code xmlns=
8078: "http://www.w3.org/TR/xhtml1/transitional" class=
8079: "filename">PLIST.common</code></p>
1.1 grant 8080: </li>
8081:
8082: <li>
1.45 wiz 8083: <p><code xmlns=
8084: "http://www.w3.org/TR/xhtml1/transitional" class=
8085: "filename">PLIST.${OPSYS}</code></p>
1.1 grant 8086: </li>
8087:
8088: <li>
1.45 wiz 8089: <p><code xmlns=
8090: "http://www.w3.org/TR/xhtml1/transitional" class=
1.21 ben 8091: "filename">PLIST.${MACHINE_ARCH}</code></p>
8092: </li>
8093:
8094: <li>
1.45 wiz 8095: <p><code xmlns=
8096: "http://www.w3.org/TR/xhtml1/transitional" class=
1.21 ben 8097: "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
8098: </li>
8099:
8100: <li>
1.45 wiz 8101: <p><code xmlns=
8102: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8103: "filename">PLIST.common_end</code></p>
1.1 grant 8104: </li>
8105: </ul>
8106: </div>
8107: </div>
8108:
1.59 rillig 8109: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 8110: <div class="titlepage">
8111: <div>
8112: <div>
8113: <h2 class="title" style="clear: both"><a name=
1.59 rillig 8114: "faq.common-dirs" id=
1.38 dillo 8115: "faq.common-dirs"></a>10.8. Sharing
8116: directories between packages</h2>
1.1 grant 8117: </div>
8118: </div>
8119: </div>
8120:
8121: <p>A “<span class="quote">shared
8122: directory</span>” is a directory where multiple
8123: (and unrelated) packages install files. These directories
8124: are problematic because you have to add special tricks in
8125: the PLIST to conditionally remove them, or have some
8126: centralized package handle them.</p>
8127:
8128: <p>Within pkgsrc, you'll find both approaches. If a
8129: directory is shared by a few unrelated packages, it's
8130: often not worth to add an extra package to remove it.
8131: Therefore, one simply does:</p>
8132: <pre class="programlisting">
1.51 rillig 8133: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
1.1 grant 8134: </pre>
8135:
8136: <p>in the PLISTs of all affected packages, instead of the
8137: regular "@dirrm" line.</p>
8138:
8139: <p>However, if the directory is shared across many
8140: packages, two different solutions are available:</p>
8141:
8142: <div class="orderedlist">
8143: <ol type="1">
8144: <li>
8145: <p>If the packages have a common dependency, the
8146: directory can be removed in that. For example, see
8147: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
8148: href=
8149: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.45 wiz 8150: target="_top"><code xmlns="" class=
8151: "filename">textproc/scrollkeeper</code></a>, which
8152: removes the shared directory <code xmlns=
8153: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 8154: "filename">share/omf</code>.</p>
1.1 grant 8155: </li>
8156:
8157: <li>
8158: <p>If the packages using the directory are not
8159: related at all (they have no common dependencies),
8160: a *-dirs package is used.</p>
8161: </li>
8162: </ol>
8163: </div>
8164:
8165: <p>From now on, we'll discuss the second solution. To get
8166: an idea of the *-dirs packages available, issue:</p>
8167: <pre class="programlisting">
1.51 rillig 8168: <code class="prompt">%</code> cd .../pkgsrc
8169: <code class="prompt">%</code> ls -d */*-dirs
1.1 grant 8170: </pre>
8171:
8172: <p>Their use from other packages is very simple. The
1.14 xtraeme 8173: <code class="varname">USE_DIRS</code> variable takes a
8174: list of package names (without the “<span class=
1.1 grant 8175: "quote">-dirs</span>” part) together with the
8176: required version number (always pick the latest one when
1.34 wiz 8177: writing new packages).</p>
1.1 grant 8178:
8179: <p>For example, if a package installs files under
1.45 wiz 8180: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8181: class="filename">share/applications</code>, it should
8182: have the following line in it:</p>
1.1 grant 8183: <pre class="programlisting">
1.51 rillig 8184: USE_DIRS+= xdg-1.1
1.1 grant 8185: </pre>
8186:
1.14 xtraeme 8187: <p>After regenerating the PLIST using
8188: <span><strong class="command">make
8189: print-PLIST</strong></span>, you should get the right
8190: (commented out) lines.</p>
1.1 grant 8191:
1.47 reed 8192: <p>Note that even if your package is using <code xmlns=
1.45 wiz 8193: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8194: "filename">$X11BASE</code>, it must not depend on the
1.1 grant 8195: *-x11-dirs packages. Just specify the name without that
1.45 wiz 8196: part and pkgsrc (in particular, <code xmlns=
8197: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8198: "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1 grant 8199: </div>
8200: </div>
8201:
1.59 rillig 8202: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 8203: <div class="titlepage">
8204: <div>
8205: <div>
1.59 rillig 8206: <h2 class="title"><a name="buildlink" id=
1.38 dillo 8207: "buildlink"></a>Chapter 11. Buildlink
1.1 grant 8208: methodology</h2>
8209: </div>
8210: </div>
8211: </div>
8212:
8213: <div class="toc">
8214: <p><b>Table of Contents</b></p>
8215:
8216: <dl>
1.30 wiz 8217: <dt><span class="sect1"><a href=
1.38 dillo 8218: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 8219: to use buildlink3</a></span></dt>
1.1 grant 8220:
1.30 wiz 8221: <dt><span class="sect1"><a href=
1.45 wiz 8222: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
8223: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8224: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 8225:
8226: <dd>
8227: <dl>
1.25 rillig 8228: <dt><span class="sect2"><a href=
1.38 dillo 8229: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 8230: buildlink3.mk file</a></span></dt>
1.1 grant 8231:
1.25 rillig 8232: <dt><span class="sect2"><a href=
1.38 dillo 8233: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 8234: <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14 xtraeme 8235: "replaceable"><code>pkg</code></em></code> in
1.45 wiz 8236: <code xmlns=
8237: "http://www.w3.org/TR/xhtml1/transitional" class=
8238: "filename">buildlink3.mk</code>
1.1 grant 8239: files</a></span></dt>
8240: </dl>
8241: </dd>
8242:
1.30 wiz 8243: <dt><span class="sect1"><a href=
1.45 wiz 8244: "#writing-builtin.mk">11.3. Writing <code xmlns=
8245: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8246: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 8247:
8248: <dd>
8249: <dl>
1.25 rillig 8250: <dt><span class="sect2"><a href=
1.38 dillo 8251: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 8252: <code xmlns=
8253: "http://www.w3.org/TR/xhtml1/transitional" class=
8254: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 8255:
1.25 rillig 8256: <dt><span class="sect2"><a href=
1.38 dillo 8257: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 8258: preferences for native or pkgsrc
8259: software</a></span></dt>
1.1 grant 8260: </dl>
8261: </dd>
8262: </dl>
8263: </div>
8264:
8265: <p>Buildlink is a framework in pkgsrc that controls what
8266: headers and libraries are seen by a package's configure and
8267: build processes. This is implemented in a two step
8268: process:</p>
8269:
8270: <div class="orderedlist">
8271: <ol type="1">
8272: <li>
8273: <p>Symlink headers and libraries for dependencies
1.14 xtraeme 8274: into <code class="varname">BUILDLINK_DIR</code>,
8275: which by default is a subdirectory of <code class=
8276: "varname">WRKDIR</code>.</p>
1.1 grant 8277: </li>
8278:
8279: <li>
8280: <p>Create wrapper scripts that are used in place of
1.14 xtraeme 8281: the normal compiler tools that translate <code class=
8282: "option">-I${LOCALBASE}/include</code> and
8283: <code class="option">-L${LOCALBASE}/lib</code> into
8284: references to <code class=
8285: "varname">BUILDLINK_DIR</code>. The wrapper scripts
8286: also make native compiler on some operating systems
8287: look like GCC, so that packages that expect GCC won't
8288: require modifications to build with those native
8289: compilers.</p>
1.1 grant 8290: </li>
8291: </ol>
8292: </div>
8293:
8294: <p>This normalizes the environment in which a package is
8295: built so that the package may be built consistently despite
8296: what other software may be installed. Please note that the
1.45 wiz 8297: normal system header and library paths, e.g. <code xmlns=
8298: "http://www.w3.org/TR/xhtml1/transitional" class=
8299: "filename">/usr/include</code>, <code xmlns=
8300: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8301: "filename">/usr/lib</code>, etc., are always searched --
1.1 grant 8302: buildlink3 is designed to insulate the package build from
8303: non-system-supplied software.</p>
8304:
1.59 rillig 8305: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 8306: <div class="titlepage">
8307: <div>
8308: <div>
8309: <h2 class="title" style="clear: both"><a name=
1.59 rillig 8310: "converting-to-buildlink3" id=
1.38 dillo 8311: "converting-to-buildlink3"></a>11.1. Converting
1.30 wiz 8312: packages to use buildlink3</h2>
1.1 grant 8313: </div>
8314: </div>
8315: </div>
8316:
8317: <p>The process of converting packages to use the
8318: buildlink3 framework (“<span class=
8319: "quote">bl3ifying</span>”) is fairly
8320: straightforward. The things to keep in mind are:</p>
8321:
8322: <div class="orderedlist">
8323: <ol type="1">
8324: <li>
8325: <p>Ensure that the build always calls the wrapper
8326: scripts instead of the actual toolchain. Some
8327: packages are tricky, and the only way to know for
1.45 wiz 8328: sure is the check <code xmlns=
8329: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8330: "filename">${WRKDIR}/.work.log</code> to see if the
1.1 grant 8331: wrappers are being invoked.</p>
8332: </li>
8333:
8334: <li>
1.14 xtraeme 8335: <p>Don't override <code class=
8336: "varname">PREFIX</code> from within the package
8337: Makefile, e.g. Java VMs, standalone shells, etc.,
1.45 wiz 8338: because the code to symlink files into <code xmlns=
8339: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8340: "filename">${BUILDLINK_DIR}</code> looks for files
1.1 grant 8341: relative to “<span class="quote">pkg_info -qp
1.14 xtraeme 8342: <em class=
8343: "replaceable"><code>pkgname</code></em></span>”.</p>
1.1 grant 8344: </li>
8345:
8346: <li>
8347: <p>Remember that <span class=
1.45 wiz 8348: "emphasis"><em>only</em></span> the <code xmlns=
8349: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8350: "filename">buildlink3.mk</code> files that you list
1.1 grant 8351: in a package's Makefile are added as dependencies
8352: for that package.</p>
8353: </li>
8354: </ol>
8355: </div>
8356:
8357: <p>If a dependency on a particular package is required
8358: for its libraries and headers, then we replace:</p>
8359: <pre class="programlisting">
1.51 rillig 8360: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 grant 8361: </pre>
8362:
8363: <p>with</p>
8364: <pre class="programlisting">
1.51 rillig 8365: .include "../../category/foo/buildlink3.mk"
1.1 grant 8366: </pre>
8367:
1.47 reed 8368: <p>The buildlink3.mk files usually define the required
8369: dependencies. If you need a newer version of the
8370: dependency when using buildlink3.mk files, then you can
8371: define it in your Makefile; for example:</p>
8372: <pre class="programlisting">
1.51 rillig 8373: BUILDLINK_DEPENDS.foo+= foo>=1.1.0
8374: .include "../../category/foo/buildlink3.mk"
1.47 reed 8375: </pre>
8376:
1.45 wiz 8377: <p>There are several <code xmlns=
8378: "http://www.w3.org/TR/xhtml1/transitional" class=
8379: "filename">buildlink3.mk</code> files in <code xmlns=
8380: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8381: "filename">pkgsrc/mk</code> that handle special package
1.1 grant 8382: issues:</p>
8383:
8384: <div class="itemizedlist">
8385: <ul type="disc">
8386: <li>
1.45 wiz 8387: <p><code xmlns=
8388: "http://www.w3.org/TR/xhtml1/transitional" class=
8389: "filename">bdb.buildlink3.mk</code> chooses either
8390: the native or a pkgsrc Berkeley DB implementation
8391: based on the values of <code class=
1.14 xtraeme 8392: "varname">BDB_ACCEPTED</code> and <code class=
8393: "varname">BDB_DEFAULT</code>.</p>
1.1 grant 8394: </li>
8395:
8396: <li>
1.45 wiz 8397: <p><code xmlns=
8398: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 8399: "filename">curses.buildlink3.mk</code>: If the
1.14 xtraeme 8400: system comes with neither Curses nor NCurses, this
8401: will take care to install the <a xmlns=
8402: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 8403: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.45 wiz 8404: target="_top"><code xmlns="" class=
8405: "filename">devel/ncurses</code></a> package.</p>
1.1 grant 8406: </li>
8407:
8408: <li>
1.45 wiz 8409: <p><code xmlns=
8410: "http://www.w3.org/TR/xhtml1/transitional" class=
8411: "filename">krb5.buildlink3.mk</code> uses the value
8412: of <code class="varname">KRB5_ACCEPTED</code> to
8413: choose between adding a dependency on Heimdal or
8414: MIT-krb5 for packages that require a Kerberos 5
1.1 grant 8415: implementation.</p>
8416: </li>
8417:
8418: <li>
1.45 wiz 8419: <p><code xmlns=
8420: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8421: "filename">motif.buildlink3.mk</code> checks for a
8422: system-provided Motif installation or adds a
8423: dependency on <a xmlns=
1.1 grant 8424: "http://www.w3.org/TR/xhtml1/transitional" href=
8425: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.45 wiz 8426: target="_top"><code xmlns="" class=
8427: "filename">x11/lesstif</code></a> or <a xmlns=
1.20 ben 8428: "http://www.w3.org/TR/xhtml1/transitional" href=
8429: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
1.45 wiz 8430: target="_top"><code xmlns="" class=
1.47 reed 8431: "filename">x11/openmotif</code></a>.</p>
1.1 grant 8432: </li>
8433:
8434: <li>
1.45 wiz 8435: <p><code xmlns=
8436: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8437: "filename">ossaudio.buildlink3.mk</code> defines
8438: several variables that may be used by packages that
1.47 reed 8439: use the Open Sound System (OSS) API.</p>
1.1 grant 8440: </li>
8441:
8442: <li>
1.45 wiz 8443: <p><code xmlns=
8444: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8445: "filename">pgsql.buildlink3.mk</code> will accept
8446: either Postgres 7.3 or 7.4, whichever is found
8447: installed. See the file for more information.</p>
1.1 grant 8448: </li>
8449:
8450: <li>
1.45 wiz 8451: <p><code xmlns=
8452: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8453: "filename">pthread.buildlink3.mk</code> uses the
8454: value of <code class="varname">PTHREAD_OPTS</code>
8455: and checks for native pthreads or adds a dependency
8456: on <a xmlns=
1.1 grant 8457: "http://www.w3.org/TR/xhtml1/transitional" href=
8458: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.45 wiz 8459: target="_top"><code xmlns="" class=
1.47 reed 8460: "filename">devel/pth</code></a> as needed.</p>
1.1 grant 8461: </li>
8462:
8463: <li>
1.45 wiz 8464: <p><code xmlns=
8465: "http://www.w3.org/TR/xhtml1/transitional" class=
8466: "filename">xaw.buildlink3.mk</code> uses the value
8467: of <code class="varname">XAW_TYPE</code> to choose
8468: a particular Athena widgets library.</p>
1.1 grant 8469: </li>
8470: </ul>
8471: </div>
8472:
1.45 wiz 8473: <p>The comments in those <code xmlns=
8474: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8475: "filename">buildlink3.mk</code> files provide a more
1.1 grant 8476: complete description of how to use them properly.</p>
8477: </div>
8478:
1.59 rillig 8479: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 8480: <div class="titlepage">
8481: <div>
8482: <div>
8483: <h2 class="title" style="clear: both"><a name=
1.59 rillig 8484: "creating-buildlink3.mk" id=
1.38 dillo 8485: "creating-buildlink3.mk"></a>11.2. Writing
1.45 wiz 8486: <code xmlns=
8487: "http://www.w3.org/TR/xhtml1/transitional" class=
8488: "filename">buildlink3.mk</code> files</h2>
1.1 grant 8489: </div>
8490: </div>
8491: </div>
8492:
1.45 wiz 8493: <p>A package's <code xmlns=
8494: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8495: "filename">buildlink3.mk</code> file is included by
8496: Makefiles to indicate the need to compile and link
8497: against header files and libraries provided by the
1.45 wiz 8498: package. A <code xmlns=
8499: "http://www.w3.org/TR/xhtml1/transitional" class=
8500: "filename">buildlink3.mk</code> file should always
8501: provide enough information to add the correct type of
8502: dependency relationship and include any other
8503: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8504: class="filename">buildlink3.mk</code> files that it needs
8505: to find headers and libraries that it needs in turn.</p>
1.1 grant 8506:
1.45 wiz 8507: <p>To generate an initial <code xmlns=
8508: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8509: "filename">buildlink3.mk</code> file for further editing,
1.1 grant 8510: Rene Hexel's <a xmlns=
8511: "http://www.w3.org/TR/xhtml1/transitional" href=
8512: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.45 wiz 8513: target="_top"><code xmlns="" class=
8514: "filename">pkgtools/createbuildlink</code></a> package is
1.20 ben 8515: highly recommended. For most packages, the following
8516: command will generate a good starting point for
1.45 wiz 8517: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8518: class="filename">buildlink3.mk</code> files:</p>
1.1 grant 8519: <pre class="screen">
1.14 xtraeme 8520: <code class="prompt">%</code> <strong class=
8521: "userinput"><code>cd pkgsrc/<em class=
8522: "replaceable"><code>category</code></em>/<em class=
8523: "replaceable"><code>pkgdir</code></em>
8524: <code class=
1.49 rillig 8525: "prompt">%</code> createbuildlink >buildlink3.mk</code></strong>
1.1 grant 8526: </pre>
8527:
1.59 rillig 8528: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 8529: <div class="titlepage">
8530: <div>
8531: <div>
1.59 rillig 8532: <h3 class="title"><a name="anatomy-of-bl3" id=
8533: "anatomy-of-bl3"></a>11.2.1. Anatomy of a
1.25 rillig 8534: buildlink3.mk file</h3>
1.1 grant 8535: </div>
8536: </div>
8537: </div>
8538:
1.45 wiz 8539: <p>The following real-life example <code xmlns=
8540: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8541: "filename">buildlink3.mk</code> is taken from
1.45 wiz 8542: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8543: class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1 grant 8544: <pre class="programlisting">
1.51 rillig 8545: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 8546:
1.51 rillig 8547: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
8548: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
1.1 grant 8549:
1.51 rillig 8550: .if !empty(BUILDLINK_DEPTH:M+)
8551: BUILDLINK_DEPENDS+= tiff
8552: .endif
1.1 grant 8553:
1.51 rillig 8554: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
8555: BUILDLINK_PACKAGES+= tiff
1.1 grant 8556:
1.51 rillig 8557: .if !empty(TIFF_BUILDLINK3_MK:M+)
8558: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
8559: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
8560: .endif # TIFF_BUILDLINK3_MK
1.1 grant 8561:
1.51 rillig 8562: .include "../../devel/zlib/buildlink3.mk"
8563: .include "../../graphics/jpeg/buildlink3.mk"
1.1 grant 8564:
1.51 rillig 8565: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
1.1 grant 8566: </pre>
8567:
1.14 xtraeme 8568: <p>The header and footer manipulate <code class=
8569: "varname">BUILDLINK_DEPTH</code>, which is common
1.45 wiz 8570: across all <code xmlns=
8571: "http://www.w3.org/TR/xhtml1/transitional" class=
8572: "filename">buildlink3.mk</code> files and is used to
8573: track at what depth we are including <code xmlns=
8574: "http://www.w3.org/TR/xhtml1/transitional" class=
8575: "filename">buildlink3.mk</code> files.</p>
1.1 grant 8576:
8577: <p>The first section controls if the dependency on
1.14 xtraeme 8578: <em class="replaceable"><code>pkg</code></em> is added.
8579: <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1 grant 8580: global list of packages for which dependencies are
8581: added by buildlink3.</p>
8582:
8583: <p>The second section advises pkgsrc that the
1.45 wiz 8584: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8585: class="filename">buildlink3.mk</code> file for
1.14 xtraeme 8586: <em class="replaceable"><code>pkg</code></em> has been
8587: included at some point. <code class=
8588: "varname">BUILDLINK_PACKAGES</code> is the global list
1.45 wiz 8589: of packages for which <code xmlns=
8590: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8591: "filename">buildlink3.mk</code> files have been
8592: included. It must <span class=
8593: "emphasis"><em>always</em></span> be appended to within
1.45 wiz 8594: a <code xmlns=
8595: "http://www.w3.org/TR/xhtml1/transitional" class=
8596: "filename">buildlink3.mk</code> file.</p>
1.1 grant 8597:
8598: <p>The third section is protected from multiple
1.14 xtraeme 8599: inclusion and controls how the dependency on <em class=
8600: "replaceable"><code>pkg</code></em> is added. Several
1.1 grant 8601: important variables are set in the section:</p>
8602:
8603: <div class="itemizedlist">
8604: <ul type="disc">
8605: <li>
1.14 xtraeme 8606: <p><code class=
8607: "varname">BUILDLINK_DEPENDS.<em class=
8608: "replaceable"><code>pkg</code></em></code> is the
8609: actual dependency recorded in the installed
8610: package; this should always be set using
8611: <span><strong class="command">+=</strong></span>
8612: to ensure that we're appending to any
8613: pre-existing list of values. This variable should
8614: be set to the first version of the package that
8615: had the last change in the major number of a
8616: shared library or that had a major API
8617: change.</p>
1.1 grant 8618: </li>
8619:
8620: <li>
1.14 xtraeme 8621: <p><code class=
8622: "varname">BUILDLINK_PKGSRCDIR.<em class=
8623: "replaceable"><code>pkg</code></em></code> is the
8624: location of the <em class=
8625: "replaceable"><code>pkg</code></em> pkgsrc
1.47 reed 8626: directory.</p>
1.1 grant 8627: </li>
8628:
8629: <li>
1.14 xtraeme 8630: <p><code class=
8631: "varname">BUILDLINK_DEPMETHOD.<em class=
8632: "replaceable"><code>pkg</code></em></code> (not
8633: shown above) controls whether we use <code class=
8634: "varname">BUILD_DEPENDS</code> or <code class=
8635: "varname">DEPENDS</code> to add the dependency on
8636: <em class="replaceable"><code>pkg</code></em>.
8637: The build dependency is selected by setting
8638: <code class=
8639: "varname">BUILDLINK_DEPMETHOD.<em class=
8640: "replaceable"><code>pkg</code></em></code> to
1.1 grant 8641: “<span class="quote">build</span>”.
8642: By default, the full dependency is used.</p>
8643: </li>
8644:
8645: <li>
1.14 xtraeme 8646: <p><code class=
8647: "varname">BUILDLINK_INCDIRS.<em class=
8648: "replaceable"><code>pkg</code></em></code> and
8649: <code class=
1.59 rillig 8650: "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
8651: <code>pkg</code></em></code> (not shown above)
8652: are lists of subdirectories of <code xmlns=
1.45 wiz 8653: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8654: "filename">${BUILDLINK_PREFIX.<em class=
8655: "replaceable"><code>pkg</code></em>}</code> to
8656: add to the header and library search paths. These
1.1 grant 8657: default to “<span class=
8658: "quote">include</span>” and
8659: “<span class="quote">lib</span>”
8660: respectively.</p>
8661: </li>
8662:
8663: <li>
1.14 xtraeme 8664: <p><code class=
8665: "varname">BUILDLINK_CPPFLAGS.<em class=
8666: "replaceable"><code>pkg</code></em></code> (not
8667: shown above) is the list of preprocessor flags to
8668: add to <code class="varname">CPPFLAGS</code>,
8669: which are passed on to the configure and build
8670: phases. The “<span class=
8671: "quote">-I</span>” option should be avoided
8672: and instead be handled using <code class=
8673: "varname">BUILDLINK_INCDIRS.<em class=
8674: "replaceable"><code>pkg</code></em></code> as
8675: above.</p>
1.1 grant 8676: </li>
8677: </ul>
8678: </div>
8679:
8680: <p>The following variables are all optionally defined
8681: within this second section (protected against multiple
8682: inclusion) and control which package files are
1.45 wiz 8683: symlinked into <code xmlns=
8684: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8685: "filename">${BUILDLINK_DIR}</code> and how their names
1.1 grant 8686: are transformed during the symlinking:</p>
8687:
8688: <div class="itemizedlist">
8689: <ul type="disc">
8690: <li>
1.14 xtraeme 8691: <p><code class=
8692: "varname">BUILDLINK_FILES.<em class=
8693: "replaceable"><code>pkg</code></em></code> (not
8694: shown above) is a shell glob pattern relative to
1.45 wiz 8695: <code xmlns=
8696: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8697: "filename">${BUILDLINK_PREFIX.<em class=
8698: "replaceable"><code>pkg</code></em>}</code> to be
1.45 wiz 8699: symlinked into <code xmlns=
8700: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8701: "filename">${BUILDLINK_DIR}</code>, e.g.
1.45 wiz 8702: <code xmlns=
8703: "http://www.w3.org/TR/xhtml1/transitional" class=
8704: "filename">include/*.h</code>.</p>
1.1 grant 8705: </li>
8706:
8707: <li>
1.14 xtraeme 8708: <p><code class=
8709: "varname">BUILDLINK_FILES_CMD.<em class=
8710: "replaceable"><code>pkg</code></em></code> (not
8711: shown above) is a shell pipeline that outputs to
1.45 wiz 8712: stdout a list of files relative to <code xmlns=
8713: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8714: "filename">${BUILDLINK_PREFIX.<em class=
8715: "replaceable"><code>pkg</code></em>}</code>. The
1.1 grant 8716: resulting files are to be symlinked into
1.45 wiz 8717: <code xmlns=
8718: "http://www.w3.org/TR/xhtml1/transitional" class=
8719: "filename">${BUILDLINK_DIR}</code>. By default,
8720: this takes the <code xmlns=
8721: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8722: "filename">+CONTENTS</code> of a <em class=
8723: "replaceable"><code>pkg</code></em> and filters
8724: it through <code class=
8725: "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
8726: "replaceable"><code>pkg</code></em>}</code>.</p>
1.1 grant 8727: </li>
8728:
8729: <li>
1.14 xtraeme 8730: <p><code class=
8731: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
8732: "replaceable"><code>pkg</code></em></code> (not
8733: shown above) is a filter command that filters
1.45 wiz 8734: <code xmlns=
8735: "http://www.w3.org/TR/xhtml1/transitional" class=
8736: "filename">+CONTENTS</code> input into a list of
8737: files relative to <code xmlns=
8738: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8739: "filename">${BUILDLINK_PREFIX.<em class=
8740: "replaceable"><code>pkg</code></em>}</code> on
8741: stdout. By default for overwrite packages,
8742: <code class=
8743: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
8744: "replaceable"><code>pkg</code></em></code>
1.45 wiz 8745: outputs the contents of the <code xmlns=
8746: "http://www.w3.org/TR/xhtml1/transitional" class=
8747: "filename">include</code> and <code xmlns=
8748: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8749: "filename">lib</code> directories in the package
1.45 wiz 8750: <code xmlns=
8751: "http://www.w3.org/TR/xhtml1/transitional" class=
8752: "filename">+CONTENTS</code>, and for pkgviews
8753: packages, it outputs any libtool archives in
8754: <code xmlns=
8755: "http://www.w3.org/TR/xhtml1/transitional" class=
8756: "filename">lib</code> directories.</p>
1.1 grant 8757: </li>
8758:
8759: <li>
1.14 xtraeme 8760: <p><code class=
8761: "varname">BUILDLINK_TRANSFORM.<em class=
8762: "replaceable"><code>pkg</code></em></code> (not
8763: shown above) is a list of sed arguments used to
1.1 grant 8764: transform the name of the source filename into a
1.14 xtraeme 8765: destination filename, e.g. <span><strong class=
1.1 grant 8766: "command">-e
1.14 xtraeme 8767: "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1 grant 8768: </li>
8769: </ul>
8770: </div>
8771:
1.45 wiz 8772: <p>The last section includes any <code xmlns=
8773: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8774: "filename">buildlink3.mk</code> needed for <em class=
8775: "replaceable"><code>pkg</code></em>'s library
1.45 wiz 8776: dependencies. Including these <code xmlns=
8777: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8778: "filename">buildlink3.mk</code> files means that the
8779: headers and libraries for these dependencies are also
1.45 wiz 8780: symlinked into <code xmlns=
8781: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8782: "filename">${BUILDLINK_DIR}</code> whenever the
8783: <em class="replaceable"><code>pkg</code></em>
1.45 wiz 8784: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8785: class="filename">buildlink3.mk</code> file is
1.14 xtraeme 8786: included.</p>
1.1 grant 8787: </div>
8788:
1.59 rillig 8789: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 8790: <div class="titlepage">
8791: <div>
8792: <div>
1.30 wiz 8793: <h3 class="title"><a name=
1.59 rillig 8794: "updating-buildlink-depends" id=
8795: "updating-buildlink-depends"></a>11.2.2. Updating
1.30 wiz 8796: <code class=
1.59 rillig 8797: "varname">BUILDLINK_DEPENDS.<em class="replaceable">
8798: <code>pkg</code></em></code> in <code xmlns=
1.45 wiz 8799: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8800: "filename">buildlink3.mk</code> files</h3>
1.1 grant 8801: </div>
8802: </div>
8803: </div>
8804:
8805: <p>There are two situations that require increasing the
1.14 xtraeme 8806: dependency listed in <code class=
8807: "varname">BUILDLINK_DEPENDS.<em class=
8808: "replaceable"><code>pkg</code></em></code> after a
8809: package update:</p>
1.1 grant 8810:
8811: <div class="orderedlist">
8812: <ol type="1">
8813: <li>
8814: <p>if the sonames (major number of the library
8815: version) of any installed shared libraries
1.47 reed 8816: change.</p>
1.1 grant 8817: </li>
8818:
8819: <li>
8820: <p>if the API or interface to the header files
8821: change.</p>
8822: </li>
8823: </ol>
8824: </div>
8825:
1.14 xtraeme 8826: <p>In these cases, <code class=
8827: "varname">BUILDLINK_DEPENDS.<em class=
8828: "replaceable"><code>pkg</code></em></code> should be
8829: adjusted to require at least the new package version.
8830: In some cases, the packages that depend on this new
8831: version may need their <code class=
8832: "varname">PKGREVISION</code>s increased and, if they
1.45 wiz 8833: have <code xmlns=
8834: "http://www.w3.org/TR/xhtml1/transitional" class=
8835: "filename">buildlink3.mk</code> files, their
8836: <code class="varname">BUILDLINK_DEPENDS.<em class=
8837: "replaceable"><code>pkg</code></em></code> adjusted,
8838: too. This is needed so that binary packages made using
8839: it will require the correct package dependency and not
8840: settle for an older one which will not contain the
8841: necessary shared libraries.</p>
1.1 grant 8842:
8843: <p>Please take careful consideration before adjusting
1.14 xtraeme 8844: <code class="varname">BUILDLINK_DEPENDS.<em class=
8845: "replaceable"><code>pkg</code></em></code> as we don't
8846: want to cause unneeded package deletions and rebuilds.
8847: In many cases, new versions of packages work just fine
8848: with older dependencies. See <a href="#dependencies"
1.59 rillig 8849: title="15.1.4. Handling dependencies">Section
8850: 15.1.4, “Handling dependencies”</a> for
8851: more information about dependencies on other packages,
1.25 rillig 8852: including the <code class=
8853: "varname">BUILDLINK_RECOMMENDED</code> and <code class=
8854: "varname">RECOMMENDED</code> definitions.</p>
1.1 grant 8855: </div>
8856: </div>
8857:
1.59 rillig 8858: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 8859: <div class="titlepage">
8860: <div>
8861: <div>
8862: <h2 class="title" style="clear: both"><a name=
1.59 rillig 8863: "writing-builtin.mk" id=
1.38 dillo 8864: "writing-builtin.mk"></a>11.3. Writing
1.45 wiz 8865: <code xmlns=
8866: "http://www.w3.org/TR/xhtml1/transitional" class=
8867: "filename">builtin.mk</code> files</h2>
1.1 grant 8868: </div>
8869: </div>
8870: </div>
8871:
8872: <p>Some packages in pkgsrc install headers and libraries
8873: that coincide with headers and libraries present in the
1.45 wiz 8874: base system. Aside from a <code xmlns=
8875: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8876: "filename">buildlink3.mk</code> file, these packages
1.45 wiz 8877: should also include a <code xmlns=
8878: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8879: "filename">builtin.mk</code> file that includes the
8880: necessary checks to decide whether using the built-in
8881: software or the pkgsrc software is appropriate.</p>
1.1 grant 8882:
8883: <p>The only requirements of a builtin.mk file for
1.14 xtraeme 8884: <em class="replaceable"><code>pkg</code></em> are:</p>
1.1 grant 8885:
8886: <div class="orderedlist">
8887: <ol type="1">
8888: <li>
1.14 xtraeme 8889: <p>It should set <code class=
8890: "varname">USE_BUILTIN.<em class=
8891: "replaceable"><code>pkg</code></em></code> to
8892: either “<span class="quote">yes</span>”
8893: or “<span class="quote">no</span>”
8894: after it is included.</p>
1.1 grant 8895: </li>
8896:
8897: <li>
8898: <p>It should <span class=
8899: "emphasis"><em>not</em></span> override any
1.14 xtraeme 8900: <code class="varname">USE_BUILTIN.<em class=
8901: "replaceable"><code>pkg</code></em></code> which is
1.45 wiz 8902: already set before the <code xmlns=
8903: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8904: "filename">builtin.mk</code> file is included.</p>
1.1 grant 8905: </li>
8906:
8907: <li>
8908: <p>It should be written to allow multiple
8909: inclusion. This is <span class=
8910: "emphasis"><em>very</em></span> important and takes
1.45 wiz 8911: careful attention to <code xmlns=
8912: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8913: "filename">Makefile</code> coding.</p>
1.1 grant 8914: </li>
8915: </ol>
8916: </div>
8917:
1.59 rillig 8918: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 8919: <div class="titlepage">
8920: <div>
8921: <div>
1.59 rillig 8922: <h3 class="title"><a name="anatomy-of-builtin.mk"
8923: id=
1.38 dillo 8924: "anatomy-of-builtin.mk"></a>11.3.1. Anatomy
1.45 wiz 8925: of a <code xmlns=
8926: "http://www.w3.org/TR/xhtml1/transitional" class=
8927: "filename">builtin.mk</code> file</h3>
1.1 grant 8928: </div>
8929: </div>
8930: </div>
8931:
8932: <p>The following is the recommended template for
8933: builtin.mk files:</p>
8934: <pre class="programlisting">
1.51 rillig 8935: .if !defined(IS_BUILTIN.foo)
8936: #
8937: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
8938: # genuinely exists in the system or not.
8939: #
8940: IS_BUILTIN.foo?= no
8941:
8942: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
8943: # version can be determined.
8944: #
8945: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
8946: BUILTIN_PKG.foo?= foo-1.0
8947: . endif
8948: .endif # IS_BUILTIN.foo
8949:
8950: .if !defined(USE_BUILTIN.foo)
8951: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
8952: . if defined(BUILTIN_PKG.foo)
8953: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
8954: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
8955: USE_BUILTIN.foo!= \
8956: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
8957: ${ECHO} "yes"; \
8958: else \
8959: ${ECHO} "no"; \
8960: fi
8961: . endif
8962: . endfor
8963: . endif
8964: .endif # USE_BUILTIN.foo
8965:
8966: CHECK_BUILTIN.foo?= no
8967: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
8968: #
8969: # Here we place code that depends on whether USE_BUILTIN.foo is set to
8970: # "yes" or "no".
8971: #
8972: .endif # CHECK_BUILTIN.foo
1.1 grant 8973: </pre>
8974:
1.14 xtraeme 8975: <p>The first section sets <code class=
8976: "varname">IS_BUILTIN.<em class=
8977: "replaceable"><code>pkg</code></em></code> depending on
8978: if <em class="replaceable"><code>pkg</code></em> really
8979: exists in the base system. This should not be a base
8980: system software with similar functionality to
8981: <em class="replaceable"><code>pkg</code></em>; it
8982: should only be “<span class=
8983: "quote">yes</span>” if the actual package is
8984: included as part of the base system. This variable is
1.45 wiz 8985: only used internally within the <code xmlns=
8986: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8987: "filename">builtin.mk</code> file.</p>
8988:
8989: <p>The second section sets <code class=
8990: "varname">BUILTIN_PKG.<em class=
8991: "replaceable"><code>pkg</code></em></code> to the
8992: version of <em class=
8993: "replaceable"><code>pkg</code></em> in the base system
8994: if it exists (if <code class=
8995: "varname">IS_BUILTIN.<em class=
8996: "replaceable"><code>pkg</code></em></code> is
1.1 grant 8997: “<span class="quote">yes</span>”). This
1.14 xtraeme 8998: variable is only used internally within the
1.45 wiz 8999: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9000: class="filename">builtin.mk</code> file.</p>
1.1 grant 9001:
1.14 xtraeme 9002: <p>The third section sets <code class=
9003: "varname">USE_BUILTIN.<em class=
9004: "replaceable"><code>pkg</code></em></code> and is
9005: <span class="emphasis"><em>required</em></span> in all
1.45 wiz 9006: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9007: class="filename">builtin.mk</code> files. The code in
9008: this section must make the determination whether the
9009: built-in software is adequate to satisfy the
9010: dependencies listed in <code class=
1.14 xtraeme 9011: "varname">BUILDLINK_DEPENDS.<em class=
9012: "replaceable"><code>pkg</code></em></code>. This is
9013: typically done by comparing <code class=
9014: "varname">BUILTIN_PKG.<em class=
9015: "replaceable"><code>pkg</code></em></code> against each
9016: of the dependencies in <code class=
9017: "varname">BUILDLINK_DEPENDS.<em class=
9018: "replaceable"><code>pkg</code></em></code>.
9019: <code class="varname">USE_BUILTIN.<em class=
9020: "replaceable"><code>pkg</code></em></code> <span class=
1.1 grant 9021: "emphasis"><em>must</em></span> be set to the correct
1.45 wiz 9022: value by the end of the <code xmlns=
9023: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9024: "filename">builtin.mk</code> file. Note that
9025: <code class="varname">USE_BUILTIN.<em class=
9026: "replaceable"><code>pkg</code></em></code> may be
1.1 grant 9027: “<span class="quote">yes</span>” even if
1.14 xtraeme 9028: <code class="varname">IS_BUILTIN.<em class=
9029: "replaceable"><code>pkg</code></em></code> is
1.1 grant 9030: “<span class="quote">no</span>” because we
9031: may make the determination that the built-in version of
9032: the software is similar enough to be used as a
9033: replacement.</p>
9034:
1.14 xtraeme 9035: <p>The last section is guarded by <code class=
9036: "varname">CHECK_BUILTIN.<em class=
9037: "replaceable"><code>pkg</code></em></code>, and
9038: includes code that uses the value of <code class=
9039: "varname">USE_BUILTIN.<em class=
9040: "replaceable"><code>pkg</code></em></code> set in the
9041: previous section. This typically includes, e.g., adding
1.1 grant 9042: additional dependency restrictions and listing
1.45 wiz 9043: additional files to symlink into <code xmlns=
9044: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9045: "filename">${BUILDLINK_DIR}</code> (via <code class=
9046: "varname">BUILDLINK_FILES.<em class=
9047: "replaceable"><code>pkg</code></em></code>).</p>
1.1 grant 9048: </div>
9049:
1.59 rillig 9050: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 9051: <div class="titlepage">
9052: <div>
9053: <div>
1.30 wiz 9054: <h3 class="title"><a name=
1.59 rillig 9055: "native-or-pkgsrc-preference" id=
1.38 dillo 9056: "native-or-pkgsrc-preference"></a>11.3.2. Global
1.30 wiz 9057: preferences for native or pkgsrc software</h3>
1.1 grant 9058: </div>
9059: </div>
9060: </div>
9061:
9062: <p>When building packages, it's possible to choose
9063: whether to set a global preference for using either the
9064: built-in (native) version or the pkgsrc version of
9065: software to satisfy a dependency. This is controlled by
1.14 xtraeme 9066: setting <code class="varname">PREFER_PKGSRC</code> and
9067: <code class="varname">PREFER_NATIVE</code>. These
9068: variables take values of either “<span class=
1.1 grant 9069: "quote">yes</span>”, “<span class=
9070: "quote">no</span>”, or a list of packages.
1.14 xtraeme 9071: <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
9072: to use the pkgsrc versions of software, while
9073: <code class="varname">PREFER_NATIVE</code> tells pkgsrc
9074: to use the built-in versions. Preferences are
9075: determined by the most specific instance of the package
9076: in either <code class="varname">PREFER_PKGSRC</code> or
9077: <code class="varname">PREFER_NATIVE</code>. If a
9078: package is specified in neither or in both variables,
9079: then <code class="varname">PREFER_PKGSRC</code> has
9080: precedence over <code class=
9081: "varname">PREFER_NATIVE</code>. For example, to require
9082: using pkgsrc versions of software for all but the most
9083: basic bits on a NetBSD system, you can set:</p>
1.1 grant 9084: <pre class="programlisting">
1.51 rillig 9085: PREFER_PKGSRC= yes
9086: PREFER_NATIVE= getopt skey tcp_wrappers
1.1 grant 9087: </pre>
9088:
9089: <p>A package <span class=
1.45 wiz 9090: "emphasis"><em>must</em></span> have a <code xmlns=
9091: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9092: "filename">builtin.mk</code> file to be listed in
9093: <code class="varname">PREFER_NATIVE</code>, otherwise
9094: it is simply ignored in that list.</p>
1.1 grant 9095: </div>
9096: </div>
9097: </div>
9098:
1.59 rillig 9099: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 9100: <div class="titlepage">
9101: <div>
9102: <div>
1.59 rillig 9103: <h2 class="title"><a name="pkginstall" id=
1.38 dillo 9104: "pkginstall"></a>Chapter 12. The pkginstall
1.35 jmmv 9105: framework</h2>
1.1 grant 9106: </div>
9107: </div>
9108: </div>
9109:
9110: <div class="toc">
9111: <p><b>Table of Contents</b></p>
9112:
9113: <dl>
1.30 wiz 9114: <dt><span class="sect1"><a href=
1.38 dillo 9115: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 9116: directories outside the installation
9117: prefix</a></span></dt>
9118:
9119: <dd>
9120: <dl>
9121: <dt><span class="sect2"><a href=
1.38 dillo 9122: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 9123: manipulation</a></span></dt>
9124:
9125: <dt><span class="sect2"><a href=
1.38 dillo 9126: "#files-outside-prefix">12.1.2. File
1.35 jmmv 9127: manipulation</a></span></dt>
9128: </dl>
9129: </dd>
9130:
1.38 dillo 9131: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 9132: Configuration files</a></span></dt>
9133:
9134: <dd>
9135: <dl>
9136: <dt><span class="sect2"><a href=
1.38 dillo 9137: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 9138: "varname">PKG_SYSCONFDIR</code> is
9139: set</a></span></dt>
9140:
9141: <dt><span class="sect2"><a href=
1.38 dillo 9142: "#conf-files-configure">12.2.2. Telling the
1.47 reed 9143: software where configuration files
1.35 jmmv 9144: are</a></span></dt>
9145:
9146: <dt><span class="sect2"><a href=
1.38 dillo 9147: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 9148: installations</a></span></dt>
9149:
9150: <dt><span class="sect2"><a href=
1.38 dillo 9151: "#conf-files-disable">12.2.4. Disabling handling of
1.35 jmmv 9152: configuration files</a></span></dt>
9153: </dl>
9154: </dd>
9155:
1.38 dillo 9156: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 9157: System startup scripts</a></span></dt>
9158:
9159: <dd>
9160: <dl>
9161: <dt><span class="sect2"><a href=
1.38 dillo 9162: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 9163: of system startup scripts</a></span></dt>
9164: </dl>
9165: </dd>
1.1 grant 9166:
1.30 wiz 9167: <dt><span class="sect1"><a href=
1.38 dillo 9168: "#users-and-groups">12.4. System users and
1.35 jmmv 9169: groups</a></span></dt>
9170:
1.38 dillo 9171: <dt><span class="sect1"><a href="#shells">12.5. System
1.35 jmmv 9172: shells</a></span></dt>
9173:
9174: <dd>
9175: <dl>
9176: <dt><span class="sect2"><a href=
1.38 dillo 9177: "#shells-disable">12.5.1. Disabling handling of
1.35 jmmv 9178: configuration files</a></span></dt>
9179: </dl>
9180: </dd>
1.1 grant 9181: </dl>
9182: </div>
9183:
1.35 jmmv 9184: <p>This chapter describes the framework known as
9185: <code class="literal">pkginstall</code>, whose key features
9186: are:</p>
9187:
9188: <div class="itemizedlist">
9189: <ul type="disc">
9190: <li>
9191: <p>Generic installation and manipulation of
9192: directories and files outside the pkgsrc-handled
9193: tree, <code class="varname">LOCALBASE</code>.</p>
9194: </li>
9195:
9196: <li>
9197: <p>Automatic handling of configuration files during
9198: installation, provided that packages are correctly
9199: designed.</p>
9200: </li>
9201:
9202: <li>
9203: <p>Generation and installation of system startup
9204: scripts.</p>
9205: </li>
9206:
9207: <li>
9208: <p>Registration of system users and groups.</p>
9209: </li>
9210:
9211: <li>
9212: <p>Registration of system shells.</p>
9213: </li>
9214: </ul>
9215: </div>
9216:
9217: <p>The following sections inspect each of the above points
1.47 reed 9218: in detail. Note that in order to use any of the described
1.35 jmmv 9219: functionalities, you must add the following to your
1.45 wiz 9220: package's <code xmlns=
9221: "http://www.w3.org/TR/xhtml1/transitional" class=
9222: "filename">Makefile</code>:</p>
1.35 jmmv 9223: <pre class="programlisting">
1.51 rillig 9224: USE_PKGINSTALL= YES
1.35 jmmv 9225: </pre>
9226:
9227: <p>You may be thinking that many of the things described
9228: here could be easily done with simple code in the package's
9229: post-installation target (<code class=
9230: "literal">post-install</code>). <span class=
9231: "emphasis"><em>This is incorrect</em></span>, as the code
9232: in them is only executed when building from source.
9233: Machines using binary packages could not benefit from it at
9234: all (as the code itself could be unavailable). Therefore,
9235: the only way to achieve any of the items described above is
9236: by means of the installation scripts, which are
9237: automatically generated by pkginstall.</p>
1.1 grant 9238:
1.59 rillig 9239: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 9240: <div class="titlepage">
9241: <div>
9242: <div>
9243: <h2 class="title" style="clear: both"><a name=
1.59 rillig 9244: "files-and-dirs-outside-prefix" id=
9245: "files-and-dirs-outside-prefix"></a>12.1. Files and
9246: directories outside the installation prefix</h2>
1.1 grant 9247: </div>
9248: </div>
9249: </div>
9250:
1.45 wiz 9251: <p>As you already know, the <code xmlns=
9252: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9253: "filename">PLIST</code> file holds a list of files and
9254: directories that belong to a package. The names used in
1.45 wiz 9255: it are relative to the installation prefix (<code xmlns=
9256: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9257: "filename">${PREFIX}</code>), which means that it cannot
9258: register files outside this directory (absolute path
9259: names are not allowed). Despite this restriction, some
9260: packages need to install files outside this location;
1.45 wiz 9261: e.g., under <code xmlns=
9262: "http://www.w3.org/TR/xhtml1/transitional" class=
9263: "filename">${VARBASE}</code> or <code xmlns=
9264: "http://www.w3.org/TR/xhtml1/transitional" class=
9265: "filename">${PKG_SYSCONFDIR}</code>.</p>
1.35 jmmv 9266:
9267: <p>The only way to achieve this is to create such files
9268: during installation time by using the installation
9269: scripts. These scripts can run arbitrary commands, so
9270: they have the potential to create and manage files
1.47 reed 9271: anywhere in the file system. Here is where pkginstall
1.35 jmmv 9272: comes into play: it provides generic scripts to abstract
9273: the manipulation of such files and directories based on
1.45 wiz 9274: variables set in the package's <code xmlns=
9275: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9276: "filename">Makefile</code>. The rest of this section
1.47 reed 9277: describes these variables.</p>
1.1 grant 9278:
1.59 rillig 9279: <div class="sect2" lang="en" xml:lang="en">
1.35 jmmv 9280: <div class="titlepage">
1.1 grant 9281: <div>
1.35 jmmv 9282: <div>
1.59 rillig 9283: <h3 class="title"><a name="dirs-outside-prefix"
9284: id="dirs-outside-prefix"></a>12.1.1. Directory
1.35 jmmv 9285: manipulation</h3>
9286: </div>
1.1 grant 9287: </div>
9288: </div>
9289:
1.35 jmmv 9290: <p>The following variables can be set to request the
1.47 reed 9291: creation of directories anywhere in the file
9292: system:</p>
1.27 rillig 9293:
1.35 jmmv 9294: <div class="itemizedlist">
9295: <ul type="disc">
9296: <li>
9297: <p><code class="varname">MAKE_DIRS</code> and
9298: <code class="varname">OWN_DIRS</code> contain a
9299: list of directories that should be created and
9300: should attempt to be destroyed by the
9301: installation scripts. The difference between the
9302: two is that the latter prompts the administrator
9303: to remove any directories that may be left after
9304: deinstallation (because they were not empty),
9305: while the former does not.</p>
9306: </li>
1.1 grant 9307:
1.35 jmmv 9308: <li>
9309: <p><code class="varname">MAKE_DIRS_PERMS</code>
9310: and <code class="varname">OWN_DIRS_PERMS</code>
9311: contain a list of tuples describing which
9312: directories should be created and should attempt
9313: to be destroyed by the installation scripts. Each
9314: tuple holds the following values, separated by
9315: spaces: the directory name, its owner, its group
9316: and its numerical mode. For example:</p>
9317: <pre class="programlisting">
1.51 rillig 9318: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
1.35 jmmv 9319: </pre>
1.1 grant 9320:
1.35 jmmv 9321: <p>The difference between the two is exactly the
9322: same as their non-<code class=
9323: "varname">PERMS</code> counterparts.</p>
9324: </li>
9325: </ul>
9326: </div>
9327: </div>
9328:
1.59 rillig 9329: <div class="sect2" lang="en" xml:lang="en">
1.35 jmmv 9330: <div class="titlepage">
9331: <div>
9332: <div>
1.59 rillig 9333: <h3 class="title"><a name="files-outside-prefix"
9334: id="files-outside-prefix"></a>12.1.2. File
1.35 jmmv 9335: manipulation</h3>
9336: </div>
9337: </div>
9338: </div>
9339:
9340: <p>Creating non-empty files outside the installation
1.45 wiz 9341: prefix is tricky because the <code xmlns=
9342: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9343: "filename">PLIST</code> forces all files to be inside
9344: it. To overcome this problem, the only solution is to
9345: extract the file in the known place (i.e., inside the
9346: installation prefix) and copy it to the appropriate
9347: location during installation (done by the installation
9348: scripts generated by pkginstall). We will call the
9349: former the <span class="emphasis"><em>master
9350: file</em></span> in the following paragraphs, which
9351: describe the variables that can be used to
9352: automatically and consistently handle files outside the
9353: installation prefix:</p>
9354:
9355: <div class="itemizedlist">
9356: <ul type="disc">
9357: <li>
9358: <p><code class="varname">CONF_FILES</code> and
9359: <code class="varname">SUPPORT_FILES</code> are
9360: pairs of master and target files. During
9361: installation time, the master file is copied to
9362: the target one if and only if the latter does not
9363: exist. Upon deinstallation, the target file is
9364: removed provided that it was not modified by the
9365: installation.</p>
9366:
9367: <p>The difference between the two is that the
9368: latter prompts the administrator to remove any
9369: files that may be left after deinstallation
9370: (because they were not empty), while the former
9371: does not.</p>
9372: </li>
9373:
9374: <li>
9375: <p><code class="varname">CONF_FILES_PERMS</code>
9376: and <code class=
9377: "varname">SUPPORT_FILES_PERMS</code> contain
9378: tuples describing master files as well as their
9379: target locations. For each of them, it also
9380: specifies their owner, their group and their
9381: numeric permissions, in this order. For
9382: example:</p>
9383: <pre class="programlisting">
1.51 rillig 9384: SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
1.35 jmmv 9385: </pre>
9386:
9387: <p>The difference between the two is exactly the
9388: same as their non-<code class=
9389: "varname">PERMS</code> counterparts.</p>
9390: </li>
9391: </ul>
9392: </div>
9393: </div>
9394: </div>
9395:
1.59 rillig 9396: <div class="sect1" lang="en" xml:lang="en">
1.35 jmmv 9397: <div class="titlepage">
9398: <div>
9399: <div>
9400: <h2 class="title" style="clear: both"><a name=
1.59 rillig 9401: "conf-files" id="conf-files"></a>12.2.
9402: Configuration files</h2>
1.35 jmmv 9403: </div>
9404: </div>
9405: </div>
9406:
9407: <p>Configuration files are special in the sense that they
9408: are installed in their own specific directory,
9409: <code class="varname">PKG_SYSCONFDIR</code>, and need
9410: special treatment during installation (most of which is
9411: automated by pkginstall). The main concept you must bear
1.36 wiz 9412: in mind is that files marked as configuration files are
1.35 jmmv 9413: automatically copied to the right place (somewhere inside
9414: <code class="varname">PKG_SYSCONFDIR</code>) during
9415: installation <span class="emphasis"><em>if and only
9416: if</em></span> they didn't exist before. Similarly, they
9417: will not be removed if they have local modifications.
1.36 wiz 9418: This ensures that administrators never lose any custom
1.35 jmmv 9419: changes they may have made.</p>
9420:
1.59 rillig 9421: <div class="sect2" lang="en" xml:lang="en">
1.35 jmmv 9422: <div class="titlepage">
9423: <div>
9424: <div>
1.59 rillig 9425: <h3 class="title"><a name="conf-files-sysconfdir"
9426: id="conf-files-sysconfdir"></a>12.2.1. How
1.35 jmmv 9427: <code class="varname">PKG_SYSCONFDIR</code> is
9428: set</h3>
9429: </div>
9430: </div>
9431: </div>
9432:
9433: <p>As said before, the <code class=
9434: "varname">PKG_SYSCONFDIR</code> variable specifies
9435: where configuration files shall be installed. Its
9436: contents are set based upon the following
9437: variables:</p>
9438:
9439: <div class="itemizedlist">
9440: <ul type="disc">
9441: <li>
9442: <p><code class="varname">PKG_SYSCONFBASE</code>:
9443: The configuration's root directory. Defaults to
1.45 wiz 9444: <code xmlns=
9445: "http://www.w3.org/TR/xhtml1/transitional" class=
9446: "filename">${PREFIX}/etc</code> although it may
9447: be overridden by the user to point to his
9448: preferred location (e.g., <code xmlns=
9449: "http://www.w3.org/TR/xhtml1/transitional" class=
9450: "filename">/etc</code>, <code xmlns=
9451: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9452: "filename">/etc/pkg</code>, etc.). Packages must
9453: not use it directly.</p>
9454: </li>
9455:
9456: <li>
9457: <p><code class=
9458: "varname">PKG_SYSCONFSUBDIR</code>: A
9459: subdirectory of <code class=
9460: "varname">PKG_SYSCONFBASE</code> under which the
9461: configuration files for the package being built
9462: shall be installed. The definition of this
9463: variable only makes sense in the package's
1.45 wiz 9464: <code xmlns=
9465: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 9466: "filename">Makefile</code> (i.e., it is not
9467: user-customizable).</p>
1.35 jmmv 9468:
9469: <p>As an example, consider the Apache package,
9470: <a xmlns=
9471: "http://www.w3.org/TR/xhtml1/transitional" href=
9472: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
1.45 wiz 9473: target="_top"><code xmlns="" class=
9474: "filename">www/apache2</code></a>, which places
9475: its configuration files under the <code xmlns=
9476: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9477: "filename">httpd/</code> subdirectory of
9478: <code class="varname">PKG_SYSCONFBASE</code>.
9479: This should be set in the package Makefile.</p>
9480: </li>
9481:
9482: <li>
9483: <p><code class="varname">PKG_SYSCONFVAR</code>:
9484: Specifies the name of the variable that holds
9485: this package's configuration directory (if
9486: different from <code class=
9487: "varname">PKG_SYSCONFBASE</code>). It defaults to
9488: <code class="varname">PKGBASE</code>'s value, and
9489: is always prefixed with <code class=
9490: "literal">PKG_SYSCONFDIR</code>.</p>
9491: </li>
9492:
9493: <li>
9494: <p><code class=
9495: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
9496: Holds the directory where the configuration files
9497: for the package identified by <code class=
9498: "varname">PKG_SYSCONFVAR</code>'s shall be
9499: placed.</p>
9500: </li>
9501: </ul>
9502: </div>
9503:
9504: <p>Based on the above variables, pkginstall determines
9505: the value of <code class=
9506: "varname">PKG_SYSCONFDIR</code>, which is the
9507: <span class="emphasis"><em>only</em></span> variable
9508: that can be used within a package to refer to its
9509: configuration directory. The algorithm used to set its
9510: value is basically the following:</p>
9511:
9512: <div class="orderedlist">
9513: <ol type="1">
9514: <li>
9515: <p>If <code class=
9516: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
9517: is set, its value is used.</p>
9518: </li>
9519:
9520: <li>
9521: <p>If the previous variable is not defined but
9522: <code class="varname">PKG_SYSCONFSUBDIR</code> is
1.45 wiz 9523: set in the package's <code xmlns=
9524: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9525: "filename">Makefile</code>, the resulting value
1.45 wiz 9526: is <code xmlns=
9527: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9528: "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
9529: </li>
9530:
9531: <li>
1.45 wiz 9532: <p>Otherwise, it is set to <code xmlns=
9533: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9534: "filename">${PKG_SYSCONFBASE}</code>.</p>
9535: </li>
9536: </ol>
9537: </div>
9538:
1.45 wiz 9539: <p>It is worth mentioning that <code xmlns=
9540: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9541: "filename">${PKG_SYSCONFDIR}</code> is automatically
1.45 wiz 9542: added to <code xmlns=
9543: "http://www.w3.org/TR/xhtml1/transitional" class=
9544: "filename">OWN_DIRS</code>. See <a href=
9545: "#dirs-outside-prefix" title=
1.59 rillig 9546: "12.1.1. Directory manipulation">Section 12.1.1,
1.35 jmmv 9547: “Directory manipulation”</a> what this
9548: means.</p>
9549: </div>
9550:
1.59 rillig 9551: <div class="sect2" lang="en" xml:lang="en">
1.35 jmmv 9552: <div class="titlepage">
9553: <div>
9554: <div>
1.59 rillig 9555: <h3 class="title"><a name="conf-files-configure"
9556: id="conf-files-configure"></a>12.2.2. Telling the
9557: software where configuration files are</h3>
1.35 jmmv 9558: </div>
9559: </div>
9560: </div>
9561:
9562: <p>Given that pkgsrc (and users!) expect configuration
9563: files to be in a known place, you need to teach each
1.36 wiz 9564: package where it shall install its files. In some cases
1.35 jmmv 9565: you will have to patch the package Makefiles to achieve
9566: it. If you are lucky, though, it may be as easy as
9567: passing an extra flag to the configuration script; this
1.47 reed 9568: is the case of GNU Autoconf- generated files:</p>
1.35 jmmv 9569: <pre class="programlisting">
1.51 rillig 9570: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.35 jmmv 9571: </pre>
9572:
9573: <p>Note that this specifies where the package has to
9574: <span class="emphasis"><em>look for</em></span> its
9575: configuration files, not where they will be originally
9576: installed (although the difference is never explicit,
9577: unfortunately).</p>
9578: </div>
9579:
1.59 rillig 9580: <div class="sect2" lang="en" xml:lang="en">
1.35 jmmv 9581: <div class="titlepage">
9582: <div>
9583: <div>
1.59 rillig 9584: <h3 class="title"><a name="conf-files-patching"
9585: id="conf-files-patching"></a>12.2.3. Patching
1.35 jmmv 9586: installations</h3>
9587: </div>
9588: </div>
9589: </div>
9590:
9591: <p>As said before, pkginstall automatically handles
9592: configuration files. This means that <span class=
9593: "strong"><strong>the packages themselves must not touch
1.45 wiz 9594: the contents of <code xmlns=
9595: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9596: "filename">${PKG_SYSCONFDIR}</code>
1.36 wiz 9597: directly</strong></span>. Bad news is that many
9598: software installation scripts will, out of the box,
9599: mess with the contents of that directory. So what is
9600: the correct procedure to fix this issue?</p>
1.35 jmmv 9601:
9602: <p>You must teach the package (usually by manually
9603: patching it) to install any configuration files under
1.45 wiz 9604: the examples hierarchy, <code xmlns=
9605: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9606: "filename">share/examples/${PKGBASE}/</code>. This way,
1.45 wiz 9607: the <code xmlns=
9608: "http://www.w3.org/TR/xhtml1/transitional" class=
9609: "filename">PLIST</code> registers them and the
9610: administrator always has the original copies
1.35 jmmv 9611: available.</p>
9612:
9613: <p>Once the required configuration files are in place
9614: (i.e., under the examples hierarchy), the pkginstall
9615: framework can use them as master copies during the
1.45 wiz 9616: package installation to update what is in <code xmlns=
9617: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9618: "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
9619: the variables <code class="varname">CONF_FILES</code>
9620: and <code class="varname">CONF_FILES_PERMS</code> are
9621: used. Check out <a href="#files-outside-prefix" title=
1.59 rillig 9622: "12.1.2. File manipulation">Section 12.1.2,
1.35 jmmv 9623: “File manipulation”</a> for information
9624: about their syntax and their purpose. Here is an
9625: example, taken from the <a xmlns=
9626: "http://www.w3.org/TR/xhtml1/transitional" href=
9627: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
1.45 wiz 9628: target="_top"><code xmlns="" class=
9629: "filename">mail/mutt</code></a> package:</p>
1.35 jmmv 9630: <pre class="programlisting">
1.51 rillig 9631: EGDIR= ${PREFIX}/share/doc/mutt/samples
9632: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
1.35 jmmv 9633: </pre>
9634:
9635: <p>Note that the <code class="varname">EGDIR</code>
9636: variable is specific to that package and has no meaning
9637: outside it.</p>
9638: </div>
9639:
1.59 rillig 9640: <div class="sect2" lang="en" xml:lang="en">
1.35 jmmv 9641: <div class="titlepage">
9642: <div>
9643: <div>
1.59 rillig 9644: <h3 class="title"><a name="conf-files-disable"
9645: id="conf-files-disable"></a>12.2.4. Disabling
1.35 jmmv 9646: handling of configuration files</h3>
9647: </div>
9648: </div>
9649: </div>
9650:
9651: <p>The automatic copying of config files can be toggled
9652: by setting the environment variable <code class=
9653: "varname">PKG_CONFIG</code> prior to package
9654: installation.</p>
9655: </div>
9656: </div>
9657:
1.59 rillig 9658: <div class="sect1" lang="en" xml:lang="en">
1.35 jmmv 9659: <div class="titlepage">
9660: <div>
9661: <div>
9662: <h2 class="title" style="clear: both"><a name=
1.59 rillig 9663: "rcd-scripts" id="rcd-scripts"></a>12.3. System
9664: startup scripts</h2>
1.35 jmmv 9665: </div>
9666: </div>
9667: </div>
9668:
9669: <p>System startup scripts are special files because they
9670: must be installed in a place known by the underlying OS,
9671: usually outside the installation prefix. Therefore, the
9672: same rules described in <a href=
9673: "#files-and-dirs-outside-prefix" title=
1.38 dillo 9674: "12.1. Files and directories outside the installation prefix">
1.59 rillig 9675: Section 12.1, “Files and directories outside the
9676: installation prefix”</a> apply, and the same
1.35 jmmv 9677: solutions can be used. However, pkginstall provides a
1.36 wiz 9678: special mechanism to handle these files.</p>
1.35 jmmv 9679:
9680: <p>In order to provide system startup scripts, the
9681: package has to:</p>
9682:
9683: <div class="orderedlist">
9684: <ol type="1">
9685: <li>
1.45 wiz 9686: <p>Store the script inside <code xmlns=
9687: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9688: "filename">${FILESDIR}</code>, with the
9689: <code class="literal">.sh</code> suffix appended.
9690: Considering the <a xmlns=
9691: "http://www.w3.org/TR/xhtml1/transitional" href=
9692: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
1.45 wiz 9693: target="_top"><code xmlns="" class=
9694: "filename">print/cups</code></a> package as an
9695: example, it has a <code xmlns=
9696: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9697: "filename">cupsd.sh</code> in its files
9698: directory.</p>
9699: </li>
9700:
9701: <li>
9702: <p>Tell pkginstall to handle it, appending the name
9703: of the script, without its extension, to the
9704: <code class="varname">RCD_SCRIPTS</code> variable.
9705: Continuing the previous example:</p>
9706: <pre class="programlisting">
1.51 rillig 9707: RCD_SCRIPTS+= cupsd
1.35 jmmv 9708: </pre>
9709: </li>
9710: </ol>
9711: </div>
9712:
9713: <p>Once this is done, pkginstall will do the following
9714: steps for each script in an automated fashion:</p>
9715:
9716: <div class="orderedlist">
9717: <ol type="1">
9718: <li>
9719: <p>Process the file found in the files directory
9720: applying all the substitutions described in the
1.45 wiz 9721: <code xmlns=
9722: "http://www.w3.org/TR/xhtml1/transitional" class=
9723: "filename">FILES_SUBST</code> variable.</p>
1.35 jmmv 9724: </li>
9725:
9726: <li>
9727: <p>Copy the script from the files directory to the
1.45 wiz 9728: examples hierarchy, <code xmlns=
9729: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9730: "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36 wiz 9731: Note that this master file must be explicitly
1.45 wiz 9732: registered in the <code xmlns=
9733: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9734: "filename">PLIST</code>.</p>
9735: </li>
9736:
9737: <li>
9738: <p>Add code to the installation scripts to copy the
9739: startup script from the examples hierarchy into the
9740: system-wide startup scripts directory.</p>
9741: </li>
9742: </ol>
9743: </div>
9744:
1.59 rillig 9745: <div class="sect2" lang="en" xml:lang="en">
1.35 jmmv 9746: <div class="titlepage">
9747: <div>
9748: <div>
1.59 rillig 9749: <h3 class="title"><a name="rcd-scripts-disable"
9750: id="rcd-scripts-disable"></a>12.3.1. Disabling
1.35 jmmv 9751: handling of system startup scripts</h3>
9752: </div>
9753: </div>
9754: </div>
9755:
9756: <p>The automatic copying of config files can be toggled
9757: by setting the environment variable <code class=
9758: "varname">PKG_RCD_SCRIPTS</code> prior to package
9759: installation. Note that the scripts will be always
1.45 wiz 9760: copied inside the examples hierarchy, <code xmlns=
9761: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9762: "filename">${PREFIX}/share/examples/rc.d/</code>, no
9763: matter what the value of this variable is.</p>
9764: </div>
9765: </div>
9766:
1.59 rillig 9767: <div class="sect1" lang="en" xml:lang="en">
1.35 jmmv 9768: <div class="titlepage">
9769: <div>
9770: <div>
9771: <h2 class="title" style="clear: both"><a name=
1.59 rillig 9772: "users-and-groups" id="users-and-groups"></a>12.4.
9773: System users and groups</h2>
1.35 jmmv 9774: </div>
9775: </div>
9776: </div>
9777:
9778: <p>If a package needs to create special users and/or
9779: groups during installation, it can do so by using the
9780: pkginstall framework.</p>
9781:
9782: <p>Users can be created by adding entries to the
9783: <code class="varname">PKG_USERS</code> variable. Each
1.45 wiz 9784: entry has the following syntax, which mimics <code xmlns=
9785: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9786: "filename">/etc/passwd</code>:</p>
9787: <pre class="programlisting">
1.51 rillig 9788: user:group[:[userid][:[descr][:[home][:shell]]]]
1.35 jmmv 9789: </pre>
9790:
9791: <p>Only the user and group are required; everything else
9792: is optional, but the colons must be in the right places
9793: when specifying optional bits. By default, a new user
1.45 wiz 9794: will have home directory <code xmlns=
9795: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9796: "filename">/nonexistent</code>, and login shell
1.45 wiz 9797: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9798: class="filename">/sbin/nologin</code> unless they are
9799: specified as part of the user element. Note that if the
1.51 rillig 9800: description contains spaces, then spaces should be
1.45 wiz 9801: backslash-escaped, as in:</p>
1.35 jmmv 9802: <pre class="programlisting">
1.51 rillig 9803: foo:foogrp::The\ Foomister
1.35 jmmv 9804: </pre>
9805:
9806: <p>Similarly, groups can be created using the
9807: <code class="varname">PKG_GROUPS</code> variable, whose
9808: syntax is:</p>
9809: <pre class="programlisting">
1.51 rillig 9810: group[:groupid]
1.35 jmmv 9811: </pre>
9812:
9813: <p>As before, only the group name is required; the
9814: numeric identifier is optional.</p>
9815: </div>
9816:
1.59 rillig 9817: <div class="sect1" lang="en" xml:lang="en">
1.35 jmmv 9818: <div class="titlepage">
9819: <div>
9820: <div>
9821: <h2 class="title" style="clear: both"><a name=
1.59 rillig 9822: "shells" id="shells"></a>12.5. System shells</h2>
1.35 jmmv 9823: </div>
9824: </div>
9825: </div>
9826:
9827: <p>Packages that install system shells should register
1.45 wiz 9828: them in the shell database, <code xmlns=
9829: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9830: "filename">/etc/shells</code>, to make things easier to
9831: the administrator. This must be done from the
9832: installation scripts to keep binary packages working on
9833: any system. pkginstall provides an easy way to accomplish
9834: this task.</p>
9835:
9836: <p>When a package provides a shell interpreter, it has to
9837: set the <code class="varname">PKG_SHELL</code> variable
9838: to its absolute file name. This will add some hooks to
9839: the installation scripts to handle it. Consider the
9840: following example, taken from <a xmlns=
9841: "http://www.w3.org/TR/xhtml1/transitional" href=
9842: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
1.45 wiz 9843: target="_top"><code xmlns="" class=
9844: "filename">shells/zsh</code></a>:</p>
1.35 jmmv 9845: <pre class="programlisting">
1.51 rillig 9846: USE_PKGINSTALL= YES
9847: PKG_SHELL= ${PREFIX}/bin/zsh
1.35 jmmv 9848: </pre>
9849:
1.59 rillig 9850: <div class="sect2" lang="en" xml:lang="en">
1.35 jmmv 9851: <div class="titlepage">
9852: <div>
9853: <div>
1.59 rillig 9854: <h3 class="title"><a name="shells-disable" id=
9855: "shells-disable"></a>12.5.1. Disabling handling
9856: of configuration files</h3>
1.35 jmmv 9857: </div>
9858: </div>
9859: </div>
9860:
9861: <p>The automatic registration of shell interpreters can
9862: be disabled by the administrator by setting the
1.45 wiz 9863: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9864: class="filename">PKG_REGISTER_SHELLS</code> environment
9865: variable to <code class="literal">NO</code>.</p>
1.35 jmmv 9866: </div>
9867: </div>
9868: </div>
9869:
1.59 rillig 9870: <div class="chapter" lang="en" xml:lang="en">
1.35 jmmv 9871: <div class="titlepage">
9872: <div>
9873: <div>
1.59 rillig 9874: <h2 class="title"><a name="options" id=
1.38 dillo 9875: "options"></a>Chapter 13. Options
1.35 jmmv 9876: handling</h2>
9877: </div>
9878: </div>
9879: </div>
9880:
9881: <div class="toc">
9882: <p><b>Table of Contents</b></p>
9883:
9884: <dl>
9885: <dt><span class="sect1"><a href=
1.38 dillo 9886: "#global-default-options">13.1. Global default
1.35 jmmv 9887: options</a></span></dt>
9888:
9889: <dt><span class="sect1"><a href=
1.38 dillo 9890: "#converting-to-options">13.2. Converting packages to
1.45 wiz 9891: use <code xmlns=
9892: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9893: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 9894:
9895: <dt><span class="sect1"><a href="#option-names">13.3.
9896: Option Names</a></span></dt>
1.35 jmmv 9897: </dl>
9898: </div>
9899:
9900: <p>Many packages have the ability to be built to support
1.45 wiz 9901: different sets of features. <code xmlns=
9902: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9903: "filename">bsd.options.mk</code> is a framework in pkgsrc
9904: that provides generic handling of those options that
9905: determine different ways in which the packages can be
9906: built. It's possible for the user to specify exactly which
9907: sets of options will be built into a package or to allow a
9908: set of global default options apply.</p>
9909:
1.59 rillig 9910: <div class="sect1" lang="en" xml:lang="en">
1.35 jmmv 9911: <div class="titlepage">
9912: <div>
9913: <div>
9914: <h2 class="title" style="clear: both"><a name=
1.59 rillig 9915: "global-default-options" id=
1.38 dillo 9916: "global-default-options"></a>13.1. Global
1.35 jmmv 9917: default options</h2>
9918: </div>
9919: </div>
9920: </div>
9921:
9922: <p>Global default options are listed in <code class=
9923: "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
9924: the options that should be built into every package if
9925: that option is supported. This variable should be set in
1.45 wiz 9926: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9927: class="filename">/etc/mk.conf</code>.</p>
1.35 jmmv 9928: </div>
9929:
1.59 rillig 9930: <div class="sect1" lang="en" xml:lang="en">
1.35 jmmv 9931: <div class="titlepage">
9932: <div>
9933: <div>
9934: <h2 class="title" style="clear: both"><a name=
1.59 rillig 9935: "converting-to-options" id=
1.38 dillo 9936: "converting-to-options"></a>13.2. Converting
1.45 wiz 9937: packages to use <code xmlns=
9938: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9939: "filename">bsd.options.mk</code></h2>
9940: </div>
9941: </div>
9942: </div>
9943:
1.45 wiz 9944: <p>The following example shows how <code xmlns=
9945: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9946: "filename">bsd.options.mk</code> should be used by the
9947: hypothetical ``wibble'' package, either in the package
1.45 wiz 9948: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9949: class="filename">Makefile</code>, or in a file, e.g.
9950: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9951: class="filename">options.mk</code>, that is included by
9952: the main package <code xmlns=
9953: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9954: "filename">Makefile</code>.</p>
9955: <pre class="programlisting">
1.51 rillig 9956: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
9957: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
9958: PKG_OPTIONS_OPTIONAL_GROUPS= database
9959: PKG_OPTIONS_GROUP.database= mysql pgsql
9960: PKG_SUGGESTED_OPTIONS= wibble-foo
9961: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
9962: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
9963:
9964: .include "../../mk/bsd.prefs.mk"
9965:
9966: # this package was previously named wibble2
9967: .if defined(PKG_OPTIONS.wibble2)
9968: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
9969: PKG_OPTIONS_DEPRECATED_WARNINGS+= \
9970: "Deprecated variable PKG_OPTIONS.wibble2 used, use "${PKG_OPTIONS_VAR:Q}" instead."
9971: .endif
9972:
9973: .include "../../mk/bsd.options.mk"
9974:
9975: # Package-specific option-handling
9976:
9977: ###
9978: ### FOO support
9979: ###
9980: .if !empty(PKG_OPTIONS:Mwibble-foo)
9981: CONFIGURE_ARGS+= --enable-foo
9982: .endif
9983:
9984: ###
9985: ### LDAP support
9986: ###
9987: .if !empty(PKG_OPTIONS:Mldap)
9988: . include "../../databases/openldap/buildlink3.mk"
9989: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
9990: .endif
9991:
9992: ###
9993: ### database support
9994: ###
9995: .if !empty(PKG_OPTIONS:Mmysql)
9996: . include "../../mk/mysql.buildlink3.mk"
9997: .endif
9998: .if !empty(PKG_OPTIONS:Mpgsql)
9999: . include "../../mk/pgsql.buildlink3.mk"
10000: .endif
1.1 grant 10001: </pre>
10002:
1.28 rillig 10003: <p>The first section contains the information about which
10004: build options are supported by the package, and any
1.1 grant 10005: default options settings if needed.</p>
10006:
10007: <div class="orderedlist">
10008: <ol type="1">
10009: <li>
1.14 xtraeme 10010: <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27 rillig 10011: the name of the <a href=
1.1 grant 10012: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
10013: <span class="citerefentry"><span class=
1.27 rillig 10014: "refentrytitle">make</span>(1)</span></a> variable
1.37 dillo 10015: that the user can set to override the default
1.57 minskim 10016: options. It should be set to PKG_OPTIONS.<em class=
10017: "replaceable"><code>pkgbase</code></em>.</p>
1.1 grant 10018: </li>
10019:
10020: <li>
1.14 xtraeme 10021: <p><code class=
10022: "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37 dillo 10023: build options supported by the package.</p>
10024: </li>
10025:
10026: <li>
10027: <p><code class=
10028: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
10029: list of names of groups of mutually exclusive
10030: options. The options in each group are listed in
10031: <code class="varname">PKG_OPTIONS_GROUP.<em class=
10032: "replaceable"><code>groupname</code></em></code>.
10033: The most specific setting of any option from the
10034: group takes precedence over all other options in
10035: the group. Options from the groups will be
10036: automatically added to <code class=
10037: "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
10038: </li>
10039:
10040: <li>
10041: <p><code class=
10042: "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
10043: like <code class=
10044: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
10045: building the packages will fail if no option from
10046: the group is selected.</p>
1.1 grant 10047: </li>
10048:
10049: <li>
1.27 rillig 10050: <p><code class=
1.44 gdt 10051: "varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a
10052: list of names of sets of options. At least one
10053: option from each set must be selected. The options
10054: in each set are listed in <code class=
10055: "varname">PKG_OPTIONS_SET.<em class=
10056: "replaceable"><code>setname</code></em></code>.
10057: Options from the sets will be automatically added
10058: to <code class=
10059: "varname">PKG_SUPPORTED_OPTIONS</code>. Building
10060: the package will fail if no option from the set is
10061: selected.</p>
10062: </li>
10063:
10064: <li>
10065: <p><code class=
1.27 rillig 10066: "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
10067: build options which are enabled by default.</p>
10068: </li>
10069:
10070: <li>
1.37 dillo 10071: <p><code class=
10072: "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
10073: of “<span class="quote"><em class=
1.59 rillig 10074: "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable">
10075: <code>option</code></em></span>” pairs that
10076: map legacy <code xmlns=
1.45 wiz 10077: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 10078: "filename">/etc/mk.conf</code> variables to their
10079: option counterparts. Pairs should be added with
10080: “<span class="quote">+=</span>” to keep
10081: the listing of global legacy variables. A warning
10082: will be issued if the user uses a legacy
10083: variable.</p>
10084: </li>
1.1 grant 10085:
1.37 dillo 10086: <li>
10087: <p><code class=
10088: "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
10089: of “<span class="quote"><em class=
1.59 rillig 10090: "replaceable"><code>old-option</code></em>:<em class="replaceable">
10091: <code>new-option</code></em></span>” pairs
10092: that map options that have been renamed to their
10093: new counterparts. Pairs should be added with
1.37 dillo 10094: “<span class="quote">+=</span>” to keep
10095: the listing of global legacy options. A warning
10096: will be issued if the user uses a legacy
10097: option.</p>
10098: </li>
1.1 grant 10099:
1.37 dillo 10100: <li>
10101: <p><code class="varname">PKG_LEGACY_OPTIONS</code>
10102: is a list of options implied by deprecated
10103: variables used. This can be used for cases that
10104: neither <code class=
10105: "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
10106: <code class=
10107: "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
10108: handle, e. g. when <code class=
10109: "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1 grant 10110: </li>
10111:
10112: <li>
1.37 dillo 10113: <p><code class=
10114: "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
10115: a list of warnings about deprecated variables or
10116: options used, and what to use instead.</p>
1.1 grant 10117: </li>
1.28 rillig 10118: </ol>
1.1 grant 10119: </div>
10120:
1.37 dillo 10121: <p>A package should never modify <code class=
10122: "varname">PKG_DEFAULT_OPTIONS</code> or the variable
10123: named in <code class="varname">PKG_OPTIONS_VAR</code>.
10124: These are strictly user-settable. To suggest a default
10125: set of options, use <code class=
10126: "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
10127:
1.42 dillo 10128: <p><code class="varname">PKG_OPTIONS_VAR</code> must be
1.45 wiz 10129: defined before including <code xmlns=
10130: "http://www.w3.org/TR/xhtml1/transitional" class=
1.42 dillo 10131: "filename">bsd.options.mk</code>. If none of <code class=
1.37 dillo 10132: "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
10133: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
10134: <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
1.47 reed 10135: are defined (as can happen with platform-specific options
1.42 dillo 10136: if none of them is supported on the current platform),
10137: <code class="varname">PKG_OPTIONS</code> is set to the
10138: empty list and the package is otherwise treated as not
10139: using the options framework.</p>
1.37 dillo 10140:
1.45 wiz 10141: <p>After the inclusion of <code xmlns=
10142: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 10143: "filename">bsd.options.mk</code>, the variable
1.28 rillig 10144: <code class="varname">PKG_OPTIONS</code> contains the
1.37 dillo 10145: list of selected build options, properly filtered to
1.28 rillig 10146: remove unsupported and duplicate options.</p>
10147:
1.1 grant 10148: <p>The remaining sections contain the logic that is
1.37 dillo 10149: specific to each option. The correct way to check for an
10150: option is to check whether it is listed in <code class=
10151: "varname">PKG_OPTIONS</code>:</p>
10152: <pre class="programlisting">
1.51 rillig 10153: .if !empty(PKG_OPTIONS:M<em class=
1.37 dillo 10154: "replaceable"><code>option</code></em>)
10155: </pre>
1.48 dillo 10156: </div>
1.37 dillo 10157:
1.59 rillig 10158: <div class="sect1" lang="en" xml:lang="en">
1.48 dillo 10159: <div class="titlepage">
10160: <div>
10161: <div>
10162: <h2 class="title" style="clear: both"><a name=
1.59 rillig 10163: "option-names" id=
1.48 dillo 10164: "option-names"></a>13.3. Option Names</h2>
10165: </div>
10166: </div>
10167: </div>
10168:
10169: <p>Options that enable similar features in different
10170: packages (like optional support for a library) should use
10171: a common name in all packages that support it (like the
10172: name of the library). If another package already has an
10173: option with the same meaning, use the same name.</p>
10174:
10175: <p>Options that enable features specific to one package,
10176: where it's unlikely that another (unrelated) package has
10177: the same (or a similar) optional feature, should use a
10178: name prefixed with <code class="varname"><em class=
10179: "replaceable"><code>pkgname</code></em>-</code>.</p>
10180:
10181: <p>If a group of related packages share an optional
10182: feature specific to that group, prefix it with the name
10183: of the “<span class="quote">main</span>”
10184: package (e. g. <code class=
10185: "varname">djbware-errno-hack</code>).</p>
10186:
10187: <p>For new options, add a line to <code xmlns=
10188: "http://www.w3.org/TR/xhtml1/transitional" class=
10189: "filename">mk/defaults/options.description</code>. Lines
10190: have two fields, separated by tab. The first field is the
10191: option name, the second its description. The description
10192: should be a whole sentence (starting with an uppercase
10193: letter and ending with a period) that describes what
10194: enabling the option does. E. g. “<span class=
10195: "quote">Enable ispell support.</span>” The file is
10196: sorted by option names.</p>
1.1 grant 10197: </div>
10198: </div>
10199:
1.59 rillig 10200: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 10201: <div class="titlepage">
10202: <div>
10203: <div>
1.59 rillig 10204: <h2 class="title"><a name="build" id=
1.38 dillo 10205: "build"></a>Chapter 14. The build
1.1 grant 10206: process</h2>
10207: </div>
10208: </div>
10209: </div>
10210:
10211: <div class="toc">
10212: <p><b>Table of Contents</b></p>
10213:
10214: <dl>
1.56 rillig 10215: <dt><span class="sect1"><a href="#build.intro">14.1.
10216: Introduction</a></span></dt>
10217:
10218: <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1 grant 10219: Program location</a></span></dt>
10220:
1.56 rillig 10221: <dt><span class="sect1"><a href=
10222: "#build.builddirs">14.3. Directories used during the
10223: build process</a></span></dt>
10224:
10225: <dt><span class="sect1"><a href="#build.running">14.4.
10226: Running a phase</a></span></dt>
10227:
10228: <dt><span class="sect1"><a href="#build.fetch">14.5.
10229: The <span class="emphasis"><em>fetch</em></span>
10230: phase</a></span></dt>
10231:
10232: <dt><span class="sect1"><a href="#build.checksum">14.6.
10233: The <span class="emphasis"><em>checksum</em></span>
10234: phase</a></span></dt>
10235:
10236: <dt><span class="sect1"><a href="#build.extract">14.7.
10237: The <span class="emphasis"><em>extract</em></span>
10238: phase</a></span></dt>
10239:
10240: <dt><span class="sect1"><a href="#build.patch">14.8.
10241: The <span class="emphasis"><em>patch</em></span>
10242: phase</a></span></dt>
10243:
10244: <dt><span class="sect1"><a href="#build.tools">14.9.
10245: The <span class="emphasis"><em>tools</em></span>
10246: phase</a></span></dt>
10247:
10248: <dt><span class="sect1"><a href="#build.wrapper">14.10.
10249: The <span class="emphasis"><em>wrapper</em></span>
10250: phase</a></span></dt>
1.1 grant 10251:
10252: <dt><span class="sect1"><a href=
1.56 rillig 10253: "#build.configure">14.11. The <span class=
10254: "emphasis"><em>configure</em></span>
10255: phase</a></span></dt>
10256:
10257: <dt><span class="sect1"><a href="#build.build">14.12.
10258: The <span class="emphasis"><em>build</em></span>
10259: phase</a></span></dt>
10260:
10261: <dt><span class="sect1"><a href="#build.test">14.13.
10262: The <span class="emphasis"><em>test</em></span>
10263: phase</a></span></dt>
10264:
10265: <dt><span class="sect1"><a href="#build.install">14.14.
10266: The <span class="emphasis"><em>install</em></span>
10267: phase</a></span></dt>
10268:
10269: <dt><span class="sect1"><a href="#build.package">14.15.
10270: The <span class="emphasis"><em>package</em></span>
10271: phase</a></span></dt>
10272:
10273: <dt><span class="sect1"><a href=
10274: "#build.helpful-targets">14.16. Other helpful
1.1 grant 10275: targets</a></span></dt>
10276: </dl>
10277: </div>
10278:
1.59 rillig 10279: <div class="sect1" lang="en" xml:lang="en">
1.56 rillig 10280: <div class="titlepage">
10281: <div>
10282: <div>
10283: <h2 class="title" style="clear: both"><a name=
1.59 rillig 10284: "build.intro" id=
1.56 rillig 10285: "build.intro"></a>14.1. Introduction</h2>
10286: </div>
10287: </div>
10288: </div>
10289:
10290: <p>This chapter gives a detailed description on how a
10291: package is built. Building a package is separated into
10292: different <span class="emphasis"><em>phases</em></span>
10293: (for example <code class="varname">fetch</code>,
10294: <code class="varname">build</code>, <code class=
10295: "varname">install</code>), all of which are described in
10296: the following sections. Each phase is splitted into
10297: so-called <span class="emphasis"><em>stages</em></span>,
10298: which take the name of the containing stage, prefixed by
10299: one of <code class="varname">pre-</code>, <code class=
10300: "varname">do-</code> or <code class=
10301: "varname">post-</code>. (Examples are <code class=
10302: "varname">pre-configure</code>, <code class=
10303: "varname">post-build</code>.) Most of the actual work is
10304: done in the <code class="varname">do-*</code> stages.</p>
10305:
10306: <p>The basic steps for building a program are always the
10307: same. First the program's source (<span class=
10308: "emphasis"><em>distfile</em></span>) must be brought to
10309: the local system and then extracted. After any patches to
10310: compile properly on NetBSD are applied, the software can
10311: be configured, then built (usually by compiling), and
10312: finally the generated binaries, etc. can be put into
10313: place on the system. These are exactly the steps
10314: performed by the NetBSD package system, which is
10315: implemented as a series of targets in a central Makefile,
10316: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10317: class="filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
10318: </div>
1.1 grant 10319:
1.59 rillig 10320: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 10321: <div class="titlepage">
10322: <div>
10323: <div>
10324: <h2 class="title" style="clear: both"><a name=
1.59 rillig 10325: "build.prefix" id=
1.56 rillig 10326: "build.prefix"></a>14.2. Program location</h2>
1.1 grant 10327: </div>
10328: </div>
10329: </div>
10330:
10331: <p>Before outlining the process performed by the NetBSD
10332: package system in the next section, here's a brief
10333: discussion on where programs are installed, and which
10334: variables influence this.</p>
10335:
1.14 xtraeme 10336: <p>The automatic variable <code class=
10337: "varname">PREFIX</code> indicates where all files of the
10338: final program shall be installed. It is usually set to
1.45 wiz 10339: <code class="varname">LOCALBASE</code> (<code xmlns=
10340: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10341: "filename">/usr/pkg</code>), or <code class=
10342: "varname">CROSSBASE</code> for pkgs in the
1.1 grant 10343: “<span class="quote">cross</span>” category.
1.14 xtraeme 10344: The value of <code class="varname">PREFIX</code> needs to
10345: be put into the various places in the program's source
10346: where paths to these files are encoded. See <a href=
1.1 grant 10347: "#components.patches" title=
1.38 dillo 10348: "8.3. patches/*">Section 8.3,
1.1 grant 10349: “patches/*”</a> and <a href="#fixes.libtool"
10350: title=
1.38 dillo 10351: "15.3.1. Shared libraries - libtool">Section 15.3.1,
1.1 grant 10352: “Shared libraries - libtool”</a> for more
10353: details.</p>
10354:
10355: <p>When choosing which of these variables to use, follow
10356: the following rules:</p>
10357:
10358: <div class="itemizedlist">
10359: <ul type="disc">
10360: <li>
1.14 xtraeme 10361: <p><code class="varname">PREFIX</code> always
10362: points to the location where the current pkg will
10363: be installed. When referring to a pkg's own
1.1 grant 10364: installation path, use “<span class=
10365: "quote">${PREFIX}</span>”.</p>
10366: </li>
10367:
10368: <li>
1.14 xtraeme 10369: <p><code class="varname">LOCALBASE</code> is where
10370: all non-X11 pkgs are installed. If you need to
1.1 grant 10371: construct a -I or -L argument to the compiler to
10372: find includes and libraries installed by another
10373: non-X11 pkg, use “<span class=
10374: "quote">${LOCALBASE}</span>”.</p>
10375: </li>
10376:
10377: <li>
1.14 xtraeme 10378: <p><code class="varname">X11BASE</code> is where
10379: the actual X11 distribution (from xsrc, etc.) is
1.1 grant 10380: installed. When looking for <span class=
10381: "emphasis"><em>standard</em></span> X11 includes
10382: (not those installed by a pkg), use
10383: “<span class=
10384: "quote">${X11BASE}</span>”.</p>
10385: </li>
10386:
10387: <li>
1.47 reed 10388: <p>X11-based packages are special in that they may
10389: be installed in either <code class=
1.14 xtraeme 10390: "varname">X11BASE</code> or <code class=
10391: "varname">LOCALBASE</code>.</p>
1.1 grant 10392:
10393: <p>Usually, X11 packages should be installed under
1.14 xtraeme 10394: <code class="varname">LOCALBASE</code> whenever
1.34 wiz 10395: possible. Note that you will need to include
1.45 wiz 10396: <code xmlns=
10397: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 10398: "filename">../../mk/x11.buildlink3.mk</code> in
10399: them to request the presence of X11 and to get the
10400: right compilation flags.</p>
1.1 grant 10401:
10402: <p>Even though, there are some packages that cannot
1.14 xtraeme 10403: be installed under <code class=
10404: "varname">LOCALBASE</code>: those that come with
1.1 grant 10405: app-defaults files. These packages are special and
1.14 xtraeme 10406: they must be placed under <code class=
10407: "varname">X11BASE</code>. To accomplish this, set
10408: either <code class="varname">USE_X11BASE</code> or
10409: <code class="varname">USE_IMAKE</code> in your
1.1 grant 10410: package.</p>
10411:
1.34 wiz 10412: <p>Some notes: If you need to find includes or
1.14 xtraeme 10413: libraries installed by a pkg that has <code class=
10414: "varname">USE_IMAKE</code> or <code class=
10415: "varname">USE_X11BASE</code> in its pkg
1.45 wiz 10416: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10417: class="filename">Makefile</code>, you need to look
10418: in <span class="emphasis"><em>both</em></span>
10419: <code xmlns=
10420: "http://www.w3.org/TR/xhtml1/transitional" class=
10421: "filename">${X11BASE}</code> and <code xmlns=
10422: "http://www.w3.org/TR/xhtml1/transitional" class=
10423: "filename">${LOCALBASE}</code>. To force
10424: installation of all X11 packages in <code class=
10425: "varname">LOCALBASE</code>, the <a xmlns=
10426: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 10427: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 wiz 10428: target="_top"><code xmlns="" class=
10429: "filename">pkgtools/xpkgwedge</code></a> package is
1.34 wiz 10430: enabled by default.</p>
1.1 grant 10431: </li>
10432:
10433: <li>
1.14 xtraeme 10434: <p><code class="varname">X11PREFIX</code> should be
1.1 grant 10435: used to refer to the installed location of an X11
1.14 xtraeme 10436: package. <code class="varname">X11PREFIX</code>
10437: will be set to <code class="varname">X11BASE</code>
10438: if xpkgwedge is not installed, and to <code class=
10439: "varname">LOCALBASE</code> if xpkgwedge is
1.1 grant 10440: installed.</p>
10441: </li>
10442:
10443: <li>
10444: <p>If xpkgwedge is installed, it is possible to
1.14 xtraeme 10445: have some packages installed in <code class=
10446: "varname">X11BASE</code> and some in <code class=
10447: "varname">LOCALBASE</code>. To determine the prefix
10448: of an installed package, the <code class=
10449: "varname">EVAL_PREFIX</code> definition can be
10450: used. It takes pairs in the format
10451: “<span class=
1.1 grant 10452: "quote">DIRNAME=<package></span>”, and
1.24 wiz 10453: the <a href=
10454: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
10455: <span class="citerefentry"><span class=
10456: "refentrytitle">make</span>(1)</span></a> variable
10457: <code class="varname">DIRNAME</code> will be set to
10458: the prefix of the installed package
10459: <package>, or “<span class=
1.1 grant 10460: "quote">${X11PREFIX}</span>” if the package
10461: is not installed.</p>
10462:
10463: <p>This is best illustrated by example.</p>
10464:
1.45 wiz 10465: <p>The following lines are taken from <code xmlns=
10466: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10467: "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1 grant 10468: <pre class="programlisting">
1.51 rillig 10469: EVAL_PREFIX+= GTKDIR=gtk+
10470: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE} \
10471: --with-gtk-prefix="${GTKDIR}" \
10472: --enable-multibyte
1.1 grant 10473: </pre>
10474:
10475: <p>Specific defaults can be defined for the
1.14 xtraeme 10476: packages evaluated using <code class=
10477: "varname">EVAL_PREFIX</code>, by using a definition
1.1 grant 10478: of the form:</p>
10479: <pre class="programlisting">
1.51 rillig 10480: GTKDIR_DEFAULT= ${LOCALBASE}
1.1 grant 10481: </pre>
10482:
1.14 xtraeme 10483: <p>where <code class="varname">GTKDIR</code>
1.1 grant 10484: corresponds to the first definition in the
1.14 xtraeme 10485: <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1 grant 10486: </li>
10487:
10488: <li>
1.45 wiz 10489: <p>Within <code xmlns=
10490: "http://www.w3.org/TR/xhtml1/transitional" class=
10491: "filename">${PREFIX}</code>, packages should
10492: install files according to <a href=
1.24 wiz 10493: "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
10494: <span class="citerefentry"><span class=
10495: "refentrytitle">hier</span>(7)</span></a>, with the
1.45 wiz 10496: exception that manual pages go into <code xmlns=
10497: "http://www.w3.org/TR/xhtml1/transitional" class=
10498: "filename">${PREFIX}/man</code>, not <code xmlns=
10499: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10500: "filename">${PREFIX}/share/man</code>.</p>
1.1 grant 10501: </li>
10502: </ul>
10503: </div>
10504: </div>
10505:
1.59 rillig 10506: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 10507: <div class="titlepage">
10508: <div>
10509: <div>
10510: <h2 class="title" style="clear: both"><a name=
1.59 rillig 10511: "build.builddirs" id=
1.56 rillig 10512: "build.builddirs"></a>14.3. Directories used
10513: during the build process</h2>
1.1 grant 10514: </div>
10515: </div>
10516: </div>
10517:
1.56 rillig 10518: <p>When building a package, a number of directories is
10519: used to store source files, temporary files,
10520: pkgsrc-internal files, and so on. These directories are
10521: explained here.</p>
10522:
10523: <p>Some of the directory variables contain relative
10524: pathnames. There are two common base directories for
10525: these relative directories: <code class=
10526: "varname">PKGSRCDIR/PKGPATH</code> is used for
10527: directories that are pkgsrc-specific. <code class=
10528: "varname">WRKSRC</code> is used for directories inside
10529: the package itself. The permissions after each variable
10530: indicate whether the variable may be changed by the
10531: package Makefile.</p>
1.1 grant 10532:
10533: <div class="variablelist">
10534: <dl>
1.56 rillig 10535: <dt><span class="term"><code class=
10536: "varname">PKGSRCDIR</code> (read-only)</span></dt>
10537:
10538: <dd>
10539: <p>This is an absolute pathname that points to the
10540: pkgsrc root directory. Generally, you don't need
10541: it.</p>
10542: </dd>
10543:
10544: <dt><span class="term"><code class=
10545: "varname">PKGPATH</code> (read-only)</span></dt>
1.1 grant 10546:
10547: <dd>
1.56 rillig 10548: <p>This is a pathname relative to <code class=
10549: "varname">PKGSRCDIR</code> that points to the
10550: current package.</p>
10551: </dd>
10552:
10553: <dt><span class="term"><code class=
10554: "varname">WRKDIR</code> (read-only)</span></dt>
10555:
10556: <dd>
10557: <p>This is an absolute pathname pointing to the
1.57 minskim 10558: directory where all work takes place. The distfiles
10559: are extraced to this directory. It also contains
10560: temporary directories and log files used by the
10561: various pkgsrc frameworks, like <span class=
10562: "emphasis"><em>buildlink</em></span> or the
10563: <span class=
1.56 rillig 10564: "emphasis"><em>wrappers</em></span>.</p>
10565: </dd>
10566:
10567: <dt><span class="term"><code class=
10568: "varname">WRKSRC</code> (read-write)</span></dt>
10569:
10570: <dd>
10571: <p>This is an absolute pathname pointing to the
10572: directory where the distfiles are extracted. It is
10573: usually a direct subdirectory of <code class=
10574: "varname">WRKDIR</code>, and often it's the only
10575: directory entry that isn't hidden.</p>
10576: </dd>
10577: </dl>
10578: </div>
10579: </div>
10580:
1.59 rillig 10581: <div class="sect1" lang="en" xml:lang="en">
1.56 rillig 10582: <div class="titlepage">
10583: <div>
10584: <div>
10585: <h2 class="title" style="clear: both"><a name=
1.59 rillig 10586: "build.running" id=
1.56 rillig 10587: "build.running"></a>14.4. Running a phase</h2>
10588: </div>
10589: </div>
10590: </div>
10591:
10592: <p>You can run a particular phase by typing
10593: <span><strong class="command">make phase</strong></span>,
10594: where <span class="emphasis"><em>phase</em></span> is the
10595: name of the phase. This will automatically run all phases
10596: that are required for this phase. The default phase is
10597: <code class="varname">build</code>, that is, when you run
10598: <span><strong class="command">make</strong></span>
10599: without parameters in a package directory, the package
10600: will be built, but not installed.</p>
10601: </div>
10602:
1.59 rillig 10603: <div class="sect1" lang="en" xml:lang="en">
1.56 rillig 10604: <div class="titlepage">
10605: <div>
10606: <div>
10607: <h2 class="title" style="clear: both"><a name=
1.59 rillig 10608: "build.fetch" id="build.fetch"></a>14.5. The
10609: <span class="emphasis"><em>fetch</em></span>
10610: phase</h2>
1.56 rillig 10611: </div>
10612: </div>
10613: </div>
10614:
10615: <p>This will check if the file(s) given in the variables
10616: <code class="varname">DISTFILES</code> and <code class=
10617: "varname">PATCHFILES</code> (as defined in the package's
10618: Makefile) are present on the local system in <code xmlns=
10619: "http://www.w3.org/TR/xhtml1/transitional" class=
10620: "filename">/usr/pkgsrc/distfiles</code>. If they are not
10621: present, an attempt will be made to fetch them using
10622: commands of the form:</p>
10623: <pre class="programlisting">
1.51 rillig 10624: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
1.1 grant 10625: </pre>
10626:
1.56 rillig 10627: <p>where ${site} varies through several possibilities in
10628: turn: first, <code class=
10629: "varname">MASTER_SITE_OVERRIDE</code> is tried, then the
10630: sites specified in either <code class=
10631: "varname">SITES_file</code> if defined, else <code class=
10632: "varname">MASTER_SITES</code> or <code class=
10633: "varname">PATCH_SITES</code>, as applies, then finally
10634: the value of <code class=
10635: "varname">MASTER_SITE_BACKUP</code>. The order of all
10636: except the first can be optionally sorted by the user,
10637: via setting either <code class=
10638: "varname">MASTER_SORT_AWK</code> or <code class=
10639: "varname">MASTER_SORT_REGEX</code>.</p>
10640: </div>
10641:
1.59 rillig 10642: <div class="sect1" lang="en" xml:lang="en">
1.56 rillig 10643: <div class="titlepage">
10644: <div>
10645: <div>
10646: <h2 class="title" style="clear: both"><a name=
1.59 rillig 10647: "build.checksum" id=
1.56 rillig 10648: "build.checksum"></a>14.6. The <span class=
10649: "emphasis"><em>checksum</em></span> phase</h2>
10650: </div>
10651: </div>
10652: </div>
10653:
10654: <p>After the distfile(s) are fetched, their checksum is
10655: generated and compared with the checksums stored in the
10656: distinfo file. If the checksums don't match, the build is
10657: aborted. This is to ensure the same distfile is used for
10658: building, and that the distfile wasn't changed, e.g. by
10659: some malign force, deliberately changed distfiles on the
10660: master distribution site or network lossage.</p>
10661: </div>
10662:
1.59 rillig 10663: <div class="sect1" lang="en" xml:lang="en">
1.56 rillig 10664: <div class="titlepage">
10665: <div>
10666: <div>
10667: <h2 class="title" style="clear: both"><a name=
1.59 rillig 10668: "build.extract" id=
1.56 rillig 10669: "build.extract"></a>14.7. The <span class=
10670: "emphasis"><em>extract</em></span> phase</h2>
10671: </div>
10672: </div>
10673: </div>
10674:
10675: <p>When the distfiles are present on the local system,
10676: they need to be extracted, as they are usually in the
10677: form of some compressed archive format, most commonly
10678: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10679: class="filename">.tar.gz</code>.</p>
1.1 grant 10680:
1.56 rillig 10681: <p>If only some of the distfiles need to be uncompressed,
10682: the files to be uncompressed should be put into
10683: <code class="varname">EXTRACT_ONLY</code>.</p>
1.1 grant 10684:
1.56 rillig 10685: <p>If the distfiles are not in <code xmlns=
10686: "http://www.w3.org/TR/xhtml1/transitional" class=
10687: "filename">.tar.gz</code> format, they can be extracted
10688: by setting either <code class=
10689: "varname">EXTRACT_SUFX</code>, or <code class=
10690: "varname">EXTRACT_CMD</code>, <code class=
10691: "varname">EXTRACT_BEFORE_ARGS</code> and <code class=
10692: "varname">EXTRACT_AFTER_ARGS</code>. In the former case,
10693: pkgsrc knows how to extract a number of suffixes
10694: (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10695: class="filename">.tar.gz</code>, <code xmlns=
10696: "http://www.w3.org/TR/xhtml1/transitional" class=
10697: "filename">.tgz</code>, <code xmlns=
10698: "http://www.w3.org/TR/xhtml1/transitional" class=
10699: "filename">.tar.gz2</code>, <code xmlns=
10700: "http://www.w3.org/TR/xhtml1/transitional" class=
10701: "filename">.tbz</code>, <code xmlns=
10702: "http://www.w3.org/TR/xhtml1/transitional" class=
10703: "filename">.tar.Z</code>, <code xmlns=
10704: "http://www.w3.org/TR/xhtml1/transitional" class=
10705: "filename">.tar</code>, <code xmlns=
10706: "http://www.w3.org/TR/xhtml1/transitional" class=
10707: "filename">.shar.gz</code>, <code xmlns=
10708: "http://www.w3.org/TR/xhtml1/transitional" class=
10709: "filename">.shar.bz2</code>, <code xmlns=
10710: "http://www.w3.org/TR/xhtml1/transitional" class=
10711: "filename">.shar.Z</code>, <code xmlns=
10712: "http://www.w3.org/TR/xhtml1/transitional" class=
10713: "filename">.shar</code>, <code xmlns=
10714: "http://www.w3.org/TR/xhtml1/transitional" class=
10715: "filename">.Z</code>, <code xmlns=
10716: "http://www.w3.org/TR/xhtml1/transitional" class=
10717: "filename">.bz2</code> and <code xmlns=
10718: "http://www.w3.org/TR/xhtml1/transitional" class=
10719: "filename">.gz</code>; see the definition of the various
10720: <code class="varname">DECOMPRESS_CMD</code> variables in
10721: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10722: class="filename">bsd.pkg.extract.mk</code> for a complete
10723: list). Here's an example on how to use the other
10724: variables for a program that comes with a compressed
10725: shell archive whose name ends in <code xmlns=
10726: "http://www.w3.org/TR/xhtml1/transitional" class=
10727: "filename">.msg.gz</code>:</p>
10728: <pre class="programlisting">
1.51 rillig 10729: EXTRACT_SUFX= .msg.gz
10730: EXTRACT_CMD= zcat
10731: EXTRACT_BEFORE_ARGS=
10732: EXTRACT_AFTER_ARGS= |sh
1.1 grant 10733: </pre>
1.56 rillig 10734: </div>
10735:
1.59 rillig 10736: <div class="sect1" lang="en" xml:lang="en">
1.56 rillig 10737: <div class="titlepage">
10738: <div>
10739: <div>
10740: <h2 class="title" style="clear: both"><a name=
1.59 rillig 10741: "build.patch" id="build.patch"></a>14.8. The
10742: <span class="emphasis"><em>patch</em></span>
10743: phase</h2>
1.56 rillig 10744: </div>
10745: </div>
10746: </div>
10747:
10748: <p>After extraction, all the patches named by the
10749: <code class="varname">PATCHFILES</code>, those present in
10750: the patches subdirectory of the package as well as in
10751: $LOCALPATCHES/$PKGPATH (e.g. <code xmlns=
10752: "http://www.w3.org/TR/xhtml1/transitional" class=
10753: "filename">/usr/local/patches/graphics/png</code>) are
10754: applied. Patchfiles ending in <code xmlns=
10755: "http://www.w3.org/TR/xhtml1/transitional" class=
10756: "filename">.Z</code> or <code xmlns=
10757: "http://www.w3.org/TR/xhtml1/transitional" class=
10758: "filename">.gz</code> are uncompressed before they are
10759: applied, files ending in <code xmlns=
10760: "http://www.w3.org/TR/xhtml1/transitional" class=
10761: "filename">.orig</code> or <code xmlns=
10762: "http://www.w3.org/TR/xhtml1/transitional" class=
10763: "filename">.rej</code> are ignored. Any special options
10764: to <a href=
10765: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
10766: <span class="citerefentry"><span class=
10767: "refentrytitle">patch</span>(1)</span></a> can be handed
10768: in <code class="varname">PATCH_DIST_ARGS</code>. See
10769: <a href="#components.patches" title=
10770: "8.3. patches/*">Section 8.3,
10771: “patches/*”</a> for more details.</p>
10772:
10773: <p>By default <a href=
10774: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
10775: <span class="citerefentry"><span class=
10776: "refentrytitle">patch</span>(1)</span></a> is given
10777: special args to make it fail if the patches apply with
10778: some lines of fuzz. Please fix (regen) the patches so
10779: that they apply cleanly. The rationale behind this is
10780: that patches that don't apply cleanly may end up being
10781: applied in the wrong place, and cause severe harm
10782: there.</p>
10783: </div>
10784:
1.59 rillig 10785: <div class="sect1" lang="en" xml:lang="en">
1.56 rillig 10786: <div class="titlepage">
10787: <div>
10788: <div>
10789: <h2 class="title" style="clear: both"><a name=
1.59 rillig 10790: "build.tools" id="build.tools"></a>14.9. The
10791: <span class="emphasis"><em>tools</em></span>
10792: phase</h2>
1.56 rillig 10793: </div>
10794: </div>
10795: </div>
10796:
10797: <p>[TODO]</p>
10798: </div>
10799:
1.59 rillig 10800: <div class="sect1" lang="en" xml:lang="en">
1.56 rillig 10801: <div class="titlepage">
10802: <div>
10803: <div>
10804: <h2 class="title" style="clear: both"><a name=
1.59 rillig 10805: "build.wrapper" id=
1.56 rillig 10806: "build.wrapper"></a>14.10. The <span class=
10807: "emphasis"><em>wrapper</em></span> phase</h2>
10808: </div>
10809: </div>
10810: </div>
10811:
10812: <p>[TODO]</p>
10813: </div>
10814:
1.59 rillig 10815: <div class="sect1" lang="en" xml:lang="en">
1.56 rillig 10816: <div class="titlepage">
10817: <div>
10818: <div>
10819: <h2 class="title" style="clear: both"><a name=
1.59 rillig 10820: "build.configure" id=
1.56 rillig 10821: "build.configure"></a>14.11. The <span class=
10822: "emphasis"><em>configure</em></span> phase</h2>
10823: </div>
10824: </div>
10825: </div>
10826:
10827: <p>Most pieces of software need information on the header
10828: files, system calls, and library routines which are
10829: available on the platform they run on. The process of
10830: determining this information is known as configuration,
10831: and is usually automated. In most cases, a script is
10832: supplied with the distfiles, and its invocation results
10833: in generation of header files, Makefiles, etc.</p>
10834:
10835: <p>If the package contains a configure script, this can
10836: be invoked by setting <code class=
10837: "varname">HAS_CONFIGURE</code> to “<span class=
10838: "quote">yes</span>”. If the configure script is a
10839: GNU autoconf script, you should set <code class=
10840: "varname">GNU_CONFIGURE</code> to “<span class=
10841: "quote">yes</span>” instead. What happens in the
10842: <span class="emphasis"><em>configure</em></span> phase is
10843: roughly:</p>
10844: <pre class="programlisting">
10845: .for d in ${CONFIGURE_DIRS}
10846: cd ${WRKSRC} && cd ${d} && env ${CONFIGURE_ENV} \
10847: ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
10848: .endfor
10849: </pre>
1.1 grant 10850:
1.56 rillig 10851: <p><code class="varname">CONFIGURE_DIRS</code> (default:
10852: “<span class="quote">.</span>”) is a list of
10853: pathnames relative to <code class=
10854: "varname">WRKSRC</code>. In each of these directories,
10855: the configure script is run with the environment
10856: <code class="varname">CONFIGURE_ENV</code> and arguments
10857: <code class="varname">CONFIGURE_ARGS</code>. The
10858: variables <code class="varname">CONFIGURE_ENV</code>,
10859: <code class="varname">CONFIGURE_SCRIPT</code> (default:
10860: “<span class="quote">./configure</span>”) and
10861: <code class="varname">CONFIGURE_ARGS</code> may all be
10862: changed by the package.</p>
1.1 grant 10863:
1.56 rillig 10864: <p>If the program uses an <code xmlns=
10865: "http://www.w3.org/TR/xhtml1/transitional" class=
10866: "filename">Imakefile</code> for configuration, the
10867: appropriate steps can be invoked by setting <code class=
10868: "varname">USE_IMAKE</code> to “<span class=
10869: "quote">yes</span>”. (If you only want the package
10870: installed in <code class="varname">${X11PREFIX}</code>
10871: but xmkmf not being run, set <code class=
10872: "varname">USE_X11BASE</code> instead.)</p>
10873: </div>
1.1 grant 10874:
1.59 rillig 10875: <div class="sect1" lang="en" xml:lang="en">
1.56 rillig 10876: <div class="titlepage">
10877: <div>
10878: <div>
10879: <h2 class="title" style="clear: both"><a name=
1.59 rillig 10880: "build.build" id="build.build"></a>14.12. The
10881: <span class="emphasis"><em>build</em></span>
10882: phase</h2>
1.56 rillig 10883: </div>
10884: </div>
1.1 grant 10885: </div>
10886:
1.56 rillig 10887: <p>For building a package, a rough equivalent of the
10888: following code is executed.</p>
1.1 grant 10889: <pre class="programlisting">
1.56 rillig 10890: .for d in ${BUILD_DIRS}
10891: cd ${WRKSRC} && cd ${d} && env ${MAKE_ENV} \
10892: ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} \
10893: -f ${MAKEFILE} ${BUILD_TARGET}
10894: .endfor
1.1 grant 10895: </pre>
1.56 rillig 10896:
10897: <p><code class="varname">BUILD_DIRS</code> (default:
10898: “<span class="quote">.</span>”) is a list of
10899: pathnames relative to <code class=
10900: "varname">WRKSRC</code>. In each of these directories,
10901: <code class="varname">MAKE_PROGRAM</code> is run with the
10902: environment <code class="varname">MAKE_ENV</code> and
10903: arguments <code class="varname">BUILD_MAKE_FLAGS</code>.
10904: The variables <code class="varname">MAKE_ENV</code>,
10905: <code class="varname">BUILD_MAKE_FLAGS</code>,
10906: <code class="varname">MAKEFILE</code> and <code class=
10907: "varname">BUILD_TARGET</code> may all be changed by the
10908: package.</p>
10909:
10910: <p>The default value of <code class=
10911: "varname">MAKE_PROGRAM</code> is “<span class=
10912: "quote">gmake</span>” if <code class=
10913: "varname">USE_TOOLS</code> contains “<span class=
10914: "quote">gmake</span>”, “<span class=
10915: "quote">make</span>” otherwise. The default value
10916: of <code class="varname">MAKEFILE</code> is
10917: “<span class="quote">Makefile</span>”, and
10918: <code class="varname">BUILD_TARGET</code> defaults to
10919: “<span class="quote">all</span>”.</p>
10920: </div>
10921:
1.59 rillig 10922: <div class="sect1" lang="en" xml:lang="en">
1.56 rillig 10923: <div class="titlepage">
10924: <div>
10925: <div>
10926: <h2 class="title" style="clear: both"><a name=
1.59 rillig 10927: "build.test" id="build.test"></a>14.13. The
10928: <span class="emphasis"><em>test</em></span>
10929: phase</h2>
1.56 rillig 10930: </div>
10931: </div>
10932: </div>
10933:
10934: <p>[TODO]</p>
10935: </div>
10936:
1.59 rillig 10937: <div class="sect1" lang="en" xml:lang="en">
1.56 rillig 10938: <div class="titlepage">
10939: <div>
10940: <div>
10941: <h2 class="title" style="clear: both"><a name=
1.59 rillig 10942: "build.install" id=
1.56 rillig 10943: "build.install"></a>14.14. The <span class=
10944: "emphasis"><em>install</em></span> phase</h2>
10945: </div>
10946: </div>
10947: </div>
10948:
10949: <p>Once the build stage has completed, the final step is
10950: to install the software in public directories, so users
10951: can access the programs and files. As in the
10952: build-target, <code class="varname">$MAKE_PROGRAM</code>
10953: is invoked on <code class="varname">$MAKEFILE</code>
10954: here, but with the <code class=
10955: "varname">$INSTALL_TARGET</code> instead, the latter
10956: defaulting to “<span class=
10957: "quote">install</span>” (plus “<span class=
10958: "quote">install.man</span>”, if <code class=
10959: "varname">USE_IMAKE</code> is set).</p>
10960: </div>
10961:
1.59 rillig 10962: <div class="sect1" lang="en" xml:lang="en">
1.56 rillig 10963: <div class="titlepage">
10964: <div>
10965: <div>
10966: <h2 class="title" style="clear: both"><a name=
1.59 rillig 10967: "build.package" id=
1.56 rillig 10968: "build.package"></a>14.15. The <span class=
10969: "emphasis"><em>package</em></span> phase</h2>
10970: </div>
10971: </div>
10972: </div>
10973:
10974: <p>[TODO]</p>
1.1 grant 10975: </div>
10976:
1.59 rillig 10977: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 10978: <div class="titlepage">
10979: <div>
10980: <div>
10981: <h2 class="title" style="clear: both"><a name=
1.59 rillig 10982: "build.helpful-targets" id=
1.56 rillig 10983: "build.helpful-targets"></a>14.16. Other
1.1 grant 10984: helpful targets</h2>
10985: </div>
10986: </div>
10987: </div>
10988:
10989: <div class="variablelist">
10990: <dl>
10991: <dt><span class="term">pre/post-*</span></dt>
10992:
10993: <dd>
10994: <p>For any of the main targets described in the
10995: previous section, two auxiliary targets exist with
10996: “<span class="quote">pre-</span>” and
10997: “<span class="quote">post-</span>” used
10998: as a prefix for the main target's name. These
10999: targets are invoked before and after the main
11000: target is called, allowing extra configuration or
11001: installation steps be performed from a package's
11002: Makefile, for example, which a program's configure
11003: script or install target omitted.</p>
11004: </dd>
11005:
11006: <dt><span class="term">do-*</span></dt>
11007:
11008: <dd>
11009: <p>Should one of the main targets do the wrong
11010: thing, and should there be no variable to fix this,
11011: you can redefine it with the do-* target. (Note
11012: that redefining the target itself instead of the
11013: do-* target is a bad idea, as the pre-* and post-*
11014: targets won't be called anymore, etc.) You will not
11015: usually need to do this.</p>
11016: </dd>
11017:
11018: <dt><span class="term">reinstall</span></dt>
11019:
11020: <dd>
1.14 xtraeme 11021: <p>If you did a <span><strong class="command">make
11022: install</strong></span> and you noticed some file
11023: was not installed properly, you can repeat the
1.1 grant 11024: installation with this target, which will ignore
11025: the “<span class="quote">already
11026: installed</span>” flag.</p>
11027: </dd>
11028:
11029: <dt><span class="term">deinstall</span></dt>
11030:
11031: <dd>
1.24 wiz 11032: <p>This target does a <a href=
11033: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
11034: <span class="citerefentry"><span class=
11035: "refentrytitle">pkg_delete</span>(1)</span></a> in
11036: the current directory, effectively de-installing
11037: the package. The following variables can be used to
11038: tune the behaviour:</p>
1.1 grant 11039:
11040: <div class="variablelist">
11041: <dl>
1.14 xtraeme 11042: <dt><span class="term"><code class=
11043: "varname">PKG_VERBOSE</code></span></dt>
1.1 grant 11044:
11045: <dd>
11046: <p>Add a "-v" to the <a href=
11047: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
11048: <span class="citerefentry"><span class=
11049: "refentrytitle">pkg_delete</span>(1)</span></a>
11050: command.</p>
11051: </dd>
11052:
1.14 xtraeme 11053: <dt><span class="term"><code class=
11054: "varname">DEINSTALLDEPENDS</code></span></dt>
1.1 grant 11055:
11056: <dd>
11057: <p>Remove all packages that require (depend
11058: on) the given package. This can be used to
11059: remove any packages that may have been pulled
11060: in by a given package, e.g. if
1.14 xtraeme 11061: <span><strong class="command">make deinstall
11062: DEINSTALLDEPENDS=1</strong></span> is done in
1.45 wiz 11063: <code xmlns=
11064: "http://www.w3.org/TR/xhtml1/transitional"
11065: class="filename">pkgsrc/x11/kde</code>, this
11066: is likely to remove whole KDE. Works by
1.1 grant 11067: adding “<span class=
11068: "quote">-R</span>” to the <a href=
11069: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
11070: <span class="citerefentry"><span class=
11071: "refentrytitle">pkg_delete</span>(1)</span></a>
11072: command line.</p>
11073: </dd>
11074: </dl>
11075: </div>
11076: </dd>
11077:
11078: <dt><span class="term">update</span></dt>
11079:
11080: <dd>
11081: <p>This target causes the current package to be
11082: updated to the latest version. The package and all
11083: depending packages first get de-installed, then
11084: current versions of the corresponding packages get
11085: compiled and installed. This is similar to manually
11086: noting which packages are currently installed, then
1.14 xtraeme 11087: performing a series of <span><strong class=
11088: "command">make deinstall</strong></span> and
11089: <span><strong class="command">make
11090: install</strong></span> (or whatever <code class=
11091: "varname">UPDATE_TARGET</code> is set to) for these
11092: packages.</p>
1.1 grant 11093:
11094: <p>You can use the “<span class=
11095: "quote">update</span>” target to resume
1.14 xtraeme 11096: package updating in case a previous
11097: <span><strong class="command">make
11098: update</strong></span> was interrupted for some
11099: reason. However, in this case, make sure you don't
11100: call <span><strong class="command">make
11101: clean</strong></span> or otherwise remove the list
11102: of dependent packages in <code class=
1.47 reed 11103: "varname">WRKDIR</code>. Otherwise, you lose the
1.1 grant 11104: ability to automatically update the current package
11105: along with the dependent packages you have
11106: installed.</p>
11107:
1.14 xtraeme 11108: <p>Resuming an interrupted <span><strong class=
11109: "command">make update</strong></span> will only
11110: work as long as the package tree remains unchanged.
11111: If the source code for one of the packages to be
11112: updated has been changed, resuming
11113: <span><strong class="command">make
11114: update</strong></span> will most certainly
11115: fail!</p>
1.1 grant 11116:
11117: <p>The following variables can be used either on
1.45 wiz 11118: the command line or in <code xmlns=
11119: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11120: "filename">/etc/mk.conf</code> to alter the
11121: behaviour of <span><strong class="command">make
11122: update</strong></span>:</p>
1.1 grant 11123:
11124: <div class="variablelist">
11125: <dl>
1.14 xtraeme 11126: <dt><span class="term"><code class=
11127: "varname">UPDATE_TARGET</code></span></dt>
1.1 grant 11128:
11129: <dd>
11130: <p>Install target to recursively use for the
11131: updated package and the dependent packages.
1.14 xtraeme 11132: Defaults to <code class=
11133: "varname">DEPENDS_TARGET</code> if set,
1.1 grant 11134: “<span class=
11135: "quote">install</span>” otherwise for
1.14 xtraeme 11136: <span><strong class="command">make
11137: update</strong></span>. e.g.
11138: <span><strong class="command">make update
11139: UPDATE_TARGET=package</strong></span></p>
1.1 grant 11140: </dd>
11141:
1.14 xtraeme 11142: <dt><span class="term"><code class=
11143: "varname">NOCLEAN</code></span></dt>
1.1 grant 11144:
11145: <dd>
11146: <p>Don't clean up after updating. Useful if
11147: you want to leave the work sources of the
11148: updated packages around for inspection or
11149: other purposes. Be sure you eventually clean
11150: up the source tree (see the
11151: “<span class=
11152: "quote">clean-update</span>” target
11153: below) or you may run into troubles with old
11154: source code still lying around on your next
1.14 xtraeme 11155: <span><strong class=
11156: "command">make</strong></span> or
11157: <span><strong class="command">make
11158: update</strong></span>.</p>
1.1 grant 11159: </dd>
11160:
1.14 xtraeme 11161: <dt><span class="term"><code class=
11162: "varname">REINSTALL</code></span></dt>
1.1 grant 11163:
11164: <dd>
11165: <p>Deinstall each package before installing
1.14 xtraeme 11166: (making <code class=
11167: "varname">DEPENDS_TARGET</code>). This may be
1.1 grant 11168: necessary if the “<span class=
11169: "quote">clean-update</span>” target
11170: (see below) was called after interrupting a
1.14 xtraeme 11171: running <span><strong class="command">make
11172: update</strong></span>.</p>
1.1 grant 11173: </dd>
11174:
1.14 xtraeme 11175: <dt><span class="term"><code class=
11176: "varname">DEPENDS_TARGET</code></span></dt>
1.1 grant 11177:
11178: <dd>
11179: <p>Allows you to disable recursion and
11180: hardcode the target for packages. The default
11181: is “<span class=
11182: "quote">update</span>” for the update
11183: target, facilitating a recursive update of
1.14 xtraeme 11184: prerequisite packages. Only set <code class=
11185: "varname">DEPENDS_TARGET</code> if you want
11186: to disable recursive updates. Use
11187: <code class="varname">UPDATE_TARGET</code>
11188: instead to just set a specific target for
11189: each package to be installed during
11190: <span><strong class="command">make
11191: update</strong></span> (see above).</p>
1.1 grant 11192: </dd>
11193: </dl>
11194: </div>
11195: </dd>
11196:
11197: <dt><span class="term">clean-update</span></dt>
11198:
11199: <dd>
11200: <p>Clean the source tree for all packages that
1.14 xtraeme 11201: would get updated if <span><strong class=
11202: "command">make update</strong></span> was called
11203: from the current directory. This target should not
11204: be used if the current package (or any of its
11205: depending packages) have already been de-installed
11206: (e.g., after calling <span><strong class=
11207: "command">make update</strong></span>) or you may
11208: lose some packages you intended to update. As a
11209: rule of thumb: only use this target <span class=
11210: "emphasis"><em>before</em></span> the first time
11211: you run <span><strong class="command">make
11212: update</strong></span> and only if you have a dirty
11213: package tree (e.g., if you used <code class=
11214: "varname">NOCLEAN</code>).</p>
1.1 grant 11215:
1.47 reed 11216: <p>If you are unsure about whether your tree is
11217: clean, you can either perform a
1.14 xtraeme 11218: <span><strong class="command">make
1.47 reed 11219: clean</strong></span> at the top of the tree, or
11220: use the following sequence of commands from the
11221: directory of the package you want to update
11222: (<span class="emphasis"><em>before</em></span>
11223: running <span><strong class="command">make
1.14 xtraeme 11224: update</strong></span> for the first time,
11225: otherwise you lose all the packages you wanted to
11226: update!):</p>
1.1 grant 11227: <pre class="screen">
1.14 xtraeme 11228: <code class="prompt">#</code> <strong class=
11229: "userinput"><code>make clean-update</code></strong>
11230: <code class="prompt">#</code> <strong class=
11231: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
11232: <code class="prompt">#</code> <strong class=
11233: "userinput"><code>make update</code></strong>
1.1 grant 11234: </pre>
11235:
11236: <p>The following variables can be used either on
1.45 wiz 11237: the command line or in <code xmlns=
11238: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11239: "filename">/etc/mk.conf</code> to alter the
11240: behaviour of <span><strong class="command">make
11241: clean-update</strong></span>:</p>
1.1 grant 11242:
11243: <div class="variablelist">
11244: <dl>
1.14 xtraeme 11245: <dt><span class="term"><code class=
11246: "varname">CLEAR_DIRLIST</code></span></dt>
1.1 grant 11247:
11248: <dd>
1.14 xtraeme 11249: <p>After <span><strong class="command">make
11250: clean</strong></span>, do not reconstruct the
11251: list of directories to update for this
11252: package. Only use this if
11253: <span><strong class="command">make
11254: update</strong></span> successfully installed
11255: all packages you wanted to update. Normally,
11256: this is done automatically on
11257: <span><strong class="command">make
11258: update</strong></span>, but may have been
11259: suppressed by the <code class=
11260: "varname">NOCLEAN</code> variable (see
1.1 grant 11261: above).</p>
11262: </dd>
11263: </dl>
11264: </div>
11265: </dd>
11266:
11267: <dt><span class="term">info</span></dt>
11268:
11269: <dd>
11270: <p>This target invokes <a href=
11271: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
11272: <span class="citerefentry"><span class=
11273: "refentrytitle">pkg_info</span>(1)</span></a> for
11274: the current package. You can use this to check
11275: which version of a package is installed.</p>
11276: </dd>
11277:
11278: <dt><span class="term">readme</span></dt>
11279:
11280: <dd>
1.45 wiz 11281: <p>This target generates a <code xmlns=
11282: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11283: "filename">README.html</code> file, which can be
1.1 grant 11284: viewed using a browser such as <a xmlns=
11285: "http://www.w3.org/TR/xhtml1/transitional" href=
11286: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 wiz 11287: target="_top"><code xmlns="" class=
11288: "filename">www/mozilla</code></a> or <a xmlns=
1.20 ben 11289: "http://www.w3.org/TR/xhtml1/transitional" href=
11290: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
1.45 wiz 11291: target="_top"><code xmlns="" class=
11292: "filename">www/links</code></a>. The generated
11293: files contain references to any packages which are
11294: in the <code class="varname">PACKAGES</code>
11295: directory on the local host. The generated files
11296: can be made to refer to URLs based on <code class=
1.20 ben 11297: "varname">FTP_PKG_URL_HOST</code> and <code class=
11298: "varname">FTP_PKG_URL_DIR</code>. For example, if I
1.45 wiz 11299: wanted to generate <code xmlns=
11300: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 11301: "filename">README.html</code> files which pointed
11302: to binary packages on the local machine, in the
1.45 wiz 11303: directory <code xmlns=
11304: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 11305: "filename">/usr/packages</code>, set <code class=
11306: "varname">FTP_PKG_URL_HOST=file://localhost</code>
11307: and <code class=
11308: "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
11309: <code class="varname">${PACKAGES}</code> directory
11310: and its subdirectories will be searched for all the
11311: binary packages.</p>
1.1 grant 11312: </dd>
11313:
11314: <dt><span class="term">readme-all</span></dt>
11315:
11316: <dd>
1.45 wiz 11317: <p>Use this target to create a file <code xmlns=
11318: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11319: "filename">README-all.html</code> which contains a
1.1 grant 11320: list of all packages currently available in the
11321: NetBSD Packages Collection, together with the
11322: category they belong to and a short description.
1.45 wiz 11323: This file is compiled from the <code xmlns=
11324: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11325: "filename">pkgsrc/*/README.html</code> files, so be
1.1 grant 11326: sure to run this <span class=
1.14 xtraeme 11327: "emphasis"><em>after</em></span> a
11328: <span><strong class="command">make
11329: readme</strong></span>.</p>
1.1 grant 11330: </dd>
11331:
11332: <dt><span class="term">cdrom-readme</span></dt>
11333:
11334: <dd>
11335: <p>This is very much the same as the
11336: “<span class="quote">readme</span>”
11337: target (see above), but is to be used when
11338: generating a pkgsrc tree to be written to a CD-ROM.
1.45 wiz 11339: This target also produces <code xmlns=
11340: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11341: "filename">README.html</code> files, and can be
11342: made to refer to URLs based on <code class=
11343: "varname">CDROM_PKG_URL_HOST</code> and
11344: <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1 grant 11345: </dd>
11346:
11347: <dt><span class="term">show-distfiles</span></dt>
11348:
11349: <dd>
11350: <p>This target shows which distfiles and patchfiles
1.14 xtraeme 11351: are needed to build the package. (<code class=
11352: "varname">DISTFILES</code> and <code class=
1.45 wiz 11353: "varname">PATCHFILES</code>, but not <code xmlns=
11354: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11355: "filename">patches/*</code>)</p>
1.1 grant 11356: </dd>
11357:
11358: <dt><span class="term">show-downlevel</span></dt>
11359:
11360: <dd>
11361: <p>This target shows nothing if the package is not
11362: installed. If a version of this package is
11363: installed, but is not the version provided in this
11364: version of pkgsrc, then a warning message is
11365: displayed. This target can be used to show which of
11366: your installed packages are downlevel, and so the
11367: old versions can be deleted, and the current ones
11368: added.</p>
11369: </dd>
11370:
11371: <dt><span class="term">show-pkgsrc-dir</span></dt>
11372:
11373: <dd>
11374: <p>This target shows the directory in the pkgsrc
11375: hierarchy from which the package can be built and
11376: installed. This may not be the same directory as
11377: the one from which the package was installed. This
11378: target is intended to be used by people who may
11379: wish to upgrade many packages on a single host, and
11380: can be invoked from the top-level pkgsrc Makefile
11381: by using the “<span class=
11382: "quote">show-host-specific-pkgs</span>”
11383: target.</p>
11384: </dd>
11385:
11386: <dt><span class=
11387: "term">show-installed-depends</span></dt>
11388:
11389: <dd>
11390: <p>This target shows which installed packages match
1.14 xtraeme 11391: the current package's <code class=
11392: "varname">DEPENDS</code>. Useful if out of date
1.1 grant 11393: dependencies are causing build problems.</p>
11394: </dd>
11395:
11396: <dt><span class="term">check-shlibs</span></dt>
11397:
11398: <dd>
11399: <p>After a package is installed, check all its
11400: binaries and (on ELF platforms) shared libraries to
11401: see if they find the shared libs they need. Run by
1.14 xtraeme 11402: default if <code class=
11403: "varname">PKG_DEVELOPER</code> is set in
1.45 wiz 11404: <code xmlns=
11405: "http://www.w3.org/TR/xhtml1/transitional" class=
11406: "filename">/etc/mk.conf</code>.</p>
1.1 grant 11407: </dd>
11408:
11409: <dt><span class="term">print-PLIST</span></dt>
11410:
11411: <dd>
11412: <p>After a “<span class="quote">make
11413: install</span>” from a new or upgraded pkg,
11414: this prints out an attempt to generate a new
1.45 wiz 11415: <code xmlns=
11416: "http://www.w3.org/TR/xhtml1/transitional" class=
11417: "filename">PLIST</code> from a <span><strong class=
11418: "command">find -newer
1.14 xtraeme 11419: work/.extract_done</strong></span>. An attempt is
11420: made to care for shared libs etc., but it is
1.1 grant 11421: <span class="emphasis"><em>strongly</em></span>
11422: recommended to review the result before putting it
1.45 wiz 11423: into <code xmlns=
11424: "http://www.w3.org/TR/xhtml1/transitional" class=
11425: "filename">PLIST</code>. On upgrades, it's useful
11426: to diff the output of this command against an
11427: already existing <code xmlns=
11428: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11429: "filename">PLIST</code> file.</p>
1.1 grant 11430:
1.24 wiz 11431: <p>If the package installs files via <a href=
11432: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
11433: <span class="citerefentry"><span class=
11434: "refentrytitle">tar</span>(1)</span></a> or other
11435: methods that don't update file access times, be
11436: sure to add these files manually to your
1.45 wiz 11437: <code xmlns=
11438: "http://www.w3.org/TR/xhtml1/transitional" class=
11439: "filename">PLIST</code>, as the “<span class=
11440: "quote">find -newer</span>” command used by
11441: this target won't catch them!</p>
1.1 grant 11442:
11443: <p>See <a href="#print-PLIST" title=
1.38 dillo 11444: "10.3. Tweaking output of make print-PLIST">Section 10.3,
1.14 xtraeme 11445: “Tweaking output of <span><strong class=
11446: "command">make
11447: print-PLIST</strong></span>”</a> for more
11448: information on this target.</p>
1.1 grant 11449: </dd>
11450:
11451: <dt><span class="term">bulk-package</span></dt>
11452:
11453: <dd>
11454: <p>Used to do bulk builds. If an appropriate binary
11455: package already exists, no action is taken. If not,
11456: this target will compile, install and package it
1.47 reed 11457: (and its depends, if <code class=
1.14 xtraeme 11458: "varname">PKG_DEPENDS</code> is set properly. See
1.1 grant 11459: <a href="#binary.configuration" title=
1.38 dillo 11460: "6.3.1. Configuration">Section 6.3.1,
1.47 reed 11461: “Configuration”</a>). After creating
11462: the binary package, the sources, the just-installed
11463: package and its required packages are removed,
1.1 grant 11464: preserving free disk space.</p>
11465:
11466: <p><span class="emphasis"><em>Beware that this
11467: target may deinstall all packages installed on a
11468: system!</em></span></p>
11469: </dd>
11470:
11471: <dt><span class="term">bulk-install</span></dt>
11472:
11473: <dd>
11474: <p>Used during bulk-installs to install required
1.47 reed 11475: packages. If an up-to-date binary package is
1.1 grant 11476: available, it will be installed via <a href=
11477: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
11478: <span class="citerefentry"><span class=
11479: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14 xtraeme 11480: not, <span><strong class="command">make
11481: bulk-package</strong></span> will be executed, but
1.47 reed 11482: the installed binary won't be removed.</p>
1.1 grant 11483:
11484: <p>A binary package is considered
1.47 reed 11485: “<span class="quote">up-to-date</span>”
1.1 grant 11486: to be installed via <a href=
11487: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
11488: <span class="citerefentry"><span class=
11489: "refentrytitle">pkg_add</span>(1)</span></a>
11490: if:</p>
11491:
11492: <div class="itemizedlist">
11493: <ul type="disc">
11494: <li>
1.45 wiz 11495: <p>None of the package's files (<code xmlns=
11496: "http://www.w3.org/TR/xhtml1/transitional"
11497: class="filename">Makefile</code>, ...) were
1.14 xtraeme 11498: modified since it was built.</p>
1.1 grant 11499: </li>
11500:
11501: <li>
11502: <p>None of the package's required (binary)
11503: packages were modified since it was
11504: built.</p>
11505: </li>
11506: </ul>
11507: </div>
11508:
11509: <p><span class="emphasis"><em>Beware that this
11510: target may deinstall all packages installed on a
11511: system!</em></span></p>
11512: </dd>
11513: </dl>
11514: </div>
11515: </div>
11516: </div>
11517:
1.59 rillig 11518: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 11519: <div class="titlepage">
11520: <div>
11521: <div>
1.59 rillig 11522: <h2 class="title"><a name="fixes" id=
1.55 rillig 11523: "fixes"></a>Chapter 15. Making your package
11524: work</h2>
1.1 grant 11525: </div>
11526: </div>
11527: </div>
11528:
11529: <div class="toc">
11530: <p><b>Table of Contents</b></p>
11531:
11532: <dl>
1.30 wiz 11533: <dt><span class="sect1"><a href=
1.38 dillo 11534: "#general-operation">15.1. General
1.30 wiz 11535: operation</a></span></dt>
1.1 grant 11536:
11537: <dd>
11538: <dl>
11539: <dt><span class="sect2"><a href=
1.38 dillo 11540: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 11541: pull in variables from /etc/mk.conf</a></span></dt>
1.1 grant 11542:
11543: <dt><span class="sect2"><a href=
1.38 dillo 11544: "#where-to-install-documentation">15.1.2. Where to
1.31 wiz 11545: install documentation</a></span></dt>
11546:
11547: <dt><span class="sect2"><a href=
1.38 dillo 11548: "#restricted-packages">15.1.3. Restricted
1.1 grant 11549: packages</a></span></dt>
11550:
11551: <dt><span class="sect2"><a href=
1.38 dillo 11552: "#dependencies">15.1.4. Handling
1.1 grant 11553: dependencies</a></span></dt>
11554:
11555: <dt><span class="sect2"><a href=
1.38 dillo 11556: "#conflicts">15.1.5. Handling conflicts with other
1.1 grant 11557: packages</a></span></dt>
11558:
11559: <dt><span class="sect2"><a href=
1.38 dillo 11560: "#not-building-packages">15.1.6. Packages that
1.30 wiz 11561: cannot or should not be built</a></span></dt>
1.1 grant 11562:
11563: <dt><span class="sect2"><a href=
1.38 dillo 11564: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 11565: should not be deleted, once
11566: installed</a></span></dt>
1.1 grant 11567:
11568: <dt><span class="sect2"><a href=
1.38 dillo 11569: "#security-handling">15.1.8. Handling packages with
1.1 grant 11570: security problems</a></span></dt>
11571:
11572: <dt><span class="sect2"><a href=
1.38 dillo 11573: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 11574: bugs</a></span></dt>
11575:
11576: <dt><span class="sect2"><a href=
1.38 dillo 11577: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 11578: incrementing versions when fixing an existing
1.1 grant 11579: package</a></span></dt>
11580:
11581: <dt><span class="sect2"><a href=
1.38 dillo 11582: "#portability-of-packages">15.1.11. Portability of
1.1 grant 11583: packages</a></span></dt>
11584: </dl>
11585: </dd>
11586:
1.30 wiz 11587: <dt><span class="sect1"><a href=
1.38 dillo 11588: "#downloading-issues">15.2. Possible downloading
1.30 wiz 11589: issues</a></span></dt>
1.1 grant 11590:
11591: <dd>
11592: <dl>
11593: <dt><span class="sect2"><a href=
1.38 dillo 11594: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 11595: distfiles aren't available for plain
1.1 grant 11596: downloading</a></span></dt>
11597:
11598: <dt><span class="sect2"><a href=
1.38 dillo 11599: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 11600: handle modified distfiles with the 'old'
11601: name</a></span></dt>
1.1 grant 11602: </dl>
11603: </dd>
11604:
1.30 wiz 11605: <dt><span class="sect1"><a href=
1.38 dillo 11606: "#configuration-gotchas">15.3. Configuration
1.30 wiz 11607: gotchas</a></span></dt>
1.1 grant 11608:
11609: <dd>
11610: <dl>
11611: <dt><span class="sect2"><a href=
1.38 dillo 11612: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 11613: libtool</a></span></dt>
11614:
11615: <dt><span class="sect2"><a href=
1.38 dillo 11616: "#using-libtool">15.3.2. Using libtool on GNU
1.30 wiz 11617: packages that already support
11618: libtool</a></span></dt>
1.1 grant 11619:
11620: <dt><span class="sect2"><a href=
1.38 dillo 11621: "#autoconf-automake">15.3.3. GNU
1.1 grant 11622: Autoconf/Automake</a></span></dt>
11623: </dl>
11624: </dd>
11625:
1.55 rillig 11626: <dt><span class="sect1"><a href="#fixes-build">15.4.
11627: Building the package</a></span></dt>
1.1 grant 11628:
11629: <dd>
11630: <dl>
11631: <dt><span class="sect2"><a href=
1.38 dillo 11632: "#cpp-defines">15.4.1. CPP defines</a></span></dt>
1.51 rillig 11633:
1.60 ! rillig 11634: <dt><span class="sect2"><a href=
! 11635: "#cpp-list-examples">15.4.2. Examples of CPP
! 11636: defines for some platforms</a></span></dt>
! 11637:
! 11638: <dt><span class="sect2"><a href="#cpp-list">15.4.3.
1.51 rillig 11639: Getting a list of CPP defines</a></span></dt>
1.1 grant 11640: </dl>
11641: </dd>
11642:
1.30 wiz 11643: <dt><span class="sect1"><a href=
1.38 dillo 11644: "#package-specific-actions">15.5. Package specific
1.30 wiz 11645: actions</a></span></dt>
1.1 grant 11646:
11647: <dd>
11648: <dl>
11649: <dt><span class="sect2"><a href=
1.38 dillo 11650: "#user-interaction">15.5.1. User
1.2 hubertf 11651: interaction</a></span></dt>
1.1 grant 11652:
11653: <dt><span class="sect2"><a href=
1.38 dillo 11654: "#handling-licenses">15.5.2. Handling
1.1 grant 11655: licenses</a></span></dt>
11656:
11657: <dt><span class="sect2"><a href=
1.38 dillo 11658: "#installing-score-files">15.5.3. Installing score
1.1 grant 11659: files</a></span></dt>
11660:
11661: <dt><span class="sect2"><a href=
1.38 dillo 11662: "#perl-scripts">15.5.4. Packages containing perl
1.1 grant 11663: scripts</a></span></dt>
11664:
11665: <dt><span class="sect2"><a href=
1.38 dillo 11666: "#hardcoded-paths">15.5.5. Packages with hardcoded
1.30 wiz 11667: paths to other interpreters</a></span></dt>
1.1 grant 11668:
11669: <dt><span class="sect2"><a href=
1.38 dillo 11670: "#perl-modules">15.5.6. Packages installing perl
1.1 grant 11671: modules</a></span></dt>
11672:
11673: <dt><span class="sect2"><a href=
1.38 dillo 11674: "#faq.info-files">15.5.7. Packages installing info
1.1 grant 11675: files</a></span></dt>
11676:
1.57 minskim 11677: <dt><span class="sect2"><a href="#manpages">15.5.8.
11678: Packages installing man pages</a></span></dt>
11679:
1.1 grant 11680: <dt><span class="sect2"><a href=
1.57 minskim 11681: "#gconf2-data-files">15.5.9. Packages installing
1.30 wiz 11682: GConf2 data files</a></span></dt>
1.1 grant 11683:
11684: <dt><span class="sect2"><a href=
1.57 minskim 11685: "#scrollkeeper-data-files">15.5.10. Packages
1.30 wiz 11686: installing scrollkeeper data files</a></span></dt>
1.1 grant 11687:
11688: <dt><span class="sect2"><a href=
1.57 minskim 11689: "#x11-fonts">15.5.11. Packages installing X11
1.1 grant 11690: fonts</a></span></dt>
11691:
11692: <dt><span class="sect2"><a href=
1.57 minskim 11693: "#gtk2-modules">15.5.12. Packages installing GTK2
1.1 grant 11694: modules</a></span></dt>
11695:
11696: <dt><span class="sect2"><a href=
1.57 minskim 11697: "#sgml-xml-data">15.5.13. Packages installing SGML
1.30 wiz 11698: or XML data</a></span></dt>
1.1 grant 11699:
11700: <dt><span class="sect2"><a href=
1.57 minskim 11701: "#mime-database">15.5.14. Packages installing
1.1 grant 11702: extensions to the MIME database</a></span></dt>
11703:
11704: <dt><span class="sect2"><a href=
1.57 minskim 11705: "#intltool">15.5.15. Packages using
1.1 grant 11706: intltool</a></span></dt>
1.18 xtraeme 11707:
11708: <dt><span class="sect2"><a href=
1.57 minskim 11709: "#startup-scripts">15.5.16. Packages installing
1.30 wiz 11710: startup scripts</a></span></dt>
1.57 minskim 11711:
11712: <dt><span class="sect2"><a href=
11713: "#tex-packages">15.5.17. Packages installing TeX
11714: modules</a></span></dt>
1.1 grant 11715: </dl>
11716: </dd>
11717:
1.30 wiz 11718: <dt><span class="sect1"><a href=
1.38 dillo 11719: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 11720: author</a></span></dt>
1.1 grant 11721: </dl>
11722: </div>
11723:
1.59 rillig 11724: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 11725: <div class="titlepage">
11726: <div>
11727: <div>
11728: <h2 class="title" style="clear: both"><a name=
1.59 rillig 11729: "general-operation" id=
1.38 dillo 11730: "general-operation"></a>15.1. General
1.1 grant 11731: operation</h2>
11732: </div>
11733: </div>
11734: </div>
11735:
1.59 rillig 11736: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 11737: <div class="titlepage">
11738: <div>
11739: <div>
1.30 wiz 11740: <h3 class="title"><a name=
1.59 rillig 11741: "pulling-vars-from-etc-mk.conf" id=
1.38 dillo 11742: "pulling-vars-from-etc-mk.conf"></a>15.1.1. How
1.30 wiz 11743: to pull in variables from /etc/mk.conf</h3>
1.1 grant 11744: </div>
11745: </div>
11746: </div>
11747:
11748: <p>The problem with package-defined variables that can
1.14 xtraeme 11749: be overridden via <code class="varname">MAKECONF</code>
1.45 wiz 11750: or <code xmlns=
11751: "http://www.w3.org/TR/xhtml1/transitional" class=
11752: "filename">/etc/mk.conf</code> is that <a href=
1.1 grant 11753: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
11754: <span class="citerefentry"><span class=
11755: "refentrytitle">make</span>(1)</span></a> expands a
1.47 reed 11756: variable as it is used, but evaluates preprocessor-like
1.1 grant 11757: statements (.if, .ifdef and .ifndef) as they are read.
1.14 xtraeme 11758: So, to use any variable (which may be set in
1.45 wiz 11759: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
11760: class="filename">/etc/mk.conf</code>) in one of the
11761: .if* statements, the file <code xmlns=
11762: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11763: "filename">/etc/mk.conf</code> must be included before
1.1 grant 11764: that .if* statement.</p>
11765:
1.47 reed 11766: <p>Rather than having a number of ad-hoc ways of
1.45 wiz 11767: including <code xmlns=
11768: "http://www.w3.org/TR/xhtml1/transitional" class=
11769: "filename">/etc/mk.conf</code>, should it exist, or
11770: <code class="varname">MAKECONF</code>, should it exist,
11771: include the <code xmlns=
11772: "http://www.w3.org/TR/xhtml1/transitional" class=
11773: "filename">pkgsrc/mk/bsd.prefs.mk</code> file in the
11774: package Makefile before any preprocessor-like .if,
11775: .ifdef, or .ifndef statements:</p>
1.1 grant 11776: <pre class="programlisting">
1.51 rillig 11777: .include "../../mk/bsd.prefs.mk"
11778:
1.1 grant 11779: .if defined(USE_MENUS)
1.51 rillig 11780: # ...
1.1 grant 11781: .endif
11782: </pre>
11783:
1.14 xtraeme 11784: <p>If you wish to set the <code class=
1.45 wiz 11785: "varname">CFLAGS</code> variable in <code xmlns=
11786: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 11787: "filename">/etc/mk.conf</code>, please make sure to
1.1 grant 11788: use:</p>
11789: <pre class="programlisting">
1.51 rillig 11790: CFLAGS+= -your -flags
1.1 grant 11791: </pre>
11792:
1.14 xtraeme 11793: <p>Using <code class="varname">CFLAGS=</code> (i.e.
11794: without the “<span class="quote">+</span>”)
11795: may lead to problems with packages that need to add
11796: their own flags. Also, you may want to take a look at
11797: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 11798: href=
11799: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 wiz 11800: target="_top"><code xmlns="" class=
11801: "filename">devel/cpuflags</code></a> package if you're
1.20 ben 11802: interested in optimization for the current CPU.</p>
1.1 grant 11803: </div>
11804:
1.59 rillig 11805: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 11806: <div class="titlepage">
11807: <div>
11808: <div>
1.31 wiz 11809: <h3 class="title"><a name=
1.59 rillig 11810: "where-to-install-documentation" id=
1.38 dillo 11811: "where-to-install-documentation"></a>15.1.2. Where
1.31 wiz 11812: to install documentation</h3>
11813: </div>
11814: </div>
11815: </div>
11816:
1.45 wiz 11817: <p>Documentation should be installed into <code xmlns=
11818: "http://www.w3.org/TR/xhtml1/transitional" class=
1.31 wiz 11819: "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
1.45 wiz 11820: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
11821: class="filename">${PREFIX}/share/doc/${PKGNAME}</code>
11822: (the latter includes the version number of the
11823: package).</p>
1.31 wiz 11824: </div>
11825:
1.59 rillig 11826: <div class="sect2" lang="en" xml:lang="en">
1.31 wiz 11827: <div class="titlepage">
11828: <div>
11829: <div>
1.59 rillig 11830: <h3 class="title"><a name="restricted-packages"
11831: id=
1.38 dillo 11832: "restricted-packages"></a>15.1.3. Restricted
1.1 grant 11833: packages</h3>
11834: </div>
11835: </div>
11836: </div>
11837:
11838: <p>Some licenses restrict how software may be
11839: re-distributed. In order to satisfy these restrictions,
11840: the package system defines five make variables that can
11841: be set to note these restrictions:</p>
11842:
11843: <div class="itemizedlist">
11844: <ul type="disc">
11845: <li>
1.14 xtraeme 11846: <p><code class="varname">RESTRICTED</code></p>
1.1 grant 11847:
11848: <p>This variable should be set whenever a
11849: restriction exists (regardless of its kind). Set
11850: this variable to a string containing the reason
11851: for the restriction.</p>
11852: </li>
11853:
11854: <li>
1.14 xtraeme 11855: <p><code class=
11856: "varname">NO_BIN_ON_CDROM</code></p>
1.1 grant 11857:
11858: <p>Binaries may not be placed on CD-ROM. Set this
1.14 xtraeme 11859: variable to <code class=
11860: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 11861: package may not be included on a CD-ROM.</p>
11862: </li>
11863:
11864: <li>
1.14 xtraeme 11865: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1 grant 11866:
11867: <p>Binaries may not be placed on an FTP server.
1.14 xtraeme 11868: Set this variable to <code class=
11869: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 11870: package may not not be made available on the
11871: Internet.</p>
11872: </li>
11873:
11874: <li>
1.14 xtraeme 11875: <p><code class=
11876: "varname">NO_SRC_ON_CDROM</code></p>
1.1 grant 11877:
11878: <p>Distfiles may not be placed on CD-ROM. Set
1.14 xtraeme 11879: this variable to <code class=
11880: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 11881: of the source code or other distfile(s) is not
11882: allowed on CD-ROMs.</p>
11883: </li>
11884:
11885: <li>
1.14 xtraeme 11886: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1 grant 11887:
11888: <p>Distfiles may not be placed on FTP. Set this
1.14 xtraeme 11889: variable to <code class=
11890: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 11891: of the source code or other distfile(s) via the
11892: Internet is not allowed.</p>
11893: </li>
11894: </ul>
11895: </div>
11896:
1.14 xtraeme 11897: <p>Please note that the use of <code class=
11898: "varname">NO_PACKAGE</code>, <code class=
11899: "varname">IGNORE</code>, <code class=
11900: "varname">NO_CDROM</code>, or other generic make
1.1 grant 11901: variables to denote restrictions is deprecated, because
11902: they unconditionally prevent users from generating
11903: binary packages!</p>
11904: </div>
11905:
1.59 rillig 11906: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 11907: <div class="titlepage">
11908: <div>
11909: <div>
1.59 rillig 11910: <h3 class="title"><a name="dependencies" id=
1.38 dillo 11911: "dependencies"></a>15.1.4. Handling
1.1 grant 11912: dependencies</h3>
11913: </div>
11914: </div>
11915: </div>
11916:
11917: <p>Your package may depend on some other package being
11918: present - and there are various ways of expressing this
1.14 xtraeme 11919: dependency. pkgsrc supports the <code class=
11920: "varname">BUILD_DEPENDS</code> and <code class=
1.47 reed 11921: "varname">DEPENDS</code> definitions, the <code class=
11922: "varname">USE_TOOLS</code> definition, as well as
1.45 wiz 11923: dependencies via <code xmlns=
11924: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11925: "filename">buildlink3.mk</code>, which is the preferred
1.1 grant 11926: way to handle dependencies, and which uses the
11927: variables named above. See <a href="#buildlink" title=
1.38 dillo 11928: "Chapter 11. Buildlink methodology">Chapter 11,
1.1 grant 11929: <i>Buildlink methodology</i></a> for more
11930: information.</p>
11931:
11932: <p>The basic difference between the two variables is as
1.14 xtraeme 11933: follows: The <code class="varname">DEPENDS</code>
1.1 grant 11934: definition registers that pre-requisite in the binary
11935: package so it will be pulled in when the binary package
1.14 xtraeme 11936: is later installed, whilst the <code class=
11937: "varname">BUILD_DEPENDS</code> definition does not,
1.1 grant 11938: marking a dependency that is only needed for building
11939: the package.</p>
11940:
11941: <p>This means that if you only need a package present
11942: whilst you are building, it should be noted as a
1.14 xtraeme 11943: <code class="varname">BUILD_DEPENDS</code>.</p>
1.1 grant 11944:
1.14 xtraeme 11945: <p>The format for a <code class=
11946: "varname">BUILD_DEPENDS</code> and a <code class=
11947: "varname">DEPENDS</code> definition is:</p>
1.1 grant 11948: <pre class="programlisting">
1.51 rillig 11949: <pre-req-package-name>:../../<category>/<pre-req-package>
1.1 grant 11950: </pre>
11951:
11952: <p>Please note that the “<span class=
11953: "quote">pre-req-package-name</span>” may include
1.18 xtraeme 11954: any of the wildcard version numbers recognized by
1.1 grant 11955: <a href=
11956: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
11957: <span class="citerefentry"><span class=
11958: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
11959:
11960: <div class="orderedlist">
11961: <ol type="1">
11962: <li>
11963: <p>If your package needs another package's
11964: binaries or libraries to build or run, and if
1.45 wiz 11965: that package has a <code xmlns=
11966: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11967: "filename">buildlink3.mk</code> file available,
11968: use it:</p>
1.1 grant 11969: <pre class="programlisting">
11970: .include "../../graphics/jpeg/buildlink3.mk"
11971: </pre>
11972: </li>
11973:
11974: <li>
11975: <p>If your package needs to use another package
1.45 wiz 11976: to build itself and there is no <code xmlns=
11977: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11978: "filename">buildlink3.mk</code> file available,
11979: use the <code class=
11980: "varname">BUILD_DEPENDS</code> definition:</p>
1.1 grant 11981: <pre class="programlisting">
1.51 rillig 11982: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
1.1 grant 11983: </pre>
11984: </li>
11985:
11986: <li>
11987: <p>If your package needs a library with which to
1.45 wiz 11988: link and again there is no <code xmlns=
11989: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11990: "filename">buildlink3.mk</code> file available,
11991: this is specified using the <code class=
11992: "varname">DEPENDS</code> definition. An example
11993: of this is the <a xmlns=
1.1 grant 11994: "http://www.w3.org/TR/xhtml1/transitional" href=
11995: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45 wiz 11996: target="_top"><code xmlns="" class=
11997: "filename">print/lyx</code></a> package, which
11998: uses the xpm library, version 3.4j to build:</p>
1.1 grant 11999: <pre class="programlisting">
1.51 rillig 12000: DEPENDS+= xpm-3.4j:../../graphics/xpm
1.1 grant 12001: </pre>
12002:
12003: <p>You can also use wildcards in package
12004: dependences:</p>
12005: <pre class="programlisting">
1.51 rillig 12006: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
1.1 grant 12007: </pre>
12008:
12009: <p>Note that such wildcard dependencies are
12010: retained when creating binary packages. The
12011: dependency is checked when installing the binary
12012: package and any package which matches the pattern
12013: will be used. Wildcard dependencies should be
12014: used with care.</p>
12015:
12016: <p>The “<span class=
12017: "quote">-[0-9]*</span>” should be used
12018: instead of “<span class=
12019: "quote">-*</span>” to avoid potentially
12020: ambiguous matches such as “<span class=
12021: "quote">tk-postgresql</span>” matching a
12022: “<span class="quote">tk-*</span>”
1.14 xtraeme 12023: <code class="varname">DEPENDS</code>.</p>
1.1 grant 12024:
12025: <p>Wildcards can also be used to specify that a
12026: package will only build against a certain minimum
12027: version of a pre-requisite:</p>
12028: <pre class="programlisting">
1.51 rillig 12029: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
1.1 grant 12030: </pre>
12031:
12032: <p>This means that the package will build against
12033: version 3.5.4 of the tiff library or newer. Such
12034: a dependency may be warranted if, for example,
12035: the API of the library has changed with version
12036: 3.5.4 and a package would not compile against an
12037: earlier version of tiff.</p>
12038:
12039: <p>Please note that such dependencies should only
12040: be updated if a package requires a newer
12041: pre-requisite, but not to denote recommendations
12042: such as security updates or ABI changes that do
12043: not prevent a package from building correctly.
12044: Such recommendations can be expressed using
1.14 xtraeme 12045: <code class="varname">RECOMMENDED</code>:</p>
1.1 grant 12046: <pre class="programlisting">
1.51 rillig 12047: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
1.1 grant 12048: </pre>
12049:
1.14 xtraeme 12050: <p>In addition to the above <code class=
12051: "varname">DEPENDS</code> line, this denotes that
1.1 grant 12052: while a package will build against
12053: tiff>=3.5.4, at least version 3.6.1 is
1.14 xtraeme 12054: recommended. <code class=
12055: "varname">RECOMMENDED</code> entries will be
12056: turned into dependencies unless explicitly
12057: ignored (in which case a warning will be
1.36 wiz 12058: printed).</p>
12059:
12060: <p>To ignore these dependency recommendations and
12061: just use the required <code class=
12062: "varname">DEPENDS</code>, set <code class=
12063: "varname">IGNORE_RECOMMENDED=YES</code>. This may
12064: make it easier and faster to update packages
12065: built using pkgsrc, since older compatible
12066: dependencies can continue to be used. This is
12067: useful for people who watch their rebuilds very
12068: carefully; it is not very good as a
12069: general-purpose hammer. If you use it, you need
12070: to be mindful of possible ABI changes, including
12071: those from the underlying OS.</p>
12072:
12073: <p>Packages that are built with recommendations
12074: ignored may not be uploaded to ftp.NetBSD.org by
12075: developers and should not be used across
12076: different systems that may have different
12077: versions of binary packages installed.</p>
1.1 grant 12078:
12079: <p>For security fixes, please update the package
12080: vulnerabilities file as well as setting
1.14 xtraeme 12081: <code class="varname">RECOMMENDED</code>, see
1.1 grant 12082: <a href="#security-handling" title=
1.38 dillo 12083: "15.1.8. Handling packages with security problems">
1.59 rillig 12084: Section 15.1.8, “Handling packages with
12085: security problems”</a> for more
1.1 grant 12086: information.</p>
12087: </li>
12088:
12089: <li>
12090: <p>If your package needs some executable to be
1.17 sketch 12091: able to run correctly and if there's no
1.45 wiz 12092: <code xmlns=
12093: "http://www.w3.org/TR/xhtml1/transitional" class=
12094: "filename">buildlink3.mk</code> file, this is
12095: specified using the <code class=
1.14 xtraeme 12096: "varname">DEPENDS</code> variable. The <a xmlns=
1.1 grant 12097: "http://www.w3.org/TR/xhtml1/transitional" href=
12098: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45 wiz 12099: target="_top"><code xmlns="" class=
12100: "filename">print/lyx</code></a> package needs to
12101: be able to execute the latex binary from the
12102: teTeX package when it runs, and that is
12103: specified:</p>
1.1 grant 12104: <pre class="programlisting">
1.51 rillig 12105: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
1.1 grant 12106: </pre>
12107:
12108: <p>The comment about wildcard dependencies from
12109: previous paragraph applies here, too.</p>
12110: </li>
12111: </ol>
12112: </div>
12113:
12114: <p>If your package needs files from another package to
12115: build, see the first part of the “<span class=
12116: "quote">do-configure</span>” target <a xmlns=
12117: "http://www.w3.org/TR/xhtml1/transitional" href=
12118: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.45 wiz 12119: target="_top"><code xmlns="" class=
12120: "filename">print/ghostscript5</code></a> package (it
1.20 ben 12121: relies on the jpeg sources being present in source form
12122: during the build):</p>
1.1 grant 12123: <pre class="programlisting">
1.51 rillig 12124: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
12125: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
1.1 grant 12126: fi
12127: </pre>
12128:
12129: <p>If you build any other packages that way, please
12130: make sure the working files are deleted too when this
12131: package's working files are cleaned up. The easiest way
12132: to do so is by adding a pre-clean target:</p>
12133: <pre class="programlisting">
1.51 rillig 12134: pre-clean:
12135: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
1.1 grant 12136: </pre>
12137:
1.14 xtraeme 12138: <p>Please also note the <code class=
12139: "varname">BUILD_USES_MSGFMT</code> and <code class=
12140: "varname">BUILD_USES_GETTEXT_M4</code> definitions,
12141: which are provided as convenience definitions. The
1.24 wiz 12142: former works out whether <a href=
12143: "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
12144: <span class="citerefentry"><span class=
12145: "refentrytitle">msgfmt</span>(1)</span></a> is part of
12146: the base system, and, if it isn't, installs the
12147: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12148: href=
1.1 grant 12149: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.45 wiz 12150: target="_top"><code xmlns="" class=
12151: "filename">devel/gettext</code></a> package. The latter
1.20 ben 12152: adds a build dependency on either an installed version
12153: of an older gettext package, or if it isn't, installs
12154: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12155: href=
12156: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
1.45 wiz 12157: target="_top"><code xmlns="" class=
12158: "filename">devel/gettext-m4</code></a> package.</p>
1.1 grant 12159: </div>
12160:
1.59 rillig 12161: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12162: <div class="titlepage">
12163: <div>
12164: <div>
1.59 rillig 12165: <h3 class="title"><a name="conflicts" id=
1.38 dillo 12166: "conflicts"></a>15.1.5. Handling conflicts
1.1 grant 12167: with other packages</h3>
12168: </div>
12169: </div>
12170: </div>
12171:
12172: <p>Your package may conflict with other packages a user
12173: might already have installed on his system, e.g. if
12174: your package installs the same set of files like
12175: another package in our pkgsrc tree.</p>
12176:
1.14 xtraeme 12177: <p>In this case you can set <code class=
1.47 reed 12178: "varname">CONFLICTS</code> to a space-separated list of
1.1 grant 12179: packages (including version string) your package
12180: conflicts with.</p>
12181:
1.47 reed 12182: <p>For example, <a xmlns=
1.1 grant 12183: "http://www.w3.org/TR/xhtml1/transitional" href=
12184: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.45 wiz 12185: target="_top"><code xmlns="" class=
12186: "filename">x11/Xaw3d</code></a> and <a xmlns=
1.20 ben 12187: "http://www.w3.org/TR/xhtml1/transitional" href=
12188: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
1.45 wiz 12189: target="_top"><code xmlns="" class=
1.47 reed 12190: "filename">x11/Xaw-Xpm</code></a> install the same
12191: shared library, thus you set in <code xmlns=
1.45 wiz 12192: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 12193: "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1 grant 12194: <pre class="programlisting">
1.51 rillig 12195: CONFLICTS= Xaw-Xpm-[0-9]*
1.1 grant 12196: </pre>
12197:
1.45 wiz 12198: <p>and in <code xmlns=
12199: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12200: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1 grant 12201: <pre class="programlisting">
1.51 rillig 12202: CONFLICTS= Xaw3d-[0-9]*
1.1 grant 12203: </pre>
12204:
12205: <p>Packages will automatically conflict with other
12206: packages with the name prefix and a different version
12207: string. “<span class=
12208: "quote">Xaw3d-1.5</span>” e.g. will automatically
12209: conflict with the older version “<span class=
12210: "quote">Xaw3d-1.3</span>”.</p>
12211: </div>
12212:
1.59 rillig 12213: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12214: <div class="titlepage">
12215: <div>
12216: <div>
1.59 rillig 12217: <h3 class="title"><a name="not-building-packages"
12218: id=
1.38 dillo 12219: "not-building-packages"></a>15.1.6. Packages
1.30 wiz 12220: that cannot or should not be built</h3>
1.1 grant 12221: </div>
12222: </div>
12223: </div>
12224:
12225: <p>There are several reasons why a package might be
12226: instructed to not build under certain circumstances. If
12227: the package builds and runs on most platforms, the
1.14 xtraeme 12228: exceptions should be noted with <code class=
12229: "varname">NOT_FOR_PLATFORM</code>. If the package
12230: builds and runs on a small handful of platforms, set
12231: <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.45 wiz 12232: Both <code class="varname">ONLY_FOR_PLATFORM</code> and
12233: <code class="varname">NOT_FOR_PLATFORM</code> are OS
12234: triples (OS-version-platform) that can use glob-style
12235: wildcards.</p>
12236:
12237: <p>If the package should be skipped (for example,
12238: because it provides functionality already provided by
12239: the system), set <code class=
1.14 xtraeme 12240: "varname">PKG_SKIP_REASON</code> to a descriptive
12241: message. If the package should fail because some
12242: preconditions are not met, set <code class=
12243: "varname">PKG_FAIL_REASON</code> to a descriptive
1.1 grant 12244: message.</p>
12245: </div>
12246:
1.59 rillig 12247: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12248: <div class="titlepage">
12249: <div>
12250: <div>
1.59 rillig 12251: <h3 class="title"><a name="undeletable-packages"
12252: id=
1.38 dillo 12253: "undeletable-packages"></a>15.1.7. Packages
1.30 wiz 12254: which should not be deleted, once installed</h3>
1.1 grant 12255: </div>
12256: </div>
12257: </div>
12258:
12259: <p>To ensure that a package may not be deleted, once it
1.14 xtraeme 12260: has been installed, the <code class=
12261: "varname">PKG_PRESERVE</code> definition should be set
12262: in the package Makefile. This will be carried into any
1.1 grant 12263: binary package that is made from this pkgsrc entry. A
12264: “<span class="quote">preserved</span>”
12265: package will not be deleted using <a href=
12266: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
12267: <span class="citerefentry"><span class=
12268: "refentrytitle">pkg_delete</span>(1)</span></a> unless
12269: the “<span class="quote">-f</span>” option
12270: is used.</p>
12271: </div>
12272:
1.59 rillig 12273: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12274: <div class="titlepage">
12275: <div>
12276: <div>
1.59 rillig 12277: <h3 class="title"><a name="security-handling" id=
1.38 dillo 12278: "security-handling"></a>15.1.8. Handling
1.1 grant 12279: packages with security problems</h3>
12280: </div>
12281: </div>
12282: </div>
12283:
12284: <p>When a vulnerability is found, this should be noted
1.45 wiz 12285: in <code xmlns=
12286: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12287: "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.43 wiz 12288: and after committing that file, use
12289: <span><strong class="command">make
12290: upload</strong></span> in the same directory to update
12291: the file on ftp.NetBSD.org.</p>
12292:
12293: <p>After fixing the vulnerability by a patch, its
12294: <code class="varname">PKGREVISION</code> should be
12295: increased (this is of course not necessary if the
12296: problem is fixed by using a newer release of the
1.45 wiz 12297: software). In addition, if a <code xmlns=
12298: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12299: "filename">buildlink3.mk</code> file exists for an
1.43 wiz 12300: affected package, a corresponding <code class=
1.14 xtraeme 12301: "varname">BUILDLINK_RECOMMENDED.<em class=
12302: "replaceable"><code>pkg</code></em></code> entry should
1.43 wiz 12303: be added or updated in it.</p>
1.1 grant 12304:
12305: <p>Also, if the fix should be applied to the stable
12306: pkgsrc branch, be sure to submit a pullup request!</p>
1.43 wiz 12307:
12308: <p>Binary packages already on ftp.NetBSD.org will be
12309: handled semi-automatically by a weekly cron job.</p>
1.1 grant 12310: </div>
12311:
1.59 rillig 12312: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12313: <div class="titlepage">
12314: <div>
12315: <div>
1.59 rillig 12316: <h3 class="title"><a name="compiler-bugs" id=
1.38 dillo 12317: "compiler-bugs"></a>15.1.9. How to handle
1.1 grant 12318: compiler bugs</h3>
12319: </div>
12320: </div>
12321: </div>
12322:
12323: <p>Some source files trigger bugs in the compiler,
12324: based on combinations of compiler version and
12325: architecture and almost always relation to optimisation
12326: being enabled. Common symptoms are gcc internal errors
12327: or never finishing compiling a file.</p>
12328:
1.47 reed 12329: <p>Typically, a workaround involves testing the
1.14 xtraeme 12330: <code class="varname">MACHINE_ARCH</code> and compiler
1.1 grant 12331: version, disabling optimisation for that
1.14 xtraeme 12332: file/<code class="varname">MACHINE_ARCH</code>/compiler
1.45 wiz 12333: combination, and documenting it in <code xmlns=
12334: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12335: "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1 grant 12336: number of examples!</p>
12337: </div>
12338:
1.59 rillig 12339: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12340: <div class="titlepage">
12341: <div>
12342: <div>
1.59 rillig 12343: <h3 class="title"><a name="bumping-pkgrevision"
12344: id="bumping-pkgrevision"></a>15.1.10. How to
1.30 wiz 12345: handle incrementing versions when fixing an
12346: existing package</h3>
1.1 grant 12347: </div>
12348: </div>
12349: </div>
12350:
12351: <p>When making fixes to an existing package it can be
1.14 xtraeme 12352: useful to change the version number in <code class=
12353: "varname">PKGNAME</code>. To avoid conflicting with
1.1 grant 12354: future versions by the original author, a
12355: “<span class="quote">nb1</span>”,
12356: “<span class="quote">nb2</span>”, ...
12357: suffix can be used on package versions by setting
1.14 xtraeme 12358: <code class="varname">PKGREVISION=1</code> (2, ...).
12359: The “<span class="quote">nb</span>” is
12360: treated like a “<span class=
12361: "quote">.</span>” by the pkg tools. e.g.</p>
1.1 grant 12362: <pre class="programlisting">
1.51 rillig 12363: DISTNAME= foo-17.42
12364: PKGREVISION= 9
1.1 grant 12365: </pre>
12366:
1.14 xtraeme 12367: <p>will result in a <code class=
12368: "varname">PKGNAME</code> of “<span class=
1.1 grant 12369: "quote">foo-17.42nb9</span>”.</p>
12370:
12371: <p>When a new release of the package is released, the
1.14 xtraeme 12372: <code class="varname">PKGREVISION</code> should be
1.47 reed 12373: removed, e.g. on a new minor release of the above
1.14 xtraeme 12374: package, things should be like:</p>
1.1 grant 12375: <pre class="programlisting">
1.51 rillig 12376: DISTNAME= foo-17.43
1.1 grant 12377: </pre>
12378: </div>
12379:
1.59 rillig 12380: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12381: <div class="titlepage">
12382: <div>
12383: <div>
1.30 wiz 12384: <h3 class="title"><a name=
1.59 rillig 12385: "portability-of-packages" id=
1.38 dillo 12386: "portability-of-packages"></a>15.1.11. Portability
1.30 wiz 12387: of packages</h3>
1.1 grant 12388: </div>
12389: </div>
12390: </div>
12391:
12392: <p>One appealing feature of pkgsrc is that it runs on
12393: many different platforms. As a result, it is important
12394: to ensure, where possible, that packages in pkgsrc are
12395: portable. There are some particular details you should
12396: pay attention to while working on pkgsrc.</p>
12397:
1.59 rillig 12398: <div class="sect3" lang="en" xml:lang="en">
1.1 grant 12399: <div class="titlepage">
12400: <div>
12401: <div>
1.59 rillig 12402: <h4 class="title"><a name="install-scripts" id=
1.38 dillo 12403: "install-scripts"></a>15.1.11.1. ${INSTALL},
1.1 grant 12404: ${INSTALL_DATA_DIR}, ...</h4>
12405: </div>
12406: </div>
12407: </div>
12408:
1.14 xtraeme 12409: <p>The BSD-compatible <span><strong class=
12410: "command">install</strong></span> supplied with some
1.1 grant 12411: operating systems will not perform more than one
12412: operation at a time. As such, you should call
12413: “<span class="quote">${INSTALL}</span>”,
12414: etc. like this:</p>
12415: <pre class="programlisting">
1.51 rillig 12416: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
12417: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
1.1 grant 12418: </pre>
12419: </div>
12420: </div>
12421: </div>
12422:
1.59 rillig 12423: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 12424: <div class="titlepage">
12425: <div>
12426: <div>
12427: <h2 class="title" style="clear: both"><a name=
1.59 rillig 12428: "downloading-issues" id=
1.38 dillo 12429: "downloading-issues"></a>15.2. Possible
1.1 grant 12430: downloading issues</h2>
12431: </div>
12432: </div>
12433: </div>
12434:
1.59 rillig 12435: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12436: <div class="titlepage">
12437: <div>
12438: <div>
1.59 rillig 12439: <h3 class="title"><a name="no-plain-download" id=
1.38 dillo 12440: "no-plain-download"></a>15.2.1. Packages
1.30 wiz 12441: whose distfiles aren't available for plain
1.1 grant 12442: downloading</h3>
12443: </div>
12444: </div>
12445: </div>
12446:
12447: <p>If you need to download from a dynamic URL you can
1.14 xtraeme 12448: set <code class="varname">DYNAMIC_MASTER_SITES</code>
12449: and a <span><strong class="command">make
1.45 wiz 12450: fetch</strong></span> will call <code xmlns=
12451: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12452: "filename">files/getsite.sh</code> with the name of
12453: each file to download as an argument, expecting it to
12454: output the URL of the directory from which to download
12455: it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12456: href=
1.1 grant 12457: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.45 wiz 12458: target="_top"><code xmlns="" class=
12459: "filename">graphics/ns-cult3d</code></a> is an example
12460: of this usage.</p>
1.1 grant 12461:
12462: <p>If the download can't be automated, because the user
12463: must submit personal information to apply for a
12464: password, or must pay for the source, or whatever, you
1.14 xtraeme 12465: can set <code class="varname">_FETCH_MESSAGE</code> to
12466: a macro which displays a message explaining the
12467: situation. <code class="varname">_FETCH_MESSAGE</code>
12468: must be executable shell commands, not just a message.
12469: (Generally, it executes <code class=
12470: "varname">${ECHO}</code>). As of this writing, the
1.1 grant 12471: following packages use this: <a xmlns=
12472: "http://www.w3.org/TR/xhtml1/transitional" href=
1.20 ben 12473: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
1.45 wiz 12474: target="_top"><code xmlns="" class=
12475: "filename">cad/simian</code></a>, <a xmlns=
1.20 ben 12476: "http://www.w3.org/TR/xhtml1/transitional" href=
12477: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
1.45 wiz 12478: target="_top"><code xmlns="" class=
12479: "filename">devel/ipv6socket</code></a>, <a xmlns=
1.20 ben 12480: "http://www.w3.org/TR/xhtml1/transitional" href=
12481: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
1.45 wiz 12482: target="_top"><code xmlns="" class=
12483: "filename">emulators/vmware-module</code></a>,
12484: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12485: href=
1.20 ben 12486: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
1.45 wiz 12487: target="_top"><code xmlns="" class=
12488: "filename">fonts/acroread-jpnfont</code></a>, <a xmlns=
1.20 ben 12489: "http://www.w3.org/TR/xhtml1/transitional" href=
1.43 wiz 12490: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/multimedia/realplayer/README.html"
1.45 wiz 12491: target="_top"><code xmlns="" class=
12492: "filename">multimedia/realplayer</code></a>, <a xmlns=
1.43 wiz 12493: "http://www.w3.org/TR/xhtml1/transitional" href=
1.20 ben 12494: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
1.45 wiz 12495: target="_top"><code xmlns="" class=
12496: "filename">sysutils/storage-manager</code></a>,
12497: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12498: href=
1.20 ben 12499: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
1.45 wiz 12500: target="_top"><code xmlns="" class=
12501: "filename">www/ap-aolserver</code></a>, <a xmlns=
1.20 ben 12502: "http://www.w3.org/TR/xhtml1/transitional" href=
12503: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
1.45 wiz 12504: target="_top"><code xmlns="" class=
12505: "filename">www/openacs</code></a>. Try to be consistent
1.20 ben 12506: with them.</p>
1.1 grant 12507: </div>
12508:
1.59 rillig 12509: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12510: <div class="titlepage">
12511: <div>
12512: <div>
1.30 wiz 12513: <h3 class="title"><a name=
1.59 rillig 12514: "modified-distfiles-same-name" id=
1.38 dillo 12515: "modified-distfiles-same-name"></a>15.2.2. How
1.30 wiz 12516: to handle modified distfiles with the 'old'
12517: name</h3>
1.1 grant 12518: </div>
12519: </div>
12520: </div>
12521:
12522: <p>Sometimes authors of a software package make some
12523: modifications after the software was released, and they
12524: put up a new distfile without changing the package's
12525: version number. If a package is already in pkgsrc at
1.32 wiz 12526: that time, the checksum will no longer match. The
12527: contents of the new distfile should be compared against
12528: the old one before changing anything, to make sure the
12529: distfile was really updated on purpose, and that no
12530: trojan horse or so crept in. Then, the correct way to
12531: work around this is to set <code class=
12532: "varname">DIST_SUBDIR</code> to a unique directory
12533: name, usually based on <code class=
12534: "varname">PKGNAME_NOREV</code>. In case this happens
12535: more often, <code class="varname">PKGNAME</code> can be
1.45 wiz 12536: used (thus including the <code xmlns=
12537: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 12538: "filename">nbX</code> suffix) or a date stamp can be
12539: appended, like <code class=
12540: "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
1.45 wiz 12541: forget regenerating the <code xmlns=
12542: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 12543: "filename">distinfo</code> file after that, since it
12544: contains the <code class="varname">DIST_SUBDIR</code>
12545: path in the filenames. Furthermore, a mail to the
12546: package's authors seems appropriate telling them that
12547: changing distfiles after releases without changing the
12548: file names is not good practice.</p>
1.1 grant 12549: </div>
12550: </div>
12551:
1.59 rillig 12552: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 12553: <div class="titlepage">
12554: <div>
12555: <div>
12556: <h2 class="title" style="clear: both"><a name=
1.59 rillig 12557: "configuration-gotchas" id=
1.38 dillo 12558: "configuration-gotchas"></a>15.3. Configuration
1.1 grant 12559: gotchas</h2>
12560: </div>
12561: </div>
12562: </div>
12563:
1.59 rillig 12564: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12565: <div class="titlepage">
12566: <div>
12567: <div>
1.59 rillig 12568: <h3 class="title"><a name="fixes.libtool" id=
1.38 dillo 12569: "fixes.libtool"></a>15.3.1. Shared libraries
1.1 grant 12570: - libtool</h3>
12571: </div>
12572: </div>
12573: </div>
12574:
12575: <p>pkgsrc supports many different machines, with
12576: different object formats like a.out and ELF, and
12577: varying abilities to do shared library and dynamic
12578: loading at all. To accompany this, varying commands and
12579: options have to be passed to the compiler, linker, etc.
12580: to get the Right Thing, which can be pretty annoying
12581: especially if you don't have all the machines at your
12582: hand to test things. The <a xmlns=
12583: "http://www.w3.org/TR/xhtml1/transitional" href=
12584: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.45 wiz 12585: target="_top"><code xmlns="" class=
12586: "filename">devel/libtool</code></a> pkg can help here,
12587: as it just “<span class=
12588: "quote">knows</span>” how to build both static
12589: and dynamic libraries from a set of source files, thus
1.47 reed 12590: being platform-independent.</p>
1.1 grant 12591:
12592: <p>Here's how to use libtool in a pkg in seven simple
12593: steps:</p>
12594:
12595: <div class="orderedlist">
12596: <ol type="1">
12597: <li>
1.14 xtraeme 12598: <p>Add <code class=
12599: "varname">USE_LIBTOOL=yes</code> to the package
12600: Makefile.</p>
1.1 grant 12601: </li>
12602:
12603: <li>
12604: <p>For library objects, use “<span class=
12605: "quote">${LIBTOOL} --mode=compile
12606: ${CC}</span>” in place of
12607: “<span class="quote">${CC}</span>”.
12608: You could even add it to the definition of
1.14 xtraeme 12609: <code class="varname">CC</code>, if only
12610: libraries are being built in a given Makefile.
12611: This one command will build both PIC and non-PIC
12612: library objects, so you need not have separate
12613: shared and non-shared library rules.</p>
1.1 grant 12614: </li>
12615:
12616: <li>
12617: <p>For the linking of the library, remove any
12618: “<span class="quote">ar</span>”,
12619: “<span class="quote">ranlib</span>”,
12620: and “<span class="quote">ld
12621: -Bshareable</span>” commands, and instead
12622: use:</p>
12623: <pre class="programlisting">
1.51 rillig 12624: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} \
12625: -rpath ${PREFIX}/lib -version-info major:minor
1.1 grant 12626: </pre>
12627:
12628: <p>Note that the library is changed to have a
1.45 wiz 12629: <code xmlns=
12630: "http://www.w3.org/TR/xhtml1/transitional" class=
12631: "filename">.la</code> extension, and the objects
12632: are changed to have a <code xmlns=
12633: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12634: "filename">.lo</code> extension. Change
12635: <code class="varname">OBJS</code> as necessary.
12636: This automatically creates all of the
1.45 wiz 12637: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12638: class="filename">.a</code>, <code xmlns=
12639: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12640: "filename">.so.major.minor</code>, and ELF
12641: symlinks (if necessary) in the build directory.
12642: Be sure to include “<span class=
1.1 grant 12643: "quote">-version-info</span>”, especially
12644: when major and minor are zero, as libtool will
12645: otherwise strip off the shared library
12646: version.</p>
12647:
12648: <p>From the libtool manual:</p>
12649: <pre class="programlisting">
1.51 rillig 12650: So, libtool library versions are described by three integers:
1.1 grant 12651:
1.51 rillig 12652: CURRENT
12653: The most recent interface number that this library implements.
1.1 grant 12654:
1.51 rillig 12655: REVISION
12656: The implementation number of the CURRENT interface.
1.1 grant 12657:
1.51 rillig 12658: AGE
12659: The difference between the newest and oldest interfaces that
12660: this library implements. In other words, the library implements
12661: all the interface numbers in the range from number `CURRENT -
12662: AGE' to `CURRENT'.
1.1 grant 12663:
1.51 rillig 12664: If two libraries have identical CURRENT and AGE numbers, then the
12665: dynamic linker chooses the library with the greater REVISION number.
1.1 grant 12666: </pre>
12667:
12668: <p>The “<span class=
12669: "quote">-release</span>” option will
12670: produce different results for a.out and ELF
12671: (excluding symlinks) in only one case. An ELF
12672: library of the form “<span class=
12673: "quote">libfoo-release.so.<span class=
12674: "emphasis"><em>x</em></span>.<span class=
12675: "emphasis"><em>y</em></span></span>” will
12676: have a symlink of “<span class=
12677: "quote">libfoo.so.<span class=
12678: "emphasis"><em>x</em></span>.<span class=
12679: "emphasis"><em>y</em></span></span>” on an
12680: a.out platform. This is handled
12681: automatically.</p>
12682:
12683: <p>The “<span class="quote">-rpath
12684: argument</span>” is the install directory
12685: of the library being built.</p>
12686:
1.45 wiz 12687: <p>In the <code xmlns=
12688: "http://www.w3.org/TR/xhtml1/transitional" class=
12689: "filename">PLIST</code>, include only the
12690: <code xmlns=
12691: "http://www.w3.org/TR/xhtml1/transitional" class=
1.19 hubertf 12692: "filename">.la</code> file, the other files will
12693: be added automatically.</p>
1.1 grant 12694: </li>
12695:
12696: <li>
1.45 wiz 12697: <p>When linking shared object (<code xmlns=
12698: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12699: "filename">.so</code>) files, i.e. files that are
1.24 wiz 12700: loaded via <a href=
12701: "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
12702: <span class="citerefentry"><span class=
12703: "refentrytitle">dlopen</span>(3)</span></a>, NOT
12704: shared libraries, use “<span class=
12705: "quote">-module -avoid-version</span>” to
12706: prevent them getting version tacked on.</p>
1.1 grant 12707:
1.45 wiz 12708: <p>The <code xmlns=
12709: "http://www.w3.org/TR/xhtml1/transitional" class=
12710: "filename">PLIST</code> file gets the
12711: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12712: class="filename">foo.so</code> entry.</p>
1.1 grant 12713: </li>
12714:
12715: <li>
12716: <p>When linking programs that depend on these
12717: libraries <span class=
12718: "emphasis"><em>before</em></span> they are
12719: installed, preface the <a href=
12720: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
12721: <span class="citerefentry"><span class=
12722: "refentrytitle">cc</span>(1)</span></a> or
12723: <a href=
12724: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
12725: <span class="citerefentry"><span class=
12726: "refentrytitle">ld</span>(1)</span></a> line with
12727: “<span class="quote">${LIBTOOL}
12728: --mode=link</span>”, and it will find the
12729: correct libraries (static or shared), but please
12730: be aware that libtool will not allow you to
12731: specify a relative path in -L (such as
12732: “<span class=
12733: "quote">-L../somelib</span>”), because it
12734: expects you to change that argument to be the
1.45 wiz 12735: <code xmlns=
12736: "http://www.w3.org/TR/xhtml1/transitional" class=
12737: "filename">.la</code> file. e.g.</p>
1.1 grant 12738: <pre class="programlisting">
1.51 rillig 12739: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
1.1 grant 12740: </pre>
12741:
12742: <p>should be changed to:</p>
12743: <pre class="programlisting">
1.51 rillig 12744: ${LIBTOOL} --mode=link ${CC} -o <em class=
1.14 xtraeme 12745: "replaceable"><code>someprog</code></em> <em class=
12746: "replaceable"><code>../somelib/somelib.la</code></em>
1.1 grant 12747: </pre>
12748:
12749: <p>and it will do the right thing with the
12750: libraries.</p>
12751: </li>
12752:
12753: <li>
12754: <p>When installing libraries, preface the
12755: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
12756: <span class="citerefentry"><span class=
12757: "refentrytitle">install</span>(1)</span></a> or
12758: <a href=
12759: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
12760: <span class="citerefentry"><span class=
12761: "refentrytitle">cp</span>(1)</span></a> command
12762: with “<span class="quote">${LIBTOOL}
12763: --mode=install</span>”, and change the
1.45 wiz 12764: library name to <code xmlns=
12765: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12766: "filename">.la</code>. e.g.</p>
1.1 grant 12767: <pre class="programlisting">
1.51 rillig 12768: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1 grant 12769: </pre>
12770:
1.45 wiz 12771: <p>This will install the static <code xmlns=
12772: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12773: "filename">.a</code>, shared library, any needed
1.1 grant 12774: symlinks, and run <a href=
12775: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
12776: <span class="citerefentry"><span class=
12777: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
12778: </li>
12779:
12780: <li>
1.45 wiz 12781: <p>In your <code xmlns=
12782: "http://www.w3.org/TR/xhtml1/transitional" class=
12783: "filename">PLIST</code>, include only the
12784: <code xmlns=
12785: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 12786: "filename">.la</code> file (this is a change from
12787: previous behaviour).</p>
1.1 grant 12788: </li>
12789: </ol>
12790: </div>
12791: </div>
12792:
1.59 rillig 12793: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12794: <div class="titlepage">
12795: <div>
12796: <div>
1.59 rillig 12797: <h3 class="title"><a name="using-libtool" id=
1.38 dillo 12798: "using-libtool"></a>15.3.2. Using libtool on
1.30 wiz 12799: GNU packages that already support libtool</h3>
1.1 grant 12800: </div>
12801: </div>
12802: </div>
12803:
1.14 xtraeme 12804: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
12805: the package Makefile. This will override the package's
12806: own libtool in most cases. For older libtool using
1.1 grant 12807: packages, libtool is made by ltconfig script during the
12808: do-configure step; you can check the libtool script
1.14 xtraeme 12809: location by doing <span><strong class="command">make
12810: configure; find work*/ -name
12811: libtool</strong></span>.</p>
12812:
12813: <p><code class="varname">LIBTOOL_OVERRIDE</code>
12814: specifies which libtool scripts, relative to
12815: <code class="varname">WRKSRC</code>, to override. By
12816: default, it is set to “<span class=
12817: "quote">libtool */libtool */*/libtool</span>”. If
12818: this does not match the location of the package's
12819: libtool script(s), set it as appropriate.</p>
1.13 hubertf 12820:
1.45 wiz 12821: <p>If you do not need <code xmlns=
12822: "http://www.w3.org/TR/xhtml1/transitional" class=
12823: "filename">*.a</code> static libraries built and
12824: installed, then use <code class=
12825: "varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.1 grant 12826:
1.47 reed 12827: <p>If your package makes use of the
12828: platform-independent library for loading dynamic shared
12829: objects, that comes with libtool (libltdl), you should
12830: include devel/libltdl/buildlink3.mk.</p>
1.1 grant 12831:
12832: <p>Some packages use libtool incorrectly so that the
12833: package may not work or build in some circumstances.
12834: Some of the more common errors are:</p>
12835:
12836: <div class="itemizedlist">
12837: <ul type="disc">
12838: <li>
12839: <p>The inclusion of a shared object (-module) as
12840: a dependent library in an executable or library.
12841: This in itself isn't a problem if one of two
12842: things has been done:</p>
12843:
12844: <div class="orderedlist">
12845: <ol type="1">
12846: <li>
12847: <p>The shared object is named correctly,
1.45 wiz 12848: i.e. <code xmlns=
12849: "http://www.w3.org/TR/xhtml1/transitional"
12850: class="filename">libfoo.la</code>, not
12851: <code xmlns=
12852: "http://www.w3.org/TR/xhtml1/transitional"
12853: class="filename">foo.la</code></p>
1.1 grant 12854: </li>
12855:
12856: <li>
12857: <p>The -dlopen option is used when linking
12858: an executable.</p>
12859: </li>
12860: </ol>
12861: </div>
12862: </li>
12863:
12864: <li>
12865: <p>The use of libltdl without the correct calls
12866: to initialisation routines. The function
12867: lt_dlinit() should be called and the macro
1.14 xtraeme 12868: <code class=
12869: "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1 grant 12870: included in executables.</p>
12871: </li>
12872: </ul>
12873: </div>
12874: </div>
12875:
1.59 rillig 12876: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12877: <div class="titlepage">
12878: <div>
12879: <div>
1.59 rillig 12880: <h3 class="title"><a name="autoconf-automake" id=
1.38 dillo 12881: "autoconf-automake"></a>15.3.3. GNU
1.1 grant 12882: Autoconf/Automake</h3>
12883: </div>
12884: </div>
12885: </div>
12886:
12887: <p>If a package needs GNU autoconf or automake to be
12888: executed to regenerate the configure script and
12889: Makefile.in makefile templates, then they should be
1.35 jmmv 12890: executed in a pre-configure target.</p>
1.1 grant 12891:
12892: <p>For packages that need only autoconf:</p>
12893: <pre class="programlisting">
1.51 rillig 12894: AUTOCONF_REQD= 2.50 # if default version is not good enough
12895: USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13
12896: ...
1.1 grant 12897:
1.51 rillig 12898: pre-configure:
12899: cd ${WRKSRC}; autoconf
1.1 grant 12900:
1.51 rillig 12901: ...
1.1 grant 12902: </pre>
12903:
12904: <p>and for packages that need automake and
12905: autoconf:</p>
12906: <pre class="programlisting">
1.51 rillig 12907: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
12908: USE_TOOLS+= automake # use "automake14" for automake-1.4
12909: ...
1.1 grant 12910:
1.51 rillig 12911: pre-configure:
12912: cd ${WRKSRC}; \
12913: aclocal; autoheader; \
12914: automake -a --foreign -i; autoconf
12915:
12916: ...
1.1 grant 12917: </pre>
12918:
12919: <p>Packages which use GNU Automake will almost
1.35 jmmv 12920: certainly require GNU Make.</p>
1.1 grant 12921:
12922: <p>There are times when the configure process makes
12923: additional changes to the generated files, which then
12924: causes the build process to try to re-execute the
12925: automake sequence. This is prevented by touching
12926: various files in the configure stage. If this causes
1.14 xtraeme 12927: problems with your package you can set <code class=
12928: "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1 grant 12929: Makefile.</p>
12930: </div>
12931: </div>
12932:
1.59 rillig 12933: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 12934: <div class="titlepage">
12935: <div>
12936: <div>
12937: <h2 class="title" style="clear: both"><a name=
1.59 rillig 12938: "fixes-build" id=
1.55 rillig 12939: "fixes-build"></a>15.4. Building the
12940: package</h2>
1.1 grant 12941: </div>
12942: </div>
12943: </div>
12944:
1.59 rillig 12945: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 12946: <div class="titlepage">
12947: <div>
12948: <div>
1.59 rillig 12949: <h3 class="title"><a name="cpp-defines" id=
1.38 dillo 12950: "cpp-defines"></a>15.4.1. CPP defines</h3>
1.1 grant 12951: </div>
12952: </div>
12953: </div>
12954:
1.55 rillig 12955: <p>Sometimes you need to compile different code
12956: depending on the target platform. The C preprocessor
12957: has a set of predefined macros that can be queried by
12958: using <code class="varname">#ifdef FOO</code> or
12959: <code class="varname">#if defined(FOO)</code>. Among
12960: these macros are usually ones that describe the target
12961: CPU and operating system. Depending of which of the
12962: macros are defined, you can write code that uses
12963: features unique to a specific platform. The best way to
12964: handle these differences is to use the GNU autotools
12965: (automake, autoconf, etc.) to check for specific
12966: features (like the existence of a header file, a
12967: function or a library).</p>
12968:
12969: <p>If that is not possible you can use the predefined
12970: macros below to configure your code to the platform it
12971: runs on. Almost every operating system, hardware
12972: architecture and compiler has its own macro. For
12973: example, if the macros <code class=
12974: "varname">__GNUC__</code>, <code class=
12975: "varname">__i386__</code> and <code class=
12976: "varname">__NetBSD__</code> are all defined, you know
12977: that you are using NetBSD on an Intel CPU, and your
12978: compiler is GCC.</p>
12979:
1.59 rillig 12980: <div class="sect3" lang="en" xml:lang="en">
1.55 rillig 12981: <div class="titlepage">
12982: <div>
12983: <div>
12984: <h4 class="title"><a name=
1.59 rillig 12985: "fixes-build-cpp-opsys" id=
1.55 rillig 12986: "fixes-build-cpp-opsys"></a>15.4.1.1. CPP
12987: defines for operating systems</h4>
12988: </div>
12989: </div>
12990: </div>
12991:
12992: <p>To distinguish between 4.4 BSD-derived systems and
12993: the rest of the world, you should use the following
12994: code.</p>
12995: <pre class="programlisting">
1.51 rillig 12996: #include <sys/param.h>
1.55 rillig 12997: #if (defined(BSD) && BSD >= 199306)
1.60 ! rillig 12998: /* BSD-specific code goes here */
1.55 rillig 12999: #else
1.60 ! rillig 13000: /* non-BSD-specific code goes here */
1.55 rillig 13001: #endif
1.1 grant 13002: </pre>
13003:
1.55 rillig 13004: <p>If this distinction is not fine enough, you can
13005: also use the following defines.</p>
13006: <pre class="programlisting">
13007: FreeBSD __FreeBSD__
1.56 rillig 13008: DragonFly __DragonFly__
1.57 minskim 13009: Interix __INTERIX
1.55 rillig 13010: Linux linux, __linux, __linux__
13011: NetBSD __NetBSD__
13012: OpenBSD __OpenBSD__
1.60 ! rillig 13013: Solaris sun, __sun
1.1 grant 13014: </pre>
1.55 rillig 13015: </div>
1.1 grant 13016:
1.59 rillig 13017: <div class="sect3" lang="en" xml:lang="en">
1.55 rillig 13018: <div class="titlepage">
13019: <div>
13020: <div>
1.59 rillig 13021: <h4 class="title"><a name="fixes-build-cpp-cpu"
13022: id="fixes-build-cpp-cpu"></a>15.4.1.2. CPP
1.55 rillig 13023: defines for CPUs</h4>
13024: </div>
13025: </div>
13026: </div>
13027: <pre class="programlisting">
13028: i386 i386, __i386, __i386__
13029: MIPS __mips
13030: SPARC sparc, __sparc
13031: </pre>
13032: </div>
13033:
1.59 rillig 13034: <div class="sect3" lang="en" xml:lang="en">
1.55 rillig 13035: <div class="titlepage">
13036: <div>
13037: <div>
13038: <h4 class="title"><a name=
1.59 rillig 13039: "fixes-build-cpp-compiler" id=
1.55 rillig 13040: "fixes-build-cpp-compiler"></a>15.4.1.3. CPP
13041: defines for compilers</h4>
13042: </div>
13043: </div>
13044: </div>
13045: <pre class="programlisting">
13046: GCC __GNUC__ (major version), __GNUC_MINOR__
1.60 ! rillig 13047: SunPro __SUNPRO_C (0x570 for version 5.7)
1.55 rillig 13048: </pre>
13049: </div>
1.1 grant 13050: </div>
1.51 rillig 13051:
1.59 rillig 13052: <div class="sect2" lang="en" xml:lang="en">
1.51 rillig 13053: <div class="titlepage">
13054: <div>
13055: <div>
1.60 ! rillig 13056: <h3 class="title"><a name="cpp-list-examples" id=
! 13057: "cpp-list-examples"></a>15.4.2. Examples of
! 13058: CPP defines for some platforms</h3>
! 13059: </div>
! 13060: </div>
! 13061: </div>
! 13062:
! 13063: <p>The list of the CPP identification macros for
! 13064: hardware and operating system may depend on the
! 13065: compiler that is used. The following list contains some
! 13066: examples that may help you to choose the right ones.
! 13067: For example, if you want to conditionally compile code
! 13068: on Solaris, don't use <code class=
! 13069: "varname">__sun__</code>, as the SunPro compiler does
! 13070: not define it. Use <code class="varname">__sun</code>
! 13071: instead.</p>
! 13072:
! 13073: <div class="variablelist">
! 13074: <dl>
! 13075: <dt><span class="term">SunPro 5.7 + Solaris 8 +
! 13076: SPARC</span></dt>
! 13077:
! 13078: <dd>
! 13079: <p>__SVR4, __sparc, __sun, __unix, sparc, sun,
! 13080: unix.</p>
! 13081: </dd>
! 13082:
! 13083: <dt><span class="term">GCC 4 + Solaris 8 +
! 13084: SPARC</span></dt>
! 13085:
! 13086: <dd>
! 13087: <p>__ELF__, __sparc, __sparc__, __sun, __sun__,
! 13088: __SVR4, __svr4__, __unix, __unix__, sparc, sun,
! 13089: unix.</p>
! 13090: </dd>
! 13091: </dl>
! 13092: </div>
! 13093: </div>
! 13094:
! 13095: <div class="sect2" lang="en" xml:lang="en">
! 13096: <div class="titlepage">
! 13097: <div>
! 13098: <div>
1.59 rillig 13099: <h3 class="title"><a name="cpp-list" id=
1.60 ! rillig 13100: "cpp-list"></a>15.4.3. Getting a list of CPP
1.51 rillig 13101: defines</h3>
13102: </div>
13103: </div>
13104: </div>
13105:
1.60 ! rillig 13106: <p>If your system uses the GNU C Compiler, you can get
! 13107: a list of symbols that are defined by default, e.g. to
! 13108: identify the platform, with the following command:</p>
1.51 rillig 13109: <pre class="programlisting">
13110: gcc -E -dM - < /dev/null
13111: </pre>
1.60 ! rillig 13112:
! 13113: <p>On other systems you may get the list by using the
! 13114: system's syscall trace utility (ktrace, truss, strace)
! 13115: to have a look which arguments are passed to the actual
! 13116: compiler.</p>
1.51 rillig 13117: </div>
1.1 grant 13118: </div>
13119:
1.59 rillig 13120: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 13121: <div class="titlepage">
13122: <div>
13123: <div>
13124: <h2 class="title" style="clear: both"><a name=
1.59 rillig 13125: "package-specific-actions" id=
1.38 dillo 13126: "package-specific-actions"></a>15.5. Package
1.1 grant 13127: specific actions</h2>
13128: </div>
13129: </div>
13130: </div>
13131:
1.59 rillig 13132: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13133: <div class="titlepage">
13134: <div>
13135: <div>
1.59 rillig 13136: <h3 class="title"><a name="user-interaction" id=
1.38 dillo 13137: "user-interaction"></a>15.5.1. User
1.2 hubertf 13138: interaction</h3>
1.1 grant 13139: </div>
13140: </div>
13141: </div>
13142:
13143: <p>Occasionally, packages require interaction from the
13144: user, and this can be in a number of ways:</p>
13145:
13146: <div class="itemizedlist">
13147: <ul type="disc">
13148: <li>
13149: <p>help in fetching the distfiles</p>
13150: </li>
13151:
13152: <li>
13153: <p>help to configure the package before it is
13154: built</p>
13155: </li>
13156:
13157: <li>
13158: <p>help during the build process</p>
13159: </li>
13160:
13161: <li>
13162: <p>help during the installation of a package</p>
13163: </li>
13164: </ul>
13165: </div>
13166:
1.14 xtraeme 13167: <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1 grant 13168: definition is provided to notify the pkgsrc mechanism
13169: of an interactive stage which will be needed, and this
1.45 wiz 13170: should be set in the package's <code xmlns=
13171: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 13172: "filename">Makefile</code>, e.g.:</p>
1.1 grant 13173: <pre class="programlisting">
1.51 rillig 13174: INTERACTIVE_STAGE= build
1.1 grant 13175: </pre>
13176:
13177: <p>Multiple interactive stages can be specified:</p>
13178: <pre class="programlisting">
1.51 rillig 13179: INTERACTIVE_STAGE= configure install
1.1 grant 13180: </pre>
13181: </div>
13182:
1.59 rillig 13183: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13184: <div class="titlepage">
13185: <div>
13186: <div>
1.59 rillig 13187: <h3 class="title"><a name="handling-licenses" id=
1.38 dillo 13188: "handling-licenses"></a>15.5.2. Handling
1.1 grant 13189: licenses</h3>
13190: </div>
13191: </div>
13192: </div>
13193:
1.44 gdt 13194: <p>A package may be covered by a license which the user
13195: has or has not agreed to accept. For these cases,
13196: pkgsrc contains a mechanism to note that a package is
13197: covered by a particular license, and the package cannot
13198: be built unless the user has accepted the license.
13199: (Installation of binary packages are not currently
13200: subject to this mechanism.) Packages with licenses that
13201: are either Open Source according to the Open Source
13202: Initiative or Free according to the Free Software
13203: Foundation will not be marked with a license tag.
13204: Packages with licenses that have not been determined to
13205: meet either definition will be marked with a license
13206: tag referring to the license. This will prevent
13207: building unless pkgsrc is informed that the license is
13208: acceptable, and enables displaying the license.</p>
13209:
13210: <p>The license tag mechanism is intended to address
13211: copyright-related issues surrounding building,
13212: installing and using a package, and not to address
13213: redistribution issues (see <code class=
13214: "varname">RESTRICTED</code> and <code class=
13215: "varname">NO_SRC_ON_FTP</code>, etc.). However, the
13216: above definition of licenses for which tags are not
13217: needed implies that packages with redistribution
13218: restrictions should have tags.</p>
13219:
13220: <p>Denoting that a package is covered by a particular
1.45 wiz 13221: license is done by placing the license in <code xmlns=
13222: "http://www.w3.org/TR/xhtml1/transitional" class=
1.44 gdt 13223: "filename">pkgsrc/licenses</code> and setting the
13224: <code class="varname">LICENSE</code> variable to a
13225: string identifying the license, e.g. in <a xmlns=
1.14 xtraeme 13226: "http://www.w3.org/TR/xhtml1/transitional" href=
1.44 gdt 13227: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/xv/README.html"
1.45 wiz 13228: target="_top"><code xmlns="" class=
13229: "filename">graphics/xv</code></a>:</p>
1.1 grant 13230: <pre class="programlisting">
1.51 rillig 13231: LICENSE= xv-license
1.1 grant 13232: </pre>
13233:
13234: <p>When trying to build, the user will get a notice
1.44 gdt 13235: that the package is covered by a license which has not
13236: been accepted:</p>
1.1 grant 13237: <pre class="programlisting">
1.51 rillig 13238: <code class="prompt">%</code> <strong class=
1.14 xtraeme 13239: "userinput"><code>make</code></strong>
1.51 rillig 13240: ===> xv-3.10anb9 has an unacceptable license: xv-license.
13241: ===> To view the license, enter "/usr/bin/make show-license".
13242: ===> To indicate acceptance, add this line to your /etc/mk.conf:
13243: ===> ACCEPTABLE_LICENSES+=xv-license
13244: *** Error code 1
1.1 grant 13245: </pre>
13246:
1.14 xtraeme 13247: <p>The license can be viewed with <span><strong class=
13248: "command">make show-license</strong></span>, and if it
13249: is considered appropriate, the line printed above can
1.45 wiz 13250: be added to <code xmlns=
13251: "http://www.w3.org/TR/xhtml1/transitional" class=
13252: "filename">/etc/mk.conf</code> to indicate acceptance
13253: of the particular license:</p>
1.1 grant 13254: <pre class="programlisting">
1.51 rillig 13255: ACCEPTABLE_LICENSES+=xv-license
1.1 grant 13256: </pre>
13257:
13258: <p>When adding a package with a new license, the
1.45 wiz 13259: license text should be added to <code xmlns=
13260: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13261: "filename">pkgsrc/licenses</code> for displaying. A
13262: list of known licenses can be seen in this directory as
13263: well as by looking at the list of (commented out)
13264: <code class="varname">ACCEPTABLE_LICENSES</code>
1.45 wiz 13265: variable settings in <code xmlns=
13266: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13267: "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1 grant 13268:
1.44 gdt 13269: <p>The use of <code class=
13270: "varname">LICENSE=shareware</code>, <code class=
13271: "varname">LICENSE=no-commercial-use</code>, and similar
13272: language is deprecated because it does not crisply
13273: refer to a particular license text. Another problem
13274: with such usage is that it does not enable a user to
13275: denote acceptance of the license for a single package
13276: without accepting the same license text for another
13277: package. In particular, this can be inappropriate when
13278: e.g. one accepts a particular license to indicate to
13279: pkgsrc that a fee has been paid.</p>
1.1 grant 13280: </div>
13281:
1.59 rillig 13282: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13283: <div class="titlepage">
13284: <div>
13285: <div>
1.30 wiz 13286: <h3 class="title"><a name=
1.59 rillig 13287: "installing-score-files" id=
1.38 dillo 13288: "installing-score-files"></a>15.5.3. Installing
1.30 wiz 13289: score files</h3>
1.1 grant 13290: </div>
13291: </div>
13292: </div>
13293:
13294: <p>Certain packages, most of them in the games
13295: category, install a score file that allows all users on
13296: the system to record their highscores. In order for
13297: this to work, the binaries need to be installed setgid
13298: and the score files owned by the appropriate group
13299: and/or owner (traditionally the "games" user/group).
13300: The following variables, documented in more detail in
1.45 wiz 13301: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13302: class="filename">mk/defaults/mk.conf</code>, control
13303: this behaviour: <code class=
1.14 xtraeme 13304: "varname">SETGIDGAME</code>, <code class=
13305: "varname">GAMEDATAMODE</code>, <code class=
13306: "varname">GAMEGRP</code>, <code class=
13307: "varname">GAMEMODE</code>, <code class=
13308: "varname">GAMEOWN</code>.</p>
1.1 grant 13309:
13310: <p>Note that per default, setgid installation of games
1.14 xtraeme 13311: is disabled; setting <code class=
13312: "varname">SETGIDGAME=YES</code> will set all the other
1.1 grant 13313: variables accordingly.</p>
13314:
13315: <p>A package should therefor never hard code file
1.14 xtraeme 13316: ownership or access permissions but rely on
13317: <code class="varname">INSTALL_GAME</code> and
13318: <code class="varname">INSTALL_GAME_DATA</code> to set
13319: these correctly.</p>
1.1 grant 13320: </div>
13321:
1.59 rillig 13322: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13323: <div class="titlepage">
13324: <div>
13325: <div>
1.59 rillig 13326: <h3 class="title"><a name="perl-scripts" id=
1.38 dillo 13327: "perl-scripts"></a>15.5.4. Packages
1.30 wiz 13328: containing perl scripts</h3>
1.1 grant 13329: </div>
13330: </div>
13331: </div>
13332:
13333: <p>If your package contains interpreted perl scripts,
1.14 xtraeme 13334: set <code class="varname">REPLACE_PERL</code> to ensure
13335: that the proper interpreter path is set. <code class=
13336: "varname">REPLACE_PERL</code> should contain a list of
13337: scripts, relative to <code class=
13338: "varname">WRKSRC</code>, that you want adjusted.</p>
1.1 grant 13339: </div>
13340:
1.59 rillig 13341: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13342: <div class="titlepage">
13343: <div>
13344: <div>
1.59 rillig 13345: <h3 class="title"><a name="hardcoded-paths" id=
1.38 dillo 13346: "hardcoded-paths"></a>15.5.5. Packages with
1.1 grant 13347: hardcoded paths to other interpreters</h3>
13348: </div>
13349: </div>
13350: </div>
13351:
13352: <p>Your package may also contain scripts with hardcoded
13353: paths to other interpreters besides (or as well as)
13354: perl. To correct the full pathname to the script
13355: interpreter, you need to set the following definitions
1.45 wiz 13356: in your <code xmlns=
13357: "http://www.w3.org/TR/xhtml1/transitional" class=
13358: "filename">Makefile</code> (we shall use
13359: <span><strong class="command">tclsh</strong></span> in
13360: this example):</p>
1.1 grant 13361: <pre class="programlisting">
1.51 rillig 13362: REPLACE_INTERPRETER+= tcl
13363: _REPLACE.tcl.old= .*/bin/tclsh
13364: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
13365: _REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed,
13366: # relative to ${WRKSRC}, just as in REPLACE_PERL
1.1 grant 13367: </pre>
13368: </div>
13369:
1.59 rillig 13370: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13371: <div class="titlepage">
13372: <div>
13373: <div>
1.59 rillig 13374: <h3 class="title"><a name="perl-modules" id=
1.38 dillo 13375: "perl-modules"></a>15.5.6. Packages
1.30 wiz 13376: installing perl modules</h3>
1.1 grant 13377: </div>
13378: </div>
13379: </div>
13380:
13381: <p>Makefiles of packages providing perl5 modules should
1.45 wiz 13382: include the Makefile fragment <code xmlns=
13383: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13384: "filename">../../lang/perl5/module.mk</code>. It
13385: provides a <span><strong class=
13386: "command">do-configure</strong></span> target for the
13387: standard perl configuration for such modules as well as
13388: various hooks to tune this configuration. See comments
13389: in this file for details.</p>
1.1 grant 13390:
13391: <p>Perl5 modules will install into different places
13392: depending on the version of perl used during the build
13393: process. To address this, pkgsrc will append lines to
1.45 wiz 13394: the <code xmlns=
13395: "http://www.w3.org/TR/xhtml1/transitional" class=
13396: "filename">PLIST</code> corresponding to the files
13397: listed in the installed <code xmlns=
13398: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13399: "filename">.packlist</code> file generated by most
13400: perl5 modules. This is invoked by defining <code class=
13401: "varname">PERL5_PACKLIST</code> to a space-separated
13402: list of paths to packlist files, e.g.:</p>
1.1 grant 13403: <pre class="programlisting">
1.51 rillig 13404: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
1.1 grant 13405: </pre>
13406:
1.14 xtraeme 13407: <p>The variables <code class=
13408: "varname">PERL5_SITELIB</code>, <code class=
13409: "varname">PERL5_SITEARCH</code>, and <code class=
13410: "varname">PERL5_ARCHLIB</code> represent the three
1.1 grant 13411: locations in which perl5 modules may be installed, and
13412: may be used by perl5 packages that don't have a
13413: packlist. These three variables are also substituted
1.45 wiz 13414: for in the <code xmlns=
13415: "http://www.w3.org/TR/xhtml1/transitional" class=
13416: "filename">PLIST</code>.</p>
1.1 grant 13417: </div>
13418:
1.59 rillig 13419: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13420: <div class="titlepage">
13421: <div>
13422: <div>
1.59 rillig 13423: <h3 class="title"><a name="faq.info-files" id=
1.38 dillo 13424: "faq.info-files"></a>15.5.7. Packages
1.1 grant 13425: installing info files</h3>
13426: </div>
13427: </div>
13428: </div>
13429:
13430: <p>Some packages install info files or use the
13431: “<span class="quote">makeinfo</span>” or
13432: “<span class="quote">install-info</span>”
13433: commands. Each of the info files:</p>
13434:
13435: <div class="itemizedlist">
13436: <ul type="disc">
13437: <li>
13438: <p>is considered to be installed in the directory
1.45 wiz 13439: <code xmlns=
13440: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13441: "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1 grant 13442: </li>
13443:
13444: <li>
13445: <p>is registered in the Info directory file
1.45 wiz 13446: <code xmlns=
13447: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13448: "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1 grant 13449: </li>
13450:
13451: <li>
13452: <p>and must be listed as a filename in the
1.14 xtraeme 13453: <code class="varname">INFO_FILES</code> variable
13454: in the package Makefile.</p>
1.1 grant 13455: </li>
13456: </ul>
13457: </div>
13458:
1.14 xtraeme 13459: <p><code class="varname">INFO_DIR</code> defaults to
1.1 grant 13460: “<span class="quote">info</span>” and can
1.45 wiz 13461: be overridden in the package Makefile. <code xmlns=
13462: "http://www.w3.org/TR/xhtml1/transitional" class=
13463: "filename">INSTALL</code> and <code xmlns=
13464: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13465: "filename">DEINSTALL</code> scripts will be generated
13466: to handle registration of the info files in the Info
1.1 grant 13467: directory file. The “<span class=
13468: "quote">install-info</span>” command used for the
13469: info files registration is either provided by the
13470: system, or by a special purpose package automatically
13471: added as dependency if needed.</p>
13472:
13473: <p>A package which needs the “<span class=
13474: "quote">makeinfo</span>” command at build time
1.14 xtraeme 13475: must define the variable <code class=
13476: "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1 grant 13477: minimum version of the “<span class=
13478: "quote">makeinfo</span>” command is needed it
1.14 xtraeme 13479: should be noted with the <code class=
13480: "varname">TEXINFO_REQD</code> variable in the package
1.45 wiz 13481: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13482: class="filename">Makefile</code>. By default, a minimum
13483: version of 3.12 is required. If the system does not
13484: provide a <span><strong class=
1.14 xtraeme 13485: "command">makeinfo</strong></span> command or if it
13486: does not match the required minimum, a build dependency
13487: on the <a xmlns=
13488: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 13489: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.45 wiz 13490: target="_top"><code xmlns="" class=
13491: "filename">devel/gtexinfo</code></a> package will be
1.20 ben 13492: added automatically.</p>
1.1 grant 13493:
13494: <p>The build and installation process of the software
13495: provided by the package should not use the
1.14 xtraeme 13496: <span><strong class=
13497: "command">install-info</strong></span> command as the
13498: registration of info files is the task of the package
1.45 wiz 13499: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13500: class="filename">INSTALL</code> script, and it must use
13501: the appropriate <span><strong class=
1.14 xtraeme 13502: "command">makeinfo</strong></span> command.</p>
1.1 grant 13503:
1.47 reed 13504: <p>To achieve this goal, the pkgsrc infrastructure
1.14 xtraeme 13505: creates overriding scripts for the <span><strong class=
13506: "command">install-info</strong></span> and
13507: <span><strong class="command">makeinfo</strong></span>
13508: commands in a directory listed early in <code class=
13509: "varname">PATH</code>.</p>
1.1 grant 13510:
1.14 xtraeme 13511: <p>The script overriding <span><strong class=
13512: "command">install-info</strong></span> has no effect
13513: except the logging of a message. The script overriding
13514: <span><strong class="command">makeinfo</strong></span>
13515: logs a message and according to the value of
13516: <code class="varname">USE_MAKEINFO</code> and
13517: <code class="varname">TEXINFO_REQD</code> either run
13518: the appropriate <span><strong class=
13519: "command">makeinfo</strong></span> command or exit on
13520: error.</p>
1.1 grant 13521: </div>
13522:
1.59 rillig 13523: <div class="sect2" lang="en" xml:lang="en">
1.57 minskim 13524: <div class="titlepage">
13525: <div>
13526: <div>
1.59 rillig 13527: <h3 class="title"><a name="manpages" id=
1.57 minskim 13528: "manpages"></a>15.5.8. Packages installing
13529: man pages</h3>
13530: </div>
13531: </div>
13532: </div>
13533:
13534: <p>Many packages install manual pages. The man pages
13535: are installed under <code class=
13536: "varname">${PREFIX}/${PKGMANDIR}</code> which is
13537: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13538: class="filename">/usr/pkg/man</code> by default.
13539: <code class="varname">PKGMANDIR</code> defaults to
13540: “<span class="quote">man</span>”. For
13541: example, you can set <code class=
13542: "varname">PKGMANDIR</code> to “<span class=
13543: "quote">share/man</span>” to have man pages
13544: install under <code xmlns=
13545: "http://www.w3.org/TR/xhtml1/transitional" class=
13546: "filename">/usr/pkg/share/man/</code> by default.</p>
13547:
13548: <div class="note" style=
13549: "margin-left: 0.5in; margin-right: 0.5in;">
13550: <h3 class="title">Note</h3>
13551:
13552: <p>The support for a custom <code class=
13553: "varname">PKGMANDIR</code> is not complete.</p>
13554: </div>
13555:
13556: <p>The <code xmlns=
13557: "http://www.w3.org/TR/xhtml1/transitional" class=
13558: "filename">PLIST</code> files can just use <code xmlns=
13559: "http://www.w3.org/TR/xhtml1/transitional" class=
13560: "filename">man/</code> as the top level directory for
13561: the man page file entries and the pkgsrc framework will
13562: convert as needed.</p>
13563:
13564: <p>Packages that are configured with <code class=
13565: "varname">GNU_CONFIGURE</code> set as
13566: “<span class="quote">yes</span>”, by
13567: default will use the <code xmlns=
13568: "http://www.w3.org/TR/xhtml1/transitional" class=
13569: "filename">./configure</code> --mandir switch to set
13570: where the man pages should be installed. The path is
13571: <code class="varname">GNU_CONFIGURE_MANDIR</code> which
13572: defaults to <code class=
13573: "varname">${PREFIX}/${PKGMANDIR}</code>.</p>
13574:
13575: <p>Packages that use <code class=
13576: "varname">GNU_CONFIGURE</code> but do not use --mandir,
13577: can set <code class=
13578: "varname">CONFIGURE_HAS_MANDIR</code> to
13579: “<span class="quote">no</span>”. Or if the
13580: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13581: class="filename">./configure</code> script uses a
13582: non-standard use of --mandir, you can set <code class=
13583: "varname">GNU_CONFIGURE_MANDIR</code> as needed.</p>
13584:
13585: <p>See <a href="#manpage-compression" title=
13586: "10.5. Man page compression">Section 10.5,
13587: “Man page compression”</a> for information
13588: on installation of compressed manual pages.</p>
13589: </div>
13590:
1.59 rillig 13591: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13592: <div class="titlepage">
13593: <div>
13594: <div>
1.59 rillig 13595: <h3 class="title"><a name="gconf2-data-files" id=
1.57 minskim 13596: "gconf2-data-files"></a>15.5.9. Packages
1.30 wiz 13597: installing GConf2 data files</h3>
1.1 grant 13598: </div>
13599: </div>
13600: </div>
13601:
1.45 wiz 13602: <p>If a package installs <code xmlns=
13603: "http://www.w3.org/TR/xhtml1/transitional" class=
13604: "filename">.schemas</code> or <code xmlns=
13605: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13606: "filename">.entries</code> files, used by GConf2, you
1.1 grant 13607: need to take some extra steps to make sure they get
13608: registered in the database:</p>
13609:
13610: <div class="orderedlist">
13611: <ol type="1">
13612: <li>
1.45 wiz 13613: <p>Include <code xmlns=
13614: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13615: "filename">../../devel/GConf2/schemas.mk</code>
1.45 wiz 13616: instead of its <code xmlns=
13617: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13618: "filename">buildlink3.mk</code> file. This takes
1.1 grant 13619: care of rebuilding the GConf2 database at
13620: installation and deinstallation time, and tells
13621: the package where to install GConf2 data files
13622: using some standard configure arguments. It also
13623: disallows any access to the database directly
13624: from the package.</p>
13625: </li>
13626:
13627: <li>
13628: <p>Ensure that the package installs its
1.45 wiz 13629: <code xmlns=
13630: "http://www.w3.org/TR/xhtml1/transitional" class=
13631: "filename">.schemas</code> files under
13632: <code xmlns=
13633: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13634: "filename">${PREFIX}/share/gconf/schemas</code>.
1.45 wiz 13635: If they get installed under <code xmlns=
13636: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13637: "filename">${PREFIX}/etc</code>, you will need to
1.1 grant 13638: manually patch the package.</p>
13639: </li>
13640:
13641: <li>
13642: <p>Check the PLIST and remove any entries under
13643: the etc/gconf directory, as they will be handled
13644: automatically. See <a href="#faq.conf" title=
1.38 dillo 13645: "7.14. How do I change the location of configuration files?">
13646: Section 7.14, “How do I change the
1.35 jmmv 13647: location of configuration files?”</a> for
13648: more information.</p>
1.1 grant 13649: </li>
13650:
13651: <li>
1.14 xtraeme 13652: <p>Define the <code class=
13653: "varname">GCONF2_SCHEMAS</code> variable in your
1.45 wiz 13654: <code xmlns=
13655: "http://www.w3.org/TR/xhtml1/transitional" class=
13656: "filename">Makefile</code> with a list of all
13657: <code xmlns=
13658: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13659: "filename">.schemas</code> files installed by the
13660: package, if any. Names must not contain any
13661: directories in them.</p>
1.1 grant 13662: </li>
13663:
13664: <li>
1.14 xtraeme 13665: <p>Define the <code class=
13666: "varname">GCONF2_ENTRIES</code> variable in your
1.45 wiz 13667: <code xmlns=
13668: "http://www.w3.org/TR/xhtml1/transitional" class=
13669: "filename">Makefile</code> with a list of all
13670: <code xmlns=
13671: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13672: "filename">.entries</code> files installed by the
13673: package, if any. Names must not contain any
13674: directories in them.</p>
1.1 grant 13675: </li>
13676: </ol>
13677: </div>
13678: </div>
13679:
1.59 rillig 13680: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13681: <div class="titlepage">
13682: <div>
13683: <div>
1.30 wiz 13684: <h3 class="title"><a name=
1.59 rillig 13685: "scrollkeeper-data-files" id=
1.57 minskim 13686: "scrollkeeper-data-files"></a>15.5.10. Packages
1.30 wiz 13687: installing scrollkeeper data files</h3>
1.1 grant 13688: </div>
13689: </div>
13690: </div>
13691:
1.45 wiz 13692: <p>If a package installs <code xmlns=
13693: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13694: "filename">.omf</code> files, used by scrollkeeper, you
13695: need to take some extra steps to make sure they get
13696: registered in the database:</p>
1.1 grant 13697:
13698: <div class="orderedlist">
13699: <ol type="1">
13700: <li>
1.45 wiz 13701: <p>Include <code xmlns=
13702: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13703: "filename">../../textproc/scrollkeeper/omf.mk</code>
1.45 wiz 13704: instead of its <code xmlns=
13705: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13706: "filename">buildlink3.mk</code> file. This takes
1.1 grant 13707: care of rebuilding the scrollkeeper database at
13708: installation and deinstallation time, and
13709: disallows any access to it directly from the
13710: package.</p>
13711: </li>
13712:
13713: <li>
13714: <p>Check the PLIST and remove any entries under
1.45 wiz 13715: the <code xmlns=
13716: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13717: "filename">libdata/scrollkeeper</code> directory,
1.1 grant 13718: as they will be handled automatically.</p>
13719: </li>
13720:
13721: <li>
1.45 wiz 13722: <p>Remove the <code xmlns=
13723: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13724: "filename">share/omf</code> directory from the
13725: PLIST. It will be handled by scrollkeeper.</p>
1.1 grant 13726: </li>
13727: </ol>
13728: </div>
13729: </div>
13730:
1.59 rillig 13731: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13732: <div class="titlepage">
13733: <div>
13734: <div>
1.59 rillig 13735: <h3 class="title"><a name="x11-fonts" id=
1.57 minskim 13736: "x11-fonts"></a>15.5.11. Packages installing
1.1 grant 13737: X11 fonts</h3>
13738: </div>
13739: </div>
13740: </div>
13741:
13742: <p>If a package installs font files, you will need to
13743: rebuild the fonts database in the directory where they
13744: get installed at installation and deinstallation time.
1.45 wiz 13745: This can be automatically done by using <code xmlns=
13746: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13747: "filename">mk/fonts.mk</code>, which you need to
1.45 wiz 13748: include in your <code xmlns=
13749: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13750: "filename">Makefile</code>.</p>
1.1 grant 13751:
13752: <p>When the file is included, you can list the
1.14 xtraeme 13753: directories where fonts are installed in the
13754: <code class="varname">FONTS_<em class=
13755: "replaceable"><code>type</code></em>_DIRS</code>
13756: variables, where <em class=
13757: "replaceable"><code>type</code></em> can be one of
13758: “<span class="quote">TTF</span>”,
1.1 grant 13759: “<span class="quote">TYPE1</span>” or
13760: “<span class="quote">X11</span>”. Also make
1.45 wiz 13761: sure that the database file <code xmlns=
13762: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13763: "filename">fonts.dir</code> is not listed in the
1.1 grant 13764: PLIST.</p>
13765:
13766: <p>Note that you should not create new directories for
13767: fonts; instead use the standard ones to avoid that the
13768: user needs to manually configure his X server to find
13769: them.</p>
13770: </div>
13771:
1.59 rillig 13772: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13773: <div class="titlepage">
13774: <div>
13775: <div>
1.59 rillig 13776: <h3 class="title"><a name="gtk2-modules" id=
1.57 minskim 13777: "gtk2-modules"></a>15.5.12. Packages
1.30 wiz 13778: installing GTK2 modules</h3>
1.1 grant 13779: </div>
13780: </div>
13781: </div>
13782:
1.47 reed 13783: <p>If a package installs GTK2 immodules or loaders, you
1.1 grant 13784: need to take some extra steps to get them registered in
13785: the GTK2 database properly:</p>
13786:
13787: <div class="orderedlist">
13788: <ol type="1">
13789: <li>
1.45 wiz 13790: <p>Include <code xmlns=
13791: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13792: "filename">../../x11/gtk2/modules.mk</code>
1.45 wiz 13793: instead of its <code xmlns=
13794: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13795: "filename">buildlink3.mk</code> file. This takes
13796: care of rebuilding the database at installation
13797: and deinstallation time.</p>
1.1 grant 13798: </li>
13799:
13800: <li>
1.14 xtraeme 13801: <p>Set <code class=
13802: "varname">GTK2_IMMODULES=YES</code> if your
13803: package installs GTK2 immodules.</p>
1.1 grant 13804: </li>
13805:
13806: <li>
1.14 xtraeme 13807: <p>Set <code class=
13808: "varname">GTK2_LOADERS=YES</code> if your package
13809: installs GTK2 loaders.</p>
1.1 grant 13810: </li>
13811:
13812: <li>
1.47 reed 13813: <p>Patch the package to not touch any of the GTK2
1.1 grant 13814: databases directly. These are:</p>
13815:
13816: <div class="itemizedlist">
13817: <ul type="disc">
13818: <li>
1.45 wiz 13819: <p><code xmlns=
13820: "http://www.w3.org/TR/xhtml1/transitional"
13821: class=
1.14 xtraeme 13822: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1 grant 13823: </li>
13824:
13825: <li>
1.45 wiz 13826: <p><code xmlns=
13827: "http://www.w3.org/TR/xhtml1/transitional"
13828: class=
1.14 xtraeme 13829: "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1 grant 13830: </li>
13831: </ul>
13832: </div>
13833: </li>
13834:
13835: <li>
13836: <p>Check the PLIST and remove any entries under
1.45 wiz 13837: the <code xmlns=
13838: "http://www.w3.org/TR/xhtml1/transitional" class=
13839: "filename">libdata/gtk-2.0</code> directory, as
13840: they will be handled automatically.</p>
1.1 grant 13841: </li>
13842: </ol>
13843: </div>
13844: </div>
13845:
1.59 rillig 13846: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13847: <div class="titlepage">
13848: <div>
13849: <div>
1.59 rillig 13850: <h3 class="title"><a name="sgml-xml-data" id=
1.57 minskim 13851: "sgml-xml-data"></a>15.5.13. Packages
1.30 wiz 13852: installing SGML or XML data</h3>
1.1 grant 13853: </div>
13854: </div>
13855: </div>
13856:
13857: <p>If a package installs SGML or XML data files that
13858: need to be registered in system-wide catalogs (like
13859: DTDs, sub-catalogs, etc.), you need to take some extra
13860: steps:</p>
13861:
13862: <div class="orderedlist">
13863: <ol type="1">
13864: <li>
1.45 wiz 13865: <p>Include <code xmlns=
13866: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13867: "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
1.45 wiz 13868: in your <code xmlns=
13869: "http://www.w3.org/TR/xhtml1/transitional" class=
13870: "filename">Makefile</code>, which takes care of
13871: registering those files in system-wide catalogs
13872: at installation and deinstallation time.</p>
1.1 grant 13873: </li>
13874:
13875: <li>
1.14 xtraeme 13876: <p>Set <code class="varname">SGML_CATALOGS</code>
13877: to the full path of any SGML catalogs installed
13878: by the package.</p>
1.1 grant 13879: </li>
13880:
13881: <li>
1.14 xtraeme 13882: <p>Set <code class="varname">XML_CATALOGS</code>
13883: to the full path of any XML catalogs installed by
1.1 grant 13884: the package.</p>
13885: </li>
13886:
13887: <li>
1.14 xtraeme 13888: <p>Set <code class="varname">SGML_ENTRIES</code>
13889: to individual entries to be added to the SGML
1.1 grant 13890: catalog. These come in groups of three strings;
13891: see xmlcatmgr(1) for more information
13892: (specifically, arguments recognized by the 'add'
13893: action). Note that you will normally not use this
13894: variable.</p>
13895: </li>
13896:
13897: <li>
1.14 xtraeme 13898: <p>Set <code class="varname">XML_ENTRIES</code>
13899: to individual entries to be added to the XML
1.1 grant 13900: catalog. These come in groups of three strings;
13901: see xmlcatmgr(1) for more information
13902: (specifically, arguments recognized by the 'add'
13903: action). Note that you will normally not use this
13904: variable.</p>
13905: </li>
13906: </ol>
13907: </div>
13908: </div>
13909:
1.59 rillig 13910: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13911: <div class="titlepage">
13912: <div>
13913: <div>
1.59 rillig 13914: <h3 class="title"><a name="mime-database" id=
1.57 minskim 13915: "mime-database"></a>15.5.14. Packages
1.30 wiz 13916: installing extensions to the MIME database</h3>
1.1 grant 13917: </div>
13918: </div>
13919: </div>
13920:
13921: <p>If a package provides extensions to the MIME
1.45 wiz 13922: database by installing <code xmlns=
13923: "http://www.w3.org/TR/xhtml1/transitional" class=
13924: "filename">.xml</code> files inside <code xmlns=
13925: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13926: "filename">${PREFIX}/share/mime/packages</code>, you
13927: need to take some extra steps to ensure that the
13928: database is kept consistent with respect to these new
13929: files:</p>
1.1 grant 13930:
13931: <div class="orderedlist">
13932: <ol type="1">
13933: <li>
1.45 wiz 13934: <p>Include <code xmlns=
13935: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13936: "filename">../../databases/shared-mime-info/mimedb.mk</code>
1.45 wiz 13937: (avoid using the <code xmlns=
13938: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13939: "filename">buildlink3.mk</code> file from this
13940: same directory, which is reserved for inclusion
1.45 wiz 13941: from other <code xmlns=
13942: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13943: "filename">buildlink3.mk</code> files). It takes
13944: care of rebuilding the MIME database at
13945: installation and deinstallation time, and
13946: disallows any access to it directly from the
1.1 grant 13947: package.</p>
13948: </li>
13949:
13950: <li>
13951: <p>Check the PLIST and remove any entries under
1.45 wiz 13952: the <code xmlns=
13953: "http://www.w3.org/TR/xhtml1/transitional" class=
13954: "filename">share/mime</code> directory,
13955: <span class="emphasis"><em>except</em></span> for
13956: files saved under <code xmlns=
13957: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13958: "filename">share/mime/packages</code>. The former
1.1 grant 13959: are handled automatically by the
1.47 reed 13960: update-mime-database program, but the latter are
1.1 grant 13961: package-dependent and must be removed by the
13962: package that installed them in the first
13963: place.</p>
13964: </li>
13965:
13966: <li>
1.45 wiz 13967: <p>Remove any <code xmlns=
13968: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13969: "filename">share/mime/*</code> directories from
13970: the PLIST. They will be handled by the
1.1 grant 13971: shared-mime-info package.</p>
13972: </li>
13973: </ol>
13974: </div>
13975: </div>
13976:
1.59 rillig 13977: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 13978: <div class="titlepage">
13979: <div>
13980: <div>
1.59 rillig 13981: <h3 class="title"><a name="intltool" id=
1.57 minskim 13982: "intltool"></a>15.5.15. Packages using
1.1 grant 13983: intltool</h3>
13984: </div>
13985: </div>
13986: </div>
13987:
13988: <p>If a package uses intltool during its build, include
1.45 wiz 13989: the <code xmlns=
13990: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13991: "filename">../../textproc/intltool/buildlink3.mk</code>
1.1 grant 13992: file, which forces it to use the intltool package
13993: provided by pkgsrc, instead of the one bundled with the
13994: distribution file.</p>
13995:
13996: <p>This tracks intltool's build-time dependencies and
13997: uses the latest available version; this way, the
13998: package benefits of any bug fixes that may have
13999: appeared since it was released.</p>
14000: </div>
1.18 xtraeme 14001:
1.59 rillig 14002: <div class="sect2" lang="en" xml:lang="en">
1.18 xtraeme 14003: <div class="titlepage">
14004: <div>
14005: <div>
1.59 rillig 14006: <h3 class="title"><a name="startup-scripts" id=
1.57 minskim 14007: "startup-scripts"></a>15.5.16. Packages
1.30 wiz 14008: installing startup scripts</h3>
1.18 xtraeme 14009: </div>
14010: </div>
14011: </div>
14012:
14013: <p>If a package contains a rc.d script, it won't be
14014: copied into the startup directory by default, but you
14015: can enable it, by adding the option <code class=
1.45 wiz 14016: "varname">PKG_RCD_SCRIPTS=YES</code> in <code xmlns=
14017: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 14018: "filename">/etc/mk.conf</code>. This option will copy
1.45 wiz 14019: the scripts into <code xmlns=
14020: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 14021: "filename">/etc/rc.d</code> when a package is
14022: installed, and it will automatically remove the scripts
14023: when the package is deinstalled.</p>
14024: </div>
1.57 minskim 14025:
1.59 rillig 14026: <div class="sect2" lang="en" xml:lang="en">
1.57 minskim 14027: <div class="titlepage">
14028: <div>
14029: <div>
1.59 rillig 14030: <h3 class="title"><a name="tex-packages" id=
1.57 minskim 14031: "tex-packages"></a>15.5.17. Packages
14032: installing TeX modules</h3>
14033: </div>
14034: </div>
14035: </div>
14036:
14037: <p>If a package installs TeX packages into the texmf
14038: tree, the <code xmlns=
14039: "http://www.w3.org/TR/xhtml1/transitional" class=
14040: "filename">ls-R</code> database of the tree needs to be
14041: updated.</p>
14042:
14043: <div class="note" style=
14044: "margin-left: 0.5in; margin-right: 0.5in;">
14045: <h3 class="title">Note</h3>
14046:
14047: <p>Except the main TeX packages such as teTeX-texmf,
14048: packages should install files into <code class=
14049: "varname">PKG_LOCALTEXMFPREFIX</code>, not
14050: <code class="varname">PKG_TEXMFPREFIX</code>.</p>
14051: </div>
14052:
14053: <div class="orderedlist">
14054: <ol type="1">
14055: <li>
14056: <p>Include <code xmlns=
14057: "http://www.w3.org/TR/xhtml1/transitional" class=
14058: "filename">../../print/teTeX/module.mk</code>
14059: instead of <code xmlns=
14060: "http://www.w3.org/TR/xhtml1/transitional" class=
14061: "filename">../../mk/tex.buildlink3.mk</code>.
14062: This takes care of rebuilding the <code xmlns=
14063: "http://www.w3.org/TR/xhtml1/transitional" class=
14064: "filename">ls-R</code> database at installation
14065: and deinstallation time.</p>
14066: </li>
14067:
14068: <li>
14069: <p>If your package installs files into a texmf
14070: tree other than the one at <code class=
14071: "varname">PKG_LOCALTEXMFPREFIX</code>, set
14072: <code class="varname">TEXMFDIRS</code> to the
14073: list of all texmf trees that need database
14074: update.</p>
14075: </li>
14076:
14077: <li>
14078: <p>Make sure that none of <code xmlns=
14079: "http://www.w3.org/TR/xhtml1/transitional" class=
14080: "filename">ls-R</code> databases are included in
14081: <code xmlns=
14082: "http://www.w3.org/TR/xhtml1/transitional" class=
14083: "filename">PLIST</code>, as they will be removed
14084: only by the teTeX-bin package.</p>
14085: </li>
14086: </ol>
14087: </div>
14088: </div>
1.1 grant 14089: </div>
14090:
1.59 rillig 14091: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 14092: <div class="titlepage">
14093: <div>
14094: <div>
14095: <h2 class="title" style="clear: both"><a name=
1.59 rillig 14096: "feedback-to-author" id=
1.38 dillo 14097: "feedback-to-author"></a>15.6. Feedback to the
1.30 wiz 14098: author</h2>
1.1 grant 14099: </div>
14100: </div>
14101: </div>
14102:
14103: <p>If you have found any bugs in the package you make
14104: available, if you had to do special steps to make it run
14105: under NetBSD or if you enhanced the software in various
14106: other ways, be sure to report these changes back to the
14107: original author of the program! With that kind of
14108: support, the next release of the program can incorporate
14109: these fixes, and people not using the NetBSD packages
14110: system can win from your efforts.</p>
14111:
14112: <p>Support the idea of free software!</p>
14113: </div>
14114: </div>
14115:
1.59 rillig 14116: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 14117: <div class="titlepage">
14118: <div>
14119: <div>
1.59 rillig 14120: <h2 class="title"><a name="debug" id=
1.38 dillo 14121: "debug"></a>Chapter 16. Debugging</h2>
1.1 grant 14122: </div>
14123: </div>
14124: </div>
14125:
14126: <p>To check out all the gotchas when building a package,
14127: here are the steps that I do in order to get a package
14128: working. Please note this is basically the same as what was
14129: explained in the previous sections, only with some
14130: debugging aids.</p>
14131:
14132: <div class="itemizedlist">
14133: <ul type="disc">
14134: <li>
1.14 xtraeme 14135: <p>Be sure to set <code class=
1.45 wiz 14136: "varname">PKG_DEVELOPER=1</code> in <code xmlns=
14137: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14138: "filename">/etc/mk.conf</code></p>
1.1 grant 14139: </li>
14140:
14141: <li>
14142: <p>Install <a xmlns=
14143: "http://www.w3.org/TR/xhtml1/transitional" href=
14144: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 wiz 14145: target="_top"><code xmlns="" class=
14146: "filename">pkgtools/url2pkg</code></a>, create a
1.20 ben 14147: directory for a new package, change into it, then run
14148: <span><strong class=
14149: "command">url2pkg</strong></span>:</p>
1.1 grant 14150: <pre class="screen">
1.14 xtraeme 14151: <code class="prompt">%</code> <strong class=
14152: "userinput"><code>mkdir /usr/pkgsrc/<em class=
14153: "replaceable"><code>category</code></em>/<em class=
14154: "replaceable"><code>examplepkg</code></em></code></strong>
14155: <code class="prompt">%</code> <strong class=
14156: "userinput"><code>cd /usr/pkgsrc/<em class=
14157: "replaceable"><code>category</code></em>/<em class=
14158: "replaceable"><code>examplepkg</code></em></code></strong>
14159: <code class="prompt">%</code> <strong class=
14160: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1 grant 14161: </pre>
14162: </li>
14163:
14164: <li>
1.45 wiz 14165: <p>Edit the <code xmlns=
14166: "http://www.w3.org/TR/xhtml1/transitional" class=
14167: "filename">Makefile</code> as requested.</p>
1.1 grant 14168: </li>
14169:
14170: <li>
1.45 wiz 14171: <p>Fill in the <code xmlns=
14172: "http://www.w3.org/TR/xhtml1/transitional" class=
14173: "filename">DESCR</code> file</p>
1.1 grant 14174: </li>
14175:
14176: <li>
1.14 xtraeme 14177: <p>Run <span><strong class="command">make
14178: configure</strong></span></p>
1.1 grant 14179: </li>
14180:
14181: <li>
14182: <p>Add any dependencies glimpsed from documentation
1.45 wiz 14183: and the configure step to the package's <code xmlns=
14184: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14185: "filename">Makefile</code>.</p>
1.1 grant 14186: </li>
14187:
14188: <li>
14189: <p>Make the package compile, doing multiple rounds
14190: of</p>
14191: <pre class="screen">
1.14 xtraeme 14192: <code class="prompt">%</code> <strong class=
14193: "userinput"><code>make</code></strong>
14194: <code class="prompt">%</code> <strong class=
14195: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
14196: <code class="prompt">%</code> <strong class=
14197: "userinput"><code>mkpatches</code></strong>
14198: <code class="prompt">%</code> <strong class=
14199: "userinput"><code>patchdiff</code></strong>
14200: <code class="prompt">%</code> <strong class=
14201: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
14202: <code class="prompt">%</code> <strong class=
14203: "userinput"><code>make mps</code></strong>
14204: <code class="prompt">%</code> <strong class=
14205: "userinput"><code>make clean</code></strong>
1.1 grant 14206: </pre>
14207:
14208: <p>Doing as non-root user will ensure that no files
14209: are modified that shouldn't be, especially during the
1.14 xtraeme 14210: build phase. <span><strong class=
14211: "command">mkpatches</strong></span>,
14212: <span><strong class=
14213: "command">patchdiff</strong></span> and
14214: <span><strong class="command">pkgvi</strong></span>
14215: are from the <a xmlns=
1.1 grant 14216: "http://www.w3.org/TR/xhtml1/transitional" href=
14217: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 14218: target="_top"><code xmlns="" class=
14219: "filename">pkgtools/pkgdiff</code></a> package.</p>
1.1 grant 14220: </li>
14221:
14222: <li>
1.45 wiz 14223: <p>Look at the <code xmlns=
14224: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14225: "filename">Makefile</code>, fix if necessary; see
14226: <a href="#components.Makefile" title=
1.38 dillo 14227: "8.1. Makefile">Section 8.1,
1.45 wiz 14228: “<code xmlns=
14229: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14230: "filename">Makefile</code>”</a>.</p>
1.1 grant 14231: </li>
14232:
14233: <li>
1.45 wiz 14234: <p>Generate a <code xmlns=
14235: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14236: "filename">PLIST</code>:</p>
1.1 grant 14237: <pre class="screen">
1.14 xtraeme 14238: <code class="prompt">#</code> <strong class=
14239: "userinput"><code>make install</code></strong>
14240: <code class="prompt">#</code> <strong class=
14241: "userinput"><code>make print-PLIST >PLIST</code></strong>
14242: <code class="prompt">#</code> <strong class=
14243: "userinput"><code>make deinstall</code></strong>
14244: <code class="prompt">#</code> <strong class=
14245: "userinput"><code>make install</code></strong>
14246: <code class="prompt">#</code> <strong class=
14247: "userinput"><code>make deinstall</code></strong>
1.1 grant 14248: </pre>
14249:
1.45 wiz 14250: <p>You usually need to be <code xmlns=
14251: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14252: "username">root</code> to do this. Look if there are
1.1 grant 14253: any files left:</p>
14254: <pre class="screen">
1.14 xtraeme 14255: <code class="prompt">#</code> <strong class=
14256: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 14257: </pre>
14258:
14259: <p>If this reveals any files that are missing in
1.45 wiz 14260: <code xmlns=
14261: "http://www.w3.org/TR/xhtml1/transitional" class=
14262: "filename">PLIST</code>, add them.</p>
1.1 grant 14263: </li>
14264:
14265: <li>
1.45 wiz 14266: <p>Now that the <code xmlns=
14267: "http://www.w3.org/TR/xhtml1/transitional" class=
14268: "filename">PLIST</code> is OK, install the package
14269: again and make a binary package:</p>
1.1 grant 14270: <pre class="screen">
1.14 xtraeme 14271: <code class="prompt">#</code> <strong class=
14272: "userinput"><code>make reinstall</code></strong>
14273: <code class="prompt">#</code> <strong class=
14274: "userinput"><code>make package</code></strong>
1.1 grant 14275: </pre>
14276: </li>
14277:
14278: <li>
14279: <p>Delete the installed package:</p>
14280: <pre class="screen">
1.14 xtraeme 14281: <code class="prompt">#</code> <strong class=
14282: "userinput"><code>pkg_delete blub</code></strong>
1.1 grant 14283: </pre>
14284: </li>
14285:
14286: <li>
1.14 xtraeme 14287: <p>Repeat the above <span><strong class=
14288: "command">make print-PLIST</strong></span> command,
14289: which shouldn't find anything now:</p>
1.1 grant 14290: <pre class="screen">
1.14 xtraeme 14291: <code class="prompt">#</code> <strong class=
14292: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 14293: </pre>
14294: </li>
14295:
14296: <li>
14297: <p>Reinstall the binary package:</p>
14298: <pre class="screen">
1.14 xtraeme 14299: <code class="prompt">#</code> <strong class=
14300: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1 grant 14301: </pre>
14302: </li>
14303:
14304: <li>
14305: <p>Play with it. Make sure everything works.</p>
14306: </li>
14307:
14308: <li>
1.14 xtraeme 14309: <p>Run <span><strong class=
14310: "command">pkglint</strong></span> from <a xmlns=
1.1 grant 14311: "http://www.w3.org/TR/xhtml1/transitional" href=
14312: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 14313: target="_top"><code xmlns="" class=
14314: "filename">pkgtools/pkglint</code></a>, and fix the
1.20 ben 14315: problems it reports:</p>
1.1 grant 14316: <pre class="screen">
1.14 xtraeme 14317: <code class="prompt">#</code> <strong class=
14318: "userinput"><code>pkglint</code></strong>
1.1 grant 14319: </pre>
14320: </li>
14321:
14322: <li>
14323: <p>Submit (or commit, if you have cvs access); see
14324: <a href="#submit" title=
1.38 dillo 14325: "Chapter 17. Submitting and Committing">Chapter 17,
1.1 grant 14326: <i>Submitting and Committing</i></a>.</p>
14327: </li>
14328: </ul>
14329: </div>
14330: </div>
14331:
1.59 rillig 14332: <div class="chapter" lang="en" xml:lang="en">
1.1 grant 14333: <div class="titlepage">
14334: <div>
14335: <div>
1.59 rillig 14336: <h2 class="title"><a name="submit" id=
1.38 dillo 14337: "submit"></a>Chapter 17. Submitting and
1.1 grant 14338: Committing</h2>
14339: </div>
14340: </div>
14341: </div>
14342:
14343: <div class="toc">
14344: <p><b>Table of Contents</b></p>
14345:
14346: <dl>
1.30 wiz 14347: <dt><span class="sect1"><a href=
1.38 dillo 14348: "#submitting-your-package">17.1. Submitting your
1.30 wiz 14349: packages</a></span></dt>
1.1 grant 14350:
1.30 wiz 14351: <dt><span class="sect1"><a href=
1.41 wiz 14352: "#general-notes-for-changes">17.2. General notes when
14353: adding, updating, or removing packages</a></span></dt>
14354:
14355: <dt><span class="sect1"><a href=
14356: "#committing-importing">17.3. Committing: Importing a
1.30 wiz 14357: package into CVS</a></span></dt>
1.1 grant 14358:
1.30 wiz 14359: <dt><span class="sect1"><a href=
1.41 wiz 14360: "#updating-package">17.4. Updating a package to a newer
1.30 wiz 14361: version</a></span></dt>
1.1 grant 14362:
1.41 wiz 14363: <dt><span class="sect1"><a href="#moving-package">17.5.
1.2 hubertf 14364: Moving a package in pkgsrc</a></span></dt>
1.1 grant 14365: </dl>
14366: </div>
14367:
1.59 rillig 14368: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 14369: <div class="titlepage">
14370: <div>
14371: <div>
14372: <h2 class="title" style="clear: both"><a name=
1.59 rillig 14373: "submitting-your-package" id=
1.38 dillo 14374: "submitting-your-package"></a>17.1. Submitting
1.30 wiz 14375: your packages</h2>
1.1 grant 14376: </div>
14377: </div>
14378: </div>
14379:
14380: <p>You have to separate between binary and
14381: “<span class="quote">normal</span>” (source)
14382: packages here:</p>
14383:
14384: <div class="itemizedlist">
14385: <ul type="disc">
14386: <li>
14387: <p>precompiled binary packages</p>
14388:
14389: <p>Our policy is that we accept binaries only from
14390: pkgsrc developers to guarantee that the packages
14391: don't contain any trojan horses etc. This is not to
1.13 hubertf 14392: annoy anyone but rather to protect our users!
1.1 grant 14393: You're still free to put up your home-made binary
1.13 hubertf 14394: packages and tell the world where to get them.
14395: NetBSD developers doing bulk builds and wanting to
14396: upload them please see <a href="#bulk-upload"
1.38 dillo 14397: title="6.3.8. Uploading results of a bulk build">
14398: Section 6.3.8, “Uploading results of a
1.13 hubertf 14399: bulk build”</a>.</p>
1.1 grant 14400: </li>
14401:
14402: <li>
14403: <p>packages</p>
14404:
14405: <p>First, check that your package is complete,
14406: compiles and runs well; see <a href="#debug" title=
1.38 dillo 14407: "Chapter 16. Debugging">Chapter 16,
1.1 grant 14408: <i>Debugging</i></a> and the rest of this document.
1.24 wiz 14409: Next, generate an uuencoded gzipped <a href=
14410: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
14411: <span class="citerefentry"><span class=
14412: "refentrytitle">tar</span>(1)</span></a> archive,
1.1 grant 14413: preferably with all files in a single directory.
1.14 xtraeme 14414: Finally, <span><strong class=
14415: "command">send-pr</strong></span> with category
1.1 grant 14416: “<span class="quote">pkg</span>”, a
14417: synopsis which includes the package name and
14418: version number, a short description of your package
14419: (contents of the COMMENT variable or DESCR file are
14420: OK) and attach the archive to your PR.</p>
14421:
14422: <p>If you want to submit several packages, please
14423: send a separate PR for each one, it's easier for us
14424: to track things that way.</p>
14425:
14426: <p>Alternatively, you can also import new packages
14427: into pkgsrc-wip (“<span class="quote">pkgsrc
14428: work-in-progress</span>”); see the homepage
14429: at <a href="http://pkgsrc-wip.sourceforge.net/"
14430: target=
14431: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
14432: details.</p>
14433: </li>
14434: </ul>
14435: </div>
14436: </div>
14437:
1.59 rillig 14438: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 14439: <div class="titlepage">
14440: <div>
14441: <div>
14442: <h2 class="title" style="clear: both"><a name=
1.59 rillig 14443: "general-notes-for-changes" id=
1.41 wiz 14444: "general-notes-for-changes"></a>17.2. General
14445: notes when adding, updating, or removing
14446: packages</h2>
14447: </div>
14448: </div>
14449: </div>
14450:
14451: <p>Please note all package additions, updates, moves, and
1.45 wiz 14452: removals in <code xmlns=
14453: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 14454: "filename">pkgsrc/doc/CHANGES</code>. It's very important
14455: to keep this file up to date and conforming to the
14456: existing format, because it will be used by scripts to
14457: automatically update pages on <a href=
14458: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
1.45 wiz 14459: and other sites. Additionally, check the <code xmlns=
14460: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 14461: "filename">pkgsrc/doc/TODO</code> file and remove the
14462: entry for the package you updated or removed, in case it
14463: was mentioned there.</p>
14464:
14465: <p>There is a make target that helps in creating proper
1.45 wiz 14466: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14467: class="filename">CHANGES</code> entries:
1.41 wiz 14468: <span><strong class="command">make
14469: changes-entry</strong></span>. It uses the optional
14470: <code class="varname">CTYPE</code> and <code class=
14471: "varname">NETBSD_LOGIN_NAME</code> variables. The general
1.45 wiz 14472: usage is to first make sure that your <code xmlns=
14473: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 14474: "filename">CHANGES</code> file is up-to-date (to avoid
14475: having to resolve conflicts later-on) and then to
14476: <span><strong class="command">cd</strong></span> to the
14477: package directory. For package updates,
14478: <span><strong class="command">make
14479: changes-entry</strong></span> is enough. For new
14480: packages, or package moves or removals, set the
14481: <code class="varname">CTYPE</code> variable on the
14482: command line to "Added", "Moved", or "Removed". You can
14483: set <code class="varname">NETBSD_LOGIN_NAME</code> in
1.45 wiz 14484: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14485: class="filename">/etc/mk.conf</code> if your local login
14486: name is not the same as your NetBSD login name. Don't
14487: forget to commit the changes to <code xmlns=
14488: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 14489: "filename">pkgsrc/doc/CHANGES</code>!</p>
14490: </div>
14491:
1.59 rillig 14492: <div class="sect1" lang="en" xml:lang="en">
1.41 wiz 14493: <div class="titlepage">
14494: <div>
14495: <div>
14496: <h2 class="title" style="clear: both"><a name=
1.59 rillig 14497: "committing-importing" id=
1.41 wiz 14498: "committing-importing"></a>17.3. Committing:
1.30 wiz 14499: Importing a package into CVS</h2>
1.1 grant 14500: </div>
14501: </div>
14502: </div>
14503:
14504: <p>This section is only of interest for pkgsrc developers
14505: with write access to the pkgsrc repository. Please
14506: remember that cvs imports files relative to the current
14507: working directory, and that the pathname that you give
1.14 xtraeme 14508: the <span><strong class="command">cvs
14509: import</strong></span> command is so that it knows where
14510: to place the files in the repository. Newly created
14511: packages should be imported with a vendor tag of
14512: “<span class="quote">TNF</span>” and a
14513: release tag of “<span class=
14514: "quote">pkgsrc-base</span>”, e.g:</p>
1.1 grant 14515: <pre class="programlisting">
1.51 rillig 14516: <code class="prompt">$</code> cd .../pkgsrc/category/pkgname
14517: <code class=
14518: "prompt">$</code> cvs import pkgsrc/category/pkgname TNF pkgsrc-base
1.1 grant 14519: </pre>
14520:
14521: <p>Remember to move the directory from which you imported
14522: out of the way, or cvs will complain the next time you
14523: “<span class="quote">cvs update</span>” your
14524: source tree. Also don't forget to add the new package to
1.45 wiz 14525: the category's <code xmlns=
14526: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14527: "filename">Makefile</code>.</p>
1.1 grant 14528:
14529: <p>The commit message of the initial import should
1.45 wiz 14530: include part of the <code xmlns=
14531: "http://www.w3.org/TR/xhtml1/transitional" class=
14532: "filename">DESCR</code> file, so people reading the
14533: mailing lists know what the package is/does.</p>
1.1 grant 14534:
14535: <p>For new packages, “<span class="quote">cvs
14536: import</span>” is preferred to “<span class=
14537: "quote">cvs add</span>” because the former gets
14538: everything with a single command, and provides a
14539: consistent tag.</p>
14540: </div>
14541:
1.59 rillig 14542: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 14543: <div class="titlepage">
14544: <div>
14545: <div>
14546: <h2 class="title" style="clear: both"><a name=
1.59 rillig 14547: "updating-package" id=
1.41 wiz 14548: "updating-package"></a>17.4. Updating a
1.30 wiz 14549: package to a newer version</h2>
1.1 grant 14550: </div>
14551: </div>
14552: </div>
14553:
14554: <p>Please always put a concise, appropriate and relevant
14555: summary of the changes between old and new versions into
14556: the commit log when updating a package. There are various
14557: reasons for this:</p>
14558:
14559: <div class="itemizedlist">
14560: <ul type="disc">
14561: <li>
14562: <p>A URL is volatile, and can change over time. It
14563: may go away completely or its information may be
14564: overwritten by newer information.</p>
14565: </li>
14566:
14567: <li>
14568: <p>Having the change information between old and
14569: new versions in our CVS repository is very useful
14570: for people who use either cvs or anoncvs.</p>
14571: </li>
14572:
14573: <li>
14574: <p>Having the change information between old and
14575: new versions in our CVS repository is very useful
14576: for people who read the pkgsrc-changes mailing
14577: list, so that they can make tactical decisions
14578: about when to upgrade the package.</p>
14579: </li>
14580: </ul>
14581: </div>
14582:
1.18 xtraeme 14583: <p>Please also recognize that, just because a new version
1.1 grant 14584: of a package has been released, it should not
14585: automatically be upgraded in the CVS repository. We
14586: prefer to be conservative in the packages that are
14587: included in pkgsrc - development or beta packages are not
14588: really the best thing for most places in which pkgsrc is
14589: used. Please use your judgement about what should go into
14590: pkgsrc, and bear in mind that stability is to be
14591: preferred above new and possibly untested features.</p>
14592: </div>
14593:
1.59 rillig 14594: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 14595: <div class="titlepage">
14596: <div>
14597: <div>
14598: <h2 class="title" style="clear: both"><a name=
1.59 rillig 14599: "moving-package" id=
1.41 wiz 14600: "moving-package"></a>17.5. Moving a package in
1.30 wiz 14601: pkgsrc</h2>
1.1 grant 14602: </div>
14603: </div>
14604: </div>
14605:
14606: <div class="orderedlist">
14607: <ol type="1">
14608: <li>
14609: <p>Make a copy of the directory somewhere else.</p>
14610: </li>
14611:
14612: <li>
14613: <p>Remove all CVS dirs.</p>
14614:
14615: <p>Alternatively to the first two steps you can
14616: also do:</p>
14617: <pre class="screen">
1.14 xtraeme 14618: <code class="prompt">%</code> <strong class=
14619: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1 grant 14620: </pre>
14621:
14622: <p>and use that for further work.</p>
14623: </li>
14624:
14625: <li>
1.14 xtraeme 14626: <p>Fix <code class="varname">CATEGORIES</code> and
14627: any <code class="varname">DEPENDS</code> paths that
14628: just did “<span class=
1.1 grant 14629: "quote">../package</span>” instead of
14630: “<span class=
14631: "quote">../../category/package</span>”.</p>
14632: </li>
14633:
14634: <li>
1.14 xtraeme 14635: <p><span><strong class="command">cvs
14636: import</strong></span> the modified package in the
14637: new place.</p>
1.1 grant 14638: </li>
14639:
14640: <li>
14641: <p>Check if any package depends on it:</p>
14642: <pre class="screen">
1.14 xtraeme 14643: <code class="prompt">%</code> <strong class=
14644: "userinput"><code>cd /usr/pkgsrc</code></strong>
14645: <code class="prompt">%</code> <strong class=
14646: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1 grant 14647: </pre>
14648: </li>
14649:
14650: <li>
14651: <p>Fix paths in packages from step 5 to point to
14652: new location.</p>
14653: </li>
14654:
14655: <li>
1.14 xtraeme 14656: <p><span><strong class="command">cvs rm
14657: (-f)</strong></span> the package at the old
14658: location.</p>
1.1 grant 14659: </li>
14660:
14661: <li>
1.45 wiz 14662: <p>Remove from <code xmlns=
14663: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14664: "filename">oldcategory/Makefile</code>.</p>
1.1 grant 14665: </li>
14666:
14667: <li>
1.45 wiz 14668: <p>Add to <code xmlns=
14669: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14670: "filename">newcategory/Makefile</code>.</p>
1.1 grant 14671: </li>
14672:
14673: <li>
14674: <p>Commit the changed and removed files:</p>
14675: <pre class="screen">
1.14 xtraeme 14676: <code class="prompt">%</code> <strong class=
14677: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1 grant 14678: </pre>
14679:
14680: <p>(and any packages from step 5, of course).</p>
14681: </li>
14682: </ol>
14683: </div>
14684: </div>
14685: </div>
14686: </div>
14687:
1.59 rillig 14688: <div class="appendix" lang="en" xml:lang="en">
1.1 grant 14689: <div class="titlepage">
14690: <div>
14691: <div>
1.59 rillig 14692: <h2 class="title"><a name="examples" id=
1.46 gdt 14693: "examples"></a>Appendix A. A simple example
1.1 grant 14694: package: bison</h2>
14695: </div>
14696: </div>
14697: </div>
14698:
14699: <div class="toc">
14700: <p><b>Table of Contents</b></p>
14701:
14702: <dl>
1.46 gdt 14703: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 14704: files</a></span></dt>
14705:
14706: <dd>
14707: <dl>
1.30 wiz 14708: <dt><span class="sect2"><a href=
1.46 gdt 14709: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 14710:
1.30 wiz 14711: <dt><span class="sect2"><a href=
1.46 gdt 14712: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 14713:
1.30 wiz 14714: <dt><span class="sect2"><a href=
1.46 gdt 14715: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 14716:
1.30 wiz 14717: <dt><span class="sect2"><a href=
1.46 gdt 14718: "#checking-package-with-pkglint">A.1.4. Checking a
1.30 wiz 14719: package with <span><strong class=
1.14 xtraeme 14720: "command">pkglint</strong></span></a></span></dt>
1.1 grant 14721: </dl>
14722: </dd>
14723:
1.46 gdt 14724: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30 wiz 14725: Steps for building, installing, packaging</a></span></dt>
1.1 grant 14726: </dl>
14727: </div>
14728:
14729: <p>We checked to find a piece of software that wasn't in the
14730: packages collection, and picked GNU bison. Quite why someone
1.14 xtraeme 14731: would want to have <span><strong class=
14732: "command">bison</strong></span> when Berkeley
14733: <span><strong class="command">yacc</strong></span> is already
14734: present in the tree is beyond us, but it's useful for the
14735: purposes of this exercise.</p>
1.1 grant 14736:
1.59 rillig 14737: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 14738: <div class="titlepage">
14739: <div>
14740: <div>
14741: <h2 class="title" style="clear: both"><a name=
1.59 rillig 14742: "example-files" id=
1.46 gdt 14743: "example-files"></a>A.1. files</h2>
1.1 grant 14744: </div>
14745: </div>
14746: </div>
14747:
1.59 rillig 14748: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 14749: <div class="titlepage">
14750: <div>
14751: <div>
1.59 rillig 14752: <h3 class="title"><a name="example-Makefile" id=
1.46 gdt 14753: "example-Makefile"></a>A.1.1. Makefile</h3>
1.1 grant 14754: </div>
14755: </div>
14756: </div>
14757: <pre class="programlisting">
1.51 rillig 14758: # $NetBSD$
14759: #
1.1 grant 14760:
1.51 rillig 14761: DISTNAME= bison-1.25
14762: CATEGORIES= devel
14763: MASTER_SITES= ${MASTER_SITE_GNU}
1.1 grant 14764:
1.51 rillig 14765: MAINTAINER= thorpej@NetBSD.org
14766: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
14767: COMMENT= GNU yacc clone
1.1 grant 14768:
1.51 rillig 14769: GNU_CONFIGURE= yes
14770: INFO_FILES= bison.info
1.1 grant 14771:
1.51 rillig 14772: .include "../../mk/bsd.pkg.mk"
1.1 grant 14773: </pre>
14774: </div>
14775:
1.59 rillig 14776: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 14777: <div class="titlepage">
14778: <div>
14779: <div>
1.59 rillig 14780: <h3 class="title"><a name="example-descr" id=
1.46 gdt 14781: "example-descr"></a>A.1.2. DESCR</h3>
1.1 grant 14782: </div>
14783: </div>
14784: </div>
14785: <pre class="programlisting">
1.51 rillig 14786: GNU version of yacc. Can make re-entrant parsers, and numerous other
14787: improvements. Why you would want this when Berkeley <a href=
1.1 grant 14788: "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 14789: of the NetBSD source tree is beyond me.
1.1 grant 14790: </pre>
14791: </div>
14792:
1.59 rillig 14793: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 14794: <div class="titlepage">
14795: <div>
14796: <div>
1.59 rillig 14797: <h3 class="title"><a name="example-plist" id=
1.46 gdt 14798: "example-plist"></a>A.1.3. PLIST</h3>
1.1 grant 14799: </div>
14800: </div>
14801: </div>
14802: <pre class="programlisting">
1.51 rillig 14803: @comment $NetBSD$
14804: bin/bison
14805: man/man1/bison.1.gz
14806: share/bison.simple
14807: share/bison.hairy
1.1 grant 14808: </pre>
14809: </div>
14810:
1.59 rillig 14811: <div class="sect2" lang="en" xml:lang="en">
1.1 grant 14812: <div class="titlepage">
14813: <div>
14814: <div>
1.30 wiz 14815: <h3 class="title"><a name=
1.59 rillig 14816: "checking-package-with-pkglint" id=
1.46 gdt 14817: "checking-package-with-pkglint"></a>A.1.4. Checking
1.30 wiz 14818: a package with <span><strong class=
1.14 xtraeme 14819: "command">pkglint</strong></span></h3>
1.1 grant 14820: </div>
14821: </div>
14822: </div>
14823:
14824: <p>The NetBSD package system comes with <a xmlns=
14825: "http://www.w3.org/TR/xhtml1/transitional" href=
14826: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 14827: target="_top"><code xmlns="" class=
14828: "filename">pkgtools/pkglint</code></a> which helps to
14829: check the contents of these files. After installation it
14830: is quite easy to use, just change to the directory of the
1.20 ben 14831: package you wish to examine and execute
14832: <span><strong class=
14833: "command">pkglint</strong></span>:</p>
1.1 grant 14834: <pre class="screen">
1.14 xtraeme 14835: <code class="prompt">$</code> <strong class=
14836: "userinput"><code>pkglint</code></strong>
1.1 grant 14837: looks fine.
14838: </pre>
14839:
14840: <p>Depending on the supplied command line arguments (see
1.60 ! rillig 14841: pkglint(1)), more checks will be performed. Use e.g.
! 14842: <span><strong class="command">pkglint -Call
! 14843: -Wall</strong></span> for a very thorough check.</p>
1.1 grant 14844: </div>
14845: </div>
14846:
1.59 rillig 14847: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 14848: <div class="titlepage">
14849: <div>
14850: <div>
14851: <h2 class="title" style="clear: both"><a name=
1.59 rillig 14852: "steps-for-b-i-p" id=
1.46 gdt 14853: "steps-for-b-i-p"></a>A.2. Steps for building,
1.30 wiz 14854: installing, packaging</h2>
1.1 grant 14855: </div>
14856: </div>
14857: </div>
14858:
14859: <p>Create the directory where the package lives, plus any
14860: auxiliary directories:</p>
14861: <pre class="screen">
1.14 xtraeme 14862: <code class="prompt">#</code> <strong class=
14863: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
14864: <code class="prompt">#</code> <strong class=
14865: "userinput"><code>mkdir bison</code></strong>
14866: <code class="prompt">#</code> <strong class=
14867: "userinput"><code>cd bison</code></strong>
14868: <code class="prompt">#</code> <strong class=
14869: "userinput"><code>mkdir patches</code></strong>
1.1 grant 14870: </pre>
14871:
1.45 wiz 14872: <p>Create <code xmlns=
14873: "http://www.w3.org/TR/xhtml1/transitional" class=
14874: "filename">Makefile</code>, <code xmlns=
14875: "http://www.w3.org/TR/xhtml1/transitional" class=
14876: "filename">DESCR</code> and <code xmlns=
14877: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14878: "filename">PLIST</code> (see <a href="#components" title=
1.38 dillo 14879: "Chapter 8. Package components - files, directories and contents">
1.59 rillig 14880: Chapter 8, <i>Package components - files, directories and
14881: contents</i></a>) then continue with fetching the
1.1 grant 14882: distfile:</p>
14883: <pre class="screen">
1.14 xtraeme 14884: <code class="prompt">#</code> <strong class=
14885: "userinput"><code>make fetch</code></strong>
1.1 grant 14886: >> bison-1.25.tar.gz doesn't seem to exist on this system.
14887: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
14888: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
14889: ftp: Error retrieving file: 500 Internal error
14890:
14891: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
14892: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
14893: ftp: Error retrieving file: 500 Internal error
14894:
14895: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
14896: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
14897: Successfully retrieved file.
14898: </pre>
14899:
1.45 wiz 14900: <p>Generate the checksum of the distfile into <code xmlns=
14901: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14902: "filename">distinfo</code>:</p>
1.1 grant 14903: <pre class="screen">
1.14 xtraeme 14904: <code class="prompt">#</code> <strong class=
14905: "userinput"><code>make makesum</code></strong>
1.1 grant 14906: </pre>
14907:
14908: <p>Now compile:</p>
14909: <pre class="screen">
1.14 xtraeme 14910: <code class="prompt">#</code> <strong class=
14911: "userinput"><code>make</code></strong>
1.1 grant 14912: >> Checksum OK for bison-1.25.tar.gz.
14913: ===> Extracting for bison-1.25
14914: ===> Patching for bison-1.25
14915: ===> Ignoring empty patch directory
14916: ===> Configuring for bison-1.25
14917: creating cache ./config.cache
14918: checking for gcc... cc
14919: checking whether we are using GNU C... yes
14920: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
14921: checking how to run the C preprocessor... cc -E
14922: checking for minix/config.h... no
14923: checking for POSIXized ISC... no
14924: checking whether cross-compiling... no
14925: checking for ANSI C header files... yes
14926: checking for string.h... yes
14927: checking for stdlib.h... yes
14928: checking for memory.h... yes
14929: checking for working const... yes
14930: checking for working alloca.h... no
14931: checking for alloca... yes
14932: checking for strerror... yes
14933: updating cache ./config.cache
14934: creating ./config.status
14935: creating Makefile
14936: ===> Building for bison-1.25
14937: 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
14938: 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
14939: 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
14940: 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
14941: 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
14942: 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
14943: 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
14944: 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
14945: 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
14946: 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
14947: 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
14948: 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
14949: 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
14950: 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
14951: 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
14952: 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
14953: 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
14954: 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
14955: 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
14956: 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
14957: 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
14958: 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
14959: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
14960: rm -f bison.s1
14961: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
14962: </pre>
14963:
14964: <p>Everything seems OK, so install the files:</p>
14965: <pre class="screen">
1.14 xtraeme 14966: <code class="prompt">#</code> <strong class=
14967: "userinput"><code>make install</code></strong>
1.1 grant 14968: >> Checksum OK for bison-1.25.tar.gz.
14969: ===> Installing for bison-1.25
14970: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
14971: rm -f /usr/pkg/bin/bison
14972: cd /usr/pkg/share; rm -f bison.simple bison.hairy
14973: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
14974: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
14975: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
14976: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
14977: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
14978: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
14979: ===> Registering installation for bison-1.25
14980: </pre>
14981:
14982: <p>You can now use bison, and also - if you decide so -
1.14 xtraeme 14983: remove it with <span><strong class="command">pkg_delete
14984: bison</strong></span>. Should you decide that you want a
14985: binary package, do this now:</p>
1.1 grant 14986: <pre class="screen">
1.14 xtraeme 14987: <code class="prompt">#</code> <strong class=
14988: "userinput"><code>make package</code></strong>
1.1 grant 14989: >> Checksum OK for bison-1.25.tar.gz.
14990: ===> Building package for bison-1.25
14991: Creating package bison-1.25.tgz
14992: Registering depends:.
14993: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
14994: </pre>
14995:
14996: <p>Now that you don't need the source and object files any
14997: more, clean up:</p>
14998: <pre class="screen">
1.14 xtraeme 14999: <code class="prompt">#</code> <strong class=
15000: "userinput"><code>make clean</code></strong>
1.1 grant 15001: ===> Cleaning for bison-1.25
15002: </pre>
15003: </div>
15004: </div>
15005:
1.59 rillig 15006: <div class="appendix" lang="en" xml:lang="en">
1.1 grant 15007: <div class="titlepage">
15008: <div>
15009: <div>
1.59 rillig 15010: <h2 class="title"><a name="logs" id=
1.46 gdt 15011: "logs"></a>Appendix B. Build logs</h2>
1.1 grant 15012: </div>
15013: </div>
15014: </div>
15015:
15016: <div class="toc">
15017: <p><b>Table of Contents</b></p>
15018:
15019: <dl>
1.46 gdt 15020: <dt><span class="sect1"><a href="#logs.building">B.1.
1.1 grant 15021: Building figlet</a></span></dt>
15022:
1.46 gdt 15023: <dt><span class="sect1"><a href="#logs.package">B.2.
1.1 grant 15024: Packaging figlet</a></span></dt>
15025: </dl>
15026: </div>
15027:
1.59 rillig 15028: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 15029: <div class="titlepage">
15030: <div>
15031: <div>
15032: <h2 class="title" style="clear: both"><a name=
1.59 rillig 15033: "logs.building" id=
1.46 gdt 15034: "logs.building"></a>B.1. Building figlet</h2>
1.1 grant 15035: </div>
15036: </div>
15037: </div>
15038: <pre class="screen">
1.14 xtraeme 15039: <code class="prompt">#</code> <strong class=
15040: "userinput"><code>make</code></strong>
1.1 grant 15041: ===> Checking for vulnerabilities in figlet-2.2.1nb2
15042: => figlet221.tar.gz doesn't seem to exist on this system.
15043: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
15044: => [172219 bytes]
15045: Connected to ftp.plig.net.
15046: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
15047: 331 Guest login ok, send your complete e-mail address as password.
15048: 230-You are user #5 of 500 simultaneous users allowed.
15049: 230-
15050: 230- ___ _ _ _
15051: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
15052: 230- | _| _| . |_| . | | | . |_| . | _| . |
15053: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
15054: 230- |_| |_| |___| |___|
15055: 230-
15056: 230-** Welcome to ftp.plig.org **
15057: 230-
15058: 230-Please note that all transfers from this FTP site are logged. If you
15059: 230-do not like this, please disconnect now.
15060: 230-
15061: 230-This arhive is available via
15062: 230-
15063: 230-HTTP: http://ftp.plig.org/
15064: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
15065: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
15066: 230-
15067: 230-Please email comments, bug reports and requests for packages to be
15068: 230-mirrored to ftp-admin@plig.org.
15069: 230-
15070: 230-
15071: 230 Logged in anonymously.
15072: Remote system type is UNIX.
15073: Using binary mode to transfer files.
15074: 200 Type okay.
15075: 250 "/pub" is new cwd.
15076: 250-"/pub/figlet" is new cwd.
15077: 250-
15078: 250-Welcome to the figlet archive at ftp.figlet.org
15079: 250-
15080: 250- ftp://ftp.figlet.org/pub/figlet/
15081: 250-
15082: 250-The official FIGlet web page is:
15083: 250- http://www.figlet.org/
15084: 250-
15085: 250-If you have questions, please mailto:info@figlet.org. If you want to
15086: 250-contribute a font or something else, you can email us.
15087: 250
15088: 250 "/pub/figlet/program" is new cwd.
15089: 250 "/pub/figlet/program/unix" is new cwd.
15090: local: figlet221.tar.gz remote: figlet221.tar.gz
15091: 502 Unimplemented command.
15092: 227 Entering Passive Mode (195,40,6,41,246,104)
15093: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
15094: 38% |************** | 65800 64.16 KB/s 00:01 ETA
15095: 226 Transfer completed.
15096: 172219 bytes received in 00:02 (75.99 KB/s)
15097: 221 Goodbye.
15098: => Checksum OK for figlet221.tar.gz.
15099: ===> Extracting for figlet-2.2.1nb2
15100: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
15101: ===> Patching for figlet-2.2.1nb2
15102: ===> Applying pkgsrc patches for figlet-2.2.1nb2
15103: ===> Overriding tools for figlet-2.2.1nb2
15104: ===> Creating toolchain wrappers for figlet-2.2.1nb2
15105: ===> Configuring for figlet-2.2.1nb2
15106: ===> Building for figlet-2.2.1nb2
15107: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
15108: chmod a+x figlet
15109: gcc -O2 -o chkfont chkfont.c
15110: => Unwrapping files-to-be-installed.
1.14 xtraeme 15111: <code class="prompt">#</code>
15112: <code class="prompt">#</code> <strong class=
15113: "userinput"><code>make install</code></strong>
1.1 grant 15114: ===> Checking for vulnerabilities in figlet-2.2.1nb2
15115: ===> Installing for figlet-2.2.1nb2
15116: install -d -o root -g wheel -m 755 /usr/pkg/bin
15117: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
15118: mkdir -p /usr/pkg/share/figlet
15119: cp figlet /usr/pkg/bin
15120: cp chkfont /usr/pkg/bin
15121: chmod 555 figlist showfigfonts
15122: cp figlist /usr/pkg/bin
15123: cp showfigfonts /usr/pkg/bin
15124: cp fonts/*.flf /usr/pkg/share/figlet
15125: cp fonts/*.flc /usr/pkg/share/figlet
15126: cp figlet.6 /usr/pkg/man/man6
15127: ===> Registering installation for figlet-2.2.1nb2
1.14 xtraeme 15128: <code class="prompt">#</code>
1.1 grant 15129: </pre>
15130: </div>
15131:
1.59 rillig 15132: <div class="sect1" lang="en" xml:lang="en">
1.1 grant 15133: <div class="titlepage">
15134: <div>
15135: <div>
15136: <h2 class="title" style="clear: both"><a name=
1.59 rillig 15137: "logs.package" id=
1.46 gdt 15138: "logs.package"></a>B.2. Packaging figlet</h2>
1.1 grant 15139: </div>
15140: </div>
15141: </div>
15142: <pre class="screen">
1.14 xtraeme 15143: <code class="prompt">#</code> <strong class=
15144: "userinput"><code>make package</code></strong>
1.1 grant 15145: ===> Checking for vulnerabilities in figlet-2.2.1nb2
15146: ===> Packaging figlet-2.2.1nb2
15147: ===> Building binary package for figlet-2.2.1nb2
15148: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
15149: Using SrcDir value of /usr/pkg
15150: Registering depends:.
1.14 xtraeme 15151: <code class="prompt">#</code>
1.1 grant 15152: </pre>
15153: </div>
15154: </div>
15155:
1.59 rillig 15156: <div class="appendix" lang="en" xml:lang="en">
1.1 grant 15157: <div class="titlepage">
15158: <div>
15159: <div>
1.59 rillig 15160: <h2 class="title"><a name="ftp-layout" id=
1.46 gdt 15161: "ftp-layout"></a>Appendix C. Layout of the
1.1 grant 15162: FTP server's package archive</h2>
15163: </div>
15164: </div>
15165: </div>
15166:
15167: <p>Layout for precompiled binary packages on
15168: ftp.NetBSD.org:</p>
15169: <pre class="programlisting">
1.51 rillig 15170: /pub/NetBSD/packages/
15171: distfiles/
1.1 grant 15172:
1.51 rillig 15173: # Unpacked pkgsrc trees
15174: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
15175: pkgsrc-2003Q4 -> N/A
15176: pkgsrc-2004Q1/pkgsrc
15177:
15178: # pkgsrc archives
15179: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
15180: pkgsrc-2003Q4.tar.gz -> N/A
15181: pkgsrc-2004Q1.tar.gz -> N/A
15182:
15183: # Per pkgsrc-release/OS-release/arch package archives
15184: pkgsrc-2003Q4/
15185: NetBSD-1.6.2/
15186: i386/
15187: All/
15188: archivers/
15189: foo -> ../All/foo
15190: ...
15191: pkgsrc-2004Q1/
15192: NetBSD-1.6.2/
15193: i386/
15194: All/
15195: ...
15196: NetBSD-2.0/
15197: i386/
15198: All/
15199: ...
15200: SunOS-5.9/
15201: sparc/
15202: All/
15203: ...
15204: x86/
15205: All/
15206: ...
15207:
15208: # Per os-release package archive convenience links
15209: NetBSD-1.6.2 -> 1.6.2
15210: 1.6.2/
15211: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
15212: m68k/
15213: All/
15214: archivers/
15215: foo -> ../All/foo
15216: ...
15217: amiga -> m68k
15218: atari -> m68k
15219: ...
15220:
15221: 2.0 -> NetBSD-2.0 # backward compat, historic
15222: NetBSD-2.0/
15223: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
15224: SunOS-5.9/
15225: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
15226: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
1.1 grant 15227: </pre>
15228:
15229: <p>To create:</p>
15230:
15231: <div class="orderedlist">
15232: <ol type="1">
15233: <li>
15234: <p>Run bulk build, see <a href="#bulkbuild" title=
1.59 rillig 15235: "6.3. Doing a bulk build of all packages">Section
15236: 6.3, “Doing a bulk build of all
1.1 grant 15237: packages”</a></p>
15238: </li>
15239:
15240: <li>
15241: <p>Upload /usr/pkgsrc/packages to</p>
15242: <pre class="programlisting">
15243: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.51 rillig 15244: pkgsrc-2004Q4/\ # pkgsrc-branch
15245: `uname -s`-`uname -r`/\ # OS & version
15246: `uname -p` # architecture
1.1 grant 15247: </pre>
15248: </li>
15249:
15250: <li>
1.14 xtraeme 15251: <p>If necessary, create a symlink <span><strong class=
15252: "command">ln -s `uname -m` `uname -p`</strong></span>
15253: (amiga -> m68k, ...)</p>
1.1 grant 15254: </li>
15255: </ol>
15256: </div>
15257: </div>
1.2 hubertf 15258:
1.59 rillig 15259: <div class="appendix" lang="en" xml:lang="en">
1.2 hubertf 15260: <div class="titlepage">
15261: <div>
15262: <div>
1.59 rillig 15263: <h2 class="title"><a name="editing" id=
1.46 gdt 15264: "editing"></a>Appendix D. Editing guidelines
1.2 hubertf 15265: for the pkgsrc guide</h2>
15266: </div>
15267: </div>
15268: </div>
15269:
15270: <div class="toc">
15271: <p><b>Table of Contents</b></p>
15272:
15273: <dl>
1.46 gdt 15274: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 15275: Targets</a></span></dt>
15276:
1.46 gdt 15277: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 15278: Procedure</a></span></dt>
15279: </dl>
15280: </div>
15281:
15282: <p>This section contains information on editing the pkgsrc
15283: guide itself.</p>
15284:
1.59 rillig 15285: <div class="sect1" lang="en" xml:lang="en">
1.2 hubertf 15286: <div class="titlepage">
15287: <div>
15288: <div>
15289: <h2 class="title" style="clear: both"><a name=
1.59 rillig 15290: "targets" id="targets"></a>D.1. Targets</h2>
1.2 hubertf 15291: </div>
15292: </div>
15293: </div>
15294:
1.45 wiz 15295: <p>The pkgsrc guide's source code is stored in <code xmlns=
15296: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15297: "filename">pkgsrc/doc/guide/files</code>, and several files
1.2 hubertf 15298: are created from it:</p>
15299:
15300: <div class="itemizedlist">
15301: <ul type="disc">
15302: <li>
1.45 wiz 15303: <p><code xmlns=
15304: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 15305: "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2 hubertf 15306: </li>
15307:
15308: <li>
1.45 wiz 15309: <p><code xmlns=
15310: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15311: "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2 hubertf 15312: </li>
15313:
15314: <li>
1.45 wiz 15315: <p><code xmlns=
15316: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15317: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2 hubertf 15318: the documentation on the NetBSD website will be built
15319: from pkgsrc and kept up to date on the web server
15320: itself. This means you <span class=
15321: "emphasis"><em>must</em></span> make sure that your
15322: changes haven't broken the build!</p>
15323: </li>
1.6 hubertf 15324:
15325: <li>
1.45 wiz 15326: <p><code xmlns=
15327: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15328: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6 hubertf 15329: PDF version of the pkgsrc guide.</p>
15330: </li>
15331:
15332: <li>
1.45 wiz 15333: <p><code xmlns=
15334: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15335: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6 hubertf 15336: PostScript version of the pkgsrc guide.</p>
15337: </li>
1.2 hubertf 15338: </ul>
15339: </div>
15340: </div>
15341:
1.59 rillig 15342: <div class="sect1" lang="en" xml:lang="en">
1.2 hubertf 15343: <div class="titlepage">
15344: <div>
15345: <div>
15346: <h2 class="title" style="clear: both"><a name=
1.59 rillig 15347: "procedure" id=
1.46 gdt 15348: "procedure"></a>D.2. Procedure</h2>
1.2 hubertf 15349: </div>
15350: </div>
15351: </div>
15352:
15353: <p>The procedure to edit the pkgsrc guide is:</p>
15354:
15355: <div class="itemizedlist">
15356: <ul type="disc">
15357: <li>
1.6 hubertf 15358: <p>Make sure you have the packages needed to
15359: re-generate the pkgsrc guide (and other XML-based
15360: NetBSD documentation) installed. These are
1.11 ben 15361: “<span class="quote">netbsd-doc</span>”
1.47 reed 15362: for creating the ASCII and HTML versions, and
1.6 hubertf 15363: “<span class=
1.47 reed 15364: "quote">netbsd-doc-print</span>” for the
15365: PostScript and PDF versions. You will need both
1.6 hubertf 15366: packages installed, to make sure documentation is
15367: consistent across all formats. The packages can be
1.45 wiz 15368: found in <code xmlns=
15369: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15370: "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
1.45 wiz 15371: <code xmlns=
15372: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15373: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6 hubertf 15374: </li>
15375:
15376: <li>
1.45 wiz 15377: <p>Edit the XML file(s) in <code xmlns=
15378: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15379: "filename">pkgsrc/doc/guide/files</code>.</p>
1.2 hubertf 15380: </li>
15381:
15382: <li>
1.14 xtraeme 15383: <p>Run <span><strong class="command">make extract
15384: && make do-lint</strong></span> in
1.45 wiz 15385: <code xmlns=
15386: "http://www.w3.org/TR/xhtml1/transitional" class=
15387: "filename">pkgsrc/doc/guide</code> to check the XML
15388: syntax, and fix it if needed.</p>
1.4 hubertf 15389: </li>
15390:
15391: <li>
1.14 xtraeme 15392: <p>Run <span><strong class=
1.45 wiz 15393: "command">make</strong></span> in <code xmlns=
15394: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15395: "filename">pkgsrc/doc/guide</code> to build the HTML
15396: and ASCII version.</p>
1.2 hubertf 15397: </li>
15398:
15399: <li>
1.14 xtraeme 15400: <p>If all is well, run <span><strong class=
15401: "command">make install-doc</strong></span> to put the
1.45 wiz 15402: generated files into <code xmlns=
15403: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15404: "filename">pkgsrc/doc</code>.</p>
1.2 hubertf 15405: </li>
15406:
15407: <li>
1.14 xtraeme 15408: <p><span><strong class="command">cvs commit
15409: pkgsrc/doc/guide/files</strong></span></p>
1.2 hubertf 15410: </li>
15411:
15412: <li>
1.14 xtraeme 15413: <p><span><strong class="command">cvs commit -m
15414: re-generate
15415: pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2 hubertf 15416: </li>
1.4 hubertf 15417:
15418: <li>
15419: <p>Until the webserver on www.NetBSD.org is really
15420: updated automatically to pick up changes to the
1.14 xtraeme 15421: pkgsrc guide automatically, also run
1.18 xtraeme 15422: <span><strong class="command">make install-htdocs
1.14 xtraeme 15423: HTDOCSDIR=../../../htdocs</strong></span> (or
15424: similar, adjust <code class=
15425: "varname">HTDOCSDIR</code>!).</p>
1.4 hubertf 15426: </li>
15427:
15428: <li>
1.14 xtraeme 15429: <p><span><strong class="command">cvs commit
15430: htdocs/Documentation/pkgsrc</strong></span></p>
1.4 hubertf 15431: </li>
1.2 hubertf 15432: </ul>
15433: </div>
15434: </div>
15435: </div>
1.1 grant 15436: </div>
15437: </body>
15438: </html>
CVSweb <webmaster@jp.NetBSD.org>