Annotation of pkgsrc/doc/pkgsrc.html, revision 1.65
1.1 grant 1: <html xmlns="http://www.w3.org/1999/xhtml">
2: <head>
3: <meta name="generator" content=
1.63 dillo 4: "HTML Tidy for NetBSD (vers 1 September 2005), see www.w3.org" />
1.1 grant 5: <meta http-equiv="Content-Type" content=
6: "text/html; charset=us-ascii" />
7:
8: <title>The pkgsrc guide</title>
9: <link rel="stylesheet" href="/NetBSD.css" type="text/css" />
10: <meta name="generator" content=
1.23 wiz 11: "DocBook XSL Stylesheets VX.X.X" />
1.1 grant 12: <meta name="description" content=
13: "Information about using the NetBSD package system (pkgsrc) from both a user view for installing packages as well as from a pkgsrc developers' view for creating new packages." />
14: </head>
15:
16: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084"
17: alink="#0000FF">
1.63 dillo 18: <div class="book" lang="en">
1.1 grant 19: <div class="titlepage">
20: <div>
21: <div>
1.63 dillo 22: <h1 class="title"><a name="the-pkgsrc-guide"></a>The
23: pkgsrc guide</h1>
1.1 grant 24: </div>
25:
26: <div>
1.2 hubertf 27: <h2 class="subtitle">Documentation on the NetBSD packages
1.1 grant 28: system</h2>
29: </div>
30:
31: <div>
32: <div class="authorgroup">
33: <div class="author">
34: <h3 class="author"><span class=
35: "firstname">Alistair</span> <span class=
36: "surname">Crooks</span></h3>
37:
38: <div class="affiliation">
39: <div class="address">
1.14 xtraeme 40: <p><code class="email"><<a href=
41: "mailto:agc@NetBSD.org">agc@NetBSD.org</a>></code></p>
1.1 grant 42: </div>
43: </div>
44: </div>
45:
46: <div class="author">
47: <h3 class="author"><span class=
48: "firstname">Hubert</span> <span class=
49: "surname">Feyrer</span></h3>
50:
51: <div class="affiliation">
52: <div class="address">
1.14 xtraeme 53: <p><code class="email"><<a href=
54: "mailto:hubertf@NetBSD.org">hubertf@NetBSD.org</a>></code></p>
1.1 grant 55: </div>
56: </div>
57: </div>
1.2 hubertf 58:
1.3 hubertf 59: <h3 class="corpauthor">The pkgsrc Developers</h3>
1.1 grant 60: </div>
61: </div>
62:
63: <div>
1.48 dillo 64: <p class="copyright">Copyright © 1994-2005 The
1.1 grant 65: NetBSD Foundation, Inc</p>
66: </div>
67:
1.23 wiz 68: <div xmlns="http://www.w3.org/TR/xhtml1/transitional">
1.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.65 ! hubertf 655: "#shells-disable">12.5.1. Disabling shell
! 656: registration</a></span></dt>
! 657: </dl>
! 658: </dd>
! 659:
! 660: <dt><span class="sect1"><a href="#fonts">12.6.
! 661: Fonts</a></span></dt>
! 662:
! 663: <dd>
! 664: <dl>
! 665: <dt><span class="sect2"><a href=
! 666: "#fonts-disable">12.6.1. Disabling automatic
! 667: update of the fonts databases</a></span></dt>
1.35 jmmv 668: </dl>
669: </dd>
670: </dl>
671: </dd>
672:
1.38 dillo 673: <dt><span class="chapter"><a href="#options">13.
1.1 grant 674: Options handling</a></span></dt>
675:
676: <dd>
677: <dl>
1.30 wiz 678: <dt><span class="sect1"><a href=
1.38 dillo 679: "#global-default-options">13.1. Global default
1.30 wiz 680: options</a></span></dt>
1.1 grant 681:
1.30 wiz 682: <dt><span class="sect1"><a href=
1.38 dillo 683: "#converting-to-options">13.2. Converting packages
1.45 wiz 684: to use <code xmlns=
685: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 686: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 687:
688: <dt><span class="sect1"><a href=
689: "#option-names">13.3. Option Names</a></span></dt>
1.1 grant 690: </dl>
691: </dd>
692:
1.38 dillo 693: <dt><span class="chapter"><a href="#build">14. The
1.1 grant 694: build process</a></span></dt>
695:
696: <dd>
697: <dl>
698: <dt><span class="sect1"><a href=
1.56 rillig 699: "#build.intro">14.1. Introduction</a></span></dt>
700:
701: <dt><span class="sect1"><a href=
702: "#build.prefix">14.2. Program
1.1 grant 703: location</a></span></dt>
704:
1.30 wiz 705: <dt><span class="sect1"><a href=
1.56 rillig 706: "#build.builddirs">14.3. Directories used during
707: the build process</a></span></dt>
708:
709: <dt><span class="sect1"><a href=
710: "#build.running">14.4. Running a
711: phase</a></span></dt>
712:
713: <dt><span class="sect1"><a href=
714: "#build.fetch">14.5. The <span class=
715: "emphasis"><em>fetch</em></span>
716: phase</a></span></dt>
717:
718: <dt><span class="sect1"><a href=
719: "#build.checksum">14.6. The <span class=
720: "emphasis"><em>checksum</em></span>
721: phase</a></span></dt>
722:
723: <dt><span class="sect1"><a href=
724: "#build.extract">14.7. The <span class=
725: "emphasis"><em>extract</em></span>
726: phase</a></span></dt>
727:
728: <dt><span class="sect1"><a href=
729: "#build.patch">14.8. The <span class=
730: "emphasis"><em>patch</em></span>
731: phase</a></span></dt>
732:
733: <dt><span class="sect1"><a href=
734: "#build.tools">14.9. The <span class=
735: "emphasis"><em>tools</em></span>
736: phase</a></span></dt>
737:
738: <dt><span class="sect1"><a href=
739: "#build.wrapper">14.10. The <span class=
740: "emphasis"><em>wrapper</em></span>
741: phase</a></span></dt>
742:
743: <dt><span class="sect1"><a href=
744: "#build.configure">14.11. The <span class=
745: "emphasis"><em>configure</em></span>
746: phase</a></span></dt>
747:
748: <dt><span class="sect1"><a href=
749: "#build.build">14.12. The <span class=
750: "emphasis"><em>build</em></span>
751: phase</a></span></dt>
752:
753: <dt><span class="sect1"><a href=
754: "#build.test">14.13. The <span class=
755: "emphasis"><em>test</em></span>
756: phase</a></span></dt>
757:
758: <dt><span class="sect1"><a href=
759: "#build.install">14.14. The <span class=
760: "emphasis"><em>install</em></span>
761: phase</a></span></dt>
1.1 grant 762:
763: <dt><span class="sect1"><a href=
1.56 rillig 764: "#build.package">14.15. The <span class=
765: "emphasis"><em>package</em></span>
766: phase</a></span></dt>
767:
768: <dt><span class="sect1"><a href=
769: "#build.helpful-targets">14.16. Other helpful
1.1 grant 770: targets</a></span></dt>
771: </dl>
772: </dd>
773:
1.55 rillig 774: <dt><span class="chapter"><a href="#fixes">15. Making
775: your package work</a></span></dt>
1.1 grant 776:
777: <dd>
778: <dl>
1.30 wiz 779: <dt><span class="sect1"><a href=
1.38 dillo 780: "#general-operation">15.1. General
1.30 wiz 781: operation</a></span></dt>
1.1 grant 782:
783: <dd>
784: <dl>
785: <dt><span class="sect2"><a href=
1.38 dillo 786: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 787: pull in variables from
788: /etc/mk.conf</a></span></dt>
1.1 grant 789:
790: <dt><span class="sect2"><a href=
1.38 dillo 791: "#where-to-install-documentation">15.1.2. Where
1.31 wiz 792: to install documentation</a></span></dt>
793:
794: <dt><span class="sect2"><a href=
1.38 dillo 795: "#restricted-packages">15.1.3. Restricted
1.1 grant 796: packages</a></span></dt>
797:
798: <dt><span class="sect2"><a href=
1.38 dillo 799: "#dependencies">15.1.4. Handling
1.1 grant 800: dependencies</a></span></dt>
801:
802: <dt><span class="sect2"><a href=
1.38 dillo 803: "#conflicts">15.1.5. Handling conflicts with
1.1 grant 804: other packages</a></span></dt>
805:
806: <dt><span class="sect2"><a href=
1.38 dillo 807: "#not-building-packages">15.1.6. Packages that
1.30 wiz 808: cannot or should not be built</a></span></dt>
1.1 grant 809:
810: <dt><span class="sect2"><a href=
1.38 dillo 811: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 812: should not be deleted, once
813: installed</a></span></dt>
1.1 grant 814:
815: <dt><span class="sect2"><a href=
1.38 dillo 816: "#security-handling">15.1.8. Handling packages
1.1 grant 817: with security problems</a></span></dt>
818:
819: <dt><span class="sect2"><a href=
1.38 dillo 820: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 821: bugs</a></span></dt>
822:
823: <dt><span class="sect2"><a href=
1.38 dillo 824: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 825: incrementing versions when fixing an existing
1.1 grant 826: package</a></span></dt>
827:
828: <dt><span class="sect2"><a href=
1.38 dillo 829: "#portability-of-packages">15.1.11. Portability
1.30 wiz 830: of packages</a></span></dt>
1.1 grant 831: </dl>
832: </dd>
833:
1.30 wiz 834: <dt><span class="sect1"><a href=
1.38 dillo 835: "#downloading-issues">15.2. Possible downloading
1.30 wiz 836: issues</a></span></dt>
1.1 grant 837:
838: <dd>
839: <dl>
840: <dt><span class="sect2"><a href=
1.38 dillo 841: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 842: distfiles aren't available for plain
1.1 grant 843: downloading</a></span></dt>
844:
845: <dt><span class="sect2"><a href=
1.38 dillo 846: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 847: handle modified distfiles with the 'old'
848: name</a></span></dt>
1.1 grant 849: </dl>
850: </dd>
851:
1.30 wiz 852: <dt><span class="sect1"><a href=
1.38 dillo 853: "#configuration-gotchas">15.3. Configuration
1.30 wiz 854: gotchas</a></span></dt>
1.1 grant 855:
856: <dd>
857: <dl>
858: <dt><span class="sect2"><a href=
1.38 dillo 859: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 860: libtool</a></span></dt>
861:
862: <dt><span class="sect2"><a href=
1.38 dillo 863: "#using-libtool">15.3.2. Using libtool on GNU
1.1 grant 864: packages that already support
865: libtool</a></span></dt>
866:
867: <dt><span class="sect2"><a href=
1.38 dillo 868: "#autoconf-automake">15.3.3. GNU
1.1 grant 869: Autoconf/Automake</a></span></dt>
870: </dl>
871: </dd>
872:
1.30 wiz 873: <dt><span class="sect1"><a href=
1.55 rillig 874: "#fixes-build">15.4. Building the
875: package</a></span></dt>
1.1 grant 876:
877: <dd>
878: <dl>
879: <dt><span class="sect2"><a href=
1.38 dillo 880: "#cpp-defines">15.4.1. CPP
1.1 grant 881: defines</a></span></dt>
1.51 rillig 882:
883: <dt><span class="sect2"><a href=
1.60 rillig 884: "#cpp-list-examples">15.4.2. Examples of CPP
885: defines for some platforms</a></span></dt>
886:
887: <dt><span class="sect2"><a href=
888: "#cpp-list">15.4.3. Getting a list of CPP
1.51 rillig 889: defines</a></span></dt>
1.1 grant 890: </dl>
891: </dd>
892:
1.30 wiz 893: <dt><span class="sect1"><a href=
1.38 dillo 894: "#package-specific-actions">15.5. Package specific
1.30 wiz 895: actions</a></span></dt>
1.1 grant 896:
897: <dd>
898: <dl>
899: <dt><span class="sect2"><a href=
1.38 dillo 900: "#user-interaction">15.5.1. User
1.2 hubertf 901: interaction</a></span></dt>
1.1 grant 902:
903: <dt><span class="sect2"><a href=
1.38 dillo 904: "#handling-licenses">15.5.2. Handling
1.1 grant 905: licenses</a></span></dt>
906:
907: <dt><span class="sect2"><a href=
1.38 dillo 908: "#installing-score-files">15.5.3. Installing
1.30 wiz 909: score files</a></span></dt>
1.1 grant 910:
911: <dt><span class="sect2"><a href=
1.38 dillo 912: "#perl-scripts">15.5.4. Packages containing
1.30 wiz 913: perl scripts</a></span></dt>
1.1 grant 914:
915: <dt><span class="sect2"><a href=
1.38 dillo 916: "#hardcoded-paths">15.5.5. Packages with
1.30 wiz 917: hardcoded paths to other
918: interpreters</a></span></dt>
1.1 grant 919:
920: <dt><span class="sect2"><a href=
1.38 dillo 921: "#perl-modules">15.5.6. Packages installing
1.30 wiz 922: perl modules</a></span></dt>
1.1 grant 923:
924: <dt><span class="sect2"><a href=
1.38 dillo 925: "#faq.info-files">15.5.7. Packages installing
1.1 grant 926: info files</a></span></dt>
927:
928: <dt><span class="sect2"><a href=
1.57 minskim 929: "#manpages">15.5.8. Packages installing man
930: pages</a></span></dt>
931:
932: <dt><span class="sect2"><a href=
933: "#gconf2-data-files">15.5.9. Packages
1.30 wiz 934: installing GConf2 data files</a></span></dt>
1.1 grant 935:
936: <dt><span class="sect2"><a href=
1.57 minskim 937: "#scrollkeeper-data-files">15.5.10. Packages
1.30 wiz 938: installing scrollkeeper data
939: files</a></span></dt>
1.1 grant 940:
941: <dt><span class="sect2"><a href=
1.57 minskim 942: "#x11-fonts">15.5.11. Packages installing X11
1.1 grant 943: fonts</a></span></dt>
944:
945: <dt><span class="sect2"><a href=
1.57 minskim 946: "#gtk2-modules">15.5.12. Packages installing
1.30 wiz 947: GTK2 modules</a></span></dt>
1.1 grant 948:
949: <dt><span class="sect2"><a href=
1.57 minskim 950: "#sgml-xml-data">15.5.13. Packages installing
1.30 wiz 951: SGML or XML data</a></span></dt>
1.1 grant 952:
953: <dt><span class="sect2"><a href=
1.57 minskim 954: "#mime-database">15.5.14. Packages installing
1.1 grant 955: extensions to the MIME database</a></span></dt>
956:
957: <dt><span class="sect2"><a href=
1.57 minskim 958: "#intltool">15.5.15. Packages using
1.1 grant 959: intltool</a></span></dt>
1.18 xtraeme 960:
961: <dt><span class="sect2"><a href=
1.57 minskim 962: "#startup-scripts">15.5.16. Packages installing
1.18 xtraeme 963: startup scripts</a></span></dt>
1.57 minskim 964:
965: <dt><span class="sect2"><a href=
966: "#tex-packages">15.5.17. Packages installing
967: TeX modules</a></span></dt>
1.1 grant 968: </dl>
969: </dd>
970:
1.30 wiz 971: <dt><span class="sect1"><a href=
1.38 dillo 972: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 973: author</a></span></dt>
1.1 grant 974: </dl>
975: </dd>
976:
1.38 dillo 977: <dt><span class="chapter"><a href="#debug">16.
1.1 grant 978: Debugging</a></span></dt>
979:
1.38 dillo 980: <dt><span class="chapter"><a href="#submit">17.
1.1 grant 981: Submitting and Committing</a></span></dt>
982:
983: <dd>
984: <dl>
1.30 wiz 985: <dt><span class="sect1"><a href=
1.38 dillo 986: "#submitting-your-package">17.1. Submitting your
1.30 wiz 987: packages</a></span></dt>
1.1 grant 988:
1.30 wiz 989: <dt><span class="sect1"><a href=
1.41 wiz 990: "#general-notes-for-changes">17.2. General notes
991: when adding, updating, or removing
992: packages</a></span></dt>
993:
994: <dt><span class="sect1"><a href=
995: "#committing-importing">17.3. Committing: Importing
1.30 wiz 996: a package into CVS</a></span></dt>
1.1 grant 997:
1.30 wiz 998: <dt><span class="sect1"><a href=
1.41 wiz 999: "#updating-package">17.4. Updating a package to a
1.30 wiz 1000: newer version</a></span></dt>
1.1 grant 1001:
1.30 wiz 1002: <dt><span class="sect1"><a href=
1.41 wiz 1003: "#moving-package">17.5. Moving a package in
1.30 wiz 1004: pkgsrc</a></span></dt>
1.1 grant 1005: </dl>
1006: </dd>
1007: </dl>
1008: </dd>
1009:
1.46 gdt 1010: <dt><span class="appendix"><a href="#examples">A. A simple
1.1 grant 1011: example package: bison</a></span></dt>
1012:
1013: <dd>
1014: <dl>
1.46 gdt 1015: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 1016: files</a></span></dt>
1017:
1018: <dd>
1019: <dl>
1.30 wiz 1020: <dt><span class="sect2"><a href=
1.46 gdt 1021: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 1022:
1.30 wiz 1023: <dt><span class="sect2"><a href=
1.46 gdt 1024: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 1025:
1.30 wiz 1026: <dt><span class="sect2"><a href=
1.46 gdt 1027: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 1028:
1.30 wiz 1029: <dt><span class="sect2"><a href=
1.46 gdt 1030: "#checking-package-with-pkglint">A.1.4. Checking a
1.30 wiz 1031: package with <span><strong class=
1.14 xtraeme 1032: "command">pkglint</strong></span></a></span></dt>
1.1 grant 1033: </dl>
1034: </dd>
1035:
1.46 gdt 1036: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30 wiz 1037: Steps for building, installing,
1038: packaging</a></span></dt>
1.1 grant 1039: </dl>
1040: </dd>
1041:
1.46 gdt 1042: <dt><span class="appendix"><a href="#logs">B. Build
1.1 grant 1043: logs</a></span></dt>
1044:
1045: <dd>
1046: <dl>
1.46 gdt 1047: <dt><span class="sect1"><a href="#logs.building">B.1.
1.1 grant 1048: Building figlet</a></span></dt>
1049:
1.46 gdt 1050: <dt><span class="sect1"><a href="#logs.package">B.2.
1.1 grant 1051: Packaging figlet</a></span></dt>
1052: </dl>
1053: </dd>
1054:
1.46 gdt 1055: <dt><span class="appendix"><a href="#ftp-layout">C. Layout
1.1 grant 1056: of the FTP server's package archive</a></span></dt>
1.2 hubertf 1057:
1.46 gdt 1058: <dt><span class="appendix"><a href="#editing">D. Editing
1.2 hubertf 1059: guidelines for the pkgsrc guide</a></span></dt>
1060:
1061: <dd>
1062: <dl>
1.46 gdt 1063: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 1064: Targets</a></span></dt>
1065:
1.46 gdt 1066: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 1067: Procedure</a></span></dt>
1068: </dl>
1069: </dd>
1.1 grant 1070: </dl>
1071: </div>
1072:
1.63 dillo 1073: <div class="chapter" lang="en">
1.1 grant 1074: <div class="titlepage">
1075: <div>
1076: <div>
1.63 dillo 1077: <h2 class="title"><a name=
1.51 rillig 1078: "introduction"></a>Chapter 1. What is
1079: pkgsrc?</h2>
1.1 grant 1080: </div>
1081: </div>
1082: </div>
1083:
1084: <div class="toc">
1085: <p><b>Table of Contents</b></p>
1086:
1087: <dl>
1.30 wiz 1088: <dt><span class="sect1"><a href=
1089: "#introduction-section">1.1. Introduction</a></span></dt>
1.1 grant 1090:
1091: <dt><span class="sect1"><a href="#overview">1.2.
1092: Overview</a></span></dt>
1093:
1094: <dt><span class="sect1"><a href="#terminology">1.3.
1095: Terminology</a></span></dt>
1096:
1097: <dt><span class="sect1"><a href="#typography">1.4.
1098: Typography</a></span></dt>
1099: </dl>
1100: </div>
1101:
1.63 dillo 1102: <div class="sect1" lang="en">
1.1 grant 1103: <div class="titlepage">
1104: <div>
1105: <div>
1106: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1107: "introduction-section"></a>1.1. Introduction</h2>
1.1 grant 1108: </div>
1109: </div>
1110: </div>
1111:
1.47 reed 1112: <p>There is a lot of software freely available for
1113: Unix-based systems, which usually runs on NetBSD and other
1.1 grant 1114: Unix-flavoured systems, too, sometimes with some
1115: modifications. The NetBSD Packages Collection (pkgsrc)
1116: incorporates any such changes necessary to make that
1117: software run, and makes the installation (and
1118: de-installation) of the software package easy by means of a
1119: single command.</p>
1120:
1121: <p>Once the software has been built, it is manipulated with
1.14 xtraeme 1122: the <span><strong class="command">pkg_*</strong></span>
1123: tools so that installation and de-installation, printing of
1124: an inventory of all installed packages and retrieval of
1125: one-line comments or more verbose descriptions are all
1126: simple.</p>
1.1 grant 1127:
1128: <p>pkgsrc currently contains several thousand packages,
1129: including:</p>
1130:
1131: <div class="itemizedlist">
1132: <ul type="disc">
1133: <li>
1134: <p><a xmlns=
1135: "http://www.w3.org/TR/xhtml1/transitional" href=
1136: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.45 wiz 1137: target="_top"><code xmlns="" class=
1138: "filename">www/apache</code></a> - The Apache web
1.20 ben 1139: server</p>
1.1 grant 1140: </li>
1141:
1142: <li>
1143: <p><a xmlns=
1144: "http://www.w3.org/TR/xhtml1/transitional" href=
1145: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 wiz 1146: target="_top"><code xmlns="" class=
1147: "filename">www/mozilla</code></a> - The Mozilla web
1.20 ben 1148: browser</p>
1.1 grant 1149: </li>
1150:
1151: <li>
1152: <p><a xmlns=
1153: "http://www.w3.org/TR/xhtml1/transitional" href=
1154: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.45 wiz 1155: target="_top"><code xmlns="" class=
1156: "filename">meta-pkgs/gnome</code></a> - The GNOME
1.20 ben 1157: Desktop Environment</p>
1.1 grant 1158: </li>
1159:
1160: <li>
1161: <p><a xmlns=
1162: "http://www.w3.org/TR/xhtml1/transitional" href=
1163: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.45 wiz 1164: target="_top"><code xmlns="" class=
1165: "filename">meta-pkgs/kde3</code></a> - The K Desktop
1.20 ben 1166: Environment</p>
1.1 grant 1167: </li>
1168: </ul>
1169: </div>
1170:
1171: <p>...just to name a few.</p>
1172:
1173: <p>pkgsrc has built-in support for handling varying
1174: dependencies, such as pthreads and X11, and extended
1175: features such as IPv6 support on a range of platforms.</p>
1176:
1177: <p>pkgsrc was derived from FreeBSD's ports system, and
1178: initially developed for NetBSD only. Since then, pkgsrc has
1179: grown a lot, and now supports the following platforms:</p>
1180:
1181: <div class="itemizedlist">
1182: <ul type="disc">
1183: <li>
1184: <p><a href="http://developer.apple.com/darwin/"
1185: target="_top">Darwin</a> (<a href=
1186: "http://www.apple.com/macosx/" target="_top">Mac OS
1187: X</a>)</p>
1188: </li>
1189:
1190: <li>
1.3 hubertf 1191: <p><a href="http://www.DragonFlyBSD.org/" target=
1192: "_top">DragonFlyBSD</a></p>
1193: </li>
1194:
1195: <li>
1.1 grant 1196: <p><a href="http://www.FreeBSD.org/" target=
1197: "_top">FreeBSD</a></p>
1198: </li>
1199:
1200: <li>
1.3 hubertf 1201: <p>Microsoft Windows, via <a href=
1202: "http://www.microsoft.com/windows/sfu/" target=
1203: "_top">Interix</a></p>
1.1 grant 1204: </li>
1205:
1206: <li>
1207: <p><a href="http://www.sgi.com/software/irix6.5/"
1208: target="_top">IRIX</a></p>
1209: </li>
1210:
1211: <li>
1212: <p><a href="http://www.linux.org/" target=
1213: "_top">Linux</a></p>
1214: </li>
1215:
1216: <li>
1217: <p><a href="http://www.NetBSD.org/" target=
1218: "_top">NetBSD</a> (of course)</p>
1219: </li>
1220:
1221: <li>
1.17 sketch 1222: <p><a href="http://h30097.www3.hp.com/" target=
1223: "_top">Tru64</a> (Digital UNIX, OSF1)</p>
1224: </li>
1225:
1226: <li>
1.1 grant 1227: <p><a href="http://www.openbsd.org/" target=
1228: "_top">OpenBSD</a></p>
1229: </li>
1230:
1231: <li>
1232: <p><a href="http://www.sun.com/solaris/" target=
1233: "_top">Solaris</a></p>
1234: </li>
1235: </ul>
1236: </div>
1237: </div>
1238:
1.63 dillo 1239: <div class="sect1" lang="en">
1.1 grant 1240: <div class="titlepage">
1241: <div>
1242: <div>
1243: <h2 class="title" style="clear: both"><a name=
1.63 dillo 1244: "overview"></a>1.2. Overview</h2>
1.1 grant 1245: </div>
1246: </div>
1247: </div>
1248:
1249: <p>This document is divided into two parts. The first,
1250: <a href="#users-guide" title=
1.46 gdt 1251: "Part I. The pkgsrc user's guide">The pkgsrc
1.2 hubertf 1252: user's guide</a>, describes how one can use one of the
1253: packages in the Package Collection, either by installing a
1254: precompiled binary package, or by building one's own copy
1255: using the NetBSD package system. The second part, <a href=
1.1 grant 1256: "#developers-guide" title=
1.46 gdt 1257: "Part II. The pkgsrc developer's guide">The
1258: pkgsrc developer's guide</a>, explains how to prepare a
1259: package so it can be easily built by other NetBSD users
1260: without knowing about the package's building details.</p>
1.1 grant 1261:
1262: <p>This document is available in various formats:</p>
1263:
1264: <div class="itemizedlist">
1265: <ul type="disc">
1266: <li>
1267: <p><a href="index.html" target="_top">HTML</a></p>
1268: </li>
1269:
1270: <li>
1271: <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
1272: </li>
1273:
1274: <li>
1275: <p><a href="pkgsrc.ps" target="_top">PS</a></p>
1276: </li>
1277:
1278: <li>
1279: <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
1280: </li>
1281: </ul>
1282: </div>
1283: </div>
1284:
1.63 dillo 1285: <div class="sect1" lang="en">
1.1 grant 1286: <div class="titlepage">
1287: <div>
1288: <div>
1289: <h2 class="title" style="clear: both"><a name=
1290: "terminology"></a>1.3. Terminology</h2>
1291: </div>
1292: </div>
1293: </div>
1294:
1295: <p>There has been a lot of talk about “<span class=
1296: "quote">ports</span>”, “<span class=
1297: "quote">packages</span>”, etc. so far. Here is a
1298: description of all the terminology used within this
1299: document.</p>
1300:
1301: <div class="variablelist">
1302: <dl>
1303: <dt><span class="term">Package</span></dt>
1304:
1305: <dd>
1306: <p>A set of files and building instructions that
1307: describe what's necessary to build a certain piece of
1308: software using pkgsrc. Packages are traditionally
1.45 wiz 1309: stored under <code xmlns=
1310: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1311: "filename">/usr/pkgsrc</code>.</p>
1.1 grant 1312: </dd>
1313:
1314: <dt><span class="term">The NetBSD package
1315: system</span></dt>
1316:
1317: <dd>
1318: <p>This is the former name of “<span class=
1319: "quote">pkgsrc</span>”. It is part of the
1.27 rillig 1320: NetBSD operating system and can be bootstrapped to
1321: run on non-NetBSD operating systems as well. It
1322: handles building (compiling), installing, and
1323: removing of packages.</p>
1.1 grant 1324: </dd>
1325:
1326: <dt><span class="term">Distfile</span></dt>
1327:
1328: <dd>
1329: <p>This term describes the file or files that are
1330: provided by the author of the piece of software to
1331: distribute his work. All the changes necessary to
1332: build on NetBSD are reflected in the corresponding
1333: package. Usually the distfile is in the form of a
1334: compressed tar-archive, but other types are possible,
1.45 wiz 1335: too. Distfiles are usually stored below <code xmlns=
1336: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1337: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 1338: </dd>
1339:
1340: <dt><span class="term">Port</span></dt>
1341:
1342: <dd>
1343: <p>This is the term used by FreeBSD and OpenBSD
1344: people for what we call a package. In NetBSD
1345: terminology, “<span class=
1346: "quote">port</span>” refers to a different
1347: architecture.</p>
1348: </dd>
1349:
1350: <dt><span class="term">Precompiled/binary
1351: package</span></dt>
1352:
1353: <dd>
1354: <p>A set of binaries built with pkgsrc from a
1.14 xtraeme 1355: distfile and stuffed together in a single
1.45 wiz 1356: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
1357: class="filename">.tgz</code> file so it can be
1.14 xtraeme 1358: installed on machines of the same machine
1359: architecture without the need to recompile. Packages
1.45 wiz 1360: are usually generated in <code xmlns=
1361: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1362: "filename">/usr/pkgsrc/packages</code>; there is also
1363: an archive on <a href=
1.1 grant 1364: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
1365: "_top">ftp.NetBSD.org</a>.</p>
1366:
1367: <p>Sometimes, this is referred to by the term
1368: “<span class="quote">package</span>” too,
1369: especially in the context of precompiled
1370: packages.</p>
1371: </dd>
1372:
1373: <dt><span class="term">Program</span></dt>
1374:
1375: <dd>
1376: <p>The piece of software to be installed which will
1.47 reed 1377: be constructed from all the files in the distfile by
1.1 grant 1378: the actions defined in the corresponding package.</p>
1379: </dd>
1380: </dl>
1381: </div>
1382: </div>
1383:
1.63 dillo 1384: <div class="sect1" lang="en">
1.1 grant 1385: <div class="titlepage">
1386: <div>
1387: <div>
1388: <h2 class="title" style="clear: both"><a name=
1389: "typography"></a>1.4. Typography</h2>
1390: </div>
1391: </div>
1392: </div>
1393:
1394: <p>When giving examples for commands, shell prompts are
1395: used to show if the command should/can be issued as root,
1396: or if “<span class="quote">normal</span>” user
1.14 xtraeme 1397: privileges are sufficient. We use a <code class=
1398: "prompt">#</code> for root's shell prompt, and a
1.27 rillig 1399: <code class="prompt">%</code> for users' shell prompt,
1.14 xtraeme 1400: assuming they use the C-shell or tcsh.</p>
1.1 grant 1401: </div>
1402: </div>
1403:
1.63 dillo 1404: <div class="part" lang="en">
1.1 grant 1405: <div class="titlepage">
1406: <div>
1407: <div>
1.63 dillo 1408: <h1 class="title"><a name=
1.48 dillo 1409: "users-guide"></a>Part I. The pkgsrc user's
1410: guide</h1>
1.1 grant 1411: </div>
1412: </div>
1413: </div>
1414:
1415: <div class="toc">
1416: <p><b>Table of Contents</b></p>
1417:
1418: <dl>
1419: <dt><span class="chapter"><a href="#getting">2. Where to
1.59 rillig 1420: get pkgsrc and how to keep it up-to-date</a></span></dt>
1.1 grant 1421:
1422: <dd>
1423: <dl>
1.30 wiz 1424: <dt><span class="sect1"><a href="#as-tar-file">2.1.
1425: As tar file</a></span></dt>
1.1 grant 1426:
1.30 wiz 1427: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1428: SUP</a></span></dt>
1429:
1.30 wiz 1430: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1431: CVS</a></span></dt>
1.59 rillig 1432:
1433: <dt><span class="sect1"><a href="#uptodate-cvs">2.4.
1434: Keeping pkgsrc up-to-date via CVS</a></span></dt>
1.1 grant 1435: </dl>
1436: </dd>
1437:
1438: <dt><span class="chapter"><a href="#platforms">3. Using
1439: pkgsrc on systems other than NetBSD</a></span></dt>
1440:
1441: <dd>
1442: <dl>
1.30 wiz 1443: <dt><span class="sect1"><a href=
1444: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1445: pkgsrc</a></span></dt>
1.1 grant 1446:
1.30 wiz 1447: <dt><span class="sect1"><a href=
1.47 reed 1448: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 1449: notes</a></span></dt>
1.1 grant 1450:
1451: <dd>
1452: <dl>
1.30 wiz 1453: <dt><span class="sect2"><a href="#darwin">3.2.1.
1454: Darwin (Mac OS X)</a></span></dt>
1.1 grant 1455:
1.30 wiz 1456: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1457: FreeBSD</a></span></dt>
1.22 tv 1458:
1.30 wiz 1459: <dt><span class="sect2"><a href="#interix">3.2.3.
1460: Interix</a></span></dt>
1.1 grant 1461:
1.30 wiz 1462: <dt><span class="sect2"><a href="#irix">3.2.4.
1463: IRIX</a></span></dt>
1.1 grant 1464:
1.30 wiz 1465: <dt><span class="sect2"><a href="#linux">3.2.5.
1466: Linux</a></span></dt>
1.1 grant 1467:
1.30 wiz 1468: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1469: OpenBSD</a></span></dt>
1.1 grant 1470:
1.30 wiz 1471: <dt><span class="sect2"><a href="#solaris">3.2.7.
1472: Solaris</a></span></dt>
1.1 grant 1473: </dl>
1474: </dd>
1475: </dl>
1476: </dd>
1477:
1478: <dt><span class="chapter"><a href="#using">4. Using
1479: pkgsrc</a></span></dt>
1480:
1481: <dd>
1482: <dl>
1483: <dt><span class="sect1"><a href=
1484: "#getting-started">4.1. Working with binary
1485: packages</a></span></dt>
1486:
1487: <dd>
1488: <dl>
1489: <dt><span class="sect2"><a href=
1.30 wiz 1490: "#where-to-get-binary-packages">4.1.1. Where to
1491: get binary packages</a></span></dt>
1.1 grant 1492:
1493: <dt><span class="sect2"><a href=
1.30 wiz 1494: "#how-to-use-binary-packages">4.1.2. How to use
1495: binary packages</a></span></dt>
1.1 grant 1496:
1497: <dt><span class="sect2"><a href=
1.30 wiz 1498: "#a-word-of-warning">4.1.3. A word of
1.1 grant 1499: warning</a></span></dt>
1500: </dl>
1501: </dd>
1502:
1.30 wiz 1503: <dt><span class="sect1"><a href=
1504: "#building-packages-from-source">4.2. Building
1505: packages from source</a></span></dt>
1.1 grant 1506:
1507: <dd>
1508: <dl>
1509: <dt><span class="sect2"><a href=
1.30 wiz 1510: "#requirements">4.2.1.
1511: Requirements</a></span></dt>
1.1 grant 1512:
1513: <dt><span class="sect2"><a href=
1.30 wiz 1514: "#fetching-distfiles">4.2.2. Fetching
1.1 grant 1515: distfiles</a></span></dt>
1516:
1517: <dt><span class="sect2"><a href=
1.30 wiz 1518: "#how-to-build-and-install">4.2.3. How to build
1519: and install</a></span></dt>
1.1 grant 1520:
1521: <dt><span class="sect2"><a href=
1.30 wiz 1522: "#selecting-the-compiler">4.2.4. Selecting the
1.1 grant 1523: compiler</a></span></dt>
1524: </dl>
1525: </dd>
1526: </dl>
1527: </dd>
1528:
1.38 dillo 1529: <dt><span class="chapter"><a href="#configuring">5.
1530: Configuring pkgsrc</a></span></dt>
1531:
1532: <dd>
1533: <dl>
1534: <dt><span class="sect1"><a href=
1.45 wiz 1535: "#general-configuration">5.1. General
1536: configuration</a></span></dt>
1537:
1538: <dt><span class="sect1"><a href=
1539: "#variables-affecting-build">5.2. Variables affecting
1540: the build process</a></span></dt>
1541:
1542: <dt><span class="sect1"><a href=
1543: "#developer-advanced-settings">5.3.
1544: Developer/advanced settings</a></span></dt>
1545:
1546: <dt><span class="sect1"><a href=
1547: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 1548: Options</a></span></dt>
1.38 dillo 1549: </dl>
1550: </dd>
1551:
1552: <dt><span class="chapter"><a href="#binary">6. Creating
1.1 grant 1553: binary packages</a></span></dt>
1554:
1555: <dd>
1556: <dl>
1.30 wiz 1557: <dt><span class="sect1"><a href=
1.38 dillo 1558: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 1559: single binary package</a></span></dt>
1.1 grant 1560:
1.30 wiz 1561: <dt><span class="sect1"><a href=
1.38 dillo 1562: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 1563: Settings for creation of binary
1564: packages</a></span></dt>
1565:
1.38 dillo 1566: <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1 grant 1567: Doing a bulk build of all packages</a></span></dt>
1568:
1569: <dd>
1570: <dl>
1571: <dt><span class="sect2"><a href=
1.38 dillo 1572: "#binary.configuration">6.3.1.
1.1 grant 1573: Configuration</a></span></dt>
1574:
1575: <dt><span class="sect2"><a href=
1.38 dillo 1576: "#other-environmental-considerations">6.3.2.
1.30 wiz 1577: Other environmental
1.1 grant 1578: considerations</a></span></dt>
1579:
1580: <dt><span class="sect2"><a href=
1.38 dillo 1581: "#operation">6.3.3. Operation</a></span></dt>
1.1 grant 1582:
1583: <dt><span class="sect2"><a href=
1.38 dillo 1584: "#what-it-does">6.3.4. What it
1.30 wiz 1585: does</a></span></dt>
1.1 grant 1586:
1587: <dt><span class="sect2"><a href=
1.38 dillo 1588: "#disk-space-requirements">6.3.5. Disk space
1.1 grant 1589: requirements</a></span></dt>
1590:
1591: <dt><span class="sect2"><a href=
1.38 dillo 1592: "#setting-up-a-sandbox">6.3.6. Setting up a
1.47 reed 1593: sandbox for chrooted builds</a></span></dt>
1.1 grant 1594:
1595: <dt><span class="sect2"><a href=
1.38 dillo 1596: "#building-a-partial-set">6.3.7. Building a
1.30 wiz 1597: partial set of packages</a></span></dt>
1.13 hubertf 1598:
1599: <dt><span class="sect2"><a href=
1.38 dillo 1600: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 1601: build</a></span></dt>
1.1 grant 1602: </dl>
1603: </dd>
1604:
1.30 wiz 1605: <dt><span class="sect1"><a href=
1.38 dillo 1606: "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30 wiz 1607: packages collection</a></span></dt>
1.1 grant 1608:
1609: <dd>
1610: <dl>
1611: <dt><span class="sect2"><a href=
1.38 dillo 1612: "#cdpack-example">6.4.1. Example of
1.1 grant 1613: cdpack</a></span></dt>
1614: </dl>
1615: </dd>
1616: </dl>
1617: </dd>
1618:
1.38 dillo 1619: <dt><span class="chapter"><a href="#faq">7. Frequently
1.1 grant 1620: Asked Questions</a></span></dt>
1621:
1622: <dd>
1623: <dl>
1.30 wiz 1624: <dt><span class="sect1"><a href=
1.38 dillo 1625: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 1626: lists for pkg-related discussion?</a></span></dt>
1.1 grant 1627:
1.38 dillo 1628: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 1629: Where's the pkgviews documentation?</a></span></dt>
1630:
1.38 dillo 1631: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 1632: Utilities for package management
1633: (pkgtools)</a></span></dt>
1634:
1.30 wiz 1635: <dt><span class="sect1"><a href=
1.38 dillo 1636: "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30 wiz 1637: non-root</a></span></dt>
1.1 grant 1638:
1.30 wiz 1639: <dt><span class="sect1"><a href=
1.38 dillo 1640: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 1641: fetching distfiles?</a></span></dt>
1.14 xtraeme 1642:
1.30 wiz 1643: <dt><span class="sect1"><a href=
1.38 dillo 1644: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 1645: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 1646:
1.30 wiz 1647: <dt><span class="sect1"><a href=
1.38 dillo 1648: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 1649: from pkgsrc?</a></span></dt>
1.1 grant 1650:
1.30 wiz 1651: <dt><span class="sect1"><a href=
1.38 dillo 1652: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 1653: behind a firewall</a></span></dt>
1.1 grant 1654:
1.38 dillo 1655: <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.30 wiz 1656: How do I tell <span><strong class="command">make
1.14 xtraeme 1657: fetch</strong></span> to do passive
1.1 grant 1658: FTP?</a></span></dt>
1659:
1.30 wiz 1660: <dt><span class="sect1"><a href=
1.38 dillo 1661: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 1662: distfiles at once</a></span></dt>
1.1 grant 1663:
1.30 wiz 1664: <dt><span class="sect1"><a href=
1.38 dillo 1665: "#tmac.andoc-missing">7.11. What does
1.30 wiz 1666: “<span class="quote">Don't know how to make
1667: /usr/share/tmac/tmac.andoc</span>”
1.14 xtraeme 1668: mean?</a></span></dt>
1.13 hubertf 1669:
1.30 wiz 1670: <dt><span class="sect1"><a href=
1.38 dillo 1671: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 1672: “<span class="quote">Could not find
1.14 xtraeme 1673: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 1674:
1.30 wiz 1675: <dt><span class="sect1"><a href=
1.38 dillo 1676: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 1677: pkgsrc</a></span></dt>
1.1 grant 1678:
1.38 dillo 1679: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 1680: do I change the location of configuration
1681: files?</a></span></dt>
1.1 grant 1682:
1683: <dt><span class="sect1"><a href=
1.38 dillo 1684: "#audit-packages">7.15. Automated security
1.1 grant 1685: checks</a></span></dt>
1686: </dl>
1687: </dd>
1688: </dl>
1689: </div>
1690:
1.63 dillo 1691: <div class="chapter" lang="en">
1.1 grant 1692: <div class="titlepage">
1693: <div>
1694: <div>
1.63 dillo 1695: <h2 class="title"><a name=
1.1 grant 1696: "getting"></a>Chapter 2. Where to get
1.59 rillig 1697: pkgsrc and how to keep it up-to-date</h2>
1.1 grant 1698: </div>
1699: </div>
1700: </div>
1701:
1702: <div class="toc">
1703: <p><b>Table of Contents</b></p>
1704:
1705: <dl>
1.30 wiz 1706: <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1 grant 1707: tar file</a></span></dt>
1708:
1.30 wiz 1709: <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1 grant 1710: SUP</a></span></dt>
1711:
1.30 wiz 1712: <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1 grant 1713: CVS</a></span></dt>
1.59 rillig 1714:
1715: <dt><span class="sect1"><a href="#uptodate-cvs">2.4.
1716: Keeping pkgsrc up-to-date via CVS</a></span></dt>
1.1 grant 1717: </dl>
1718: </div>
1719:
1720: <p>There are three ways to get pkgsrc. Either as a tar
1721: file, via SUP, or via CVS. All three ways are described
1722: here.</p>
1723:
1.63 dillo 1724: <div class="sect1" lang="en">
1.1 grant 1725: <div class="titlepage">
1726: <div>
1727: <div>
1728: <h2 class="title" style="clear: both"><a name=
1.63 dillo 1729: "as-tar-file"></a>2.1. As tar file</h2>
1.1 grant 1730: </div>
1731: </div>
1732: </div>
1733:
1734: <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
1735: file from <a href=
1.11 ben 1736: "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20 ben 1737: target="_top">ftp.NetBSD.org</a> and unpack it into
1.45 wiz 1738: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
1739: class="filename">/usr/pkgsrc</code>.</p>
1.1 grant 1740: </div>
1741:
1.63 dillo 1742: <div class="sect1" lang="en">
1.1 grant 1743: <div class="titlepage">
1744: <div>
1745: <div>
1746: <h2 class="title" style="clear: both"><a name=
1.63 dillo 1747: "via-sup"></a>2.2. Via SUP</h2>
1.1 grant 1748: </div>
1749: </div>
1750: </div>
1751:
1752: <p>As an alternative to the tar file, you can get pkgsrc
1753: via the Software Update Protocol, SUP. To do so, make
1754: sure your supfile has a line</p>
1755: <pre class="programlisting">
1.51 rillig 1756: release=pkgsrc
1.1 grant 1757: </pre>
1758:
1.45 wiz 1759: <p>in it, see the examples in <code xmlns=
1760: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1761: "filename">/usr/share/examples/supfiles</code>, and that
1.45 wiz 1762: the <code xmlns=
1763: "http://www.w3.org/TR/xhtml1/transitional" class=
1764: "filename">/usr/pkgsrc</code> directory exists. Then,
1765: simply run <span><strong class="command">sup -v
1766: <em class="replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1 grant 1767: </div>
1768:
1.63 dillo 1769: <div class="sect1" lang="en">
1.1 grant 1770: <div class="titlepage">
1771: <div>
1772: <div>
1773: <h2 class="title" style="clear: both"><a name=
1.63 dillo 1774: "via-cvs"></a>2.3. Via CVS</h2>
1.1 grant 1775: </div>
1776: </div>
1777: </div>
1778:
1779: <p>To get pkgsrc via CVS, make sure you have
1780: “<span class="quote">cvs</span>” installed.
1.27 rillig 1781: To do an initial (full) checkout of pkgsrc, do the
1782: following steps:</p>
1.1 grant 1783: <pre class="screen">
1.14 xtraeme 1784: <code class="prompt">%</code> <strong class=
1785: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
1786: <code class="prompt">%</code> <strong class=
1787: "userinput"><code>setenv CVS_RSH ssh</code></strong>
1788: <code class="prompt">%</code> <strong class=
1789: "userinput"><code>cd /usr</code></strong>
1790: <code class="prompt">%</code> <strong class=
1791: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
1792: </pre>
1793:
1.45 wiz 1794: <p>This will create the <code xmlns=
1795: "http://www.w3.org/TR/xhtml1/transitional" class=
1796: "filename">pkgsrc</code> directory in your <code xmlns=
1797: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1798: "filename">/usr</code>, and all the package source will
1.45 wiz 1799: be stored under <code xmlns=
1800: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1801: "filename">/usr/pkgsrc</code>. To update pkgsrc after the
1802: initial checkout, make sure you have <code class=
1803: "varname">CVS_RSH</code> set as above, then do:</p>
1.1 grant 1804: <pre class="screen">
1.14 xtraeme 1805: <code class="prompt">%</code> <strong class=
1806: "userinput"><code>cd /usr/pkgsrc</code></strong>
1807: <code class="prompt">%</code> <strong class=
1808: "userinput"><code>cvs -q update -dP</code></strong>
1.1 grant 1809: </pre>
1810:
1811: <p>Please also note that it is possible to have multiple
1812: copies of the pkgsrc hierarchy in use at any one time -
1813: all work is done relatively within the pkgsrc tree.</p>
1814: </div>
1.59 rillig 1815:
1.63 dillo 1816: <div class="sect1" lang="en">
1.59 rillig 1817: <div class="titlepage">
1818: <div>
1819: <div>
1820: <h2 class="title" style="clear: both"><a name=
1821: "uptodate-cvs"></a>2.4. Keeping pkgsrc
1822: up-to-date via CVS</h2>
1823: </div>
1824: </div>
1825: </div>
1826:
1827: <p>If your copy of pkgsrc contains a lot of <code xmlns=
1828: "http://www.w3.org/TR/xhtml1/transitional" class=
1829: "filename">CVS</code> directories, you can update it
1830: using the <a href=
1831: "http://netbsd.gw.com/cgi-bin/man-cgi?cvs+1+NetBSD-current">
1832: <span class="citerefentry"><span class=
1833: "refentrytitle">cvs</span>(1)</span></a> program. First,
1834: <span><strong class="command">cd</strong></span> to the
1835: top level directory of pkgsrc. Then run
1836: <span><strong class="command">cvs -q update
1837: -dP</strong></span>, and you're done.</p>
1838:
1839: <p>If that doesn't work and the file <code xmlns=
1840: "http://www.w3.org/TR/xhtml1/transitional" class=
1841: "filename">CVS/Root</code> contains the string
1842: “<span class="quote">:pserver:</span>”, you
1843: have to run <span><strong class="command">cvs
1844: login</strong></span> once to get known to the NetBSD CVS
1845: server. The <span><strong class=
1846: "command">cvs</strong></span> utility will then ask you
1847: for a password. Just enter “<span class=
1848: "quote">anoncvs</span>”. Then try again to
1849: update.</p>
1850: </div>
1.1 grant 1851: </div>
1852:
1.63 dillo 1853: <div class="chapter" lang="en">
1.1 grant 1854: <div class="titlepage">
1855: <div>
1856: <div>
1.63 dillo 1857: <h2 class="title"><a name=
1.1 grant 1858: "platforms"></a>Chapter 3. Using pkgsrc on
1859: systems other than NetBSD</h2>
1860: </div>
1861: </div>
1862: </div>
1863:
1864: <div class="toc">
1865: <p><b>Table of Contents</b></p>
1866:
1867: <dl>
1.30 wiz 1868: <dt><span class="sect1"><a href=
1869: "#bootstrapping-pkgsrc">3.1. Bootstrapping
1870: pkgsrc</a></span></dt>
1.1 grant 1871:
1.30 wiz 1872: <dt><span class="sect1"><a href=
1.47 reed 1873: "#platform-specific-notes">3.2. Platform-specific
1.30 wiz 1874: notes</a></span></dt>
1.1 grant 1875:
1876: <dd>
1877: <dl>
1.30 wiz 1878: <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1 grant 1879: Darwin (Mac OS X)</a></span></dt>
1880:
1.30 wiz 1881: <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1 grant 1882: FreeBSD</a></span></dt>
1883:
1.30 wiz 1884: <dt><span class="sect2"><a href="#interix">3.2.3.
1.1 grant 1885: Interix</a></span></dt>
1886:
1.30 wiz 1887: <dt><span class="sect2"><a href="#irix">3.2.4.
1.1 grant 1888: IRIX</a></span></dt>
1889:
1.30 wiz 1890: <dt><span class="sect2"><a href="#linux">3.2.5.
1.22 tv 1891: Linux</a></span></dt>
1892:
1.30 wiz 1893: <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1 grant 1894: OpenBSD</a></span></dt>
1895:
1.30 wiz 1896: <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1 grant 1897: Solaris</a></span></dt>
1898: </dl>
1899: </dd>
1900: </dl>
1901: </div>
1902:
1.63 dillo 1903: <div class="sect1" lang="en">
1.1 grant 1904: <div class="titlepage">
1905: <div>
1906: <div>
1907: <h2 class="title" style="clear: both"><a name=
1.30 wiz 1908: "bootstrapping-pkgsrc"></a>3.1. Bootstrapping
1909: pkgsrc</h2>
1.1 grant 1910: </div>
1911: </div>
1912: </div>
1913:
1.27 rillig 1914: <p>For operating systems other than NetBSD, we provide a
1.1 grant 1915: bootstrap kit to build the required tools to use pkgsrc
1916: on your platform. Besides support for native NetBSD,
1917: pkgsrc and the bootstrap kit have support for the
1918: following operating systems:</p>
1919:
1920: <div class="itemizedlist">
1921: <ul type="disc">
1922: <li>
1923: <p>Darwin (Mac OS X)</p>
1924: </li>
1925:
1926: <li>
1.16 grant 1927: <p>DragonFlyBSD</p>
1928: </li>
1929:
1930: <li>
1.1 grant 1931: <p>FreeBSD</p>
1932: </li>
1933:
1934: <li>
1935: <p>Interix (Windows 2000, XP, 2003)</p>
1936: </li>
1937:
1938: <li>
1939: <p>IRIX</p>
1940: </li>
1941:
1942: <li>
1943: <p>Linux</p>
1944: </li>
1945:
1946: <li>
1947: <p>OpenBSD</p>
1948: </li>
1949:
1950: <li>
1951: <p>Solaris</p>
1952: </li>
1.16 grant 1953:
1954: <li>
1955: <p>Tru64 (Digital UNIX/OSF1)</p>
1956: </li>
1.1 grant 1957: </ul>
1958: </div>
1959:
1960: <p>Support for other platforms is under development.</p>
1961:
1962: <p>Installing the bootstrap kit should be as simple
1963: as:</p>
1964: <pre class="screen">
1.14 xtraeme 1965: <code class="prompt">#</code> <strong class=
1966: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
1967: <code class="prompt">#</code> <strong class=
1968: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
1969: <code class="prompt">#</code> <strong class=
1970: "userinput"><code>./bootstrap</code></strong>
1.1 grant 1971: </pre>
1972:
1973: <p>See <a href="#getting" title=
1.59 rillig 1974: "Chapter 2. Where to get pkgsrc and how to keep it up-to-date">
1.63 dillo 1975: Chapter 2, <i>Where to get pkgsrc and how to keep it
1.59 rillig 1976: up-to-date</i></a> for other ways to get pkgsrc before
1977: bootstrapping. The given <span><strong class=
1978: "command">bootstrap</strong></span> command will use the
1979: defaults of <code xmlns=
1.45 wiz 1980: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1981: "filename">/usr/pkg</code> for the <span class=
1982: "emphasis"><em>prefix</em></span> where programs will be
1.45 wiz 1983: installed in, and <code xmlns=
1984: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 1985: "filename">/var/db/pkg</code> for the package database
1.27 rillig 1986: directory where pkgsrc will do its internal bookkeeping.
1.1 grant 1987: However, these can also be set using command-line
1.27 rillig 1988: arguments.</p>
1.1 grant 1989:
1990: <p>Binary packages for the pkgsrc tools and an initial
1991: set of packages is available for supported platforms. An
1992: up-to-date list of these can be found on <a href=
1993: "http://www.pkgsrc.org/" target=
1.63 dillo 1994: "_top">www.pkgsrc.org</a>. Note that this only works for
1995: privileged builds that install into <code xmlns=
1996: "http://www.w3.org/TR/xhtml1/transitional" class=
1997: "filename">/usr/pkg</code>.</p>
1.47 reed 1998:
1999: <div class="note" style=
2000: "margin-left: 0.5in; margin-right: 0.5in;">
2001: <h3 class="title">Note</h3>
2002:
2003: <p>The bootstrap installs a <span><strong class=
2004: "command">bmake</strong></span> tool. Use this
2005: <span><strong class="command">bmake</strong></span>
2006: when building via pkgsrc. For examples in this guide,
2007: use <span><strong class="command">bmake</strong></span>
2008: instead of “<span class=
2009: "quote">make</span>”.</p>
2010: </div>
1.1 grant 2011: </div>
2012:
1.63 dillo 2013: <div class="sect1" lang="en">
1.1 grant 2014: <div class="titlepage">
2015: <div>
2016: <div>
2017: <h2 class="title" style="clear: both"><a name=
1.47 reed 2018: "platform-specific-notes"></a>3.2. Platform-specific
2019: notes</h2>
1.1 grant 2020: </div>
2021: </div>
2022: </div>
2023:
2024: <p>Here are some platform-specific notes you should be
2025: aware of.</p>
2026:
1.63 dillo 2027: <div class="sect2" lang="en">
1.1 grant 2028: <div class="titlepage">
2029: <div>
2030: <div>
1.63 dillo 2031: <h3 class="title"><a name=
1.30 wiz 2032: "darwin"></a>3.2.1. Darwin (Mac OS X)</h3>
1.1 grant 2033: </div>
2034: </div>
2035: </div>
2036:
2037: <p>Darwin 5.x and 6.x are supported. There are two
2038: methods of using pkgsrc on Mac OS X, by using a
2039: <a href="#platform.osx-image" title=
2040: "3.2.1.1. Using a disk image">disk image</a>, or a
2041: <a href="#platform.osx-ufs" title=
2042: "3.2.1.2. Using a UFS partition">UFS
2043: partition</a>.</p>
2044:
2045: <p>Before you start, you will need to download and
2046: install the Mac OS X Developer Tools from Apple's
2047: Developer Connection. See <a href=
2048: "http://developer.apple.com/macosx/" target=
2049: "_top">http://developer.apple.com/macosx/</a> for
2050: details. Also, make sure you install X11 for Mac OS X
2051: and the X11 SDK from <a href=
2052: "http://www.apple.com/macosx/x11/download/" target=
2053: "_top">http://www.apple.com/macosx/x11/download/</a> if
2054: you intend to build packages that use the X11 Window
2055: System.</p>
2056:
2057: <p>If you already have a UFS partition, or have a spare
2058: partition that you can format as UFS, it is recommended
2059: to use that instead of the disk image. It'll be
2060: somewhat faster and will mount automatically at boot
2061: time, where you must manually mount a disk image.</p>
2062:
2063: <div class="note" style=
2064: "margin-left: 0.5in; margin-right: 0.5in;">
2065: <h3 class="title">Note</h3>
2066:
2067: <p>You cannot use a HFS+ file system for pkgsrc,
1.47 reed 2068: because pkgsrc currently requires the file system to
1.1 grant 2069: be case-sensitive, and HFS+ is not.</p>
2070: </div>
2071:
1.63 dillo 2072: <div class="sect3" lang="en">
1.1 grant 2073: <div class="titlepage">
2074: <div>
2075: <div>
1.63 dillo 2076: <h4 class="title"><a name=
2077: "platform.osx-image"></a>3.2.1.1. Using a
2078: disk image</h4>
1.1 grant 2079: </div>
2080: </div>
2081: </div>
2082:
2083: <p>Create the disk image:</p>
2084: <pre class="screen">
1.14 xtraeme 2085: <code class="prompt">#</code> <strong class=
2086: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
2087: <code class="prompt">#</code> <strong class=
2088: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
2089: <code class="prompt">#</code> <strong class=
2090: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
2091: <code class="prompt">#</code> <strong class=
2092: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1 grant 2093: </pre>
2094:
2095: <p>That's it!</p>
2096: </div>
2097:
1.63 dillo 2098: <div class="sect3" lang="en">
1.1 grant 2099: <div class="titlepage">
2100: <div>
2101: <div>
1.63 dillo 2102: <h4 class="title"><a name=
2103: "platform.osx-ufs"></a>3.2.1.2. Using a
1.1 grant 2104: UFS partition</h4>
2105: </div>
2106: </div>
2107: </div>
2108:
1.45 wiz 2109: <p>By default, <code xmlns=
2110: "http://www.w3.org/TR/xhtml1/transitional" class=
2111: "filename">/usr</code> will be on your root file
2112: system, normally HFS+. It is possible to use the
2113: default <span class="emphasis"><em>prefix</em></span>
2114: of <code xmlns=
2115: "http://www.w3.org/TR/xhtml1/transitional" class=
2116: "filename">/usr/pkg</code> by symlinking <code xmlns=
2117: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2118: "filename">/usr/pkg</code> to a directory on a UFS
2119: file system. Obviously, another symlink is required
2120: if you want to place the package database directory
2121: outside the <span class=
2122: "emphasis"><em>prefix</em></span>. e.g.</p>
1.1 grant 2123: <pre class="screen">
1.14 xtraeme 2124: <code class="prompt">#</code> <strong class=
1.59 rillig 2125: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb</code></strong>
1.1 grant 2126: </pre>
2127:
2128: <p>If you created your partitions at the time of
2129: installing Mac OS X and formatted the target
2130: partition as UFS, it should automatically mount on
1.45 wiz 2131: <code xmlns=
2132: "http://www.w3.org/TR/xhtml1/transitional" class=
2133: "filename">/Volumes/<volume name></code> when
2134: the machine boots. If you are (re)formatting a
2135: partition as UFS, you need to ensure that the
2136: partition map correctly reflects “<span class=
2137: "quote">Apple_UFS</span>” and not
2138: “<span class=
1.1 grant 2139: "quote">Apple_HFS</span>”.</p>
2140:
2141: <p>The problem is that none of the disk tools will
2142: let you touch a disk that is booted from. You can
2143: unmount the partition, but even if you newfs it, the
2144: partition type will be incorrect and the automounter
2145: won't mount it. It can be mounted manually, but it
2146: won't appear in Finder.</p>
2147:
2148: <p>You'll need to boot off of the OS X Installation
2149: (User) CD. When the Installation program starts, go
2150: up to the menu and select Disk Utility. Now, you will
2151: be able to select the partition you want to be UFS,
2152: and Format it Apple UFS. Quit the Disk Utility, quit
2153: the installer which will reboot your machine. The new
2154: UFS file system will appear in Finder.</p>
2155:
2156: <p>Be aware that the permissions on the new file
2157: system will be writable by root only.</p>
2158:
2159: <p>This note is as of 10.2 (Jaguar) and applies to
2160: earlier versions. Hopefully Apple will fix Disk
2161: Utility in 10.3 (Panther).</p>
2162: </div>
2163: </div>
2164:
1.63 dillo 2165: <div class="sect2" lang="en">
1.1 grant 2166: <div class="titlepage">
2167: <div>
2168: <div>
1.63 dillo 2169: <h3 class="title"><a name=
1.30 wiz 2170: "freebsd"></a>3.2.2. FreeBSD</h3>
1.1 grant 2171: </div>
2172: </div>
2173: </div>
2174:
2175: <p>FreeBSD 4.7 and 5.0 have been tested and are
2176: supported, other versions may work.</p>
2177:
2178: <p>Care should be taken so that the tools that this kit
2179: installs do not conflict with the FreeBSD userland
2180: tools. There are several steps:</p>
2181:
2182: <div class="orderedlist">
2183: <ol type="1">
2184: <li>
2185: <p>FreeBSD stores its ports pkg database in
1.45 wiz 2186: <code xmlns=
2187: "http://www.w3.org/TR/xhtml1/transitional" class=
2188: "filename">/var/db/pkg</code>. It is therefore
2189: recommended that you choose a different location
2190: (e.g. <code xmlns=
2191: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2192: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2193: --pkgdbdir option to the bootstrap script.</p>
2194: </li>
2195:
2196: <li>
2197: <p>If you do not intend to use the FreeBSD ports
2198: tools, it's probably a good idea to move them out
2199: of the way to avoid confusion, e.g.</p>
2200: <pre class="screen">
1.14 xtraeme 2201: <code class="prompt">#</code> <strong class=
2202: "userinput"><code>cd /usr/sbin</code></strong>
2203: <code class="prompt">#</code> <strong class=
2204: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2205: <code class="prompt">#</code> <strong class=
2206: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2207: <code class="prompt">#</code> <strong class=
2208: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2209: <code class="prompt">#</code> <strong class=
2210: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2211: </pre>
2212: </li>
2213:
2214: <li>
1.45 wiz 2215: <p>An example <code xmlns=
2216: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2217: "filename">/etc/mk.conf</code> file will be
1.45 wiz 2218: placed in <code xmlns=
2219: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2220: "filename">/etc/mk.conf.example</code> file when
2221: you use the bootstrap script.</p>
1.1 grant 2222: </li>
2223: </ol>
2224: </div>
2225: </div>
2226:
1.63 dillo 2227: <div class="sect2" lang="en">
1.1 grant 2228: <div class="titlepage">
2229: <div>
2230: <div>
1.63 dillo 2231: <h3 class="title"><a name=
1.30 wiz 2232: "interix"></a>3.2.3. Interix</h3>
1.1 grant 2233: </div>
2234: </div>
2235: </div>
2236:
1.47 reed 2237: <p>Interix is a POSIX-compatible subsystem for the
1.1 grant 2238: Windows NT kernel, providing a Unix-like environment
2239: with a tighter kernel integration than available with
2240: Cygwin. It is part of the Windows Services for Unix
2241: package, available for free for any licensed copy of
1.22 tv 2242: Windows 2000, XP (not including XP Home), or 2003. SFU
2243: can be downloaded from <a href=
2244: "http://www.microsoft.com/windows/sfu/" target=
1.1 grant 2245: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
2246:
2247: <p>Services for Unix 3.5, current as of this writing,
2248: has been tested. 3.0 or 3.1 may work, but are not
2249: officially supported. (The main difference in 3.0/3.1
2250: is lack of pthreads.)</p>
2251:
1.63 dillo 2252: <div class="sect3" lang="en">
1.1 grant 2253: <div class="titlepage">
2254: <div>
2255: <div>
2256: <h4 class="title"><a name=
2257: "platform.interix-sfu-install"></a>3.2.3.1. When
1.2 hubertf 2258: installing Interix/SFU</h4>
1.1 grant 2259: </div>
2260: </div>
2261: </div>
2262:
2263: <p>At an absolute minimum, the following packages
2264: must be installed from the Windows Services for Unix
2265: 3.5 distribution in order to use pkgsrc:</p>
2266:
2267: <div class="itemizedlist">
2268: <ul type="disc">
2269: <li>
2270: <p>Utilities -> Base Utilities</p>
2271: </li>
2272:
2273: <li>
2274: <p>Interix GNU Components -> (all)</p>
2275: </li>
2276:
2277: <li>
2278: <p>Remote Connectivity</p>
2279: </li>
2280:
2281: <li>
2282: <p>Interix SDK</p>
2283: </li>
2284: </ul>
2285: </div>
2286:
2287: <p>When using pkgsrc on Interix, DO NOT install the
2288: Utilities subcomponent "UNIX Perl". That is Perl 5.6
2289: without shared module support, installed to
2290: /usr/local, and will only cause confusion. Instead,
2291: install Perl 5.8 from pkgsrc (or from a binary
2292: package).</p>
2293:
2294: <p>The Remote Connectivity subcomponent "Windows
2295: Remote Shell Service" does not need to be installed,
2296: but Remote Connectivity itself should be installed in
2297: order to have a working inetd.</p>
2298:
1.52 tv 2299: <p>During installation you may be asked whether to
2300: enable setuid behavior for Interix programs, and
2301: whether to make pathnames default to case-sensitive.
2302: Setuid should be enabled, and case-sensitivity MUST
2303: be enabled. (Without case-sensitivity, a large number
2304: of packages including perl will not build.)</p>
2305:
2306: <p>NOTE: Newer Windows service packs change the way
2307: binary execution works (via the Data Execution
2308: Prevention feature). In order to use pkgsrc and other
2309: gcc-compiled binaries reliably, a hotfix containing
2310: POSIX.EXE, PSXDLL.DLL, PSXRUN.EXE, and PSXSS.EXE
2311: (899522 or newer) must be installed. Hotfixes are
2312: available from Microsoft through a support contract;
2313: however, a NetBSD developer has made most Interix
2314: hotfixes available for personal use from <a href=
2315: "http://www.duh.org/interix/hotfixes.php" target=
2316: "_top">http://www.duh.org/interix/hotfixes.php</a>.</p>
1.1 grant 2317: </div>
2318:
1.63 dillo 2319: <div class="sect3" lang="en">
1.1 grant 2320: <div class="titlepage">
2321: <div>
2322: <div>
2323: <h4 class="title"><a name=
2324: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
2325: to do if Interix/SFU is already installed</h4>
2326: </div>
2327: </div>
2328: </div>
2329:
2330: <p>If SFU is already installed and you wish to alter
2331: these settings to work with pkgsrc, note the
2332: following things.</p>
2333:
2334: <div class="itemizedlist">
2335: <ul type="disc">
2336: <li>
2337: <p>To uninstall UNIX Perl, use Add/Remove
2338: Programs, select Microsoft Windows Services for
2339: UNIX, then click Change. In the installer,
2340: choose Add or Remove, then uncheck
2341: Utilities->UNIX Perl.</p>
2342: </li>
2343:
2344: <li>
1.47 reed 2345: <p>To enable case-sensitivity for the file
2346: system, run REGEDIT.EXE, and change the
1.1 grant 2347: following registry key:</p>
2348:
2349: <p>
2350: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
2351: Manager\kernel</p>
2352:
2353: <p>Set the DWORD value "obcaseinsensitive" to
2354: 0; then reboot.</p>
2355: </li>
2356:
2357: <li>
2358: <p>To enable setuid binaries (optional), run
2359: REGEDIT.EXE, and change the following registry
2360: key:</p>
2361:
2362: <p>
2363: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
2364: for UNIX</p>
2365:
2366: <p>Set the DWORD value "EnableSetuidBinaries"
2367: to 1; then reboot.</p>
2368: </li>
2369: </ul>
2370: </div>
2371: </div>
2372:
1.63 dillo 2373: <div class="sect3" lang="en">
1.1 grant 2374: <div class="titlepage">
2375: <div>
2376: <div>
2377: <h4 class="title"><a name=
2378: "platform.interix-notes"></a>3.2.3.3. Important
2379: notes for using pkgsrc</h4>
2380: </div>
2381: </div>
2382: </div>
2383:
1.52 tv 2384: <p>The package manager (either the pkgsrc "su" user,
1.1 grant 2385: or the user running "pkg_add") must be a member of
2386: the local Administrators group. Such a user must also
2387: be used to run the bootstrap. This is slightly
2388: relaxed from the normal pkgsrc requirement of
2389: "root".</p>
2390:
2391: <p>The package manager should use a umask of 002.
2392: "make install" will automatically complain if this is
2393: not the case. This ensures that directories written
2394: in /var/db/pkg are Administrators-group
2395: writeable.</p>
2396:
2397: <p>The popular Interix binary packages from
2398: http://www.interopsystems.com/ use an older version
2399: of pkgsrc's pkg_* tools. Ideally, these should NOT be
2400: used in conjunction with pkgsrc. If you choose to use
2401: them at the same time as the pkgsrc packages, ensure
2402: that you use the proper pkg_* tools for each type of
2403: binary package.</p>
1.22 tv 2404:
2405: <p>The TERM setting used for DOS-type console windows
2406: (including those invoked by the csh and ksh startup
2407: shortcuts) is "interix". Most systems don't have a
2408: termcap/terminfo entry for it, but the following
2409: .termcap entry provides adequate emulation in most
2410: cases:</p>
2411: <pre class="programlisting">
1.51 rillig 2412: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
1.22 tv 2413: </pre>
1.1 grant 2414: </div>
1.52 tv 2415:
1.63 dillo 2416: <div class="sect3" lang="en">
1.52 tv 2417: <div class="titlepage">
2418: <div>
2419: <div>
2420: <h4 class="title"><a name=
2421: "platform.interix-limits"></a>3.2.3.4. Limitations
2422: of the Interix platform</h4>
2423: </div>
2424: </div>
2425: </div>
2426:
2427: <p>Though Interix suffices as a familiar and flexible
2428: substitute for a full Unix-like platform, it has some
2429: drawbacks that should be noted for those desiring to
2430: make the most of Interix.</p>
2431:
2432: <div class="itemizedlist">
2433: <ul type="disc">
2434: <li>
1.54 tv 2435: <p><span class=
1.57 minskim 2436: "strong"><strong>X11:</strong></span></p>
1.52 tv 2437:
2438: <p>Interix comes with the standard set of X11R6
1.57 minskim 2439: client libraries, and can run X11 based
1.52 tv 2440: applications, but it does <span class=
2441: "emphasis"><em>not</em></span> come with an X
2442: server. Some options are <a href=
2443: "http://www.starnet.com/products/xwin32/"
2444: target="_top">StarNet X-Win32</a>, <a href=
2445: "http://connectivity.hummingbird.com/products/nc/exceed/"
1.57 minskim 2446: target="_top">Hummingbird Exceed</a> (available
2447: in a trimmed version for Interix from Interop
2448: Systems as the <a href=
2449: "http://www.interopsystems.com/InteropXserver.htm"
2450: target="_top">Interop X Server</a>), and the
2451: free X11 server included with <a href=
1.52 tv 2452: "http://x.cygwin.com/" target=
2453: "_top">Cygwin</a>.</p>
2454:
2455: <p>Also, StarNet Communications has graciously
2456: provided a free version of their X-Win32
2457: product that accepts connections only from
2458: localhost: <a href=
2459: "http://www.starnet.com/xwin32LX/get_xwin32LX.htm"
2460: target="_top">X-Win32 LX</a>, recommended by
2461: the maintainer of Interix pkgsrc support.</p>
2462: </li>
2463:
2464: <li>
1.57 minskim 2465: <p><span class="strong"><strong>X11
1.54 tv 2466: acceleration:</strong></span></p>
1.52 tv 2467:
2468: <p>Because Interix runs in a completely
2469: different NT subsystem from Win32 applications,
2470: it does not currently support various X11
2471: protocol extensions for acceleration (such as
2472: MIT-SHM or DGA). Most interactive applications
2473: to a local X server will run reasonably fast,
2474: but full motion video and other graphics
2475: intensive applications may require a
2476: faster-than-expected CPU.</p>
2477: </li>
2478:
2479: <li>
1.54 tv 2480: <p><span class=
2481: "strong"><strong>Audio:</strong></span></p>
1.52 tv 2482:
2483: <p>Interix has no native support for audio
1.53 tv 2484: output. For audio support, pkgsrc uses the
2485: <span><strong class=
1.52 tv 2486: "command">esound</strong></span> client/server
2487: audio system on Interix. Unlike on most
2488: platforms, the <a xmlns=
2489: "http://www.w3.org/TR/xhtml1/transitional"
2490: href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/esound/README.html"
2491: target="_top"><code xmlns="" class=
2492: "filename">audio/esound</code></a> package does
2493: <span class="emphasis"><em>not</em></span>
2494: contain the <span><strong class=
1.53 tv 2495: "command">esd</strong></span> server component.
2496: To output audio via an Interix host, the
2497: <a xmlns=
1.52 tv 2498: "http://www.w3.org/TR/xhtml1/transitional"
2499: href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/cygwin_esound/README.html"
2500: target="_top"><code xmlns="" class=
2501: "filename">emulators/cygwin_esound</code></a>
2502: package must also be installed.</p>
2503: </li>
2504:
2505: <li>
1.54 tv 2506: <p><span class="strong"><strong>CD/DVDs, USB,
2507: and SCSI:</strong></span></p>
1.52 tv 2508:
2509: <p>Direct device access is not currently
2510: supported in Interix, so it is not currently
2511: possible to access CD/DVD drives, USB devices,
2512: or SCSI devices through non-filesystem means.
2513: Among other things, this makes it impossible to
2514: use Interix directly for CD/DVD burning.</p>
2515: </li>
2516:
2517: <li>
1.54 tv 2518: <p><span class="strong"><strong>Tape
2519: drives:</strong></span></p>
1.52 tv 2520:
2521: <p>Due to the same limitations as for CD-ROMs
2522: and SCSI devices, tape drives are also not
2523: directly accessible in Interix. However,
2524: support is in work to make tape drive access
2525: possible by using Cygwin as a bridge (similarly
2526: to audio bridged via Cygwin's esound
2527: server).</p>
2528: </li>
2529: </ul>
2530: </div>
2531: </div>
2532:
1.63 dillo 2533: <div class="sect3" lang="en">
1.52 tv 2534: <div class="titlepage">
2535: <div>
2536: <div>
2537: <h4 class="title"><a name=
2538: "platform.interix-knownissues"></a>3.2.3.5. Known
2539: issues for pkgsrc on Interix</h4>
2540: </div>
2541: </div>
2542: </div>
2543:
2544: <p>It is not necessary, in general, to have a "root"
2545: user on the Windows system; any member of the local
2546: Administrators group will suffice. However, some
2547: packages currently assume that the user named "root"
2548: is the privileged user. To accommodate these, you may
2549: create such a user; make sure it is in the local
2550: group Administrators (or your language
2551: equivalent).</p>
2552:
2553: <p>"pkg_add" creates directories of mode 0755, not
2554: 0775, in $PKG_DBDIR. For the time being, install
2555: packages as the local Administrator (or your language
2556: equivalent), or run the following command after
2557: installing a package to work around the issue:</p>
2558: <pre class="screen">
2559: <code class="prompt">#</code> <strong class=
2560: "userinput"><code>chmod -R g+w $PKG_DBDIR</code></strong>
2561: </pre>
2562: </div>
1.1 grant 2563: </div>
2564:
1.63 dillo 2565: <div class="sect2" lang="en">
1.1 grant 2566: <div class="titlepage">
2567: <div>
2568: <div>
1.63 dillo 2569: <h3 class="title"><a name=
1.30 wiz 2570: "irix"></a>3.2.4. IRIX</h3>
1.1 grant 2571: </div>
2572: </div>
2573: </div>
2574:
2575: <p>You will need a working C compiler, either gcc or
2576: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14 xtraeme 2577: the <code class="varname">CC</code> environment
2578: variable according to your preference. If you do not
2579: have a license for the MIPSpro compiler suite, you can
1.1 grant 2580: download a gcc tardist file from <a href=
2581: "http://freeware.sgi.com/" target=
2582: "_top">http://freeware.sgi.com/</a>.</p>
2583:
2584: <p>Please note that you will need IRIX 6.5.17 or
2585: higher, as this is the earliest version of IRIX
1.24 wiz 2586: providing support for <a href=
2587: "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
2588: <span class="citerefentry"><span class=
2589: "refentrytitle">if_indextoname</span>(3)</span></a>,
2590: <a href=
2591: "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
2592: <span class="citerefentry"><span class=
2593: "refentrytitle">if_nametoindex</span>(3)</span></a>,
2594: etc.</p>
1.1 grant 2595:
1.27 rillig 2596: <p>At this point in time, pkgsrc only supports one ABI
2597: at a time. That is, you can not switch between the old
2598: 32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
2599: you start out using "abi=n32", that's what all your
2600: packages will be built with.</p>
1.1 grant 2601:
2602: <p>Therefore, please make sure that you have no
1.14 xtraeme 2603: conflicting <code class="varname">CFLAGS</code> in your
1.45 wiz 2604: environment or the <code xmlns=
2605: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2606: "filename">/etc/mk.conf</code>. Particularly, make sure
1.1 grant 2607: that you do not try to link n32 object files with lib64
1.45 wiz 2608: or vice versa. Check your <code xmlns=
2609: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2610: "filename">/etc/compiler.defaults</code>!</p>
1.1 grant 2611:
2612: <p>If you have the actual pkgsrc tree mounted via NFS
2613: from a different host, please make sure to set
1.14 xtraeme 2614: <code class="varname">WRKOBJDIR</code> to a local
1.1 grant 2615: directory, as it appears that IRIX linker occasionally
1.47 reed 2616: runs into issues when trying to link over a
2617: network-mounted file system.</p>
1.1 grant 2618:
2619: <p>The bootstrapping process should set all the right
2620: options for programs such as imake(1), but you may want
2621: to set some options depending on your local setup.
1.45 wiz 2622: Please see <code xmlns=
2623: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2624: "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27 rillig 2625: course, your compiler's man pages for details.</p>
1.22 tv 2626:
2627: <p>If you are using SGI's MIPSPro compiler, please
2628: set</p>
2629: <pre class="programlisting">
1.51 rillig 2630: PKGSRC_COMPILER= mipspro
1.22 tv 2631: </pre>
2632:
1.45 wiz 2633: <p>in <code xmlns=
2634: "http://www.w3.org/TR/xhtml1/transitional" class=
2635: "filename">/etc/mk.conf</code>. Otherwise, pkgsrc will
2636: assume you are using gcc and may end up passing invalid
2637: flags to the compiler. Note that bootstrap should
2638: create an appropriate <code xmlns=
2639: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2640: "filename">mk.conf.example</code> by default.</p>
2641:
2642: <p>If you have both the MIPSPro compiler chain
2643: installed as well as gcc, but want to make sure that
2644: MIPRPro is used, please set your <code class=
2645: "varname">PATH</code> to <span class=
2646: "emphasis"><em>not</em></span> include the location of
1.45 wiz 2647: gcc (often <code xmlns=
2648: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2649: "filename">/usr/freeware/bin</code>), and (important)
2650: pass the '--preserve-path' flag.</p>
1.1 grant 2651: </div>
2652:
1.63 dillo 2653: <div class="sect2" lang="en">
1.1 grant 2654: <div class="titlepage">
2655: <div>
2656: <div>
1.63 dillo 2657: <h3 class="title"><a name=
1.30 wiz 2658: "linux"></a>3.2.5. Linux</h3>
1.22 tv 2659: </div>
2660: </div>
2661: </div>
2662:
2663: <p>Some versions of Linux (for example Debian
2664: GNU/Linux) need either libtermcap or libcurses
2665: (libncurses). Installing the distributions
2666: libncurses-dev package (or equivalent) should fix the
2667: problem.</p>
2668:
2669: <p>pkgsrc supports both gcc (GNU Compiler Collection)
2670: and icc (Intel C++ Compiler). gcc is the default. icc
2671: 8.0 and 8.1 on i386 have been tested.</p>
2672:
2673: <p>To bootstrap using icc, assuming the default icc
2674: installation directory:</p>
2675: <pre class="programlisting">
1.51 rillig 2676: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
2677: ac_cv___attribute__=yes ./bootstrap
1.22 tv 2678: </pre>
2679:
2680: <div class="note" style=
2681: "margin-left: 0.5in; margin-right: 0.5in;">
2682: <h3 class="title">Note</h3>
2683:
2684: <p>icc 8.1 needs the `-i-static' argument instead of
2685: -static-libcxa.</p>
2686: </div>
2687:
2688: <p>icc supports __attribute__, but the GNU configure
2689: test uses a nested function, which icc does not
2690: support. #undef'ing __attribute__ has the unfortunate
2691: side-effect of breaking many of the Linux header files,
2692: which cannot be compiled properly without
2693: __attribute__. The test must be overridden so that
2694: __attribute__ is assumed supported by the compiler.</p>
2695:
2696: <p>After bootstrapping, you should set <code class=
1.45 wiz 2697: "varname">PKGSRC_COMPILER</code> in <code xmlns=
2698: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2699: "filename">/etc/mk.conf</code>:</p>
2700: <pre class="programlisting">
1.51 rillig 2701: PKGSRC_COMPILER= icc
1.22 tv 2702: </pre>
2703:
2704: <p>The default installation directory for icc is
1.45 wiz 2705: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
2706: class="filename">/opt/intel_cc_80</code>, which is also
2707: the pkgsrc default. If you have installed it into a
2708: different directory, set <code class=
2709: "varname">ICCBASE</code> in <code xmlns=
2710: "http://www.w3.org/TR/xhtml1/transitional" class=
1.22 tv 2711: "filename">/etc/mk.conf</code>:</p>
2712: <pre class="programlisting">
1.51 rillig 2713: ICCBASE= /opt/icc
1.22 tv 2714: </pre>
2715:
2716: <p>pkgsrc uses the static linking method of the runtime
2717: libraries provided by icc, so binaries can be run on
2718: other systems which do not have the shared libraries
2719: installed.</p>
2720:
2721: <p>Libtool, however, extracts a list of libraries from
1.24 wiz 2722: the <a href=
2723: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
2724: <span class="citerefentry"><span class=
2725: "refentrytitle">ld</span>(1)</span></a> command run
2726: when linking a C++ shared library and records it,
2727: throwing away the -Bstatic and -Bdynamic options
2728: interspersed between the libraries. This means that
2729: libtool-linked C++ shared libraries will have a runtime
2730: dependency on the icc libraries until this is fixed in
2731: libtool.</p>
1.22 tv 2732: </div>
2733:
1.63 dillo 2734: <div class="sect2" lang="en">
1.22 tv 2735: <div class="titlepage">
2736: <div>
2737: <div>
1.63 dillo 2738: <h3 class="title"><a name=
1.30 wiz 2739: "openbsd"></a>3.2.6. OpenBSD</h3>
1.1 grant 2740: </div>
2741: </div>
2742: </div>
2743:
2744: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
2745:
2746: <p>Care should be taken so that the tools that this kit
2747: installs do not conflict with the OpenBSD userland
2748: tools. There are several steps:</p>
2749:
2750: <div class="orderedlist">
2751: <ol type="1">
2752: <li>
2753: <p>OpenBSD stores its ports pkg database in
1.45 wiz 2754: <code xmlns=
2755: "http://www.w3.org/TR/xhtml1/transitional" class=
2756: "filename">/var/db/pkg</code>. It is therefore
2757: recommended that you choose a different location
2758: (e.g. <code xmlns=
2759: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2760: "filename">/usr/pkgdb</code>) by using the
1.1 grant 2761: --pkgdbdir option to the bootstrap script.</p>
2762: </li>
2763:
2764: <li>
2765: <p>If you do not intend to use the OpenBSD ports
2766: tools, it's probably a good idea to move them out
2767: of the way to avoid confusion, e.g.</p>
2768: <pre class="screen">
1.14 xtraeme 2769: <code class="prompt">#</code> <strong class=
2770: "userinput"><code>cd /usr/sbin</code></strong>
2771: <code class="prompt">#</code> <strong class=
2772: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
2773: <code class="prompt">#</code> <strong class=
2774: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
2775: <code class="prompt">#</code> <strong class=
2776: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
2777: <code class="prompt">#</code> <strong class=
2778: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1 grant 2779: </pre>
2780: </li>
2781:
2782: <li>
1.45 wiz 2783: <p>An example <code xmlns=
2784: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2785: "filename">/etc/mk.conf</code> file will be
1.45 wiz 2786: placed in <code xmlns=
2787: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2788: "filename">/etc/mk.conf.example</code> file when
2789: you use the bootstrap script. OpenBSD's make
1.45 wiz 2790: program uses <code xmlns=
2791: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2792: "filename">/etc/mk.conf</code> as well. You can
1.47 reed 2793: work around this by enclosing all the
2794: pkgsrc-specific parts of the file with:</p>
1.1 grant 2795: <pre class="programlisting">
1.51 rillig 2796: .ifdef BSD_PKG_MK
2797: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
2798: .else
2799: # OpenBSD stuff
2800: .endif
1.1 grant 2801: </pre>
2802: </li>
2803: </ol>
2804: </div>
2805: </div>
2806:
1.63 dillo 2807: <div class="sect2" lang="en">
1.1 grant 2808: <div class="titlepage">
2809: <div>
2810: <div>
1.63 dillo 2811: <h3 class="title"><a name=
1.30 wiz 2812: "solaris"></a>3.2.7. Solaris</h3>
1.1 grant 2813: </div>
2814: </div>
2815: </div>
2816:
2817: <p>Solaris 2.6 through 9 are supported on both x86 and
2818: sparc. You will need a working C compiler. Both gcc
2819: 2.95.3 and Sun WorkShop 5 have been tested.</p>
2820:
2821: <p>The following packages are required on Solaris 8 for
2822: the bootstrap process and to build packages.</p>
2823:
2824: <div class="itemizedlist">
2825: <ul type="disc">
2826: <li>
2827: <p>SUNWsprot</p>
2828: </li>
2829:
2830: <li>
2831: <p>SUNWarc</p>
2832: </li>
2833:
2834: <li>
2835: <p>SUNWbtool</p>
2836: </li>
2837:
2838: <li>
2839: <p>SUNWtoo</p>
2840: </li>
2841:
2842: <li>
2843: <p>SUNWlibm</p>
2844: </li>
2845: </ul>
2846: </div>
2847:
2848: <p>Please note the use of GNU binutils on Solaris is
2849: <span class="emphasis"><em>not</em></span>
2850: supported.</p>
2851:
1.63 dillo 2852: <div class="sect3" lang="en">
1.1 grant 2853: <div class="titlepage">
2854: <div>
2855: <div>
1.63 dillo 2856: <h4 class="title"><a name=
2857: "solaris-gcc-note"></a>3.2.7.1. If you are
2858: using gcc</h4>
1.1 grant 2859: </div>
2860: </div>
2861: </div>
2862:
2863: <p>It makes life much simpler if you only use the
2864: same gcc consistently for building all packages.</p>
2865:
2866: <p>It is recommended that an external gcc be used
2867: only for bootstrapping, then either build gcc from
2868: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
2869: href=
2870: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.45 wiz 2871: target="_top"><code xmlns="" class=
2872: "filename">lang/gcc</code></a> or install a binary
2873: gcc package, then remove gcc used during
1.20 ben 2874: bootstrapping.</p>
1.1 grant 2875:
2876: <p>Binary packages of gcc can be found through
2877: <a href=
2878: "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20 ben 2879: target=
2880: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1 grant 2881: </div>
2882:
1.63 dillo 2883: <div class="sect3" lang="en">
1.1 grant 2884: <div class="titlepage">
2885: <div>
2886: <div>
1.30 wiz 2887: <h4 class="title"><a name=
2888: "solaris-sun-workshop-note"></a>3.2.7.2. If
2889: you are using Sun WorkShop</h4>
1.1 grant 2890: </div>
2891: </div>
2892: </div>
2893:
2894: <p>You will need at least the following packages
2895: installed (from WorkShop 5.0)</p>
2896:
2897: <div class="itemizedlist">
2898: <ul type="disc">
2899: <li>
2900: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
2901: </li>
2902:
2903: <li>
2904: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
2905: </li>
2906:
2907: <li>
2908: <p>SPROild - Sun WorkShop Incremental
2909: Linker</p>
2910: </li>
2911:
2912: <li>
2913: <p>SPROlang - Sun WorkShop Compilers common
2914: components</p>
2915: </li>
2916: </ul>
2917: </div>
2918:
1.14 xtraeme 2919: <p>You should set <code class="varname">CC</code>,
2920: <code class="varname">CXX</code> and optionally,
1.45 wiz 2921: <code class="varname">CPP</code> in <code xmlns=
2922: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 2923: "filename">/etc/mk.conf</code>, e.g.:</p>
1.1 grant 2924: <pre class="programlisting">
1.51 rillig 2925: CC= cc
2926: CXX= CC
2927: CPP= /usr/ccs/lib/cpp
1.1 grant 2928: </pre>
2929:
2930: <p>You may also want to build 64-bit binaries,
1.47 reed 2931: e.g.:</p>
1.1 grant 2932: <pre class="programlisting">
1.51 rillig 2933: CFLAGS= -xtarget=ultra -xarch=v9
1.1 grant 2934: </pre>
2935:
2936: <p>Whichever compiler you use, please ensure the
2937: compiler tools and your $prefix are in your
1.14 xtraeme 2938: <code class="varname">PATH</code>. This includes
1.45 wiz 2939: <code xmlns=
2940: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 2941: "filename">/usr/ccs/{bin,lib}</code> and e.g.
1.45 wiz 2942: <code xmlns=
2943: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 2944: "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1 grant 2945: </div>
2946: </div>
2947: </div>
2948: </div>
2949:
1.63 dillo 2950: <div class="chapter" lang="en">
1.1 grant 2951: <div class="titlepage">
2952: <div>
2953: <div>
1.63 dillo 2954: <h2 class="title"><a name=
1.1 grant 2955: "using"></a>Chapter 4. Using pkgsrc</h2>
2956: </div>
2957: </div>
2958: </div>
2959:
2960: <div class="toc">
2961: <p><b>Table of Contents</b></p>
2962:
2963: <dl>
2964: <dt><span class="sect1"><a href="#getting-started">4.1.
2965: Working with binary packages</a></span></dt>
2966:
2967: <dd>
2968: <dl>
1.30 wiz 2969: <dt><span class="sect2"><a href=
2970: "#where-to-get-binary-packages">4.1.1. Where to get
2971: binary packages</a></span></dt>
1.1 grant 2972:
1.30 wiz 2973: <dt><span class="sect2"><a href=
2974: "#how-to-use-binary-packages">4.1.2. How to use
2975: binary packages</a></span></dt>
1.1 grant 2976:
1.30 wiz 2977: <dt><span class="sect2"><a href=
2978: "#a-word-of-warning">4.1.3. A word of
2979: warning</a></span></dt>
1.1 grant 2980: </dl>
2981: </dd>
2982:
1.30 wiz 2983: <dt><span class="sect1"><a href=
2984: "#building-packages-from-source">4.2. Building packages
2985: from source</a></span></dt>
1.1 grant 2986:
2987: <dd>
2988: <dl>
1.30 wiz 2989: <dt><span class="sect2"><a href=
2990: "#requirements">4.2.1. Requirements</a></span></dt>
1.1 grant 2991:
1.30 wiz 2992: <dt><span class="sect2"><a href=
2993: "#fetching-distfiles">4.2.2. Fetching
2994: distfiles</a></span></dt>
1.1 grant 2995:
1.30 wiz 2996: <dt><span class="sect2"><a href=
2997: "#how-to-build-and-install">4.2.3. How to build and
2998: install</a></span></dt>
1.1 grant 2999:
1.30 wiz 3000: <dt><span class="sect2"><a href=
3001: "#selecting-the-compiler">4.2.4. Selecting the
3002: compiler</a></span></dt>
1.1 grant 3003: </dl>
3004: </dd>
3005: </dl>
3006: </div>
3007:
1.63 dillo 3008: <div class="sect1" lang="en">
1.1 grant 3009: <div class="titlepage">
3010: <div>
3011: <div>
3012: <h2 class="title" style="clear: both"><a name=
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.63 dillo 3023: <div class="sect2" lang="en">
1.1 grant 3024: <div class="titlepage">
3025: <div>
3026: <div>
1.30 wiz 3027: <h3 class="title"><a name=
3028: "where-to-get-binary-packages"></a>4.1.1. Where
3029: to get binary packages</h3>
1.1 grant 3030: </div>
3031: </div>
3032: </div>
3033:
3034: <p>Precompiled packages are stored on ftp.NetBSD.org
1.45 wiz 3035: and its mirrors in the directory <code xmlns=
3036: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 3037: "filename">/pub/NetBSD/packages/<OSVERSION>/<ARCH>/</code>
3038: for anonymous FTP access. <code class=
3039: "varname">OSVERSION</code> is the NetBSD version
3040: (<span><strong class="command">uname
3041: -r</strong></span>), <code class="varname">ARCH</code>
3042: is the architecture (<span><strong class=
3043: "command">uname -p</strong></span>). In that directory,
3044: there is a subdirectory for each category plus a
1.45 wiz 3045: subdirectory <code xmlns=
3046: "http://www.w3.org/TR/xhtml1/transitional" class=
3047: "filename">All</code> which includes the actual
3048: binaries in <code xmlns=
3049: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 3050: "filename">.tgz</code> files. The category
3051: subdirectories use symbolic links to those files (this
1.45 wiz 3052: is the same directory layout as in <code xmlns=
3053: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3054: "filename">/usr/pkgsrc/packages</code>).</p>
1.1 grant 3055:
1.47 reed 3056: <p>This same directory layout applies for CD-ROM
1.1 grant 3057: distributions, only that the directory may be rooted
1.45 wiz 3058: somewhere else, probably somewhere below <code xmlns=
3059: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 3060: "filename">/cdrom</code>. Please consult your CD-ROMs
1.1 grant 3061: documentation for the exact location.</p>
3062: </div>
3063:
1.63 dillo 3064: <div class="sect2" lang="en">
1.1 grant 3065: <div class="titlepage">
3066: <div>
3067: <div>
1.30 wiz 3068: <h3 class="title"><a name=
3069: "how-to-use-binary-packages"></a>4.1.2. How
3070: to use binary packages</h3>
1.1 grant 3071: </div>
3072: </div>
3073: </div>
3074:
1.47 reed 3075: <p>If you have the files on a CD-ROM or downloaded them
1.23 wiz 3076: to your hard disk, you can install them with the
1.27 rillig 3077: following command (be sure to <span><strong class=
1.14 xtraeme 3078: "command">su</strong></span> to root first):</p>
1.1 grant 3079: <pre class="screen">
1.14 xtraeme 3080: <code class="prompt">#</code> <strong class=
3081: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1 grant 3082: </pre>
3083:
3084: <p>If you have FTP access and you don't want to
3085: download the packages via FTP prior to installation,
1.14 xtraeme 3086: you can do this automatically by giving
3087: <span><strong class="command">pkg_add</strong></span>
3088: an FTP URL:</p>
1.1 grant 3089: <pre class="screen">
1.14 xtraeme 3090: <code class="prompt">#</code> <strong class=
1.27 rillig 3091: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSVERSION>/<ARCH>/All/package.tgz</code></strong>
1.1 grant 3092: </pre>
3093:
1.27 rillig 3094: <p>Note that any prerequisite packages needed to run
3095: the package in question will be installed, too,
1.1 grant 3096: assuming they are present where you install from.</p>
3097:
1.23 wiz 3098: <p>To save some typing, you can set the <code class=
3099: "varname">PKG_PATH</code> environment variable to a
1.47 reed 3100: semicolon-separated list of paths (including remote
1.23 wiz 3101: URLs); trailing slashes are not allowed.</p>
3102:
1.45 wiz 3103: <p>Additionally to the <code xmlns=
3104: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 3105: "filename">All</code> directory there exists a
1.45 wiz 3106: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3107: class="filename">vulnerable</code> directory to which
3108: binary packages with known vulnerabilities are moved,
3109: since removing them could cause missing dependencies.
3110: To use these packages, add the <code xmlns=
3111: "http://www.w3.org/TR/xhtml1/transitional" class=
3112: "filename">vulnerable</code> directory to your
3113: <code class="varname">PKG_PATH</code>. However, you
3114: should run <a xmlns=
1.23 wiz 3115: "http://www.w3.org/TR/xhtml1/transitional" href=
3116: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 3117: target="_top"><code xmlns="" class=
3118: "filename">security/audit-packages</code></a>
1.47 reed 3119: regularly, especially after installing new packages,
3120: and verify that the vulnerabilities are acceptable for
3121: your configuration. An example <code class=
3122: "varname">PKG_PATH</code> would be: <code xmlns=
3123: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 3124: "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 3125: Please note that semicolon (';') is a shell
3126: meta-character, so you'll probably have to quote
3127: it.</p>
3128:
1.1 grant 3129: <p>After you've installed packages, be sure to have
1.45 wiz 3130: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3131: class="filename">/usr/pkg/bin</code> and <code xmlns=
3132: "http://www.w3.org/TR/xhtml1/transitional" class=
3133: "filename">/usr/pkg/sbin</code> in your <code class=
3134: "varname">PATH</code> so you can actually start the
3135: just installed program.</p>
1.1 grant 3136: </div>
3137:
1.63 dillo 3138: <div class="sect2" lang="en">
1.1 grant 3139: <div class="titlepage">
3140: <div>
3141: <div>
1.63 dillo 3142: <h3 class="title"><a name=
1.30 wiz 3143: "a-word-of-warning"></a>4.1.3. A word of
1.1 grant 3144: warning</h3>
3145: </div>
3146: </div>
3147: </div>
3148:
3149: <p>Please pay very careful attention to the warnings
3150: expressed in the <a href=
3151: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3152: <span class="citerefentry"><span class=
3153: "refentrytitle">pkg_add</span>(1)</span></a> manual
3154: page about the inherent dangers of installing binary
3155: packages which you did not create yourself, and the
3156: security holes that can be introduced onto your system
3157: by indiscriminate adding of such files.</p>
3158: </div>
3159: </div>
3160:
1.63 dillo 3161: <div class="sect1" lang="en">
1.1 grant 3162: <div class="titlepage">
3163: <div>
3164: <div>
3165: <h2 class="title" style="clear: both"><a name=
1.30 wiz 3166: "building-packages-from-source"></a>4.2. Building
1.1 grant 3167: packages from source</h2>
3168: </div>
3169: </div>
3170: </div>
3171:
3172: <p>This assumes that the package is already in pkgsrc. If
3173: it is not, see <a href="#developers-guide" title=
1.46 gdt 3174: "Part II. The pkgsrc developer's guide">Part II,
1.27 rillig 3175: “The pkgsrc developer's guide”</a> for
3176: instructions how to create your own packages.</p>
1.1 grant 3177:
1.63 dillo 3178: <div class="sect2" lang="en">
1.1 grant 3179: <div class="titlepage">
3180: <div>
3181: <div>
1.63 dillo 3182: <h3 class="title"><a name=
1.30 wiz 3183: "requirements"></a>4.2.1. Requirements</h3>
1.1 grant 3184: </div>
3185: </div>
3186: </div>
3187:
3188: <p>To build packages from source on a NetBSD system the
3189: “<span class="quote">comp</span>” and the
3190: “<span class="quote">text</span>”
3191: distribution sets must be installed. If you want to
1.47 reed 3192: build X11-related packages the “<span class=
1.1 grant 3193: "quote">xbase</span>” and “<span class=
3194: "quote">xcomp</span>” distribution sets are
3195: required, too.</p>
3196: </div>
3197:
1.63 dillo 3198: <div class="sect2" lang="en">
1.1 grant 3199: <div class="titlepage">
3200: <div>
3201: <div>
1.63 dillo 3202: <h3 class="title"><a name=
3203: "fetching-distfiles"></a>4.2.2. Fetching
1.1 grant 3204: distfiles</h3>
3205: </div>
3206: </div>
3207: </div>
3208:
1.27 rillig 3209: <p>The first step for building a package is downloading
3210: the distfiles (i.e. the unmodified source). If they
3211: have not yet been downloaded, pkgsrc will fetch them
1.1 grant 3212: automatically.</p>
3213:
3214: <p>You can overwrite some of the major distribution
3215: sites to fit to sites that are close to your own. Have
1.45 wiz 3216: a look at <code xmlns=
3217: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3218: "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27 rillig 3219: some examples — in particular, look for the
1.14 xtraeme 3220: <code class="varname">MASTER_SORT</code>, <code class=
3221: "varname">MASTER_SORT_REGEX</code> and <code class=
3222: "varname">INET_COUNTRY</code> definitions. This may
3223: save some of your bandwidth and time.</p>
1.1 grant 3224:
3225: <p>You can change these settings either in your shell's
3226: environment, or, if you want to keep the settings, by
1.45 wiz 3227: editing the <code xmlns=
3228: "http://www.w3.org/TR/xhtml1/transitional" class=
3229: "filename">/etc/mk.conf</code> file, and adding the
3230: definitions there.</p>
1.1 grant 3231:
3232: <p>If you don't have a permanent Internet connection
3233: and you want to know which files to download,
1.14 xtraeme 3234: <span><strong class="command">make
3235: fetch-list</strong></span> will tell you what you'll
1.45 wiz 3236: need. Put these distfiles into <code xmlns=
3237: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3238: "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1 grant 3239: </div>
3240:
1.63 dillo 3241: <div class="sect2" lang="en">
1.1 grant 3242: <div class="titlepage">
3243: <div>
3244: <div>
1.30 wiz 3245: <h3 class="title"><a name=
3246: "how-to-build-and-install"></a>4.2.3. How to
3247: build and install</h3>
1.1 grant 3248: </div>
3249: </div>
3250: </div>
3251:
3252: <p>Assuming that the distfile has been fetched (see
3253: previous section), become root and change into the
1.47 reed 3254: relevant directory and run <span><strong class=
3255: "command">make</strong></span>.</p>
3256:
3257: <div class="note" style=
3258: "margin-left: 0.5in; margin-right: 0.5in;">
3259: <h3 class="title">Note</h3>
3260:
3261: <p>If using bootstrap or pkgsrc on a non-NetBSD
3262: system, use the pkgsrc <span><strong class=
3263: "command">bmake</strong></span> command instead of
3264: “<span class="quote">make</span>” in the
3265: examples in this guide.</p>
3266: </div>
3267:
3268: <p>For example, type</p>
1.1 grant 3269: <pre class="screen">
1.14 xtraeme 3270: <code class="prompt">%</code> <strong class=
3271: "userinput"><code>cd misc/figlet</code></strong>
3272: <code class="prompt">%</code> <strong class=
3273: "userinput"><code>make</code></strong>
1.1 grant 3274: </pre>
3275:
3276: <p>at the shell prompt to build the various components
3277: of the package, and</p>
3278: <pre class="screen">
1.14 xtraeme 3279: <code class="prompt">#</code> <strong class=
3280: "userinput"><code>make install</code></strong>
1.1 grant 3281: </pre>
3282:
3283: <p>to install the various components into the correct
3284: places on your system. Installing the package on your
3285: system requires you to be root. However, pkgsrc has a
3286: <span class="emphasis"><em>just-in-time-su</em></span>
3287: feature, which allows you to only become root for the
3288: actual installation step</p>
3289:
3290: <p>Taking the figlet utility as an example, we can
3291: install it on our system by building as shown in
3292: <a href="#logs" title=
1.63 dillo 3293: "Appendix B. Build logs">Appendix B,
3294: <i>Build logs</i></a>.</p>
1.1 grant 3295:
3296: <p>The program is installed under the default root of
1.45 wiz 3297: the packages tree - <code xmlns=
3298: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3299: "filename">/usr/pkg</code>. Should this not conform to
3300: your tastes, set the <code class=
3301: "varname">LOCALBASE</code> variable in your
1.1 grant 3302: environment, and it will use that value as the root of
1.45 wiz 3303: your packages tree. So, to use <code xmlns=
3304: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3305: "filename">/usr/local</code>, set <code class=
3306: "varname">LOCALBASE=/usr/local</code> in your
1.1 grant 3307: environment. Please note that you should use a
3308: directory which is dedicated to packages and not shared
1.47 reed 3309: with other programs (i.e., do not try and use
1.14 xtraeme 3310: <code class="varname">LOCALBASE=/usr</code>). Also, you
3311: should not try to add any of your own files or
1.45 wiz 3312: directories (such as <code xmlns=
3313: "http://www.w3.org/TR/xhtml1/transitional" class=
3314: "filename">src/</code>, <code xmlns=
3315: "http://www.w3.org/TR/xhtml1/transitional" class=
3316: "filename">obj/</code>, or <code xmlns=
3317: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3318: "filename">pkgsrc/</code>) below the <code class=
3319: "varname">LOCALBASE</code> tree. This is to prevent
1.1 grant 3320: possible conflicts between programs and other files
3321: installed by the package system and whatever else may
3322: have been installed there.</p>
3323:
1.45 wiz 3324: <p>Some packages look in <code xmlns=
3325: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3326: "filename">/etc/mk.conf</code> to alter some
1.1 grant 3327: configuration options at build time. Have a look at
1.45 wiz 3328: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3329: class="filename">pkgsrc/mk/defaults/mk.conf</code> to
3330: get an overview of what will be set there by default.
1.14 xtraeme 3331: Environment variables such as <code class=
1.45 wiz 3332: "varname">LOCALBASE</code> can be set in <code xmlns=
3333: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3334: "filename">/etc/mk.conf</code> to save having to
3335: remember to set them each time you want to use
3336: pkgsrc.</p>
1.1 grant 3337:
3338: <p>Occasionally, people want to “<span class=
3339: "quote">look under the covers</span>” to see what
3340: is going on when a package is building or being
3341: installed. This may be for debugging purposes, or out
3342: of simple curiosity. A number of utility values have
3343: been added to help with this.</p>
3344:
3345: <div class="orderedlist">
3346: <ol type="1">
3347: <li>
3348: <p>If you invoke the <a href=
3349: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3350: <span class="citerefentry"><span class=
3351: "refentrytitle">make</span>(1)</span></a> command
1.14 xtraeme 3352: with <code class=
3353: "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
3354: amount of information will be displayed. For
3355: example,</p>
1.1 grant 3356: <pre class="screen">
1.14 xtraeme 3357: <strong class=
3358: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1 grant 3359: </pre>
3360:
3361: <p>will show all the commands that are invoked,
3362: up to and including the “<span class=
3363: "quote">patch</span>” stage.</p>
3364: </li>
3365:
3366: <li>
3367: <p>If you want to know the value of a certain
1.22 tv 3368: <a href=
3369: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3370: <span class="citerefentry"><span class=
3371: "refentrytitle">make</span>(1)</span></a>
3372: definition, then the <code class=
1.14 xtraeme 3373: "varname">VARNAME</code> definition should be
3374: used, in conjunction with the show-var target.
3375: e.g. to show the expansion of the <a href=
1.1 grant 3376: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
3377: <span class="citerefentry"><span class=
3378: "refentrytitle">make</span>(1)</span></a>
1.14 xtraeme 3379: variable <code class=
1.22 tv 3380: "varname">LOCALBASE</code>:</p>
1.1 grant 3381: <pre class="screen">
1.14 xtraeme 3382: <code class="prompt">%</code> <strong class=
3383: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1 grant 3384: /usr/pkg
1.14 xtraeme 3385: <code class="prompt">%</code>
1.1 grant 3386:
3387: </pre>
3388: </li>
3389: </ol>
3390: </div>
3391:
3392: <p>If you want to install a binary package that you've
3393: either created yourself (see next section), that you
3394: put into pkgsrc/packages manually or that is located on
1.8 wiz 3395: a remote FTP server, you can use the "bin-install"
1.1 grant 3396: target. This target will install a binary package - if
3397: available - via <a href=
3398: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3399: <span class="citerefentry"><span class=
3400: "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14 xtraeme 3401: <span><strong class="command">make
3402: package</strong></span>. The list of remote FTP sites
3403: searched is kept in the variable <code class=
3404: "varname">BINPKG_SITES</code>, which defaults to
3405: ftp.NetBSD.org. Any flags that should be added to
3406: <a href=
1.1 grant 3407: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3408: <span class="citerefentry"><span class=
3409: "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14 xtraeme 3410: into <code class="varname">BIN_INSTALL_FLAGS</code>.
1.45 wiz 3411: See <code xmlns=
3412: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 3413: "filename">pkgsrc/mk/defaults/mk.conf</code> for more
3414: details.</p>
1.1 grant 3415:
1.47 reed 3416: <p>A final word of warning: If you set up a system that
1.14 xtraeme 3417: has a non-standard setting for <code class=
3418: "varname">LOCALBASE</code>, be sure to set that before
1.1 grant 3419: any packages are installed, as you can not use several
3420: directories for the same purpose. Doing so will result
3421: in pkgsrc not being able to properly detect your
3422: installed packages, and fail miserably. Note also that
3423: precompiled binary packages are usually built with the
1.14 xtraeme 3424: default <code class="varname">LOCALBASE</code> of
1.45 wiz 3425: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3426: class="filename">/usr/pkg</code>, and that you should
3427: <span class="emphasis"><em>not</em></span> install any
3428: if you use a non-standard <code class=
1.14 xtraeme 3429: "varname">LOCALBASE</code>.</p>
1.1 grant 3430: </div>
3431:
1.63 dillo 3432: <div class="sect2" lang="en">
1.1 grant 3433: <div class="titlepage">
3434: <div>
3435: <div>
1.30 wiz 3436: <h3 class="title"><a name=
3437: "selecting-the-compiler"></a>4.2.4. Selecting
3438: the compiler</h3>
1.1 grant 3439: </div>
3440: </div>
3441: </div>
3442:
3443: <p>By default, pkgsrc will use GCC to build packages.
3444: This may be overridden by setting the following
3445: variables in /etc/mk.conf:</p>
3446:
3447: <div class="variablelist">
3448: <dl>
1.14 xtraeme 3449: <dt><span class="term"><code class=
3450: "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1 grant 3451:
3452: <dd>
3453: <p>This is a list of values specifying the chain
3454: of compilers to invoke when building packages.
3455: Valid values are:</p>
3456:
3457: <div class="itemizedlist">
3458: <ul type="disc">
3459: <li>
1.14 xtraeme 3460: <p><code class="varname">distcc</code>:
1.1 grant 3461: distributed C/C++ (chainable)</p>
3462: </li>
3463:
3464: <li>
1.14 xtraeme 3465: <p><code class="varname">ccache</code>:
1.1 grant 3466: compiler cache (chainable)</p>
3467: </li>
3468:
3469: <li>
1.14 xtraeme 3470: <p><code class="varname">gcc</code>: GNU
3471: C/C++ Compiler</p>
1.1 grant 3472: </li>
3473:
3474: <li>
1.14 xtraeme 3475: <p><code class="varname">mipspro</code>:
1.1 grant 3476: Silicon Graphics, Inc. MIPSpro
3477: (n32/n64)</p>
3478: </li>
3479:
3480: <li>
1.14 xtraeme 3481: <p><code class="varname">mipspro</code>:
1.1 grant 3482: Silicon Graphics, Inc. MIPSpro (o32)</p>
3483: </li>
3484:
3485: <li>
1.64 kim 3486: <p><code class="varname">sunpro</code>: Sun
1.1 grant 3487: Microsystems, Inc. WorkShip/Forte/Sun ONE
3488: Studio</p>
3489: </li>
3490: </ul>
3491: </div>
3492:
3493: <p>The default is “<span class=
1.14 xtraeme 3494: "quote"><code class=
3495: "varname">gcc</code></span>”. You can use
3496: <code class="varname">ccache</code> and/or
3497: <code class="varname">distcc</code> with an
3498: appropriate <code class=
3499: "varname">PKGSRC_COMPILER</code> setting, e.g.
3500: “<span class="quote"><code class=
3501: "varname">ccache gcc</code></span>”. This
1.1 grant 3502: variable should always be terminated with a value
3503: for a real compiler.</p>
3504: </dd>
3505:
1.14 xtraeme 3506: <dt><span class="term"><code class=
3507: "varname">GCC_REQD</code>:</span></dt>
1.1 grant 3508:
3509: <dd>
3510: <p>This specifies the minimum version of GCC to
3511: use when building packages. If the system GCC
3512: doesn't satisfy this requirement, then pkgsrc
3513: will build and install one of the GCC packages to
3514: use instead.</p>
3515: </dd>
3516: </dl>
3517: </div>
3518: </div>
3519: </div>
3520: </div>
3521:
1.63 dillo 3522: <div class="chapter" lang="en">
1.1 grant 3523: <div class="titlepage">
3524: <div>
3525: <div>
1.63 dillo 3526: <h2 class="title"><a name=
1.38 dillo 3527: "configuring"></a>Chapter 5. Configuring
3528: pkgsrc</h2>
3529: </div>
3530: </div>
3531: </div>
3532:
3533: <div class="toc">
3534: <p><b>Table of Contents</b></p>
3535:
3536: <dl>
3537: <dt><span class="sect1"><a href=
1.45 wiz 3538: "#general-configuration">5.1. General
3539: configuration</a></span></dt>
3540:
3541: <dt><span class="sect1"><a href=
3542: "#variables-affecting-build">5.2. Variables affecting
3543: the build process</a></span></dt>
3544:
3545: <dt><span class="sect1"><a href=
3546: "#developer-advanced-settings">5.3. Developer/advanced
3547: settings</a></span></dt>
3548:
3549: <dt><span class="sect1"><a href=
3550: "#selecting-build-options">5.4. Selecting Build
1.42 dillo 3551: Options</a></span></dt>
1.38 dillo 3552: </dl>
3553: </div>
3554:
1.63 dillo 3555: <div class="sect1" lang="en">
1.38 dillo 3556: <div class="titlepage">
3557: <div>
3558: <div>
3559: <h2 class="title" style="clear: both"><a name=
1.45 wiz 3560: "general-configuration"></a>5.1. General
3561: configuration</h2>
3562: </div>
3563: </div>
3564: </div>
3565:
1.47 reed 3566: <p>In this section, you can find some variables that
3567: apply to all pkgsrc packages. The preferred method of
3568: setting these variables is by setting them in
3569: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3570: class="filename">/etc/mk.conf</code>.</p>
1.45 wiz 3571:
3572: <div class="itemizedlist">
3573: <ul type="disc">
3574: <li>
3575: <p><code class="varname">LOCALBASE</code>: Where
3576: packages will be installed. The default is
3577: <code xmlns=
3578: "http://www.w3.org/TR/xhtml1/transitional" class=
3579: "filename">/usr/pkg</code>. Do not mix binary
3580: packages with different <code class=
3581: "varname">LOCALBASE</code>s!</p>
3582: </li>
3583:
3584: <li>
3585: <p><code class="varname">CROSSBASE</code>: Where
3586: “<span class="quote">cross</span>”
3587: category packages will be installed. The default is
3588: <code xmlns=
3589: "http://www.w3.org/TR/xhtml1/transitional" class=
3590: "filename">${LOCALBASE}/cross</code>.</p>
3591: </li>
3592:
3593: <li>
3594: <p><code class="varname">X11BASE</code>: Where X11
3595: is installed on the system. The default is
3596: <code xmlns=
3597: "http://www.w3.org/TR/xhtml1/transitional" class=
3598: "filename">/usr/X11R6</code>.</p>
3599: </li>
3600:
3601: <li>
3602: <p><code class="varname">DISTDIR</code>: Where to
3603: store the downloaded copies of the original source
3604: distributions used for building pkgsrc packages.
3605: The default is <code xmlns=
3606: "http://www.w3.org/TR/xhtml1/transitional" class=
3607: "filename">${PKGSRCDIR}/distfiles</code>.</p>
3608: </li>
3609:
3610: <li>
3611: <p><code class=
3612: "varname">MASTER_SITE_OVERRIDE</code>: If set,
3613: override the packages' <code class=
3614: "varname">MASTER_SITES</code> with this value.</p>
3615: </li>
3616:
3617: <li>
3618: <p><code class="varname">MASTER_SITE_BACKUP</code>:
3619: Backup location(s) for distribution files and patch
3620: files if not found locally or in <code xmlns=
3621: "http://www.w3.org/TR/xhtml1/transitional" class=
3622: "filename">${MASTER_SITES}</code> or <code xmlns=
3623: "http://www.w3.org/TR/xhtml1/transitional" class=
3624: "filename">${PATCH_SITES}</code> respectively. The
3625: defaults are <code xmlns=
3626: "http://www.w3.org/TR/xhtml1/transitional" class=
3627: "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/${DIST_SUBDIR}/</code>
3628: and <code xmlns=
3629: "http://www.w3.org/TR/xhtml1/transitional" class=
3630: "filename">ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/</code>.</p>
3631: </li>
3632:
3633: <li>
3634: <p><code class="varname">BINPKG_SITES</code>: List
3635: of sites carrying binary pkgs.</p>
3636: </li>
3637: </ul>
3638: </div>
3639: </div>
3640:
1.63 dillo 3641: <div class="sect1" lang="en">
1.45 wiz 3642: <div class="titlepage">
3643: <div>
3644: <div>
3645: <h2 class="title" style="clear: both"><a name=
3646: "variables-affecting-build"></a>5.2. Variables
3647: affecting the build process</h2>
3648: </div>
3649: </div>
3650: </div>
3651:
3652: <p>XXX</p>
3653:
3654: <div class="itemizedlist">
3655: <ul type="disc">
3656: <li>
3657: <p><code class="varname">PACKAGES</code>: The top
3658: level directory for the binary packages. The
3659: default is <code xmlns=
3660: "http://www.w3.org/TR/xhtml1/transitional" class=
3661: "filename">${PKGSRCDIR}/packages</code>.</p>
3662: </li>
3663:
3664: <li>
3665: <p><code class="varname">WRKOBJDIR</code>: The top
3666: level directory where, if defined, the separate
3667: working directories will get created, and
3668: symbolically linked to from <code xmlns=
3669: "http://www.w3.org/TR/xhtml1/transitional" class=
3670: "filename">${WRKDIR}</code> (see below). This is
3671: useful for building packages on several
3672: architectures, then <code xmlns=
3673: "http://www.w3.org/TR/xhtml1/transitional" class=
3674: "filename">${PKGSRCDIR}</code> can be NFS-mounted
3675: while <code xmlns=
3676: "http://www.w3.org/TR/xhtml1/transitional" class=
3677: "filename">${WRKOBJDIR}</code> is local to every
3678: architecture. (It should be noted that <code class=
3679: "varname">PKGSRCDIR</code> should not be set by the
3680: user — it is an internal definition which
3681: refers to the root of the pkgsrc tree. It is
3682: possible to have many pkgsrc tree instances.)</p>
3683: </li>
3684:
3685: <li>
3686: <p><code class="varname">LOCALPATCHES</code>:
3687: Directory for local patches that aren't part of
3688: pkgsrc. See <a href="#components.patches" title=
3689: "8.3. patches/*">Section 8.3,
3690: “patches/*”</a> for more information.
3691: <em class="replaceable"><code>rel</code></em> and
3692: <em class="replaceable"><code>arch</code></em> are
3693: replaced with OS release (“<span class=
3694: "quote">2.0</span>”, etc.) and architecture
3695: (“<span class="quote">mipsel</span>”,
3696: etc.).</p>
3697: </li>
3698:
3699: <li>
3700: <p><code class="varname">PKGMAKECONF</code>:
3701: Location of the <code xmlns=
3702: "http://www.w3.org/TR/xhtml1/transitional" class=
3703: "filename">mk.conf</code> file used by a package's
3704: BSD-style Makefile. If this is not set,
3705: <code class="varname">MAKECONF</code> is set to
3706: <code xmlns=
3707: "http://www.w3.org/TR/xhtml1/transitional" class=
3708: "filename">/dev/null</code> to avoid picking up
3709: settings used by builds in <code xmlns=
3710: "http://www.w3.org/TR/xhtml1/transitional" class=
3711: "filename">/usr/src</code>.</p>
3712: </li>
3713: </ul>
3714: </div>
3715: </div>
3716:
1.63 dillo 3717: <div class="sect1" lang="en">
1.45 wiz 3718: <div class="titlepage">
3719: <div>
3720: <div>
3721: <h2 class="title" style="clear: both"><a name=
3722: "developer-advanced-settings"></a>5.3. Developer/advanced
3723: settings</h2>
3724: </div>
3725: </div>
3726: </div>
3727:
3728: <p>XXX</p>
3729:
3730: <div class="itemizedlist">
3731: <ul type="disc">
3732: <li>
3733: <p><code class="varname">PKG_DEVELOPER</code>: Run
3734: some sanity checks that package developers
3735: want:</p>
3736:
3737: <div class="itemizedlist">
3738: <ul type="circle">
3739: <li>
3740: <p>make sure patches apply with zero fuzz</p>
3741: </li>
3742:
3743: <li>
3744: <p>run check-shlibs to see that all binaries
3745: will find their shared libs.</p>
3746: </li>
3747: </ul>
3748: </div>
3749: </li>
3750:
3751: <li>
3752: <p><code class="varname">PKG_DEBUG_LEVEL</code>:
3753: The level of debugging output which is displayed
3754: whilst making and installing the package. The
3755: default value for this is 0, which will not display
3756: the commands as they are executed (normal, default,
3757: quiet operation); the value 1 will display all
3758: shell commands before their invocation, and the
3759: value 2 will display both the shell commands before
3760: their invocation, and their actual execution
3761: progress with <span><strong class="command">set
3762: -x</strong></span> will be displayed.</p>
3763: </li>
1.58 erh 3764:
3765: <li>
3766: <p><code class=
3767: "varname">ALLOW_VULNERABILITIES.<em class=
3768: "replaceable"><code>pkgbase</code></em></code>: A
3769: space separated list of vulnerability IDs that may
3770: be ignored when performing the automated security
3771: checks. These IDs are listed in the
3772: pkg-vulnerabilities file and are displayed by
3773: <span><strong class=
3774: "command">audit-packages</strong></span> when it
3775: finds a vulnerable package.</p>
3776: </li>
3777:
3778: <li>
3779: <p><code class=
3780: "varname">SKIP_AUDIT_PACKAGES</code>: If this is
3781: set to “<span class=
3782: "quote">yes</span>”, the automated security
3783: checks (which use the <a xmlns=
3784: "http://www.w3.org/TR/xhtml1/transitional" href=
3785: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
3786: target="_top"><code xmlns="" class=
3787: "filename">security/audit-packages</code></a>
3788: package) will be <span class=
3789: "strong"><strong>entirely</strong></span> skipped
3790: for <span class=
3791: "strong"><strong>all</strong></span> packages
3792: built. Normally you'll want to use
3793: ALLOW_VULNERABILITIES instead of this.</p>
3794: </li>
1.45 wiz 3795: </ul>
3796: </div>
3797: </div>
3798:
1.63 dillo 3799: <div class="sect1" lang="en">
1.45 wiz 3800: <div class="titlepage">
3801: <div>
3802: <div>
3803: <h2 class="title" style="clear: both"><a name=
3804: "selecting-build-options"></a>5.4. Selecting
3805: Build Options</h2>
1.38 dillo 3806: </div>
3807: </div>
3808: </div>
3809:
3810: <p>Some packages have build time options, usually to
3811: select between different dependencies, enable optional
3812: support for big dependencies or enable experimental
3813: features.</p>
3814:
3815: <p>To see which options, if any, a package supports, and
3816: which options are mutually exclusive, run
3817: <span><strong class="command">make
3818: show-options</strong></span>, for example:</p>
3819: <pre class="programlisting">
1.51 rillig 3820: The following options are supported by this package:
3821: ssl Enable SSL support.
3822: Exactly one of the following gecko options is required:
3823: firefox Use firefox as gecko rendering engine.
3824: mozilla Use mozilla as gecko rendering engine.
3825: At most one of the following database options may be selected:
3826: mysql Enable support for MySQL database.
3827: pgsql Enable support for PostgreSQL database.
3828:
3829: These options are enabled by default: firefox
3830: These options are currently enabled: mozilla ssl
1.38 dillo 3831: </pre>
3832:
1.45 wiz 3833: <p>The following variables can be defined in <code xmlns=
3834: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 3835: "filename">/etc/mk.conf</code> to select which options to
3836: enable for a package: <code class=
3837: "varname">PKG_DEFAULT_OPTIONS</code>, which can be used
3838: to select or disable options for all packages that
3839: support them, and <code class=
3840: "varname">PKG_OPTIONS.<em class=
3841: "replaceable"><code>pkgbase</code></em></code>, which can
3842: be used to select or disable options specifically for
3843: package <em class=
3844: "replaceable"><code>pkgbase</code></em>. Options listed
3845: in these variables are selected, options preceded by
3846: “<span class="quote">-</span>” are
3847: disabled.</p>
3848:
1.39 dillo 3849: <p>The following settings are consulted in the order
3850: given, and the last setting that selects or disables an
3851: option is used:</p>
1.38 dillo 3852:
3853: <div class="orderedlist">
3854: <ol type="1">
3855: <li>
3856: <p>the default options as suggested by the package
3857: maintainer</p>
3858: </li>
3859:
3860: <li>
3861: <p>the options implied by the settings of legacy
3862: variables (see below)</p>
3863: </li>
3864:
3865: <li>
3866: <p><code class=
3867: "varname">PKG_DEFAULT_OPTIONS</code></p>
3868: </li>
3869:
3870: <li>
3871: <p><code class="varname">PKG_OPTIONS.<em class=
3872: "replaceable"><code>pkgbase</code></em></code></p>
3873: </li>
3874: </ol>
3875: </div>
3876:
3877: <p>For groups of mutually exclusive options, the last
3878: option selected is used, all others are automatically
3879: disabled. If an option of the group is explicitly
3880: disabled, the previously selected option, if any, is
3881: used. It is an error if no option from a required group
3882: of options is selected, and building the package will
3883: fail.</p>
3884:
3885: <p>Before the options framework was introduced, build
1.65 ! hubertf 3886: options were selected by setting a variable (often named
! 3887: <code class="varname">USE_<em class=
! 3888: "replaceable"><code>FOO</code></em></code>) in
1.45 wiz 3889: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
3890: class="filename">/etc/mk.conf</code> for each option. To
3891: ease transition to the options framework for the user,
3892: these legacy variables are converted to the appropriate
1.65 ! hubertf 3893: options setting (<code class=
! 3894: "varname">PKG_OPTIONS.<em class=
! 3895: "replaceable"><code>pkgbase</code></em></code>)
! 3896: automatically. A warning is issued to prompt the user to
! 3897: update <code xmlns=
1.45 wiz 3898: "http://www.w3.org/TR/xhtml1/transitional" class=
1.38 dillo 3899: "filename">/etc/mk.conf</code> to use the options
1.65 ! hubertf 3900: framework directly. Support for the legacy variables will
! 3901: be removed eventually.</p>
1.38 dillo 3902: </div>
3903: </div>
3904:
1.63 dillo 3905: <div class="chapter" lang="en">
1.38 dillo 3906: <div class="titlepage">
3907: <div>
3908: <div>
1.63 dillo 3909: <h2 class="title"><a name=
1.38 dillo 3910: "binary"></a>Chapter 6. Creating binary
1.1 grant 3911: packages</h2>
3912: </div>
3913: </div>
3914: </div>
3915:
3916: <div class="toc">
3917: <p><b>Table of Contents</b></p>
3918:
3919: <dl>
1.30 wiz 3920: <dt><span class="sect1"><a href=
1.38 dillo 3921: "#building-a-single-binary-package">6.1. Building a
1.30 wiz 3922: single binary package</a></span></dt>
1.1 grant 3923:
1.30 wiz 3924: <dt><span class="sect1"><a href=
1.38 dillo 3925: "#settings-for-creationg-of-binary-packages">6.2.
1.1 grant 3926: Settings for creation of binary
3927: packages</a></span></dt>
3928:
1.38 dillo 3929: <dt><span class="sect1"><a href="#bulkbuild">6.3. Doing
1.1 grant 3930: a bulk build of all packages</a></span></dt>
3931:
3932: <dd>
3933: <dl>
3934: <dt><span class="sect2"><a href=
1.38 dillo 3935: "#binary.configuration">6.3.1.
1.1 grant 3936: Configuration</a></span></dt>
3937:
1.30 wiz 3938: <dt><span class="sect2"><a href=
1.38 dillo 3939: "#other-environmental-considerations">6.3.2. Other
1.30 wiz 3940: environmental considerations</a></span></dt>
1.1 grant 3941:
1.38 dillo 3942: <dt><span class="sect2"><a href="#operation">6.3.3.
1.1 grant 3943: Operation</a></span></dt>
3944:
1.30 wiz 3945: <dt><span class="sect2"><a href=
1.38 dillo 3946: "#what-it-does">6.3.4. What it does</a></span></dt>
1.1 grant 3947:
1.30 wiz 3948: <dt><span class="sect2"><a href=
1.38 dillo 3949: "#disk-space-requirements">6.3.5. Disk space
1.30 wiz 3950: requirements</a></span></dt>
1.1 grant 3951:
1.30 wiz 3952: <dt><span class="sect2"><a href=
1.38 dillo 3953: "#setting-up-a-sandbox">6.3.6. Setting up a sandbox
1.47 reed 3954: for chrooted builds</a></span></dt>
1.1 grant 3955:
1.30 wiz 3956: <dt><span class="sect2"><a href=
1.38 dillo 3957: "#building-a-partial-set">6.3.7. Building a partial
1.30 wiz 3958: set of packages</a></span></dt>
1.13 hubertf 3959:
3960: <dt><span class="sect2"><a href=
1.38 dillo 3961: "#bulk-upload">6.3.8. Uploading results of a bulk
1.13 hubertf 3962: build</a></span></dt>
1.1 grant 3963: </dl>
3964: </dd>
3965:
1.38 dillo 3966: <dt><span class="sect1"><a href="#creating-cdroms">6.4.
1.1 grant 3967: Creating a multiple CD-ROM packages
3968: collection</a></span></dt>
3969:
3970: <dd>
3971: <dl>
1.30 wiz 3972: <dt><span class="sect2"><a href=
1.38 dillo 3973: "#cdpack-example">6.4.1. Example of
1.30 wiz 3974: cdpack</a></span></dt>
1.1 grant 3975: </dl>
3976: </dd>
3977: </dl>
3978: </div>
3979:
1.63 dillo 3980: <div class="sect1" lang="en">
1.1 grant 3981: <div class="titlepage">
3982: <div>
3983: <div>
3984: <h2 class="title" style="clear: both"><a name=
1.38 dillo 3985: "building-a-single-binary-package"></a>6.1. Building
1.30 wiz 3986: a single binary package</h2>
1.1 grant 3987: </div>
3988: </div>
3989: </div>
3990:
3991: <p>Once you have built and installed a package, you can
3992: create a <span class="emphasis"><em>binary
3993: package</em></span> which can be installed on another
3994: system with <a href=
3995: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
3996: <span class="citerefentry"><span class=
1.47 reed 3997: "refentrytitle">pkg_add</span>(1)</span></a>. This saves
1.1 grant 3998: having to build the same package on a group of hosts and
3999: wasting CPU time. It also provides a simple means for
4000: others to install your package, should you distribute
4001: it.</p>
4002:
4003: <p>To create a binary package, change into the
1.14 xtraeme 4004: appropriate directory in pkgsrc, and run
4005: <span><strong class="command">make
4006: package</strong></span>:</p>
1.1 grant 4007: <pre class="screen">
1.14 xtraeme 4008: <code class="prompt">#</code> <strong class=
4009: "userinput"><code>cd misc/figlet</code></strong>
4010: <code class="prompt">#</code> <strong class=
4011: "userinput"><code>make package</code></strong>
1.1 grant 4012: </pre>
4013:
4014: <p>This will build and install your package (if not
4015: already done), and then build a binary package from what
1.14 xtraeme 4016: was installed. You can then use the <span><strong class=
4017: "command">pkg_*</strong></span> tools to manipulate it.
1.45 wiz 4018: Binary packages are created by default in <code xmlns=
4019: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4020: "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1 grant 4021: gzipped tar file. See <a href="#logs.package" title=
1.63 dillo 4022: "B.2. Packaging figlet">Section B.2,
1.1 grant 4023: “Packaging figlet”</a> for a continuation of
4024: the above <a xmlns=
4025: "http://www.w3.org/TR/xhtml1/transitional" href=
4026: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.45 wiz 4027: target="_top"><code xmlns="" class=
4028: "filename">misc/figlet</code></a> example.</p>
1.1 grant 4029:
4030: <p>See <a href="#submit" title=
1.63 dillo 4031: "Chapter 17. Submitting and Committing">Chapter 17,
4032: <i>Submitting and Committing</i></a> for information on
4033: how to submit such a binary package.</p>
1.1 grant 4034: </div>
4035:
1.63 dillo 4036: <div class="sect1" lang="en">
1.1 grant 4037: <div class="titlepage">
4038: <div>
4039: <div>
4040: <h2 class="title" style="clear: both"><a name=
1.38 dillo 4041: "settings-for-creationg-of-binary-packages"></a>6.2. Settings
1.1 grant 4042: for creation of binary packages</h2>
4043: </div>
4044: </div>
4045: </div>
4046:
4047: <p>See <a href="#build.helpful-targets" title=
1.56 rillig 4048: "14.16. Other helpful targets">Section 14.16,
1.1 grant 4049: “Other helpful targets”</a>.</p>
4050: </div>
4051:
1.63 dillo 4052: <div class="sect1" lang="en">
1.1 grant 4053: <div class="titlepage">
4054: <div>
4055: <div>
4056: <h2 class="title" style="clear: both"><a name=
1.63 dillo 4057: "bulkbuild"></a>6.3. Doing a bulk build of all
4058: packages</h2>
1.1 grant 4059: </div>
4060: </div>
4061: </div>
4062:
4063: <p>If you want to get a full set of precompiled binary
4064: packages, this section describes how to get them. Beware
4065: that the bulk build will remove all currently installed
1.63 dillo 4066: packages from your system!</p>
4067:
4068: <p>Having an FTP server configured either on the machine
4069: doing the bulk builds or on a nearby NFS server can help
4070: to make the packages available to other machines that can
4071: then save time by installing only the binary packages.
4072: See <a href=
1.1 grant 4073: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
4074: <span class="citerefentry"><span class=
4075: "refentrytitle">ftpd</span>(8)</span></a> for more
4076: information. If you use a remote NFS server's storage, be
4077: sure to not actually compile on NFS storage, as this
4078: slows things down a lot.</p>
4079:
1.63 dillo 4080: <div class="sect2" lang="en">
1.1 grant 4081: <div class="titlepage">
4082: <div>
4083: <div>
1.63 dillo 4084: <h3 class="title"><a name=
1.38 dillo 4085: "binary.configuration"></a>6.3.1. Configuration</h3>
1.1 grant 4086: </div>
4087: </div>
4088: </div>
4089:
1.63 dillo 4090: <div class="sect3" lang="en">
1.1 grant 4091: <div class="titlepage">
4092: <div>
4093: <div>
1.63 dillo 4094: <h4 class="title"><a name=
4095: "binary.bulk.build.conf"></a>6.3.1.1. <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4096: class="filename">build.conf</code></h4>
4097: </div>
4098: </div>
4099: </div>
4100:
4101: <p>The <code xmlns=
4102: "http://www.w3.org/TR/xhtml1/transitional" class=
4103: "filename">build.conf</code> file is the main
4104: configuration file for bulk builds. You can configure
4105: how your copy of pkgsrc is kept up to date, how the
4106: distfiles are downloaded, how the packages are built
4107: and how the report is generated. You can find an
4108: annotated example file in <code xmlns=
4109: "http://www.w3.org/TR/xhtml1/transitional" class=
4110: "filename">pkgsrc/mk/bulk/build.conf-example</code>.
4111: To use it, copy <code xmlns=
4112: "http://www.w3.org/TR/xhtml1/transitional" class=
4113: "filename">build.conf-example</code> to <code xmlns=
4114: "http://www.w3.org/TR/xhtml1/transitional" class=
4115: "filename">build.conf</code> and edit it, following
4116: the comments in that file.</p>
4117: </div>
4118:
4119: <div class="sect3" lang="en">
4120: <div class="titlepage">
4121: <div>
4122: <div>
4123: <h4 class="title"><a name=
4124: "binary.mk.conf"></a>6.3.1.2. /etc/mk.conf</h4>
1.1 grant 4125: </div>
4126: </div>
4127: </div>
4128:
1.45 wiz 4129: <p>You may want to set variables in <code xmlns=
4130: "http://www.w3.org/TR/xhtml1/transitional" class=
4131: "filename">/etc/mk.conf</code>. Look at <code xmlns=
4132: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4133: "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1 grant 4134: details of the default settings. You will want to
1.14 xtraeme 4135: ensure that <code class=
4136: "varname">ACCEPTABLE_LICENSES</code> meet your local
4137: policy. As used in this example, <code class=
4138: "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1 grant 4139: "emphasis"><em>all</em></span> licenses.</p>
4140: <pre class="programlisting">
1.51 rillig 4141: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
4142: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
4143: BSDSRCDIR= /usr/src
4144: BSDXSRCDIR= /usr/xsrc # for x11/xservers
4145: OBJHOSTNAME?= yes # use work.`hostname`
4146: FAILOVER_FETCH= yes # insist on the correct checksum
4147: PKG_DEVELOPER?= yes
4148: _ACCEPTABLE= yes
1.1 grant 4149: </pre>
4150:
1.63 dillo 4151: <p>Some options that are especially useful for bulk
4152: builds can be found at the top lines of the file
4153: <code xmlns=
4154: "http://www.w3.org/TR/xhtml1/transitional" class=
4155: "filename">mk/bulk/bsd.bulk-pkg.mk</code>. The most
4156: useful options of these are briefly described
4157: here.</p>
4158:
4159: <div class="itemizedlist">
4160: <ul type="disc">
4161: <li>
4162: <p>If you are on a slow machine, you may want
4163: to set <code class=
4164: "varname">USE_BULK_BROKEN_CHECK</code> to
4165: “<span class=
4166: "quote">no</span>”.</p>
4167: </li>
4168:
4169: <li>
4170: <p>If you are doing bulk builds from a
4171: read-only copy of pkgsrc, you have to set
4172: <code class="varname">BULKFILESDIR</code> to
4173: the directory where all log files are created.
4174: Otherwise the log files are created in the
4175: pkgsrc directory.</p>
4176: </li>
4177:
4178: <li>
4179: <p>Another important variable is <code class=
4180: "varname">BULK_PREREQ</code>, which is a list
4181: of packages that should be always available
4182: while building other packages.</p>
4183: </li>
4184: </ul>
1.1 grant 4185: </div>
4186: </div>
4187:
1.63 dillo 4188: <div class="sect3" lang="en">
1.1 grant 4189: <div class="titlepage">
4190: <div>
4191: <div>
1.63 dillo 4192: <h4 class="title"><a name=
1.45 wiz 4193: "pre-build.local"></a>6.3.1.3. <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4194: class="filename">pre-build.local</code></h4>
1.1 grant 4195: </div>
4196: </div>
4197: </div>
4198:
4199: <p>It is possible to configure the bulk build to
1.47 reed 4200: perform certain site-specific tasks at the end of the
1.45 wiz 4201: pre-build stage. If the file <code xmlns=
4202: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4203: "filename">pre-build.local</code> exists in
1.45 wiz 4204: <code xmlns=
4205: "http://www.w3.org/TR/xhtml1/transitional" class=
4206: "filename">/usr/pkgsrc/mk/bulk</code>, it will be
4207: executed (as a <a href=
1.24 wiz 4208: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
4209: <span class="citerefentry"><span class=
4210: "refentrytitle">sh</span>(1)</span></a> script) at
4211: the end of the usual pre-build stage. An example use
1.45 wiz 4212: of <code xmlns=
4213: "http://www.w3.org/TR/xhtml1/transitional" class=
4214: "filename">pre-build.local</code> is to have the
4215: line:</p>
1.1 grant 4216: <pre class="screen">
1.14 xtraeme 4217: <code class="prompt">#</code> <strong class=
4218: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23 wiz 4219: > pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1 grant 4220: </pre>
4221:
4222: <p>to prevent the system from trying to build a
4223: particular package which requires nearly 3 GB of disk
4224: space.</p>
4225: </div>
4226: </div>
4227:
1.63 dillo 4228: <div class="sect2" lang="en">
1.1 grant 4229: <div class="titlepage">
4230: <div>
4231: <div>
1.30 wiz 4232: <h3 class="title"><a name=
1.38 dillo 4233: "other-environmental-considerations"></a>6.3.2. Other
1.30 wiz 4234: environmental considerations</h3>
1.1 grant 4235: </div>
4236: </div>
4237: </div>
4238:
1.45 wiz 4239: <p>As <code xmlns=
4240: "http://www.w3.org/TR/xhtml1/transitional" class=
4241: "filename">/usr/pkg</code> will be completely deleted
4242: at the start of bulk builds, make sure your login shell
4243: is placed somewhere else. Either drop it into
4244: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4245: class="filename">/usr/local/bin</code> (and adjust your
4246: login shell in the passwd file), or (re-)install it via
1.14 xtraeme 4247: <a href=
1.1 grant 4248: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4249: <span class="citerefentry"><span class=
4250: "refentrytitle">pkg_add</span>(1)</span></a> from
1.45 wiz 4251: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4252: class="filename">/etc/rc.local</code>, so you can login
4253: after a reboot (remember that your current process
4254: won't die if the package is removed, you just can't
4255: start any new instances of the shell any more). Also,
4256: if you use NetBSD earlier than 1.5, or you still want
4257: to use the pkgsrc version of ssh for some reason, be
4258: sure to install ssh before starting it from
4259: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4260: class="filename">rc.local</code>:</p>
1.1 grant 4261: <pre class="programlisting">
1.51 rillig 4262: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
4263: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
4264: /usr/pkg/etc/rc.d/sshd
4265: fi
1.1 grant 4266: </pre>
4267:
4268: <p>Not doing so will result in you being not able to
4269: log in via ssh after the bulk build is finished or if
4270: the machine gets rebooted or crashes. You have been
4271: warned! :)</p>
4272: </div>
4273:
1.63 dillo 4274: <div class="sect2" lang="en">
1.1 grant 4275: <div class="titlepage">
4276: <div>
4277: <div>
1.63 dillo 4278: <h3 class="title"><a name=
1.38 dillo 4279: "operation"></a>6.3.3. Operation</h3>
1.1 grant 4280: </div>
4281: </div>
4282: </div>
4283:
4284: <p>Make sure you don't need any of the packages still
4285: installed.</p>
4286:
4287: <div class="warning" style=
4288: "margin-left: 0.5in; margin-right: 0.5in;">
4289: <h3 class="title">Warning</h3>
4290:
4291: <p>During the bulk build, <span class=
4292: "emphasis"><em>all packages will be
4293: removed!</em></span></p>
4294: </div>
4295:
4296: <p>Be sure to remove all other things that might
4297: interfere with builds, like some libs installed in
1.45 wiz 4298: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4299: class="filename">/usr/local</code>, etc. then become
4300: root and type:</p>
1.1 grant 4301: <pre class="screen">
1.14 xtraeme 4302: <code class="prompt">#</code> <strong class=
4303: "userinput"><code>cd /usr/pkgsrc</code></strong>
4304: <code class="prompt">#</code> <strong class=
4305: "userinput"><code>sh mk/bulk/build</code></strong>
1.1 grant 4306: </pre>
4307:
4308: <p>If for some reason your last build didn't complete
4309: (power failure, system panic, ...), you can continue it
4310: by running:</p>
4311: <pre class="screen">
1.14 xtraeme 4312: <code class="prompt">#</code> <strong class=
4313: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1 grant 4314: </pre>
4315:
4316: <p>At the end of the bulk build, you will get a summary
4317: via mail, and find build logs in the directory
1.14 xtraeme 4318: specified by <code class="varname">FTP</code> in the
1.45 wiz 4319: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4320: class="filename">build.conf</code> file.</p>
1.1 grant 4321: </div>
4322:
1.63 dillo 4323: <div class="sect2" lang="en">
1.1 grant 4324: <div class="titlepage">
4325: <div>
4326: <div>
1.63 dillo 4327: <h3 class="title"><a name=
1.38 dillo 4328: "what-it-does"></a>6.3.4. What it does</h3>
1.1 grant 4329: </div>
4330: </div>
4331: </div>
4332:
4333: <p>The bulk builds consist of three steps:</p>
4334:
4335: <div class="variablelist">
4336: <dl>
4337: <dt><span class="term">1. pre-build</span></dt>
4338:
4339: <dd>
4340: <p>The script updates your pkgsrc tree via
4341: (anon)cvs, then cleans out any broken distfiles,
4342: and removes all packages installed.</p>
4343: </dd>
4344:
4345: <dt><span class="term">2. the bulk
4346: build</span></dt>
4347:
4348: <dd>
4349: <p>This is basically “<span class=
4350: "quote">make bulk-package</span>” with an
4351: optimised order in which packages will be built.
4352: Packages that don't require other packages will
4353: be built first, and packages with many
4354: dependencies will be built later.</p>
4355: </dd>
4356:
4357: <dt><span class="term">3. post-build</span></dt>
4358:
4359: <dd>
4360: <p>Generates a report that's placed in the
1.45 wiz 4361: directory specified in the <code xmlns=
4362: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4363: "filename">build.conf</code> file named
1.45 wiz 4364: <code xmlns=
4365: "http://www.w3.org/TR/xhtml1/transitional" class=
4366: "filename">broken.html</code>, a short version of
4367: that report will also be mailed to the build's
4368: admin.</p>
1.1 grant 4369: </dd>
4370: </dl>
4371: </div>
4372:
4373: <p>During the build, a list of broken packages will be
1.45 wiz 4374: compiled in <code xmlns=
4375: "http://www.w3.org/TR/xhtml1/transitional" class=
4376: "filename">/usr/pkgsrc/.broken</code> (or <code xmlns=
4377: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4378: "filename">.../.broken.${MACHINE}</code> if
4379: <code class="varname">OBJMACHINE</code> is set),
4380: individual build logs of broken builds can be found in
4381: the package's directory. These files are used by the
4382: bulk-targets to mark broken builds to not waste time
4383: trying to rebuild them, and they can be used to debug
4384: these broken package builds later.</p>
1.1 grant 4385: </div>
4386:
1.63 dillo 4387: <div class="sect2" lang="en">
1.1 grant 4388: <div class="titlepage">
4389: <div>
4390: <div>
1.30 wiz 4391: <h3 class="title"><a name=
1.38 dillo 4392: "disk-space-requirements"></a>6.3.5. Disk
1.30 wiz 4393: space requirements</h3>
1.1 grant 4394: </div>
4395: </div>
4396: </div>
4397:
4398: <p>Currently, roughly the following requirements are
4399: valid for NetBSD 2.0/i386:</p>
4400:
4401: <div class="itemizedlist">
4402: <ul type="disc">
4403: <li>
4404: <p>10 GB - distfiles (NFS ok)</p>
4405: </li>
4406:
4407: <li>
4408: <p>8 GB - full set of all binaries (NFS ok)</p>
4409: </li>
4410:
4411: <li>
4412: <p>5 GB - temp space for compiling (local disk
4413: recommended)</p>
4414: </li>
4415: </ul>
4416: </div>
4417:
4418: <p>Note that all pkgs will be de-installed as soon as
4419: they are turned into a binary package, and that sources
4420: are removed, so there is no excessively huge demand to
4421: disk space. Afterwards, if the package is needed again,
4422: it will be installed via <a href=
4423: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
4424: <span class="citerefentry"><span class=
4425: "refentrytitle">pkg_add</span>(1)</span></a> instead of
4426: building again, so there are no cycles wasted by
4427: recompiling.</p>
4428: </div>
4429:
1.63 dillo 4430: <div class="sect2" lang="en">
1.1 grant 4431: <div class="titlepage">
4432: <div>
4433: <div>
1.63 dillo 4434: <h3 class="title"><a name=
4435: "setting-up-a-sandbox"></a>6.3.6. Setting up
4436: a sandbox for chrooted builds</h3>
1.1 grant 4437: </div>
4438: </div>
4439: </div>
4440:
1.12 agc 4441: <p>If you don't want all the packages nuked from a
4442: machine (rendering it useless for anything but pkg
1.23 wiz 4443: compiling), there is the possibility of doing the
4444: package bulk build inside a chroot environment.</p>
1.12 agc 4445:
4446: <p>The first step is to set up a chroot sandbox, e.g.
1.45 wiz 4447: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4448: class="filename">/usr/sandbox</code>. This can be done
4449: by using null mounts, or manually.</p>
1.12 agc 4450:
1.45 wiz 4451: <p>There is a shell script called <code xmlns=
4452: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4453: "filename">pkgsrc/mk/bulk/mksandbox</code> which will
4454: set up the sandbox environment using null mounts. It
1.45 wiz 4455: will also create a script called <code xmlns=
4456: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4457: "filename">sandbox</code> in the root of the sandbox
1.12 agc 4458: environment, which will allow the null mounts to be
1.14 xtraeme 4459: activated using the <span><strong class=
4460: "command">sandbox mount</strong></span> command and
4461: deactivated using the <span><strong class=
4462: "command">sandbox umount</strong></span> command.</p>
1.12 agc 4463:
4464: <p>To set up a sandbox environment by hand, after
4465: extracting all the sets from a NetBSD installation or
1.14 xtraeme 4466: doing a <span><strong class="command">make distribution
1.45 wiz 4467: DESTDIR=/usr/sandbox</strong></span> in <code xmlns=
4468: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4469: "filename">/usr/src/etc</code>, be sure the following
1.7 wiz 4470: items are present and properly configured:</p>
1.1 grant 4471:
4472: <div class="procedure">
4473: <ol type="1">
4474: <li>
4475: <p>Kernel</p>
4476: <pre class="screen">
1.14 xtraeme 4477: <code class="prompt">#</code> <strong class=
4478: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1 grant 4479: </pre>
4480: </li>
4481:
4482: <li>
1.45 wiz 4483: <p><code xmlns=
4484: "http://www.w3.org/TR/xhtml1/transitional" class=
4485: "filename">/dev/*</code></p>
1.1 grant 4486: <pre class="screen">
1.14 xtraeme 4487: <code class="prompt">#</code> <strong class=
4488: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1 grant 4489: </pre>
4490: </li>
4491:
4492: <li>
1.45 wiz 4493: <p><code xmlns=
4494: "http://www.w3.org/TR/xhtml1/transitional" class=
4495: "filename">/etc/resolv.conf</code> (for <a xmlns=
1.1 grant 4496: "http://www.w3.org/TR/xhtml1/transitional" href=
4497: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 wiz 4498: target="_top"><code xmlns="" class=
4499: "filename">security/smtpd</code></a> and
4500: mail):</p>
1.1 grant 4501: <pre class="screen">
1.14 xtraeme 4502: <code class="prompt">#</code> <strong class=
4503: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1 grant 4504: </pre>
4505: </li>
4506:
4507: <li>
4508: <p>Working(!) mail config (hostname,
4509: sendmail.cf):</p>
4510: <pre class="screen">
1.14 xtraeme 4511: <code class="prompt">#</code> <strong class=
4512: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1 grant 4513: </pre>
4514: </li>
4515:
4516: <li>
1.45 wiz 4517: <p><code xmlns=
4518: "http://www.w3.org/TR/xhtml1/transitional" class=
4519: "filename">/etc/localtime</code> (for <a xmlns=
1.1 grant 4520: "http://www.w3.org/TR/xhtml1/transitional" href=
4521: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45 wiz 4522: target="_top"><code xmlns="" class=
4523: "filename">security/smtpd</code></a>):</p>
1.1 grant 4524: <pre class="screen">
1.14 xtraeme 4525: <code class="prompt">#</code> <strong class=
4526: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1 grant 4527: </pre>
4528: </li>
4529:
4530: <li>
1.45 wiz 4531: <p><code xmlns=
4532: "http://www.w3.org/TR/xhtml1/transitional" class=
4533: "filename">/usr/src</code> (system sources, for
4534: <a xmlns=
1.1 grant 4535: "http://www.w3.org/TR/xhtml1/transitional" href=
4536: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.45 wiz 4537: target="_top"><code xmlns="" class=
4538: "filename">sysutils/aperture</code></a>,
4539: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
4540: href=
1.20 ben 4541: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
1.45 wiz 4542: target="_top"><code xmlns="" class=
4543: "filename">net/ppp-mppe</code></a>):</p>
1.1 grant 4544: <pre class="screen">
1.14 xtraeme 4545: <code class="prompt">#</code> <strong class=
4546: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
4547: <code class="prompt">#</code> <strong class=
1.23 wiz 4548: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1 grant 4549: </pre>
4550: </li>
4551:
4552: <li>
1.45 wiz 4553: <p>Create <code xmlns=
4554: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4555: "filename">/var/db/pkg</code> (not part of
4556: default install):</p>
1.1 grant 4557: <pre class="screen">
1.14 xtraeme 4558: <code class="prompt">#</code> <strong class=
4559: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1 grant 4560: </pre>
4561: </li>
4562:
4563: <li>
1.45 wiz 4564: <p>Create <code xmlns=
4565: "http://www.w3.org/TR/xhtml1/transitional" class=
4566: "filename">/usr/pkg</code> (not part of default
4567: install):</p>
1.1 grant 4568: <pre class="screen">
1.14 xtraeme 4569: <code class="prompt">#</code> <strong class=
4570: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1 grant 4571: </pre>
4572: </li>
4573:
4574: <li>
1.45 wiz 4575: <p>Checkout pkgsrc via cvs into <code xmlns=
4576: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4577: "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1 grant 4578: <pre class="screen">
1.14 xtraeme 4579: <code class="prompt">#</code> <strong class=
4580: "userinput"><code>cd /usr/sandbox/usr</code></strong>
4581: <code class="prompt">#</code> <strong class=
4582: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1 grant 4583: </pre>
4584:
4585: <p>Do not mount/link this to the copy of your
4586: pkgsrc tree you do development in, as this will
4587: likely cause problems!</p>
4588: </li>
4589:
4590: <li>
1.45 wiz 4591: <p>Make <code xmlns=
4592: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4593: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.45 wiz 4594: and <code xmlns=
4595: "http://www.w3.org/TR/xhtml1/transitional" class=
4596: "filename">.../distfiles</code> point somewhere
4597: appropriate. NFS- and/or nullfs-mounts may come
4598: in handy!</p>
1.1 grant 4599: </li>
4600:
4601: <li>
1.45 wiz 4602: <p>Edit <code xmlns=
4603: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4604: "filename">/etc/mk.conf</code>, see <a href=
4605: "#binary.mk.conf" title=
1.63 dillo 4606: "6.3.1.2. /etc/mk.conf">Section 6.3.1.2,
1.1 grant 4607: “/etc/mk.conf”</a>.</p>
4608: </li>
4609:
4610: <li>
1.45 wiz 4611: <p>Adjust <code xmlns=
4612: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4613: "filename">mk/bulk/build.conf</code> to suit your
1.1 grant 4614: needs.</p>
4615: </li>
4616:
4617: <li>
1.14 xtraeme 4618: <p>If you have set <code class=
1.45 wiz 4619: "varname">CVS_USER</code> in <code xmlns=
4620: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4621: "filename">build.conf</code>, make sure that
4622: account exists and can do a <span><strong class=
4623: "command">cvs ${CVS_FLAGS} update</strong></span>
1.1 grant 4624: properly!</p>
4625: </li>
4626: </ol>
4627: </div>
4628:
1.47 reed 4629: <p>When the chroot sandbox is set up, you can start the
1.1 grant 4630: build with the following steps:</p>
4631: <pre class="screen">
1.14 xtraeme 4632: <code class="prompt">#</code> <strong class=
4633: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
4634: <code class="prompt">#</code> <strong class=
4635: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1 grant 4636: </pre>
4637:
4638: <p>This will just jump inside the sandbox and start
4639: building. At the end of the build, mail will be sent
4640: with the results of the build. Created binary pkgs will
1.45 wiz 4641: be in <code xmlns=
4642: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4643: "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1 grant 4644: (wherever that points/mounts to/from).</p>
4645: </div>
4646:
1.63 dillo 4647: <div class="sect2" lang="en">
1.1 grant 4648: <div class="titlepage">
4649: <div>
4650: <div>
1.30 wiz 4651: <h3 class="title"><a name=
1.38 dillo 4652: "building-a-partial-set"></a>6.3.7. Building
1.30 wiz 4653: a partial set of packages</h3>
1.1 grant 4654: </div>
4655: </div>
4656: </div>
4657:
4658: <p>In addition to building a complete set of all
1.45 wiz 4659: packages in pkgsrc, the <code xmlns=
4660: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4661: "filename">pkgsrc/mk/bulk/build</code> script may be
4662: used to build a subset of the packages contained in
1.47 reed 4663: pkgsrc. By setting <code class=
1.45 wiz 4664: "varname">SPECIFIC_PKGS</code> in <code xmlns=
4665: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4666: "filename">/etc/mk.conf</code>, the variables</p>
1.1 grant 4667:
4668: <div class="itemizedlist">
4669: <ul type="disc">
4670: <li>
4671: <p>SITE_SPECIFIC_PKGS</p>
4672: </li>
4673:
4674: <li>
4675: <p>HOST_SPECIFIC_PKGS</p>
4676: </li>
4677:
4678: <li>
4679: <p>GROUP_SPECIFIC_PKGS</p>
4680: </li>
4681:
4682: <li>
4683: <p>USER_SPECIFIC_PKGS</p>
4684: </li>
4685: </ul>
4686: </div>
4687:
4688: <p>will define the set of packages which should be
4689: built. The bulk build code will also include any
4690: packages which are needed as dependencies for the
4691: explicitly listed packages.</p>
4692:
4693: <p>One use of this is to do a bulk build with
1.14 xtraeme 4694: <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1 grant 4695: sandbox periodically to have a complete set of the
4696: binary packages needed for your site available without
4697: the overhead of building extra packages that are not
4698: needed.</p>
4699: </div>
1.13 hubertf 4700:
1.63 dillo 4701: <div class="sect2" lang="en">
1.13 hubertf 4702: <div class="titlepage">
4703: <div>
4704: <div>
1.63 dillo 4705: <h3 class="title"><a name=
1.38 dillo 4706: "bulk-upload"></a>6.3.8. Uploading results
1.13 hubertf 4707: of a bulk build</h3>
4708: </div>
4709: </div>
4710: </div>
4711:
4712: <p>This section describes how pkgsrc developers can
4713: upload binary pkgs built by bulk builds to
4714: ftp.NetBSD.org.</p>
4715:
1.17 sketch 4716: <p>If you would like to automatically create checksum
4717: files for the binary packages you intend to upload,
4718: remember to set <code class="varname">MKSUMS=yes</code>
1.45 wiz 4719: in your <code xmlns=
4720: "http://www.w3.org/TR/xhtml1/transitional" class=
1.17 sketch 4721: "filename">mk/bulk/build.conf</code>.</p>
4722:
4723: <p>If you would like to PGP sign the checksum files
4724: (highly recommended!), remember to set <code class=
4725: "varname">SIGN_AS=username@NetBSD.org</code> in your
1.45 wiz 4726: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4727: class="filename">mk/bulk/build.conf</code>. This will
4728: prompt you for your GPG password to sign the files
1.17 sketch 4729: before uploading everything.</p>
4730:
4731: <p>Then, make sure that you have <code class=
1.14 xtraeme 4732: "varname">RSYNC_DST</code> set properly in your
1.45 wiz 4733: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4734: class="filename">mk/bulk/build.conf</code> file, i.e.
4735: adjust it to something like one of the following:</p>
1.13 hubertf 4736: <pre class="screen">
4737: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
4738: </pre>
4739:
1.47 reed 4740: <p>Please use appropriate values for "pkgsrc-200xQy",
1.13 hubertf 4741: "NetBSD-a.b.c" and "arch" here. If your login on
1.14 xtraeme 4742: ftp.NetBSD.org is different from <code class=
4743: "varname">CVS_USER</code>, write your login directly
4744: into the variable, e.g. my local account is "feyrer",
4745: but for my login "hubertf", I use:</p>
1.13 hubertf 4746: <pre class="screen">
4747: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload
4748: </pre>
4749:
1.45 wiz 4750: <p>A separate <code xmlns=
4751: "http://www.w3.org/TR/xhtml1/transitional" class=
4752: "filename">upload</code> directory is used here to
4753: allow "closing" the directory during upload. To do so,
4754: run the following command on ftp.NetBSD.org next:</p>
1.13 hubertf 4755: <pre class="screen">
1.14 xtraeme 4756: nbftp% <strong class=
4757: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13 hubertf 4758: </pre>
4759:
1.45 wiz 4760: <p>Please note that <code xmlns=
4761: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4762: "filename">/pub/NetBSD/packages</code> is only
1.13 hubertf 4763: appropriate for packages for the NetBSD operating
4764: system. Binary packages for other operating systems
1.45 wiz 4765: should go into <code xmlns=
4766: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4767: "filename">/pub/pkgsrc</code>.</p>
1.13 hubertf 4768:
4769: <p>Before uploading the binary pkgs, ssh authentication
1.47 reed 4770: needs to be set up. This example shows how to set up
1.13 hubertf 4771: temporary keys for the root account <span class=
4772: "emphasis"><em>inside the sandbox</em></span> (assuming
4773: that no keys should be present there usually):</p>
4774: <pre class="screen">
1.14 xtraeme 4775: <code class="prompt">#</code> <strong class=
4776: "userinput"><code>chroot /usr/sandbox</code></strong>
4777: chroot-<code class="prompt">#</code> <strong class=
4778: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>
4779: chroot-<code class="prompt">#</code> <strong class=
4780: "userinput"><code>ssh-keygen -t dsa</code></strong>
4781: chroot-<code class="prompt">#</code> <strong class=
4782: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong>
1.13 hubertf 4783: </pre>
4784:
1.45 wiz 4785: <p>Now take the output of <code xmlns=
4786: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4787: "filename">id-dsa.pub</code> and append it to your
1.45 wiz 4788: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4789: class="filename">~/.ssh/authorized_keys</code> file on
4790: ftp.NetBSD.org. You can remove the key after the upload
4791: is done!</p>
1.13 hubertf 4792:
4793: <p>Next, test if your ssh connection really works:</p>
4794: <pre class="screen">
1.14 xtraeme 4795: chroot-<code class="prompt">#</code> <strong class=
4796: "userinput"><code>ssh ftp.NetBSD.org date</code></strong>
1.13 hubertf 4797: </pre>
4798:
4799: <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
4800:
4801: <p>Now after all this works, you can exit the sandbox
4802: and start the upload:</p>
4803: <pre class="screen">
1.14 xtraeme 4804: chroot-<code class="prompt">#</code> <strong class=
4805: "userinput"><code>exit</code></strong>
4806: <code class="prompt">#</code> <strong class=
4807: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
4808: <code class="prompt">#</code> <strong class=
4809: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong>
1.13 hubertf 4810: </pre>
4811:
4812: <p>The upload process may take quite some time. Use
1.24 wiz 4813: <a href=
4814: "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
4815: <span class="citerefentry"><span class=
4816: "refentrytitle">ls</span>(1)</span></a> or <a href=
4817: "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
4818: <span class="citerefentry"><span class=
4819: "refentrytitle">du</span>(1)</span></a> on the FTP
4820: server to monitor progress of the upload. The upload
4821: script will take care of not uploading restricted
4822: packages and putting vulnerable packages into the
1.45 wiz 4823: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4824: class="filename">vulnerable</code> subdirectory.</p>
1.13 hubertf 4825:
4826: <p>After the upload has ended, first thing is to revoke
4827: ssh access:</p>
4828: <pre class="screen">
1.14 xtraeme 4829: nbftp% <strong class=
4830: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13 hubertf 4831: Gdd:x!
4832: </pre>
4833:
4834: <p>Use whatever is needed to remove the key you've
4835: entered before! Last, move the uploaded packages out of
1.45 wiz 4836: the <code xmlns=
4837: "http://www.w3.org/TR/xhtml1/transitional" class=
4838: "filename">upload</code> directory to have them
4839: accessible to everyone:</p>
1.13 hubertf 4840: <pre class="screen">
1.14 xtraeme 4841: nbftp% <strong class=
4842: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
4843: nbftp% <strong class=
4844: "userinput"><code>mv upload/* .</code></strong>
4845: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
4846: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong>
1.13 hubertf 4847: </pre>
4848: </div>
1.1 grant 4849: </div>
4850:
1.63 dillo 4851: <div class="sect1" lang="en">
1.1 grant 4852: <div class="titlepage">
4853: <div>
4854: <div>
4855: <h2 class="title" style="clear: both"><a name=
1.38 dillo 4856: "creating-cdroms"></a>6.4. Creating a multiple
1.30 wiz 4857: CD-ROM packages collection</h2>
1.1 grant 4858: </div>
4859: </div>
4860: </div>
4861:
4862: <p>After your pkgsrc bulk-build has completed, you may
4863: wish to create a CD-ROM set of the resulting binary
4864: packages to assist in installing packages on other
4865: machines. The <a xmlns=
4866: "http://www.w3.org/TR/xhtml1/transitional" href=
4867: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.45 wiz 4868: target="_top"><code xmlns="" class=
4869: "filename">pkgtools/cdpack</code></a> package provides a
1.20 ben 4870: simple tool for creating the ISO 9660 images.
4871: <span><strong class="command">cdpack</strong></span>
4872: arranges the packages on the CD-ROMs in a way that keeps
1.47 reed 4873: all the dependencies for a given package on the same CD
4874: as that package.</p>
1.1 grant 4875:
1.63 dillo 4876: <div class="sect2" lang="en">
1.1 grant 4877: <div class="titlepage">
4878: <div>
4879: <div>
1.63 dillo 4880: <h3 class="title"><a name=
1.38 dillo 4881: "cdpack-example"></a>6.4.1. Example of
1.1 grant 4882: cdpack</h3>
4883: </div>
4884: </div>
4885: </div>
4886:
4887: <p>Complete documentation for cdpack is found in the
1.47 reed 4888: cdpack(1) man page. The following short example assumes
1.45 wiz 4889: that the binary packages are left in <code xmlns=
4890: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4891: "filename">/usr/pkgsrc/packages/All</code> and that
1.45 wiz 4892: sufficient disk space exists in <code xmlns=
4893: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4894: "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1 grant 4895: <pre class="screen">
1.14 xtraeme 4896: <code class="prompt">#</code> <strong class=
4897: "userinput"><code>mkdir /u2/images</code></strong>
4898: <code class="prompt">#</code> <strong class=
4899: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
4900: <code class="prompt">#</code> <strong class=
4901: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 4902: </pre>
4903:
4904: <p>If you wish to include a common set of files
1.45 wiz 4905: (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
4906: class="filename">COPYRIGHT</code>, <code xmlns=
4907: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4908: "filename">README</code>, etc.) on each CD in the
1.1 grant 4909: collection, then you need to create a directory which
4910: contains these files. e.g.</p>
4911: <pre class="screen">
1.14 xtraeme 4912: <code class="prompt">#</code> <strong class=
4913: "userinput"><code>mkdir /tmp/common</code></strong>
4914: <code class="prompt">#</code> <strong class=
4915: "userinput"><code>echo "This is a README" > /tmp/common/README</code></strong>
4916: <code class="prompt">#</code> <strong class=
4917: "userinput"><code>echo "Another file" > /tmp/common/COPYING</code></strong>
4918: <code class="prompt">#</code> <strong class=
4919: "userinput"><code>mkdir /tmp/common/bin</code></strong>
4920: <code class="prompt">#</code> <strong class=
4921: "userinput"><code>echo "#!/bin/sh" > /tmp/common/bin/myscript</code></strong>
4922: <code class="prompt">#</code> <strong class=
4923: "userinput"><code>echo "echo Hello world" >> /tmp/common/bin/myscript</code></strong>
4924: <code class="prompt">#</code> <strong class=
4925: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1 grant 4926: </pre>
4927:
4928: <p>Now create the images:</p>
4929: <pre class="screen">
1.14 xtraeme 4930: <code class="prompt">#</code> <strong class=
4931: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1 grant 4932: </pre>
4933:
1.45 wiz 4934: <p>Each image will contain <code xmlns=
4935: "http://www.w3.org/TR/xhtml1/transitional" class=
4936: "filename">README</code>, <code xmlns=
4937: "http://www.w3.org/TR/xhtml1/transitional" class=
4938: "filename">COPYING</code>, and <code xmlns=
4939: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 4940: "filename">bin/myscript</code> in their root
1.1 grant 4941: directories.</p>
4942: </div>
4943: </div>
4944: </div>
4945:
1.63 dillo 4946: <div class="chapter" lang="en">
1.1 grant 4947: <div class="titlepage">
4948: <div>
4949: <div>
1.63 dillo 4950: <h2 class="title"><a name=
1.38 dillo 4951: "faq"></a>Chapter 7. Frequently Asked
1.1 grant 4952: Questions</h2>
4953: </div>
4954: </div>
4955: </div>
4956:
4957: <div class="toc">
4958: <p><b>Table of Contents</b></p>
4959:
4960: <dl>
1.30 wiz 4961: <dt><span class="sect1"><a href=
1.38 dillo 4962: "#mailing-list-pointers">7.1. Are there any mailing
1.30 wiz 4963: lists for pkg-related discussion?</a></span></dt>
1.1 grant 4964:
1.38 dillo 4965: <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1 grant 4966: Where's the pkgviews documentation?</a></span></dt>
4967:
1.38 dillo 4968: <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1 grant 4969: Utilities for package management
4970: (pkgtools)</a></span></dt>
4971:
1.38 dillo 4972: <dt><span class="sect1"><a href="#non-root-pkgsrc">7.4.
1.30 wiz 4973: How to use pkgsrc as non-root</a></span></dt>
1.1 grant 4974:
1.30 wiz 4975: <dt><span class="sect1"><a href=
1.38 dillo 4976: "#resume-transfers">7.5. How to resume transfers when
1.30 wiz 4977: fetching distfiles?</a></span></dt>
1.14 xtraeme 4978:
1.30 wiz 4979: <dt><span class="sect1"><a href=
1.38 dillo 4980: "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30 wiz 4981: XFree86 from pkgsrc?</a></span></dt>
1.1 grant 4982:
1.30 wiz 4983: <dt><span class="sect1"><a href=
1.38 dillo 4984: "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30 wiz 4985: from pkgsrc?</a></span></dt>
1.1 grant 4986:
1.30 wiz 4987: <dt><span class="sect1"><a href=
1.38 dillo 4988: "#fetch-behind-firewall">7.8. How to fetch files from
1.30 wiz 4989: behind a firewall</a></span></dt>
1.1 grant 4990:
1.38 dillo 4991: <dt><span class="sect1"><a href="#passive-ftp">7.9. How
1.14 xtraeme 4992: do I tell <span><strong class="command">make
4993: fetch</strong></span> to do passive
4994: FTP?</a></span></dt>
1.1 grant 4995:
1.30 wiz 4996: <dt><span class="sect1"><a href=
1.38 dillo 4997: "#fetching-all-distfiles">7.10. How to fetch all
1.30 wiz 4998: distfiles at once</a></span></dt>
1.1 grant 4999:
1.30 wiz 5000: <dt><span class="sect1"><a href=
1.38 dillo 5001: "#tmac.andoc-missing">7.11. What does
1.30 wiz 5002: “<span class="quote">Don't know how to make
1.14 xtraeme 5003: /usr/share/tmac/tmac.andoc</span>”
1.1 grant 5004: mean?</a></span></dt>
5005:
1.30 wiz 5006: <dt><span class="sect1"><a href=
1.38 dillo 5007: "#bsd.own.mk-missing">7.12. What does
1.30 wiz 5008: “<span class="quote">Could not find
1.14 xtraeme 5009: bsd.own.mk</span>” mean?</a></span></dt>
1.1 grant 5010:
1.30 wiz 5011: <dt><span class="sect1"><a href=
1.38 dillo 5012: "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30 wiz 5013: pkgsrc</a></span></dt>
1.1 grant 5014:
1.38 dillo 5015: <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35 jmmv 5016: do I change the location of configuration
5017: files?</a></span></dt>
1.1 grant 5018:
1.38 dillo 5019: <dt><span class="sect1"><a href="#audit-packages">7.15.
1.1 grant 5020: Automated security checks</a></span></dt>
5021: </dl>
5022: </div>
5023:
5024: <p>This section contains hints, tips & tricks on
5025: special things in pkgsrc that we didn't find a better place
5026: for in the previous chapters, and it contains items for
5027: both pkgsrc users and developers.</p>
5028:
1.63 dillo 5029: <div class="sect1" lang="en">
1.1 grant 5030: <div class="titlepage">
5031: <div>
5032: <div>
5033: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5034: "mailing-list-pointers"></a>7.1. Are there any
1.30 wiz 5035: mailing lists for pkg-related discussion?</h2>
1.1 grant 5036: </div>
5037: </div>
5038: </div>
5039:
1.18 xtraeme 5040: <p>The following mailing lists may be of interest to
5041: pkgsrc users:</p>
5042:
5043: <div class="itemizedlist">
5044: <ul type="disc">
5045: <li>
5046: <p><a href=
5047: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.34 wiz 5048: target="_top">pkgsrc-bugs</a>: A list where problem
5049: reports related to pkgsrc are sent and
5050: discussed.</p>
1.18 xtraeme 5051: </li>
5052:
5053: <li>
5054: <p><a href=
5055: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34 wiz 5056: target="_top">pkgsrc-bulk</a>: A list where the
1.20 ben 5057: results of pkgsrc bulk builds are sent and
1.34 wiz 5058: discussed.</p>
1.18 xtraeme 5059: </li>
5060:
5061: <li>
5062: <p><a href=
5063: "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.34 wiz 5064: target="_top">pkgsrc-changes</a>: A list where all
5065: commit messages to pkgsrc are sent.</p>
1.18 xtraeme 5066: </li>
5067:
5068: <li>
5069: <p><a href=
5070: "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.34 wiz 5071: target="_top">tech-pkg</a>: A general discussion
5072: list for all things related to pkgsrc.</p>
1.18 xtraeme 5073: </li>
5074: </ul>
5075: </div>
5076:
5077: <p>To subscribe, do:</p>
1.1 grant 5078: <pre class="programlisting">
1.51 rillig 5079: <code class="prompt">%</code> echo subscribe <em class=
1.18 xtraeme 5080: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1 grant 5081: </pre>
5082:
1.18 xtraeme 5083: <p>Archives for all these mailing lists are available
5084: from <a href="http://mail-index.NetBSD.org/" target=
5085: "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1 grant 5086: </div>
5087:
1.63 dillo 5088: <div class="sect1" lang="en">
1.1 grant 5089: <div class="titlepage">
5090: <div>
5091: <div>
5092: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5093: "pkgviews-docs"></a>7.2. Where's the pkgviews
1.30 wiz 5094: documentation?</h2>
1.1 grant 5095: </div>
5096: </div>
5097: </div>
5098:
5099: <p>Pkgviews is tightly integrated with buildlink. You can
1.45 wiz 5100: find a pkgviews User's guide in <code xmlns=
5101: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5102: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1 grant 5103: </div>
5104:
1.63 dillo 5105: <div class="sect1" lang="en">
1.1 grant 5106: <div class="titlepage">
5107: <div>
5108: <div>
5109: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5110: "faq-pkgtools"></a>7.3. Utilities for package
1.5 hubertf 5111: management (pkgtools)</h2>
1.1 grant 5112: </div>
5113: </div>
5114: </div>
5115:
1.45 wiz 5116: <p>The <code xmlns=
5117: "http://www.w3.org/TR/xhtml1/transitional" class=
5118: "filename">pkgsrc/pkgtools</code> directory pkgtools
5119: contains a number of useful utilities for both users and
5120: developers of pkgsrc. This section attempts only to make
5121: the reader aware of the utilities and when they might be
5122: useful, and not to duplicate the documentation that comes
5123: with each package.</p>
1.1 grant 5124:
5125: <p>Utilities used by pkgsrc (automatically installed when
5126: needed):</p>
5127:
5128: <div class="itemizedlist">
5129: <ul type="disc">
5130: <li>
5131: <p><a xmlns=
5132: "http://www.w3.org/TR/xhtml1/transitional" href=
5133: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.45 wiz 5134: target="_top"><code xmlns="" class=
5135: "filename">pkgtools/x11-links</code></a>: Symlinks
1.34 wiz 5136: for use by buildlink.</p>
1.1 grant 5137: </li>
5138: </ul>
5139: </div>
5140:
5141: <p>OS tool augmentation (automatically installed when
5142: needed):</p>
5143:
5144: <div class="itemizedlist">
5145: <ul type="disc">
5146: <li>
5147: <p><a xmlns=
5148: "http://www.w3.org/TR/xhtml1/transitional" href=
5149: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.45 wiz 5150: target="_top"><code xmlns="" class=
5151: "filename">pkgtools/digest</code></a>: Calculates
1.34 wiz 5152: various kinds of checksums (including SHA1).</p>
1.1 grant 5153: </li>
5154:
5155: <li>
5156: <p><a xmlns=
5157: "http://www.w3.org/TR/xhtml1/transitional" href=
5158: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.45 wiz 5159: target="_top"><code xmlns="" class=
5160: "filename">pkgtools/libnbcompat</code></a>:
1.34 wiz 5161: Compatibility library for pkgsrc tools.</p>
1.1 grant 5162: </li>
5163:
5164: <li>
5165: <p><a xmlns=
5166: "http://www.w3.org/TR/xhtml1/transitional" href=
5167: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.45 wiz 5168: target="_top"><code xmlns="" class=
5169: "filename">pkgtools/mtree</code></a>: Installed on
1.34 wiz 5170: non-BSD systems due to lack of native mtree.</p>
1.1 grant 5171: </li>
5172:
5173: <li>
5174: <p><a xmlns=
5175: "http://www.w3.org/TR/xhtml1/transitional" href=
5176: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5177: target="_top"><code xmlns="" class=
5178: "filename">pkgtools/pkg_install</code></a>:
5179: Up-to-date replacement for <code xmlns=
5180: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 5181: "filename">/usr/sbin/pkg_install</code>, or for use
5182: on operating systems where pkg_install is not
5183: present.</p>
1.1 grant 5184: </li>
5185: </ul>
5186: </div>
5187:
5188: <p>Utilities used by pkgsrc (not automatically
5189: installed):</p>
5190:
5191: <div class="itemizedlist">
5192: <ul type="disc">
5193: <li>
5194: <p><a xmlns=
5195: "http://www.w3.org/TR/xhtml1/transitional" href=
5196: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.45 wiz 5197: target="_top"><code xmlns="" class=
5198: "filename">pkgtools/pkg_tarup</code></a>: Create a
1.20 ben 5199: binary package from an already-installed package.
1.34 wiz 5200: Used by <span><strong class="command">make
5201: replace</strong></span> to save the old
5202: package.</p>
1.1 grant 5203: </li>
5204:
5205: <li>
5206: <p><a xmlns=
5207: "http://www.w3.org/TR/xhtml1/transitional" href=
1.5 hubertf 5208: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.45 wiz 5209: target="_top"><code xmlns="" class=
5210: "filename">pkgtools/dfdisk</code></a>: Adds extra
1.20 ben 5211: functionality to pkgsrc, allowing it to fetch
5212: distfiles from multiple locations. It currently
5213: supports the following methods: multiple CD-ROMs
5214: and network FTP/HTTP connections.</p>
1.5 hubertf 5215: </li>
5216:
5217: <li>
5218: <p><a xmlns=
5219: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 5220: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 wiz 5221: target="_top"><code xmlns="" class=
5222: "filename">pkgtools/xpkgwedge</code></a>: Put X11
1.34 wiz 5223: packages someplace else (enabled by default).</p>
1.1 grant 5224: </li>
1.5 hubertf 5225:
5226: <li>
5227: <p><a xmlns=
5228: "http://www.w3.org/TR/xhtml1/transitional" href=
5229: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 wiz 5230: target="_top"><code xmlns="" class=
5231: "filename">devel/cpuflags</code></a>: Determine the
1.34 wiz 5232: best compiler flags to optimise code for your
1.20 ben 5233: current CPU and compiler.</p>
1.5 hubertf 5234: </li>
1.1 grant 5235: </ul>
5236: </div>
5237:
5238: <p>Utilities for keeping track of installed packages,
5239: being up to date, etc:</p>
5240:
5241: <div class="itemizedlist">
5242: <ul type="disc">
5243: <li>
5244: <p><a xmlns=
5245: "http://www.w3.org/TR/xhtml1/transitional" href=
5246: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.45 wiz 5247: target="_top"><code xmlns="" class=
5248: "filename">pkgtools/pkg_chk</code></a>: Reports on
1.27 rillig 5249: packages whose installed versions do not match the
1.34 wiz 5250: latest pkgsrc entries.</p>
1.1 grant 5251: </li>
5252:
5253: <li>
5254: <p><a xmlns=
5255: "http://www.w3.org/TR/xhtml1/transitional" href=
5256: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 wiz 5257: target="_top"><code xmlns="" class=
5258: "filename">pkgtools/pkgdep</code></a>: Makes
1.20 ben 5259: dependency graphs of packages, to aid in choosing a
1.34 wiz 5260: strategy for updating.</p>
1.1 grant 5261: </li>
5262:
5263: <li>
5264: <p><a xmlns=
5265: "http://www.w3.org/TR/xhtml1/transitional" href=
5266: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.45 wiz 5267: target="_top"><code xmlns="" class=
5268: "filename">pkgtools/pkgdepgraph</code></a>: Makes
1.27 rillig 5269: graphs from the output of <a xmlns=
5270: "http://www.w3.org/TR/xhtml1/transitional" href=
5271: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45 wiz 5272: target="_top"><code xmlns="" class=
5273: "filename">pkgtools/pkgdep</code></a> (uses
1.34 wiz 5274: graphviz).</p>
1.1 grant 5275: </li>
5276:
5277: <li>
5278: <p><a xmlns=
5279: "http://www.w3.org/TR/xhtml1/transitional" href=
5280: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 5281: target="_top"><code xmlns="" class=
5282: "filename">pkgtools/pkglint</code></a>: The
1.27 rillig 5283: pkglint(1) program checks a pkgsrc entry for
5284: errors, lintpkgsrc(1) does various checks on the
5285: complete pkgsrc system.</p>
1.1 grant 5286: </li>
5287:
5288: <li>
5289: <p><a xmlns=
5290: "http://www.w3.org/TR/xhtml1/transitional" href=
5291: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.45 wiz 5292: target="_top"><code xmlns="" class=
5293: "filename">pkgtools/pkgsurvey</code></a>: Report
5294: what packages you have installed.</p>
1.1 grant 5295: </li>
5296: </ul>
5297: </div>
5298:
5299: <p>Utilities for people maintaining or creating
5300: individual packages:</p>
5301:
5302: <div class="itemizedlist">
5303: <ul type="disc">
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/pkgdiff/README.html"
1.45 wiz 5308: target="_top"><code xmlns="" class=
5309: "filename">pkgtools/pkgdiff</code></a>: Automate
1.20 ben 5310: making and maintaining patches for a package
1.34 wiz 5311: (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1 grant 5312: </li>
5313:
5314: <li>
5315: <p><a xmlns=
5316: "http://www.w3.org/TR/xhtml1/transitional" href=
5317: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.45 wiz 5318: target="_top"><code xmlns="" class=
5319: "filename">pkgtools/rpm2pkg</code></a>, <a xmlns=
1.20 ben 5320: "http://www.w3.org/TR/xhtml1/transitional" href=
5321: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 wiz 5322: target="_top"><code xmlns="" class=
5323: "filename">pkgtools/url2pkg</code></a>: Aids in
1.34 wiz 5324: converting to pkgsrc.</p>
1.1 grant 5325: </li>
5326:
5327: <li>
5328: <p><a xmlns=
5329: "http://www.w3.org/TR/xhtml1/transitional" href=
5330: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.45 wiz 5331: target="_top"><code xmlns="" class=
5332: "filename">pkgtools/gensolpkg</code></a>: Convert
1.34 wiz 5333: pkgsrc to a Solaris package.</p>
1.1 grant 5334: </li>
5335: </ul>
5336: </div>
5337:
1.47 reed 5338: <p>Utilities for people maintaining pkgsrc (or: more
1.1 grant 5339: obscure pkg utilities)</p>
5340:
5341: <div class="itemizedlist">
5342: <ul type="disc">
5343: <li>
5344: <p><a xmlns=
5345: "http://www.w3.org/TR/xhtml1/transitional" href=
5346: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.45 wiz 5347: target="_top"><code xmlns="" class=
5348: "filename">pkgtools/pkg_comp</code></a>: Build
1.34 wiz 5349: packages in a chrooted area.</p>
1.1 grant 5350: </li>
5351:
5352: <li>
5353: <p><a xmlns=
5354: "http://www.w3.org/TR/xhtml1/transitional" href=
5355: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.45 wiz 5356: target="_top"><code xmlns="" class=
5357: "filename">pkgtools/libkver</code></a>: Spoof
5358: kernel version for chrooted cross builds.</p>
1.1 grant 5359: </li>
5360: </ul>
5361: </div>
5362: </div>
5363:
1.63 dillo 5364: <div class="sect1" lang="en">
1.1 grant 5365: <div class="titlepage">
5366: <div>
5367: <div>
5368: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5369: "non-root-pkgsrc"></a>7.4. How to use pkgsrc
1.30 wiz 5370: as non-root</h2>
1.1 grant 5371: </div>
5372: </div>
5373: </div>
5374:
5375: <p>If you want to use pkgsrc as non-root user, you can
5376: set some variables to make pkgsrc work under these
1.33 jmmv 5377: conditions. At the very least, you need to set
5378: <code class="varname">UNPRIVILEGED</code> to
5379: “<span class="quote">yes</span>”; this will
5380: turn on unprivileged mode and set multiple related
5381: variables to allow installation of packages as
5382: non-root.</p>
5383:
5384: <p>In case the defaults are not enough, you may want to
5385: tune some other variables used. For example, if the
5386: automatic user/group detection leads to incorrect values
5387: (or not the ones you would like to use), you can change
5388: them by setting <code class=
5389: "varname">UNPRIVILEGED_USER</code> and <code class=
5390: "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
5391:
5392: <p>As regards bootstrapping, please note that the
5393: <span><strong class="command">bootstrap</strong></span>
5394: script will ease non-root configuration when given the
5395: “<span class=
5396: "quote">--ignore-user-check</span>” flag, as it
5397: will choose and use multiple default directories under
1.45 wiz 5398: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5399: class="filename">~/pkg</code> as the installation
1.33 jmmv 5400: targets. These directories can be overriden by the
5401: “<span class="quote">--prefix</span>” flag
5402: provided by the script, as well as some others that allow
5403: finer tuning of the tree layout.</p>
1.14 xtraeme 5404: </div>
5405:
1.63 dillo 5406: <div class="sect1" lang="en">
1.14 xtraeme 5407: <div class="titlepage">
5408: <div>
5409: <div>
5410: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5411: "resume-transfers"></a>7.5. How to resume
1.30 wiz 5412: transfers when fetching distfiles?</h2>
1.14 xtraeme 5413: </div>
5414: </div>
5415: </div>
5416:
1.47 reed 5417: <p>By default, resuming transfers in pkgsrc is disabled,
1.15 xtraeme 5418: but you can enable this feature by adding the option
5419: <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
1.45 wiz 5420: into <code xmlns=
5421: "http://www.w3.org/TR/xhtml1/transitional" class=
5422: "filename">/etc/mk.conf</code>. If, during a fetch step,
5423: an incomplete distfile is found, pkgsrc will try to
5424: resume it.</p>
1.15 xtraeme 5425:
5426: <p>You can also use a different program than the default
1.24 wiz 5427: <a href=
5428: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
5429: <span class="citerefentry"><span class=
5430: "refentrytitle">ftp</span>(1)</span></a> by changing the
5431: <code class="varname">FETCH_CMD</code> variable. Don't
5432: forget to set <code class=
5433: "varname">FETCH_RESUME_ARGS</code> and <code class=
5434: "varname">FETCH_OUTPUT_ARGS</code> if you are not using
5435: default values.</p>
1.14 xtraeme 5436:
1.45 wiz 5437: <p>For example, if you want to use <code xmlns=
5438: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5439: "filename">wget</code> to resume downloads, you'll have
5440: to use something like:</p>
5441: <pre class="programlisting">
1.51 rillig 5442: FETCH_CMD= wget
5443: FETCH_BEFORE_ARGS= --passive-ftp
5444: FETCH_RESUME_ARGS= -c
5445: FETCH_OUTPUT_ARGS= -O
1.14 xtraeme 5446: </pre>
1.1 grant 5447: </div>
5448:
1.63 dillo 5449: <div class="sect1" lang="en">
1.1 grant 5450: <div class="titlepage">
5451: <div>
5452: <div>
5453: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5454: "XFree86-from-pkgsrc"></a>7.6. How can I
1.1 grant 5455: install/use XFree86 from pkgsrc?</h2>
5456: </div>
5457: </div>
5458: </div>
5459:
5460: <p>If you want to use XFree86 from pkgsrc instead of your
1.45 wiz 5461: system's own X11 (<code xmlns=
5462: "http://www.w3.org/TR/xhtml1/transitional" class=
5463: "filename">/usr/X11R6</code>, <code xmlns=
5464: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5465: "filename">/usr/openwin</code>, ...), you will have to
1.45 wiz 5466: add the following line into <code xmlns=
5467: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5468: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5469: <pre class="programlisting">
1.51 rillig 5470: X11_TYPE=XFree86
1.1 grant 5471: </pre>
5472: </div>
5473:
1.63 dillo 5474: <div class="sect1" lang="en">
1.1 grant 5475: <div class="titlepage">
5476: <div>
5477: <div>
5478: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5479: "x.org-from-pkgsrc"></a>7.7. How can I
1.1 grant 5480: install/use X.org from pkgsrc?</h2>
5481: </div>
5482: </div>
5483: </div>
5484:
5485: <p>If you want to use X.org from pkgsrc instead of your
1.45 wiz 5486: system's own X11 (<code xmlns=
5487: "http://www.w3.org/TR/xhtml1/transitional" class=
5488: "filename">/usr/X11R6</code>, <code xmlns=
5489: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5490: "filename">/usr/openwin</code>, ...) you will have to add
1.45 wiz 5491: the following line into <code xmlns=
5492: "http://www.w3.org/TR/xhtml1/transitional" class=
1.15 xtraeme 5493: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5494: <pre class="programlisting">
1.51 rillig 5495: X11_TYPE=xorg
1.1 grant 5496: </pre>
5497: </div>
5498:
1.63 dillo 5499: <div class="sect1" lang="en">
1.1 grant 5500: <div class="titlepage">
5501: <div>
5502: <div>
5503: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5504: "fetch-behind-firewall"></a>7.8. How to fetch
1.30 wiz 5505: files from behind a firewall</h2>
1.1 grant 5506: </div>
5507: </div>
5508: </div>
5509:
5510: <p>If you are sitting behind a firewall which does not
5511: allow direct connections to Internet hosts (i.e.
5512: non-NAT), you may specify the relevant proxy hosts. This
5513: is done using an environment variable in the form of a
1.47 reed 5514: URL, e.g. in Amdahl, the machine “<span class=
1.1 grant 5515: "quote">orpheus.amdahl.com</span>” is one of the
5516: firewalls, and it uses port 80 as the proxy port number.
5517: So the proxy environment variables are:</p>
5518: <pre class="programlisting">
1.51 rillig 5519: ftp_proxy=ftp://orpheus.amdahl.com:80/
5520: http_proxy=http://orpheus.amdahl.com:80/
1.1 grant 5521: </pre>
5522: </div>
5523:
1.63 dillo 5524: <div class="sect1" lang="en">
1.1 grant 5525: <div class="titlepage">
5526: <div>
5527: <div>
5528: <h2 class="title" style="clear: both"><a name=
1.63 dillo 5529: "passive-ftp"></a>7.9. How do I tell
5530: <span><strong class="command">make
1.14 xtraeme 5531: fetch</strong></span> to do passive FTP?</h2>
1.1 grant 5532: </div>
5533: </div>
5534: </div>
5535:
5536: <p>This depends on which utility is used to retrieve
1.45 wiz 5537: distfiles. From <code xmlns=
5538: "http://www.w3.org/TR/xhtml1/transitional" class=
5539: "filename">bsd.pkg.mk</code>, <code class=
5540: "varname">FETCH_CMD</code> is assigned the first
5541: available command from the following list:</p>
1.34 wiz 5542:
5543: <div class="itemizedlist">
5544: <ul type="disc">
5545: <li>
1.45 wiz 5546: <p><code xmlns=
5547: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 5548: "filename">${LOCALBASE}/bin/ftp</code></p>
5549: </li>
5550:
5551: <li>
1.45 wiz 5552: <p><code xmlns=
5553: "http://www.w3.org/TR/xhtml1/transitional" class=
5554: "filename">/usr/bin/ftp</code></p>
1.34 wiz 5555: </li>
5556: </ul>
5557: </div>
1.1 grant 5558:
5559: <p>On a default NetBSD installation, this will be
1.45 wiz 5560: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5561: class="filename">/usr/bin/ftp</code>, which automatically
5562: tries passive connections first, and falls back to active
5563: connections if the server refuses to do passive. For the
5564: other tools, add the following to your <code xmlns=
5565: "http://www.w3.org/TR/xhtml1/transitional" class=
5566: "filename">/etc/mk.conf</code> file: <code class=
5567: "varname">PASSIVE_FETCH=1</code>.</p>
1.1 grant 5568:
1.45 wiz 5569: <p>Having that option present will prevent <code xmlns=
5570: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5571: "filename">/usr/bin/ftp</code> from falling back to
5572: active transfers.</p>
1.1 grant 5573: </div>
5574:
1.63 dillo 5575: <div class="sect1" lang="en">
1.1 grant 5576: <div class="titlepage">
5577: <div>
5578: <div>
5579: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5580: "fetching-all-distfiles"></a>7.10. How to
1.1 grant 5581: fetch all distfiles at once</h2>
5582: </div>
5583: </div>
5584: </div>
5585:
5586: <p>You would like to download all the distfiles in a
5587: single batch from work or university, where you can't run
1.14 xtraeme 5588: a <span><strong class="command">make
5589: fetch</strong></span>. There is an archive of distfiles
5590: on <a href=
1.1 grant 5591: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
5592: target="_top">ftp.NetBSD.org</a>, but downloading the
5593: entire directory may not be appropriate.</p>
5594:
1.14 xtraeme 5595: <p>The answer here is to do a <span><strong class=
1.45 wiz 5596: "command">make fetch-list</strong></span> in <code xmlns=
5597: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 5598: "filename">/usr/pkgsrc</code> or one of its
1.1 grant 5599: subdirectories, carry the resulting list to your machine
1.23 wiz 5600: at work/school and use it there. If you don't have a
1.24 wiz 5601: NetBSD-compatible <a href=
5602: "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
5603: <span class="citerefentry"><span class=
5604: "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
5605: at work, don't forget to set <code class=
5606: "varname">FETCH_CMD</code> to something that fetches a
5607: URL:</p>
1.1 grant 5608:
5609: <p>At home:</p>
5610: <pre class="screen">
1.14 xtraeme 5611: <code class="prompt">%</code> <strong class=
5612: "userinput"><code>cd /usr/pkgsrc</code></strong>
5613: <code class="prompt">%</code> <strong class=
5614: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
5615: <code class="prompt">%</code> <strong class=
5616: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1 grant 5617: </pre>
5618:
5619: <p>At work:</p>
5620: <pre class="screen">
1.14 xtraeme 5621: <code class="prompt">%</code> <strong class=
5622: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1 grant 5623: </pre>
5624:
1.45 wiz 5625: <p>then tar up <code xmlns=
5626: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5627: "filename">/tmp/distfiles</code> and take it home.</p>
1.1 grant 5628:
5629: <p>If you have a machine running NetBSD, and you want to
5630: get <span class="emphasis"><em>all</em></span> distfiles
5631: (even ones that aren't for your machine architecture),
5632: you can do so by using the above-mentioned
1.14 xtraeme 5633: <span><strong class="command">make
5634: fetch-list</strong></span> approach, or fetch the
5635: distfiles directly by running:</p>
1.1 grant 5636: <pre class="screen">
1.14 xtraeme 5637: <code class="prompt">%</code> <strong class=
5638: "userinput"><code>make mirror-distfiles</code></strong>
1.1 grant 5639: </pre>
5640:
1.14 xtraeme 5641: <p>If you even decide to ignore <code class=
5642: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
5643: can get everything by running:</p>
1.1 grant 5644: <pre class="screen">
1.14 xtraeme 5645: <code class="prompt">%</code> <strong class=
5646: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1 grant 5647: </pre>
5648: </div>
5649:
1.63 dillo 5650: <div class="sect1" lang="en">
1.1 grant 5651: <div class="titlepage">
5652: <div>
5653: <div>
5654: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5655: "tmac.andoc-missing"></a>7.11. What does
1.1 grant 5656: “<span class="quote">Don't know how to make
5657: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
5658: </div>
5659: </div>
5660: </div>
5661:
5662: <p>When compiling the <a xmlns=
5663: "http://www.w3.org/TR/xhtml1/transitional" href=
5664: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5665: target="_top"><code xmlns="" class=
5666: "filename">pkgtools/pkg_install</code></a> package, you
5667: get the error from make that it doesn't know how to make
5668: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5669: class="filename">/usr/share/tmac/tmac.andoc</code>? This
5670: indicates that you don't have installed the
1.23 wiz 5671: “<span class="quote">text</span>” set (nroff,
5672: ...) from the NetBSD base distribution on your machine.
1.47 reed 5673: It is recommended to do that to format man pages.</p>
1.1 grant 5674:
5675: <p>In the case of the <a xmlns=
5676: "http://www.w3.org/TR/xhtml1/transitional" href=
5677: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45 wiz 5678: target="_top"><code xmlns="" class=
5679: "filename">pkgtools/pkg_install</code></a> package, you
5680: can get away with setting <code class=
1.20 ben 5681: "varname">NOMAN=YES</code> either in the environment or
1.45 wiz 5682: in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5683: class="filename">/etc/mk.conf</code>.</p>
1.1 grant 5684: </div>
5685:
1.63 dillo 5686: <div class="sect1" lang="en">
1.1 grant 5687: <div class="titlepage">
5688: <div>
5689: <div>
5690: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5691: "bsd.own.mk-missing"></a>7.12. What does
1.1 grant 5692: “<span class="quote">Could not find
5693: bsd.own.mk</span>” mean?</h2>
5694: </div>
5695: </div>
5696: </div>
5697:
1.45 wiz 5698: <p>You didn't install the compiler set, <code xmlns=
5699: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 5700: "filename">comp.tgz</code>, when you installed your
1.47 reed 5701: NetBSD machine. Please get and install it, by extracting
5702: it in <code xmlns=
1.45 wiz 5703: "http://www.w3.org/TR/xhtml1/transitional" class=
5704: "filename">/</code>:</p>
1.1 grant 5705: <pre class="screen">
1.14 xtraeme 5706: <code class="prompt">#</code> <strong class=
5707: "userinput"><code>cd /</code></strong>
5708: <code class="prompt">#</code> <strong class=
5709: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1 grant 5710: </pre>
5711:
1.45 wiz 5712: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5713: class="filename">comp.tgz</code> is part of every NetBSD
5714: release. Get the one that corresponds to your release
5715: (determine via <span><strong class="command">uname
5716: -r</strong></span>).</p>
1.1 grant 5717: </div>
5718:
1.63 dillo 5719: <div class="sect1" lang="en">
1.1 grant 5720: <div class="titlepage">
5721: <div>
5722: <div>
5723: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5724: "using-sudo-with-pkgsrc"></a>7.13. Using
1.1 grant 5725: 'sudo' with pkgsrc</h2>
5726: </div>
5727: </div>
5728: </div>
5729:
5730: <p>When installing packages as non-root user and using
1.24 wiz 5731: the just-in-time <a href=
5732: "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
5733: <span class="citerefentry"><span class=
5734: "refentrytitle">su</span>(1)</span></a> feature of
5735: pkgsrc, it can become annoying to type in the root
5736: password for each required package installed. To avoid
5737: this, the sudo package can be used, which does password
5738: caching over a limited time. To use it, install sudo
5739: (either as binary package or from <a xmlns=
5740: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 5741: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.45 wiz 5742: target="_top"><code xmlns="" class=
5743: "filename">security/sudo</code></a>) and then put the
5744: following into your <code xmlns=
5745: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 5746: "filename">/etc/mk.conf</code>:</p>
1.1 grant 5747: <pre class="programlisting">
1.51 rillig 5748: .if exists(${LOCALBASE}/bin/sudo)
5749: SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c
5750: .endif
1.1 grant 5751: </pre>
5752: </div>
5753:
1.63 dillo 5754: <div class="sect1" lang="en">
1.1 grant 5755: <div class="titlepage">
5756: <div>
5757: <div>
5758: <h2 class="title" style="clear: both"><a name=
1.63 dillo 5759: "faq.conf"></a>7.14. How do I change the
5760: location of configuration files?</h2>
1.1 grant 5761: </div>
5762: </div>
5763: </div>
5764:
1.35 jmmv 5765: <p>As the system administrator, you can choose where
5766: configuration files are installed. The default settings
1.45 wiz 5767: make all these files go into <code xmlns=
5768: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 5769: "filename">${PREFIX}/etc</code> or some of its
5770: subdirectories; this may be suboptimal depending on your
5771: expectations (e.g., a read-only, NFS-exported
5772: <code class="varname">PREFIX</code> with a need of
5773: per-machine configuration of the provided packages).</p>
5774:
5775: <p>In order to change the defaults, you can modify the
5776: <code class="varname">PKG_SYSCONFBASE</code> variable (in
1.45 wiz 5777: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
5778: class="filename">/etc/mk.conf</code>) to point to your
5779: preferred configuration directory; some common examples
5780: include <code xmlns=
5781: "http://www.w3.org/TR/xhtml1/transitional" class=
5782: "filename">/etc</code> or <code xmlns=
5783: "http://www.w3.org/TR/xhtml1/transitional" class=
5784: "filename">/etc/pkg</code>.</p>
1.35 jmmv 5785:
5786: <p>Furthermore, you can change this value on a
5787: per-package basis by setting the <code class=
5788: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
5789: variable. <code class="varname">PKG_SYSCONFVAR</code>'s
5790: value usually matches the name of the package you would
5791: like to modify, that is, the contents of <code class=
5792: "varname">PKGBASE</code>.</p>
1.1 grant 5793:
1.47 reed 5794: <p>Note that after changing these settings, you must
1.35 jmmv 5795: rebuild and reinstall any affected packages.</p>
1.1 grant 5796: </div>
5797:
1.63 dillo 5798: <div class="sect1" lang="en">
1.1 grant 5799: <div class="titlepage">
5800: <div>
5801: <div>
5802: <h2 class="title" style="clear: both"><a name=
1.38 dillo 5803: "audit-packages"></a>7.15. Automated security
1.1 grant 5804: checks</h2>
5805: </div>
5806: </div>
5807: </div>
5808:
5809: <p>Please be aware that there can often be bugs in
5810: third-party software, and some of these bugs can leave a
5811: machine vulnerable to exploitation by attackers. In an
5812: effort to lessen the exposure, the NetBSD packages team
5813: maintains a database of known-exploits to packages which
5814: have at one time been included in pkgsrc. The database
5815: can be downloaded automatically, and a security audit of
5816: all packages installed on a system can take place. To do
5817: this, install the <a xmlns=
5818: "http://www.w3.org/TR/xhtml1/transitional" href=
5819: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 5820: target="_top"><code xmlns="" class=
5821: "filename">security/audit-packages</code></a> package. It
1.20 ben 5822: has two components:</p>
1.1 grant 5823:
5824: <div class="orderedlist">
5825: <ol type="1">
5826: <li>
1.34 wiz 5827: <p><span><strong class=
5828: "command">download-vulnerability-list</strong></span>,
1.1 grant 5829: an easy way to download a list of the security
5830: vulnerabilities information. This list is kept up
5831: to date by the NetBSD security officer and the
5832: NetBSD packages team, and is distributed from the
5833: NetBSD ftp server:</p>
5834:
5835: <p><a href=
5836: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20 ben 5837: target=
5838: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1 grant 5839: </li>
5840:
5841: <li>
1.34 wiz 5842: <p><span><strong class=
5843: "command">audit-packages</strong></span>, an easy
5844: way to audit the current machine, checking each
1.1 grant 5845: vulnerability which is known. If a vulnerable
5846: package is installed, it will be shown by output to
5847: stdout, including a description of the type of
5848: vulnerability, and a URL containing more
5849: information.</p>
5850: </li>
5851: </ol>
5852: </div>
5853:
1.23 wiz 5854: <p>Use of the <a xmlns=
5855: "http://www.w3.org/TR/xhtml1/transitional" href=
5856: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45 wiz 5857: target="_top"><code xmlns="" class=
5858: "filename">security/audit-packages</code></a> package is
1.23 wiz 5859: strongly recommended! After “<span class=
5860: "quote">audit-packages</span>” is installed, please
5861: read the package's message, which you can get by running
5862: <strong class="userinput"><code>pkg_info -D
1.65 ! hubertf 5863: audit-packages</code></strong>.</p>
1.58 erh 5864:
5865: <p>If this package is installed, pkgsrc builds will use
5866: it to perform a security check before building any
5867: package. See <a href="#variables-affecting-build" title=
5868: "5.2. Variables affecting the build process">Section 5.2,
5869: “Variables affecting the build process”</a>
1.59 rillig 5870: for ways to control this check.</p>
1.1 grant 5871: </div>
5872: </div>
5873: </div>
5874:
1.63 dillo 5875: <div class="part" lang="en">
1.1 grant 5876: <div class="titlepage">
5877: <div>
5878: <div>
1.63 dillo 5879: <h1 class="title"><a name=
1.48 dillo 5880: "developers-guide"></a>Part II. The pkgsrc
5881: developer's guide</h1>
1.1 grant 5882: </div>
5883: </div>
5884: </div>
5885:
5886: <div class="toc">
5887: <p><b>Table of Contents</b></p>
5888:
5889: <dl>
1.38 dillo 5890: <dt><span class="chapter"><a href="#components">8.
1.27 rillig 5891: Package components - files, directories and
5892: contents</a></span></dt>
5893:
5894: <dd>
5895: <dl>
5896: <dt><span class="sect1"><a href=
1.45 wiz 5897: "#components.Makefile">8.1. <code xmlns=
5898: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 5899: "filename">Makefile</code></a></span></dt>
5900:
5901: <dt><span class="sect1"><a href=
1.45 wiz 5902: "#components.distinfo">8.2. <code xmlns=
5903: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 5904: "filename">distinfo</code></a></span></dt>
5905:
5906: <dt><span class="sect1"><a href=
1.38 dillo 5907: "#components.patches">8.3. patches/*</a></span></dt>
1.27 rillig 5908:
1.30 wiz 5909: <dt><span class="sect1"><a href=
1.38 dillo 5910: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 5911: files</a></span></dt>
1.27 rillig 5912:
5913: <dt><span class="sect1"><a href=
1.38 dillo 5914: "#components.optional">8.5. Optional
1.27 rillig 5915: files</a></span></dt>
5916:
1.38 dillo 5917: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 5918: <code xmlns=
5919: "http://www.w3.org/TR/xhtml1/transitional" class=
5920: "filename">work*</code></a></span></dt>
1.27 rillig 5921:
1.38 dillo 5922: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 5923: <code xmlns=
5924: "http://www.w3.org/TR/xhtml1/transitional" class=
5925: "filename">files/*</code></a></span></dt>
1.27 rillig 5926: </dl>
5927: </dd>
5928:
1.38 dillo 5929: <dt><span class="chapter"><a href="#makefile">9.
1.45 wiz 5930: Programming in <code xmlns=
5931: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 5932: "filename">Makefile</code>s</a></span></dt>
5933:
5934: <dd>
5935: <dl>
5936: <dt><span class="sect1"><a href=
1.45 wiz 5937: "#makefile.variables">9.1. <code xmlns=
5938: "http://www.w3.org/TR/xhtml1/transitional" class=
1.25 rillig 5939: "filename">Makefile</code> variables</a></span></dt>
5940:
1.27 rillig 5941: <dd>
5942: <dl>
5943: <dt><span class="sect2"><a href=
1.38 dillo 5944: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 5945: conventions</a></span></dt>
5946: </dl>
5947: </dd>
5948:
1.38 dillo 5949: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.25 rillig 5950: Code snippets</a></span></dt>
5951:
5952: <dd>
5953: <dl>
5954: <dt><span class="sect2"><a href=
1.38 dillo 5955: "#adding-to-list">9.2.1. Adding things to a
1.25 rillig 5956: list</a></span></dt>
5957:
5958: <dt><span class="sect2"><a href=
1.38 dillo 5959: "#converting-internal-to-external">9.2.2.
1.30 wiz 5960: Converting an internal list into an external
5961: list</a></span></dt>
1.25 rillig 5962:
5963: <dt><span class="sect2"><a href=
1.38 dillo 5964: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 5965: variables to a shell command</a></span></dt>
1.27 rillig 5966:
5967: <dt><span class="sect2"><a href=
1.38 dillo 5968: "#quoting-guideline">9.2.4. Quoting
1.27 rillig 5969: guideline</a></span></dt>
5970:
5971: <dt><span class="sect2"><a href=
1.38 dillo 5972: "#bsd-make-bug-workaround">9.2.5. Workaround for
1.30 wiz 5973: a bug in BSD Make</a></span></dt>
1.25 rillig 5974: </dl>
5975: </dd>
5976: </dl>
5977: </dd>
5978:
1.38 dillo 5979: <dt><span class="chapter"><a href="#plist">10. PLIST
1.1 grant 5980: issues</a></span></dt>
5981:
5982: <dd>
5983: <dl>
1.38 dillo 5984: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 5985: ID</a></span></dt>
5986:
1.30 wiz 5987: <dt><span class="sect1"><a href=
1.38 dillo 5988: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 5989: <code xmlns=
5990: "http://www.w3.org/TR/xhtml1/transitional" class=
5991: "filename">PLIST</code> generation</a></span></dt>
1.1 grant 5992:
1.38 dillo 5993: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 5994: Tweaking output of <span><strong class="command">make
5995: print-PLIST</strong></span></a></span></dt>
1.1 grant 5996:
1.38 dillo 5997: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 5998: Variable substitution in PLIST</a></span></dt>
5999:
1.30 wiz 6000: <dt><span class="sect1"><a href=
1.48 dillo 6001: "#manpage-compression">10.5. Man page
6002: compression</a></span></dt>
1.1 grant 6003:
1.30 wiz 6004: <dt><span class="sect1"><a href=
1.38 dillo 6005: "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30 wiz 6006: <code class=
1.14 xtraeme 6007: "varname">PLIST_SRC</code></a></span></dt>
1.1 grant 6008:
1.30 wiz 6009: <dt><span class="sect1"><a href=
1.47 reed 6010: "#platform-specific-plist">10.7. Platform-specific
1.38 dillo 6011: and differing PLISTs</a></span></dt>
1.1 grant 6012:
6013: <dt><span class="sect1"><a href=
1.38 dillo 6014: "#faq.common-dirs">10.8. Sharing directories between
1.1 grant 6015: packages</a></span></dt>
6016: </dl>
6017: </dd>
6018:
1.38 dillo 6019: <dt><span class="chapter"><a href="#buildlink">11.
1.1 grant 6020: Buildlink methodology</a></span></dt>
6021:
6022: <dd>
6023: <dl>
1.30 wiz 6024: <dt><span class="sect1"><a href=
1.38 dillo 6025: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 6026: to use buildlink3</a></span></dt>
1.1 grant 6027:
1.30 wiz 6028: <dt><span class="sect1"><a href=
1.45 wiz 6029: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
6030: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 6031: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 6032:
6033: <dd>
6034: <dl>
6035: <dt><span class="sect2"><a href=
1.38 dillo 6036: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 6037: buildlink3.mk file</a></span></dt>
1.1 grant 6038:
6039: <dt><span class="sect2"><a href=
1.38 dillo 6040: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 6041: <code class=
1.63 dillo 6042: "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
6043: in <code xmlns=
1.45 wiz 6044: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 6045: "filename">buildlink3.mk</code>
1.1 grant 6046: files</a></span></dt>
6047: </dl>
6048: </dd>
6049:
1.30 wiz 6050: <dt><span class="sect1"><a href=
1.45 wiz 6051: "#writing-builtin.mk">11.3. Writing <code xmlns=
6052: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 6053: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 6054:
6055: <dd>
6056: <dl>
6057: <dt><span class="sect2"><a href=
1.38 dillo 6058: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 6059: <code xmlns=
6060: "http://www.w3.org/TR/xhtml1/transitional" class=
6061: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 6062:
6063: <dt><span class="sect2"><a href=
1.38 dillo 6064: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 6065: preferences for native or pkgsrc
6066: software</a></span></dt>
1.1 grant 6067: </dl>
6068: </dd>
6069: </dl>
6070: </dd>
6071:
1.38 dillo 6072: <dt><span class="chapter"><a href="#pkginstall">12. The
1.35 jmmv 6073: pkginstall framework</a></span></dt>
6074:
6075: <dd>
6076: <dl>
6077: <dt><span class="sect1"><a href=
1.38 dillo 6078: "#files-and-dirs-outside-prefix">12.1. Files and
1.35 jmmv 6079: directories outside the installation
6080: prefix</a></span></dt>
6081:
6082: <dd>
6083: <dl>
6084: <dt><span class="sect2"><a href=
1.38 dillo 6085: "#dirs-outside-prefix">12.1.1. Directory
1.35 jmmv 6086: manipulation</a></span></dt>
6087:
6088: <dt><span class="sect2"><a href=
1.38 dillo 6089: "#files-outside-prefix">12.1.2. File
1.35 jmmv 6090: manipulation</a></span></dt>
6091: </dl>
6092: </dd>
6093:
1.38 dillo 6094: <dt><span class="sect1"><a href="#conf-files">12.2.
1.35 jmmv 6095: Configuration files</a></span></dt>
6096:
6097: <dd>
6098: <dl>
6099: <dt><span class="sect2"><a href=
1.38 dillo 6100: "#conf-files-sysconfdir">12.2.1. How <code class=
1.35 jmmv 6101: "varname">PKG_SYSCONFDIR</code> is
6102: set</a></span></dt>
6103:
6104: <dt><span class="sect2"><a href=
1.38 dillo 6105: "#conf-files-configure">12.2.2. Telling the
1.47 reed 6106: software where configuration files
1.35 jmmv 6107: are</a></span></dt>
6108:
6109: <dt><span class="sect2"><a href=
1.38 dillo 6110: "#conf-files-patching">12.2.3. Patching
1.35 jmmv 6111: installations</a></span></dt>
6112:
6113: <dt><span class="sect2"><a href=
1.38 dillo 6114: "#conf-files-disable">12.2.4. Disabling handling
1.35 jmmv 6115: of configuration files</a></span></dt>
6116: </dl>
6117: </dd>
6118:
1.38 dillo 6119: <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35 jmmv 6120: System startup scripts</a></span></dt>
6121:
6122: <dd>
6123: <dl>
6124: <dt><span class="sect2"><a href=
1.38 dillo 6125: "#rcd-scripts-disable">12.3.1. Disabling handling
1.35 jmmv 6126: of system startup scripts</a></span></dt>
6127: </dl>
6128: </dd>
6129:
6130: <dt><span class="sect1"><a href=
1.38 dillo 6131: "#users-and-groups">12.4. System users and
1.35 jmmv 6132: groups</a></span></dt>
6133:
1.38 dillo 6134: <dt><span class="sect1"><a href="#shells">12.5.
1.35 jmmv 6135: System shells</a></span></dt>
6136:
6137: <dd>
6138: <dl>
6139: <dt><span class="sect2"><a href=
1.65 ! hubertf 6140: "#shells-disable">12.5.1. Disabling shell
! 6141: registration</a></span></dt>
! 6142: </dl>
! 6143: </dd>
! 6144:
! 6145: <dt><span class="sect1"><a href="#fonts">12.6.
! 6146: Fonts</a></span></dt>
! 6147:
! 6148: <dd>
! 6149: <dl>
! 6150: <dt><span class="sect2"><a href=
! 6151: "#fonts-disable">12.6.1. Disabling automatic
! 6152: update of the fonts databases</a></span></dt>
1.35 jmmv 6153: </dl>
6154: </dd>
6155: </dl>
6156: </dd>
6157:
1.38 dillo 6158: <dt><span class="chapter"><a href="#options">13. Options
1.1 grant 6159: handling</a></span></dt>
6160:
6161: <dd>
6162: <dl>
1.30 wiz 6163: <dt><span class="sect1"><a href=
1.38 dillo 6164: "#global-default-options">13.1. Global default
1.30 wiz 6165: options</a></span></dt>
1.1 grant 6166:
1.30 wiz 6167: <dt><span class="sect1"><a href=
1.38 dillo 6168: "#converting-to-options">13.2. Converting packages to
1.45 wiz 6169: use <code xmlns=
6170: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6171: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 6172:
6173: <dt><span class="sect1"><a href="#option-names">13.3.
6174: Option Names</a></span></dt>
1.1 grant 6175: </dl>
6176: </dd>
6177:
1.38 dillo 6178: <dt><span class="chapter"><a href="#build">14. The build
1.1 grant 6179: process</a></span></dt>
6180:
6181: <dd>
6182: <dl>
1.56 rillig 6183: <dt><span class="sect1"><a href="#build.intro">14.1.
6184: Introduction</a></span></dt>
6185:
6186: <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1 grant 6187: Program location</a></span></dt>
6188:
1.56 rillig 6189: <dt><span class="sect1"><a href=
6190: "#build.builddirs">14.3. Directories used during the
6191: build process</a></span></dt>
1.1 grant 6192:
6193: <dt><span class="sect1"><a href=
1.56 rillig 6194: "#build.running">14.4. Running a
6195: phase</a></span></dt>
6196:
6197: <dt><span class="sect1"><a href="#build.fetch">14.5.
6198: The <span class="emphasis"><em>fetch</em></span>
6199: phase</a></span></dt>
6200:
6201: <dt><span class="sect1"><a href=
6202: "#build.checksum">14.6. The <span class=
6203: "emphasis"><em>checksum</em></span>
6204: phase</a></span></dt>
6205:
6206: <dt><span class="sect1"><a href=
6207: "#build.extract">14.7. The <span class=
6208: "emphasis"><em>extract</em></span>
6209: phase</a></span></dt>
6210:
6211: <dt><span class="sect1"><a href="#build.patch">14.8.
6212: The <span class="emphasis"><em>patch</em></span>
6213: phase</a></span></dt>
6214:
6215: <dt><span class="sect1"><a href="#build.tools">14.9.
6216: The <span class="emphasis"><em>tools</em></span>
6217: phase</a></span></dt>
6218:
6219: <dt><span class="sect1"><a href=
6220: "#build.wrapper">14.10. The <span class=
6221: "emphasis"><em>wrapper</em></span>
6222: phase</a></span></dt>
6223:
6224: <dt><span class="sect1"><a href=
6225: "#build.configure">14.11. The <span class=
6226: "emphasis"><em>configure</em></span>
6227: phase</a></span></dt>
6228:
6229: <dt><span class="sect1"><a href="#build.build">14.12.
6230: The <span class="emphasis"><em>build</em></span>
6231: phase</a></span></dt>
6232:
6233: <dt><span class="sect1"><a href="#build.test">14.13.
6234: The <span class="emphasis"><em>test</em></span>
6235: phase</a></span></dt>
6236:
6237: <dt><span class="sect1"><a href=
6238: "#build.install">14.14. The <span class=
6239: "emphasis"><em>install</em></span>
6240: phase</a></span></dt>
6241:
6242: <dt><span class="sect1"><a href=
6243: "#build.package">14.15. The <span class=
6244: "emphasis"><em>package</em></span>
6245: phase</a></span></dt>
6246:
6247: <dt><span class="sect1"><a href=
6248: "#build.helpful-targets">14.16. Other helpful
1.1 grant 6249: targets</a></span></dt>
6250: </dl>
6251: </dd>
6252:
1.55 rillig 6253: <dt><span class="chapter"><a href="#fixes">15. Making
6254: your package work</a></span></dt>
1.1 grant 6255:
6256: <dd>
6257: <dl>
1.30 wiz 6258: <dt><span class="sect1"><a href=
1.38 dillo 6259: "#general-operation">15.1. General
1.30 wiz 6260: operation</a></span></dt>
1.1 grant 6261:
6262: <dd>
6263: <dl>
6264: <dt><span class="sect2"><a href=
1.38 dillo 6265: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 6266: pull in variables from
6267: /etc/mk.conf</a></span></dt>
1.1 grant 6268:
6269: <dt><span class="sect2"><a href=
1.38 dillo 6270: "#where-to-install-documentation">15.1.2. Where
1.31 wiz 6271: to install documentation</a></span></dt>
6272:
6273: <dt><span class="sect2"><a href=
1.38 dillo 6274: "#restricted-packages">15.1.3. Restricted
1.1 grant 6275: packages</a></span></dt>
6276:
6277: <dt><span class="sect2"><a href=
1.38 dillo 6278: "#dependencies">15.1.4. Handling
1.1 grant 6279: dependencies</a></span></dt>
6280:
6281: <dt><span class="sect2"><a href=
1.38 dillo 6282: "#conflicts">15.1.5. Handling conflicts with
1.1 grant 6283: other packages</a></span></dt>
6284:
6285: <dt><span class="sect2"><a href=
1.38 dillo 6286: "#not-building-packages">15.1.6. Packages that
1.30 wiz 6287: cannot or should not be built</a></span></dt>
1.1 grant 6288:
6289: <dt><span class="sect2"><a href=
1.38 dillo 6290: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 6291: should not be deleted, once
6292: installed</a></span></dt>
1.1 grant 6293:
6294: <dt><span class="sect2"><a href=
1.38 dillo 6295: "#security-handling">15.1.8. Handling packages
1.1 grant 6296: with security problems</a></span></dt>
6297:
6298: <dt><span class="sect2"><a href=
1.38 dillo 6299: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 6300: bugs</a></span></dt>
6301:
6302: <dt><span class="sect2"><a href=
1.38 dillo 6303: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 6304: incrementing versions when fixing an existing
1.1 grant 6305: package</a></span></dt>
6306:
6307: <dt><span class="sect2"><a href=
1.38 dillo 6308: "#portability-of-packages">15.1.11. Portability
1.30 wiz 6309: of packages</a></span></dt>
1.1 grant 6310: </dl>
6311: </dd>
6312:
1.30 wiz 6313: <dt><span class="sect1"><a href=
1.38 dillo 6314: "#downloading-issues">15.2. Possible downloading
1.30 wiz 6315: issues</a></span></dt>
1.1 grant 6316:
6317: <dd>
6318: <dl>
6319: <dt><span class="sect2"><a href=
1.38 dillo 6320: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 6321: distfiles aren't available for plain
1.1 grant 6322: downloading</a></span></dt>
6323:
6324: <dt><span class="sect2"><a href=
1.38 dillo 6325: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 6326: handle modified distfiles with the 'old'
6327: name</a></span></dt>
1.1 grant 6328: </dl>
6329: </dd>
6330:
1.30 wiz 6331: <dt><span class="sect1"><a href=
1.38 dillo 6332: "#configuration-gotchas">15.3. Configuration
1.30 wiz 6333: gotchas</a></span></dt>
1.1 grant 6334:
6335: <dd>
6336: <dl>
6337: <dt><span class="sect2"><a href=
1.38 dillo 6338: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 6339: libtool</a></span></dt>
6340:
6341: <dt><span class="sect2"><a href=
1.38 dillo 6342: "#using-libtool">15.3.2. Using libtool on GNU
1.1 grant 6343: packages that already support
6344: libtool</a></span></dt>
6345:
6346: <dt><span class="sect2"><a href=
1.38 dillo 6347: "#autoconf-automake">15.3.3. GNU
1.1 grant 6348: Autoconf/Automake</a></span></dt>
6349: </dl>
6350: </dd>
6351:
1.55 rillig 6352: <dt><span class="sect1"><a href="#fixes-build">15.4.
6353: Building the package</a></span></dt>
1.1 grant 6354:
6355: <dd>
6356: <dl>
6357: <dt><span class="sect2"><a href=
1.38 dillo 6358: "#cpp-defines">15.4.1. CPP
1.30 wiz 6359: defines</a></span></dt>
1.51 rillig 6360:
6361: <dt><span class="sect2"><a href=
1.60 rillig 6362: "#cpp-list-examples">15.4.2. Examples of CPP
6363: defines for some platforms</a></span></dt>
6364:
6365: <dt><span class="sect2"><a href=
6366: "#cpp-list">15.4.3. Getting a list of CPP
1.51 rillig 6367: defines</a></span></dt>
1.1 grant 6368: </dl>
6369: </dd>
6370:
1.30 wiz 6371: <dt><span class="sect1"><a href=
1.38 dillo 6372: "#package-specific-actions">15.5. Package specific
1.30 wiz 6373: actions</a></span></dt>
1.1 grant 6374:
6375: <dd>
6376: <dl>
6377: <dt><span class="sect2"><a href=
1.38 dillo 6378: "#user-interaction">15.5.1. User
1.2 hubertf 6379: interaction</a></span></dt>
1.1 grant 6380:
6381: <dt><span class="sect2"><a href=
1.38 dillo 6382: "#handling-licenses">15.5.2. Handling
1.1 grant 6383: licenses</a></span></dt>
6384:
6385: <dt><span class="sect2"><a href=
1.38 dillo 6386: "#installing-score-files">15.5.3. Installing
1.30 wiz 6387: score files</a></span></dt>
1.1 grant 6388:
6389: <dt><span class="sect2"><a href=
1.38 dillo 6390: "#perl-scripts">15.5.4. Packages containing perl
1.1 grant 6391: scripts</a></span></dt>
6392:
6393: <dt><span class="sect2"><a href=
1.38 dillo 6394: "#hardcoded-paths">15.5.5. Packages with
1.30 wiz 6395: hardcoded paths to other
6396: interpreters</a></span></dt>
1.1 grant 6397:
6398: <dt><span class="sect2"><a href=
1.38 dillo 6399: "#perl-modules">15.5.6. Packages installing perl
1.1 grant 6400: modules</a></span></dt>
6401:
6402: <dt><span class="sect2"><a href=
1.38 dillo 6403: "#faq.info-files">15.5.7. Packages installing
1.1 grant 6404: info files</a></span></dt>
6405:
6406: <dt><span class="sect2"><a href=
1.57 minskim 6407: "#manpages">15.5.8. Packages installing man
6408: pages</a></span></dt>
6409:
6410: <dt><span class="sect2"><a href=
6411: "#gconf2-data-files">15.5.9. Packages installing
1.30 wiz 6412: GConf2 data files</a></span></dt>
1.1 grant 6413:
6414: <dt><span class="sect2"><a href=
1.57 minskim 6415: "#scrollkeeper-data-files">15.5.10. Packages
1.30 wiz 6416: installing scrollkeeper data
6417: files</a></span></dt>
1.1 grant 6418:
6419: <dt><span class="sect2"><a href=
1.57 minskim 6420: "#x11-fonts">15.5.11. Packages installing X11
1.1 grant 6421: fonts</a></span></dt>
6422:
6423: <dt><span class="sect2"><a href=
1.57 minskim 6424: "#gtk2-modules">15.5.12. Packages installing GTK2
1.1 grant 6425: modules</a></span></dt>
6426:
6427: <dt><span class="sect2"><a href=
1.57 minskim 6428: "#sgml-xml-data">15.5.13. Packages installing
1.30 wiz 6429: SGML or XML data</a></span></dt>
1.1 grant 6430:
6431: <dt><span class="sect2"><a href=
1.57 minskim 6432: "#mime-database">15.5.14. Packages installing
1.1 grant 6433: extensions to the MIME database</a></span></dt>
6434:
6435: <dt><span class="sect2"><a href=
1.57 minskim 6436: "#intltool">15.5.15. Packages using
1.1 grant 6437: intltool</a></span></dt>
1.18 xtraeme 6438:
6439: <dt><span class="sect2"><a href=
1.57 minskim 6440: "#startup-scripts">15.5.16. Packages installing
1.30 wiz 6441: startup scripts</a></span></dt>
1.57 minskim 6442:
6443: <dt><span class="sect2"><a href=
6444: "#tex-packages">15.5.17. Packages installing TeX
6445: modules</a></span></dt>
1.1 grant 6446: </dl>
6447: </dd>
6448:
1.30 wiz 6449: <dt><span class="sect1"><a href=
1.38 dillo 6450: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 6451: author</a></span></dt>
1.1 grant 6452: </dl>
6453: </dd>
6454:
1.38 dillo 6455: <dt><span class="chapter"><a href="#debug">16.
1.1 grant 6456: Debugging</a></span></dt>
6457:
1.38 dillo 6458: <dt><span class="chapter"><a href="#submit">17.
1.1 grant 6459: Submitting and Committing</a></span></dt>
6460:
6461: <dd>
6462: <dl>
1.30 wiz 6463: <dt><span class="sect1"><a href=
1.38 dillo 6464: "#submitting-your-package">17.1. Submitting your
1.30 wiz 6465: packages</a></span></dt>
1.1 grant 6466:
1.30 wiz 6467: <dt><span class="sect1"><a href=
1.41 wiz 6468: "#general-notes-for-changes">17.2. General notes when
6469: adding, updating, or removing
6470: packages</a></span></dt>
6471:
6472: <dt><span class="sect1"><a href=
6473: "#committing-importing">17.3. Committing: Importing a
1.30 wiz 6474: package into CVS</a></span></dt>
1.1 grant 6475:
1.30 wiz 6476: <dt><span class="sect1"><a href=
1.41 wiz 6477: "#updating-package">17.4. Updating a package to a
1.30 wiz 6478: newer version</a></span></dt>
1.1 grant 6479:
1.30 wiz 6480: <dt><span class="sect1"><a href=
1.41 wiz 6481: "#moving-package">17.5. Moving a package in
1.30 wiz 6482: pkgsrc</a></span></dt>
1.1 grant 6483: </dl>
6484: </dd>
6485: </dl>
6486: </div>
6487:
1.63 dillo 6488: <div class="chapter" lang="en">
1.1 grant 6489: <div class="titlepage">
6490: <div>
6491: <div>
1.63 dillo 6492: <h2 class="title"><a name=
1.38 dillo 6493: "components"></a>Chapter 8. Package
1.27 rillig 6494: components - files, directories and contents</h2>
1.25 rillig 6495: </div>
6496: </div>
6497: </div>
6498:
6499: <div class="toc">
6500: <p><b>Table of Contents</b></p>
6501:
6502: <dl>
6503: <dt><span class="sect1"><a href=
1.45 wiz 6504: "#components.Makefile">8.1. <code xmlns=
6505: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6506: "filename">Makefile</code></a></span></dt>
6507:
6508: <dt><span class="sect1"><a href=
1.45 wiz 6509: "#components.distinfo">8.2. <code xmlns=
6510: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6511: "filename">distinfo</code></a></span></dt>
6512:
6513: <dt><span class="sect1"><a href=
1.38 dillo 6514: "#components.patches">8.3. patches/*</a></span></dt>
1.25 rillig 6515:
1.30 wiz 6516: <dt><span class="sect1"><a href=
1.38 dillo 6517: "#other-mandatory-files">8.4. Other mandatory
1.30 wiz 6518: files</a></span></dt>
1.25 rillig 6519:
1.27 rillig 6520: <dt><span class="sect1"><a href=
1.38 dillo 6521: "#components.optional">8.5. Optional
1.27 rillig 6522: files</a></span></dt>
1.25 rillig 6523:
1.38 dillo 6524: <dt><span class="sect1"><a href="#work-dir">8.6.
1.45 wiz 6525: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6526: class="filename">work*</code></a></span></dt>
1.25 rillig 6527:
1.38 dillo 6528: <dt><span class="sect1"><a href="#files-dir">8.7.
1.45 wiz 6529: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6530: class="filename">files/*</code></a></span></dt>
1.25 rillig 6531: </dl>
6532: </div>
6533:
1.27 rillig 6534: <p>Whenever you're preparing a package, there are a number
6535: of files involved which are described in the following
6536: sections.</p>
1.25 rillig 6537:
1.63 dillo 6538: <div class="sect1" lang="en">
1.25 rillig 6539: <div class="titlepage">
6540: <div>
6541: <div>
6542: <h2 class="title" style="clear: both"><a name=
1.45 wiz 6543: "components.Makefile"></a>8.1. <code xmlns=
6544: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6545: "filename">Makefile</code></h2>
1.25 rillig 6546: </div>
6547: </div>
6548: </div>
6549:
1.27 rillig 6550: <p>Building, installation and creation of a binary
1.45 wiz 6551: package are all controlled by the package's <code xmlns=
6552: "http://www.w3.org/TR/xhtml1/transitional" class=
6553: "filename">Makefile</code>. The <code xmlns=
6554: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 6555: "filename">Makefile</code> describes various things about
6556: a package, for example from where to get it, how to
6557: configure, build, and install it.</p>
6558:
1.45 wiz 6559: <p>A package <code xmlns=
6560: "http://www.w3.org/TR/xhtml1/transitional" class=
6561: "filename">Makefile</code> contains several sections that
6562: describe the package.</p>
1.25 rillig 6563:
1.27 rillig 6564: <p>In the first section there are the following
6565: variables, which should appear exactly in the order given
6566: here.</p>
1.25 rillig 6567:
6568: <div class="itemizedlist">
6569: <ul type="disc">
6570: <li>
1.27 rillig 6571: <p><code class="varname">DISTNAME</code> is the
6572: basename of the distribution file to be downloaded
6573: from the package's website.</p>
6574: </li>
6575:
6576: <li>
6577: <p><code class="varname">PKGNAME</code> is the name
6578: of the package, as used by pkgsrc. You only need to
1.50 rillig 6579: provide it if it differs from <code class=
6580: "varname">DISTNAME</code>. Usually it is the
6581: directory name together with the version number. It
6582: must match the regular expression <code class=
1.27 rillig 6583: "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
6584: that is, it starts with a letter or digit, and
6585: contains only letters, digits, dashes, underscores,
6586: dots and plus signs.</p>
1.25 rillig 6587: </li>
6588:
6589: <li>
1.27 rillig 6590: <p><code class="varname">CATEGORIES</code> is a
6591: list of categories which the package fits in. You
6592: can choose any of the top-level directories of
6593: pkgsrc for it.</p>
1.45 wiz 6594:
6595: <p>Currently the following values are available for
6596: <code class="varname">CATEGORIES</code>. If more
6597: than one is used, they need to be separated by
6598: spaces:</p>
6599: <pre class="programlisting">
1.51 rillig 6600: archivers cross geography meta-pkgs security
6601: audio databases graphics misc shells
6602: benchmarks devel ham multimedia sysutils
6603: biology editors inputmethod net textproc
6604: cad emulators lang news time
6605: chat finance mail parallel wm
6606: comms fonts math pkgtools www
6607: converters games mbone print x11
1.45 wiz 6608: </pre>
1.25 rillig 6609: </li>
6610:
6611: <li>
1.27 rillig 6612: <p><code class="varname">MASTER_SITES</code> is a
6613: list of URLs where the distribution files can be
6614: downloaded. Each URL must end with a slash.</p>
1.45 wiz 6615:
6616: <p>The <code class="varname">MASTER_SITES</code>
6617: may make use of the following predefined sites:</p>
6618: <pre class="programlisting">
1.51 rillig 6619: ${MASTER_SITE_APACHE}
6620: ${MASTER_SITE_BACKUP}
6621: ${MASTER_SITE_CYGWIN}
6622: ${MASTER_SITE_DEBIAN}
6623: ${MASTER_SITE_FREEBSD}
6624: ${MASTER_SITE_FREEBSD_LOCAL}
6625: ${MASTER_SITE_GNOME}
6626: ${MASTER_SITE_GNU}
6627: ${MASTER_SITE_GNUSTEP}
6628: ${MASTER_SITE_IFARCHIVE}
6629: ${MASTER_SITE_MOZILLA}
6630: ${MASTER_SITE_OPENOFFICE}
6631: ${MASTER_SITE_PERL_CPAN}
6632: ${MASTER_SITE_R_CRAN}
6633: ${MASTER_SITE_SOURCEFORGE}
6634: ${MASTER_SITE_SUNSITE}
6635: ${MASTER_SITE_SUSE}
6636: ${MASTER_SITE_TEX_CTAN}
6637: ${MASTER_SITE_XCONTRIB}
6638: ${MASTER_SITE_XEMACS}
1.45 wiz 6639: </pre>
6640:
6641: <p>If one of these predefined sites is chosen, you
6642: may want to specify a subdirectory of that site.
6643: Since these macros may expand to more than one
6644: actual site, you <span class=
6645: "emphasis"><em>must</em></span> use the following
6646: construct to specify a subdirectory:</p>
6647: <pre class="programlisting">
1.51 rillig 6648: ${MASTER_SITE_GNU:=subdirectory/name/}
6649: ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.45 wiz 6650: </pre>
6651:
6652: <p>Note the trailing slash after the subdirectory
6653: name.</p>
6654:
6655: <p>If the package has multiple <code class=
6656: "varname">DISTFILES</code> or multiple <code class=
6657: "varname">PATCHFILES</code> from different sites,
6658: set <code class="varname">SITES_foo</code> to a
1.47 reed 6659: list of URIs where file “<span class=
1.45 wiz 6660: "quote">foo</span>” may be found.
6661: “<span class="quote">foo</span>”
1.47 reed 6662: includes the suffix, e.g.:</p>
1.45 wiz 6663: <pre class="programlisting">
1.51 rillig 6664: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
6665: DISTFILES+= foo-file.tar.gz
6666: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
6667: http://www.somewhereelse.com/mirror/somehow/
1.45 wiz 6668: </pre>
6669: </li>
6670:
6671: <li>
6672: <p><code class="varname">DISTFILES</code>: Name(s)
6673: of archive file(s) containing distribution. The
6674: default is <code xmlns=
6675: "http://www.w3.org/TR/xhtml1/transitional" class=
6676: "filename">${DISTNAME}${EXTRACT_SUFX}</code>.
6677: Should only be set if you have more than one
6678: distfile.</p>
6679:
6680: <p>Note that the normal default setting of
6681: <code class="varname">DISTFILES</code> must be made
6682: explicit if you want to add to it (rather than
6683: replace it), as you usually would.</p>
6684: </li>
6685:
6686: <li>
6687: <p><code class="varname">EXTRACT_SUFX</code>:
6688: Suffix of the distribution file, will be appended
6689: to <code class="varname">DISTNAME</code>. Defaults
6690: to <code xmlns=
6691: "http://www.w3.org/TR/xhtml1/transitional" class=
6692: "filename">.tar.gz</code>.</p>
6693: </li>
6694: </ul>
6695: </div>
6696:
6697: <p>The second section contains information about
6698: separately downloaded patches, if any.</p>
6699:
6700: <div class="itemizedlist">
6701: <ul type="disc">
6702: <li>
1.47 reed 6703: <p><code class="varname">PATCHFILES:</code> Name(s)
1.45 wiz 6704: of additional files that contain distribution
6705: patches. There is no default. pkgsrc will look for
6706: them at <code class="varname">PATCH_SITES</code>.
6707: They will automatically be uncompressed before
6708: patching if the names end with <code xmlns=
6709: "http://www.w3.org/TR/xhtml1/transitional" class=
6710: "filename">.gz</code> or <code xmlns=
6711: "http://www.w3.org/TR/xhtml1/transitional" class=
6712: "filename">.Z</code>.</p>
6713: </li>
6714:
6715: <li>
6716: <p><code class="varname">PATCH_SITES</code>:
6717: Primary location(s) for distribution patch files
6718: (see <code class="varname">PATCHFILES</code> below)
6719: if not found locally.</p>
1.25 rillig 6720: </li>
6721: </ul>
6722: </div>
6723:
1.45 wiz 6724: <p>The third section contains the following
1.27 rillig 6725: variables.</p>
1.25 rillig 6726:
1.27 rillig 6727: <div class="itemizedlist">
6728: <ul type="disc">
6729: <li>
6730: <p><code class="varname">MAINTAINER</code> is the
1.50 rillig 6731: email address of the person who feels responsible
6732: for this package, and who is most likely to look at
6733: problems or questions regarding this package which
6734: have been reported with <a href=
1.45 wiz 6735: "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
6736: <span class="citerefentry"><span class=
1.50 rillig 6737: "refentrytitle">send-pr</span>(1)</span></a>. Other
6738: developers should contact the <code class=
6739: "varname">MAINTAINER</code> before making major
6740: changes to the package. When packaging a new
6741: program, set <code class=
6742: "varname">MAINTAINER</code> to yourself. If you
6743: really can't maintain the package for future
6744: updates, set it to <code class="email"><<a href=
1.45 wiz 6745: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></code>.</p>
1.27 rillig 6746: </li>
1.25 rillig 6747:
1.27 rillig 6748: <li>
6749: <p><code class="varname">HOMEPAGE</code> is a URL
6750: where users can find more information about the
1.23 wiz 6751: package.</p>
6752: </li>
1.1 grant 6753:
1.23 wiz 6754: <li>
6755: <p><code class="varname">COMMENT</code> is a
1.45 wiz 6756: one-line description of the package (should not
6757: include the package name).</p>
1.23 wiz 6758: </li>
6759: </ul>
6760: </div>
1.1 grant 6761:
1.45 wiz 6762: <p>Other variables that affect the build:</p>
1.1 grant 6763:
1.45 wiz 6764: <div class="itemizedlist">
6765: <ul type="disc">
6766: <li>
6767: <p><code class="varname">WRKSRC</code>: The
1.50 rillig 6768: directory where the interesting distribution files
6769: of the package are found. The default is
6770: <code xmlns=
6771: "http://www.w3.org/TR/xhtml1/transitional" class=
6772: "filename">${WRKDIR}/${DISTNAME}</code>, which
6773: works for most packages.</p>
6774:
6775: <p>If a package doesn't create a subdirectory for
6776: itself (most GNU software does, for instance), but
6777: extracts itself in the current directory, you
6778: should set <code class="varname">WRKSRC=
6779: ${WRKDIR}</code>.</p>
6780:
6781: <p>If a package doesn't create a subdirectory with
6782: the name of <code class="varname">DISTNAME</code>
6783: but some different name, set <code class=
6784: "varname">WRKSRC</code> to point to the proper name
6785: in <code xmlns=
6786: "http://www.w3.org/TR/xhtml1/transitional" class=
6787: "filename">${WRKDIR}</code>, for example
6788: <code class="varname">WRKSRC=
6789: ${WRKDIR}/${DISTNAME}/unix</code>. See <a xmlns=
6790: "http://www.w3.org/TR/xhtml1/transitional" href=
6791: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
6792: target="_top"><code xmlns="" class=
6793: "filename">lang/tcl</code></a> and <a xmlns=
6794: "http://www.w3.org/TR/xhtml1/transitional" href=
6795: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
6796: target="_top"><code xmlns="" class=
6797: "filename">x11/tk</code></a> for other
6798: examples.</p>
6799:
6800: <p>The name of the working directory created by
6801: pkgsrc is taken from the <code class=
6802: "varname">WRKDIR_BASENAME</code> variable. By
6803: default, its value is <code xmlns=
6804: "http://www.w3.org/TR/xhtml1/transitional" class=
6805: "filename">work</code>. If you want to use the same
6806: pkgsrc tree for building different kinds of binary
6807: packages, you can change the variable according to
6808: your needs. Two other variables handle common cases
6809: of setting <code class=
6810: "varname">WRKDIR_BASENAME</code> individually. If
6811: <code class="varname">OBJHOSTNAME</code> is defined
6812: in <code xmlns=
1.45 wiz 6813: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 6814: "filename">/etc/mk.conf</code>, the first component
6815: of the host's name is attached to the directory
6816: name. If <code class="varname">OBJMACHINE</code> is
6817: defined, the platform name is attached, which might
6818: look like <code xmlns=
6819: "http://www.w3.org/TR/xhtml1/transitional" class=
6820: "filename">work.i386</code> or <code xmlns=
1.45 wiz 6821: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 6822: "filename">work.sparc</code>.</p>
1.45 wiz 6823: </li>
6824: </ul>
1.1 grant 6825: </div>
6826:
6827: <p>Please pay attention to the following gotchas:</p>
6828:
6829: <div class="itemizedlist">
6830: <ul type="disc">
6831: <li>
1.14 xtraeme 6832: <p>Add <code class="varname">MANCOMPRESSED</code>
1.47 reed 6833: if man pages are installed in compressed form by
6834: the package; see comment in <code xmlns=
1.45 wiz 6835: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6836: "filename">bsd.pkg.mk</code>.</p>
1.1 grant 6837: </li>
6838:
6839: <li>
1.45 wiz 6840: <p>Replace <code xmlns=
6841: "http://www.w3.org/TR/xhtml1/transitional" class=
6842: "filename">/usr/local</code> with
6843: “<span class="quote">${PREFIX}</span>”
6844: in all files (see patches, below).</p>
1.1 grant 6845: </li>
6846:
6847: <li>
6848: <p>If the package installs any info files, see
6849: <a href="#faq.info-files" title=
1.45 wiz 6850: "15.5.7. Packages installing info files">Section 15.5.7,
6851: “Packages installing info
1.1 grant 6852: files”</a>.</p>
6853: </li>
6854: </ul>
6855: </div>
6856: </div>
6857:
1.63 dillo 6858: <div class="sect1" lang="en">
1.1 grant 6859: <div class="titlepage">
6860: <div>
6861: <div>
6862: <h2 class="title" style="clear: both"><a name=
1.45 wiz 6863: "components.distinfo"></a>8.2. <code xmlns=
6864: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 6865: "filename">distinfo</code></h2>
1.1 grant 6866: </div>
6867: </div>
6868: </div>
6869:
1.50 rillig 6870: <p>The <code xmlns=
6871: "http://www.w3.org/TR/xhtml1/transitional" class=
6872: "filename">distinfo</code> file contains the message
6873: digest, or checksum, of each distfile needed for the
6874: package. This ensures that the distfiles retrieved from
6875: the Internet have not been corrupted during transfer or
6876: altered by a malign force to introduce a security hole.
6877: Due to recent rumor about weaknesses of digest
6878: algorithms, all distfiles are protected using both SHA1
6879: and RMD160 message digests, as well as the file size.</p>
6880:
6881: <p>The <code xmlns=
6882: "http://www.w3.org/TR/xhtml1/transitional" class=
6883: "filename">distinfo</code> file also contains the
6884: checksums for all the patches found in the <code xmlns=
6885: "http://www.w3.org/TR/xhtml1/transitional" class=
6886: "filename">patches</code> directory (see <a href=
6887: "#components.patches" title=
6888: "8.3. patches/*">Section 8.3,
6889: “patches/*”</a>).</p>
6890:
6891: <p>To regenerate the <code xmlns=
6892: "http://www.w3.org/TR/xhtml1/transitional" class=
6893: "filename">distinfo</code> file, use the
1.14 xtraeme 6894: <span><strong class="command">make
1.50 rillig 6895: makedistinfo</strong></span> or <span><strong class=
6896: "command">make mdi</strong></span> command.</p>
1.1 grant 6897:
1.50 rillig 6898: <p>Some packages have different sets of distfiles
6899: depending on the platform, for example <a xmlns=
1.1 grant 6900: "http://www.w3.org/TR/xhtml1/transitional" href=
6901: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.45 wiz 6902: target="_top"><code xmlns="" class=
6903: "filename">www/navigator</code></a>). These are kept in
1.50 rillig 6904: the same <code xmlns=
1.45 wiz 6905: "http://www.w3.org/TR/xhtml1/transitional" class=
1.50 rillig 6906: "filename">distinfo</code> file and care should be taken
6907: when upgrading such a package to ensure distfile
6908: information is not lost.</p>
1.1 grant 6909: </div>
6910:
1.63 dillo 6911: <div class="sect1" lang="en">
1.1 grant 6912: <div class="titlepage">
6913: <div>
6914: <div>
6915: <h2 class="title" style="clear: both"><a name=
1.38 dillo 6916: "components.patches"></a>8.3. patches/*</h2>
1.1 grant 6917: </div>
6918: </div>
6919: </div>
6920:
6921: <p>This directory contains files that are used by the
6922: <a href=
6923: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
6924: <span class="citerefentry"><span class=
6925: "refentrytitle">patch</span>(1)</span></a> command to
6926: modify the sources as distributed in the distribution
6927: file into a form that will compile and run perfectly on
6928: NetBSD. The files are applied successively in alphabetic
6929: order (as returned by a shell “<span class=
6930: "quote">patches/patch-*</span>” glob expansion), so
1.45 wiz 6931: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6932: class="filename">patch-aa</code> is applied before
6933: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6934: class="filename">patch-ab</code>, etc.</p>
6935:
6936: <p>The <code xmlns=
6937: "http://www.w3.org/TR/xhtml1/transitional" class=
6938: "filename">patch-*</code> files should be in
6939: <span><strong class="command">diff -bu</strong></span>
6940: format, and apply without a fuzz to avoid problems. (To
6941: force patches to apply with fuzz you can set <code class=
1.14 xtraeme 6942: "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1 grant 6943: not put changes for more than one file into a single
1.47 reed 6944: patch file, as this will make future modifications more
1.1 grant 6945: difficult.</p>
6946:
6947: <p>Similar, a file should be patched at most once, not
6948: several times by several different patches. If a file
6949: needs several patches, they should be combined into one
6950: file.</p>
6951:
6952: <p>One important thing to mention is to pay attention
6953: that no RCS IDs get stored in the patch files, as these
6954: will cause problems when later checked into the NetBSD
1.14 xtraeme 6955: CVS tree. Use the <span><strong class=
6956: "command">pkgdiff</strong></span> from the <a xmlns=
1.1 grant 6957: "http://www.w3.org/TR/xhtml1/transitional" href=
6958: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 6959: target="_top"><code xmlns="" class=
6960: "filename">pkgtools/pkgdiff</code></a> package to avoid
1.20 ben 6961: these problems.</p>
1.1 grant 6962:
6963: <p>For even more automation, we recommend using
1.14 xtraeme 6964: <span><strong class="command">mkpatches</strong></span>
6965: from the same package to make a whole set of patches. You
6966: just have to backup files before you edit them to
1.45 wiz 6967: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6968: class="filename">filename.orig</code>, e.g. with
1.14 xtraeme 6969: <span><strong class="command">cp -p filename
6970: filename.orig</strong></span> or, easier, by using
6971: <span><strong class="command">pkgvi</strong></span> again
6972: from the same package. If you upgrade a package this way,
6973: you can easily compare the new set of patches with the
6974: previously existing one with <span><strong class=
6975: "command">patchdiff</strong></span>.</p>
1.1 grant 6976:
6977: <p>When you have finished a package, remember to generate
6978: the checksums for the patch files by using the
1.14 xtraeme 6979: <span><strong class="command">make
6980: makepatchsum</strong></span> command, see <a href=
6981: "#components.distinfo" title=
1.38 dillo 6982: "8.2. distinfo">Section 8.2,
1.45 wiz 6983: “<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
6984: class="filename">distinfo</code>”</a>.</p>
1.1 grant 6985:
1.46 gdt 6986: <p>When adding a patch that corrects a problem in the
6987: distfile (rather than e.g. enforcing pkgsrc's view of
6988: where man pages should go), send the patch as a bug
6989: report to the maintainer. This benefits non-pkgsrc users
6990: of the package, and usually enables removing the patch in
6991: future version.</p>
6992:
1.1 grant 6993: <p>Patch files that are distributed by the author or
1.14 xtraeme 6994: other maintainers can be listed in <code class=
6995: "varname">$PATCHFILES</code>.</p>
1.1 grant 6996:
6997: <p>If it is desired to store any patches that should not
6998: be committed into pkgsrc, they can be kept outside the
1.45 wiz 6999: pkgsrc tree in the <code xmlns=
7000: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7001: "filename">$LOCALPATCHES</code> directory. The directory
1.1 grant 7002: tree there is expected to have the same
7003: “<span class="quote">category/package</span>”
7004: structure as pkgsrc, and patches are expected to be
1.45 wiz 7005: stored inside these dirs (also known as <code xmlns=
7006: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 7007: "filename">$LOCALPATCHES/$PKGPATH</code>). For example,
7008: if you want to keep a private patch for <code xmlns=
1.45 wiz 7009: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7010: "filename">pkgsrc/graphics/png</code>, keep it in
1.45 wiz 7011: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7012: class=
1.14 xtraeme 7013: "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
7014: files in the named directory are expected to be patch
1.1 grant 7015: files, and <span class="emphasis"><em>they are applied
7016: after pkgsrc patches are applied</em></span>.</p>
1.27 rillig 7017: </div>
7018:
1.63 dillo 7019: <div class="sect1" lang="en">
1.27 rillig 7020: <div class="titlepage">
7021: <div>
7022: <div>
7023: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7024: "other-mandatory-files"></a>8.4. Other
1.27 rillig 7025: mandatory files</h2>
7026: </div>
7027: </div>
7028: </div>
7029:
7030: <div class="variablelist">
7031: <dl>
1.45 wiz 7032: <dt><span class="term"><code xmlns=
7033: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7034: "filename">DESCR</code></span></dt>
7035:
7036: <dd>
7037: <p>A multi-line description of the piece of
7038: software. This should include any credits where
7039: they are due. Please bear in mind that others do
7040: not share your sense of humour (or spelling
7041: idiosyncrasies), and that others will read
7042: everything that you write here.</p>
7043: </dd>
7044:
1.45 wiz 7045: <dt><span class="term"><code xmlns=
7046: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7047: "filename">PLIST</code></span></dt>
7048:
7049: <dd>
7050: <p>This file governs the files that are installed
7051: on your system: all the binaries, manual pages,
7052: etc. There are other directives which may be
7053: entered in this file, to control the creation and
7054: deletion of directories, and the location of
7055: inserted files. See <a href="#plist" title=
1.38 dillo 7056: "Chapter 10. PLIST issues">Chapter 10,
1.27 rillig 7057: <i>PLIST issues</i></a> for more information.</p>
7058: </dd>
7059: </dl>
7060: </div>
7061: </div>
7062:
1.63 dillo 7063: <div class="sect1" lang="en">
1.27 rillig 7064: <div class="titlepage">
7065: <div>
7066: <div>
7067: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7068: "components.optional"></a>8.5. Optional
1.27 rillig 7069: files</h2>
7070: </div>
7071: </div>
7072: </div>
7073:
7074: <div class="variablelist">
7075: <dl>
1.45 wiz 7076: <dt><span class="term"><code xmlns=
7077: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7078: "filename">INSTALL</code></span></dt>
7079:
7080: <dd>
7081: <p>This shell script is invoked twice by <a href=
7082: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7083: <span class="citerefentry"><span class=
7084: "refentrytitle">pkg_add</span>(1)</span></a>. First
7085: time after package extraction and before files are
7086: moved in place, the second time after the files to
7087: install are moved in place. This can be used to do
7088: any custom procedures not possible with @exec
1.45 wiz 7089: commands in <code xmlns=
7090: "http://www.w3.org/TR/xhtml1/transitional" class=
7091: "filename">PLIST</code>. See <a href=
1.27 rillig 7092: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
7093: <span class="citerefentry"><span class=
7094: "refentrytitle">pkg_add</span>(1)</span></a> and
7095: <a href=
7096: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
7097: <span class="citerefentry"><span class=
7098: "refentrytitle">pkg_create</span>(1)</span></a> for
7099: more information.</p>
7100: </dd>
7101:
1.45 wiz 7102: <dt><span class="term"><code xmlns=
7103: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7104: "filename">DEINSTALL</code></span></dt>
7105:
7106: <dd>
7107: <p>This script is executed before and after any
7108: files are removed. It is this script's
7109: responsibility to clean up any additional messy
7110: details around the package's installation, since
7111: all pkg_delete knows is how to delete the files
7112: created in the original distribution. See <a href=
7113: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
7114: <span class="citerefentry"><span class=
7115: "refentrytitle">pkg_delete</span>(1)</span></a> and
7116: <a href=
7117: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
7118: <span class="citerefentry"><span class=
7119: "refentrytitle">pkg_create</span>(1)</span></a> for
7120: more information.</p>
7121: </dd>
7122:
1.45 wiz 7123: <dt><span class="term"><code xmlns=
7124: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7125: "filename">MESSAGE</code></span></dt>
7126:
7127: <dd>
1.50 rillig 7128: <p>This file is displayed after installation of the
1.27 rillig 7129: package. Useful for things like legal notices on
7130: almost-free software and hints for updating config
7131: files after installing modules for apache, PHP etc.
7132: Please note that you can modify variables in it
7133: easily by using <code class=
7134: "varname">MESSAGE_SUBST</code> in the package's
1.45 wiz 7135: <code xmlns=
7136: "http://www.w3.org/TR/xhtml1/transitional" class=
7137: "filename">Makefile</code>:</p>
1.27 rillig 7138: <pre class="programlisting">
1.51 rillig 7139: MESSAGE_SUBST+= SOMEVAR="somevalue"
1.27 rillig 7140: </pre>
7141:
7142: <p>replaces "${SOMEVAR}" with “<span class=
1.45 wiz 7143: "quote">somevalue</span>” in <code xmlns=
7144: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7145: "filename">MESSAGE</code>.</p>
7146: </dd>
7147: </dl>
7148: </div>
7149: </div>
7150:
1.63 dillo 7151: <div class="sect1" lang="en">
1.27 rillig 7152: <div class="titlepage">
7153: <div>
7154: <div>
7155: <h2 class="title" style="clear: both"><a name=
1.63 dillo 7156: "work-dir"></a>8.6. <code xmlns=
1.45 wiz 7157: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7158: "filename">work*</code></h2>
7159: </div>
7160: </div>
7161: </div>
7162:
7163: <p>When you type <span><strong class=
1.47 reed 7164: "command">make</strong></span>, the distribution files
7165: are unpacked into the directory denoted by <code class=
1.45 wiz 7166: "varname">WRKDIR</code>. It can be removed by running
7167: <span><strong class="command">make clean</strong></span>.
7168: Besides the sources, this directory is also used to keep
7169: various timestamp files. The directory gets <span class=
7170: "emphasis"><em>removed completely</em></span> on clean.
7171: The default is <code xmlns=
7172: "http://www.w3.org/TR/xhtml1/transitional" class=
7173: "filename">${.CURDIR}/work</code> or <code xmlns=
7174: "http://www.w3.org/TR/xhtml1/transitional" class=
7175: "filename">${.CURDIR}/work.${MACHINE_ARCH}</code> if
7176: <code class="varname">OBJMACHINE</code> is set.</p>
1.27 rillig 7177: </div>
7178:
1.63 dillo 7179: <div class="sect1" lang="en">
1.27 rillig 7180: <div class="titlepage">
7181: <div>
7182: <div>
7183: <h2 class="title" style="clear: both"><a name=
1.45 wiz 7184: "files-dir"></a>8.7. <code xmlns=
7185: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7186: "filename">files/*</code></h2>
7187: </div>
7188: </div>
7189: </div>
7190:
7191: <p>If you have any files that you wish to be placed in
7192: the package prior to configuration or building, you could
7193: place these files here and use a “<span class=
7194: "quote">${CP}</span>” command in the
7195: “<span class="quote">pre-configure</span>”
7196: target to achieve this. Alternatively, you could simply
1.45 wiz 7197: diff the file against <code xmlns=
7198: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7199: "filename">/dev/null</code> and use the patch mechanism
7200: to manage the creation of this file.</p>
7201: </div>
7202: </div>
7203:
1.63 dillo 7204: <div class="chapter" lang="en">
1.27 rillig 7205: <div class="titlepage">
7206: <div>
7207: <div>
1.63 dillo 7208: <h2 class="title"><a name=
1.38 dillo 7209: "makefile"></a>Chapter 9. Programming in
1.45 wiz 7210: <code xmlns=
7211: "http://www.w3.org/TR/xhtml1/transitional" class=
7212: "filename">Makefile</code>s</h2>
1.27 rillig 7213: </div>
7214: </div>
7215: </div>
7216:
7217: <div class="toc">
7218: <p><b>Table of Contents</b></p>
7219:
7220: <dl>
7221: <dt><span class="sect1"><a href=
1.45 wiz 7222: "#makefile.variables">9.1. <code xmlns=
7223: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7224: "filename">Makefile</code> variables</a></span></dt>
7225:
7226: <dd>
7227: <dl>
7228: <dt><span class="sect2"><a href=
1.38 dillo 7229: "#makefile.variables.names">9.1.1. Naming
1.27 rillig 7230: conventions</a></span></dt>
7231: </dl>
7232: </dd>
7233:
1.38 dillo 7234: <dt><span class="sect1"><a href="#makefile.code">9.2.
1.27 rillig 7235: Code snippets</a></span></dt>
7236:
7237: <dd>
7238: <dl>
1.30 wiz 7239: <dt><span class="sect2"><a href=
1.38 dillo 7240: "#adding-to-list">9.2.1. Adding things to a
1.30 wiz 7241: list</a></span></dt>
1.27 rillig 7242:
1.30 wiz 7243: <dt><span class="sect2"><a href=
1.38 dillo 7244: "#converting-internal-to-external">9.2.2.
1.27 rillig 7245: Converting an internal list into an external
7246: list</a></span></dt>
7247:
1.30 wiz 7248: <dt><span class="sect2"><a href=
1.38 dillo 7249: "#passing-variable-to-shell">9.2.3. Passing
1.30 wiz 7250: variables to a shell command</a></span></dt>
1.27 rillig 7251:
1.30 wiz 7252: <dt><span class="sect2"><a href=
1.38 dillo 7253: "#quoting-guideline">9.2.4. Quoting
1.30 wiz 7254: guideline</a></span></dt>
1.27 rillig 7255:
1.30 wiz 7256: <dt><span class="sect2"><a href=
1.38 dillo 7257: "#bsd-make-bug-workaround">9.2.5. Workaround for a
1.30 wiz 7258: bug in BSD Make</a></span></dt>
1.27 rillig 7259: </dl>
7260: </dd>
7261: </dl>
7262: </div>
7263:
1.45 wiz 7264: <p>Pkgsrc consists of many <code xmlns=
7265: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7266: "filename">Makefile</code> fragments, each of which forms a
7267: well-defined part of the pkgsrc system. Using the <a href=
7268: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7269: <span class="citerefentry"><span class=
7270: "refentrytitle">make</span>(1)</span></a> system as a
7271: programming language for a big system like pkgsrc requires
7272: some discipline to keep the code correct and
7273: understandable.</p>
7274:
1.45 wiz 7275: <p>The basic ingredients for <code xmlns=
7276: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7277: "filename">Makefile</code> programming are variables (which
7278: are actually macros) and shell commands. Among these shell
7279: commands may even be more complex ones like <a href=
7280: "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
7281: <span class="citerefentry"><span class=
7282: "refentrytitle">awk</span>(1)</span></a> programs. To make
7283: sure that every shell command runs as intended it is
7284: necessary to quote all variables correctly when they are
7285: used.</p>
7286:
7287: <p>This chapter describes some patterns, that appear quite
1.45 wiz 7288: often in <code xmlns=
7289: "http://www.w3.org/TR/xhtml1/transitional" class=
7290: "filename">Makefile</code>s, including the pitfalls that
7291: come along with them.</p>
1.27 rillig 7292:
1.63 dillo 7293: <div class="sect1" lang="en">
1.27 rillig 7294: <div class="titlepage">
7295: <div>
7296: <div>
7297: <h2 class="title" style="clear: both"><a name=
1.45 wiz 7298: "makefile.variables"></a>9.1. <code xmlns=
7299: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7300: "filename">Makefile</code> variables</h2>
7301: </div>
7302: </div>
7303: </div>
7304:
1.45 wiz 7305: <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7306: class="filename">Makefile</code> variables contain
7307: strings that can be processed using the five operators
7308: ``='', ``+='', ``?='', ``:='', and ``!='', which are
7309: described in the <a href=
1.27 rillig 7310: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7311: <span class="citerefentry"><span class=
7312: "refentrytitle">make</span>(1)</span></a> man page.</p>
7313:
1.45 wiz 7314: <p>When a variable's value is parsed from a <code xmlns=
7315: "http://www.w3.org/TR/xhtml1/transitional" class=
1.27 rillig 7316: "filename">Makefile</code>, the hash character ``#'' and
7317: the backslash character ``\'' are handled specially. If a
7318: backslash is followed by a newline, any whitespace
7319: immediately in front of the backslash, the backslash, the
7320: newline, and any whitespace immediately behind the
7321: newline are replaced with a single space. A backspace
7322: character and an immediately following hash character are
1.47 reed 7323: replaced with a single hash character. Otherwise, the
1.27 rillig 7324: backslash is passed as is. In a variable assignment, any
7325: hash character that is not preceded by a backslash starts
7326: a comment that continues upto the end of the logical
7327: line.</p>
7328:
7329: <p><span class="emphasis"><em>Note:</em></span> Because
7330: of this parsing algorithm the only way to create a
7331: variable consisting of a single backslash is using the
7332: ``!='' operator, for example: <code class=
7333: "varname">BACKSLASH!=echo "\\"</code>.</p>
7334:
7335: <p>So far for defining variables. The other thing you can
7336: do with variables is evaluating them. A variable is
7337: evaluated when it is part of the right side of the ``:=''
7338: or the ``!='' operator, or directly before executing a
7339: shell command which the variable is part of. In all other
1.47 reed 7340: cases, <a href=
1.27 rillig 7341: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7342: <span class="citerefentry"><span class=
7343: "refentrytitle">make</span>(1)</span></a> performs lazy
7344: evaluation, that is, variables are not evaluated until
7345: there's no other way. The ``modifiers'' mentioned in the
7346: man page also evaluate the variable.</p>
7347:
7348: <p>Some of the modifiers split the string into words and
7349: then operate on the words, others operate on the string
1.47 reed 7350: as a whole. When a string is split into words, it is
7351: split as you would expect it from <a href=
1.27 rillig 7352: "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
7353: <span class="citerefentry"><span class=
7354: "refentrytitle">sh</span>(1)</span></a>.</p>
7355:
7356: <p>No rule without exception—the
7357: <span><strong class="command">.for</strong></span> loop
7358: does not follow the shell quoting rules but splits at
7359: sequences of whitespace.</p>
7360:
7361: <p>There are several types of variables that should be
7362: handled differently. Strings and two types of lists.</p>
7363:
7364: <div class="itemizedlist">
7365: <ul type="disc">
7366: <li>
7367: <p><span class="emphasis"><em>Strings</em></span>
1.47 reed 7368: can contain arbitrary characters. Nevertheless, you
1.27 rillig 7369: should restrict yourself to only using printable
7370: characters. Examples are <code class=
7371: "varname">PREFIX</code> and <code class=
7372: "varname">COMMENT</code>.</p>
7373: </li>
7374:
7375: <li>
7376: <p><span class="emphasis"><em>Internal
7377: lists</em></span> are lists that are never exported
7378: to any shell command. Their elements are separated
1.47 reed 7379: by whitespace. Therefore, the elements themselves
1.27 rillig 7380: cannot have embedded whitespace. Any other
7381: characters are allowed. Internal lists can be used
7382: in <span><strong class=
7383: "command">.for</strong></span> loops. Examples are
7384: <code class="varname">DEPENDS</code> and
7385: <code class="varname">BUILD_DEPENDS</code>.</p>
7386: </li>
7387:
7388: <li>
7389: <p><span class="emphasis"><em>External
7390: lists</em></span> are lists that may be exported to
7391: a shell command. Their elements can contain any
7392: characters, including whitespace. That's why they
7393: cannot be used in <span><strong class=
7394: "command">.for</strong></span> loops. Examples are
7395: <code class="varname">DISTFILES</code> and
7396: <code class="varname">MASTER_SITES</code>.</p>
7397: </li>
7398: </ul>
7399: </div>
7400:
1.63 dillo 7401: <div class="sect2" lang="en">
1.27 rillig 7402: <div class="titlepage">
7403: <div>
7404: <div>
7405: <h3 class="title"><a name=
1.38 dillo 7406: "makefile.variables.names"></a>9.1.1. Naming
1.27 rillig 7407: conventions</h3>
7408: </div>
7409: </div>
7410: </div>
7411:
7412: <div class="itemizedlist">
7413: <ul type="disc">
7414: <li>
7415: <p>All variable names starting with an underscore
7416: are reserved for use by the pkgsrc
7417: infrastructure. They shall not be used by package
1.45 wiz 7418: <code xmlns=
7419: "http://www.w3.org/TR/xhtml1/transitional" class=
7420: "filename">Makefile</code>s.</p>
1.27 rillig 7421: </li>
7422:
7423: <li>
7424: <p>In <span><strong class=
7425: "command">.for</strong></span> loops you should
7426: use lowercase variable names for the iteration
7427: variables.</p>
7428: </li>
7429:
7430: <li>
7431: <p>All list variables should have a ``plural''
7432: name, e.g. <code class=
7433: "varname">PKG_OPTIONS</code> or <code class=
7434: "varname">DISTFILES</code>.</p>
7435: </li>
7436: </ul>
7437: </div>
7438: </div>
7439: </div>
7440:
1.63 dillo 7441: <div class="sect1" lang="en">
1.27 rillig 7442: <div class="titlepage">
7443: <div>
7444: <div>
7445: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7446: "makefile.code"></a>9.2. Code snippets</h2>
1.27 rillig 7447: </div>
7448: </div>
7449: </div>
7450:
7451: <p>This section presents you with some code snippets you
7452: should use in your own code. If you don't find anything
7453: appropriate here, you should test your code and add it
7454: here.</p>
7455:
1.63 dillo 7456: <div class="sect2" lang="en">
1.27 rillig 7457: <div class="titlepage">
7458: <div>
7459: <div>
1.63 dillo 7460: <h3 class="title"><a name=
1.38 dillo 7461: "adding-to-list"></a>9.2.1. Adding things to
1.30 wiz 7462: a list</h3>
1.27 rillig 7463: </div>
7464: </div>
7465: </div>
7466: <pre class="programlisting">
1.51 rillig 7467: STRING= foo * bar `date`
7468: INT_LIST= # empty
7469: ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache
7470: EXT_LIST= # empty
7471: ANOTHER_EXT_LIST= a=b c=d
7472:
7473: INT_LIST+= ${STRING} # 1
7474: INT_LIST+= ${ANOTHER_INT_LIST} # 2
7475: EXT_LIST+= ${STRING:Q} # 3
7476: EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
1.27 rillig 7477: </pre>
7478:
7479: <p>When you add a string to an external list (example
7480: 3), it must be quoted. In all other cases, you must not
7481: add a quoting level. You must not merge internal and
7482: external lists, unless you are sure that all entries
7483: are correctly interpreted in both lists.</p>
7484: </div>
7485:
1.63 dillo 7486: <div class="sect2" lang="en">
1.27 rillig 7487: <div class="titlepage">
7488: <div>
7489: <div>
1.30 wiz 7490: <h3 class="title"><a name=
1.38 dillo 7491: "converting-internal-to-external"></a>9.2.2. Converting
1.30 wiz 7492: an internal list into an external list</h3>
1.27 rillig 7493: </div>
7494: </div>
7495: </div>
7496: <pre class="programlisting">
1.51 rillig 7497: EXT_LIST= # empty
7498: .for i in ${INT_LIST}
7499: EXT_LIST+= ${i:Q}""
7500: .endfor
1.27 rillig 7501: </pre>
7502:
7503: <p>This code converts the internal list <code class=
7504: "varname">INT_LIST</code> into the external list
7505: <code class="varname">EXT_LIST</code>. As the elements
7506: of an internal list are unquoted they must be quoted
7507: here. The reason for appending <code class=
7508: "varname">""</code> is explained below.</p>
7509: </div>
1.1 grant 7510:
1.63 dillo 7511: <div class="sect2" lang="en">
1.27 rillig 7512: <div class="titlepage">
1.1 grant 7513: <div>
1.27 rillig 7514: <div>
1.30 wiz 7515: <h3 class="title"><a name=
1.38 dillo 7516: "passing-variable-to-shell"></a>9.2.3. Passing
1.30 wiz 7517: variables to a shell command</h3>
1.27 rillig 7518: </div>
1.1 grant 7519: </div>
7520: </div>
1.27 rillig 7521: <pre class="programlisting">
1.51 rillig 7522: STRING= foo bar < > * `date` $$HOME ' "
7523: EXT_LIST= string=${STRING:Q} x=second\ item
1.27 rillig 7524:
1.51 rillig 7525: all:
7526: echo ${STRING} # 1
7527: echo "${STRING}" # 2
7528: echo "${STRING:Q}" # 3
7529: echo ${STRING:Q} # 4
7530: echo x${STRING:Q} | sed 1s,.,, # 5
7531: env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
1.27 rillig 7532: </pre>
7533:
7534: <p>Example 1 leads to a syntax error in the shell, as
7535: the characters are just copied.</p>
7536:
7537: <p>Example 2 leads to a syntax error too, and if you
7538: leave out the last " character from <code class=
7539: "varname">${STRING}</code>, <a href=
7540: "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
7541: <span class="citerefentry"><span class=
7542: "refentrytitle">date</span>(1)</span></a> will be
7543: executed. The <code class="varname">$HOME</code> shell
7544: variable would be evaluated, too.</p>
7545:
7546: <p>Example 3 outputs each space character preceded by a
7547: backslash (or not), depending on the implementation of
7548: the <a href=
7549: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7550: <span class="citerefentry"><span class=
7551: "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1 grant 7552:
1.27 rillig 7553: <p>Example 4 handles correctly every string that does
7554: not start with a dash. In that case, the result depends
7555: on the implementation of the <a href=
7556: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7557: <span class="citerefentry"><span class=
7558: "refentrytitle">echo</span>(1)</span></a> command. As
7559: long as you can guarantee that your input does not
1.47 reed 7560: start with a dash, this form is appropriate.</p>
1.1 grant 7561:
1.27 rillig 7562: <p>Example 5 handles even the case of a leading dash
7563: correctly.</p>
1.1 grant 7564:
1.27 rillig 7565: <p>The <code class="varname">EXT_LIST</code> does not
1.47 reed 7566: need to be quoted because the quoting has already been
1.27 rillig 7567: done when adding elements to the list.</p>
1.1 grant 7568:
1.27 rillig 7569: <p>As internal lists shall not be passed to the shell,
7570: there is no example for it.</p>
1.1 grant 7571: </div>
7572:
1.63 dillo 7573: <div class="sect2" lang="en">
1.27 rillig 7574: <div class="titlepage">
1.1 grant 7575: <div>
1.27 rillig 7576: <div>
1.63 dillo 7577: <h3 class="title"><a name=
1.38 dillo 7578: "quoting-guideline"></a>9.2.4. Quoting
1.27 rillig 7579: guideline</h3>
7580: </div>
1.1 grant 7581: </div>
7582: </div>
7583:
1.27 rillig 7584: <p>There are many possible sources of wrongly quoted
7585: variables. This section lists some of the commonly
7586: known ones.</p>
1.1 grant 7587:
1.27 rillig 7588: <div class="itemizedlist">
7589: <ul type="disc">
7590: <li>
7591: <p>Whenever you use the value of a list, think
7592: about what happens to leading or trailing
7593: whitespace. If the list is a well-formed shell
1.47 reed 7594: expression, you can apply the <code class=
1.27 rillig 7595: "varname">:M*</code> modifier to strip leading
7596: and trailing whitespace from each word. The
7597: <code class="varname">:M</code> operator first
7598: splits its argument according to the rules of the
7599: shell, and then creates a new list consisting of
7600: all words that match the shell glob expression
7601: <code class="varname">*</code>, that is: all. One
7602: class of situations where this is needed is when
7603: adding a variable like <code class=
7604: "varname">CPPFLAGS</code> to <code class=
7605: "varname">CONFIGURE_ARGS</code>. If the configure
1.47 reed 7606: script invokes other configure scripts, it strips
1.27 rillig 7607: the leading and trailing whitespace from the
7608: variable and then passes it to the other
7609: configure scripts. But these configure scripts
7610: expect the (child) <code class=
7611: "varname">CPPFLAGS</code> variable to be the same
7612: as the parent <code class=
7613: "varname">CPPFLAGS</code>. That's why we better
7614: pass the <code class="varname">CPPFLAGS</code>
7615: value properly trimmed. And here is how we do
7616: it:</p>
7617: <pre class="programlisting">
1.51 rillig 7618: CPPFLAGS= # empty
7619: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\"
7620: CPPFLAGS+= ${MY_CPPFLAGS}
7621:
7622: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
7623:
7624: all:
7625: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
7626: echo x${CONFIGURE_ARGS}x # properly trimmed
1.27 rillig 7627: </pre>
7628: </li>
1.1 grant 7629:
1.27 rillig 7630: <li>
7631: <p>The example above contains one bug: The
7632: <code class="varname">${PREFIX}</code> is a
7633: properly quoted shell expression, but there is
7634: the C compiler after it, which also expects a
7635: properly quoted string (this time in C syntax).
7636: The version above is therefore only correct if
7637: <code class="varname">${PREFIX}</code> does not
7638: have embedded backslashes or double quotes. If
7639: you want to allow these, you have to add another
7640: layer of quoting to each variable that is used as
7641: a C string literal. You cannot use the
7642: <code class="varname">:Q</code> operator for it,
7643: as this operator only works for the shell.</p>
7644: </li>
1.1 grant 7645:
1.27 rillig 7646: <li>
1.47 reed 7647: <p>Whenever a variable can be empty, the
1.27 rillig 7648: <code class="varname">:Q</code> operator can have
7649: surprising results. Here are two completely
7650: different cases which can be solved with the same
7651: trick.</p>
7652: <pre class="programlisting">
1.51 rillig 7653: EMPTY= # empty
7654: empty_test:
7655: for i in a ${EMPTY:Q} c; do \
7656: echo "$$i"; \
7657: done
7658:
7659: for_test:
7660: .for i in a:\ a:\test.txt
7661: echo ${i:Q}
7662: echo "foo"
7663: .endfor
1.1 grant 7664: </pre>
7665:
1.27 rillig 7666: <p>The first example will only print two of the
7667: three lines we might have expected. This is
7668: because <code class="varname">${EMPTY:Q}</code>
7669: expands to the empty string, which the shell
7670: cannot see. The workaround is to write
7671: <code class="varname">${EMPTY:Q}""</code>. This
7672: pattern can be often found as <code class=
7673: "varname">${TEST} -z ${VAR:Q}</code> or as
7674: <code class="varname">${TEST} -f
7675: ${FNAME:Q}</code> (both of these are wrong).</p>
7676:
7677: <p>The second example will only print three lines
7678: instead of four. The first line looks like
7679: <code class="varname">a:\ echo foo</code>. This
7680: is because the backslash of the value
7681: <code class="varname">a:\</code> is interpreted
7682: as a line-continuation by <a href=
7683: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
7684: <span class="citerefentry"><span class=
7685: "refentrytitle">make</span>(1)</span></a>, which
7686: makes the second line the arguments of the
7687: <a href=
7688: "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
7689: <span class="citerefentry"><span class=
7690: "refentrytitle">echo</span>(1)</span></a> command
7691: from the first line. To avoid this, write
7692: <code class="varname">${i:Q}""</code>.</p>
7693: </li>
7694: </ul>
7695: </div>
1.1 grant 7696: </div>
7697:
1.63 dillo 7698: <div class="sect2" lang="en">
1.27 rillig 7699: <div class="titlepage">
1.1 grant 7700: <div>
1.27 rillig 7701: <div>
1.30 wiz 7702: <h3 class="title"><a name=
1.38 dillo 7703: "bsd-make-bug-workaround"></a>9.2.5. Workaround
1.30 wiz 7704: for a bug in BSD Make</h3>
1.27 rillig 7705: </div>
1.1 grant 7706: </div>
7707: </div>
7708:
1.27 rillig 7709: <p>The pkgsrc bmake program does not handle the
7710: following assignment correctly. In case <code class=
7711: "varname">_othervar_</code> contains a ``-'' character,
7712: one of the closing braces is included in <code class=
7713: "varname">${VAR}</code> after this code executes.</p>
7714: <pre class="programlisting">
1.51 rillig 7715: VAR:= ${VAR:N${_othervar_:C/-//}}
1.1 grant 7716: </pre>
7717:
1.27 rillig 7718: <p>For a more complex code snippet and a workaround,
7719: see the package <a xmlns=
7720: "http://www.w3.org/TR/xhtml1/transitional" href=
7721: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
1.45 wiz 7722: target="_top"><code xmlns="" class=
7723: "filename">regress/make-quoting</code></a>, testcase
1.27 rillig 7724: <code class="varname">bug1</code>.</p>
1.1 grant 7725: </div>
7726: </div>
7727: </div>
7728:
1.63 dillo 7729: <div class="chapter" lang="en">
1.1 grant 7730: <div class="titlepage">
7731: <div>
7732: <div>
1.63 dillo 7733: <h2 class="title"><a name=
1.38 dillo 7734: "plist"></a>Chapter 10. PLIST issues</h2>
1.1 grant 7735: </div>
7736: </div>
7737: </div>
7738:
7739: <div class="toc">
7740: <p><b>Table of Contents</b></p>
7741:
7742: <dl>
1.38 dillo 7743: <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1 grant 7744: ID</a></span></dt>
7745:
1.30 wiz 7746: <dt><span class="sect1"><a href=
1.38 dillo 7747: "#automatic-plist-generation">10.2. Semi-automatic
1.45 wiz 7748: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7749: class="filename">PLIST</code>
1.14 xtraeme 7750: generation</a></span></dt>
1.1 grant 7751:
1.38 dillo 7752: <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14 xtraeme 7753: Tweaking output of <span><strong class="command">make
7754: print-PLIST</strong></span></a></span></dt>
1.1 grant 7755:
1.38 dillo 7756: <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1 grant 7757: Variable substitution in PLIST</a></span></dt>
7758:
1.30 wiz 7759: <dt><span class="sect1"><a href=
1.48 dillo 7760: "#manpage-compression">10.5. Man page
7761: compression</a></span></dt>
1.1 grant 7762:
1.38 dillo 7763: <dt><span class="sect1"><a href=
7764: "#using-PLIST_SRC">10.6. Changing PLIST source with
7765: <code class="varname">PLIST_SRC</code></a></span></dt>
1.1 grant 7766:
1.30 wiz 7767: <dt><span class="sect1"><a href=
1.47 reed 7768: "#platform-specific-plist">10.7. Platform-specific and
1.30 wiz 7769: differing PLISTs</a></span></dt>
1.1 grant 7770:
1.38 dillo 7771: <dt><span class="sect1"><a href=
7772: "#faq.common-dirs">10.8. Sharing directories between
7773: packages</a></span></dt>
1.1 grant 7774: </dl>
7775: </div>
7776:
1.45 wiz 7777: <p>The <code xmlns=
7778: "http://www.w3.org/TR/xhtml1/transitional" class=
7779: "filename">PLIST</code> file contains a package's
7780: “<span class="quote">packing list</span>”, i.e.
7781: a list of files that belong to the package (relative to the
7782: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7783: class="filename">${PREFIX}</code> directory it's been
7784: installed in) plus some additional statements - see the
7785: <a href=
1.1 grant 7786: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
7787: <span class="citerefentry"><span class=
1.47 reed 7788: "refentrytitle">pkg_create</span>(1)</span></a> man page
7789: for a full list. This chapter addresses some issues that
7790: need attention when dealing with the <code xmlns=
1.45 wiz 7791: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7792: "filename">PLIST</code> file (or files, see below!).</p>
1.1 grant 7793:
1.63 dillo 7794: <div class="sect1" lang="en">
1.1 grant 7795: <div class="titlepage">
7796: <div>
7797: <div>
7798: <h2 class="title" style="clear: both"><a name=
1.63 dillo 7799: "rcs-id"></a>10.1. RCS ID</h2>
1.1 grant 7800: </div>
7801: </div>
7802: </div>
7803:
7804: <p>Be sure to add a RCS ID line as the first thing in any
1.45 wiz 7805: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
7806: class="filename">PLIST</code> file you write:</p>
1.1 grant 7807: <pre class="programlisting">
1.51 rillig 7808: @comment $NetBSD$
1.1 grant 7809: </pre>
7810: </div>
7811:
1.63 dillo 7812: <div class="sect1" lang="en">
1.1 grant 7813: <div class="titlepage">
7814: <div>
7815: <div>
7816: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7817: "automatic-plist-generation"></a>10.2. Semi-automatic
1.45 wiz 7818: <code xmlns=
7819: "http://www.w3.org/TR/xhtml1/transitional" class=
7820: "filename">PLIST</code> generation</h2>
1.1 grant 7821: </div>
7822: </div>
7823: </div>
7824:
1.14 xtraeme 7825: <p>You can use the <span><strong class="command">make
7826: print-PLIST</strong></span> command to output a PLIST
7827: that matches any new files since the package was
7828: extracted. See <a href="#build.helpful-targets" title=
1.56 rillig 7829: "14.16. Other helpful targets">Section 14.16,
1.1 grant 7830: “Other helpful targets”</a> for more
7831: information on this target.</p>
7832: </div>
7833:
1.63 dillo 7834: <div class="sect1" lang="en">
1.1 grant 7835: <div class="titlepage">
7836: <div>
7837: <div>
7838: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7839: "print-PLIST"></a>10.3. Tweaking output of
1.14 xtraeme 7840: <span><strong class="command">make
7841: print-PLIST</strong></span></h2>
1.1 grant 7842: </div>
7843: </div>
7844: </div>
7845:
7846: <p>If you have used any of the *-dirs packages, as
7847: explained in <a href="#faq.common-dirs" title=
1.38 dillo 7848: "10.8. Sharing directories between packages">Section 10.8,
1.1 grant 7849: “Sharing directories between packages”</a>,
1.14 xtraeme 7850: you may have noticed that <span><strong class=
7851: "command">make print-PLIST</strong></span> outputs a set
7852: of <code class="varname">@comment</code>s instead of real
7853: <code class="varname">@dirrm</code> lines. You can also
7854: do this for specific directories and files, so that the
7855: results of that command are very close to reality. This
7856: helps <span class="emphasis"><em>a lot</em></span> during
7857: the update of packages.</p>
7858:
7859: <p>The <code class="varname">PRINT_PLIST_AWK</code>
7860: variable takes a set of AWK patterns and actions that are
7861: used to filter the output of print-PLIST. You can
7862: <span class="emphasis"><em>append</em></span> any chunk
7863: of AWK scripting you like to it, but be careful with
1.1 grant 7864: quoting.</p>
7865:
1.45 wiz 7866: <p>For example, to get all files inside the <code xmlns=
7867: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7868: "filename">libdata/foo</code> directory removed from the
1.1 grant 7869: resulting PLIST:</p>
7870: <pre class="programlisting">
1.51 rillig 7871: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
1.1 grant 7872: </pre>
7873:
1.14 xtraeme 7874: <p>And to get all the <code class="varname">@dirrm</code>
1.1 grant 7875: lines referring to a specific (shared) directory
1.14 xtraeme 7876: converted to <code class="varname">@comment</code>s:</p>
1.1 grant 7877: <pre class="programlisting">
1.51 rillig 7878: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
1.1 grant 7879: </pre>
7880: </div>
7881:
1.63 dillo 7882: <div class="sect1" lang="en">
1.1 grant 7883: <div class="titlepage">
7884: <div>
7885: <div>
7886: <h2 class="title" style="clear: both"><a name=
1.38 dillo 7887: "plist.misc"></a>10.4. Variable substitution
7888: in PLIST</h2>
1.1 grant 7889: </div>
7890: </div>
7891: </div>
7892:
7893: <p>A number of variables are substituted automatically in
7894: PLISTs when a package is installed on a system. This
7895: includes the following variables:</p>
7896:
7897: <div class="variablelist">
7898: <dl>
1.14 xtraeme 7899: <dt><span class="term"><code class=
7900: "varname">${MACHINE_ARCH}</code>, <code class=
7901: "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1 grant 7902:
7903: <dd>
7904: <p>Some packages like emacs and perl embed
7905: information about which architecture they were
7906: built on into the pathnames where they install
1.47 reed 7907: their files. To handle this case, PLIST will be
1.1 grant 7908: preprocessed before actually used, and the symbol
1.14 xtraeme 7909: “<span class="quote"><code class=
7910: "varname">${MACHINE_ARCH}</code></span>” will
7911: be replaced by what <span><strong class=
7912: "command">uname -p</strong></span> gives. The same
7913: is done if the string <code class=
7914: "varname">${MACHINE_GNU_ARCH}</code> is embedded in
7915: PLIST somewhere - use this on packages that have
1.47 reed 7916: GNU autoconf-created configure scripts.</p>
1.1 grant 7917:
7918: <div class="note" style=
7919: "margin-left: 0.5in; margin-right: 0.5in;">
7920: <h3 class="title">Legacy note</h3>
7921:
7922: <p>There used to be a symbol “<span class=
1.14 xtraeme 7923: "quote"><code class=
7924: "varname">$ARCH</code></span>” that was
7925: replaced by the output of <span><strong class=
7926: "command">uname -m</strong></span>, but that's no
1.1 grant 7927: longer supported and has been removed.</p>
7928: </div>
7929: </dd>
7930:
1.14 xtraeme 7931: <dt><span class="term"><code class=
7932: "varname">${OPSYS}</code>, <code class=
7933: "varname">${LOWER_OPSYS}</code>, <code class=
7934: "varname">${OS_VERSION}</code></span></dt>
1.1 grant 7935:
7936: <dd>
7937: <p>Some packages want to embed the OS name and
7938: version into some paths. To do this, use these
1.45 wiz 7939: variables in the <code xmlns=
7940: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7941: "filename">PLIST</code>:</p>
1.1 grant 7942:
7943: <div class="itemizedlist">
7944: <ul type="disc">
7945: <li>
1.14 xtraeme 7946: <p><code class="varname">${OPSYS}</code> -
7947: output of “<span class=
7948: "quote"><span><strong class="command">uname
7949: -s</strong></span></span>”</p>
1.1 grant 7950: </li>
7951:
7952: <li>
1.14 xtraeme 7953: <p><code class=
7954: "varname">${LOWER_OPSYS}</code> - lowercase
7955: common name (eg. “<span class=
7956: "quote">solaris</span>”)</p>
1.1 grant 7957: </li>
7958:
7959: <li>
1.14 xtraeme 7960: <p><code class="varname">${OS_VERSION}</code>
7961: - “<span class=
7962: "quote"><span><strong class="command">uname
7963: -r</strong></span></span>”</p>
1.1 grant 7964: </li>
7965: </ul>
7966: </div>
7967: </dd>
7968:
1.14 xtraeme 7969: <dt><span class="term"><code class=
7970: "varname">${PKGLOCALEDIR}</code></span></dt>
1.1 grant 7971:
7972: <dd>
7973: <p>Packages that install locale files should list
7974: them in the PLIST as “<span class=
7975: "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>”
7976: instead of “<span class=
7977: "quote">share/locale/de/LC_MESSAGES/...</span>”.
7978: This properly handles the fact that different
7979: operating systems expect locale files to be either
1.45 wiz 7980: in <code xmlns=
7981: "http://www.w3.org/TR/xhtml1/transitional" class=
7982: "filename">share</code> or <code xmlns=
7983: "http://www.w3.org/TR/xhtml1/transitional" class=
7984: "filename">lib</code> by default.</p>
1.1 grant 7985: </dd>
7986: </dl>
7987: </div>
7988:
7989: <p>For a complete list of values which are replaced by
1.45 wiz 7990: default, please look in <code xmlns=
7991: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 7992: "filename">bsd.pkg.mk</code> (and search for <span class=
1.1 grant 7993: "emphasis"><em>PLIST_SUBST</em></span>).</p>
7994:
7995: <p>If you want to change other variables not listed
7996: above, you can add variables and their expansions to this
1.14 xtraeme 7997: variable in the following way, similar to <code class=
7998: "varname">MESSAGE_SUBST</code> (see <a href=
1.1 grant 7999: "#components.optional" title=
1.38 dillo 8000: "8.5. Optional files">Section 8.5,
1.1 grant 8001: “Optional files”</a>):</p>
8002: <pre class="programlisting">
1.51 rillig 8003: PLIST_SUBST+= SOMEVAR="somevalue"
1.1 grant 8004: </pre>
8005:
8006: <p>This replaces all occurrences of “<span class=
8007: "quote">${SOMEVAR}</span>” in the PLIST with
8008: “<span class="quote">somevalue</span>”.</p>
8009: </div>
8010:
1.63 dillo 8011: <div class="sect1" lang="en">
1.1 grant 8012: <div class="titlepage">
8013: <div>
8014: <div>
8015: <h2 class="title" style="clear: both"><a name=
1.48 dillo 8016: "manpage-compression"></a>10.5. Man page
8017: compression</h2>
1.1 grant 8018: </div>
8019: </div>
8020: </div>
8021:
1.47 reed 8022: <p>Man pages should be installed in compressed form if
1.45 wiz 8023: <code class="varname">MANZ</code> is set (in <code xmlns=
8024: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8025: "filename">bsd.own.mk</code>), and uncompressed
1.45 wiz 8026: otherwise. To handle this in the <code xmlns=
8027: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8028: "filename">PLIST</code> file, the suffix
8029: “<span class="quote">.gz</span>” is
1.47 reed 8030: appended/removed automatically for man pages according to
1.14 xtraeme 8031: <code class="varname">MANZ</code> and <code class=
8032: "varname">MANCOMPRESSED</code> being set or not, see
1.45 wiz 8033: above for details. This modification of the <code xmlns=
8034: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8035: "filename">PLIST</code> file is done on a copy of it, not
1.45 wiz 8036: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8037: class="filename">PLIST</code> itself.</p>
1.1 grant 8038: </div>
8039:
1.63 dillo 8040: <div class="sect1" lang="en">
1.1 grant 8041: <div class="titlepage">
8042: <div>
8043: <div>
8044: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8045: "using-PLIST_SRC"></a>10.6. Changing PLIST
1.30 wiz 8046: source with <code class=
1.14 xtraeme 8047: "varname">PLIST_SRC</code></h2>
1.1 grant 8048: </div>
8049: </div>
8050: </div>
8051:
1.14 xtraeme 8052: <p>To use one or more files as source for the
1.45 wiz 8053: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8054: class="filename">PLIST</code> used in generating the
8055: binary package, set the variable <code class=
1.14 xtraeme 8056: "varname">PLIST_SRC</code> to the names of that file(s).
1.24 wiz 8057: The files are later concatenated using <a href=
8058: "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
8059: <span class="citerefentry"><span class=
8060: "refentrytitle">cat</span>(1)</span></a>, and order of
8061: things is important.</p>
1.1 grant 8062: </div>
8063:
1.63 dillo 8064: <div class="sect1" lang="en">
1.1 grant 8065: <div class="titlepage">
8066: <div>
8067: <div>
8068: <h2 class="title" style="clear: both"><a name=
1.47 reed 8069: "platform-specific-plist"></a>10.7. Platform-specific
8070: and differing PLISTs</h2>
1.1 grant 8071: </div>
8072: </div>
8073: </div>
8074:
8075: <p>Some packages decide to install a different set of
8076: files based on the operating system being used. These
8077: differences can be automatically handled by using the
8078: following files:</p>
8079:
8080: <div class="itemizedlist">
8081: <ul type="disc">
8082: <li>
1.45 wiz 8083: <p><code xmlns=
8084: "http://www.w3.org/TR/xhtml1/transitional" class=
8085: "filename">PLIST.common</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=
8091: "filename">PLIST.${OPSYS}</code></p>
1.1 grant 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.${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.21 ben 8103: "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
8104: </li>
8105:
8106: <li>
1.45 wiz 8107: <p><code xmlns=
8108: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8109: "filename">PLIST.common_end</code></p>
1.1 grant 8110: </li>
8111: </ul>
8112: </div>
8113: </div>
8114:
1.63 dillo 8115: <div class="sect1" lang="en">
1.1 grant 8116: <div class="titlepage">
8117: <div>
8118: <div>
8119: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8120: "faq.common-dirs"></a>10.8. Sharing
8121: directories between packages</h2>
1.1 grant 8122: </div>
8123: </div>
8124: </div>
8125:
8126: <p>A “<span class="quote">shared
8127: directory</span>” is a directory where multiple
8128: (and unrelated) packages install files. These directories
8129: are problematic because you have to add special tricks in
8130: the PLIST to conditionally remove them, or have some
8131: centralized package handle them.</p>
8132:
8133: <p>Within pkgsrc, you'll find both approaches. If a
8134: directory is shared by a few unrelated packages, it's
8135: often not worth to add an extra package to remove it.
8136: Therefore, one simply does:</p>
8137: <pre class="programlisting">
1.51 rillig 8138: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
1.1 grant 8139: </pre>
8140:
8141: <p>in the PLISTs of all affected packages, instead of the
8142: regular "@dirrm" line.</p>
8143:
8144: <p>However, if the directory is shared across many
8145: packages, two different solutions are available:</p>
8146:
8147: <div class="orderedlist">
8148: <ol type="1">
8149: <li>
8150: <p>If the packages have a common dependency, the
8151: directory can be removed in that. For example, see
8152: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
8153: href=
8154: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.45 wiz 8155: target="_top"><code xmlns="" class=
8156: "filename">textproc/scrollkeeper</code></a>, which
8157: removes the shared directory <code xmlns=
8158: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 8159: "filename">share/omf</code>.</p>
1.1 grant 8160: </li>
8161:
8162: <li>
8163: <p>If the packages using the directory are not
8164: related at all (they have no common dependencies),
8165: a *-dirs package is used.</p>
8166: </li>
8167: </ol>
8168: </div>
8169:
8170: <p>From now on, we'll discuss the second solution. To get
8171: an idea of the *-dirs packages available, issue:</p>
8172: <pre class="programlisting">
1.51 rillig 8173: <code class="prompt">%</code> cd .../pkgsrc
8174: <code class="prompt">%</code> ls -d */*-dirs
1.1 grant 8175: </pre>
8176:
8177: <p>Their use from other packages is very simple. The
1.14 xtraeme 8178: <code class="varname">USE_DIRS</code> variable takes a
8179: list of package names (without the “<span class=
1.1 grant 8180: "quote">-dirs</span>” part) together with the
8181: required version number (always pick the latest one when
1.34 wiz 8182: writing new packages).</p>
1.1 grant 8183:
8184: <p>For example, if a package installs files under
1.45 wiz 8185: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8186: class="filename">share/applications</code>, it should
8187: have the following line in it:</p>
1.1 grant 8188: <pre class="programlisting">
1.51 rillig 8189: USE_DIRS+= xdg-1.1
1.1 grant 8190: </pre>
8191:
1.14 xtraeme 8192: <p>After regenerating the PLIST using
8193: <span><strong class="command">make
8194: print-PLIST</strong></span>, you should get the right
8195: (commented out) lines.</p>
1.1 grant 8196:
1.47 reed 8197: <p>Note that even if your package is using <code xmlns=
1.45 wiz 8198: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8199: "filename">$X11BASE</code>, it must not depend on the
1.1 grant 8200: *-x11-dirs packages. Just specify the name without that
1.45 wiz 8201: part and pkgsrc (in particular, <code xmlns=
8202: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8203: "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1 grant 8204: </div>
8205: </div>
8206:
1.63 dillo 8207: <div class="chapter" lang="en">
1.1 grant 8208: <div class="titlepage">
8209: <div>
8210: <div>
1.63 dillo 8211: <h2 class="title"><a name=
1.38 dillo 8212: "buildlink"></a>Chapter 11. Buildlink
1.1 grant 8213: methodology</h2>
8214: </div>
8215: </div>
8216: </div>
8217:
8218: <div class="toc">
8219: <p><b>Table of Contents</b></p>
8220:
8221: <dl>
1.30 wiz 8222: <dt><span class="sect1"><a href=
1.38 dillo 8223: "#converting-to-buildlink3">11.1. Converting packages
1.30 wiz 8224: to use buildlink3</a></span></dt>
1.1 grant 8225:
1.30 wiz 8226: <dt><span class="sect1"><a href=
1.45 wiz 8227: "#creating-buildlink3.mk">11.2. Writing <code xmlns=
8228: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8229: "filename">buildlink3.mk</code> files</a></span></dt>
1.1 grant 8230:
8231: <dd>
8232: <dl>
1.25 rillig 8233: <dt><span class="sect2"><a href=
1.38 dillo 8234: "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30 wiz 8235: buildlink3.mk file</a></span></dt>
1.1 grant 8236:
1.25 rillig 8237: <dt><span class="sect2"><a href=
1.38 dillo 8238: "#updating-buildlink-depends">11.2.2. Updating
1.30 wiz 8239: <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14 xtraeme 8240: "replaceable"><code>pkg</code></em></code> in
1.45 wiz 8241: <code xmlns=
8242: "http://www.w3.org/TR/xhtml1/transitional" class=
8243: "filename">buildlink3.mk</code>
1.1 grant 8244: files</a></span></dt>
8245: </dl>
8246: </dd>
8247:
1.30 wiz 8248: <dt><span class="sect1"><a href=
1.45 wiz 8249: "#writing-builtin.mk">11.3. Writing <code xmlns=
8250: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8251: "filename">builtin.mk</code> files</a></span></dt>
1.1 grant 8252:
8253: <dd>
8254: <dl>
1.25 rillig 8255: <dt><span class="sect2"><a href=
1.38 dillo 8256: "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45 wiz 8257: <code xmlns=
8258: "http://www.w3.org/TR/xhtml1/transitional" class=
8259: "filename">builtin.mk</code> file</a></span></dt>
1.1 grant 8260:
1.25 rillig 8261: <dt><span class="sect2"><a href=
1.38 dillo 8262: "#native-or-pkgsrc-preference">11.3.2. Global
1.30 wiz 8263: preferences for native or pkgsrc
8264: software</a></span></dt>
1.1 grant 8265: </dl>
8266: </dd>
8267: </dl>
8268: </div>
8269:
8270: <p>Buildlink is a framework in pkgsrc that controls what
8271: headers and libraries are seen by a package's configure and
8272: build processes. This is implemented in a two step
8273: process:</p>
8274:
8275: <div class="orderedlist">
8276: <ol type="1">
8277: <li>
8278: <p>Symlink headers and libraries for dependencies
1.14 xtraeme 8279: into <code class="varname">BUILDLINK_DIR</code>,
8280: which by default is a subdirectory of <code class=
8281: "varname">WRKDIR</code>.</p>
1.1 grant 8282: </li>
8283:
8284: <li>
8285: <p>Create wrapper scripts that are used in place of
1.14 xtraeme 8286: the normal compiler tools that translate <code class=
8287: "option">-I${LOCALBASE}/include</code> and
8288: <code class="option">-L${LOCALBASE}/lib</code> into
8289: references to <code class=
8290: "varname">BUILDLINK_DIR</code>. The wrapper scripts
8291: also make native compiler on some operating systems
8292: look like GCC, so that packages that expect GCC won't
8293: require modifications to build with those native
8294: compilers.</p>
1.1 grant 8295: </li>
8296: </ol>
8297: </div>
8298:
8299: <p>This normalizes the environment in which a package is
8300: built so that the package may be built consistently despite
8301: what other software may be installed. Please note that the
1.45 wiz 8302: normal system header and library paths, e.g. <code xmlns=
8303: "http://www.w3.org/TR/xhtml1/transitional" class=
8304: "filename">/usr/include</code>, <code xmlns=
8305: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8306: "filename">/usr/lib</code>, etc., are always searched --
1.1 grant 8307: buildlink3 is designed to insulate the package build from
8308: non-system-supplied software.</p>
8309:
1.63 dillo 8310: <div class="sect1" lang="en">
1.1 grant 8311: <div class="titlepage">
8312: <div>
8313: <div>
8314: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8315: "converting-to-buildlink3"></a>11.1. Converting
1.30 wiz 8316: packages to use buildlink3</h2>
1.1 grant 8317: </div>
8318: </div>
8319: </div>
8320:
8321: <p>The process of converting packages to use the
8322: buildlink3 framework (“<span class=
8323: "quote">bl3ifying</span>”) is fairly
8324: straightforward. The things to keep in mind are:</p>
8325:
8326: <div class="orderedlist">
8327: <ol type="1">
8328: <li>
8329: <p>Ensure that the build always calls the wrapper
8330: scripts instead of the actual toolchain. Some
8331: packages are tricky, and the only way to know for
1.45 wiz 8332: sure is the check <code xmlns=
8333: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8334: "filename">${WRKDIR}/.work.log</code> to see if the
1.1 grant 8335: wrappers are being invoked.</p>
8336: </li>
8337:
8338: <li>
1.14 xtraeme 8339: <p>Don't override <code class=
8340: "varname">PREFIX</code> from within the package
8341: Makefile, e.g. Java VMs, standalone shells, etc.,
1.45 wiz 8342: because the code to symlink files into <code xmlns=
8343: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8344: "filename">${BUILDLINK_DIR}</code> looks for files
1.1 grant 8345: relative to “<span class="quote">pkg_info -qp
1.14 xtraeme 8346: <em class=
8347: "replaceable"><code>pkgname</code></em></span>”.</p>
1.1 grant 8348: </li>
8349:
8350: <li>
8351: <p>Remember that <span class=
1.45 wiz 8352: "emphasis"><em>only</em></span> the <code xmlns=
8353: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8354: "filename">buildlink3.mk</code> files that you list
1.1 grant 8355: in a package's Makefile are added as dependencies
8356: for that package.</p>
8357: </li>
8358: </ol>
8359: </div>
8360:
8361: <p>If a dependency on a particular package is required
8362: for its libraries and headers, then we replace:</p>
8363: <pre class="programlisting">
1.51 rillig 8364: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 grant 8365: </pre>
8366:
8367: <p>with</p>
8368: <pre class="programlisting">
1.51 rillig 8369: .include "../../category/foo/buildlink3.mk"
1.1 grant 8370: </pre>
8371:
1.47 reed 8372: <p>The buildlink3.mk files usually define the required
8373: dependencies. If you need a newer version of the
8374: dependency when using buildlink3.mk files, then you can
8375: define it in your Makefile; for example:</p>
8376: <pre class="programlisting">
1.51 rillig 8377: BUILDLINK_DEPENDS.foo+= foo>=1.1.0
8378: .include "../../category/foo/buildlink3.mk"
1.47 reed 8379: </pre>
8380:
1.45 wiz 8381: <p>There are several <code xmlns=
8382: "http://www.w3.org/TR/xhtml1/transitional" class=
8383: "filename">buildlink3.mk</code> files in <code xmlns=
8384: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8385: "filename">pkgsrc/mk</code> that handle special package
1.1 grant 8386: issues:</p>
8387:
8388: <div class="itemizedlist">
8389: <ul type="disc">
8390: <li>
1.45 wiz 8391: <p><code xmlns=
8392: "http://www.w3.org/TR/xhtml1/transitional" class=
8393: "filename">bdb.buildlink3.mk</code> chooses either
8394: the native or a pkgsrc Berkeley DB implementation
8395: based on the values of <code class=
1.14 xtraeme 8396: "varname">BDB_ACCEPTED</code> and <code class=
8397: "varname">BDB_DEFAULT</code>.</p>
1.1 grant 8398: </li>
8399:
8400: <li>
1.45 wiz 8401: <p><code xmlns=
8402: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 8403: "filename">curses.buildlink3.mk</code>: If the
1.14 xtraeme 8404: system comes with neither Curses nor NCurses, this
8405: will take care to install the <a xmlns=
8406: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 8407: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.45 wiz 8408: target="_top"><code xmlns="" class=
8409: "filename">devel/ncurses</code></a> package.</p>
1.1 grant 8410: </li>
8411:
8412: <li>
1.45 wiz 8413: <p><code xmlns=
8414: "http://www.w3.org/TR/xhtml1/transitional" class=
8415: "filename">krb5.buildlink3.mk</code> uses the value
8416: of <code class="varname">KRB5_ACCEPTED</code> to
8417: choose between adding a dependency on Heimdal or
8418: MIT-krb5 for packages that require a Kerberos 5
1.1 grant 8419: implementation.</p>
8420: </li>
8421:
8422: <li>
1.45 wiz 8423: <p><code xmlns=
8424: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8425: "filename">motif.buildlink3.mk</code> checks for a
8426: system-provided Motif installation or adds a
8427: dependency on <a xmlns=
1.1 grant 8428: "http://www.w3.org/TR/xhtml1/transitional" href=
8429: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.45 wiz 8430: target="_top"><code xmlns="" class=
8431: "filename">x11/lesstif</code></a> or <a xmlns=
1.20 ben 8432: "http://www.w3.org/TR/xhtml1/transitional" href=
8433: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
1.45 wiz 8434: target="_top"><code xmlns="" class=
1.47 reed 8435: "filename">x11/openmotif</code></a>.</p>
1.1 grant 8436: </li>
8437:
8438: <li>
1.45 wiz 8439: <p><code xmlns=
8440: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8441: "filename">ossaudio.buildlink3.mk</code> defines
8442: several variables that may be used by packages that
1.47 reed 8443: use the Open Sound System (OSS) API.</p>
1.1 grant 8444: </li>
8445:
8446: <li>
1.45 wiz 8447: <p><code xmlns=
8448: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8449: "filename">pgsql.buildlink3.mk</code> will accept
8450: either Postgres 7.3 or 7.4, whichever is found
8451: installed. See the file for more information.</p>
1.1 grant 8452: </li>
8453:
8454: <li>
1.45 wiz 8455: <p><code xmlns=
8456: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8457: "filename">pthread.buildlink3.mk</code> uses the
8458: value of <code class="varname">PTHREAD_OPTS</code>
8459: and checks for native pthreads or adds a dependency
8460: on <a xmlns=
1.1 grant 8461: "http://www.w3.org/TR/xhtml1/transitional" href=
8462: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.45 wiz 8463: target="_top"><code xmlns="" class=
1.47 reed 8464: "filename">devel/pth</code></a> as needed.</p>
1.1 grant 8465: </li>
8466:
8467: <li>
1.45 wiz 8468: <p><code xmlns=
8469: "http://www.w3.org/TR/xhtml1/transitional" class=
8470: "filename">xaw.buildlink3.mk</code> uses the value
8471: of <code class="varname">XAW_TYPE</code> to choose
8472: a particular Athena widgets library.</p>
1.1 grant 8473: </li>
8474: </ul>
8475: </div>
8476:
1.45 wiz 8477: <p>The comments in those <code xmlns=
8478: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8479: "filename">buildlink3.mk</code> files provide a more
1.1 grant 8480: complete description of how to use them properly.</p>
8481: </div>
8482:
1.63 dillo 8483: <div class="sect1" lang="en">
1.1 grant 8484: <div class="titlepage">
8485: <div>
8486: <div>
8487: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8488: "creating-buildlink3.mk"></a>11.2. Writing
1.45 wiz 8489: <code xmlns=
8490: "http://www.w3.org/TR/xhtml1/transitional" class=
8491: "filename">buildlink3.mk</code> files</h2>
1.1 grant 8492: </div>
8493: </div>
8494: </div>
8495:
1.45 wiz 8496: <p>A package's <code xmlns=
8497: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8498: "filename">buildlink3.mk</code> file is included by
8499: Makefiles to indicate the need to compile and link
8500: against header files and libraries provided by the
1.45 wiz 8501: package. A <code xmlns=
8502: "http://www.w3.org/TR/xhtml1/transitional" class=
8503: "filename">buildlink3.mk</code> file should always
8504: provide enough information to add the correct type of
8505: dependency relationship and include any other
8506: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8507: class="filename">buildlink3.mk</code> files that it needs
8508: to find headers and libraries that it needs in turn.</p>
1.1 grant 8509:
1.45 wiz 8510: <p>To generate an initial <code xmlns=
8511: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8512: "filename">buildlink3.mk</code> file for further editing,
1.1 grant 8513: Rene Hexel's <a xmlns=
8514: "http://www.w3.org/TR/xhtml1/transitional" href=
8515: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.45 wiz 8516: target="_top"><code xmlns="" class=
8517: "filename">pkgtools/createbuildlink</code></a> package is
1.20 ben 8518: highly recommended. For most packages, the following
8519: command will generate a good starting point for
1.45 wiz 8520: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8521: class="filename">buildlink3.mk</code> files:</p>
1.1 grant 8522: <pre class="screen">
1.14 xtraeme 8523: <code class="prompt">%</code> <strong class=
8524: "userinput"><code>cd pkgsrc/<em class=
8525: "replaceable"><code>category</code></em>/<em class=
8526: "replaceable"><code>pkgdir</code></em>
8527: <code class=
1.49 rillig 8528: "prompt">%</code> createbuildlink >buildlink3.mk</code></strong>
1.1 grant 8529: </pre>
8530:
1.63 dillo 8531: <div class="sect2" lang="en">
1.1 grant 8532: <div class="titlepage">
8533: <div>
8534: <div>
1.63 dillo 8535: <h3 class="title"><a name=
8536: "anatomy-of-bl3"></a>11.2.1. Anatomy of a
1.25 rillig 8537: buildlink3.mk file</h3>
1.1 grant 8538: </div>
8539: </div>
8540: </div>
8541:
1.45 wiz 8542: <p>The following real-life example <code xmlns=
8543: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8544: "filename">buildlink3.mk</code> is taken from
1.45 wiz 8545: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8546: class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1 grant 8547: <pre class="programlisting">
1.51 rillig 8548: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1 grant 8549:
1.51 rillig 8550: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
8551: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
1.1 grant 8552:
1.51 rillig 8553: .if !empty(BUILDLINK_DEPTH:M+)
8554: BUILDLINK_DEPENDS+= tiff
8555: .endif
1.1 grant 8556:
1.51 rillig 8557: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
8558: BUILDLINK_PACKAGES+= tiff
1.1 grant 8559:
1.51 rillig 8560: .if !empty(TIFF_BUILDLINK3_MK:M+)
8561: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
8562: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
8563: .endif # TIFF_BUILDLINK3_MK
1.1 grant 8564:
1.51 rillig 8565: .include "../../devel/zlib/buildlink3.mk"
8566: .include "../../graphics/jpeg/buildlink3.mk"
1.1 grant 8567:
1.51 rillig 8568: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
1.1 grant 8569: </pre>
8570:
1.14 xtraeme 8571: <p>The header and footer manipulate <code class=
8572: "varname">BUILDLINK_DEPTH</code>, which is common
1.45 wiz 8573: across all <code xmlns=
8574: "http://www.w3.org/TR/xhtml1/transitional" class=
8575: "filename">buildlink3.mk</code> files and is used to
8576: track at what depth we are including <code xmlns=
8577: "http://www.w3.org/TR/xhtml1/transitional" class=
8578: "filename">buildlink3.mk</code> files.</p>
1.1 grant 8579:
8580: <p>The first section controls if the dependency on
1.14 xtraeme 8581: <em class="replaceable"><code>pkg</code></em> is added.
8582: <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1 grant 8583: global list of packages for which dependencies are
8584: added by buildlink3.</p>
8585:
8586: <p>The second section advises pkgsrc that the
1.45 wiz 8587: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8588: class="filename">buildlink3.mk</code> file for
1.14 xtraeme 8589: <em class="replaceable"><code>pkg</code></em> has been
8590: included at some point. <code class=
8591: "varname">BUILDLINK_PACKAGES</code> is the global list
1.45 wiz 8592: of packages for which <code xmlns=
8593: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8594: "filename">buildlink3.mk</code> files have been
8595: included. It must <span class=
8596: "emphasis"><em>always</em></span> be appended to within
1.45 wiz 8597: a <code xmlns=
8598: "http://www.w3.org/TR/xhtml1/transitional" class=
8599: "filename">buildlink3.mk</code> file.</p>
1.1 grant 8600:
8601: <p>The third section is protected from multiple
1.14 xtraeme 8602: inclusion and controls how the dependency on <em class=
8603: "replaceable"><code>pkg</code></em> is added. Several
1.1 grant 8604: important variables are set in the section:</p>
8605:
8606: <div class="itemizedlist">
8607: <ul type="disc">
8608: <li>
1.14 xtraeme 8609: <p><code class=
8610: "varname">BUILDLINK_DEPENDS.<em class=
8611: "replaceable"><code>pkg</code></em></code> is the
8612: actual dependency recorded in the installed
8613: package; this should always be set using
8614: <span><strong class="command">+=</strong></span>
8615: to ensure that we're appending to any
8616: pre-existing list of values. This variable should
8617: be set to the first version of the package that
8618: had the last change in the major number of a
8619: shared library or that had a major API
8620: change.</p>
1.1 grant 8621: </li>
8622:
8623: <li>
1.14 xtraeme 8624: <p><code class=
8625: "varname">BUILDLINK_PKGSRCDIR.<em class=
8626: "replaceable"><code>pkg</code></em></code> is the
8627: location of the <em class=
8628: "replaceable"><code>pkg</code></em> pkgsrc
1.47 reed 8629: directory.</p>
1.1 grant 8630: </li>
8631:
8632: <li>
1.14 xtraeme 8633: <p><code class=
8634: "varname">BUILDLINK_DEPMETHOD.<em class=
8635: "replaceable"><code>pkg</code></em></code> (not
8636: shown above) controls whether we use <code class=
8637: "varname">BUILD_DEPENDS</code> or <code class=
8638: "varname">DEPENDS</code> to add the dependency on
8639: <em class="replaceable"><code>pkg</code></em>.
8640: The build dependency is selected by setting
8641: <code class=
8642: "varname">BUILDLINK_DEPMETHOD.<em class=
8643: "replaceable"><code>pkg</code></em></code> to
1.1 grant 8644: “<span class="quote">build</span>”.
8645: By default, the full dependency is used.</p>
8646: </li>
8647:
8648: <li>
1.14 xtraeme 8649: <p><code class=
8650: "varname">BUILDLINK_INCDIRS.<em class=
8651: "replaceable"><code>pkg</code></em></code> and
8652: <code class=
1.63 dillo 8653: "varname">BUILDLINK_LIBDIRS.<em class="replaceable"><code>pkg</code></em></code>
8654: (not shown above) are lists of subdirectories of
8655: <code xmlns=
1.45 wiz 8656: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8657: "filename">${BUILDLINK_PREFIX.<em class=
8658: "replaceable"><code>pkg</code></em>}</code> to
8659: add to the header and library search paths. These
1.1 grant 8660: default to “<span class=
8661: "quote">include</span>” and
8662: “<span class="quote">lib</span>”
8663: respectively.</p>
8664: </li>
8665:
8666: <li>
1.14 xtraeme 8667: <p><code class=
8668: "varname">BUILDLINK_CPPFLAGS.<em class=
8669: "replaceable"><code>pkg</code></em></code> (not
8670: shown above) is the list of preprocessor flags to
8671: add to <code class="varname">CPPFLAGS</code>,
8672: which are passed on to the configure and build
8673: phases. The “<span class=
8674: "quote">-I</span>” option should be avoided
8675: and instead be handled using <code class=
8676: "varname">BUILDLINK_INCDIRS.<em class=
8677: "replaceable"><code>pkg</code></em></code> as
8678: above.</p>
1.1 grant 8679: </li>
8680: </ul>
8681: </div>
8682:
8683: <p>The following variables are all optionally defined
8684: within this second section (protected against multiple
8685: inclusion) and control which package files are
1.45 wiz 8686: symlinked into <code xmlns=
8687: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8688: "filename">${BUILDLINK_DIR}</code> and how their names
1.1 grant 8689: are transformed during the symlinking:</p>
8690:
8691: <div class="itemizedlist">
8692: <ul type="disc">
8693: <li>
1.14 xtraeme 8694: <p><code class=
8695: "varname">BUILDLINK_FILES.<em class=
8696: "replaceable"><code>pkg</code></em></code> (not
8697: shown above) is a shell glob pattern relative to
1.45 wiz 8698: <code xmlns=
8699: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8700: "filename">${BUILDLINK_PREFIX.<em class=
8701: "replaceable"><code>pkg</code></em>}</code> to be
1.45 wiz 8702: symlinked into <code xmlns=
8703: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8704: "filename">${BUILDLINK_DIR}</code>, e.g.
1.45 wiz 8705: <code xmlns=
8706: "http://www.w3.org/TR/xhtml1/transitional" class=
8707: "filename">include/*.h</code>.</p>
1.1 grant 8708: </li>
8709:
8710: <li>
1.14 xtraeme 8711: <p><code class=
8712: "varname">BUILDLINK_FILES_CMD.<em class=
8713: "replaceable"><code>pkg</code></em></code> (not
8714: shown above) is a shell pipeline that outputs to
1.45 wiz 8715: stdout a list of files relative to <code xmlns=
8716: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8717: "filename">${BUILDLINK_PREFIX.<em class=
8718: "replaceable"><code>pkg</code></em>}</code>. The
1.1 grant 8719: resulting files are to be symlinked into
1.45 wiz 8720: <code xmlns=
8721: "http://www.w3.org/TR/xhtml1/transitional" class=
8722: "filename">${BUILDLINK_DIR}</code>. By default,
8723: this takes the <code xmlns=
8724: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8725: "filename">+CONTENTS</code> of a <em class=
8726: "replaceable"><code>pkg</code></em> and filters
8727: it through <code class=
8728: "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
8729: "replaceable"><code>pkg</code></em>}</code>.</p>
1.1 grant 8730: </li>
8731:
8732: <li>
1.14 xtraeme 8733: <p><code class=
8734: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
8735: "replaceable"><code>pkg</code></em></code> (not
8736: shown above) is a filter command that filters
1.45 wiz 8737: <code xmlns=
8738: "http://www.w3.org/TR/xhtml1/transitional" class=
8739: "filename">+CONTENTS</code> input into a list of
8740: files relative to <code xmlns=
8741: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8742: "filename">${BUILDLINK_PREFIX.<em class=
8743: "replaceable"><code>pkg</code></em>}</code> on
8744: stdout. By default for overwrite packages,
8745: <code class=
8746: "varname">BUILDLINK_CONTENTS_FILTER.<em class=
8747: "replaceable"><code>pkg</code></em></code>
1.45 wiz 8748: outputs the contents of the <code xmlns=
8749: "http://www.w3.org/TR/xhtml1/transitional" class=
8750: "filename">include</code> and <code xmlns=
8751: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8752: "filename">lib</code> directories in the package
1.45 wiz 8753: <code xmlns=
8754: "http://www.w3.org/TR/xhtml1/transitional" class=
8755: "filename">+CONTENTS</code>, and for pkgviews
8756: packages, it outputs any libtool archives in
8757: <code xmlns=
8758: "http://www.w3.org/TR/xhtml1/transitional" class=
8759: "filename">lib</code> directories.</p>
1.1 grant 8760: </li>
8761:
8762: <li>
1.14 xtraeme 8763: <p><code class=
8764: "varname">BUILDLINK_TRANSFORM.<em class=
8765: "replaceable"><code>pkg</code></em></code> (not
8766: shown above) is a list of sed arguments used to
1.1 grant 8767: transform the name of the source filename into a
1.14 xtraeme 8768: destination filename, e.g. <span><strong class=
1.1 grant 8769: "command">-e
1.14 xtraeme 8770: "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1 grant 8771: </li>
8772: </ul>
8773: </div>
8774:
1.45 wiz 8775: <p>The last section includes any <code xmlns=
8776: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8777: "filename">buildlink3.mk</code> needed for <em class=
8778: "replaceable"><code>pkg</code></em>'s library
1.45 wiz 8779: dependencies. Including these <code xmlns=
8780: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8781: "filename">buildlink3.mk</code> files means that the
8782: headers and libraries for these dependencies are also
1.45 wiz 8783: symlinked into <code xmlns=
8784: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8785: "filename">${BUILDLINK_DIR}</code> whenever the
8786: <em class="replaceable"><code>pkg</code></em>
1.45 wiz 8787: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
8788: class="filename">buildlink3.mk</code> file is
1.14 xtraeme 8789: included.</p>
1.1 grant 8790: </div>
8791:
1.63 dillo 8792: <div class="sect2" lang="en">
1.1 grant 8793: <div class="titlepage">
8794: <div>
8795: <div>
1.30 wiz 8796: <h3 class="title"><a name=
1.63 dillo 8797: "updating-buildlink-depends"></a>11.2.2. Updating
1.30 wiz 8798: <code class=
1.63 dillo 8799: "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
8800: in <code xmlns=
1.45 wiz 8801: "http://www.w3.org/TR/xhtml1/transitional" class=
1.30 wiz 8802: "filename">buildlink3.mk</code> files</h3>
1.1 grant 8803: </div>
8804: </div>
8805: </div>
8806:
8807: <p>There are two situations that require increasing the
1.14 xtraeme 8808: dependency listed in <code class=
8809: "varname">BUILDLINK_DEPENDS.<em class=
8810: "replaceable"><code>pkg</code></em></code> after a
8811: package update:</p>
1.1 grant 8812:
8813: <div class="orderedlist">
8814: <ol type="1">
8815: <li>
8816: <p>if the sonames (major number of the library
8817: version) of any installed shared libraries
1.47 reed 8818: change.</p>
1.1 grant 8819: </li>
8820:
8821: <li>
8822: <p>if the API or interface to the header files
8823: change.</p>
8824: </li>
8825: </ol>
8826: </div>
8827:
1.14 xtraeme 8828: <p>In these cases, <code class=
8829: "varname">BUILDLINK_DEPENDS.<em class=
8830: "replaceable"><code>pkg</code></em></code> should be
8831: adjusted to require at least the new package version.
8832: In some cases, the packages that depend on this new
8833: version may need their <code class=
8834: "varname">PKGREVISION</code>s increased and, if they
1.45 wiz 8835: have <code xmlns=
8836: "http://www.w3.org/TR/xhtml1/transitional" class=
8837: "filename">buildlink3.mk</code> files, their
8838: <code class="varname">BUILDLINK_DEPENDS.<em class=
8839: "replaceable"><code>pkg</code></em></code> adjusted,
8840: too. This is needed so that binary packages made using
8841: it will require the correct package dependency and not
8842: settle for an older one which will not contain the
8843: necessary shared libraries.</p>
1.1 grant 8844:
8845: <p>Please take careful consideration before adjusting
1.14 xtraeme 8846: <code class="varname">BUILDLINK_DEPENDS.<em class=
8847: "replaceable"><code>pkg</code></em></code> as we don't
8848: want to cause unneeded package deletions and rebuilds.
8849: In many cases, new versions of packages work just fine
8850: with older dependencies. See <a href="#dependencies"
1.63 dillo 8851: title=
8852: "15.1.4. Handling dependencies">Section 15.1.4,
8853: “Handling dependencies”</a> for more
8854: information about dependencies on other packages,
1.25 rillig 8855: including the <code class=
8856: "varname">BUILDLINK_RECOMMENDED</code> and <code class=
8857: "varname">RECOMMENDED</code> definitions.</p>
1.1 grant 8858: </div>
8859: </div>
8860:
1.63 dillo 8861: <div class="sect1" lang="en">
1.1 grant 8862: <div class="titlepage">
8863: <div>
8864: <div>
8865: <h2 class="title" style="clear: both"><a name=
1.38 dillo 8866: "writing-builtin.mk"></a>11.3. Writing
1.45 wiz 8867: <code xmlns=
8868: "http://www.w3.org/TR/xhtml1/transitional" class=
8869: "filename">builtin.mk</code> files</h2>
1.1 grant 8870: </div>
8871: </div>
8872: </div>
8873:
8874: <p>Some packages in pkgsrc install headers and libraries
8875: that coincide with headers and libraries present in the
1.45 wiz 8876: base system. Aside from a <code xmlns=
8877: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8878: "filename">buildlink3.mk</code> file, these packages
1.45 wiz 8879: should also include a <code xmlns=
8880: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8881: "filename">builtin.mk</code> file that includes the
8882: necessary checks to decide whether using the built-in
8883: software or the pkgsrc software is appropriate.</p>
1.1 grant 8884:
8885: <p>The only requirements of a builtin.mk file for
1.14 xtraeme 8886: <em class="replaceable"><code>pkg</code></em> are:</p>
1.1 grant 8887:
8888: <div class="orderedlist">
8889: <ol type="1">
8890: <li>
1.14 xtraeme 8891: <p>It should set <code class=
8892: "varname">USE_BUILTIN.<em class=
8893: "replaceable"><code>pkg</code></em></code> to
8894: either “<span class="quote">yes</span>”
8895: or “<span class="quote">no</span>”
8896: after it is included.</p>
1.1 grant 8897: </li>
8898:
8899: <li>
8900: <p>It should <span class=
8901: "emphasis"><em>not</em></span> override any
1.14 xtraeme 8902: <code class="varname">USE_BUILTIN.<em class=
8903: "replaceable"><code>pkg</code></em></code> which is
1.45 wiz 8904: already set before the <code xmlns=
8905: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8906: "filename">builtin.mk</code> file is included.</p>
1.1 grant 8907: </li>
8908:
8909: <li>
8910: <p>It should be written to allow multiple
8911: inclusion. This is <span class=
8912: "emphasis"><em>very</em></span> important and takes
1.45 wiz 8913: careful attention to <code xmlns=
8914: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8915: "filename">Makefile</code> coding.</p>
1.1 grant 8916: </li>
8917: </ol>
8918: </div>
8919:
1.63 dillo 8920: <div class="sect2" lang="en">
1.1 grant 8921: <div class="titlepage">
8922: <div>
8923: <div>
1.63 dillo 8924: <h3 class="title"><a name=
1.38 dillo 8925: "anatomy-of-builtin.mk"></a>11.3.1. Anatomy
1.45 wiz 8926: of a <code xmlns=
8927: "http://www.w3.org/TR/xhtml1/transitional" class=
8928: "filename">builtin.mk</code> file</h3>
1.1 grant 8929: </div>
8930: </div>
8931: </div>
8932:
8933: <p>The following is the recommended template for
8934: builtin.mk files:</p>
8935: <pre class="programlisting">
1.51 rillig 8936: .if !defined(IS_BUILTIN.foo)
8937: #
8938: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
8939: # genuinely exists in the system or not.
8940: #
8941: IS_BUILTIN.foo?= no
8942:
8943: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
8944: # version can be determined.
8945: #
8946: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
8947: BUILTIN_PKG.foo?= foo-1.0
8948: . endif
8949: .endif # IS_BUILTIN.foo
8950:
8951: .if !defined(USE_BUILTIN.foo)
8952: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
8953: . if defined(BUILTIN_PKG.foo)
8954: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
8955: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
8956: USE_BUILTIN.foo!= \
8957: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
8958: ${ECHO} "yes"; \
8959: else \
8960: ${ECHO} "no"; \
8961: fi
8962: . endif
8963: . endfor
8964: . endif
8965: .endif # USE_BUILTIN.foo
8966:
8967: CHECK_BUILTIN.foo?= no
8968: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
8969: #
8970: # Here we place code that depends on whether USE_BUILTIN.foo is set to
8971: # "yes" or "no".
8972: #
8973: .endif # CHECK_BUILTIN.foo
1.1 grant 8974: </pre>
8975:
1.14 xtraeme 8976: <p>The first section sets <code class=
8977: "varname">IS_BUILTIN.<em class=
8978: "replaceable"><code>pkg</code></em></code> depending on
8979: if <em class="replaceable"><code>pkg</code></em> really
8980: exists in the base system. This should not be a base
8981: system software with similar functionality to
8982: <em class="replaceable"><code>pkg</code></em>; it
8983: should only be “<span class=
8984: "quote">yes</span>” if the actual package is
8985: included as part of the base system. This variable is
1.45 wiz 8986: only used internally within the <code xmlns=
8987: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 8988: "filename">builtin.mk</code> file.</p>
8989:
8990: <p>The second section sets <code class=
8991: "varname">BUILTIN_PKG.<em class=
8992: "replaceable"><code>pkg</code></em></code> to the
8993: version of <em class=
8994: "replaceable"><code>pkg</code></em> in the base system
8995: if it exists (if <code class=
8996: "varname">IS_BUILTIN.<em class=
8997: "replaceable"><code>pkg</code></em></code> is
1.1 grant 8998: “<span class="quote">yes</span>”). This
1.14 xtraeme 8999: variable is only used internally within the
1.45 wiz 9000: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9001: class="filename">builtin.mk</code> file.</p>
1.1 grant 9002:
1.14 xtraeme 9003: <p>The third section sets <code class=
9004: "varname">USE_BUILTIN.<em class=
9005: "replaceable"><code>pkg</code></em></code> and is
9006: <span class="emphasis"><em>required</em></span> in all
1.45 wiz 9007: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9008: class="filename">builtin.mk</code> files. The code in
9009: this section must make the determination whether the
9010: built-in software is adequate to satisfy the
9011: dependencies listed in <code class=
1.14 xtraeme 9012: "varname">BUILDLINK_DEPENDS.<em class=
9013: "replaceable"><code>pkg</code></em></code>. This is
9014: typically done by comparing <code class=
9015: "varname">BUILTIN_PKG.<em class=
9016: "replaceable"><code>pkg</code></em></code> against each
9017: of the dependencies in <code class=
9018: "varname">BUILDLINK_DEPENDS.<em class=
9019: "replaceable"><code>pkg</code></em></code>.
9020: <code class="varname">USE_BUILTIN.<em class=
9021: "replaceable"><code>pkg</code></em></code> <span class=
1.1 grant 9022: "emphasis"><em>must</em></span> be set to the correct
1.45 wiz 9023: value by the end of the <code xmlns=
9024: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9025: "filename">builtin.mk</code> file. Note that
9026: <code class="varname">USE_BUILTIN.<em class=
9027: "replaceable"><code>pkg</code></em></code> may be
1.1 grant 9028: “<span class="quote">yes</span>” even if
1.14 xtraeme 9029: <code class="varname">IS_BUILTIN.<em class=
9030: "replaceable"><code>pkg</code></em></code> is
1.1 grant 9031: “<span class="quote">no</span>” because we
9032: may make the determination that the built-in version of
9033: the software is similar enough to be used as a
9034: replacement.</p>
9035:
1.14 xtraeme 9036: <p>The last section is guarded by <code class=
9037: "varname">CHECK_BUILTIN.<em class=
9038: "replaceable"><code>pkg</code></em></code>, and
9039: includes code that uses the value of <code class=
9040: "varname">USE_BUILTIN.<em class=
9041: "replaceable"><code>pkg</code></em></code> set in the
9042: previous section. This typically includes, e.g., adding
1.1 grant 9043: additional dependency restrictions and listing
1.45 wiz 9044: additional files to symlink into <code xmlns=
9045: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 9046: "filename">${BUILDLINK_DIR}</code> (via <code class=
9047: "varname">BUILDLINK_FILES.<em class=
9048: "replaceable"><code>pkg</code></em></code>).</p>
1.1 grant 9049: </div>
9050:
1.63 dillo 9051: <div class="sect2" lang="en">
1.1 grant 9052: <div class="titlepage">
9053: <div>
9054: <div>
1.30 wiz 9055: <h3 class="title"><a name=
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.63 dillo 9099: <div class="chapter" lang="en">
1.1 grant 9100: <div class="titlepage">
9101: <div>
9102: <div>
1.63 dillo 9103: <h2 class="title"><a name=
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.65 ! hubertf 9177: "#shells-disable">12.5.1. Disabling shell
! 9178: registration</a></span></dt>
! 9179: </dl>
! 9180: </dd>
! 9181:
! 9182: <dt><span class="sect1"><a href="#fonts">12.6.
! 9183: Fonts</a></span></dt>
! 9184:
! 9185: <dd>
! 9186: <dl>
! 9187: <dt><span class="sect2"><a href=
! 9188: "#fonts-disable">12.6.1. Disabling automatic update
! 9189: of the fonts databases</a></span></dt>
1.35 jmmv 9190: </dl>
9191: </dd>
1.1 grant 9192: </dl>
9193: </div>
9194:
1.35 jmmv 9195: <p>This chapter describes the framework known as
9196: <code class="literal">pkginstall</code>, whose key features
9197: are:</p>
9198:
9199: <div class="itemizedlist">
9200: <ul type="disc">
9201: <li>
9202: <p>Generic installation and manipulation of
9203: directories and files outside the pkgsrc-handled
9204: tree, <code class="varname">LOCALBASE</code>.</p>
9205: </li>
9206:
9207: <li>
9208: <p>Automatic handling of configuration files during
9209: installation, provided that packages are correctly
9210: designed.</p>
9211: </li>
9212:
9213: <li>
9214: <p>Generation and installation of system startup
9215: scripts.</p>
9216: </li>
9217:
9218: <li>
9219: <p>Registration of system users and groups.</p>
9220: </li>
9221:
9222: <li>
9223: <p>Registration of system shells.</p>
9224: </li>
1.65 ! hubertf 9225:
! 9226: <li>
! 9227: <p>Automatic updating of fonts databases.</p>
! 9228: </li>
1.35 jmmv 9229: </ul>
9230: </div>
9231:
9232: <p>The following sections inspect each of the above points
1.65 ! hubertf 9233: in detail.</p>
1.35 jmmv 9234:
9235: <p>You may be thinking that many of the things described
9236: here could be easily done with simple code in the package's
9237: post-installation target (<code class=
9238: "literal">post-install</code>). <span class=
9239: "emphasis"><em>This is incorrect</em></span>, as the code
9240: in them is only executed when building from source.
9241: Machines using binary packages could not benefit from it at
9242: all (as the code itself could be unavailable). Therefore,
9243: the only way to achieve any of the items described above is
9244: by means of the installation scripts, which are
9245: automatically generated by pkginstall.</p>
1.1 grant 9246:
1.63 dillo 9247: <div class="sect1" lang="en">
1.1 grant 9248: <div class="titlepage">
9249: <div>
9250: <div>
9251: <h2 class="title" style="clear: both"><a name=
1.63 dillo 9252: "files-and-dirs-outside-prefix"></a>12.1. Files
9253: and directories outside the installation
9254: prefix</h2>
1.1 grant 9255: </div>
9256: </div>
9257: </div>
9258:
1.45 wiz 9259: <p>As you already know, the <code xmlns=
9260: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9261: "filename">PLIST</code> file holds a list of files and
9262: directories that belong to a package. The names used in
1.45 wiz 9263: it are relative to the installation prefix (<code xmlns=
9264: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9265: "filename">${PREFIX}</code>), which means that it cannot
9266: register files outside this directory (absolute path
9267: names are not allowed). Despite this restriction, some
9268: packages need to install files outside this location;
1.45 wiz 9269: e.g., under <code xmlns=
9270: "http://www.w3.org/TR/xhtml1/transitional" class=
9271: "filename">${VARBASE}</code> or <code xmlns=
9272: "http://www.w3.org/TR/xhtml1/transitional" class=
9273: "filename">${PKG_SYSCONFDIR}</code>.</p>
1.35 jmmv 9274:
9275: <p>The only way to achieve this is to create such files
9276: during installation time by using the installation
9277: scripts. These scripts can run arbitrary commands, so
9278: they have the potential to create and manage files
1.47 reed 9279: anywhere in the file system. Here is where pkginstall
1.35 jmmv 9280: comes into play: it provides generic scripts to abstract
9281: the manipulation of such files and directories based on
1.45 wiz 9282: variables set in the package's <code xmlns=
9283: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9284: "filename">Makefile</code>. The rest of this section
1.47 reed 9285: describes these variables.</p>
1.1 grant 9286:
1.63 dillo 9287: <div class="sect2" lang="en">
1.35 jmmv 9288: <div class="titlepage">
1.1 grant 9289: <div>
1.35 jmmv 9290: <div>
1.63 dillo 9291: <h3 class="title"><a name=
9292: "dirs-outside-prefix"></a>12.1.1. Directory
1.35 jmmv 9293: manipulation</h3>
9294: </div>
1.1 grant 9295: </div>
9296: </div>
9297:
1.35 jmmv 9298: <p>The following variables can be set to request the
1.47 reed 9299: creation of directories anywhere in the file
9300: system:</p>
1.27 rillig 9301:
1.35 jmmv 9302: <div class="itemizedlist">
9303: <ul type="disc">
9304: <li>
9305: <p><code class="varname">MAKE_DIRS</code> and
9306: <code class="varname">OWN_DIRS</code> contain a
9307: list of directories that should be created and
9308: should attempt to be destroyed by the
9309: installation scripts. The difference between the
9310: two is that the latter prompts the administrator
9311: to remove any directories that may be left after
9312: deinstallation (because they were not empty),
9313: while the former does not.</p>
9314: </li>
1.1 grant 9315:
1.35 jmmv 9316: <li>
9317: <p><code class="varname">MAKE_DIRS_PERMS</code>
9318: and <code class="varname">OWN_DIRS_PERMS</code>
9319: contain a list of tuples describing which
9320: directories should be created and should attempt
9321: to be destroyed by the installation scripts. Each
9322: tuple holds the following values, separated by
9323: spaces: the directory name, its owner, its group
9324: and its numerical mode. For example:</p>
9325: <pre class="programlisting">
1.51 rillig 9326: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
1.35 jmmv 9327: </pre>
1.1 grant 9328:
1.35 jmmv 9329: <p>The difference between the two is exactly the
9330: same as their non-<code class=
9331: "varname">PERMS</code> counterparts.</p>
9332: </li>
9333: </ul>
9334: </div>
9335: </div>
9336:
1.63 dillo 9337: <div class="sect2" lang="en">
1.35 jmmv 9338: <div class="titlepage">
9339: <div>
9340: <div>
1.63 dillo 9341: <h3 class="title"><a name=
9342: "files-outside-prefix"></a>12.1.2. File
1.35 jmmv 9343: manipulation</h3>
9344: </div>
9345: </div>
9346: </div>
9347:
9348: <p>Creating non-empty files outside the installation
1.45 wiz 9349: prefix is tricky because the <code xmlns=
9350: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9351: "filename">PLIST</code> forces all files to be inside
9352: it. To overcome this problem, the only solution is to
9353: extract the file in the known place (i.e., inside the
9354: installation prefix) and copy it to the appropriate
9355: location during installation (done by the installation
9356: scripts generated by pkginstall). We will call the
9357: former the <span class="emphasis"><em>master
9358: file</em></span> in the following paragraphs, which
9359: describe the variables that can be used to
9360: automatically and consistently handle files outside the
9361: installation prefix:</p>
9362:
9363: <div class="itemizedlist">
9364: <ul type="disc">
9365: <li>
9366: <p><code class="varname">CONF_FILES</code> and
9367: <code class="varname">SUPPORT_FILES</code> are
9368: pairs of master and target files. During
9369: installation time, the master file is copied to
9370: the target one if and only if the latter does not
9371: exist. Upon deinstallation, the target file is
9372: removed provided that it was not modified by the
9373: installation.</p>
9374:
9375: <p>The difference between the two is that the
9376: latter prompts the administrator to remove any
9377: files that may be left after deinstallation
9378: (because they were not empty), while the former
9379: does not.</p>
9380: </li>
9381:
9382: <li>
9383: <p><code class="varname">CONF_FILES_PERMS</code>
9384: and <code class=
9385: "varname">SUPPORT_FILES_PERMS</code> contain
9386: tuples describing master files as well as their
9387: target locations. For each of them, it also
9388: specifies their owner, their group and their
9389: numeric permissions, in this order. For
9390: example:</p>
9391: <pre class="programlisting">
1.51 rillig 9392: SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
1.35 jmmv 9393: </pre>
9394:
9395: <p>The difference between the two is exactly the
9396: same as their non-<code class=
9397: "varname">PERMS</code> counterparts.</p>
9398: </li>
9399: </ul>
9400: </div>
9401: </div>
9402: </div>
9403:
1.63 dillo 9404: <div class="sect1" lang="en">
1.35 jmmv 9405: <div class="titlepage">
9406: <div>
9407: <div>
9408: <h2 class="title" style="clear: both"><a name=
1.63 dillo 9409: "conf-files"></a>12.2. Configuration
9410: files</h2>
1.35 jmmv 9411: </div>
9412: </div>
9413: </div>
9414:
9415: <p>Configuration files are special in the sense that they
9416: are installed in their own specific directory,
9417: <code class="varname">PKG_SYSCONFDIR</code>, and need
9418: special treatment during installation (most of which is
9419: automated by pkginstall). The main concept you must bear
1.36 wiz 9420: in mind is that files marked as configuration files are
1.35 jmmv 9421: automatically copied to the right place (somewhere inside
9422: <code class="varname">PKG_SYSCONFDIR</code>) during
9423: installation <span class="emphasis"><em>if and only
9424: if</em></span> they didn't exist before. Similarly, they
9425: will not be removed if they have local modifications.
1.36 wiz 9426: This ensures that administrators never lose any custom
1.35 jmmv 9427: changes they may have made.</p>
9428:
1.63 dillo 9429: <div class="sect2" lang="en">
1.35 jmmv 9430: <div class="titlepage">
9431: <div>
9432: <div>
1.63 dillo 9433: <h3 class="title"><a name=
9434: "conf-files-sysconfdir"></a>12.2.1. How
1.35 jmmv 9435: <code class="varname">PKG_SYSCONFDIR</code> is
9436: set</h3>
9437: </div>
9438: </div>
9439: </div>
9440:
9441: <p>As said before, the <code class=
9442: "varname">PKG_SYSCONFDIR</code> variable specifies
9443: where configuration files shall be installed. Its
9444: contents are set based upon the following
9445: variables:</p>
9446:
9447: <div class="itemizedlist">
9448: <ul type="disc">
9449: <li>
9450: <p><code class="varname">PKG_SYSCONFBASE</code>:
9451: The configuration's root directory. Defaults to
1.45 wiz 9452: <code xmlns=
9453: "http://www.w3.org/TR/xhtml1/transitional" class=
9454: "filename">${PREFIX}/etc</code> although it may
9455: be overridden by the user to point to his
9456: preferred location (e.g., <code xmlns=
9457: "http://www.w3.org/TR/xhtml1/transitional" class=
9458: "filename">/etc</code>, <code xmlns=
9459: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9460: "filename">/etc/pkg</code>, etc.). Packages must
9461: not use it directly.</p>
9462: </li>
9463:
9464: <li>
9465: <p><code class=
9466: "varname">PKG_SYSCONFSUBDIR</code>: A
9467: subdirectory of <code class=
9468: "varname">PKG_SYSCONFBASE</code> under which the
9469: configuration files for the package being built
9470: shall be installed. The definition of this
9471: variable only makes sense in the package's
1.45 wiz 9472: <code xmlns=
9473: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 9474: "filename">Makefile</code> (i.e., it is not
9475: user-customizable).</p>
1.35 jmmv 9476:
9477: <p>As an example, consider the Apache package,
9478: <a xmlns=
9479: "http://www.w3.org/TR/xhtml1/transitional" href=
9480: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
1.45 wiz 9481: target="_top"><code xmlns="" class=
9482: "filename">www/apache2</code></a>, which places
9483: its configuration files under the <code xmlns=
9484: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9485: "filename">httpd/</code> subdirectory of
9486: <code class="varname">PKG_SYSCONFBASE</code>.
9487: This should be set in the package Makefile.</p>
9488: </li>
9489:
9490: <li>
9491: <p><code class="varname">PKG_SYSCONFVAR</code>:
9492: Specifies the name of the variable that holds
9493: this package's configuration directory (if
9494: different from <code class=
9495: "varname">PKG_SYSCONFBASE</code>). It defaults to
9496: <code class="varname">PKGBASE</code>'s value, and
9497: is always prefixed with <code class=
9498: "literal">PKG_SYSCONFDIR</code>.</p>
9499: </li>
9500:
9501: <li>
9502: <p><code class=
9503: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
9504: Holds the directory where the configuration files
9505: for the package identified by <code class=
9506: "varname">PKG_SYSCONFVAR</code>'s shall be
9507: placed.</p>
9508: </li>
9509: </ul>
9510: </div>
9511:
9512: <p>Based on the above variables, pkginstall determines
9513: the value of <code class=
9514: "varname">PKG_SYSCONFDIR</code>, which is the
9515: <span class="emphasis"><em>only</em></span> variable
9516: that can be used within a package to refer to its
9517: configuration directory. The algorithm used to set its
9518: value is basically the following:</p>
9519:
9520: <div class="orderedlist">
9521: <ol type="1">
9522: <li>
9523: <p>If <code class=
9524: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
9525: is set, its value is used.</p>
9526: </li>
9527:
9528: <li>
9529: <p>If the previous variable is not defined but
9530: <code class="varname">PKG_SYSCONFSUBDIR</code> is
1.45 wiz 9531: set in the package's <code xmlns=
9532: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9533: "filename">Makefile</code>, the resulting value
1.45 wiz 9534: is <code xmlns=
9535: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9536: "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
9537: </li>
9538:
9539: <li>
1.45 wiz 9540: <p>Otherwise, it is set to <code xmlns=
9541: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9542: "filename">${PKG_SYSCONFBASE}</code>.</p>
9543: </li>
9544: </ol>
9545: </div>
9546:
1.45 wiz 9547: <p>It is worth mentioning that <code xmlns=
9548: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9549: "filename">${PKG_SYSCONFDIR}</code> is automatically
1.45 wiz 9550: added to <code xmlns=
9551: "http://www.w3.org/TR/xhtml1/transitional" class=
9552: "filename">OWN_DIRS</code>. See <a href=
9553: "#dirs-outside-prefix" title=
1.63 dillo 9554: "12.1.1. Directory manipulation">Section 12.1.1,
1.35 jmmv 9555: “Directory manipulation”</a> what this
9556: means.</p>
9557: </div>
9558:
1.63 dillo 9559: <div class="sect2" lang="en">
1.35 jmmv 9560: <div class="titlepage">
9561: <div>
9562: <div>
1.63 dillo 9563: <h3 class="title"><a name=
9564: "conf-files-configure"></a>12.2.2. Telling
9565: the software where configuration files are</h3>
1.35 jmmv 9566: </div>
9567: </div>
9568: </div>
9569:
9570: <p>Given that pkgsrc (and users!) expect configuration
9571: files to be in a known place, you need to teach each
1.36 wiz 9572: package where it shall install its files. In some cases
1.35 jmmv 9573: you will have to patch the package Makefiles to achieve
9574: it. If you are lucky, though, it may be as easy as
9575: passing an extra flag to the configuration script; this
1.47 reed 9576: is the case of GNU Autoconf- generated files:</p>
1.35 jmmv 9577: <pre class="programlisting">
1.51 rillig 9578: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.35 jmmv 9579: </pre>
9580:
9581: <p>Note that this specifies where the package has to
9582: <span class="emphasis"><em>look for</em></span> its
9583: configuration files, not where they will be originally
9584: installed (although the difference is never explicit,
9585: unfortunately).</p>
9586: </div>
9587:
1.63 dillo 9588: <div class="sect2" lang="en">
1.35 jmmv 9589: <div class="titlepage">
9590: <div>
9591: <div>
1.63 dillo 9592: <h3 class="title"><a name=
9593: "conf-files-patching"></a>12.2.3. Patching
1.35 jmmv 9594: installations</h3>
9595: </div>
9596: </div>
9597: </div>
9598:
9599: <p>As said before, pkginstall automatically handles
9600: configuration files. This means that <span class=
9601: "strong"><strong>the packages themselves must not touch
1.45 wiz 9602: the contents of <code xmlns=
9603: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9604: "filename">${PKG_SYSCONFDIR}</code>
1.36 wiz 9605: directly</strong></span>. Bad news is that many
9606: software installation scripts will, out of the box,
9607: mess with the contents of that directory. So what is
9608: the correct procedure to fix this issue?</p>
1.35 jmmv 9609:
9610: <p>You must teach the package (usually by manually
9611: patching it) to install any configuration files under
1.45 wiz 9612: the examples hierarchy, <code xmlns=
9613: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9614: "filename">share/examples/${PKGBASE}/</code>. This way,
1.45 wiz 9615: the <code xmlns=
9616: "http://www.w3.org/TR/xhtml1/transitional" class=
9617: "filename">PLIST</code> registers them and the
9618: administrator always has the original copies
1.35 jmmv 9619: available.</p>
9620:
9621: <p>Once the required configuration files are in place
9622: (i.e., under the examples hierarchy), the pkginstall
9623: framework can use them as master copies during the
1.45 wiz 9624: package installation to update what is in <code xmlns=
9625: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9626: "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
9627: the variables <code class="varname">CONF_FILES</code>
9628: and <code class="varname">CONF_FILES_PERMS</code> are
9629: used. Check out <a href="#files-outside-prefix" title=
1.63 dillo 9630: "12.1.2. File manipulation">Section 12.1.2,
1.35 jmmv 9631: “File manipulation”</a> for information
9632: about their syntax and their purpose. Here is an
9633: example, taken from the <a xmlns=
9634: "http://www.w3.org/TR/xhtml1/transitional" href=
9635: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
1.45 wiz 9636: target="_top"><code xmlns="" class=
9637: "filename">mail/mutt</code></a> package:</p>
1.35 jmmv 9638: <pre class="programlisting">
1.51 rillig 9639: EGDIR= ${PREFIX}/share/doc/mutt/samples
9640: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
1.35 jmmv 9641: </pre>
9642:
9643: <p>Note that the <code class="varname">EGDIR</code>
9644: variable is specific to that package and has no meaning
9645: outside it.</p>
9646: </div>
9647:
1.63 dillo 9648: <div class="sect2" lang="en">
1.35 jmmv 9649: <div class="titlepage">
9650: <div>
9651: <div>
1.63 dillo 9652: <h3 class="title"><a name=
9653: "conf-files-disable"></a>12.2.4. Disabling
1.35 jmmv 9654: handling of configuration files</h3>
9655: </div>
9656: </div>
9657: </div>
9658:
9659: <p>The automatic copying of config files can be toggled
9660: by setting the environment variable <code class=
9661: "varname">PKG_CONFIG</code> prior to package
9662: installation.</p>
9663: </div>
9664: </div>
9665:
1.63 dillo 9666: <div class="sect1" lang="en">
1.35 jmmv 9667: <div class="titlepage">
9668: <div>
9669: <div>
9670: <h2 class="title" style="clear: both"><a name=
1.63 dillo 9671: "rcd-scripts"></a>12.3. System startup
9672: scripts</h2>
1.35 jmmv 9673: </div>
9674: </div>
9675: </div>
9676:
9677: <p>System startup scripts are special files because they
9678: must be installed in a place known by the underlying OS,
9679: usually outside the installation prefix. Therefore, the
9680: same rules described in <a href=
9681: "#files-and-dirs-outside-prefix" title=
1.38 dillo 9682: "12.1. Files and directories outside the installation prefix">
1.63 dillo 9683: Section 12.1, “Files and directories outside
9684: the installation prefix”</a> apply, and the same
1.35 jmmv 9685: solutions can be used. However, pkginstall provides a
1.36 wiz 9686: special mechanism to handle these files.</p>
1.35 jmmv 9687:
9688: <p>In order to provide system startup scripts, the
9689: package has to:</p>
9690:
9691: <div class="orderedlist">
9692: <ol type="1">
9693: <li>
1.45 wiz 9694: <p>Store the script inside <code xmlns=
9695: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9696: "filename">${FILESDIR}</code>, with the
9697: <code class="literal">.sh</code> suffix appended.
9698: Considering the <a xmlns=
9699: "http://www.w3.org/TR/xhtml1/transitional" href=
9700: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
1.45 wiz 9701: target="_top"><code xmlns="" class=
9702: "filename">print/cups</code></a> package as an
9703: example, it has a <code xmlns=
9704: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9705: "filename">cupsd.sh</code> in its files
9706: directory.</p>
9707: </li>
9708:
9709: <li>
9710: <p>Tell pkginstall to handle it, appending the name
9711: of the script, without its extension, to the
9712: <code class="varname">RCD_SCRIPTS</code> variable.
9713: Continuing the previous example:</p>
9714: <pre class="programlisting">
1.51 rillig 9715: RCD_SCRIPTS+= cupsd
1.35 jmmv 9716: </pre>
9717: </li>
9718: </ol>
9719: </div>
9720:
9721: <p>Once this is done, pkginstall will do the following
9722: steps for each script in an automated fashion:</p>
9723:
9724: <div class="orderedlist">
9725: <ol type="1">
9726: <li>
9727: <p>Process the file found in the files directory
9728: applying all the substitutions described in the
1.45 wiz 9729: <code xmlns=
9730: "http://www.w3.org/TR/xhtml1/transitional" class=
9731: "filename">FILES_SUBST</code> variable.</p>
1.35 jmmv 9732: </li>
9733:
9734: <li>
9735: <p>Copy the script from the files directory to the
1.45 wiz 9736: examples hierarchy, <code xmlns=
9737: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9738: "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36 wiz 9739: Note that this master file must be explicitly
1.45 wiz 9740: registered in the <code xmlns=
9741: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9742: "filename">PLIST</code>.</p>
9743: </li>
9744:
9745: <li>
9746: <p>Add code to the installation scripts to copy the
9747: startup script from the examples hierarchy into the
9748: system-wide startup scripts directory.</p>
9749: </li>
9750: </ol>
9751: </div>
9752:
1.63 dillo 9753: <div class="sect2" lang="en">
1.35 jmmv 9754: <div class="titlepage">
9755: <div>
9756: <div>
1.63 dillo 9757: <h3 class="title"><a name=
9758: "rcd-scripts-disable"></a>12.3.1. Disabling
1.35 jmmv 9759: handling of system startup scripts</h3>
9760: </div>
9761: </div>
9762: </div>
9763:
9764: <p>The automatic copying of config files can be toggled
9765: by setting the environment variable <code class=
9766: "varname">PKG_RCD_SCRIPTS</code> prior to package
9767: installation. Note that the scripts will be always
1.45 wiz 9768: copied inside the examples hierarchy, <code xmlns=
9769: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9770: "filename">${PREFIX}/share/examples/rc.d/</code>, no
9771: matter what the value of this variable is.</p>
9772: </div>
9773: </div>
9774:
1.63 dillo 9775: <div class="sect1" lang="en">
1.35 jmmv 9776: <div class="titlepage">
9777: <div>
9778: <div>
9779: <h2 class="title" style="clear: both"><a name=
1.63 dillo 9780: "users-and-groups"></a>12.4. System users and
9781: groups</h2>
1.35 jmmv 9782: </div>
9783: </div>
9784: </div>
9785:
9786: <p>If a package needs to create special users and/or
9787: groups during installation, it can do so by using the
9788: pkginstall framework.</p>
9789:
9790: <p>Users can be created by adding entries to the
9791: <code class="varname">PKG_USERS</code> variable. Each
1.45 wiz 9792: entry has the following syntax, which mimics <code xmlns=
9793: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9794: "filename">/etc/passwd</code>:</p>
9795: <pre class="programlisting">
1.51 rillig 9796: user:group[:[userid][:[descr][:[home][:shell]]]]
1.35 jmmv 9797: </pre>
9798:
9799: <p>Only the user and group are required; everything else
9800: is optional, but the colons must be in the right places
9801: when specifying optional bits. By default, a new user
1.45 wiz 9802: will have home directory <code xmlns=
9803: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9804: "filename">/nonexistent</code>, and login shell
1.45 wiz 9805: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9806: class="filename">/sbin/nologin</code> unless they are
9807: specified as part of the user element. Note that if the
1.51 rillig 9808: description contains spaces, then spaces should be
1.45 wiz 9809: backslash-escaped, as in:</p>
1.35 jmmv 9810: <pre class="programlisting">
1.51 rillig 9811: foo:foogrp::The\ Foomister
1.35 jmmv 9812: </pre>
9813:
9814: <p>Similarly, groups can be created using the
9815: <code class="varname">PKG_GROUPS</code> variable, whose
9816: syntax is:</p>
9817: <pre class="programlisting">
1.51 rillig 9818: group[:groupid]
1.35 jmmv 9819: </pre>
9820:
9821: <p>As before, only the group name is required; the
9822: numeric identifier is optional.</p>
9823: </div>
9824:
1.63 dillo 9825: <div class="sect1" lang="en">
1.35 jmmv 9826: <div class="titlepage">
9827: <div>
9828: <div>
9829: <h2 class="title" style="clear: both"><a name=
1.63 dillo 9830: "shells"></a>12.5. System shells</h2>
1.35 jmmv 9831: </div>
9832: </div>
9833: </div>
9834:
9835: <p>Packages that install system shells should register
1.45 wiz 9836: them in the shell database, <code xmlns=
9837: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9838: "filename">/etc/shells</code>, to make things easier to
9839: the administrator. This must be done from the
9840: installation scripts to keep binary packages working on
9841: any system. pkginstall provides an easy way to accomplish
9842: this task.</p>
9843:
9844: <p>When a package provides a shell interpreter, it has to
9845: set the <code class="varname">PKG_SHELL</code> variable
9846: to its absolute file name. This will add some hooks to
9847: the installation scripts to handle it. Consider the
9848: following example, taken from <a xmlns=
9849: "http://www.w3.org/TR/xhtml1/transitional" href=
9850: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
1.45 wiz 9851: target="_top"><code xmlns="" class=
9852: "filename">shells/zsh</code></a>:</p>
1.35 jmmv 9853: <pre class="programlisting">
1.51 rillig 9854: PKG_SHELL= ${PREFIX}/bin/zsh
1.35 jmmv 9855: </pre>
9856:
1.63 dillo 9857: <div class="sect2" lang="en">
1.35 jmmv 9858: <div class="titlepage">
9859: <div>
9860: <div>
1.63 dillo 9861: <h3 class="title"><a name=
1.65 ! hubertf 9862: "shells-disable"></a>12.5.1. Disabling shell
! 9863: registration</h3>
1.35 jmmv 9864: </div>
9865: </div>
9866: </div>
9867:
9868: <p>The automatic registration of shell interpreters can
9869: be disabled by the administrator by setting the
1.45 wiz 9870: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9871: class="filename">PKG_REGISTER_SHELLS</code> environment
9872: variable to <code class="literal">NO</code>.</p>
1.35 jmmv 9873: </div>
9874: </div>
1.65 ! hubertf 9875:
! 9876: <div class="sect1" lang="en">
! 9877: <div class="titlepage">
! 9878: <div>
! 9879: <div>
! 9880: <h2 class="title" style="clear: both"><a name=
! 9881: "fonts"></a>12.6. Fonts</h2>
! 9882: </div>
! 9883: </div>
! 9884: </div>
! 9885:
! 9886: <p>Packages that install X11 fonts should update the
! 9887: database files that index the fonts within each fonts
! 9888: directory. This can easily be accomplished within the
! 9889: pkginstall framework.</p>
! 9890:
! 9891: <p>When a package installs X11 fonts, it must list the
! 9892: directories in which fonts are installed in the
! 9893: <code class="varname">FONTS_DIRS.<em class=
! 9894: "replaceable"><code>type</code></em></code> variables,
! 9895: where <em class="replaceable"><code>type</code></em> can
! 9896: be one of “<span class="quote">ttf</span>”,
! 9897: “<span class="quote">type1</span>” or
! 9898: “<span class="quote">x11</span>”. This will
! 9899: add hooks to the installation scripts to run the
! 9900: appropriate commands to update the fonts database files
! 9901: within each of those directories. For convenience, if the
! 9902: directory path is relative, it is taken to be relative to
! 9903: the package's installation prefix. Consider the following
! 9904: example, taken from <a xmlns=
! 9905: "http://www.w3.org/TR/xhtml1/transitional" href=
! 9906: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/dbz-ttf/README.html"
! 9907: target="_top"><code xmlns="" class=
! 9908: "filename">fonts/dbz-ttf</code></a>:</p>
! 9909: <pre class="programlisting">
! 9910: FONTS_DIRS.ttf= ${PREFIX}/lib/X11/fonts/TTF
! 9911: </pre>
! 9912:
! 9913: <div class="sect2" lang="en">
! 9914: <div class="titlepage">
! 9915: <div>
! 9916: <div>
! 9917: <h3 class="title"><a name=
! 9918: "fonts-disable"></a>12.6.1. Disabling
! 9919: automatic update of the fonts databases</h3>
! 9920: </div>
! 9921: </div>
! 9922: </div>
! 9923:
! 9924: <p>The automatic update of fonts databases can be
! 9925: disabled by the administrator by setting the
! 9926: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 9927: class="filename">PKG_UPDATE_FONTS_DB</code> environment
! 9928: variable to <code class="literal">NO</code>.</p>
! 9929: </div>
! 9930: </div>
1.35 jmmv 9931: </div>
9932:
1.63 dillo 9933: <div class="chapter" lang="en">
1.35 jmmv 9934: <div class="titlepage">
9935: <div>
9936: <div>
1.63 dillo 9937: <h2 class="title"><a name=
1.38 dillo 9938: "options"></a>Chapter 13. Options
1.35 jmmv 9939: handling</h2>
9940: </div>
9941: </div>
9942: </div>
9943:
9944: <div class="toc">
9945: <p><b>Table of Contents</b></p>
9946:
9947: <dl>
9948: <dt><span class="sect1"><a href=
1.38 dillo 9949: "#global-default-options">13.1. Global default
1.35 jmmv 9950: options</a></span></dt>
9951:
9952: <dt><span class="sect1"><a href=
1.38 dillo 9953: "#converting-to-options">13.2. Converting packages to
1.45 wiz 9954: use <code xmlns=
9955: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9956: "filename">bsd.options.mk</code></a></span></dt>
1.48 dillo 9957:
9958: <dt><span class="sect1"><a href="#option-names">13.3.
9959: Option Names</a></span></dt>
1.35 jmmv 9960: </dl>
9961: </div>
9962:
9963: <p>Many packages have the ability to be built to support
1.45 wiz 9964: different sets of features. <code xmlns=
9965: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 9966: "filename">bsd.options.mk</code> is a framework in pkgsrc
9967: that provides generic handling of those options that
9968: determine different ways in which the packages can be
9969: built. It's possible for the user to specify exactly which
9970: sets of options will be built into a package or to allow a
9971: set of global default options apply.</p>
9972:
1.63 dillo 9973: <div class="sect1" lang="en">
1.35 jmmv 9974: <div class="titlepage">
9975: <div>
9976: <div>
9977: <h2 class="title" style="clear: both"><a name=
1.38 dillo 9978: "global-default-options"></a>13.1. Global
1.35 jmmv 9979: default options</h2>
9980: </div>
9981: </div>
9982: </div>
9983:
9984: <p>Global default options are listed in <code class=
9985: "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
9986: the options that should be built into every package if
9987: that option is supported. This variable should be set in
1.45 wiz 9988: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
9989: class="filename">/etc/mk.conf</code>.</p>
1.35 jmmv 9990: </div>
9991:
1.63 dillo 9992: <div class="sect1" lang="en">
1.35 jmmv 9993: <div class="titlepage">
9994: <div>
9995: <div>
9996: <h2 class="title" style="clear: both"><a name=
1.38 dillo 9997: "converting-to-options"></a>13.2. Converting
1.45 wiz 9998: packages to use <code xmlns=
9999: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10000: "filename">bsd.options.mk</code></h2>
10001: </div>
10002: </div>
10003: </div>
10004:
1.45 wiz 10005: <p>The following example shows how <code xmlns=
10006: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10007: "filename">bsd.options.mk</code> should be used by the
10008: hypothetical ``wibble'' package, either in the package
1.45 wiz 10009: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10010: class="filename">Makefile</code>, or in a file, e.g.
10011: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10012: class="filename">options.mk</code>, that is included by
10013: the main package <code xmlns=
10014: "http://www.w3.org/TR/xhtml1/transitional" class=
1.35 jmmv 10015: "filename">Makefile</code>.</p>
10016: <pre class="programlisting">
1.51 rillig 10017: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
10018: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
10019: PKG_OPTIONS_OPTIONAL_GROUPS= database
10020: PKG_OPTIONS_GROUP.database= mysql pgsql
10021: PKG_SUGGESTED_OPTIONS= wibble-foo
10022: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
10023: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
10024:
10025: .include "../../mk/bsd.prefs.mk"
10026:
10027: # this package was previously named wibble2
10028: .if defined(PKG_OPTIONS.wibble2)
10029: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
10030: PKG_OPTIONS_DEPRECATED_WARNINGS+= \
10031: "Deprecated variable PKG_OPTIONS.wibble2 used, use "${PKG_OPTIONS_VAR:Q}" instead."
10032: .endif
10033:
10034: .include "../../mk/bsd.options.mk"
10035:
10036: # Package-specific option-handling
10037:
10038: ###
10039: ### FOO support
10040: ###
10041: .if !empty(PKG_OPTIONS:Mwibble-foo)
10042: CONFIGURE_ARGS+= --enable-foo
10043: .endif
10044:
10045: ###
10046: ### LDAP support
10047: ###
10048: .if !empty(PKG_OPTIONS:Mldap)
10049: . include "../../databases/openldap/buildlink3.mk"
10050: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
10051: .endif
10052:
10053: ###
10054: ### database support
10055: ###
10056: .if !empty(PKG_OPTIONS:Mmysql)
10057: . include "../../mk/mysql.buildlink3.mk"
10058: .endif
10059: .if !empty(PKG_OPTIONS:Mpgsql)
10060: . include "../../mk/pgsql.buildlink3.mk"
10061: .endif
1.1 grant 10062: </pre>
10063:
1.28 rillig 10064: <p>The first section contains the information about which
10065: build options are supported by the package, and any
1.1 grant 10066: default options settings if needed.</p>
10067:
10068: <div class="orderedlist">
10069: <ol type="1">
10070: <li>
1.14 xtraeme 10071: <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27 rillig 10072: the name of the <a href=
1.1 grant 10073: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
10074: <span class="citerefentry"><span class=
1.27 rillig 10075: "refentrytitle">make</span>(1)</span></a> variable
1.37 dillo 10076: that the user can set to override the default
1.57 minskim 10077: options. It should be set to PKG_OPTIONS.<em class=
1.63 dillo 10078: "replaceable"><code>pkgbase</code></em>. Do not set
10079: it to PKG_OPTIONS.${PKGBASE}, since <code class=
10080: "varname">PKGBASE</code> is set after <code class=
10081: "varname">PKG_OPTIONS_VAR</code> is used.</p>
1.1 grant 10082: </li>
10083:
10084: <li>
1.14 xtraeme 10085: <p><code class=
10086: "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37 dillo 10087: build options supported by the package.</p>
10088: </li>
10089:
10090: <li>
10091: <p><code class=
10092: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
10093: list of names of groups of mutually exclusive
10094: options. The options in each group are listed in
10095: <code class="varname">PKG_OPTIONS_GROUP.<em class=
10096: "replaceable"><code>groupname</code></em></code>.
10097: The most specific setting of any option from the
10098: group takes precedence over all other options in
10099: the group. Options from the groups will be
10100: automatically added to <code class=
10101: "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
10102: </li>
10103:
10104: <li>
10105: <p><code class=
10106: "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
10107: like <code class=
10108: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
10109: building the packages will fail if no option from
10110: the group is selected.</p>
1.1 grant 10111: </li>
10112:
10113: <li>
1.27 rillig 10114: <p><code class=
1.44 gdt 10115: "varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a
10116: list of names of sets of options. At least one
10117: option from each set must be selected. The options
10118: in each set are listed in <code class=
10119: "varname">PKG_OPTIONS_SET.<em class=
10120: "replaceable"><code>setname</code></em></code>.
10121: Options from the sets will be automatically added
10122: to <code class=
10123: "varname">PKG_SUPPORTED_OPTIONS</code>. Building
10124: the package will fail if no option from the set is
10125: selected.</p>
10126: </li>
10127:
10128: <li>
10129: <p><code class=
1.27 rillig 10130: "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
10131: build options which are enabled by default.</p>
10132: </li>
10133:
10134: <li>
1.37 dillo 10135: <p><code class=
10136: "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
10137: of “<span class="quote"><em class=
1.63 dillo 10138: "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable"><code>option</code></em></span>”
10139: pairs that map legacy <code xmlns=
1.45 wiz 10140: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 10141: "filename">/etc/mk.conf</code> variables to their
10142: option counterparts. Pairs should be added with
10143: “<span class="quote">+=</span>” to keep
10144: the listing of global legacy variables. A warning
10145: will be issued if the user uses a legacy
10146: variable.</p>
10147: </li>
1.1 grant 10148:
1.37 dillo 10149: <li>
10150: <p><code class=
10151: "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
10152: of “<span class="quote"><em class=
1.63 dillo 10153: "replaceable"><code>old-option</code></em>:<em class="replaceable"><code>new-option</code></em></span>”
10154: pairs that map options that have been renamed to
10155: their new counterparts. Pairs should be added with
1.37 dillo 10156: “<span class="quote">+=</span>” to keep
10157: the listing of global legacy options. A warning
10158: will be issued if the user uses a legacy
10159: option.</p>
10160: </li>
1.1 grant 10161:
1.37 dillo 10162: <li>
10163: <p><code class="varname">PKG_LEGACY_OPTIONS</code>
10164: is a list of options implied by deprecated
10165: variables used. This can be used for cases that
10166: neither <code class=
10167: "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
10168: <code class=
10169: "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
10170: handle, e. g. when <code class=
10171: "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1 grant 10172: </li>
10173:
10174: <li>
1.37 dillo 10175: <p><code class=
10176: "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
10177: a list of warnings about deprecated variables or
10178: options used, and what to use instead.</p>
1.1 grant 10179: </li>
1.28 rillig 10180: </ol>
1.1 grant 10181: </div>
10182:
1.37 dillo 10183: <p>A package should never modify <code class=
10184: "varname">PKG_DEFAULT_OPTIONS</code> or the variable
10185: named in <code class="varname">PKG_OPTIONS_VAR</code>.
10186: These are strictly user-settable. To suggest a default
10187: set of options, use <code class=
10188: "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
10189:
1.42 dillo 10190: <p><code class="varname">PKG_OPTIONS_VAR</code> must be
1.45 wiz 10191: defined before including <code xmlns=
10192: "http://www.w3.org/TR/xhtml1/transitional" class=
1.42 dillo 10193: "filename">bsd.options.mk</code>. If none of <code class=
1.37 dillo 10194: "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
10195: "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
10196: <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
1.47 reed 10197: are defined (as can happen with platform-specific options
1.42 dillo 10198: if none of them is supported on the current platform),
10199: <code class="varname">PKG_OPTIONS</code> is set to the
10200: empty list and the package is otherwise treated as not
10201: using the options framework.</p>
1.37 dillo 10202:
1.45 wiz 10203: <p>After the inclusion of <code xmlns=
10204: "http://www.w3.org/TR/xhtml1/transitional" class=
1.37 dillo 10205: "filename">bsd.options.mk</code>, the variable
1.28 rillig 10206: <code class="varname">PKG_OPTIONS</code> contains the
1.37 dillo 10207: list of selected build options, properly filtered to
1.28 rillig 10208: remove unsupported and duplicate options.</p>
10209:
1.1 grant 10210: <p>The remaining sections contain the logic that is
1.37 dillo 10211: specific to each option. The correct way to check for an
10212: option is to check whether it is listed in <code class=
10213: "varname">PKG_OPTIONS</code>:</p>
10214: <pre class="programlisting">
1.51 rillig 10215: .if !empty(PKG_OPTIONS:M<em class=
1.37 dillo 10216: "replaceable"><code>option</code></em>)
10217: </pre>
1.48 dillo 10218: </div>
1.37 dillo 10219:
1.63 dillo 10220: <div class="sect1" lang="en">
1.48 dillo 10221: <div class="titlepage">
10222: <div>
10223: <div>
10224: <h2 class="title" style="clear: both"><a name=
10225: "option-names"></a>13.3. Option Names</h2>
10226: </div>
10227: </div>
10228: </div>
10229:
10230: <p>Options that enable similar features in different
10231: packages (like optional support for a library) should use
10232: a common name in all packages that support it (like the
10233: name of the library). If another package already has an
10234: option with the same meaning, use the same name.</p>
10235:
10236: <p>Options that enable features specific to one package,
10237: where it's unlikely that another (unrelated) package has
10238: the same (or a similar) optional feature, should use a
10239: name prefixed with <code class="varname"><em class=
10240: "replaceable"><code>pkgname</code></em>-</code>.</p>
10241:
10242: <p>If a group of related packages share an optional
10243: feature specific to that group, prefix it with the name
10244: of the “<span class="quote">main</span>”
10245: package (e. g. <code class=
10246: "varname">djbware-errno-hack</code>).</p>
10247:
10248: <p>For new options, add a line to <code xmlns=
10249: "http://www.w3.org/TR/xhtml1/transitional" class=
10250: "filename">mk/defaults/options.description</code>. Lines
10251: have two fields, separated by tab. The first field is the
10252: option name, the second its description. The description
10253: should be a whole sentence (starting with an uppercase
10254: letter and ending with a period) that describes what
10255: enabling the option does. E. g. “<span class=
10256: "quote">Enable ispell support.</span>” The file is
10257: sorted by option names.</p>
1.1 grant 10258: </div>
10259: </div>
10260:
1.63 dillo 10261: <div class="chapter" lang="en">
1.1 grant 10262: <div class="titlepage">
10263: <div>
10264: <div>
1.63 dillo 10265: <h2 class="title"><a name=
1.38 dillo 10266: "build"></a>Chapter 14. The build
1.1 grant 10267: process</h2>
10268: </div>
10269: </div>
10270: </div>
10271:
10272: <div class="toc">
10273: <p><b>Table of Contents</b></p>
10274:
10275: <dl>
1.56 rillig 10276: <dt><span class="sect1"><a href="#build.intro">14.1.
10277: Introduction</a></span></dt>
10278:
10279: <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1 grant 10280: Program location</a></span></dt>
10281:
1.56 rillig 10282: <dt><span class="sect1"><a href=
10283: "#build.builddirs">14.3. Directories used during the
10284: build process</a></span></dt>
10285:
10286: <dt><span class="sect1"><a href="#build.running">14.4.
10287: Running a phase</a></span></dt>
10288:
10289: <dt><span class="sect1"><a href="#build.fetch">14.5.
10290: The <span class="emphasis"><em>fetch</em></span>
10291: phase</a></span></dt>
10292:
10293: <dt><span class="sect1"><a href="#build.checksum">14.6.
10294: The <span class="emphasis"><em>checksum</em></span>
10295: phase</a></span></dt>
10296:
10297: <dt><span class="sect1"><a href="#build.extract">14.7.
10298: The <span class="emphasis"><em>extract</em></span>
10299: phase</a></span></dt>
10300:
10301: <dt><span class="sect1"><a href="#build.patch">14.8.
10302: The <span class="emphasis"><em>patch</em></span>
10303: phase</a></span></dt>
10304:
10305: <dt><span class="sect1"><a href="#build.tools">14.9.
10306: The <span class="emphasis"><em>tools</em></span>
10307: phase</a></span></dt>
10308:
10309: <dt><span class="sect1"><a href="#build.wrapper">14.10.
10310: The <span class="emphasis"><em>wrapper</em></span>
10311: phase</a></span></dt>
1.1 grant 10312:
10313: <dt><span class="sect1"><a href=
1.56 rillig 10314: "#build.configure">14.11. The <span class=
10315: "emphasis"><em>configure</em></span>
10316: phase</a></span></dt>
10317:
10318: <dt><span class="sect1"><a href="#build.build">14.12.
10319: The <span class="emphasis"><em>build</em></span>
10320: phase</a></span></dt>
10321:
10322: <dt><span class="sect1"><a href="#build.test">14.13.
10323: The <span class="emphasis"><em>test</em></span>
10324: phase</a></span></dt>
10325:
10326: <dt><span class="sect1"><a href="#build.install">14.14.
10327: The <span class="emphasis"><em>install</em></span>
10328: phase</a></span></dt>
10329:
10330: <dt><span class="sect1"><a href="#build.package">14.15.
10331: The <span class="emphasis"><em>package</em></span>
10332: phase</a></span></dt>
10333:
10334: <dt><span class="sect1"><a href=
10335: "#build.helpful-targets">14.16. Other helpful
1.1 grant 10336: targets</a></span></dt>
10337: </dl>
10338: </div>
10339:
1.63 dillo 10340: <div class="sect1" lang="en">
1.56 rillig 10341: <div class="titlepage">
10342: <div>
10343: <div>
10344: <h2 class="title" style="clear: both"><a name=
10345: "build.intro"></a>14.1. Introduction</h2>
10346: </div>
10347: </div>
10348: </div>
10349:
10350: <p>This chapter gives a detailed description on how a
10351: package is built. Building a package is separated into
10352: different <span class="emphasis"><em>phases</em></span>
10353: (for example <code class="varname">fetch</code>,
10354: <code class="varname">build</code>, <code class=
10355: "varname">install</code>), all of which are described in
10356: the following sections. Each phase is splitted into
10357: so-called <span class="emphasis"><em>stages</em></span>,
10358: which take the name of the containing stage, prefixed by
10359: one of <code class="varname">pre-</code>, <code class=
10360: "varname">do-</code> or <code class=
10361: "varname">post-</code>. (Examples are <code class=
10362: "varname">pre-configure</code>, <code class=
10363: "varname">post-build</code>.) Most of the actual work is
10364: done in the <code class="varname">do-*</code> stages.</p>
10365:
10366: <p>The basic steps for building a program are always the
10367: same. First the program's source (<span class=
10368: "emphasis"><em>distfile</em></span>) must be brought to
10369: the local system and then extracted. After any patches to
10370: compile properly on NetBSD are applied, the software can
10371: be configured, then built (usually by compiling), and
10372: finally the generated binaries, etc. can be put into
10373: place on the system. These are exactly the steps
10374: performed by the NetBSD package system, which is
10375: implemented as a series of targets in a central Makefile,
10376: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10377: class="filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
10378: </div>
1.1 grant 10379:
1.63 dillo 10380: <div class="sect1" lang="en">
1.1 grant 10381: <div class="titlepage">
10382: <div>
10383: <div>
10384: <h2 class="title" style="clear: both"><a name=
1.56 rillig 10385: "build.prefix"></a>14.2. Program location</h2>
1.1 grant 10386: </div>
10387: </div>
10388: </div>
10389:
10390: <p>Before outlining the process performed by the NetBSD
10391: package system in the next section, here's a brief
10392: discussion on where programs are installed, and which
10393: variables influence this.</p>
10394:
1.14 xtraeme 10395: <p>The automatic variable <code class=
10396: "varname">PREFIX</code> indicates where all files of the
10397: final program shall be installed. It is usually set to
1.45 wiz 10398: <code class="varname">LOCALBASE</code> (<code xmlns=
10399: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10400: "filename">/usr/pkg</code>), or <code class=
10401: "varname">CROSSBASE</code> for pkgs in the
1.1 grant 10402: “<span class="quote">cross</span>” category.
1.14 xtraeme 10403: The value of <code class="varname">PREFIX</code> needs to
10404: be put into the various places in the program's source
10405: where paths to these files are encoded. See <a href=
1.1 grant 10406: "#components.patches" title=
1.38 dillo 10407: "8.3. patches/*">Section 8.3,
1.1 grant 10408: “patches/*”</a> and <a href="#fixes.libtool"
10409: title=
1.38 dillo 10410: "15.3.1. Shared libraries - libtool">Section 15.3.1,
1.1 grant 10411: “Shared libraries - libtool”</a> for more
10412: details.</p>
10413:
10414: <p>When choosing which of these variables to use, follow
10415: the following rules:</p>
10416:
10417: <div class="itemizedlist">
10418: <ul type="disc">
10419: <li>
1.14 xtraeme 10420: <p><code class="varname">PREFIX</code> always
10421: points to the location where the current pkg will
10422: be installed. When referring to a pkg's own
1.1 grant 10423: installation path, use “<span class=
10424: "quote">${PREFIX}</span>”.</p>
10425: </li>
10426:
10427: <li>
1.14 xtraeme 10428: <p><code class="varname">LOCALBASE</code> is where
10429: all non-X11 pkgs are installed. If you need to
1.1 grant 10430: construct a -I or -L argument to the compiler to
10431: find includes and libraries installed by another
10432: non-X11 pkg, use “<span class=
10433: "quote">${LOCALBASE}</span>”.</p>
10434: </li>
10435:
10436: <li>
1.14 xtraeme 10437: <p><code class="varname">X11BASE</code> is where
10438: the actual X11 distribution (from xsrc, etc.) is
1.1 grant 10439: installed. When looking for <span class=
10440: "emphasis"><em>standard</em></span> X11 includes
10441: (not those installed by a pkg), use
10442: “<span class=
10443: "quote">${X11BASE}</span>”.</p>
10444: </li>
10445:
10446: <li>
1.47 reed 10447: <p>X11-based packages are special in that they may
10448: be installed in either <code class=
1.14 xtraeme 10449: "varname">X11BASE</code> or <code class=
10450: "varname">LOCALBASE</code>.</p>
1.1 grant 10451:
10452: <p>Usually, X11 packages should be installed under
1.14 xtraeme 10453: <code class="varname">LOCALBASE</code> whenever
1.34 wiz 10454: possible. Note that you will need to include
1.45 wiz 10455: <code xmlns=
10456: "http://www.w3.org/TR/xhtml1/transitional" class=
1.34 wiz 10457: "filename">../../mk/x11.buildlink3.mk</code> in
10458: them to request the presence of X11 and to get the
10459: right compilation flags.</p>
1.1 grant 10460:
10461: <p>Even though, there are some packages that cannot
1.14 xtraeme 10462: be installed under <code class=
10463: "varname">LOCALBASE</code>: those that come with
1.1 grant 10464: app-defaults files. These packages are special and
1.14 xtraeme 10465: they must be placed under <code class=
10466: "varname">X11BASE</code>. To accomplish this, set
10467: either <code class="varname">USE_X11BASE</code> or
10468: <code class="varname">USE_IMAKE</code> in your
1.1 grant 10469: package.</p>
10470:
1.34 wiz 10471: <p>Some notes: If you need to find includes or
1.14 xtraeme 10472: libraries installed by a pkg that has <code class=
10473: "varname">USE_IMAKE</code> or <code class=
10474: "varname">USE_X11BASE</code> in its pkg
1.45 wiz 10475: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10476: class="filename">Makefile</code>, you need to look
10477: in <span class="emphasis"><em>both</em></span>
10478: <code xmlns=
10479: "http://www.w3.org/TR/xhtml1/transitional" class=
10480: "filename">${X11BASE}</code> and <code xmlns=
10481: "http://www.w3.org/TR/xhtml1/transitional" class=
10482: "filename">${LOCALBASE}</code>. To force
10483: installation of all X11 packages in <code class=
10484: "varname">LOCALBASE</code>, the <a xmlns=
10485: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 10486: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45 wiz 10487: target="_top"><code xmlns="" class=
10488: "filename">pkgtools/xpkgwedge</code></a> package is
1.34 wiz 10489: enabled by default.</p>
1.1 grant 10490: </li>
10491:
10492: <li>
1.14 xtraeme 10493: <p><code class="varname">X11PREFIX</code> should be
1.1 grant 10494: used to refer to the installed location of an X11
1.14 xtraeme 10495: package. <code class="varname">X11PREFIX</code>
10496: will be set to <code class="varname">X11BASE</code>
10497: if xpkgwedge is not installed, and to <code class=
10498: "varname">LOCALBASE</code> if xpkgwedge is
1.1 grant 10499: installed.</p>
10500: </li>
10501:
10502: <li>
10503: <p>If xpkgwedge is installed, it is possible to
1.14 xtraeme 10504: have some packages installed in <code class=
10505: "varname">X11BASE</code> and some in <code class=
10506: "varname">LOCALBASE</code>. To determine the prefix
10507: of an installed package, the <code class=
10508: "varname">EVAL_PREFIX</code> definition can be
10509: used. It takes pairs in the format
10510: “<span class=
1.1 grant 10511: "quote">DIRNAME=<package></span>”, and
1.24 wiz 10512: the <a href=
10513: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
10514: <span class="citerefentry"><span class=
10515: "refentrytitle">make</span>(1)</span></a> variable
10516: <code class="varname">DIRNAME</code> will be set to
10517: the prefix of the installed package
10518: <package>, or “<span class=
1.1 grant 10519: "quote">${X11PREFIX}</span>” if the package
10520: is not installed.</p>
10521:
10522: <p>This is best illustrated by example.</p>
10523:
1.45 wiz 10524: <p>The following lines are taken from <code xmlns=
10525: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10526: "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1 grant 10527: <pre class="programlisting">
1.51 rillig 10528: EVAL_PREFIX+= GTKDIR=gtk+
10529: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE} \
10530: --with-gtk-prefix="${GTKDIR}" \
10531: --enable-multibyte
1.1 grant 10532: </pre>
10533:
10534: <p>Specific defaults can be defined for the
1.14 xtraeme 10535: packages evaluated using <code class=
10536: "varname">EVAL_PREFIX</code>, by using a definition
1.1 grant 10537: of the form:</p>
10538: <pre class="programlisting">
1.51 rillig 10539: GTKDIR_DEFAULT= ${LOCALBASE}
1.1 grant 10540: </pre>
10541:
1.14 xtraeme 10542: <p>where <code class="varname">GTKDIR</code>
1.1 grant 10543: corresponds to the first definition in the
1.14 xtraeme 10544: <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1 grant 10545: </li>
10546:
10547: <li>
1.45 wiz 10548: <p>Within <code xmlns=
10549: "http://www.w3.org/TR/xhtml1/transitional" class=
10550: "filename">${PREFIX}</code>, packages should
10551: install files according to <a href=
1.24 wiz 10552: "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
10553: <span class="citerefentry"><span class=
10554: "refentrytitle">hier</span>(7)</span></a>, with the
1.45 wiz 10555: exception that manual pages go into <code xmlns=
10556: "http://www.w3.org/TR/xhtml1/transitional" class=
10557: "filename">${PREFIX}/man</code>, not <code xmlns=
10558: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 10559: "filename">${PREFIX}/share/man</code>.</p>
1.1 grant 10560: </li>
10561: </ul>
10562: </div>
10563: </div>
10564:
1.63 dillo 10565: <div class="sect1" lang="en">
1.1 grant 10566: <div class="titlepage">
10567: <div>
10568: <div>
10569: <h2 class="title" style="clear: both"><a name=
1.56 rillig 10570: "build.builddirs"></a>14.3. Directories used
10571: during the build process</h2>
1.1 grant 10572: </div>
10573: </div>
10574: </div>
10575:
1.56 rillig 10576: <p>When building a package, a number of directories is
10577: used to store source files, temporary files,
10578: pkgsrc-internal files, and so on. These directories are
10579: explained here.</p>
10580:
10581: <p>Some of the directory variables contain relative
10582: pathnames. There are two common base directories for
10583: these relative directories: <code class=
10584: "varname">PKGSRCDIR/PKGPATH</code> is used for
10585: directories that are pkgsrc-specific. <code class=
10586: "varname">WRKSRC</code> is used for directories inside
10587: the package itself. The permissions after each variable
10588: indicate whether the variable may be changed by the
10589: package Makefile.</p>
1.1 grant 10590:
10591: <div class="variablelist">
10592: <dl>
1.56 rillig 10593: <dt><span class="term"><code class=
10594: "varname">PKGSRCDIR</code> (read-only)</span></dt>
10595:
10596: <dd>
10597: <p>This is an absolute pathname that points to the
10598: pkgsrc root directory. Generally, you don't need
10599: it.</p>
10600: </dd>
10601:
10602: <dt><span class="term"><code class=
10603: "varname">PKGPATH</code> (read-only)</span></dt>
1.1 grant 10604:
10605: <dd>
1.56 rillig 10606: <p>This is a pathname relative to <code class=
10607: "varname">PKGSRCDIR</code> that points to the
10608: current package.</p>
10609: </dd>
10610:
10611: <dt><span class="term"><code class=
10612: "varname">WRKDIR</code> (read-only)</span></dt>
10613:
10614: <dd>
10615: <p>This is an absolute pathname pointing to the
1.57 minskim 10616: directory where all work takes place. The distfiles
10617: are extraced to this directory. It also contains
10618: temporary directories and log files used by the
10619: various pkgsrc frameworks, like <span class=
10620: "emphasis"><em>buildlink</em></span> or the
10621: <span class=
1.56 rillig 10622: "emphasis"><em>wrappers</em></span>.</p>
10623: </dd>
10624:
10625: <dt><span class="term"><code class=
10626: "varname">WRKSRC</code> (read-write)</span></dt>
10627:
10628: <dd>
10629: <p>This is an absolute pathname pointing to the
10630: directory where the distfiles are extracted. It is
10631: usually a direct subdirectory of <code class=
10632: "varname">WRKDIR</code>, and often it's the only
10633: directory entry that isn't hidden.</p>
10634: </dd>
10635: </dl>
10636: </div>
10637: </div>
10638:
1.63 dillo 10639: <div class="sect1" lang="en">
1.56 rillig 10640: <div class="titlepage">
10641: <div>
10642: <div>
10643: <h2 class="title" style="clear: both"><a name=
10644: "build.running"></a>14.4. Running a phase</h2>
10645: </div>
10646: </div>
10647: </div>
10648:
10649: <p>You can run a particular phase by typing
10650: <span><strong class="command">make phase</strong></span>,
10651: where <span class="emphasis"><em>phase</em></span> is the
10652: name of the phase. This will automatically run all phases
10653: that are required for this phase. The default phase is
10654: <code class="varname">build</code>, that is, when you run
10655: <span><strong class="command">make</strong></span>
10656: without parameters in a package directory, the package
10657: will be built, but not installed.</p>
10658: </div>
10659:
1.63 dillo 10660: <div class="sect1" lang="en">
1.56 rillig 10661: <div class="titlepage">
10662: <div>
10663: <div>
10664: <h2 class="title" style="clear: both"><a name=
1.63 dillo 10665: "build.fetch"></a>14.5. The <span class=
10666: "emphasis"><em>fetch</em></span> phase</h2>
1.56 rillig 10667: </div>
10668: </div>
10669: </div>
10670:
10671: <p>This will check if the file(s) given in the variables
10672: <code class="varname">DISTFILES</code> and <code class=
10673: "varname">PATCHFILES</code> (as defined in the package's
10674: Makefile) are present on the local system in <code xmlns=
10675: "http://www.w3.org/TR/xhtml1/transitional" class=
10676: "filename">/usr/pkgsrc/distfiles</code>. If they are not
10677: present, an attempt will be made to fetch them using
10678: commands of the form:</p>
10679: <pre class="programlisting">
1.51 rillig 10680: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
1.1 grant 10681: </pre>
10682:
1.56 rillig 10683: <p>where ${site} varies through several possibilities in
10684: turn: first, <code class=
10685: "varname">MASTER_SITE_OVERRIDE</code> is tried, then the
10686: sites specified in either <code class=
10687: "varname">SITES_file</code> if defined, else <code class=
10688: "varname">MASTER_SITES</code> or <code class=
10689: "varname">PATCH_SITES</code>, as applies, then finally
10690: the value of <code class=
10691: "varname">MASTER_SITE_BACKUP</code>. The order of all
10692: except the first can be optionally sorted by the user,
10693: via setting either <code class=
10694: "varname">MASTER_SORT_AWK</code> or <code class=
10695: "varname">MASTER_SORT_REGEX</code>.</p>
10696: </div>
10697:
1.63 dillo 10698: <div class="sect1" lang="en">
1.56 rillig 10699: <div class="titlepage">
10700: <div>
10701: <div>
10702: <h2 class="title" style="clear: both"><a name=
10703: "build.checksum"></a>14.6. The <span class=
10704: "emphasis"><em>checksum</em></span> phase</h2>
10705: </div>
10706: </div>
10707: </div>
10708:
10709: <p>After the distfile(s) are fetched, their checksum is
10710: generated and compared with the checksums stored in the
10711: distinfo file. If the checksums don't match, the build is
10712: aborted. This is to ensure the same distfile is used for
10713: building, and that the distfile wasn't changed, e.g. by
10714: some malign force, deliberately changed distfiles on the
10715: master distribution site or network lossage.</p>
10716: </div>
10717:
1.63 dillo 10718: <div class="sect1" lang="en">
1.56 rillig 10719: <div class="titlepage">
10720: <div>
10721: <div>
10722: <h2 class="title" style="clear: both"><a name=
10723: "build.extract"></a>14.7. The <span class=
10724: "emphasis"><em>extract</em></span> phase</h2>
10725: </div>
10726: </div>
10727: </div>
10728:
10729: <p>When the distfiles are present on the local system,
10730: they need to be extracted, as they are usually in the
10731: form of some compressed archive format, most commonly
10732: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10733: class="filename">.tar.gz</code>.</p>
1.1 grant 10734:
1.56 rillig 10735: <p>If only some of the distfiles need to be uncompressed,
10736: the files to be uncompressed should be put into
10737: <code class="varname">EXTRACT_ONLY</code>.</p>
1.1 grant 10738:
1.56 rillig 10739: <p>If the distfiles are not in <code xmlns=
10740: "http://www.w3.org/TR/xhtml1/transitional" class=
10741: "filename">.tar.gz</code> format, they can be extracted
10742: by setting either <code class=
10743: "varname">EXTRACT_SUFX</code>, or <code class=
10744: "varname">EXTRACT_CMD</code>, <code class=
10745: "varname">EXTRACT_BEFORE_ARGS</code> and <code class=
10746: "varname">EXTRACT_AFTER_ARGS</code>. In the former case,
10747: pkgsrc knows how to extract a number of suffixes
10748: (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10749: class="filename">.tar.gz</code>, <code xmlns=
10750: "http://www.w3.org/TR/xhtml1/transitional" class=
10751: "filename">.tgz</code>, <code xmlns=
10752: "http://www.w3.org/TR/xhtml1/transitional" class=
10753: "filename">.tar.gz2</code>, <code xmlns=
10754: "http://www.w3.org/TR/xhtml1/transitional" class=
10755: "filename">.tbz</code>, <code xmlns=
10756: "http://www.w3.org/TR/xhtml1/transitional" class=
10757: "filename">.tar.Z</code>, <code xmlns=
10758: "http://www.w3.org/TR/xhtml1/transitional" class=
10759: "filename">.tar</code>, <code xmlns=
10760: "http://www.w3.org/TR/xhtml1/transitional" class=
10761: "filename">.shar.gz</code>, <code xmlns=
10762: "http://www.w3.org/TR/xhtml1/transitional" class=
10763: "filename">.shar.bz2</code>, <code xmlns=
10764: "http://www.w3.org/TR/xhtml1/transitional" class=
10765: "filename">.shar.Z</code>, <code xmlns=
10766: "http://www.w3.org/TR/xhtml1/transitional" class=
10767: "filename">.shar</code>, <code xmlns=
10768: "http://www.w3.org/TR/xhtml1/transitional" class=
10769: "filename">.Z</code>, <code xmlns=
10770: "http://www.w3.org/TR/xhtml1/transitional" class=
10771: "filename">.bz2</code> and <code xmlns=
10772: "http://www.w3.org/TR/xhtml1/transitional" class=
10773: "filename">.gz</code>; see the definition of the various
10774: <code class="varname">DECOMPRESS_CMD</code> variables in
10775: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
10776: class="filename">bsd.pkg.extract.mk</code> for a complete
10777: list). Here's an example on how to use the other
10778: variables for a program that comes with a compressed
10779: shell archive whose name ends in <code xmlns=
10780: "http://www.w3.org/TR/xhtml1/transitional" class=
10781: "filename">.msg.gz</code>:</p>
10782: <pre class="programlisting">
1.51 rillig 10783: EXTRACT_SUFX= .msg.gz
10784: EXTRACT_CMD= zcat
10785: EXTRACT_BEFORE_ARGS=
10786: EXTRACT_AFTER_ARGS= |sh
1.1 grant 10787: </pre>
1.56 rillig 10788: </div>
10789:
1.63 dillo 10790: <div class="sect1" lang="en">
1.56 rillig 10791: <div class="titlepage">
10792: <div>
10793: <div>
10794: <h2 class="title" style="clear: both"><a name=
1.63 dillo 10795: "build.patch"></a>14.8. The <span class=
10796: "emphasis"><em>patch</em></span> phase</h2>
1.56 rillig 10797: </div>
10798: </div>
10799: </div>
10800:
10801: <p>After extraction, all the patches named by the
10802: <code class="varname">PATCHFILES</code>, those present in
10803: the patches subdirectory of the package as well as in
10804: $LOCALPATCHES/$PKGPATH (e.g. <code xmlns=
10805: "http://www.w3.org/TR/xhtml1/transitional" class=
10806: "filename">/usr/local/patches/graphics/png</code>) are
10807: applied. Patchfiles ending in <code xmlns=
10808: "http://www.w3.org/TR/xhtml1/transitional" class=
10809: "filename">.Z</code> or <code xmlns=
10810: "http://www.w3.org/TR/xhtml1/transitional" class=
10811: "filename">.gz</code> are uncompressed before they are
10812: applied, files ending in <code xmlns=
10813: "http://www.w3.org/TR/xhtml1/transitional" class=
10814: "filename">.orig</code> or <code xmlns=
10815: "http://www.w3.org/TR/xhtml1/transitional" class=
10816: "filename">.rej</code> are ignored. Any special options
10817: to <a href=
10818: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
10819: <span class="citerefentry"><span class=
10820: "refentrytitle">patch</span>(1)</span></a> can be handed
10821: in <code class="varname">PATCH_DIST_ARGS</code>. See
10822: <a href="#components.patches" title=
10823: "8.3. patches/*">Section 8.3,
10824: “patches/*”</a> for more details.</p>
10825:
10826: <p>By default <a href=
10827: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
10828: <span class="citerefentry"><span class=
10829: "refentrytitle">patch</span>(1)</span></a> is given
10830: special args to make it fail if the patches apply with
10831: some lines of fuzz. Please fix (regen) the patches so
10832: that they apply cleanly. The rationale behind this is
10833: that patches that don't apply cleanly may end up being
10834: applied in the wrong place, and cause severe harm
10835: there.</p>
10836: </div>
10837:
1.63 dillo 10838: <div class="sect1" lang="en">
1.56 rillig 10839: <div class="titlepage">
10840: <div>
10841: <div>
10842: <h2 class="title" style="clear: both"><a name=
1.63 dillo 10843: "build.tools"></a>14.9. The <span class=
10844: "emphasis"><em>tools</em></span> phase</h2>
1.56 rillig 10845: </div>
10846: </div>
10847: </div>
10848:
10849: <p>[TODO]</p>
10850: </div>
10851:
1.63 dillo 10852: <div class="sect1" lang="en">
1.56 rillig 10853: <div class="titlepage">
10854: <div>
10855: <div>
10856: <h2 class="title" style="clear: both"><a name=
10857: "build.wrapper"></a>14.10. The <span class=
10858: "emphasis"><em>wrapper</em></span> phase</h2>
10859: </div>
10860: </div>
10861: </div>
10862:
10863: <p>[TODO]</p>
10864: </div>
10865:
1.63 dillo 10866: <div class="sect1" lang="en">
1.56 rillig 10867: <div class="titlepage">
10868: <div>
10869: <div>
10870: <h2 class="title" style="clear: both"><a name=
10871: "build.configure"></a>14.11. The <span class=
10872: "emphasis"><em>configure</em></span> phase</h2>
10873: </div>
10874: </div>
10875: </div>
10876:
10877: <p>Most pieces of software need information on the header
10878: files, system calls, and library routines which are
10879: available on the platform they run on. The process of
10880: determining this information is known as configuration,
10881: and is usually automated. In most cases, a script is
10882: supplied with the distfiles, and its invocation results
10883: in generation of header files, Makefiles, etc.</p>
10884:
10885: <p>If the package contains a configure script, this can
10886: be invoked by setting <code class=
10887: "varname">HAS_CONFIGURE</code> to “<span class=
10888: "quote">yes</span>”. If the configure script is a
10889: GNU autoconf script, you should set <code class=
10890: "varname">GNU_CONFIGURE</code> to “<span class=
10891: "quote">yes</span>” instead. What happens in the
10892: <span class="emphasis"><em>configure</em></span> phase is
10893: roughly:</p>
10894: <pre class="programlisting">
10895: .for d in ${CONFIGURE_DIRS}
10896: cd ${WRKSRC} && cd ${d} && env ${CONFIGURE_ENV} \
10897: ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
10898: .endfor
10899: </pre>
1.1 grant 10900:
1.56 rillig 10901: <p><code class="varname">CONFIGURE_DIRS</code> (default:
10902: “<span class="quote">.</span>”) is a list of
10903: pathnames relative to <code class=
10904: "varname">WRKSRC</code>. In each of these directories,
10905: the configure script is run with the environment
10906: <code class="varname">CONFIGURE_ENV</code> and arguments
10907: <code class="varname">CONFIGURE_ARGS</code>. The
10908: variables <code class="varname">CONFIGURE_ENV</code>,
10909: <code class="varname">CONFIGURE_SCRIPT</code> (default:
10910: “<span class="quote">./configure</span>”) and
10911: <code class="varname">CONFIGURE_ARGS</code> may all be
10912: changed by the package.</p>
1.1 grant 10913:
1.56 rillig 10914: <p>If the program uses an <code xmlns=
10915: "http://www.w3.org/TR/xhtml1/transitional" class=
10916: "filename">Imakefile</code> for configuration, the
10917: appropriate steps can be invoked by setting <code class=
10918: "varname">USE_IMAKE</code> to “<span class=
10919: "quote">yes</span>”. (If you only want the package
10920: installed in <code class="varname">${X11PREFIX}</code>
10921: but xmkmf not being run, set <code class=
10922: "varname">USE_X11BASE</code> instead.)</p>
10923: </div>
1.1 grant 10924:
1.63 dillo 10925: <div class="sect1" lang="en">
1.56 rillig 10926: <div class="titlepage">
10927: <div>
10928: <div>
10929: <h2 class="title" style="clear: both"><a name=
1.63 dillo 10930: "build.build"></a>14.12. The <span class=
10931: "emphasis"><em>build</em></span> phase</h2>
1.56 rillig 10932: </div>
10933: </div>
1.1 grant 10934: </div>
10935:
1.56 rillig 10936: <p>For building a package, a rough equivalent of the
10937: following code is executed.</p>
1.1 grant 10938: <pre class="programlisting">
1.56 rillig 10939: .for d in ${BUILD_DIRS}
10940: cd ${WRKSRC} && cd ${d} && env ${MAKE_ENV} \
10941: ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} \
10942: -f ${MAKEFILE} ${BUILD_TARGET}
10943: .endfor
1.1 grant 10944: </pre>
1.56 rillig 10945:
10946: <p><code class="varname">BUILD_DIRS</code> (default:
10947: “<span class="quote">.</span>”) is a list of
10948: pathnames relative to <code class=
10949: "varname">WRKSRC</code>. In each of these directories,
10950: <code class="varname">MAKE_PROGRAM</code> is run with the
10951: environment <code class="varname">MAKE_ENV</code> and
10952: arguments <code class="varname">BUILD_MAKE_FLAGS</code>.
10953: The variables <code class="varname">MAKE_ENV</code>,
10954: <code class="varname">BUILD_MAKE_FLAGS</code>,
10955: <code class="varname">MAKEFILE</code> and <code class=
10956: "varname">BUILD_TARGET</code> may all be changed by the
10957: package.</p>
10958:
10959: <p>The default value of <code class=
10960: "varname">MAKE_PROGRAM</code> is “<span class=
10961: "quote">gmake</span>” if <code class=
10962: "varname">USE_TOOLS</code> contains “<span class=
10963: "quote">gmake</span>”, “<span class=
10964: "quote">make</span>” otherwise. The default value
10965: of <code class="varname">MAKEFILE</code> is
10966: “<span class="quote">Makefile</span>”, and
10967: <code class="varname">BUILD_TARGET</code> defaults to
10968: “<span class="quote">all</span>”.</p>
10969: </div>
10970:
1.63 dillo 10971: <div class="sect1" lang="en">
1.56 rillig 10972: <div class="titlepage">
10973: <div>
10974: <div>
10975: <h2 class="title" style="clear: both"><a name=
1.63 dillo 10976: "build.test"></a>14.13. The <span class=
10977: "emphasis"><em>test</em></span> phase</h2>
1.56 rillig 10978: </div>
10979: </div>
10980: </div>
10981:
10982: <p>[TODO]</p>
10983: </div>
10984:
1.63 dillo 10985: <div class="sect1" lang="en">
1.56 rillig 10986: <div class="titlepage">
10987: <div>
10988: <div>
10989: <h2 class="title" style="clear: both"><a name=
10990: "build.install"></a>14.14. The <span class=
10991: "emphasis"><em>install</em></span> phase</h2>
10992: </div>
10993: </div>
10994: </div>
10995:
10996: <p>Once the build stage has completed, the final step is
10997: to install the software in public directories, so users
10998: can access the programs and files. As in the
10999: build-target, <code class="varname">$MAKE_PROGRAM</code>
11000: is invoked on <code class="varname">$MAKEFILE</code>
11001: here, but with the <code class=
11002: "varname">$INSTALL_TARGET</code> instead, the latter
11003: defaulting to “<span class=
11004: "quote">install</span>” (plus “<span class=
11005: "quote">install.man</span>”, if <code class=
11006: "varname">USE_IMAKE</code> is set).</p>
11007: </div>
11008:
1.63 dillo 11009: <div class="sect1" lang="en">
1.56 rillig 11010: <div class="titlepage">
11011: <div>
11012: <div>
11013: <h2 class="title" style="clear: both"><a name=
11014: "build.package"></a>14.15. The <span class=
11015: "emphasis"><em>package</em></span> phase</h2>
11016: </div>
11017: </div>
11018: </div>
11019:
11020: <p>[TODO]</p>
1.1 grant 11021: </div>
11022:
1.63 dillo 11023: <div class="sect1" lang="en">
1.1 grant 11024: <div class="titlepage">
11025: <div>
11026: <div>
11027: <h2 class="title" style="clear: both"><a name=
1.56 rillig 11028: "build.helpful-targets"></a>14.16. Other
1.1 grant 11029: helpful targets</h2>
11030: </div>
11031: </div>
11032: </div>
11033:
11034: <div class="variablelist">
11035: <dl>
11036: <dt><span class="term">pre/post-*</span></dt>
11037:
11038: <dd>
11039: <p>For any of the main targets described in the
11040: previous section, two auxiliary targets exist with
11041: “<span class="quote">pre-</span>” and
11042: “<span class="quote">post-</span>” used
11043: as a prefix for the main target's name. These
11044: targets are invoked before and after the main
11045: target is called, allowing extra configuration or
11046: installation steps be performed from a package's
11047: Makefile, for example, which a program's configure
11048: script or install target omitted.</p>
11049: </dd>
11050:
11051: <dt><span class="term">do-*</span></dt>
11052:
11053: <dd>
11054: <p>Should one of the main targets do the wrong
11055: thing, and should there be no variable to fix this,
11056: you can redefine it with the do-* target. (Note
11057: that redefining the target itself instead of the
11058: do-* target is a bad idea, as the pre-* and post-*
11059: targets won't be called anymore, etc.) You will not
11060: usually need to do this.</p>
11061: </dd>
11062:
11063: <dt><span class="term">reinstall</span></dt>
11064:
11065: <dd>
1.14 xtraeme 11066: <p>If you did a <span><strong class="command">make
11067: install</strong></span> and you noticed some file
11068: was not installed properly, you can repeat the
1.1 grant 11069: installation with this target, which will ignore
11070: the “<span class="quote">already
11071: installed</span>” flag.</p>
11072: </dd>
11073:
11074: <dt><span class="term">deinstall</span></dt>
11075:
11076: <dd>
1.24 wiz 11077: <p>This target does a <a href=
11078: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
11079: <span class="citerefentry"><span class=
11080: "refentrytitle">pkg_delete</span>(1)</span></a> in
11081: the current directory, effectively de-installing
11082: the package. The following variables can be used to
11083: tune the behaviour:</p>
1.1 grant 11084:
11085: <div class="variablelist">
11086: <dl>
1.14 xtraeme 11087: <dt><span class="term"><code class=
11088: "varname">PKG_VERBOSE</code></span></dt>
1.1 grant 11089:
11090: <dd>
11091: <p>Add a "-v" to the <a href=
11092: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
11093: <span class="citerefentry"><span class=
11094: "refentrytitle">pkg_delete</span>(1)</span></a>
11095: command.</p>
11096: </dd>
11097:
1.14 xtraeme 11098: <dt><span class="term"><code class=
11099: "varname">DEINSTALLDEPENDS</code></span></dt>
1.1 grant 11100:
11101: <dd>
11102: <p>Remove all packages that require (depend
11103: on) the given package. This can be used to
11104: remove any packages that may have been pulled
11105: in by a given package, e.g. if
1.14 xtraeme 11106: <span><strong class="command">make deinstall
11107: DEINSTALLDEPENDS=1</strong></span> is done in
1.45 wiz 11108: <code xmlns=
11109: "http://www.w3.org/TR/xhtml1/transitional"
11110: class="filename">pkgsrc/x11/kde</code>, this
11111: is likely to remove whole KDE. Works by
1.1 grant 11112: adding “<span class=
11113: "quote">-R</span>” to the <a href=
11114: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
11115: <span class="citerefentry"><span class=
11116: "refentrytitle">pkg_delete</span>(1)</span></a>
11117: command line.</p>
11118: </dd>
11119: </dl>
11120: </div>
11121: </dd>
11122:
11123: <dt><span class="term">update</span></dt>
11124:
11125: <dd>
11126: <p>This target causes the current package to be
11127: updated to the latest version. The package and all
11128: depending packages first get de-installed, then
11129: current versions of the corresponding packages get
11130: compiled and installed. This is similar to manually
11131: noting which packages are currently installed, then
1.14 xtraeme 11132: performing a series of <span><strong class=
11133: "command">make deinstall</strong></span> and
11134: <span><strong class="command">make
11135: install</strong></span> (or whatever <code class=
11136: "varname">UPDATE_TARGET</code> is set to) for these
11137: packages.</p>
1.1 grant 11138:
11139: <p>You can use the “<span class=
11140: "quote">update</span>” target to resume
1.14 xtraeme 11141: package updating in case a previous
11142: <span><strong class="command">make
11143: update</strong></span> was interrupted for some
11144: reason. However, in this case, make sure you don't
11145: call <span><strong class="command">make
11146: clean</strong></span> or otherwise remove the list
11147: of dependent packages in <code class=
1.47 reed 11148: "varname">WRKDIR</code>. Otherwise, you lose the
1.1 grant 11149: ability to automatically update the current package
11150: along with the dependent packages you have
11151: installed.</p>
11152:
1.14 xtraeme 11153: <p>Resuming an interrupted <span><strong class=
11154: "command">make update</strong></span> will only
11155: work as long as the package tree remains unchanged.
11156: If the source code for one of the packages to be
11157: updated has been changed, resuming
11158: <span><strong class="command">make
11159: update</strong></span> will most certainly
11160: fail!</p>
1.1 grant 11161:
11162: <p>The following variables can be used either on
1.45 wiz 11163: the command line or in <code xmlns=
11164: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11165: "filename">/etc/mk.conf</code> to alter the
11166: behaviour of <span><strong class="command">make
11167: update</strong></span>:</p>
1.1 grant 11168:
11169: <div class="variablelist">
11170: <dl>
1.14 xtraeme 11171: <dt><span class="term"><code class=
11172: "varname">UPDATE_TARGET</code></span></dt>
1.1 grant 11173:
11174: <dd>
11175: <p>Install target to recursively use for the
11176: updated package and the dependent packages.
1.14 xtraeme 11177: Defaults to <code class=
11178: "varname">DEPENDS_TARGET</code> if set,
1.1 grant 11179: “<span class=
11180: "quote">install</span>” otherwise for
1.14 xtraeme 11181: <span><strong class="command">make
11182: update</strong></span>. e.g.
11183: <span><strong class="command">make update
11184: UPDATE_TARGET=package</strong></span></p>
1.1 grant 11185: </dd>
11186:
1.14 xtraeme 11187: <dt><span class="term"><code class=
11188: "varname">NOCLEAN</code></span></dt>
1.1 grant 11189:
11190: <dd>
11191: <p>Don't clean up after updating. Useful if
11192: you want to leave the work sources of the
11193: updated packages around for inspection or
11194: other purposes. Be sure you eventually clean
11195: up the source tree (see the
11196: “<span class=
11197: "quote">clean-update</span>” target
11198: below) or you may run into troubles with old
11199: source code still lying around on your next
1.14 xtraeme 11200: <span><strong class=
11201: "command">make</strong></span> or
11202: <span><strong class="command">make
11203: update</strong></span>.</p>
1.1 grant 11204: </dd>
11205:
1.14 xtraeme 11206: <dt><span class="term"><code class=
11207: "varname">REINSTALL</code></span></dt>
1.1 grant 11208:
11209: <dd>
11210: <p>Deinstall each package before installing
1.14 xtraeme 11211: (making <code class=
11212: "varname">DEPENDS_TARGET</code>). This may be
1.1 grant 11213: necessary if the “<span class=
11214: "quote">clean-update</span>” target
11215: (see below) was called after interrupting a
1.14 xtraeme 11216: running <span><strong class="command">make
11217: update</strong></span>.</p>
1.1 grant 11218: </dd>
11219:
1.14 xtraeme 11220: <dt><span class="term"><code class=
11221: "varname">DEPENDS_TARGET</code></span></dt>
1.1 grant 11222:
11223: <dd>
11224: <p>Allows you to disable recursion and
11225: hardcode the target for packages. The default
11226: is “<span class=
11227: "quote">update</span>” for the update
11228: target, facilitating a recursive update of
1.14 xtraeme 11229: prerequisite packages. Only set <code class=
11230: "varname">DEPENDS_TARGET</code> if you want
11231: to disable recursive updates. Use
11232: <code class="varname">UPDATE_TARGET</code>
11233: instead to just set a specific target for
11234: each package to be installed during
11235: <span><strong class="command">make
11236: update</strong></span> (see above).</p>
1.1 grant 11237: </dd>
11238: </dl>
11239: </div>
11240: </dd>
11241:
11242: <dt><span class="term">clean-update</span></dt>
11243:
11244: <dd>
11245: <p>Clean the source tree for all packages that
1.14 xtraeme 11246: would get updated if <span><strong class=
11247: "command">make update</strong></span> was called
11248: from the current directory. This target should not
11249: be used if the current package (or any of its
11250: depending packages) have already been de-installed
11251: (e.g., after calling <span><strong class=
11252: "command">make update</strong></span>) or you may
11253: lose some packages you intended to update. As a
11254: rule of thumb: only use this target <span class=
11255: "emphasis"><em>before</em></span> the first time
11256: you run <span><strong class="command">make
11257: update</strong></span> and only if you have a dirty
11258: package tree (e.g., if you used <code class=
11259: "varname">NOCLEAN</code>).</p>
1.1 grant 11260:
1.47 reed 11261: <p>If you are unsure about whether your tree is
11262: clean, you can either perform a
1.14 xtraeme 11263: <span><strong class="command">make
1.47 reed 11264: clean</strong></span> at the top of the tree, or
11265: use the following sequence of commands from the
11266: directory of the package you want to update
11267: (<span class="emphasis"><em>before</em></span>
11268: running <span><strong class="command">make
1.14 xtraeme 11269: update</strong></span> for the first time,
11270: otherwise you lose all the packages you wanted to
11271: update!):</p>
1.1 grant 11272: <pre class="screen">
1.14 xtraeme 11273: <code class="prompt">#</code> <strong class=
11274: "userinput"><code>make clean-update</code></strong>
11275: <code class="prompt">#</code> <strong class=
11276: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
11277: <code class="prompt">#</code> <strong class=
11278: "userinput"><code>make update</code></strong>
1.1 grant 11279: </pre>
11280:
11281: <p>The following variables can be used either on
1.45 wiz 11282: the command line or in <code xmlns=
11283: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11284: "filename">/etc/mk.conf</code> to alter the
11285: behaviour of <span><strong class="command">make
11286: clean-update</strong></span>:</p>
1.1 grant 11287:
11288: <div class="variablelist">
11289: <dl>
1.14 xtraeme 11290: <dt><span class="term"><code class=
11291: "varname">CLEAR_DIRLIST</code></span></dt>
1.1 grant 11292:
11293: <dd>
1.14 xtraeme 11294: <p>After <span><strong class="command">make
11295: clean</strong></span>, do not reconstruct the
11296: list of directories to update for this
11297: package. Only use this if
11298: <span><strong class="command">make
11299: update</strong></span> successfully installed
11300: all packages you wanted to update. Normally,
11301: this is done automatically on
11302: <span><strong class="command">make
11303: update</strong></span>, but may have been
11304: suppressed by the <code class=
11305: "varname">NOCLEAN</code> variable (see
1.1 grant 11306: above).</p>
11307: </dd>
11308: </dl>
11309: </div>
11310: </dd>
11311:
11312: <dt><span class="term">info</span></dt>
11313:
11314: <dd>
11315: <p>This target invokes <a href=
11316: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
11317: <span class="citerefentry"><span class=
11318: "refentrytitle">pkg_info</span>(1)</span></a> for
11319: the current package. You can use this to check
11320: which version of a package is installed.</p>
11321: </dd>
11322:
11323: <dt><span class="term">readme</span></dt>
11324:
11325: <dd>
1.45 wiz 11326: <p>This target generates a <code xmlns=
11327: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11328: "filename">README.html</code> file, which can be
1.1 grant 11329: viewed using a browser such as <a xmlns=
11330: "http://www.w3.org/TR/xhtml1/transitional" href=
11331: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45 wiz 11332: target="_top"><code xmlns="" class=
11333: "filename">www/mozilla</code></a> or <a xmlns=
1.20 ben 11334: "http://www.w3.org/TR/xhtml1/transitional" href=
11335: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
1.45 wiz 11336: target="_top"><code xmlns="" class=
11337: "filename">www/links</code></a>. The generated
11338: files contain references to any packages which are
11339: in the <code class="varname">PACKAGES</code>
11340: directory on the local host. The generated files
11341: can be made to refer to URLs based on <code class=
1.20 ben 11342: "varname">FTP_PKG_URL_HOST</code> and <code class=
11343: "varname">FTP_PKG_URL_DIR</code>. For example, if I
1.45 wiz 11344: wanted to generate <code xmlns=
11345: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 11346: "filename">README.html</code> files which pointed
11347: to binary packages on the local machine, in the
1.45 wiz 11348: directory <code xmlns=
11349: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 11350: "filename">/usr/packages</code>, set <code class=
11351: "varname">FTP_PKG_URL_HOST=file://localhost</code>
11352: and <code class=
11353: "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
11354: <code class="varname">${PACKAGES}</code> directory
11355: and its subdirectories will be searched for all the
11356: binary packages.</p>
1.1 grant 11357: </dd>
11358:
11359: <dt><span class="term">readme-all</span></dt>
11360:
11361: <dd>
1.45 wiz 11362: <p>Use this target to create a file <code xmlns=
11363: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11364: "filename">README-all.html</code> which contains a
1.1 grant 11365: list of all packages currently available in the
11366: NetBSD Packages Collection, together with the
11367: category they belong to and a short description.
1.45 wiz 11368: This file is compiled from the <code xmlns=
11369: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11370: "filename">pkgsrc/*/README.html</code> files, so be
1.1 grant 11371: sure to run this <span class=
1.14 xtraeme 11372: "emphasis"><em>after</em></span> a
11373: <span><strong class="command">make
11374: readme</strong></span>.</p>
1.1 grant 11375: </dd>
11376:
11377: <dt><span class="term">cdrom-readme</span></dt>
11378:
11379: <dd>
11380: <p>This is very much the same as the
11381: “<span class="quote">readme</span>”
11382: target (see above), but is to be used when
11383: generating a pkgsrc tree to be written to a CD-ROM.
1.45 wiz 11384: This target also produces <code xmlns=
11385: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11386: "filename">README.html</code> files, and can be
11387: made to refer to URLs based on <code class=
11388: "varname">CDROM_PKG_URL_HOST</code> and
11389: <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1 grant 11390: </dd>
11391:
11392: <dt><span class="term">show-distfiles</span></dt>
11393:
11394: <dd>
11395: <p>This target shows which distfiles and patchfiles
1.14 xtraeme 11396: are needed to build the package. (<code class=
11397: "varname">DISTFILES</code> and <code class=
1.45 wiz 11398: "varname">PATCHFILES</code>, but not <code xmlns=
11399: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11400: "filename">patches/*</code>)</p>
1.1 grant 11401: </dd>
11402:
11403: <dt><span class="term">show-downlevel</span></dt>
11404:
11405: <dd>
11406: <p>This target shows nothing if the package is not
11407: installed. If a version of this package is
11408: installed, but is not the version provided in this
11409: version of pkgsrc, then a warning message is
11410: displayed. This target can be used to show which of
11411: your installed packages are downlevel, and so the
11412: old versions can be deleted, and the current ones
11413: added.</p>
11414: </dd>
11415:
11416: <dt><span class="term">show-pkgsrc-dir</span></dt>
11417:
11418: <dd>
11419: <p>This target shows the directory in the pkgsrc
11420: hierarchy from which the package can be built and
11421: installed. This may not be the same directory as
11422: the one from which the package was installed. This
11423: target is intended to be used by people who may
11424: wish to upgrade many packages on a single host, and
11425: can be invoked from the top-level pkgsrc Makefile
11426: by using the “<span class=
11427: "quote">show-host-specific-pkgs</span>”
11428: target.</p>
11429: </dd>
11430:
11431: <dt><span class=
11432: "term">show-installed-depends</span></dt>
11433:
11434: <dd>
11435: <p>This target shows which installed packages match
1.14 xtraeme 11436: the current package's <code class=
11437: "varname">DEPENDS</code>. Useful if out of date
1.1 grant 11438: dependencies are causing build problems.</p>
11439: </dd>
11440:
11441: <dt><span class="term">check-shlibs</span></dt>
11442:
11443: <dd>
11444: <p>After a package is installed, check all its
11445: binaries and (on ELF platforms) shared libraries to
11446: see if they find the shared libs they need. Run by
1.14 xtraeme 11447: default if <code class=
11448: "varname">PKG_DEVELOPER</code> is set in
1.45 wiz 11449: <code xmlns=
11450: "http://www.w3.org/TR/xhtml1/transitional" class=
11451: "filename">/etc/mk.conf</code>.</p>
1.1 grant 11452: </dd>
11453:
11454: <dt><span class="term">print-PLIST</span></dt>
11455:
11456: <dd>
11457: <p>After a “<span class="quote">make
11458: install</span>” from a new or upgraded pkg,
11459: this prints out an attempt to generate a new
1.45 wiz 11460: <code xmlns=
11461: "http://www.w3.org/TR/xhtml1/transitional" class=
11462: "filename">PLIST</code> from a <span><strong class=
11463: "command">find -newer
1.14 xtraeme 11464: work/.extract_done</strong></span>. An attempt is
11465: made to care for shared libs etc., but it is
1.1 grant 11466: <span class="emphasis"><em>strongly</em></span>
11467: recommended to review the result before putting it
1.45 wiz 11468: into <code xmlns=
11469: "http://www.w3.org/TR/xhtml1/transitional" class=
11470: "filename">PLIST</code>. On upgrades, it's useful
11471: to diff the output of this command against an
11472: already existing <code xmlns=
11473: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11474: "filename">PLIST</code> file.</p>
1.1 grant 11475:
1.24 wiz 11476: <p>If the package installs files via <a href=
11477: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
11478: <span class="citerefentry"><span class=
11479: "refentrytitle">tar</span>(1)</span></a> or other
11480: methods that don't update file access times, be
11481: sure to add these files manually to your
1.45 wiz 11482: <code xmlns=
11483: "http://www.w3.org/TR/xhtml1/transitional" class=
11484: "filename">PLIST</code>, as the “<span class=
11485: "quote">find -newer</span>” command used by
11486: this target won't catch them!</p>
1.1 grant 11487:
11488: <p>See <a href="#print-PLIST" title=
1.38 dillo 11489: "10.3. Tweaking output of make print-PLIST">Section 10.3,
1.14 xtraeme 11490: “Tweaking output of <span><strong class=
11491: "command">make
11492: print-PLIST</strong></span>”</a> for more
11493: information on this target.</p>
1.1 grant 11494: </dd>
11495:
11496: <dt><span class="term">bulk-package</span></dt>
11497:
11498: <dd>
11499: <p>Used to do bulk builds. If an appropriate binary
11500: package already exists, no action is taken. If not,
11501: this target will compile, install and package it
1.47 reed 11502: (and its depends, if <code class=
1.14 xtraeme 11503: "varname">PKG_DEPENDS</code> is set properly. See
1.1 grant 11504: <a href="#binary.configuration" title=
1.38 dillo 11505: "6.3.1. Configuration">Section 6.3.1,
1.47 reed 11506: “Configuration”</a>). After creating
11507: the binary package, the sources, the just-installed
11508: package and its required packages are removed,
1.1 grant 11509: preserving free disk space.</p>
11510:
11511: <p><span class="emphasis"><em>Beware that this
11512: target may deinstall all packages installed on a
11513: system!</em></span></p>
11514: </dd>
11515:
11516: <dt><span class="term">bulk-install</span></dt>
11517:
11518: <dd>
11519: <p>Used during bulk-installs to install required
1.47 reed 11520: packages. If an up-to-date binary package is
1.1 grant 11521: available, it will be installed via <a href=
11522: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
11523: <span class="citerefentry"><span class=
11524: "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14 xtraeme 11525: not, <span><strong class="command">make
11526: bulk-package</strong></span> will be executed, but
1.47 reed 11527: the installed binary won't be removed.</p>
1.1 grant 11528:
11529: <p>A binary package is considered
1.47 reed 11530: “<span class="quote">up-to-date</span>”
1.1 grant 11531: to be installed via <a href=
11532: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
11533: <span class="citerefentry"><span class=
11534: "refentrytitle">pkg_add</span>(1)</span></a>
11535: if:</p>
11536:
11537: <div class="itemizedlist">
11538: <ul type="disc">
11539: <li>
1.45 wiz 11540: <p>None of the package's files (<code xmlns=
11541: "http://www.w3.org/TR/xhtml1/transitional"
11542: class="filename">Makefile</code>, ...) were
1.14 xtraeme 11543: modified since it was built.</p>
1.1 grant 11544: </li>
11545:
11546: <li>
11547: <p>None of the package's required (binary)
11548: packages were modified since it was
11549: built.</p>
11550: </li>
11551: </ul>
11552: </div>
11553:
11554: <p><span class="emphasis"><em>Beware that this
11555: target may deinstall all packages installed on a
11556: system!</em></span></p>
11557: </dd>
11558: </dl>
11559: </div>
11560: </div>
11561: </div>
11562:
1.63 dillo 11563: <div class="chapter" lang="en">
1.1 grant 11564: <div class="titlepage">
11565: <div>
11566: <div>
1.63 dillo 11567: <h2 class="title"><a name=
1.55 rillig 11568: "fixes"></a>Chapter 15. Making your package
11569: work</h2>
1.1 grant 11570: </div>
11571: </div>
11572: </div>
11573:
11574: <div class="toc">
11575: <p><b>Table of Contents</b></p>
11576:
11577: <dl>
1.30 wiz 11578: <dt><span class="sect1"><a href=
1.38 dillo 11579: "#general-operation">15.1. General
1.30 wiz 11580: operation</a></span></dt>
1.1 grant 11581:
11582: <dd>
11583: <dl>
11584: <dt><span class="sect2"><a href=
1.38 dillo 11585: "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30 wiz 11586: pull in variables from /etc/mk.conf</a></span></dt>
1.1 grant 11587:
11588: <dt><span class="sect2"><a href=
1.38 dillo 11589: "#where-to-install-documentation">15.1.2. Where to
1.31 wiz 11590: install documentation</a></span></dt>
11591:
11592: <dt><span class="sect2"><a href=
1.38 dillo 11593: "#restricted-packages">15.1.3. Restricted
1.1 grant 11594: packages</a></span></dt>
11595:
11596: <dt><span class="sect2"><a href=
1.38 dillo 11597: "#dependencies">15.1.4. Handling
1.1 grant 11598: dependencies</a></span></dt>
11599:
11600: <dt><span class="sect2"><a href=
1.38 dillo 11601: "#conflicts">15.1.5. Handling conflicts with other
1.1 grant 11602: packages</a></span></dt>
11603:
11604: <dt><span class="sect2"><a href=
1.38 dillo 11605: "#not-building-packages">15.1.6. Packages that
1.30 wiz 11606: cannot or should not be built</a></span></dt>
1.1 grant 11607:
11608: <dt><span class="sect2"><a href=
1.38 dillo 11609: "#undeletable-packages">15.1.7. Packages which
1.30 wiz 11610: should not be deleted, once
11611: installed</a></span></dt>
1.1 grant 11612:
11613: <dt><span class="sect2"><a href=
1.38 dillo 11614: "#security-handling">15.1.8. Handling packages with
1.1 grant 11615: security problems</a></span></dt>
11616:
11617: <dt><span class="sect2"><a href=
1.38 dillo 11618: "#compiler-bugs">15.1.9. How to handle compiler
1.1 grant 11619: bugs</a></span></dt>
11620:
11621: <dt><span class="sect2"><a href=
1.38 dillo 11622: "#bumping-pkgrevision">15.1.10. How to handle
1.30 wiz 11623: incrementing versions when fixing an existing
1.1 grant 11624: package</a></span></dt>
11625:
11626: <dt><span class="sect2"><a href=
1.38 dillo 11627: "#portability-of-packages">15.1.11. Portability of
1.1 grant 11628: packages</a></span></dt>
11629: </dl>
11630: </dd>
11631:
1.30 wiz 11632: <dt><span class="sect1"><a href=
1.38 dillo 11633: "#downloading-issues">15.2. Possible downloading
1.30 wiz 11634: issues</a></span></dt>
1.1 grant 11635:
11636: <dd>
11637: <dl>
11638: <dt><span class="sect2"><a href=
1.38 dillo 11639: "#no-plain-download">15.2.1. Packages whose
1.30 wiz 11640: distfiles aren't available for plain
1.1 grant 11641: downloading</a></span></dt>
11642:
11643: <dt><span class="sect2"><a href=
1.38 dillo 11644: "#modified-distfiles-same-name">15.2.2. How to
1.30 wiz 11645: handle modified distfiles with the 'old'
11646: name</a></span></dt>
1.1 grant 11647: </dl>
11648: </dd>
11649:
1.30 wiz 11650: <dt><span class="sect1"><a href=
1.38 dillo 11651: "#configuration-gotchas">15.3. Configuration
1.30 wiz 11652: gotchas</a></span></dt>
1.1 grant 11653:
11654: <dd>
11655: <dl>
11656: <dt><span class="sect2"><a href=
1.38 dillo 11657: "#fixes.libtool">15.3.1. Shared libraries -
1.1 grant 11658: libtool</a></span></dt>
11659:
11660: <dt><span class="sect2"><a href=
1.38 dillo 11661: "#using-libtool">15.3.2. Using libtool on GNU
1.30 wiz 11662: packages that already support
11663: libtool</a></span></dt>
1.1 grant 11664:
11665: <dt><span class="sect2"><a href=
1.38 dillo 11666: "#autoconf-automake">15.3.3. GNU
1.1 grant 11667: Autoconf/Automake</a></span></dt>
11668: </dl>
11669: </dd>
11670:
1.55 rillig 11671: <dt><span class="sect1"><a href="#fixes-build">15.4.
11672: Building the package</a></span></dt>
1.1 grant 11673:
11674: <dd>
11675: <dl>
11676: <dt><span class="sect2"><a href=
1.38 dillo 11677: "#cpp-defines">15.4.1. CPP defines</a></span></dt>
1.51 rillig 11678:
1.60 rillig 11679: <dt><span class="sect2"><a href=
11680: "#cpp-list-examples">15.4.2. Examples of CPP
11681: defines for some platforms</a></span></dt>
11682:
11683: <dt><span class="sect2"><a href="#cpp-list">15.4.3.
1.51 rillig 11684: Getting a list of CPP defines</a></span></dt>
1.1 grant 11685: </dl>
11686: </dd>
11687:
1.30 wiz 11688: <dt><span class="sect1"><a href=
1.38 dillo 11689: "#package-specific-actions">15.5. Package specific
1.30 wiz 11690: actions</a></span></dt>
1.1 grant 11691:
11692: <dd>
11693: <dl>
11694: <dt><span class="sect2"><a href=
1.38 dillo 11695: "#user-interaction">15.5.1. User
1.2 hubertf 11696: interaction</a></span></dt>
1.1 grant 11697:
11698: <dt><span class="sect2"><a href=
1.38 dillo 11699: "#handling-licenses">15.5.2. Handling
1.1 grant 11700: licenses</a></span></dt>
11701:
11702: <dt><span class="sect2"><a href=
1.38 dillo 11703: "#installing-score-files">15.5.3. Installing score
1.1 grant 11704: files</a></span></dt>
11705:
11706: <dt><span class="sect2"><a href=
1.38 dillo 11707: "#perl-scripts">15.5.4. Packages containing perl
1.1 grant 11708: scripts</a></span></dt>
11709:
11710: <dt><span class="sect2"><a href=
1.38 dillo 11711: "#hardcoded-paths">15.5.5. Packages with hardcoded
1.30 wiz 11712: paths to other interpreters</a></span></dt>
1.1 grant 11713:
11714: <dt><span class="sect2"><a href=
1.38 dillo 11715: "#perl-modules">15.5.6. Packages installing perl
1.1 grant 11716: modules</a></span></dt>
11717:
11718: <dt><span class="sect2"><a href=
1.38 dillo 11719: "#faq.info-files">15.5.7. Packages installing info
1.1 grant 11720: files</a></span></dt>
11721:
1.57 minskim 11722: <dt><span class="sect2"><a href="#manpages">15.5.8.
11723: Packages installing man pages</a></span></dt>
11724:
1.1 grant 11725: <dt><span class="sect2"><a href=
1.57 minskim 11726: "#gconf2-data-files">15.5.9. Packages installing
1.30 wiz 11727: GConf2 data files</a></span></dt>
1.1 grant 11728:
11729: <dt><span class="sect2"><a href=
1.57 minskim 11730: "#scrollkeeper-data-files">15.5.10. Packages
1.30 wiz 11731: installing scrollkeeper data files</a></span></dt>
1.1 grant 11732:
11733: <dt><span class="sect2"><a href=
1.57 minskim 11734: "#x11-fonts">15.5.11. Packages installing X11
1.1 grant 11735: fonts</a></span></dt>
11736:
11737: <dt><span class="sect2"><a href=
1.57 minskim 11738: "#gtk2-modules">15.5.12. Packages installing GTK2
1.1 grant 11739: modules</a></span></dt>
11740:
11741: <dt><span class="sect2"><a href=
1.57 minskim 11742: "#sgml-xml-data">15.5.13. Packages installing SGML
1.30 wiz 11743: or XML data</a></span></dt>
1.1 grant 11744:
11745: <dt><span class="sect2"><a href=
1.57 minskim 11746: "#mime-database">15.5.14. Packages installing
1.1 grant 11747: extensions to the MIME database</a></span></dt>
11748:
11749: <dt><span class="sect2"><a href=
1.57 minskim 11750: "#intltool">15.5.15. Packages using
1.1 grant 11751: intltool</a></span></dt>
1.18 xtraeme 11752:
11753: <dt><span class="sect2"><a href=
1.57 minskim 11754: "#startup-scripts">15.5.16. Packages installing
1.30 wiz 11755: startup scripts</a></span></dt>
1.57 minskim 11756:
11757: <dt><span class="sect2"><a href=
11758: "#tex-packages">15.5.17. Packages installing TeX
11759: modules</a></span></dt>
1.1 grant 11760: </dl>
11761: </dd>
11762:
1.30 wiz 11763: <dt><span class="sect1"><a href=
1.38 dillo 11764: "#feedback-to-author">15.6. Feedback to the
1.30 wiz 11765: author</a></span></dt>
1.1 grant 11766: </dl>
11767: </div>
11768:
1.63 dillo 11769: <div class="sect1" lang="en">
1.1 grant 11770: <div class="titlepage">
11771: <div>
11772: <div>
11773: <h2 class="title" style="clear: both"><a name=
1.38 dillo 11774: "general-operation"></a>15.1. General
1.1 grant 11775: operation</h2>
11776: </div>
11777: </div>
11778: </div>
11779:
1.63 dillo 11780: <div class="sect2" lang="en">
1.1 grant 11781: <div class="titlepage">
11782: <div>
11783: <div>
1.30 wiz 11784: <h3 class="title"><a name=
1.38 dillo 11785: "pulling-vars-from-etc-mk.conf"></a>15.1.1. How
1.30 wiz 11786: to pull in variables from /etc/mk.conf</h3>
1.1 grant 11787: </div>
11788: </div>
11789: </div>
11790:
11791: <p>The problem with package-defined variables that can
1.14 xtraeme 11792: be overridden via <code class="varname">MAKECONF</code>
1.45 wiz 11793: or <code xmlns=
11794: "http://www.w3.org/TR/xhtml1/transitional" class=
11795: "filename">/etc/mk.conf</code> is that <a href=
1.1 grant 11796: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
11797: <span class="citerefentry"><span class=
11798: "refentrytitle">make</span>(1)</span></a> expands a
1.47 reed 11799: variable as it is used, but evaluates preprocessor-like
1.1 grant 11800: statements (.if, .ifdef and .ifndef) as they are read.
1.14 xtraeme 11801: So, to use any variable (which may be set in
1.45 wiz 11802: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
11803: class="filename">/etc/mk.conf</code>) in one of the
11804: .if* statements, the file <code xmlns=
11805: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11806: "filename">/etc/mk.conf</code> must be included before
1.1 grant 11807: that .if* statement.</p>
11808:
1.47 reed 11809: <p>Rather than having a number of ad-hoc ways of
1.45 wiz 11810: including <code xmlns=
11811: "http://www.w3.org/TR/xhtml1/transitional" class=
11812: "filename">/etc/mk.conf</code>, should it exist, or
11813: <code class="varname">MAKECONF</code>, should it exist,
11814: include the <code xmlns=
11815: "http://www.w3.org/TR/xhtml1/transitional" class=
11816: "filename">pkgsrc/mk/bsd.prefs.mk</code> file in the
11817: package Makefile before any preprocessor-like .if,
11818: .ifdef, or .ifndef statements:</p>
1.1 grant 11819: <pre class="programlisting">
1.51 rillig 11820: .include "../../mk/bsd.prefs.mk"
11821:
1.1 grant 11822: .if defined(USE_MENUS)
1.51 rillig 11823: # ...
1.1 grant 11824: .endif
11825: </pre>
11826:
1.14 xtraeme 11827: <p>If you wish to set the <code class=
1.45 wiz 11828: "varname">CFLAGS</code> variable in <code xmlns=
11829: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 11830: "filename">/etc/mk.conf</code>, please make sure to
1.1 grant 11831: use:</p>
11832: <pre class="programlisting">
1.51 rillig 11833: CFLAGS+= -your -flags
1.1 grant 11834: </pre>
11835:
1.14 xtraeme 11836: <p>Using <code class="varname">CFLAGS=</code> (i.e.
11837: without the “<span class="quote">+</span>”)
11838: may lead to problems with packages that need to add
11839: their own flags. Also, you may want to take a look at
11840: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1 grant 11841: href=
11842: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45 wiz 11843: target="_top"><code xmlns="" class=
11844: "filename">devel/cpuflags</code></a> package if you're
1.20 ben 11845: interested in optimization for the current CPU.</p>
1.1 grant 11846: </div>
11847:
1.63 dillo 11848: <div class="sect2" lang="en">
1.1 grant 11849: <div class="titlepage">
11850: <div>
11851: <div>
1.31 wiz 11852: <h3 class="title"><a name=
1.38 dillo 11853: "where-to-install-documentation"></a>15.1.2. Where
1.31 wiz 11854: to install documentation</h3>
11855: </div>
11856: </div>
11857: </div>
11858:
1.45 wiz 11859: <p>Documentation should be installed into <code xmlns=
11860: "http://www.w3.org/TR/xhtml1/transitional" class=
1.31 wiz 11861: "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
1.45 wiz 11862: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
11863: class="filename">${PREFIX}/share/doc/${PKGNAME}</code>
11864: (the latter includes the version number of the
11865: package).</p>
1.31 wiz 11866: </div>
11867:
1.63 dillo 11868: <div class="sect2" lang="en">
1.31 wiz 11869: <div class="titlepage">
11870: <div>
11871: <div>
1.63 dillo 11872: <h3 class="title"><a name=
1.38 dillo 11873: "restricted-packages"></a>15.1.3. Restricted
1.1 grant 11874: packages</h3>
11875: </div>
11876: </div>
11877: </div>
11878:
11879: <p>Some licenses restrict how software may be
11880: re-distributed. In order to satisfy these restrictions,
11881: the package system defines five make variables that can
11882: be set to note these restrictions:</p>
11883:
11884: <div class="itemizedlist">
11885: <ul type="disc">
11886: <li>
1.14 xtraeme 11887: <p><code class="varname">RESTRICTED</code></p>
1.1 grant 11888:
11889: <p>This variable should be set whenever a
11890: restriction exists (regardless of its kind). Set
11891: this variable to a string containing the reason
11892: for the restriction.</p>
11893: </li>
11894:
11895: <li>
1.14 xtraeme 11896: <p><code class=
11897: "varname">NO_BIN_ON_CDROM</code></p>
1.1 grant 11898:
11899: <p>Binaries may not be placed on CD-ROM. Set this
1.14 xtraeme 11900: variable to <code class=
11901: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 11902: package may not be included on a CD-ROM.</p>
11903: </li>
11904:
11905: <li>
1.14 xtraeme 11906: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1 grant 11907:
11908: <p>Binaries may not be placed on an FTP server.
1.14 xtraeme 11909: Set this variable to <code class=
11910: "varname">${RESTRICTED}</code> whenever a binary
1.1 grant 11911: package may not not be made available on the
11912: Internet.</p>
11913: </li>
11914:
11915: <li>
1.14 xtraeme 11916: <p><code class=
11917: "varname">NO_SRC_ON_CDROM</code></p>
1.1 grant 11918:
11919: <p>Distfiles may not be placed on CD-ROM. Set
1.14 xtraeme 11920: this variable to <code class=
11921: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 11922: of the source code or other distfile(s) is not
11923: allowed on CD-ROMs.</p>
11924: </li>
11925:
11926: <li>
1.14 xtraeme 11927: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1 grant 11928:
11929: <p>Distfiles may not be placed on FTP. Set this
1.14 xtraeme 11930: variable to <code class=
11931: "varname">${RESTRICTED}</code> if re-distribution
1.1 grant 11932: of the source code or other distfile(s) via the
11933: Internet is not allowed.</p>
11934: </li>
11935: </ul>
11936: </div>
11937:
1.14 xtraeme 11938: <p>Please note that the use of <code class=
11939: "varname">NO_PACKAGE</code>, <code class=
11940: "varname">IGNORE</code>, <code class=
11941: "varname">NO_CDROM</code>, or other generic make
1.1 grant 11942: variables to denote restrictions is deprecated, because
11943: they unconditionally prevent users from generating
11944: binary packages!</p>
11945: </div>
11946:
1.63 dillo 11947: <div class="sect2" lang="en">
1.1 grant 11948: <div class="titlepage">
11949: <div>
11950: <div>
1.63 dillo 11951: <h3 class="title"><a name=
1.38 dillo 11952: "dependencies"></a>15.1.4. Handling
1.1 grant 11953: dependencies</h3>
11954: </div>
11955: </div>
11956: </div>
11957:
11958: <p>Your package may depend on some other package being
11959: present - and there are various ways of expressing this
1.14 xtraeme 11960: dependency. pkgsrc supports the <code class=
11961: "varname">BUILD_DEPENDS</code> and <code class=
1.47 reed 11962: "varname">DEPENDS</code> definitions, the <code class=
11963: "varname">USE_TOOLS</code> definition, as well as
1.45 wiz 11964: dependencies via <code xmlns=
11965: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 11966: "filename">buildlink3.mk</code>, which is the preferred
1.1 grant 11967: way to handle dependencies, and which uses the
11968: variables named above. See <a href="#buildlink" title=
1.38 dillo 11969: "Chapter 11. Buildlink methodology">Chapter 11,
1.1 grant 11970: <i>Buildlink methodology</i></a> for more
11971: information.</p>
11972:
11973: <p>The basic difference between the two variables is as
1.14 xtraeme 11974: follows: The <code class="varname">DEPENDS</code>
1.1 grant 11975: definition registers that pre-requisite in the binary
11976: package so it will be pulled in when the binary package
1.14 xtraeme 11977: is later installed, whilst the <code class=
11978: "varname">BUILD_DEPENDS</code> definition does not,
1.1 grant 11979: marking a dependency that is only needed for building
11980: the package.</p>
11981:
11982: <p>This means that if you only need a package present
11983: whilst you are building, it should be noted as a
1.14 xtraeme 11984: <code class="varname">BUILD_DEPENDS</code>.</p>
1.1 grant 11985:
1.14 xtraeme 11986: <p>The format for a <code class=
11987: "varname">BUILD_DEPENDS</code> and a <code class=
11988: "varname">DEPENDS</code> definition is:</p>
1.1 grant 11989: <pre class="programlisting">
1.51 rillig 11990: <pre-req-package-name>:../../<category>/<pre-req-package>
1.1 grant 11991: </pre>
11992:
11993: <p>Please note that the “<span class=
11994: "quote">pre-req-package-name</span>” may include
1.18 xtraeme 11995: any of the wildcard version numbers recognized by
1.1 grant 11996: <a href=
11997: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
11998: <span class="citerefentry"><span class=
11999: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
12000:
12001: <div class="orderedlist">
12002: <ol type="1">
12003: <li>
12004: <p>If your package needs another package's
12005: binaries or libraries to build or run, and if
1.45 wiz 12006: that package has a <code xmlns=
12007: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12008: "filename">buildlink3.mk</code> file available,
12009: use it:</p>
1.1 grant 12010: <pre class="programlisting">
12011: .include "../../graphics/jpeg/buildlink3.mk"
12012: </pre>
12013: </li>
12014:
12015: <li>
12016: <p>If your package needs to use another package
1.45 wiz 12017: to build itself and there is no <code xmlns=
12018: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12019: "filename">buildlink3.mk</code> file available,
12020: use the <code class=
12021: "varname">BUILD_DEPENDS</code> definition:</p>
1.1 grant 12022: <pre class="programlisting">
1.51 rillig 12023: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
1.1 grant 12024: </pre>
12025: </li>
12026:
12027: <li>
12028: <p>If your package needs a library with which to
1.45 wiz 12029: link and again there is no <code xmlns=
12030: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12031: "filename">buildlink3.mk</code> file available,
12032: this is specified using the <code class=
12033: "varname">DEPENDS</code> definition. An example
12034: of this is the <a xmlns=
1.1 grant 12035: "http://www.w3.org/TR/xhtml1/transitional" href=
12036: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45 wiz 12037: target="_top"><code xmlns="" class=
12038: "filename">print/lyx</code></a> package, which
12039: uses the xpm library, version 3.4j to build:</p>
1.1 grant 12040: <pre class="programlisting">
1.51 rillig 12041: DEPENDS+= xpm-3.4j:../../graphics/xpm
1.1 grant 12042: </pre>
12043:
12044: <p>You can also use wildcards in package
12045: dependences:</p>
12046: <pre class="programlisting">
1.51 rillig 12047: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
1.1 grant 12048: </pre>
12049:
12050: <p>Note that such wildcard dependencies are
12051: retained when creating binary packages. The
12052: dependency is checked when installing the binary
12053: package and any package which matches the pattern
12054: will be used. Wildcard dependencies should be
12055: used with care.</p>
12056:
12057: <p>The “<span class=
12058: "quote">-[0-9]*</span>” should be used
12059: instead of “<span class=
12060: "quote">-*</span>” to avoid potentially
12061: ambiguous matches such as “<span class=
12062: "quote">tk-postgresql</span>” matching a
12063: “<span class="quote">tk-*</span>”
1.14 xtraeme 12064: <code class="varname">DEPENDS</code>.</p>
1.1 grant 12065:
12066: <p>Wildcards can also be used to specify that a
12067: package will only build against a certain minimum
12068: version of a pre-requisite:</p>
12069: <pre class="programlisting">
1.51 rillig 12070: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
1.1 grant 12071: </pre>
12072:
12073: <p>This means that the package will build against
12074: version 3.5.4 of the tiff library or newer. Such
12075: a dependency may be warranted if, for example,
12076: the API of the library has changed with version
12077: 3.5.4 and a package would not compile against an
12078: earlier version of tiff.</p>
12079:
12080: <p>Please note that such dependencies should only
12081: be updated if a package requires a newer
12082: pre-requisite, but not to denote recommendations
12083: such as security updates or ABI changes that do
12084: not prevent a package from building correctly.
12085: Such recommendations can be expressed using
1.14 xtraeme 12086: <code class="varname">RECOMMENDED</code>:</p>
1.1 grant 12087: <pre class="programlisting">
1.51 rillig 12088: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
1.1 grant 12089: </pre>
12090:
1.14 xtraeme 12091: <p>In addition to the above <code class=
12092: "varname">DEPENDS</code> line, this denotes that
1.1 grant 12093: while a package will build against
12094: tiff>=3.5.4, at least version 3.6.1 is
1.14 xtraeme 12095: recommended. <code class=
12096: "varname">RECOMMENDED</code> entries will be
12097: turned into dependencies unless explicitly
12098: ignored (in which case a warning will be
1.36 wiz 12099: printed).</p>
12100:
12101: <p>To ignore these dependency recommendations and
12102: just use the required <code class=
12103: "varname">DEPENDS</code>, set <code class=
12104: "varname">IGNORE_RECOMMENDED=YES</code>. This may
12105: make it easier and faster to update packages
12106: built using pkgsrc, since older compatible
12107: dependencies can continue to be used. This is
12108: useful for people who watch their rebuilds very
12109: carefully; it is not very good as a
12110: general-purpose hammer. If you use it, you need
12111: to be mindful of possible ABI changes, including
12112: those from the underlying OS.</p>
12113:
12114: <p>Packages that are built with recommendations
12115: ignored may not be uploaded to ftp.NetBSD.org by
12116: developers and should not be used across
12117: different systems that may have different
12118: versions of binary packages installed.</p>
1.1 grant 12119:
12120: <p>For security fixes, please update the package
12121: vulnerabilities file as well as setting
1.14 xtraeme 12122: <code class="varname">RECOMMENDED</code>, see
1.1 grant 12123: <a href="#security-handling" title=
1.38 dillo 12124: "15.1.8. Handling packages with security problems">
1.63 dillo 12125: Section 15.1.8, “Handling packages
12126: with security problems”</a> for more
1.1 grant 12127: information.</p>
12128: </li>
12129:
12130: <li>
12131: <p>If your package needs some executable to be
1.17 sketch 12132: able to run correctly and if there's no
1.45 wiz 12133: <code xmlns=
12134: "http://www.w3.org/TR/xhtml1/transitional" class=
12135: "filename">buildlink3.mk</code> file, this is
12136: specified using the <code class=
1.14 xtraeme 12137: "varname">DEPENDS</code> variable. The <a xmlns=
1.1 grant 12138: "http://www.w3.org/TR/xhtml1/transitional" href=
12139: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45 wiz 12140: target="_top"><code xmlns="" class=
12141: "filename">print/lyx</code></a> package needs to
12142: be able to execute the latex binary from the
12143: teTeX package when it runs, and that is
12144: specified:</p>
1.1 grant 12145: <pre class="programlisting">
1.51 rillig 12146: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
1.1 grant 12147: </pre>
12148:
12149: <p>The comment about wildcard dependencies from
12150: previous paragraph applies here, too.</p>
12151: </li>
12152: </ol>
12153: </div>
12154:
12155: <p>If your package needs files from another package to
12156: build, see the first part of the “<span class=
12157: "quote">do-configure</span>” target <a xmlns=
12158: "http://www.w3.org/TR/xhtml1/transitional" href=
12159: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.45 wiz 12160: target="_top"><code xmlns="" class=
12161: "filename">print/ghostscript5</code></a> package (it
1.20 ben 12162: relies on the jpeg sources being present in source form
12163: during the build):</p>
1.1 grant 12164: <pre class="programlisting">
1.51 rillig 12165: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
12166: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
1.1 grant 12167: fi
12168: </pre>
12169:
12170: <p>If you build any other packages that way, please
12171: make sure the working files are deleted too when this
12172: package's working files are cleaned up. The easiest way
12173: to do so is by adding a pre-clean target:</p>
12174: <pre class="programlisting">
1.51 rillig 12175: pre-clean:
12176: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
1.1 grant 12177: </pre>
12178:
1.14 xtraeme 12179: <p>Please also note the <code class=
12180: "varname">BUILD_USES_MSGFMT</code> and <code class=
12181: "varname">BUILD_USES_GETTEXT_M4</code> definitions,
12182: which are provided as convenience definitions. The
1.24 wiz 12183: former works out whether <a href=
12184: "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
12185: <span class="citerefentry"><span class=
12186: "refentrytitle">msgfmt</span>(1)</span></a> is part of
12187: the base system, and, if it isn't, installs the
12188: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12189: href=
1.1 grant 12190: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.45 wiz 12191: target="_top"><code xmlns="" class=
12192: "filename">devel/gettext</code></a> package. The latter
1.20 ben 12193: adds a build dependency on either an installed version
12194: of an older gettext package, or if it isn't, installs
12195: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12196: href=
12197: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
1.45 wiz 12198: target="_top"><code xmlns="" class=
12199: "filename">devel/gettext-m4</code></a> package.</p>
1.1 grant 12200: </div>
12201:
1.63 dillo 12202: <div class="sect2" lang="en">
1.1 grant 12203: <div class="titlepage">
12204: <div>
12205: <div>
1.63 dillo 12206: <h3 class="title"><a name=
1.38 dillo 12207: "conflicts"></a>15.1.5. Handling conflicts
1.1 grant 12208: with other packages</h3>
12209: </div>
12210: </div>
12211: </div>
12212:
12213: <p>Your package may conflict with other packages a user
12214: might already have installed on his system, e.g. if
12215: your package installs the same set of files like
12216: another package in our pkgsrc tree.</p>
12217:
1.14 xtraeme 12218: <p>In this case you can set <code class=
1.47 reed 12219: "varname">CONFLICTS</code> to a space-separated list of
1.1 grant 12220: packages (including version string) your package
12221: conflicts with.</p>
12222:
1.47 reed 12223: <p>For example, <a xmlns=
1.1 grant 12224: "http://www.w3.org/TR/xhtml1/transitional" href=
12225: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.45 wiz 12226: target="_top"><code xmlns="" class=
12227: "filename">x11/Xaw3d</code></a> and <a xmlns=
1.20 ben 12228: "http://www.w3.org/TR/xhtml1/transitional" href=
12229: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
1.45 wiz 12230: target="_top"><code xmlns="" class=
1.47 reed 12231: "filename">x11/Xaw-Xpm</code></a> install the same
12232: shared library, thus you set in <code xmlns=
1.45 wiz 12233: "http://www.w3.org/TR/xhtml1/transitional" class=
1.20 ben 12234: "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1 grant 12235: <pre class="programlisting">
1.51 rillig 12236: CONFLICTS= Xaw-Xpm-[0-9]*
1.1 grant 12237: </pre>
12238:
1.45 wiz 12239: <p>and in <code xmlns=
12240: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12241: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1 grant 12242: <pre class="programlisting">
1.51 rillig 12243: CONFLICTS= Xaw3d-[0-9]*
1.1 grant 12244: </pre>
12245:
12246: <p>Packages will automatically conflict with other
12247: packages with the name prefix and a different version
12248: string. “<span class=
12249: "quote">Xaw3d-1.5</span>” e.g. will automatically
12250: conflict with the older version “<span class=
12251: "quote">Xaw3d-1.3</span>”.</p>
12252: </div>
12253:
1.63 dillo 12254: <div class="sect2" lang="en">
1.1 grant 12255: <div class="titlepage">
12256: <div>
12257: <div>
1.63 dillo 12258: <h3 class="title"><a name=
1.38 dillo 12259: "not-building-packages"></a>15.1.6. Packages
1.30 wiz 12260: that cannot or should not be built</h3>
1.1 grant 12261: </div>
12262: </div>
12263: </div>
12264:
12265: <p>There are several reasons why a package might be
12266: instructed to not build under certain circumstances. If
12267: the package builds and runs on most platforms, the
1.14 xtraeme 12268: exceptions should be noted with <code class=
12269: "varname">NOT_FOR_PLATFORM</code>. If the package
12270: builds and runs on a small handful of platforms, set
12271: <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.45 wiz 12272: Both <code class="varname">ONLY_FOR_PLATFORM</code> and
12273: <code class="varname">NOT_FOR_PLATFORM</code> are OS
12274: triples (OS-version-platform) that can use glob-style
12275: wildcards.</p>
12276:
12277: <p>If the package should be skipped (for example,
12278: because it provides functionality already provided by
12279: the system), set <code class=
1.14 xtraeme 12280: "varname">PKG_SKIP_REASON</code> to a descriptive
12281: message. If the package should fail because some
12282: preconditions are not met, set <code class=
12283: "varname">PKG_FAIL_REASON</code> to a descriptive
1.1 grant 12284: message.</p>
12285: </div>
12286:
1.63 dillo 12287: <div class="sect2" lang="en">
1.1 grant 12288: <div class="titlepage">
12289: <div>
12290: <div>
1.63 dillo 12291: <h3 class="title"><a name=
1.38 dillo 12292: "undeletable-packages"></a>15.1.7. Packages
1.30 wiz 12293: which should not be deleted, once installed</h3>
1.1 grant 12294: </div>
12295: </div>
12296: </div>
12297:
12298: <p>To ensure that a package may not be deleted, once it
1.14 xtraeme 12299: has been installed, the <code class=
12300: "varname">PKG_PRESERVE</code> definition should be set
12301: in the package Makefile. This will be carried into any
1.1 grant 12302: binary package that is made from this pkgsrc entry. A
12303: “<span class="quote">preserved</span>”
12304: package will not be deleted using <a href=
12305: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
12306: <span class="citerefentry"><span class=
12307: "refentrytitle">pkg_delete</span>(1)</span></a> unless
12308: the “<span class="quote">-f</span>” option
12309: is used.</p>
12310: </div>
12311:
1.63 dillo 12312: <div class="sect2" lang="en">
1.1 grant 12313: <div class="titlepage">
12314: <div>
12315: <div>
1.63 dillo 12316: <h3 class="title"><a name=
1.38 dillo 12317: "security-handling"></a>15.1.8. Handling
1.1 grant 12318: packages with security problems</h3>
12319: </div>
12320: </div>
12321: </div>
12322:
12323: <p>When a vulnerability is found, this should be noted
1.45 wiz 12324: in <code xmlns=
12325: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12326: "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.43 wiz 12327: and after committing that file, use
12328: <span><strong class="command">make
12329: upload</strong></span> in the same directory to update
12330: the file on ftp.NetBSD.org.</p>
12331:
12332: <p>After fixing the vulnerability by a patch, its
12333: <code class="varname">PKGREVISION</code> should be
12334: increased (this is of course not necessary if the
12335: problem is fixed by using a newer release of the
1.45 wiz 12336: software). In addition, if a <code xmlns=
12337: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12338: "filename">buildlink3.mk</code> file exists for an
1.43 wiz 12339: affected package, a corresponding <code class=
1.14 xtraeme 12340: "varname">BUILDLINK_RECOMMENDED.<em class=
12341: "replaceable"><code>pkg</code></em></code> entry should
1.43 wiz 12342: be added or updated in it.</p>
1.1 grant 12343:
12344: <p>Also, if the fix should be applied to the stable
12345: pkgsrc branch, be sure to submit a pullup request!</p>
1.43 wiz 12346:
12347: <p>Binary packages already on ftp.NetBSD.org will be
12348: handled semi-automatically by a weekly cron job.</p>
1.1 grant 12349: </div>
12350:
1.63 dillo 12351: <div class="sect2" lang="en">
1.1 grant 12352: <div class="titlepage">
12353: <div>
12354: <div>
1.63 dillo 12355: <h3 class="title"><a name=
1.38 dillo 12356: "compiler-bugs"></a>15.1.9. How to handle
1.1 grant 12357: compiler bugs</h3>
12358: </div>
12359: </div>
12360: </div>
12361:
12362: <p>Some source files trigger bugs in the compiler,
12363: based on combinations of compiler version and
12364: architecture and almost always relation to optimisation
12365: being enabled. Common symptoms are gcc internal errors
12366: or never finishing compiling a file.</p>
12367:
1.47 reed 12368: <p>Typically, a workaround involves testing the
1.14 xtraeme 12369: <code class="varname">MACHINE_ARCH</code> and compiler
1.1 grant 12370: version, disabling optimisation for that
1.14 xtraeme 12371: file/<code class="varname">MACHINE_ARCH</code>/compiler
1.45 wiz 12372: combination, and documenting it in <code xmlns=
12373: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12374: "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1 grant 12375: number of examples!</p>
12376: </div>
12377:
1.63 dillo 12378: <div class="sect2" lang="en">
1.1 grant 12379: <div class="titlepage">
12380: <div>
12381: <div>
1.63 dillo 12382: <h3 class="title"><a name=
12383: "bumping-pkgrevision"></a>15.1.10. How to
1.30 wiz 12384: handle incrementing versions when fixing an
12385: existing package</h3>
1.1 grant 12386: </div>
12387: </div>
12388: </div>
12389:
12390: <p>When making fixes to an existing package it can be
1.14 xtraeme 12391: useful to change the version number in <code class=
12392: "varname">PKGNAME</code>. To avoid conflicting with
1.1 grant 12393: future versions by the original author, a
12394: “<span class="quote">nb1</span>”,
12395: “<span class="quote">nb2</span>”, ...
12396: suffix can be used on package versions by setting
1.14 xtraeme 12397: <code class="varname">PKGREVISION=1</code> (2, ...).
12398: The “<span class="quote">nb</span>” is
12399: treated like a “<span class=
12400: "quote">.</span>” by the pkg tools. e.g.</p>
1.1 grant 12401: <pre class="programlisting">
1.51 rillig 12402: DISTNAME= foo-17.42
12403: PKGREVISION= 9
1.1 grant 12404: </pre>
12405:
1.14 xtraeme 12406: <p>will result in a <code class=
12407: "varname">PKGNAME</code> of “<span class=
1.1 grant 12408: "quote">foo-17.42nb9</span>”.</p>
12409:
12410: <p>When a new release of the package is released, the
1.14 xtraeme 12411: <code class="varname">PKGREVISION</code> should be
1.47 reed 12412: removed, e.g. on a new minor release of the above
1.14 xtraeme 12413: package, things should be like:</p>
1.1 grant 12414: <pre class="programlisting">
1.51 rillig 12415: DISTNAME= foo-17.43
1.1 grant 12416: </pre>
12417: </div>
12418:
1.63 dillo 12419: <div class="sect2" lang="en">
1.1 grant 12420: <div class="titlepage">
12421: <div>
12422: <div>
1.30 wiz 12423: <h3 class="title"><a name=
1.38 dillo 12424: "portability-of-packages"></a>15.1.11. Portability
1.30 wiz 12425: of packages</h3>
1.1 grant 12426: </div>
12427: </div>
12428: </div>
12429:
12430: <p>One appealing feature of pkgsrc is that it runs on
12431: many different platforms. As a result, it is important
12432: to ensure, where possible, that packages in pkgsrc are
12433: portable. There are some particular details you should
12434: pay attention to while working on pkgsrc.</p>
12435:
1.63 dillo 12436: <div class="sect3" lang="en">
1.1 grant 12437: <div class="titlepage">
12438: <div>
12439: <div>
1.63 dillo 12440: <h4 class="title"><a name=
1.38 dillo 12441: "install-scripts"></a>15.1.11.1. ${INSTALL},
1.1 grant 12442: ${INSTALL_DATA_DIR}, ...</h4>
12443: </div>
12444: </div>
12445: </div>
12446:
1.14 xtraeme 12447: <p>The BSD-compatible <span><strong class=
12448: "command">install</strong></span> supplied with some
1.1 grant 12449: operating systems will not perform more than one
12450: operation at a time. As such, you should call
12451: “<span class="quote">${INSTALL}</span>”,
12452: etc. like this:</p>
12453: <pre class="programlisting">
1.51 rillig 12454: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
12455: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
1.1 grant 12456: </pre>
12457: </div>
12458: </div>
12459: </div>
12460:
1.63 dillo 12461: <div class="sect1" lang="en">
1.1 grant 12462: <div class="titlepage">
12463: <div>
12464: <div>
12465: <h2 class="title" style="clear: both"><a name=
1.38 dillo 12466: "downloading-issues"></a>15.2. Possible
1.1 grant 12467: downloading issues</h2>
12468: </div>
12469: </div>
12470: </div>
12471:
1.63 dillo 12472: <div class="sect2" lang="en">
1.1 grant 12473: <div class="titlepage">
12474: <div>
12475: <div>
1.63 dillo 12476: <h3 class="title"><a name=
1.38 dillo 12477: "no-plain-download"></a>15.2.1. Packages
1.30 wiz 12478: whose distfiles aren't available for plain
1.1 grant 12479: downloading</h3>
12480: </div>
12481: </div>
12482: </div>
12483:
12484: <p>If you need to download from a dynamic URL you can
1.14 xtraeme 12485: set <code class="varname">DYNAMIC_MASTER_SITES</code>
12486: and a <span><strong class="command">make
1.45 wiz 12487: fetch</strong></span> will call <code xmlns=
12488: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12489: "filename">files/getsite.sh</code> with the name of
12490: each file to download as an argument, expecting it to
12491: output the URL of the directory from which to download
12492: it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12493: href=
1.1 grant 12494: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.45 wiz 12495: target="_top"><code xmlns="" class=
12496: "filename">graphics/ns-cult3d</code></a> is an example
12497: of this usage.</p>
1.1 grant 12498:
12499: <p>If the download can't be automated, because the user
12500: must submit personal information to apply for a
12501: password, or must pay for the source, or whatever, you
1.14 xtraeme 12502: can set <code class="varname">_FETCH_MESSAGE</code> to
12503: a macro which displays a message explaining the
12504: situation. <code class="varname">_FETCH_MESSAGE</code>
12505: must be executable shell commands, not just a message.
12506: (Generally, it executes <code class=
12507: "varname">${ECHO}</code>). As of this writing, the
1.1 grant 12508: following packages use this: <a xmlns=
12509: "http://www.w3.org/TR/xhtml1/transitional" href=
1.20 ben 12510: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
1.45 wiz 12511: target="_top"><code xmlns="" class=
12512: "filename">cad/simian</code></a>, <a xmlns=
1.20 ben 12513: "http://www.w3.org/TR/xhtml1/transitional" href=
12514: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
1.45 wiz 12515: target="_top"><code xmlns="" class=
12516: "filename">devel/ipv6socket</code></a>, <a xmlns=
1.20 ben 12517: "http://www.w3.org/TR/xhtml1/transitional" href=
12518: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
1.45 wiz 12519: target="_top"><code xmlns="" class=
12520: "filename">emulators/vmware-module</code></a>,
12521: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12522: href=
1.20 ben 12523: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
1.45 wiz 12524: target="_top"><code xmlns="" class=
12525: "filename">fonts/acroread-jpnfont</code></a>, <a xmlns=
1.20 ben 12526: "http://www.w3.org/TR/xhtml1/transitional" href=
1.43 wiz 12527: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/multimedia/realplayer/README.html"
1.45 wiz 12528: target="_top"><code xmlns="" class=
12529: "filename">multimedia/realplayer</code></a>, <a xmlns=
1.43 wiz 12530: "http://www.w3.org/TR/xhtml1/transitional" href=
1.20 ben 12531: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
1.45 wiz 12532: target="_top"><code xmlns="" class=
12533: "filename">sysutils/storage-manager</code></a>,
12534: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
12535: href=
1.20 ben 12536: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
1.45 wiz 12537: target="_top"><code xmlns="" class=
12538: "filename">www/ap-aolserver</code></a>, <a xmlns=
1.20 ben 12539: "http://www.w3.org/TR/xhtml1/transitional" href=
12540: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
1.45 wiz 12541: target="_top"><code xmlns="" class=
12542: "filename">www/openacs</code></a>. Try to be consistent
1.20 ben 12543: with them.</p>
1.1 grant 12544: </div>
12545:
1.63 dillo 12546: <div class="sect2" lang="en">
1.1 grant 12547: <div class="titlepage">
12548: <div>
12549: <div>
1.30 wiz 12550: <h3 class="title"><a name=
1.38 dillo 12551: "modified-distfiles-same-name"></a>15.2.2. How
1.30 wiz 12552: to handle modified distfiles with the 'old'
12553: name</h3>
1.1 grant 12554: </div>
12555: </div>
12556: </div>
12557:
12558: <p>Sometimes authors of a software package make some
12559: modifications after the software was released, and they
12560: put up a new distfile without changing the package's
12561: version number. If a package is already in pkgsrc at
1.32 wiz 12562: that time, the checksum will no longer match. The
12563: contents of the new distfile should be compared against
12564: the old one before changing anything, to make sure the
12565: distfile was really updated on purpose, and that no
12566: trojan horse or so crept in. Then, the correct way to
12567: work around this is to set <code class=
12568: "varname">DIST_SUBDIR</code> to a unique directory
12569: name, usually based on <code class=
12570: "varname">PKGNAME_NOREV</code>. In case this happens
12571: more often, <code class="varname">PKGNAME</code> can be
1.45 wiz 12572: used (thus including the <code xmlns=
12573: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 12574: "filename">nbX</code> suffix) or a date stamp can be
12575: appended, like <code class=
12576: "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
1.45 wiz 12577: forget regenerating the <code xmlns=
12578: "http://www.w3.org/TR/xhtml1/transitional" class=
1.32 wiz 12579: "filename">distinfo</code> file after that, since it
12580: contains the <code class="varname">DIST_SUBDIR</code>
12581: path in the filenames. Furthermore, a mail to the
12582: package's authors seems appropriate telling them that
12583: changing distfiles after releases without changing the
12584: file names is not good practice.</p>
1.1 grant 12585: </div>
12586: </div>
12587:
1.63 dillo 12588: <div class="sect1" lang="en">
1.1 grant 12589: <div class="titlepage">
12590: <div>
12591: <div>
12592: <h2 class="title" style="clear: both"><a name=
1.38 dillo 12593: "configuration-gotchas"></a>15.3. Configuration
1.1 grant 12594: gotchas</h2>
12595: </div>
12596: </div>
12597: </div>
12598:
1.63 dillo 12599: <div class="sect2" lang="en">
1.1 grant 12600: <div class="titlepage">
12601: <div>
12602: <div>
1.63 dillo 12603: <h3 class="title"><a name=
1.38 dillo 12604: "fixes.libtool"></a>15.3.1. Shared libraries
1.1 grant 12605: - libtool</h3>
12606: </div>
12607: </div>
12608: </div>
12609:
12610: <p>pkgsrc supports many different machines, with
12611: different object formats like a.out and ELF, and
12612: varying abilities to do shared library and dynamic
12613: loading at all. To accompany this, varying commands and
12614: options have to be passed to the compiler, linker, etc.
12615: to get the Right Thing, which can be pretty annoying
12616: especially if you don't have all the machines at your
12617: hand to test things. The <a xmlns=
12618: "http://www.w3.org/TR/xhtml1/transitional" href=
12619: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.45 wiz 12620: target="_top"><code xmlns="" class=
12621: "filename">devel/libtool</code></a> pkg can help here,
12622: as it just “<span class=
12623: "quote">knows</span>” how to build both static
12624: and dynamic libraries from a set of source files, thus
1.47 reed 12625: being platform-independent.</p>
1.1 grant 12626:
12627: <p>Here's how to use libtool in a pkg in seven simple
12628: steps:</p>
12629:
12630: <div class="orderedlist">
12631: <ol type="1">
12632: <li>
1.14 xtraeme 12633: <p>Add <code class=
12634: "varname">USE_LIBTOOL=yes</code> to the package
12635: Makefile.</p>
1.1 grant 12636: </li>
12637:
12638: <li>
12639: <p>For library objects, use “<span class=
12640: "quote">${LIBTOOL} --mode=compile
12641: ${CC}</span>” in place of
12642: “<span class="quote">${CC}</span>”.
12643: You could even add it to the definition of
1.14 xtraeme 12644: <code class="varname">CC</code>, if only
12645: libraries are being built in a given Makefile.
12646: This one command will build both PIC and non-PIC
12647: library objects, so you need not have separate
12648: shared and non-shared library rules.</p>
1.1 grant 12649: </li>
12650:
12651: <li>
12652: <p>For the linking of the library, remove any
12653: “<span class="quote">ar</span>”,
12654: “<span class="quote">ranlib</span>”,
12655: and “<span class="quote">ld
12656: -Bshareable</span>” commands, and instead
12657: use:</p>
12658: <pre class="programlisting">
1.51 rillig 12659: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} \
12660: -rpath ${PREFIX}/lib -version-info major:minor
1.1 grant 12661: </pre>
12662:
12663: <p>Note that the library is changed to have a
1.45 wiz 12664: <code xmlns=
12665: "http://www.w3.org/TR/xhtml1/transitional" class=
12666: "filename">.la</code> extension, and the objects
12667: are changed to have a <code xmlns=
12668: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12669: "filename">.lo</code> extension. Change
12670: <code class="varname">OBJS</code> as necessary.
12671: This automatically creates all of the
1.45 wiz 12672: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12673: class="filename">.a</code>, <code xmlns=
12674: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12675: "filename">.so.major.minor</code>, and ELF
12676: symlinks (if necessary) in the build directory.
12677: Be sure to include “<span class=
1.1 grant 12678: "quote">-version-info</span>”, especially
12679: when major and minor are zero, as libtool will
12680: otherwise strip off the shared library
12681: version.</p>
12682:
12683: <p>From the libtool manual:</p>
12684: <pre class="programlisting">
1.51 rillig 12685: So, libtool library versions are described by three integers:
1.1 grant 12686:
1.51 rillig 12687: CURRENT
12688: The most recent interface number that this library implements.
1.1 grant 12689:
1.51 rillig 12690: REVISION
12691: The implementation number of the CURRENT interface.
1.1 grant 12692:
1.51 rillig 12693: AGE
12694: The difference between the newest and oldest interfaces that
12695: this library implements. In other words, the library implements
12696: all the interface numbers in the range from number `CURRENT -
12697: AGE' to `CURRENT'.
1.1 grant 12698:
1.51 rillig 12699: If two libraries have identical CURRENT and AGE numbers, then the
12700: dynamic linker chooses the library with the greater REVISION number.
1.1 grant 12701: </pre>
12702:
12703: <p>The “<span class=
12704: "quote">-release</span>” option will
12705: produce different results for a.out and ELF
12706: (excluding symlinks) in only one case. An ELF
12707: library of the form “<span class=
12708: "quote">libfoo-release.so.<span class=
12709: "emphasis"><em>x</em></span>.<span class=
12710: "emphasis"><em>y</em></span></span>” will
12711: have a symlink of “<span class=
12712: "quote">libfoo.so.<span class=
12713: "emphasis"><em>x</em></span>.<span class=
12714: "emphasis"><em>y</em></span></span>” on an
12715: a.out platform. This is handled
12716: automatically.</p>
12717:
12718: <p>The “<span class="quote">-rpath
12719: argument</span>” is the install directory
12720: of the library being built.</p>
12721:
1.45 wiz 12722: <p>In the <code xmlns=
12723: "http://www.w3.org/TR/xhtml1/transitional" class=
12724: "filename">PLIST</code>, include only the
12725: <code xmlns=
12726: "http://www.w3.org/TR/xhtml1/transitional" class=
1.19 hubertf 12727: "filename">.la</code> file, the other files will
12728: be added automatically.</p>
1.1 grant 12729: </li>
12730:
12731: <li>
1.45 wiz 12732: <p>When linking shared object (<code xmlns=
12733: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12734: "filename">.so</code>) files, i.e. files that are
1.24 wiz 12735: loaded via <a href=
12736: "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
12737: <span class="citerefentry"><span class=
12738: "refentrytitle">dlopen</span>(3)</span></a>, NOT
12739: shared libraries, use “<span class=
12740: "quote">-module -avoid-version</span>” to
12741: prevent them getting version tacked on.</p>
1.1 grant 12742:
1.45 wiz 12743: <p>The <code xmlns=
12744: "http://www.w3.org/TR/xhtml1/transitional" class=
12745: "filename">PLIST</code> file gets the
12746: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
12747: class="filename">foo.so</code> entry.</p>
1.1 grant 12748: </li>
12749:
12750: <li>
12751: <p>When linking programs that depend on these
12752: libraries <span class=
12753: "emphasis"><em>before</em></span> they are
12754: installed, preface the <a href=
12755: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
12756: <span class="citerefentry"><span class=
12757: "refentrytitle">cc</span>(1)</span></a> or
12758: <a href=
12759: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
12760: <span class="citerefentry"><span class=
12761: "refentrytitle">ld</span>(1)</span></a> line with
12762: “<span class="quote">${LIBTOOL}
12763: --mode=link</span>”, and it will find the
12764: correct libraries (static or shared), but please
12765: be aware that libtool will not allow you to
12766: specify a relative path in -L (such as
12767: “<span class=
12768: "quote">-L../somelib</span>”), because it
12769: expects you to change that argument to be the
1.45 wiz 12770: <code xmlns=
12771: "http://www.w3.org/TR/xhtml1/transitional" class=
12772: "filename">.la</code> file. e.g.</p>
1.1 grant 12773: <pre class="programlisting">
1.51 rillig 12774: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
1.1 grant 12775: </pre>
12776:
12777: <p>should be changed to:</p>
12778: <pre class="programlisting">
1.51 rillig 12779: ${LIBTOOL} --mode=link ${CC} -o <em class=
1.14 xtraeme 12780: "replaceable"><code>someprog</code></em> <em class=
12781: "replaceable"><code>../somelib/somelib.la</code></em>
1.1 grant 12782: </pre>
12783:
12784: <p>and it will do the right thing with the
12785: libraries.</p>
12786: </li>
12787:
12788: <li>
12789: <p>When installing libraries, preface the
12790: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
12791: <span class="citerefentry"><span class=
12792: "refentrytitle">install</span>(1)</span></a> or
12793: <a href=
12794: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
12795: <span class="citerefentry"><span class=
12796: "refentrytitle">cp</span>(1)</span></a> command
12797: with “<span class="quote">${LIBTOOL}
12798: --mode=install</span>”, and change the
1.45 wiz 12799: library name to <code xmlns=
12800: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12801: "filename">.la</code>. e.g.</p>
1.1 grant 12802: <pre class="programlisting">
1.51 rillig 12803: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1 grant 12804: </pre>
12805:
1.45 wiz 12806: <p>This will install the static <code xmlns=
12807: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 12808: "filename">.a</code>, shared library, any needed
1.1 grant 12809: symlinks, and run <a href=
12810: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
12811: <span class="citerefentry"><span class=
12812: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
12813: </li>
12814:
12815: <li>
1.45 wiz 12816: <p>In your <code xmlns=
12817: "http://www.w3.org/TR/xhtml1/transitional" class=
12818: "filename">PLIST</code>, include only the
12819: <code xmlns=
12820: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 12821: "filename">.la</code> file (this is a change from
12822: previous behaviour).</p>
1.1 grant 12823: </li>
12824: </ol>
12825: </div>
12826: </div>
12827:
1.63 dillo 12828: <div class="sect2" lang="en">
1.1 grant 12829: <div class="titlepage">
12830: <div>
12831: <div>
1.63 dillo 12832: <h3 class="title"><a name=
1.38 dillo 12833: "using-libtool"></a>15.3.2. Using libtool on
1.30 wiz 12834: GNU packages that already support libtool</h3>
1.1 grant 12835: </div>
12836: </div>
12837: </div>
12838:
1.14 xtraeme 12839: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
12840: the package Makefile. This will override the package's
12841: own libtool in most cases. For older libtool using
1.1 grant 12842: packages, libtool is made by ltconfig script during the
12843: do-configure step; you can check the libtool script
1.14 xtraeme 12844: location by doing <span><strong class="command">make
12845: configure; find work*/ -name
12846: libtool</strong></span>.</p>
12847:
12848: <p><code class="varname">LIBTOOL_OVERRIDE</code>
12849: specifies which libtool scripts, relative to
12850: <code class="varname">WRKSRC</code>, to override. By
12851: default, it is set to “<span class=
12852: "quote">libtool */libtool */*/libtool</span>”. If
12853: this does not match the location of the package's
12854: libtool script(s), set it as appropriate.</p>
1.13 hubertf 12855:
1.45 wiz 12856: <p>If you do not need <code xmlns=
12857: "http://www.w3.org/TR/xhtml1/transitional" class=
12858: "filename">*.a</code> static libraries built and
12859: installed, then use <code class=
12860: "varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.1 grant 12861:
1.47 reed 12862: <p>If your package makes use of the
12863: platform-independent library for loading dynamic shared
12864: objects, that comes with libtool (libltdl), you should
12865: include devel/libltdl/buildlink3.mk.</p>
1.1 grant 12866:
12867: <p>Some packages use libtool incorrectly so that the
12868: package may not work or build in some circumstances.
12869: Some of the more common errors are:</p>
12870:
12871: <div class="itemizedlist">
12872: <ul type="disc">
12873: <li>
12874: <p>The inclusion of a shared object (-module) as
12875: a dependent library in an executable or library.
12876: This in itself isn't a problem if one of two
12877: things has been done:</p>
12878:
12879: <div class="orderedlist">
12880: <ol type="1">
12881: <li>
12882: <p>The shared object is named correctly,
1.45 wiz 12883: i.e. <code xmlns=
12884: "http://www.w3.org/TR/xhtml1/transitional"
12885: class="filename">libfoo.la</code>, not
12886: <code xmlns=
12887: "http://www.w3.org/TR/xhtml1/transitional"
12888: class="filename">foo.la</code></p>
1.1 grant 12889: </li>
12890:
12891: <li>
12892: <p>The -dlopen option is used when linking
12893: an executable.</p>
12894: </li>
12895: </ol>
12896: </div>
12897: </li>
12898:
12899: <li>
12900: <p>The use of libltdl without the correct calls
12901: to initialisation routines. The function
12902: lt_dlinit() should be called and the macro
1.14 xtraeme 12903: <code class=
12904: "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1 grant 12905: included in executables.</p>
12906: </li>
12907: </ul>
12908: </div>
12909: </div>
12910:
1.63 dillo 12911: <div class="sect2" lang="en">
1.1 grant 12912: <div class="titlepage">
12913: <div>
12914: <div>
1.63 dillo 12915: <h3 class="title"><a name=
1.38 dillo 12916: "autoconf-automake"></a>15.3.3. GNU
1.1 grant 12917: Autoconf/Automake</h3>
12918: </div>
12919: </div>
12920: </div>
12921:
12922: <p>If a package needs GNU autoconf or automake to be
12923: executed to regenerate the configure script and
12924: Makefile.in makefile templates, then they should be
1.35 jmmv 12925: executed in a pre-configure target.</p>
1.1 grant 12926:
12927: <p>For packages that need only autoconf:</p>
12928: <pre class="programlisting">
1.51 rillig 12929: AUTOCONF_REQD= 2.50 # if default version is not good enough
12930: USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13
12931: ...
1.1 grant 12932:
1.51 rillig 12933: pre-configure:
12934: cd ${WRKSRC}; autoconf
1.1 grant 12935:
1.51 rillig 12936: ...
1.1 grant 12937: </pre>
12938:
12939: <p>and for packages that need automake and
12940: autoconf:</p>
12941: <pre class="programlisting">
1.51 rillig 12942: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
12943: USE_TOOLS+= automake # use "automake14" for automake-1.4
12944: ...
1.1 grant 12945:
1.51 rillig 12946: pre-configure:
12947: cd ${WRKSRC}; \
12948: aclocal; autoheader; \
12949: automake -a --foreign -i; autoconf
12950:
12951: ...
1.1 grant 12952: </pre>
12953:
12954: <p>Packages which use GNU Automake will almost
1.35 jmmv 12955: certainly require GNU Make.</p>
1.1 grant 12956:
12957: <p>There are times when the configure process makes
12958: additional changes to the generated files, which then
12959: causes the build process to try to re-execute the
12960: automake sequence. This is prevented by touching
12961: various files in the configure stage. If this causes
1.14 xtraeme 12962: problems with your package you can set <code class=
12963: "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1 grant 12964: Makefile.</p>
12965: </div>
12966: </div>
12967:
1.63 dillo 12968: <div class="sect1" lang="en">
1.1 grant 12969: <div class="titlepage">
12970: <div>
12971: <div>
12972: <h2 class="title" style="clear: both"><a name=
1.55 rillig 12973: "fixes-build"></a>15.4. Building the
12974: package</h2>
1.1 grant 12975: </div>
12976: </div>
12977: </div>
12978:
1.63 dillo 12979: <div class="sect2" lang="en">
1.1 grant 12980: <div class="titlepage">
12981: <div>
12982: <div>
1.63 dillo 12983: <h3 class="title"><a name=
1.38 dillo 12984: "cpp-defines"></a>15.4.1. CPP defines</h3>
1.1 grant 12985: </div>
12986: </div>
12987: </div>
12988:
1.55 rillig 12989: <p>Sometimes you need to compile different code
12990: depending on the target platform. The C preprocessor
12991: has a set of predefined macros that can be queried by
12992: using <code class="varname">#ifdef FOO</code> or
12993: <code class="varname">#if defined(FOO)</code>. Among
12994: these macros are usually ones that describe the target
12995: CPU and operating system. Depending of which of the
12996: macros are defined, you can write code that uses
1.61 rillig 12997: features unique to a specific platform. Generally you
12998: should rather use the GNU autotools (automake,
12999: autoconf, etc.) to check for specific features (like
13000: the existence of a header file, a function or a
13001: library), but sometimes this is not possible or
13002: desired.</p>
13003:
13004: <p>In that case you can use the predefined macros below
13005: to configure your code to the platform it runs on.
13006: Almost every operating system, hardware architecture
13007: and compiler has its own macro. For example, if the
13008: macros <code class="varname">__GNUC__</code>,
13009: <code class="varname">__i386__</code> and <code class=
1.55 rillig 13010: "varname">__NetBSD__</code> are all defined, you know
1.61 rillig 13011: that you are using NetBSD on an i386 compatible CPU,
13012: and your compiler is GCC.</p>
1.55 rillig 13013:
1.63 dillo 13014: <div class="sect3" lang="en">
1.55 rillig 13015: <div class="titlepage">
13016: <div>
13017: <div>
13018: <h4 class="title"><a name=
13019: "fixes-build-cpp-opsys"></a>15.4.1.1. CPP
13020: defines for operating systems</h4>
13021: </div>
13022: </div>
13023: </div>
13024:
13025: <p>To distinguish between 4.4 BSD-derived systems and
13026: the rest of the world, you should use the following
13027: code.</p>
13028: <pre class="programlisting">
1.51 rillig 13029: #include <sys/param.h>
1.55 rillig 13030: #if (defined(BSD) && BSD >= 199306)
1.60 rillig 13031: /* BSD-specific code goes here */
1.55 rillig 13032: #else
1.60 rillig 13033: /* non-BSD-specific code goes here */
1.55 rillig 13034: #endif
1.1 grant 13035: </pre>
13036:
1.55 rillig 13037: <p>If this distinction is not fine enough, you can
13038: also use the following defines.</p>
13039: <pre class="programlisting">
13040: FreeBSD __FreeBSD__
1.56 rillig 13041: DragonFly __DragonFly__
1.57 minskim 13042: Interix __INTERIX
1.55 rillig 13043: Linux linux, __linux, __linux__
13044: NetBSD __NetBSD__
13045: OpenBSD __OpenBSD__
1.60 rillig 13046: Solaris sun, __sun
1.1 grant 13047: </pre>
1.55 rillig 13048: </div>
1.1 grant 13049:
1.63 dillo 13050: <div class="sect3" lang="en">
1.55 rillig 13051: <div class="titlepage">
13052: <div>
13053: <div>
1.63 dillo 13054: <h4 class="title"><a name=
13055: "fixes-build-cpp-cpu"></a>15.4.1.2. CPP
1.55 rillig 13056: defines for CPUs</h4>
13057: </div>
13058: </div>
13059: </div>
13060: <pre class="programlisting">
13061: i386 i386, __i386, __i386__
13062: MIPS __mips
13063: SPARC sparc, __sparc
13064: </pre>
13065: </div>
13066:
1.63 dillo 13067: <div class="sect3" lang="en">
1.55 rillig 13068: <div class="titlepage">
13069: <div>
13070: <div>
13071: <h4 class="title"><a name=
13072: "fixes-build-cpp-compiler"></a>15.4.1.3. CPP
13073: defines for compilers</h4>
13074: </div>
13075: </div>
13076: </div>
13077: <pre class="programlisting">
13078: GCC __GNUC__ (major version), __GNUC_MINOR__
1.60 rillig 13079: SunPro __SUNPRO_C (0x570 for version 5.7)
1.55 rillig 13080: </pre>
13081: </div>
1.1 grant 13082: </div>
1.51 rillig 13083:
1.63 dillo 13084: <div class="sect2" lang="en">
1.51 rillig 13085: <div class="titlepage">
13086: <div>
13087: <div>
1.63 dillo 13088: <h3 class="title"><a name=
1.60 rillig 13089: "cpp-list-examples"></a>15.4.2. Examples of
13090: CPP defines for some platforms</h3>
13091: </div>
13092: </div>
13093: </div>
13094:
13095: <p>The list of the CPP identification macros for
13096: hardware and operating system may depend on the
13097: compiler that is used. The following list contains some
13098: examples that may help you to choose the right ones.
13099: For example, if you want to conditionally compile code
13100: on Solaris, don't use <code class=
13101: "varname">__sun__</code>, as the SunPro compiler does
13102: not define it. Use <code class="varname">__sun</code>
13103: instead.</p>
13104:
13105: <div class="variablelist">
13106: <dl>
1.61 rillig 13107: <dt><span class="term">GCC 3.3.3 + SuSE Linux 9.1 +
13108: i386</span></dt>
13109:
13110: <dd>
1.62 rillig 13111: <p>__ELF__, __gnu_linux__, __i386, __i386__,
1.61 rillig 13112: __linux, __linux__, __unix, __unix__, i386,
13113: linux, unix.</p>
13114: </dd>
13115:
13116: <dt><span class="term">GCC 2.95 + NetBSD 1.6.2 +
13117: i386</span></dt>
13118:
13119: <dd>
1.62 rillig 13120: <p>__ELF__, __NetBSD__, __i386, __i386__,
1.61 rillig 13121: i386.</p>
13122: </dd>
13123:
13124: <dt><span class="term">GCC 3.3.3 + NetBSD 2.0 +
13125: i386</span></dt>
1.60 rillig 13126:
13127: <dd>
1.62 rillig 13128: <p>__ELF__, __NetBSD__, __i386, __i386__,
1.61 rillig 13129: i386.</p>
1.60 rillig 13130: </dd>
13131:
13132: <dt><span class="term">GCC 4 + Solaris 8 +
13133: SPARC</span></dt>
13134:
13135: <dd>
13136: <p>__ELF__, __sparc, __sparc__, __sun, __sun__,
13137: __SVR4, __svr4__, __unix, __unix__, sparc, sun,
13138: unix.</p>
13139: </dd>
1.61 rillig 13140:
13141: <dt><span class="term">SunPro 5.7 + Solaris 8 +
13142: SPARC</span></dt>
13143:
13144: <dd>
13145: <p>__SVR4, __sparc, __sun, __unix, sparc, sun,
13146: unix.</p>
13147: </dd>
1.60 rillig 13148: </dl>
13149: </div>
13150: </div>
13151:
1.63 dillo 13152: <div class="sect2" lang="en">
1.60 rillig 13153: <div class="titlepage">
13154: <div>
13155: <div>
1.63 dillo 13156: <h3 class="title"><a name=
1.60 rillig 13157: "cpp-list"></a>15.4.3. Getting a list of CPP
1.51 rillig 13158: defines</h3>
13159: </div>
13160: </div>
13161: </div>
13162:
1.60 rillig 13163: <p>If your system uses the GNU C Compiler, you can get
13164: a list of symbols that are defined by default, e.g. to
13165: identify the platform, with the following command:</p>
1.51 rillig 13166: <pre class="programlisting">
13167: gcc -E -dM - < /dev/null
13168: </pre>
1.60 rillig 13169:
13170: <p>On other systems you may get the list by using the
13171: system's syscall trace utility (ktrace, truss, strace)
13172: to have a look which arguments are passed to the actual
13173: compiler.</p>
1.51 rillig 13174: </div>
1.1 grant 13175: </div>
13176:
1.63 dillo 13177: <div class="sect1" lang="en">
1.1 grant 13178: <div class="titlepage">
13179: <div>
13180: <div>
13181: <h2 class="title" style="clear: both"><a name=
1.38 dillo 13182: "package-specific-actions"></a>15.5. Package
1.1 grant 13183: specific actions</h2>
13184: </div>
13185: </div>
13186: </div>
13187:
1.63 dillo 13188: <div class="sect2" lang="en">
1.1 grant 13189: <div class="titlepage">
13190: <div>
13191: <div>
1.63 dillo 13192: <h3 class="title"><a name=
1.38 dillo 13193: "user-interaction"></a>15.5.1. User
1.2 hubertf 13194: interaction</h3>
1.1 grant 13195: </div>
13196: </div>
13197: </div>
13198:
13199: <p>Occasionally, packages require interaction from the
13200: user, and this can be in a number of ways:</p>
13201:
13202: <div class="itemizedlist">
13203: <ul type="disc">
13204: <li>
13205: <p>help in fetching the distfiles</p>
13206: </li>
13207:
13208: <li>
13209: <p>help to configure the package before it is
13210: built</p>
13211: </li>
13212:
13213: <li>
13214: <p>help during the build process</p>
13215: </li>
13216:
13217: <li>
13218: <p>help during the installation of a package</p>
13219: </li>
13220: </ul>
13221: </div>
13222:
1.14 xtraeme 13223: <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1 grant 13224: definition is provided to notify the pkgsrc mechanism
13225: of an interactive stage which will be needed, and this
1.45 wiz 13226: should be set in the package's <code xmlns=
13227: "http://www.w3.org/TR/xhtml1/transitional" class=
1.47 reed 13228: "filename">Makefile</code>, e.g.:</p>
1.1 grant 13229: <pre class="programlisting">
1.51 rillig 13230: INTERACTIVE_STAGE= build
1.1 grant 13231: </pre>
13232:
13233: <p>Multiple interactive stages can be specified:</p>
13234: <pre class="programlisting">
1.51 rillig 13235: INTERACTIVE_STAGE= configure install
1.1 grant 13236: </pre>
13237: </div>
13238:
1.63 dillo 13239: <div class="sect2" lang="en">
1.1 grant 13240: <div class="titlepage">
13241: <div>
13242: <div>
1.63 dillo 13243: <h3 class="title"><a name=
1.38 dillo 13244: "handling-licenses"></a>15.5.2. Handling
1.1 grant 13245: licenses</h3>
13246: </div>
13247: </div>
13248: </div>
13249:
1.44 gdt 13250: <p>A package may be covered by a license which the user
13251: has or has not agreed to accept. For these cases,
13252: pkgsrc contains a mechanism to note that a package is
13253: covered by a particular license, and the package cannot
13254: be built unless the user has accepted the license.
13255: (Installation of binary packages are not currently
13256: subject to this mechanism.) Packages with licenses that
13257: are either Open Source according to the Open Source
13258: Initiative or Free according to the Free Software
13259: Foundation will not be marked with a license tag.
13260: Packages with licenses that have not been determined to
13261: meet either definition will be marked with a license
13262: tag referring to the license. This will prevent
13263: building unless pkgsrc is informed that the license is
13264: acceptable, and enables displaying the license.</p>
13265:
13266: <p>The license tag mechanism is intended to address
13267: copyright-related issues surrounding building,
13268: installing and using a package, and not to address
13269: redistribution issues (see <code class=
13270: "varname">RESTRICTED</code> and <code class=
13271: "varname">NO_SRC_ON_FTP</code>, etc.). However, the
13272: above definition of licenses for which tags are not
13273: needed implies that packages with redistribution
13274: restrictions should have tags.</p>
13275:
13276: <p>Denoting that a package is covered by a particular
1.45 wiz 13277: license is done by placing the license in <code xmlns=
13278: "http://www.w3.org/TR/xhtml1/transitional" class=
1.44 gdt 13279: "filename">pkgsrc/licenses</code> and setting the
13280: <code class="varname">LICENSE</code> variable to a
13281: string identifying the license, e.g. in <a xmlns=
1.14 xtraeme 13282: "http://www.w3.org/TR/xhtml1/transitional" href=
1.44 gdt 13283: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/xv/README.html"
1.45 wiz 13284: target="_top"><code xmlns="" class=
13285: "filename">graphics/xv</code></a>:</p>
1.1 grant 13286: <pre class="programlisting">
1.51 rillig 13287: LICENSE= xv-license
1.1 grant 13288: </pre>
13289:
13290: <p>When trying to build, the user will get a notice
1.44 gdt 13291: that the package is covered by a license which has not
13292: been accepted:</p>
1.1 grant 13293: <pre class="programlisting">
1.51 rillig 13294: <code class="prompt">%</code> <strong class=
1.14 xtraeme 13295: "userinput"><code>make</code></strong>
1.51 rillig 13296: ===> xv-3.10anb9 has an unacceptable license: xv-license.
13297: ===> To view the license, enter "/usr/bin/make show-license".
13298: ===> To indicate acceptance, add this line to your /etc/mk.conf:
13299: ===> ACCEPTABLE_LICENSES+=xv-license
13300: *** Error code 1
1.1 grant 13301: </pre>
13302:
1.14 xtraeme 13303: <p>The license can be viewed with <span><strong class=
13304: "command">make show-license</strong></span>, and if it
13305: is considered appropriate, the line printed above can
1.45 wiz 13306: be added to <code xmlns=
13307: "http://www.w3.org/TR/xhtml1/transitional" class=
13308: "filename">/etc/mk.conf</code> to indicate acceptance
13309: of the particular license:</p>
1.1 grant 13310: <pre class="programlisting">
1.51 rillig 13311: ACCEPTABLE_LICENSES+=xv-license
1.1 grant 13312: </pre>
13313:
13314: <p>When adding a package with a new license, the
1.45 wiz 13315: license text should be added to <code xmlns=
13316: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13317: "filename">pkgsrc/licenses</code> for displaying. A
13318: list of known licenses can be seen in this directory as
13319: well as by looking at the list of (commented out)
13320: <code class="varname">ACCEPTABLE_LICENSES</code>
1.45 wiz 13321: variable settings in <code xmlns=
13322: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13323: "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1 grant 13324:
1.44 gdt 13325: <p>The use of <code class=
13326: "varname">LICENSE=shareware</code>, <code class=
13327: "varname">LICENSE=no-commercial-use</code>, and similar
13328: language is deprecated because it does not crisply
13329: refer to a particular license text. Another problem
13330: with such usage is that it does not enable a user to
13331: denote acceptance of the license for a single package
13332: without accepting the same license text for another
13333: package. In particular, this can be inappropriate when
13334: e.g. one accepts a particular license to indicate to
13335: pkgsrc that a fee has been paid.</p>
1.1 grant 13336: </div>
13337:
1.63 dillo 13338: <div class="sect2" lang="en">
1.1 grant 13339: <div class="titlepage">
13340: <div>
13341: <div>
1.30 wiz 13342: <h3 class="title"><a name=
1.38 dillo 13343: "installing-score-files"></a>15.5.3. Installing
1.30 wiz 13344: score files</h3>
1.1 grant 13345: </div>
13346: </div>
13347: </div>
13348:
13349: <p>Certain packages, most of them in the games
13350: category, install a score file that allows all users on
13351: the system to record their highscores. In order for
13352: this to work, the binaries need to be installed setgid
13353: and the score files owned by the appropriate group
13354: and/or owner (traditionally the "games" user/group).
13355: The following variables, documented in more detail in
1.45 wiz 13356: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13357: class="filename">mk/defaults/mk.conf</code>, control
13358: this behaviour: <code class=
1.14 xtraeme 13359: "varname">SETGIDGAME</code>, <code class=
13360: "varname">GAMEDATAMODE</code>, <code class=
13361: "varname">GAMEGRP</code>, <code class=
13362: "varname">GAMEMODE</code>, <code class=
13363: "varname">GAMEOWN</code>.</p>
1.1 grant 13364:
13365: <p>Note that per default, setgid installation of games
1.14 xtraeme 13366: is disabled; setting <code class=
13367: "varname">SETGIDGAME=YES</code> will set all the other
1.1 grant 13368: variables accordingly.</p>
13369:
13370: <p>A package should therefor never hard code file
1.14 xtraeme 13371: ownership or access permissions but rely on
13372: <code class="varname">INSTALL_GAME</code> and
13373: <code class="varname">INSTALL_GAME_DATA</code> to set
13374: these correctly.</p>
1.1 grant 13375: </div>
13376:
1.63 dillo 13377: <div class="sect2" lang="en">
1.1 grant 13378: <div class="titlepage">
13379: <div>
13380: <div>
1.63 dillo 13381: <h3 class="title"><a name=
1.38 dillo 13382: "perl-scripts"></a>15.5.4. Packages
1.30 wiz 13383: containing perl scripts</h3>
1.1 grant 13384: </div>
13385: </div>
13386: </div>
13387:
13388: <p>If your package contains interpreted perl scripts,
1.14 xtraeme 13389: set <code class="varname">REPLACE_PERL</code> to ensure
13390: that the proper interpreter path is set. <code class=
13391: "varname">REPLACE_PERL</code> should contain a list of
13392: scripts, relative to <code class=
13393: "varname">WRKSRC</code>, that you want adjusted.</p>
1.1 grant 13394: </div>
13395:
1.63 dillo 13396: <div class="sect2" lang="en">
1.1 grant 13397: <div class="titlepage">
13398: <div>
13399: <div>
1.63 dillo 13400: <h3 class="title"><a name=
1.38 dillo 13401: "hardcoded-paths"></a>15.5.5. Packages with
1.1 grant 13402: hardcoded paths to other interpreters</h3>
13403: </div>
13404: </div>
13405: </div>
13406:
13407: <p>Your package may also contain scripts with hardcoded
13408: paths to other interpreters besides (or as well as)
13409: perl. To correct the full pathname to the script
13410: interpreter, you need to set the following definitions
1.45 wiz 13411: in your <code xmlns=
13412: "http://www.w3.org/TR/xhtml1/transitional" class=
13413: "filename">Makefile</code> (we shall use
13414: <span><strong class="command">tclsh</strong></span> in
13415: this example):</p>
1.1 grant 13416: <pre class="programlisting">
1.51 rillig 13417: REPLACE_INTERPRETER+= tcl
13418: _REPLACE.tcl.old= .*/bin/tclsh
13419: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
13420: _REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed,
13421: # relative to ${WRKSRC}, just as in REPLACE_PERL
1.1 grant 13422: </pre>
13423: </div>
13424:
1.63 dillo 13425: <div class="sect2" lang="en">
1.1 grant 13426: <div class="titlepage">
13427: <div>
13428: <div>
1.63 dillo 13429: <h3 class="title"><a name=
1.38 dillo 13430: "perl-modules"></a>15.5.6. Packages
1.30 wiz 13431: installing perl modules</h3>
1.1 grant 13432: </div>
13433: </div>
13434: </div>
13435:
13436: <p>Makefiles of packages providing perl5 modules should
1.45 wiz 13437: include the Makefile fragment <code xmlns=
13438: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13439: "filename">../../lang/perl5/module.mk</code>. It
13440: provides a <span><strong class=
13441: "command">do-configure</strong></span> target for the
13442: standard perl configuration for such modules as well as
13443: various hooks to tune this configuration. See comments
13444: in this file for details.</p>
1.1 grant 13445:
13446: <p>Perl5 modules will install into different places
13447: depending on the version of perl used during the build
13448: process. To address this, pkgsrc will append lines to
1.45 wiz 13449: the <code xmlns=
13450: "http://www.w3.org/TR/xhtml1/transitional" class=
13451: "filename">PLIST</code> corresponding to the files
13452: listed in the installed <code xmlns=
13453: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13454: "filename">.packlist</code> file generated by most
13455: perl5 modules. This is invoked by defining <code class=
13456: "varname">PERL5_PACKLIST</code> to a space-separated
13457: list of paths to packlist files, e.g.:</p>
1.1 grant 13458: <pre class="programlisting">
1.51 rillig 13459: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
1.1 grant 13460: </pre>
13461:
1.14 xtraeme 13462: <p>The variables <code class=
13463: "varname">PERL5_SITELIB</code>, <code class=
13464: "varname">PERL5_SITEARCH</code>, and <code class=
13465: "varname">PERL5_ARCHLIB</code> represent the three
1.1 grant 13466: locations in which perl5 modules may be installed, and
13467: may be used by perl5 packages that don't have a
13468: packlist. These three variables are also substituted
1.45 wiz 13469: for in the <code xmlns=
13470: "http://www.w3.org/TR/xhtml1/transitional" class=
13471: "filename">PLIST</code>.</p>
1.1 grant 13472: </div>
13473:
1.63 dillo 13474: <div class="sect2" lang="en">
1.1 grant 13475: <div class="titlepage">
13476: <div>
13477: <div>
1.63 dillo 13478: <h3 class="title"><a name=
1.38 dillo 13479: "faq.info-files"></a>15.5.7. Packages
1.1 grant 13480: installing info files</h3>
13481: </div>
13482: </div>
13483: </div>
13484:
13485: <p>Some packages install info files or use the
13486: “<span class="quote">makeinfo</span>” or
13487: “<span class="quote">install-info</span>”
13488: commands. Each of the info files:</p>
13489:
13490: <div class="itemizedlist">
13491: <ul type="disc">
13492: <li>
13493: <p>is considered to be installed in the directory
1.45 wiz 13494: <code xmlns=
13495: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13496: "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1 grant 13497: </li>
13498:
13499: <li>
13500: <p>is registered in the Info directory file
1.45 wiz 13501: <code xmlns=
13502: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13503: "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1 grant 13504: </li>
13505:
13506: <li>
13507: <p>and must be listed as a filename in the
1.14 xtraeme 13508: <code class="varname">INFO_FILES</code> variable
13509: in the package Makefile.</p>
1.1 grant 13510: </li>
13511: </ul>
13512: </div>
13513:
1.14 xtraeme 13514: <p><code class="varname">INFO_DIR</code> defaults to
1.1 grant 13515: “<span class="quote">info</span>” and can
1.45 wiz 13516: be overridden in the package Makefile. <code xmlns=
13517: "http://www.w3.org/TR/xhtml1/transitional" class=
13518: "filename">INSTALL</code> and <code xmlns=
13519: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13520: "filename">DEINSTALL</code> scripts will be generated
13521: to handle registration of the info files in the Info
1.1 grant 13522: directory file. The “<span class=
13523: "quote">install-info</span>” command used for the
13524: info files registration is either provided by the
13525: system, or by a special purpose package automatically
13526: added as dependency if needed.</p>
13527:
13528: <p>A package which needs the “<span class=
13529: "quote">makeinfo</span>” command at build time
1.14 xtraeme 13530: must define the variable <code class=
13531: "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1 grant 13532: minimum version of the “<span class=
13533: "quote">makeinfo</span>” command is needed it
1.14 xtraeme 13534: should be noted with the <code class=
13535: "varname">TEXINFO_REQD</code> variable in the package
1.45 wiz 13536: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13537: class="filename">Makefile</code>. By default, a minimum
13538: version of 3.12 is required. If the system does not
13539: provide a <span><strong class=
1.14 xtraeme 13540: "command">makeinfo</strong></span> command or if it
13541: does not match the required minimum, a build dependency
13542: on the <a xmlns=
13543: "http://www.w3.org/TR/xhtml1/transitional" href=
1.1 grant 13544: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.45 wiz 13545: target="_top"><code xmlns="" class=
13546: "filename">devel/gtexinfo</code></a> package will be
1.20 ben 13547: added automatically.</p>
1.1 grant 13548:
13549: <p>The build and installation process of the software
13550: provided by the package should not use the
1.14 xtraeme 13551: <span><strong class=
13552: "command">install-info</strong></span> command as the
13553: registration of info files is the task of the package
1.45 wiz 13554: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13555: class="filename">INSTALL</code> script, and it must use
13556: the appropriate <span><strong class=
1.14 xtraeme 13557: "command">makeinfo</strong></span> command.</p>
1.1 grant 13558:
1.47 reed 13559: <p>To achieve this goal, the pkgsrc infrastructure
1.14 xtraeme 13560: creates overriding scripts for the <span><strong class=
13561: "command">install-info</strong></span> and
13562: <span><strong class="command">makeinfo</strong></span>
13563: commands in a directory listed early in <code class=
13564: "varname">PATH</code>.</p>
1.1 grant 13565:
1.14 xtraeme 13566: <p>The script overriding <span><strong class=
13567: "command">install-info</strong></span> has no effect
13568: except the logging of a message. The script overriding
13569: <span><strong class="command">makeinfo</strong></span>
13570: logs a message and according to the value of
13571: <code class="varname">USE_MAKEINFO</code> and
13572: <code class="varname">TEXINFO_REQD</code> either run
13573: the appropriate <span><strong class=
13574: "command">makeinfo</strong></span> command or exit on
13575: error.</p>
1.1 grant 13576: </div>
13577:
1.63 dillo 13578: <div class="sect2" lang="en">
1.57 minskim 13579: <div class="titlepage">
13580: <div>
13581: <div>
1.63 dillo 13582: <h3 class="title"><a name=
1.57 minskim 13583: "manpages"></a>15.5.8. Packages installing
13584: man pages</h3>
13585: </div>
13586: </div>
13587: </div>
13588:
13589: <p>Many packages install manual pages. The man pages
13590: are installed under <code class=
13591: "varname">${PREFIX}/${PKGMANDIR}</code> which is
13592: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13593: class="filename">/usr/pkg/man</code> by default.
13594: <code class="varname">PKGMANDIR</code> defaults to
13595: “<span class="quote">man</span>”. For
13596: example, you can set <code class=
13597: "varname">PKGMANDIR</code> to “<span class=
13598: "quote">share/man</span>” to have man pages
13599: install under <code xmlns=
13600: "http://www.w3.org/TR/xhtml1/transitional" class=
13601: "filename">/usr/pkg/share/man/</code> by default.</p>
13602:
13603: <div class="note" style=
13604: "margin-left: 0.5in; margin-right: 0.5in;">
13605: <h3 class="title">Note</h3>
13606:
13607: <p>The support for a custom <code class=
13608: "varname">PKGMANDIR</code> is not complete.</p>
13609: </div>
13610:
13611: <p>The <code xmlns=
13612: "http://www.w3.org/TR/xhtml1/transitional" class=
13613: "filename">PLIST</code> files can just use <code xmlns=
13614: "http://www.w3.org/TR/xhtml1/transitional" class=
13615: "filename">man/</code> as the top level directory for
13616: the man page file entries and the pkgsrc framework will
13617: convert as needed.</p>
13618:
13619: <p>Packages that are configured with <code class=
13620: "varname">GNU_CONFIGURE</code> set as
13621: “<span class="quote">yes</span>”, by
13622: default will use the <code xmlns=
13623: "http://www.w3.org/TR/xhtml1/transitional" class=
13624: "filename">./configure</code> --mandir switch to set
13625: where the man pages should be installed. The path is
13626: <code class="varname">GNU_CONFIGURE_MANDIR</code> which
13627: defaults to <code class=
13628: "varname">${PREFIX}/${PKGMANDIR}</code>.</p>
13629:
13630: <p>Packages that use <code class=
13631: "varname">GNU_CONFIGURE</code> but do not use --mandir,
13632: can set <code class=
13633: "varname">CONFIGURE_HAS_MANDIR</code> to
13634: “<span class="quote">no</span>”. Or if the
13635: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
13636: class="filename">./configure</code> script uses a
13637: non-standard use of --mandir, you can set <code class=
13638: "varname">GNU_CONFIGURE_MANDIR</code> as needed.</p>
13639:
13640: <p>See <a href="#manpage-compression" title=
13641: "10.5. Man page compression">Section 10.5,
13642: “Man page compression”</a> for information
13643: on installation of compressed manual pages.</p>
13644: </div>
13645:
1.63 dillo 13646: <div class="sect2" lang="en">
1.1 grant 13647: <div class="titlepage">
13648: <div>
13649: <div>
1.63 dillo 13650: <h3 class="title"><a name=
1.57 minskim 13651: "gconf2-data-files"></a>15.5.9. Packages
1.30 wiz 13652: installing GConf2 data files</h3>
1.1 grant 13653: </div>
13654: </div>
13655: </div>
13656:
1.45 wiz 13657: <p>If a package installs <code xmlns=
13658: "http://www.w3.org/TR/xhtml1/transitional" class=
13659: "filename">.schemas</code> or <code xmlns=
13660: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13661: "filename">.entries</code> files, used by GConf2, you
1.1 grant 13662: need to take some extra steps to make sure they get
13663: registered in the database:</p>
13664:
13665: <div class="orderedlist">
13666: <ol type="1">
13667: <li>
1.45 wiz 13668: <p>Include <code xmlns=
13669: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13670: "filename">../../devel/GConf2/schemas.mk</code>
1.45 wiz 13671: instead of its <code xmlns=
13672: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13673: "filename">buildlink3.mk</code> file. This takes
1.1 grant 13674: care of rebuilding the GConf2 database at
13675: installation and deinstallation time, and tells
13676: the package where to install GConf2 data files
13677: using some standard configure arguments. It also
13678: disallows any access to the database directly
13679: from the package.</p>
13680: </li>
13681:
13682: <li>
13683: <p>Ensure that the package installs its
1.45 wiz 13684: <code xmlns=
13685: "http://www.w3.org/TR/xhtml1/transitional" class=
13686: "filename">.schemas</code> files under
13687: <code xmlns=
13688: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13689: "filename">${PREFIX}/share/gconf/schemas</code>.
1.45 wiz 13690: If they get installed under <code xmlns=
13691: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13692: "filename">${PREFIX}/etc</code>, you will need to
1.1 grant 13693: manually patch the package.</p>
13694: </li>
13695:
13696: <li>
13697: <p>Check the PLIST and remove any entries under
13698: the etc/gconf directory, as they will be handled
13699: automatically. See <a href="#faq.conf" title=
1.38 dillo 13700: "7.14. How do I change the location of configuration files?">
13701: Section 7.14, “How do I change the
1.35 jmmv 13702: location of configuration files?”</a> for
13703: more information.</p>
1.1 grant 13704: </li>
13705:
13706: <li>
1.14 xtraeme 13707: <p>Define the <code class=
13708: "varname">GCONF2_SCHEMAS</code> variable in your
1.45 wiz 13709: <code xmlns=
13710: "http://www.w3.org/TR/xhtml1/transitional" class=
13711: "filename">Makefile</code> with a list of all
13712: <code xmlns=
13713: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13714: "filename">.schemas</code> files installed by the
13715: package, if any. Names must not contain any
13716: directories in them.</p>
1.1 grant 13717: </li>
13718:
13719: <li>
1.14 xtraeme 13720: <p>Define the <code class=
13721: "varname">GCONF2_ENTRIES</code> variable in your
1.45 wiz 13722: <code xmlns=
13723: "http://www.w3.org/TR/xhtml1/transitional" class=
13724: "filename">Makefile</code> with a list of all
13725: <code xmlns=
13726: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13727: "filename">.entries</code> files installed by the
13728: package, if any. Names must not contain any
13729: directories in them.</p>
1.1 grant 13730: </li>
13731: </ol>
13732: </div>
13733: </div>
13734:
1.63 dillo 13735: <div class="sect2" lang="en">
1.1 grant 13736: <div class="titlepage">
13737: <div>
13738: <div>
1.30 wiz 13739: <h3 class="title"><a name=
1.57 minskim 13740: "scrollkeeper-data-files"></a>15.5.10. Packages
1.30 wiz 13741: installing scrollkeeper data files</h3>
1.1 grant 13742: </div>
13743: </div>
13744: </div>
13745:
1.45 wiz 13746: <p>If a package installs <code xmlns=
13747: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13748: "filename">.omf</code> files, used by scrollkeeper, you
13749: need to take some extra steps to make sure they get
13750: registered in the database:</p>
1.1 grant 13751:
13752: <div class="orderedlist">
13753: <ol type="1">
13754: <li>
1.45 wiz 13755: <p>Include <code xmlns=
13756: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13757: "filename">../../textproc/scrollkeeper/omf.mk</code>
1.45 wiz 13758: instead of its <code xmlns=
13759: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13760: "filename">buildlink3.mk</code> file. This takes
1.1 grant 13761: care of rebuilding the scrollkeeper database at
13762: installation and deinstallation time, and
13763: disallows any access to it directly from the
13764: package.</p>
13765: </li>
13766:
13767: <li>
13768: <p>Check the PLIST and remove any entries under
1.45 wiz 13769: the <code xmlns=
13770: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13771: "filename">libdata/scrollkeeper</code> directory,
1.1 grant 13772: as they will be handled automatically.</p>
13773: </li>
13774:
13775: <li>
1.45 wiz 13776: <p>Remove the <code xmlns=
13777: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13778: "filename">share/omf</code> directory from the
13779: PLIST. It will be handled by scrollkeeper.</p>
1.1 grant 13780: </li>
13781: </ol>
13782: </div>
13783: </div>
13784:
1.63 dillo 13785: <div class="sect2" lang="en">
1.1 grant 13786: <div class="titlepage">
13787: <div>
13788: <div>
1.63 dillo 13789: <h3 class="title"><a name=
1.57 minskim 13790: "x11-fonts"></a>15.5.11. Packages installing
1.1 grant 13791: X11 fonts</h3>
13792: </div>
13793: </div>
13794: </div>
13795:
13796: <p>If a package installs font files, you will need to
13797: rebuild the fonts database in the directory where they
13798: get installed at installation and deinstallation time.
1.65 ! hubertf 13799: This can be automatically done by using the pkginstall
! 13800: framework.</p>
1.1 grant 13801:
1.65 ! hubertf 13802: <p>You can list the directories where fonts are
! 13803: installed in the <code class=
! 13804: "varname">FONTS_DIRS.<em class=
! 13805: "replaceable"><code>type</code></em></code> variables,
! 13806: where <em class="replaceable"><code>type</code></em>
! 13807: can be one of “<span class=
! 13808: "quote">ttf</span>”, “<span class=
! 13809: "quote">type1</span>” or “<span class=
! 13810: "quote">x11</span>”. Also make sure that the
! 13811: database file <code xmlns=
1.45 wiz 13812: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13813: "filename">fonts.dir</code> is not listed in the
1.1 grant 13814: PLIST.</p>
13815:
13816: <p>Note that you should not create new directories for
13817: fonts; instead use the standard ones to avoid that the
13818: user needs to manually configure his X server to find
13819: them.</p>
13820: </div>
13821:
1.63 dillo 13822: <div class="sect2" lang="en">
1.1 grant 13823: <div class="titlepage">
13824: <div>
13825: <div>
1.63 dillo 13826: <h3 class="title"><a name=
1.57 minskim 13827: "gtk2-modules"></a>15.5.12. Packages
1.30 wiz 13828: installing GTK2 modules</h3>
1.1 grant 13829: </div>
13830: </div>
13831: </div>
13832:
1.47 reed 13833: <p>If a package installs GTK2 immodules or loaders, you
1.1 grant 13834: need to take some extra steps to get them registered in
13835: the GTK2 database properly:</p>
13836:
13837: <div class="orderedlist">
13838: <ol type="1">
13839: <li>
1.45 wiz 13840: <p>Include <code xmlns=
13841: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13842: "filename">../../x11/gtk2/modules.mk</code>
1.45 wiz 13843: instead of its <code xmlns=
13844: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13845: "filename">buildlink3.mk</code> file. This takes
13846: care of rebuilding the database at installation
13847: and deinstallation time.</p>
1.1 grant 13848: </li>
13849:
13850: <li>
1.14 xtraeme 13851: <p>Set <code class=
13852: "varname">GTK2_IMMODULES=YES</code> if your
13853: package installs GTK2 immodules.</p>
1.1 grant 13854: </li>
13855:
13856: <li>
1.14 xtraeme 13857: <p>Set <code class=
13858: "varname">GTK2_LOADERS=YES</code> if your package
13859: installs GTK2 loaders.</p>
1.1 grant 13860: </li>
13861:
13862: <li>
1.47 reed 13863: <p>Patch the package to not touch any of the GTK2
1.1 grant 13864: databases directly. These are:</p>
13865:
13866: <div class="itemizedlist">
13867: <ul type="disc">
13868: <li>
1.45 wiz 13869: <p><code xmlns=
13870: "http://www.w3.org/TR/xhtml1/transitional"
13871: class=
1.14 xtraeme 13872: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1 grant 13873: </li>
13874:
13875: <li>
1.45 wiz 13876: <p><code xmlns=
13877: "http://www.w3.org/TR/xhtml1/transitional"
13878: class=
1.14 xtraeme 13879: "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1 grant 13880: </li>
13881: </ul>
13882: </div>
13883: </li>
13884:
13885: <li>
13886: <p>Check the PLIST and remove any entries under
1.45 wiz 13887: the <code xmlns=
13888: "http://www.w3.org/TR/xhtml1/transitional" class=
13889: "filename">libdata/gtk-2.0</code> directory, as
13890: they will be handled automatically.</p>
1.1 grant 13891: </li>
13892: </ol>
13893: </div>
13894: </div>
13895:
1.63 dillo 13896: <div class="sect2" lang="en">
1.1 grant 13897: <div class="titlepage">
13898: <div>
13899: <div>
1.63 dillo 13900: <h3 class="title"><a name=
1.57 minskim 13901: "sgml-xml-data"></a>15.5.13. Packages
1.30 wiz 13902: installing SGML or XML data</h3>
1.1 grant 13903: </div>
13904: </div>
13905: </div>
13906:
13907: <p>If a package installs SGML or XML data files that
13908: need to be registered in system-wide catalogs (like
13909: DTDs, sub-catalogs, etc.), you need to take some extra
13910: steps:</p>
13911:
13912: <div class="orderedlist">
13913: <ol type="1">
13914: <li>
1.45 wiz 13915: <p>Include <code xmlns=
13916: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13917: "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
1.45 wiz 13918: in your <code xmlns=
13919: "http://www.w3.org/TR/xhtml1/transitional" class=
13920: "filename">Makefile</code>, which takes care of
13921: registering those files in system-wide catalogs
13922: at installation and deinstallation time.</p>
1.1 grant 13923: </li>
13924:
13925: <li>
1.14 xtraeme 13926: <p>Set <code class="varname">SGML_CATALOGS</code>
13927: to the full path of any SGML catalogs installed
13928: by the package.</p>
1.1 grant 13929: </li>
13930:
13931: <li>
1.14 xtraeme 13932: <p>Set <code class="varname">XML_CATALOGS</code>
13933: to the full path of any XML catalogs installed by
1.1 grant 13934: the package.</p>
13935: </li>
13936:
13937: <li>
1.14 xtraeme 13938: <p>Set <code class="varname">SGML_ENTRIES</code>
13939: to individual entries to be added to the SGML
1.1 grant 13940: catalog. These come in groups of three strings;
13941: see xmlcatmgr(1) for more information
13942: (specifically, arguments recognized by the 'add'
13943: action). Note that you will normally not use this
13944: variable.</p>
13945: </li>
13946:
13947: <li>
1.14 xtraeme 13948: <p>Set <code class="varname">XML_ENTRIES</code>
13949: to individual entries to be added to the XML
1.1 grant 13950: catalog. These come in groups of three strings;
13951: see xmlcatmgr(1) for more information
13952: (specifically, arguments recognized by the 'add'
13953: action). Note that you will normally not use this
13954: variable.</p>
13955: </li>
13956: </ol>
13957: </div>
13958: </div>
13959:
1.63 dillo 13960: <div class="sect2" lang="en">
1.1 grant 13961: <div class="titlepage">
13962: <div>
13963: <div>
1.63 dillo 13964: <h3 class="title"><a name=
1.57 minskim 13965: "mime-database"></a>15.5.14. Packages
1.30 wiz 13966: installing extensions to the MIME database</h3>
1.1 grant 13967: </div>
13968: </div>
13969: </div>
13970:
13971: <p>If a package provides extensions to the MIME
1.45 wiz 13972: database by installing <code xmlns=
13973: "http://www.w3.org/TR/xhtml1/transitional" class=
13974: "filename">.xml</code> files inside <code xmlns=
13975: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13976: "filename">${PREFIX}/share/mime/packages</code>, you
13977: need to take some extra steps to ensure that the
13978: database is kept consistent with respect to these new
13979: files:</p>
1.1 grant 13980:
13981: <div class="orderedlist">
13982: <ol type="1">
13983: <li>
1.45 wiz 13984: <p>Include <code xmlns=
13985: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13986: "filename">../../databases/shared-mime-info/mimedb.mk</code>
1.45 wiz 13987: (avoid using the <code xmlns=
13988: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13989: "filename">buildlink3.mk</code> file from this
13990: same directory, which is reserved for inclusion
1.45 wiz 13991: from other <code xmlns=
13992: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 13993: "filename">buildlink3.mk</code> files). It takes
13994: care of rebuilding the MIME database at
13995: installation and deinstallation time, and
13996: disallows any access to it directly from the
1.1 grant 13997: package.</p>
13998: </li>
13999:
14000: <li>
14001: <p>Check the PLIST and remove any entries under
1.45 wiz 14002: the <code xmlns=
14003: "http://www.w3.org/TR/xhtml1/transitional" class=
14004: "filename">share/mime</code> directory,
14005: <span class="emphasis"><em>except</em></span> for
14006: files saved under <code xmlns=
14007: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14008: "filename">share/mime/packages</code>. The former
1.1 grant 14009: are handled automatically by the
1.47 reed 14010: update-mime-database program, but the latter are
1.1 grant 14011: package-dependent and must be removed by the
14012: package that installed them in the first
14013: place.</p>
14014: </li>
14015:
14016: <li>
1.45 wiz 14017: <p>Remove any <code xmlns=
14018: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14019: "filename">share/mime/*</code> directories from
14020: the PLIST. They will be handled by the
1.1 grant 14021: shared-mime-info package.</p>
14022: </li>
14023: </ol>
14024: </div>
14025: </div>
14026:
1.63 dillo 14027: <div class="sect2" lang="en">
1.1 grant 14028: <div class="titlepage">
14029: <div>
14030: <div>
1.63 dillo 14031: <h3 class="title"><a name=
1.57 minskim 14032: "intltool"></a>15.5.15. Packages using
1.1 grant 14033: intltool</h3>
14034: </div>
14035: </div>
14036: </div>
14037:
14038: <p>If a package uses intltool during its build, include
1.45 wiz 14039: the <code xmlns=
14040: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14041: "filename">../../textproc/intltool/buildlink3.mk</code>
1.1 grant 14042: file, which forces it to use the intltool package
14043: provided by pkgsrc, instead of the one bundled with the
14044: distribution file.</p>
14045:
14046: <p>This tracks intltool's build-time dependencies and
14047: uses the latest available version; this way, the
14048: package benefits of any bug fixes that may have
14049: appeared since it was released.</p>
14050: </div>
1.18 xtraeme 14051:
1.63 dillo 14052: <div class="sect2" lang="en">
1.18 xtraeme 14053: <div class="titlepage">
14054: <div>
14055: <div>
1.63 dillo 14056: <h3 class="title"><a name=
1.57 minskim 14057: "startup-scripts"></a>15.5.16. Packages
1.30 wiz 14058: installing startup scripts</h3>
1.18 xtraeme 14059: </div>
14060: </div>
14061: </div>
14062:
14063: <p>If a package contains a rc.d script, it won't be
14064: copied into the startup directory by default, but you
14065: can enable it, by adding the option <code class=
1.45 wiz 14066: "varname">PKG_RCD_SCRIPTS=YES</code> in <code xmlns=
14067: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 14068: "filename">/etc/mk.conf</code>. This option will copy
1.45 wiz 14069: the scripts into <code xmlns=
14070: "http://www.w3.org/TR/xhtml1/transitional" class=
1.18 xtraeme 14071: "filename">/etc/rc.d</code> when a package is
14072: installed, and it will automatically remove the scripts
14073: when the package is deinstalled.</p>
14074: </div>
1.57 minskim 14075:
1.63 dillo 14076: <div class="sect2" lang="en">
1.57 minskim 14077: <div class="titlepage">
14078: <div>
14079: <div>
1.63 dillo 14080: <h3 class="title"><a name=
1.57 minskim 14081: "tex-packages"></a>15.5.17. Packages
14082: installing TeX modules</h3>
14083: </div>
14084: </div>
14085: </div>
14086:
14087: <p>If a package installs TeX packages into the texmf
14088: tree, the <code xmlns=
14089: "http://www.w3.org/TR/xhtml1/transitional" class=
14090: "filename">ls-R</code> database of the tree needs to be
14091: updated.</p>
14092:
14093: <div class="note" style=
14094: "margin-left: 0.5in; margin-right: 0.5in;">
14095: <h3 class="title">Note</h3>
14096:
14097: <p>Except the main TeX packages such as teTeX-texmf,
14098: packages should install files into <code class=
14099: "varname">PKG_LOCALTEXMFPREFIX</code>, not
14100: <code class="varname">PKG_TEXMFPREFIX</code>.</p>
14101: </div>
14102:
14103: <div class="orderedlist">
14104: <ol type="1">
14105: <li>
14106: <p>Include <code xmlns=
14107: "http://www.w3.org/TR/xhtml1/transitional" class=
14108: "filename">../../print/teTeX/module.mk</code>
14109: instead of <code xmlns=
14110: "http://www.w3.org/TR/xhtml1/transitional" class=
14111: "filename">../../mk/tex.buildlink3.mk</code>.
14112: This takes care of rebuilding the <code xmlns=
14113: "http://www.w3.org/TR/xhtml1/transitional" class=
14114: "filename">ls-R</code> database at installation
14115: and deinstallation time.</p>
14116: </li>
14117:
14118: <li>
14119: <p>If your package installs files into a texmf
14120: tree other than the one at <code class=
14121: "varname">PKG_LOCALTEXMFPREFIX</code>, set
14122: <code class="varname">TEXMFDIRS</code> to the
14123: list of all texmf trees that need database
14124: update.</p>
1.64 kim 14125:
14126: <p>If your package also installs font map files
14127: that need to be registered using
14128: <span><strong class=
14129: "command">updmap</strong></span>, set
14130: <code class="varname">TEX_FONTMAPS</code> to the
14131: list of all such font map files. Then
14132: <span><strong class=
14133: "command">updmap</strong></span> will be run
14134: automatically at installation/deinstallation to
14135: enable/disable font map files for TeX output
14136: drivers.</p>
1.57 minskim 14137: </li>
14138:
14139: <li>
14140: <p>Make sure that none of <code xmlns=
14141: "http://www.w3.org/TR/xhtml1/transitional" class=
14142: "filename">ls-R</code> databases are included in
14143: <code xmlns=
14144: "http://www.w3.org/TR/xhtml1/transitional" class=
14145: "filename">PLIST</code>, as they will be removed
14146: only by the teTeX-bin package.</p>
14147: </li>
14148: </ol>
14149: </div>
14150: </div>
1.1 grant 14151: </div>
14152:
1.63 dillo 14153: <div class="sect1" lang="en">
1.1 grant 14154: <div class="titlepage">
14155: <div>
14156: <div>
14157: <h2 class="title" style="clear: both"><a name=
1.38 dillo 14158: "feedback-to-author"></a>15.6. Feedback to the
1.30 wiz 14159: author</h2>
1.1 grant 14160: </div>
14161: </div>
14162: </div>
14163:
14164: <p>If you have found any bugs in the package you make
14165: available, if you had to do special steps to make it run
14166: under NetBSD or if you enhanced the software in various
14167: other ways, be sure to report these changes back to the
14168: original author of the program! With that kind of
14169: support, the next release of the program can incorporate
14170: these fixes, and people not using the NetBSD packages
14171: system can win from your efforts.</p>
14172:
14173: <p>Support the idea of free software!</p>
14174: </div>
14175: </div>
14176:
1.63 dillo 14177: <div class="chapter" lang="en">
1.1 grant 14178: <div class="titlepage">
14179: <div>
14180: <div>
1.63 dillo 14181: <h2 class="title"><a name=
1.38 dillo 14182: "debug"></a>Chapter 16. Debugging</h2>
1.1 grant 14183: </div>
14184: </div>
14185: </div>
14186:
14187: <p>To check out all the gotchas when building a package,
14188: here are the steps that I do in order to get a package
14189: working. Please note this is basically the same as what was
14190: explained in the previous sections, only with some
14191: debugging aids.</p>
14192:
14193: <div class="itemizedlist">
14194: <ul type="disc">
14195: <li>
1.14 xtraeme 14196: <p>Be sure to set <code class=
1.45 wiz 14197: "varname">PKG_DEVELOPER=1</code> in <code xmlns=
14198: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14199: "filename">/etc/mk.conf</code></p>
1.1 grant 14200: </li>
14201:
14202: <li>
14203: <p>Install <a xmlns=
14204: "http://www.w3.org/TR/xhtml1/transitional" href=
14205: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45 wiz 14206: target="_top"><code xmlns="" class=
14207: "filename">pkgtools/url2pkg</code></a>, create a
1.20 ben 14208: directory for a new package, change into it, then run
14209: <span><strong class=
14210: "command">url2pkg</strong></span>:</p>
1.1 grant 14211: <pre class="screen">
1.14 xtraeme 14212: <code class="prompt">%</code> <strong class=
14213: "userinput"><code>mkdir /usr/pkgsrc/<em class=
14214: "replaceable"><code>category</code></em>/<em class=
14215: "replaceable"><code>examplepkg</code></em></code></strong>
14216: <code class="prompt">%</code> <strong class=
14217: "userinput"><code>cd /usr/pkgsrc/<em class=
14218: "replaceable"><code>category</code></em>/<em class=
14219: "replaceable"><code>examplepkg</code></em></code></strong>
14220: <code class="prompt">%</code> <strong class=
14221: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1 grant 14222: </pre>
14223: </li>
14224:
14225: <li>
1.45 wiz 14226: <p>Edit the <code xmlns=
14227: "http://www.w3.org/TR/xhtml1/transitional" class=
14228: "filename">Makefile</code> as requested.</p>
1.1 grant 14229: </li>
14230:
14231: <li>
1.45 wiz 14232: <p>Fill in the <code xmlns=
14233: "http://www.w3.org/TR/xhtml1/transitional" class=
14234: "filename">DESCR</code> file</p>
1.1 grant 14235: </li>
14236:
14237: <li>
1.14 xtraeme 14238: <p>Run <span><strong class="command">make
14239: configure</strong></span></p>
1.1 grant 14240: </li>
14241:
14242: <li>
14243: <p>Add any dependencies glimpsed from documentation
1.45 wiz 14244: and the configure step to the package's <code xmlns=
14245: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14246: "filename">Makefile</code>.</p>
1.1 grant 14247: </li>
14248:
14249: <li>
14250: <p>Make the package compile, doing multiple rounds
14251: of</p>
14252: <pre class="screen">
1.14 xtraeme 14253: <code class="prompt">%</code> <strong class=
14254: "userinput"><code>make</code></strong>
14255: <code class="prompt">%</code> <strong class=
14256: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
14257: <code class="prompt">%</code> <strong class=
14258: "userinput"><code>mkpatches</code></strong>
14259: <code class="prompt">%</code> <strong class=
14260: "userinput"><code>patchdiff</code></strong>
14261: <code class="prompt">%</code> <strong class=
14262: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
14263: <code class="prompt">%</code> <strong class=
14264: "userinput"><code>make mps</code></strong>
14265: <code class="prompt">%</code> <strong class=
14266: "userinput"><code>make clean</code></strong>
1.1 grant 14267: </pre>
14268:
14269: <p>Doing as non-root user will ensure that no files
14270: are modified that shouldn't be, especially during the
1.14 xtraeme 14271: build phase. <span><strong class=
14272: "command">mkpatches</strong></span>,
14273: <span><strong class=
14274: "command">patchdiff</strong></span> and
14275: <span><strong class="command">pkgvi</strong></span>
14276: are from the <a xmlns=
1.1 grant 14277: "http://www.w3.org/TR/xhtml1/transitional" href=
14278: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45 wiz 14279: target="_top"><code xmlns="" class=
14280: "filename">pkgtools/pkgdiff</code></a> package.</p>
1.1 grant 14281: </li>
14282:
14283: <li>
1.45 wiz 14284: <p>Look at the <code xmlns=
14285: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14286: "filename">Makefile</code>, fix if necessary; see
14287: <a href="#components.Makefile" title=
1.38 dillo 14288: "8.1. Makefile">Section 8.1,
1.45 wiz 14289: “<code xmlns=
14290: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14291: "filename">Makefile</code>”</a>.</p>
1.1 grant 14292: </li>
14293:
14294: <li>
1.45 wiz 14295: <p>Generate a <code xmlns=
14296: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14297: "filename">PLIST</code>:</p>
1.1 grant 14298: <pre class="screen">
1.14 xtraeme 14299: <code class="prompt">#</code> <strong class=
14300: "userinput"><code>make install</code></strong>
14301: <code class="prompt">#</code> <strong class=
14302: "userinput"><code>make print-PLIST >PLIST</code></strong>
14303: <code class="prompt">#</code> <strong class=
14304: "userinput"><code>make deinstall</code></strong>
14305: <code class="prompt">#</code> <strong class=
14306: "userinput"><code>make install</code></strong>
14307: <code class="prompt">#</code> <strong class=
14308: "userinput"><code>make deinstall</code></strong>
1.1 grant 14309: </pre>
14310:
1.45 wiz 14311: <p>You usually need to be <code xmlns=
14312: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14313: "username">root</code> to do this. Look if there are
1.1 grant 14314: any files left:</p>
14315: <pre class="screen">
1.14 xtraeme 14316: <code class="prompt">#</code> <strong class=
14317: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 14318: </pre>
14319:
14320: <p>If this reveals any files that are missing in
1.45 wiz 14321: <code xmlns=
14322: "http://www.w3.org/TR/xhtml1/transitional" class=
14323: "filename">PLIST</code>, add them.</p>
1.1 grant 14324: </li>
14325:
14326: <li>
1.45 wiz 14327: <p>Now that the <code xmlns=
14328: "http://www.w3.org/TR/xhtml1/transitional" class=
14329: "filename">PLIST</code> is OK, install the package
14330: again and make a binary package:</p>
1.1 grant 14331: <pre class="screen">
1.14 xtraeme 14332: <code class="prompt">#</code> <strong class=
14333: "userinput"><code>make reinstall</code></strong>
14334: <code class="prompt">#</code> <strong class=
14335: "userinput"><code>make package</code></strong>
1.1 grant 14336: </pre>
14337: </li>
14338:
14339: <li>
14340: <p>Delete the installed package:</p>
14341: <pre class="screen">
1.14 xtraeme 14342: <code class="prompt">#</code> <strong class=
14343: "userinput"><code>pkg_delete blub</code></strong>
1.1 grant 14344: </pre>
14345: </li>
14346:
14347: <li>
1.14 xtraeme 14348: <p>Repeat the above <span><strong class=
14349: "command">make print-PLIST</strong></span> command,
14350: which shouldn't find anything now:</p>
1.1 grant 14351: <pre class="screen">
1.14 xtraeme 14352: <code class="prompt">#</code> <strong class=
14353: "userinput"><code>make print-PLIST</code></strong>
1.1 grant 14354: </pre>
14355: </li>
14356:
14357: <li>
14358: <p>Reinstall the binary package:</p>
14359: <pre class="screen">
1.14 xtraeme 14360: <code class="prompt">#</code> <strong class=
14361: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1 grant 14362: </pre>
14363: </li>
14364:
14365: <li>
14366: <p>Play with it. Make sure everything works.</p>
14367: </li>
14368:
14369: <li>
1.14 xtraeme 14370: <p>Run <span><strong class=
14371: "command">pkglint</strong></span> from <a xmlns=
1.1 grant 14372: "http://www.w3.org/TR/xhtml1/transitional" href=
14373: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 14374: target="_top"><code xmlns="" class=
14375: "filename">pkgtools/pkglint</code></a>, and fix the
1.20 ben 14376: problems it reports:</p>
1.1 grant 14377: <pre class="screen">
1.14 xtraeme 14378: <code class="prompt">#</code> <strong class=
14379: "userinput"><code>pkglint</code></strong>
1.1 grant 14380: </pre>
14381: </li>
14382:
14383: <li>
14384: <p>Submit (or commit, if you have cvs access); see
14385: <a href="#submit" title=
1.38 dillo 14386: "Chapter 17. Submitting and Committing">Chapter 17,
1.1 grant 14387: <i>Submitting and Committing</i></a>.</p>
14388: </li>
14389: </ul>
14390: </div>
14391: </div>
14392:
1.63 dillo 14393: <div class="chapter" lang="en">
1.1 grant 14394: <div class="titlepage">
14395: <div>
14396: <div>
1.63 dillo 14397: <h2 class="title"><a name=
1.38 dillo 14398: "submit"></a>Chapter 17. Submitting and
1.1 grant 14399: Committing</h2>
14400: </div>
14401: </div>
14402: </div>
14403:
14404: <div class="toc">
14405: <p><b>Table of Contents</b></p>
14406:
14407: <dl>
1.30 wiz 14408: <dt><span class="sect1"><a href=
1.38 dillo 14409: "#submitting-your-package">17.1. Submitting your
1.30 wiz 14410: packages</a></span></dt>
1.1 grant 14411:
1.30 wiz 14412: <dt><span class="sect1"><a href=
1.41 wiz 14413: "#general-notes-for-changes">17.2. General notes when
14414: adding, updating, or removing packages</a></span></dt>
14415:
14416: <dt><span class="sect1"><a href=
14417: "#committing-importing">17.3. Committing: Importing a
1.30 wiz 14418: package into CVS</a></span></dt>
1.1 grant 14419:
1.30 wiz 14420: <dt><span class="sect1"><a href=
1.41 wiz 14421: "#updating-package">17.4. Updating a package to a newer
1.30 wiz 14422: version</a></span></dt>
1.1 grant 14423:
1.41 wiz 14424: <dt><span class="sect1"><a href="#moving-package">17.5.
1.2 hubertf 14425: Moving a package in pkgsrc</a></span></dt>
1.1 grant 14426: </dl>
14427: </div>
14428:
1.63 dillo 14429: <div class="sect1" lang="en">
1.1 grant 14430: <div class="titlepage">
14431: <div>
14432: <div>
14433: <h2 class="title" style="clear: both"><a name=
1.38 dillo 14434: "submitting-your-package"></a>17.1. Submitting
1.30 wiz 14435: your packages</h2>
1.1 grant 14436: </div>
14437: </div>
14438: </div>
14439:
14440: <p>You have to separate between binary and
14441: “<span class="quote">normal</span>” (source)
14442: packages here:</p>
14443:
14444: <div class="itemizedlist">
14445: <ul type="disc">
14446: <li>
14447: <p>precompiled binary packages</p>
14448:
14449: <p>Our policy is that we accept binaries only from
14450: pkgsrc developers to guarantee that the packages
14451: don't contain any trojan horses etc. This is not to
1.13 hubertf 14452: annoy anyone but rather to protect our users!
1.1 grant 14453: You're still free to put up your home-made binary
1.13 hubertf 14454: packages and tell the world where to get them.
14455: NetBSD developers doing bulk builds and wanting to
14456: upload them please see <a href="#bulk-upload"
1.38 dillo 14457: title="6.3.8. Uploading results of a bulk build">
14458: Section 6.3.8, “Uploading results of a
1.13 hubertf 14459: bulk build”</a>.</p>
1.1 grant 14460: </li>
14461:
14462: <li>
14463: <p>packages</p>
14464:
14465: <p>First, check that your package is complete,
14466: compiles and runs well; see <a href="#debug" title=
1.38 dillo 14467: "Chapter 16. Debugging">Chapter 16,
1.1 grant 14468: <i>Debugging</i></a> and the rest of this document.
1.24 wiz 14469: Next, generate an uuencoded gzipped <a href=
14470: "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
14471: <span class="citerefentry"><span class=
14472: "refentrytitle">tar</span>(1)</span></a> archive,
1.1 grant 14473: preferably with all files in a single directory.
1.14 xtraeme 14474: Finally, <span><strong class=
14475: "command">send-pr</strong></span> with category
1.1 grant 14476: “<span class="quote">pkg</span>”, a
14477: synopsis which includes the package name and
14478: version number, a short description of your package
14479: (contents of the COMMENT variable or DESCR file are
14480: OK) and attach the archive to your PR.</p>
14481:
14482: <p>If you want to submit several packages, please
14483: send a separate PR for each one, it's easier for us
14484: to track things that way.</p>
14485:
14486: <p>Alternatively, you can also import new packages
14487: into pkgsrc-wip (“<span class="quote">pkgsrc
14488: work-in-progress</span>”); see the homepage
14489: at <a href="http://pkgsrc-wip.sourceforge.net/"
14490: target=
14491: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
14492: details.</p>
14493: </li>
14494: </ul>
14495: </div>
14496: </div>
14497:
1.63 dillo 14498: <div class="sect1" lang="en">
1.1 grant 14499: <div class="titlepage">
14500: <div>
14501: <div>
14502: <h2 class="title" style="clear: both"><a name=
1.41 wiz 14503: "general-notes-for-changes"></a>17.2. General
14504: notes when adding, updating, or removing
14505: packages</h2>
14506: </div>
14507: </div>
14508: </div>
14509:
14510: <p>Please note all package additions, updates, moves, and
1.45 wiz 14511: removals in <code xmlns=
14512: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 14513: "filename">pkgsrc/doc/CHANGES</code>. It's very important
14514: to keep this file up to date and conforming to the
14515: existing format, because it will be used by scripts to
14516: automatically update pages on <a href=
14517: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
1.45 wiz 14518: and other sites. Additionally, check the <code xmlns=
14519: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 14520: "filename">pkgsrc/doc/TODO</code> file and remove the
14521: entry for the package you updated or removed, in case it
14522: was mentioned there.</p>
14523:
14524: <p>There is a make target that helps in creating proper
1.45 wiz 14525: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14526: class="filename">CHANGES</code> entries:
1.41 wiz 14527: <span><strong class="command">make
14528: changes-entry</strong></span>. It uses the optional
14529: <code class="varname">CTYPE</code> and <code class=
14530: "varname">NETBSD_LOGIN_NAME</code> variables. The general
1.45 wiz 14531: usage is to first make sure that your <code xmlns=
14532: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 14533: "filename">CHANGES</code> file is up-to-date (to avoid
14534: having to resolve conflicts later-on) and then to
14535: <span><strong class="command">cd</strong></span> to the
14536: package directory. For package updates,
14537: <span><strong class="command">make
14538: changes-entry</strong></span> is enough. For new
14539: packages, or package moves or removals, set the
14540: <code class="varname">CTYPE</code> variable on the
14541: command line to "Added", "Moved", or "Removed". You can
14542: set <code class="varname">NETBSD_LOGIN_NAME</code> in
1.45 wiz 14543: <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
14544: class="filename">/etc/mk.conf</code> if your local login
14545: name is not the same as your NetBSD login name. Don't
14546: forget to commit the changes to <code xmlns=
14547: "http://www.w3.org/TR/xhtml1/transitional" class=
1.41 wiz 14548: "filename">pkgsrc/doc/CHANGES</code>!</p>
14549: </div>
14550:
1.63 dillo 14551: <div class="sect1" lang="en">
1.41 wiz 14552: <div class="titlepage">
14553: <div>
14554: <div>
14555: <h2 class="title" style="clear: both"><a name=
14556: "committing-importing"></a>17.3. Committing:
1.30 wiz 14557: Importing a package into CVS</h2>
1.1 grant 14558: </div>
14559: </div>
14560: </div>
14561:
14562: <p>This section is only of interest for pkgsrc developers
14563: with write access to the pkgsrc repository. Please
14564: remember that cvs imports files relative to the current
14565: working directory, and that the pathname that you give
1.14 xtraeme 14566: the <span><strong class="command">cvs
14567: import</strong></span> command is so that it knows where
14568: to place the files in the repository. Newly created
14569: packages should be imported with a vendor tag of
14570: “<span class="quote">TNF</span>” and a
14571: release tag of “<span class=
14572: "quote">pkgsrc-base</span>”, e.g:</p>
1.1 grant 14573: <pre class="programlisting">
1.51 rillig 14574: <code class="prompt">$</code> cd .../pkgsrc/category/pkgname
14575: <code class=
14576: "prompt">$</code> cvs import pkgsrc/category/pkgname TNF pkgsrc-base
1.1 grant 14577: </pre>
14578:
14579: <p>Remember to move the directory from which you imported
14580: out of the way, or cvs will complain the next time you
14581: “<span class="quote">cvs update</span>” your
14582: source tree. Also don't forget to add the new package to
1.45 wiz 14583: the category's <code xmlns=
14584: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14585: "filename">Makefile</code>.</p>
1.1 grant 14586:
14587: <p>The commit message of the initial import should
1.45 wiz 14588: include part of the <code xmlns=
14589: "http://www.w3.org/TR/xhtml1/transitional" class=
14590: "filename">DESCR</code> file, so people reading the
14591: mailing lists know what the package is/does.</p>
1.1 grant 14592:
14593: <p>For new packages, “<span class="quote">cvs
14594: import</span>” is preferred to “<span class=
14595: "quote">cvs add</span>” because the former gets
14596: everything with a single command, and provides a
14597: consistent tag.</p>
14598: </div>
14599:
1.63 dillo 14600: <div class="sect1" lang="en">
1.1 grant 14601: <div class="titlepage">
14602: <div>
14603: <div>
14604: <h2 class="title" style="clear: both"><a name=
1.41 wiz 14605: "updating-package"></a>17.4. Updating a
1.30 wiz 14606: package to a newer version</h2>
1.1 grant 14607: </div>
14608: </div>
14609: </div>
14610:
14611: <p>Please always put a concise, appropriate and relevant
14612: summary of the changes between old and new versions into
14613: the commit log when updating a package. There are various
14614: reasons for this:</p>
14615:
14616: <div class="itemizedlist">
14617: <ul type="disc">
14618: <li>
14619: <p>A URL is volatile, and can change over time. It
14620: may go away completely or its information may be
14621: overwritten by newer information.</p>
14622: </li>
14623:
14624: <li>
14625: <p>Having the change information between old and
14626: new versions in our CVS repository is very useful
14627: for people who use either cvs or anoncvs.</p>
14628: </li>
14629:
14630: <li>
14631: <p>Having the change information between old and
14632: new versions in our CVS repository is very useful
14633: for people who read the pkgsrc-changes mailing
14634: list, so that they can make tactical decisions
14635: about when to upgrade the package.</p>
14636: </li>
14637: </ul>
14638: </div>
14639:
1.18 xtraeme 14640: <p>Please also recognize that, just because a new version
1.1 grant 14641: of a package has been released, it should not
14642: automatically be upgraded in the CVS repository. We
14643: prefer to be conservative in the packages that are
14644: included in pkgsrc - development or beta packages are not
14645: really the best thing for most places in which pkgsrc is
14646: used. Please use your judgement about what should go into
14647: pkgsrc, and bear in mind that stability is to be
14648: preferred above new and possibly untested features.</p>
14649: </div>
14650:
1.63 dillo 14651: <div class="sect1" lang="en">
1.1 grant 14652: <div class="titlepage">
14653: <div>
14654: <div>
14655: <h2 class="title" style="clear: both"><a name=
1.41 wiz 14656: "moving-package"></a>17.5. Moving a package in
1.30 wiz 14657: pkgsrc</h2>
1.1 grant 14658: </div>
14659: </div>
14660: </div>
14661:
14662: <div class="orderedlist">
14663: <ol type="1">
14664: <li>
14665: <p>Make a copy of the directory somewhere else.</p>
14666: </li>
14667:
14668: <li>
14669: <p>Remove all CVS dirs.</p>
14670:
14671: <p>Alternatively to the first two steps you can
14672: also do:</p>
14673: <pre class="screen">
1.14 xtraeme 14674: <code class="prompt">%</code> <strong class=
14675: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1 grant 14676: </pre>
14677:
14678: <p>and use that for further work.</p>
14679: </li>
14680:
14681: <li>
1.14 xtraeme 14682: <p>Fix <code class="varname">CATEGORIES</code> and
14683: any <code class="varname">DEPENDS</code> paths that
14684: just did “<span class=
1.1 grant 14685: "quote">../package</span>” instead of
14686: “<span class=
14687: "quote">../../category/package</span>”.</p>
14688: </li>
14689:
14690: <li>
1.14 xtraeme 14691: <p><span><strong class="command">cvs
14692: import</strong></span> the modified package in the
14693: new place.</p>
1.1 grant 14694: </li>
14695:
14696: <li>
14697: <p>Check if any package depends on it:</p>
14698: <pre class="screen">
1.14 xtraeme 14699: <code class="prompt">%</code> <strong class=
14700: "userinput"><code>cd /usr/pkgsrc</code></strong>
14701: <code class="prompt">%</code> <strong class=
14702: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1 grant 14703: </pre>
14704: </li>
14705:
14706: <li>
14707: <p>Fix paths in packages from step 5 to point to
14708: new location.</p>
14709: </li>
14710:
14711: <li>
1.14 xtraeme 14712: <p><span><strong class="command">cvs rm
14713: (-f)</strong></span> the package at the old
14714: location.</p>
1.1 grant 14715: </li>
14716:
14717: <li>
1.45 wiz 14718: <p>Remove from <code xmlns=
14719: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14720: "filename">oldcategory/Makefile</code>.</p>
1.1 grant 14721: </li>
14722:
14723: <li>
1.45 wiz 14724: <p>Add to <code xmlns=
14725: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14726: "filename">newcategory/Makefile</code>.</p>
1.1 grant 14727: </li>
14728:
14729: <li>
14730: <p>Commit the changed and removed files:</p>
14731: <pre class="screen">
1.14 xtraeme 14732: <code class="prompt">%</code> <strong class=
14733: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1 grant 14734: </pre>
14735:
14736: <p>(and any packages from step 5, of course).</p>
14737: </li>
14738: </ol>
14739: </div>
14740: </div>
14741: </div>
14742: </div>
14743:
1.63 dillo 14744: <div class="appendix" lang="en">
1.1 grant 14745: <div class="titlepage">
14746: <div>
14747: <div>
1.63 dillo 14748: <h2 class="title"><a name=
1.46 gdt 14749: "examples"></a>Appendix A. A simple example
1.1 grant 14750: package: bison</h2>
14751: </div>
14752: </div>
14753: </div>
14754:
14755: <div class="toc">
14756: <p><b>Table of Contents</b></p>
14757:
14758: <dl>
1.46 gdt 14759: <dt><span class="sect1"><a href="#example-files">A.1.
1.1 grant 14760: files</a></span></dt>
14761:
14762: <dd>
14763: <dl>
1.30 wiz 14764: <dt><span class="sect2"><a href=
1.46 gdt 14765: "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1 grant 14766:
1.30 wiz 14767: <dt><span class="sect2"><a href=
1.46 gdt 14768: "#example-descr">A.1.2. DESCR</a></span></dt>
1.1 grant 14769:
1.30 wiz 14770: <dt><span class="sect2"><a href=
1.46 gdt 14771: "#example-plist">A.1.3. PLIST</a></span></dt>
1.1 grant 14772:
1.30 wiz 14773: <dt><span class="sect2"><a href=
1.46 gdt 14774: "#checking-package-with-pkglint">A.1.4. Checking a
1.30 wiz 14775: package with <span><strong class=
1.14 xtraeme 14776: "command">pkglint</strong></span></a></span></dt>
1.1 grant 14777: </dl>
14778: </dd>
14779:
1.46 gdt 14780: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30 wiz 14781: Steps for building, installing, packaging</a></span></dt>
1.1 grant 14782: </dl>
14783: </div>
14784:
14785: <p>We checked to find a piece of software that wasn't in the
14786: packages collection, and picked GNU bison. Quite why someone
1.14 xtraeme 14787: would want to have <span><strong class=
14788: "command">bison</strong></span> when Berkeley
14789: <span><strong class="command">yacc</strong></span> is already
14790: present in the tree is beyond us, but it's useful for the
14791: purposes of this exercise.</p>
1.1 grant 14792:
1.63 dillo 14793: <div class="sect1" lang="en">
1.1 grant 14794: <div class="titlepage">
14795: <div>
14796: <div>
14797: <h2 class="title" style="clear: both"><a name=
1.46 gdt 14798: "example-files"></a>A.1. files</h2>
1.1 grant 14799: </div>
14800: </div>
14801: </div>
14802:
1.63 dillo 14803: <div class="sect2" lang="en">
1.1 grant 14804: <div class="titlepage">
14805: <div>
14806: <div>
1.63 dillo 14807: <h3 class="title"><a name=
1.46 gdt 14808: "example-Makefile"></a>A.1.1. Makefile</h3>
1.1 grant 14809: </div>
14810: </div>
14811: </div>
14812: <pre class="programlisting">
1.51 rillig 14813: # $NetBSD$
14814: #
1.1 grant 14815:
1.51 rillig 14816: DISTNAME= bison-1.25
14817: CATEGORIES= devel
14818: MASTER_SITES= ${MASTER_SITE_GNU}
1.1 grant 14819:
1.51 rillig 14820: MAINTAINER= thorpej@NetBSD.org
14821: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
14822: COMMENT= GNU yacc clone
1.1 grant 14823:
1.51 rillig 14824: GNU_CONFIGURE= yes
14825: INFO_FILES= bison.info
1.1 grant 14826:
1.51 rillig 14827: .include "../../mk/bsd.pkg.mk"
1.1 grant 14828: </pre>
14829: </div>
14830:
1.63 dillo 14831: <div class="sect2" lang="en">
1.1 grant 14832: <div class="titlepage">
14833: <div>
14834: <div>
1.63 dillo 14835: <h3 class="title"><a name=
1.46 gdt 14836: "example-descr"></a>A.1.2. DESCR</h3>
1.1 grant 14837: </div>
14838: </div>
14839: </div>
14840: <pre class="programlisting">
1.51 rillig 14841: GNU version of yacc. Can make re-entrant parsers, and numerous other
14842: improvements. Why you would want this when Berkeley <a href=
1.1 grant 14843: "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 14844: of the NetBSD source tree is beyond me.
1.1 grant 14845: </pre>
14846: </div>
14847:
1.63 dillo 14848: <div class="sect2" lang="en">
1.1 grant 14849: <div class="titlepage">
14850: <div>
14851: <div>
1.63 dillo 14852: <h3 class="title"><a name=
1.46 gdt 14853: "example-plist"></a>A.1.3. PLIST</h3>
1.1 grant 14854: </div>
14855: </div>
14856: </div>
14857: <pre class="programlisting">
1.51 rillig 14858: @comment $NetBSD$
14859: bin/bison
14860: man/man1/bison.1.gz
14861: share/bison.simple
14862: share/bison.hairy
1.1 grant 14863: </pre>
14864: </div>
14865:
1.63 dillo 14866: <div class="sect2" lang="en">
1.1 grant 14867: <div class="titlepage">
14868: <div>
14869: <div>
1.30 wiz 14870: <h3 class="title"><a name=
1.46 gdt 14871: "checking-package-with-pkglint"></a>A.1.4. Checking
1.30 wiz 14872: a package with <span><strong class=
1.14 xtraeme 14873: "command">pkglint</strong></span></h3>
1.1 grant 14874: </div>
14875: </div>
14876: </div>
14877:
14878: <p>The NetBSD package system comes with <a xmlns=
14879: "http://www.w3.org/TR/xhtml1/transitional" href=
14880: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45 wiz 14881: target="_top"><code xmlns="" class=
14882: "filename">pkgtools/pkglint</code></a> which helps to
14883: check the contents of these files. After installation it
14884: is quite easy to use, just change to the directory of the
1.20 ben 14885: package you wish to examine and execute
14886: <span><strong class=
14887: "command">pkglint</strong></span>:</p>
1.1 grant 14888: <pre class="screen">
1.14 xtraeme 14889: <code class="prompt">$</code> <strong class=
14890: "userinput"><code>pkglint</code></strong>
1.1 grant 14891: looks fine.
14892: </pre>
14893:
14894: <p>Depending on the supplied command line arguments (see
1.60 rillig 14895: pkglint(1)), more checks will be performed. Use e.g.
14896: <span><strong class="command">pkglint -Call
14897: -Wall</strong></span> for a very thorough check.</p>
1.1 grant 14898: </div>
14899: </div>
14900:
1.63 dillo 14901: <div class="sect1" lang="en">
1.1 grant 14902: <div class="titlepage">
14903: <div>
14904: <div>
14905: <h2 class="title" style="clear: both"><a name=
1.46 gdt 14906: "steps-for-b-i-p"></a>A.2. Steps for building,
1.30 wiz 14907: installing, packaging</h2>
1.1 grant 14908: </div>
14909: </div>
14910: </div>
14911:
14912: <p>Create the directory where the package lives, plus any
14913: auxiliary directories:</p>
14914: <pre class="screen">
1.14 xtraeme 14915: <code class="prompt">#</code> <strong class=
14916: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
14917: <code class="prompt">#</code> <strong class=
14918: "userinput"><code>mkdir bison</code></strong>
14919: <code class="prompt">#</code> <strong class=
14920: "userinput"><code>cd bison</code></strong>
14921: <code class="prompt">#</code> <strong class=
14922: "userinput"><code>mkdir patches</code></strong>
1.1 grant 14923: </pre>
14924:
1.45 wiz 14925: <p>Create <code xmlns=
14926: "http://www.w3.org/TR/xhtml1/transitional" class=
14927: "filename">Makefile</code>, <code xmlns=
14928: "http://www.w3.org/TR/xhtml1/transitional" class=
14929: "filename">DESCR</code> and <code xmlns=
14930: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14931: "filename">PLIST</code> (see <a href="#components" title=
1.38 dillo 14932: "Chapter 8. Package components - files, directories and contents">
1.63 dillo 14933: Chapter 8, <i>Package components - files, directories
14934: and contents</i></a>) then continue with fetching the
1.1 grant 14935: distfile:</p>
14936: <pre class="screen">
1.14 xtraeme 14937: <code class="prompt">#</code> <strong class=
14938: "userinput"><code>make fetch</code></strong>
1.1 grant 14939: >> bison-1.25.tar.gz doesn't seem to exist on this system.
14940: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
14941: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
14942: ftp: Error retrieving file: 500 Internal error
14943:
14944: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
14945: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
14946: ftp: Error retrieving file: 500 Internal error
14947:
14948: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
14949: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
14950: Successfully retrieved file.
14951: </pre>
14952:
1.45 wiz 14953: <p>Generate the checksum of the distfile into <code xmlns=
14954: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 14955: "filename">distinfo</code>:</p>
1.1 grant 14956: <pre class="screen">
1.14 xtraeme 14957: <code class="prompt">#</code> <strong class=
14958: "userinput"><code>make makesum</code></strong>
1.1 grant 14959: </pre>
14960:
14961: <p>Now compile:</p>
14962: <pre class="screen">
1.14 xtraeme 14963: <code class="prompt">#</code> <strong class=
14964: "userinput"><code>make</code></strong>
1.1 grant 14965: >> Checksum OK for bison-1.25.tar.gz.
14966: ===> Extracting for bison-1.25
14967: ===> Patching for bison-1.25
14968: ===> Ignoring empty patch directory
14969: ===> Configuring for bison-1.25
14970: creating cache ./config.cache
14971: checking for gcc... cc
14972: checking whether we are using GNU C... yes
14973: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
14974: checking how to run the C preprocessor... cc -E
14975: checking for minix/config.h... no
14976: checking for POSIXized ISC... no
14977: checking whether cross-compiling... no
14978: checking for ANSI C header files... yes
14979: checking for string.h... yes
14980: checking for stdlib.h... yes
14981: checking for memory.h... yes
14982: checking for working const... yes
14983: checking for working alloca.h... no
14984: checking for alloca... yes
14985: checking for strerror... yes
14986: updating cache ./config.cache
14987: creating ./config.status
14988: creating Makefile
14989: ===> Building for bison-1.25
14990: 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
14991: 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
14992: 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
14993: 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
14994: 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
14995: 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
14996: 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
14997: 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
14998: 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
14999: 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
15000: 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
15001: 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
15002: 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
15003: 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
15004: 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
15005: 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
15006: 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
15007: 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
15008: 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
15009: 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
15010: 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
15011: 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
15012: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
15013: rm -f bison.s1
15014: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
15015: </pre>
15016:
15017: <p>Everything seems OK, so install the files:</p>
15018: <pre class="screen">
1.14 xtraeme 15019: <code class="prompt">#</code> <strong class=
15020: "userinput"><code>make install</code></strong>
1.1 grant 15021: >> Checksum OK for bison-1.25.tar.gz.
15022: ===> Installing for bison-1.25
15023: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
15024: rm -f /usr/pkg/bin/bison
15025: cd /usr/pkg/share; rm -f bison.simple bison.hairy
15026: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
15027: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
15028: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
15029: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
15030: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
15031: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
15032: ===> Registering installation for bison-1.25
15033: </pre>
15034:
15035: <p>You can now use bison, and also - if you decide so -
1.14 xtraeme 15036: remove it with <span><strong class="command">pkg_delete
15037: bison</strong></span>. Should you decide that you want a
15038: binary package, do this now:</p>
1.1 grant 15039: <pre class="screen">
1.14 xtraeme 15040: <code class="prompt">#</code> <strong class=
15041: "userinput"><code>make package</code></strong>
1.1 grant 15042: >> Checksum OK for bison-1.25.tar.gz.
15043: ===> Building package for bison-1.25
15044: Creating package bison-1.25.tgz
15045: Registering depends:.
15046: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
15047: </pre>
15048:
15049: <p>Now that you don't need the source and object files any
15050: more, clean up:</p>
15051: <pre class="screen">
1.14 xtraeme 15052: <code class="prompt">#</code> <strong class=
15053: "userinput"><code>make clean</code></strong>
1.1 grant 15054: ===> Cleaning for bison-1.25
15055: </pre>
15056: </div>
15057: </div>
15058:
1.63 dillo 15059: <div class="appendix" lang="en">
1.1 grant 15060: <div class="titlepage">
15061: <div>
15062: <div>
1.63 dillo 15063: <h2 class="title"><a name=
1.46 gdt 15064: "logs"></a>Appendix B. Build logs</h2>
1.1 grant 15065: </div>
15066: </div>
15067: </div>
15068:
15069: <div class="toc">
15070: <p><b>Table of Contents</b></p>
15071:
15072: <dl>
1.46 gdt 15073: <dt><span class="sect1"><a href="#logs.building">B.1.
1.1 grant 15074: Building figlet</a></span></dt>
15075:
1.46 gdt 15076: <dt><span class="sect1"><a href="#logs.package">B.2.
1.1 grant 15077: Packaging figlet</a></span></dt>
15078: </dl>
15079: </div>
15080:
1.63 dillo 15081: <div class="sect1" lang="en">
1.1 grant 15082: <div class="titlepage">
15083: <div>
15084: <div>
15085: <h2 class="title" style="clear: both"><a name=
1.46 gdt 15086: "logs.building"></a>B.1. Building figlet</h2>
1.1 grant 15087: </div>
15088: </div>
15089: </div>
15090: <pre class="screen">
1.14 xtraeme 15091: <code class="prompt">#</code> <strong class=
15092: "userinput"><code>make</code></strong>
1.1 grant 15093: ===> Checking for vulnerabilities in figlet-2.2.1nb2
15094: => figlet221.tar.gz doesn't seem to exist on this system.
15095: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
15096: => [172219 bytes]
15097: Connected to ftp.plig.net.
15098: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
15099: 331 Guest login ok, send your complete e-mail address as password.
15100: 230-You are user #5 of 500 simultaneous users allowed.
15101: 230-
15102: 230- ___ _ _ _
15103: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
15104: 230- | _| _| . |_| . | | | . |_| . | _| . |
15105: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
15106: 230- |_| |_| |___| |___|
15107: 230-
15108: 230-** Welcome to ftp.plig.org **
15109: 230-
15110: 230-Please note that all transfers from this FTP site are logged. If you
15111: 230-do not like this, please disconnect now.
15112: 230-
15113: 230-This arhive is available via
15114: 230-
15115: 230-HTTP: http://ftp.plig.org/
15116: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
15117: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
15118: 230-
15119: 230-Please email comments, bug reports and requests for packages to be
15120: 230-mirrored to ftp-admin@plig.org.
15121: 230-
15122: 230-
15123: 230 Logged in anonymously.
15124: Remote system type is UNIX.
15125: Using binary mode to transfer files.
15126: 200 Type okay.
15127: 250 "/pub" is new cwd.
15128: 250-"/pub/figlet" is new cwd.
15129: 250-
15130: 250-Welcome to the figlet archive at ftp.figlet.org
15131: 250-
15132: 250- ftp://ftp.figlet.org/pub/figlet/
15133: 250-
15134: 250-The official FIGlet web page is:
15135: 250- http://www.figlet.org/
15136: 250-
15137: 250-If you have questions, please mailto:info@figlet.org. If you want to
15138: 250-contribute a font or something else, you can email us.
15139: 250
15140: 250 "/pub/figlet/program" is new cwd.
15141: 250 "/pub/figlet/program/unix" is new cwd.
15142: local: figlet221.tar.gz remote: figlet221.tar.gz
15143: 502 Unimplemented command.
15144: 227 Entering Passive Mode (195,40,6,41,246,104)
15145: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
15146: 38% |************** | 65800 64.16 KB/s 00:01 ETA
15147: 226 Transfer completed.
15148: 172219 bytes received in 00:02 (75.99 KB/s)
15149: 221 Goodbye.
15150: => Checksum OK for figlet221.tar.gz.
15151: ===> Extracting for figlet-2.2.1nb2
15152: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
15153: ===> Patching for figlet-2.2.1nb2
15154: ===> Applying pkgsrc patches for figlet-2.2.1nb2
15155: ===> Overriding tools for figlet-2.2.1nb2
15156: ===> Creating toolchain wrappers for figlet-2.2.1nb2
15157: ===> Configuring for figlet-2.2.1nb2
15158: ===> Building for figlet-2.2.1nb2
15159: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
15160: chmod a+x figlet
15161: gcc -O2 -o chkfont chkfont.c
15162: => Unwrapping files-to-be-installed.
1.14 xtraeme 15163: <code class="prompt">#</code>
15164: <code class="prompt">#</code> <strong class=
15165: "userinput"><code>make install</code></strong>
1.1 grant 15166: ===> Checking for vulnerabilities in figlet-2.2.1nb2
15167: ===> Installing for figlet-2.2.1nb2
15168: install -d -o root -g wheel -m 755 /usr/pkg/bin
15169: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
15170: mkdir -p /usr/pkg/share/figlet
15171: cp figlet /usr/pkg/bin
15172: cp chkfont /usr/pkg/bin
15173: chmod 555 figlist showfigfonts
15174: cp figlist /usr/pkg/bin
15175: cp showfigfonts /usr/pkg/bin
15176: cp fonts/*.flf /usr/pkg/share/figlet
15177: cp fonts/*.flc /usr/pkg/share/figlet
15178: cp figlet.6 /usr/pkg/man/man6
15179: ===> Registering installation for figlet-2.2.1nb2
1.14 xtraeme 15180: <code class="prompt">#</code>
1.1 grant 15181: </pre>
15182: </div>
15183:
1.63 dillo 15184: <div class="sect1" lang="en">
1.1 grant 15185: <div class="titlepage">
15186: <div>
15187: <div>
15188: <h2 class="title" style="clear: both"><a name=
1.46 gdt 15189: "logs.package"></a>B.2. Packaging figlet</h2>
1.1 grant 15190: </div>
15191: </div>
15192: </div>
15193: <pre class="screen">
1.14 xtraeme 15194: <code class="prompt">#</code> <strong class=
15195: "userinput"><code>make package</code></strong>
1.1 grant 15196: ===> Checking for vulnerabilities in figlet-2.2.1nb2
15197: ===> Packaging figlet-2.2.1nb2
15198: ===> Building binary package for figlet-2.2.1nb2
15199: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
15200: Using SrcDir value of /usr/pkg
15201: Registering depends:.
1.14 xtraeme 15202: <code class="prompt">#</code>
1.1 grant 15203: </pre>
15204: </div>
15205: </div>
15206:
1.63 dillo 15207: <div class="appendix" lang="en">
1.1 grant 15208: <div class="titlepage">
15209: <div>
15210: <div>
1.63 dillo 15211: <h2 class="title"><a name=
1.46 gdt 15212: "ftp-layout"></a>Appendix C. Layout of the
1.1 grant 15213: FTP server's package archive</h2>
15214: </div>
15215: </div>
15216: </div>
15217:
15218: <p>Layout for precompiled binary packages on
15219: ftp.NetBSD.org:</p>
15220: <pre class="programlisting">
1.51 rillig 15221: /pub/NetBSD/packages/
15222: distfiles/
1.1 grant 15223:
1.51 rillig 15224: # Unpacked pkgsrc trees
15225: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
15226: pkgsrc-2003Q4 -> N/A
15227: pkgsrc-2004Q1/pkgsrc
15228:
15229: # pkgsrc archives
15230: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
15231: pkgsrc-2003Q4.tar.gz -> N/A
15232: pkgsrc-2004Q1.tar.gz -> N/A
15233:
15234: # Per pkgsrc-release/OS-release/arch package archives
15235: pkgsrc-2003Q4/
15236: NetBSD-1.6.2/
15237: i386/
15238: All/
15239: archivers/
15240: foo -> ../All/foo
15241: ...
15242: pkgsrc-2004Q1/
15243: NetBSD-1.6.2/
15244: i386/
15245: All/
15246: ...
15247: NetBSD-2.0/
15248: i386/
15249: All/
15250: ...
15251: SunOS-5.9/
15252: sparc/
15253: All/
15254: ...
15255: x86/
15256: All/
15257: ...
15258:
15259: # Per os-release package archive convenience links
15260: NetBSD-1.6.2 -> 1.6.2
15261: 1.6.2/
15262: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
15263: m68k/
15264: All/
15265: archivers/
15266: foo -> ../All/foo
15267: ...
15268: amiga -> m68k
15269: atari -> m68k
15270: ...
15271:
15272: 2.0 -> NetBSD-2.0 # backward compat, historic
15273: NetBSD-2.0/
15274: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
15275: SunOS-5.9/
15276: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
15277: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
1.1 grant 15278: </pre>
15279:
15280: <p>To create:</p>
15281:
15282: <div class="orderedlist">
15283: <ol type="1">
15284: <li>
15285: <p>Run bulk build, see <a href="#bulkbuild" title=
1.63 dillo 15286: "6.3. Doing a bulk build of all packages">Section 6.3,
15287: “Doing a bulk build of all
1.1 grant 15288: packages”</a></p>
15289: </li>
15290:
15291: <li>
15292: <p>Upload /usr/pkgsrc/packages to</p>
15293: <pre class="programlisting">
15294: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.51 rillig 15295: pkgsrc-2004Q4/\ # pkgsrc-branch
15296: `uname -s`-`uname -r`/\ # OS & version
15297: `uname -p` # architecture
1.1 grant 15298: </pre>
15299: </li>
15300:
15301: <li>
1.14 xtraeme 15302: <p>If necessary, create a symlink <span><strong class=
15303: "command">ln -s `uname -m` `uname -p`</strong></span>
15304: (amiga -> m68k, ...)</p>
1.1 grant 15305: </li>
15306: </ol>
15307: </div>
15308: </div>
1.2 hubertf 15309:
1.63 dillo 15310: <div class="appendix" lang="en">
1.2 hubertf 15311: <div class="titlepage">
15312: <div>
15313: <div>
1.63 dillo 15314: <h2 class="title"><a name=
1.46 gdt 15315: "editing"></a>Appendix D. Editing guidelines
1.2 hubertf 15316: for the pkgsrc guide</h2>
15317: </div>
15318: </div>
15319: </div>
15320:
15321: <div class="toc">
15322: <p><b>Table of Contents</b></p>
15323:
15324: <dl>
1.46 gdt 15325: <dt><span class="sect1"><a href="#targets">D.1.
1.2 hubertf 15326: Targets</a></span></dt>
15327:
1.46 gdt 15328: <dt><span class="sect1"><a href="#procedure">D.2.
1.2 hubertf 15329: Procedure</a></span></dt>
15330: </dl>
15331: </div>
15332:
15333: <p>This section contains information on editing the pkgsrc
15334: guide itself.</p>
15335:
1.63 dillo 15336: <div class="sect1" lang="en">
1.2 hubertf 15337: <div class="titlepage">
15338: <div>
15339: <div>
15340: <h2 class="title" style="clear: both"><a name=
1.63 dillo 15341: "targets"></a>D.1. Targets</h2>
1.2 hubertf 15342: </div>
15343: </div>
15344: </div>
15345:
1.45 wiz 15346: <p>The pkgsrc guide's source code is stored in <code xmlns=
15347: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15348: "filename">pkgsrc/doc/guide/files</code>, and several files
1.2 hubertf 15349: are created from it:</p>
15350:
15351: <div class="itemizedlist">
15352: <ul type="disc">
15353: <li>
1.45 wiz 15354: <p><code xmlns=
15355: "http://www.w3.org/TR/xhtml1/transitional" class=
1.23 wiz 15356: "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2 hubertf 15357: </li>
15358:
15359: <li>
1.45 wiz 15360: <p><code xmlns=
15361: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15362: "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2 hubertf 15363: </li>
15364:
15365: <li>
1.45 wiz 15366: <p><code xmlns=
15367: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15368: "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2 hubertf 15369: the documentation on the NetBSD website will be built
15370: from pkgsrc and kept up to date on the web server
15371: itself. This means you <span class=
15372: "emphasis"><em>must</em></span> make sure that your
15373: changes haven't broken the build!</p>
15374: </li>
1.6 hubertf 15375:
15376: <li>
1.45 wiz 15377: <p><code xmlns=
15378: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15379: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6 hubertf 15380: PDF version of the pkgsrc guide.</p>
15381: </li>
15382:
15383: <li>
1.45 wiz 15384: <p><code xmlns=
15385: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15386: "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6 hubertf 15387: PostScript version of the pkgsrc guide.</p>
15388: </li>
1.2 hubertf 15389: </ul>
15390: </div>
15391: </div>
15392:
1.63 dillo 15393: <div class="sect1" lang="en">
1.2 hubertf 15394: <div class="titlepage">
15395: <div>
15396: <div>
15397: <h2 class="title" style="clear: both"><a name=
1.46 gdt 15398: "procedure"></a>D.2. Procedure</h2>
1.2 hubertf 15399: </div>
15400: </div>
15401: </div>
15402:
15403: <p>The procedure to edit the pkgsrc guide is:</p>
15404:
15405: <div class="itemizedlist">
15406: <ul type="disc">
15407: <li>
1.6 hubertf 15408: <p>Make sure you have the packages needed to
15409: re-generate the pkgsrc guide (and other XML-based
15410: NetBSD documentation) installed. These are
1.11 ben 15411: “<span class="quote">netbsd-doc</span>”
1.47 reed 15412: for creating the ASCII and HTML versions, and
1.6 hubertf 15413: “<span class=
1.47 reed 15414: "quote">netbsd-doc-print</span>” for the
15415: PostScript and PDF versions. You will need both
1.6 hubertf 15416: packages installed, to make sure documentation is
15417: consistent across all formats. The packages can be
1.45 wiz 15418: found in <code xmlns=
15419: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15420: "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
1.45 wiz 15421: <code xmlns=
15422: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15423: "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6 hubertf 15424: </li>
15425:
15426: <li>
1.45 wiz 15427: <p>Edit the XML file(s) in <code xmlns=
15428: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15429: "filename">pkgsrc/doc/guide/files</code>.</p>
1.2 hubertf 15430: </li>
15431:
15432: <li>
1.14 xtraeme 15433: <p>Run <span><strong class="command">make extract
15434: && make do-lint</strong></span> in
1.45 wiz 15435: <code xmlns=
15436: "http://www.w3.org/TR/xhtml1/transitional" class=
15437: "filename">pkgsrc/doc/guide</code> to check the XML
15438: syntax, and fix it if needed.</p>
1.4 hubertf 15439: </li>
15440:
15441: <li>
1.14 xtraeme 15442: <p>Run <span><strong class=
1.45 wiz 15443: "command">make</strong></span> in <code xmlns=
15444: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15445: "filename">pkgsrc/doc/guide</code> to build the HTML
15446: and ASCII version.</p>
1.2 hubertf 15447: </li>
15448:
15449: <li>
1.14 xtraeme 15450: <p>If all is well, run <span><strong class=
15451: "command">make install-doc</strong></span> to put the
1.45 wiz 15452: generated files into <code xmlns=
15453: "http://www.w3.org/TR/xhtml1/transitional" class=
1.14 xtraeme 15454: "filename">pkgsrc/doc</code>.</p>
1.2 hubertf 15455: </li>
15456:
15457: <li>
1.14 xtraeme 15458: <p><span><strong class="command">cvs commit
15459: pkgsrc/doc/guide/files</strong></span></p>
1.2 hubertf 15460: </li>
15461:
15462: <li>
1.14 xtraeme 15463: <p><span><strong class="command">cvs commit -m
15464: re-generate
15465: pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2 hubertf 15466: </li>
1.4 hubertf 15467:
15468: <li>
15469: <p>Until the webserver on www.NetBSD.org is really
15470: updated automatically to pick up changes to the
1.14 xtraeme 15471: pkgsrc guide automatically, also run
1.18 xtraeme 15472: <span><strong class="command">make install-htdocs
1.14 xtraeme 15473: HTDOCSDIR=../../../htdocs</strong></span> (or
15474: similar, adjust <code class=
15475: "varname">HTDOCSDIR</code>!).</p>
1.4 hubertf 15476: </li>
15477:
15478: <li>
1.14 xtraeme 15479: <p><span><strong class="command">cvs commit
15480: htdocs/Documentation/pkgsrc</strong></span></p>
1.4 hubertf 15481: </li>
1.2 hubertf 15482: </ul>
15483: </div>
15484: </div>
15485: </div>
1.1 grant 15486: </div>
15487: </body>
15488: </html>
CVSweb <webmaster@jp.NetBSD.org>