Annotation of pkgsrc/doc/pkgsrc.html, revision 1.1
1.1 ! grant 1: <html xmlns="http://www.w3.org/1999/xhtml">
! 2: <head>
! 3: <meta name="generator" content=
! 4: "HTML Tidy for NetBSD (vers 1st August 2004), see www.w3.org" />
! 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=
! 11: "DocBook XSL Stylesheets V1.65.0" />
! 12: <meta name="description" content=
! 13: "Information about using the NetBSD package system (pkgsrc) from both a user view for installing packages as well as from a pkgsrc developers' view for creating new packages." />
! 14: </head>
! 15:
! 16: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084"
! 17: alink="#0000FF">
! 18: <div class="book" lang="en" xml:lang="en">
! 19: <div class="titlepage">
! 20: <div>
! 21: <div>
! 22: <h1 class="title"><a name="id2496010" id=
! 23: "id2496010"></a>The pkgsrc guide</h1>
! 24: </div>
! 25:
! 26: <div>
! 27: <h2 class="subtitle">Documentation on the NetBSD package
! 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">
! 40: <p><tt class="email"><<a href=
! 41: "mailto:agc@NetBSD.org">agc@NetBSD.org</a>></tt></p>
! 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">
! 53: <p><tt class="email"><<a href=
! 54: "mailto:hubertf@NetBSD.org">hubertf@NetBSD.org</a>></tt></p>
! 55: </div>
! 56: </div>
! 57: </div>
! 58: </div>
! 59: </div>
! 60:
! 61: <div>
! 62: <p class="copyright">Copyright © 1994-2004 The
! 63: NetBSD Foundation, Inc</p>
! 64: </div>
! 65:
! 66: <div>
! 67: <p class="pubdate">$NetBSD: pkgsrc.xml,v 1.1.1.1
! 68: 2004/10/21 14:27:40 grant Exp $</p>
! 69: </div>
! 70:
! 71: <div>
! 72: <div class="abstract">
! 73: <p class="title"><b>Abstract</b></p>
! 74:
! 75: <p>Information about using the NetBSD package system
! 76: (pkgsrc) from both a user view for installing packages
! 77: as well as from a pkgsrc developers' view for creating
! 78: new packages.</p>
! 79: </div>
! 80: </div>
! 81: </div>
! 82: <hr />
! 83: </div>
! 84:
! 85: <div class="toc">
! 86: <p><b>Table of Contents</b></p>
! 87:
! 88: <dl>
! 89: <dt><span class="chapter"><a href="#introduction">1.
! 90: Introduction</a></span></dt>
! 91:
! 92: <dd>
! 93: <dl>
! 94: <dt><span class="sect1"><a href="#id2494471">1.1.
! 95: Introduction</a></span></dt>
! 96:
! 97: <dt><span class="sect1"><a href="#overview">1.2.
! 98: Overview</a></span></dt>
! 99:
! 100: <dt><span class="sect1"><a href="#terminology">1.3.
! 101: Terminology</a></span></dt>
! 102:
! 103: <dt><span class="sect1"><a href="#typography">1.4.
! 104: Typography</a></span></dt>
! 105: </dl>
! 106: </dd>
! 107:
! 108: <dt><span class="part"><a href="#users-guide">I. pkgsrc
! 109: user's guide</a></span></dt>
! 110:
! 111: <dd>
! 112: <dl>
! 113: <dt><span class="chapter"><a href="#getting">2. Where
! 114: to get pkgsrc</a></span></dt>
! 115:
! 116: <dd>
! 117: <dl>
! 118: <dt><span class="sect1"><a href="#id2495110">2.1.
! 119: As tar file</a></span></dt>
! 120:
! 121: <dt><span class="sect1"><a href="#id2495127">2.2.
! 122: Via SUP</a></span></dt>
! 123:
! 124: <dt><span class="sect1"><a href="#id2495159">2.3.
! 125: Via CVS</a></span></dt>
! 126: </dl>
! 127: </dd>
! 128:
! 129: <dt><span class="chapter"><a href="#platforms">3. Using
! 130: pkgsrc on systems other than NetBSD</a></span></dt>
! 131:
! 132: <dd>
! 133: <dl>
! 134: <dt><span class="sect1"><a href="#id2495269">3.1.
! 135: Bootstrapping pkgsrc</a></span></dt>
! 136:
! 137: <dt><span class="sect1"><a href="#id2495376">3.2.
! 138: Platform specific notes</a></span></dt>
! 139:
! 140: <dd>
! 141: <dl>
! 142: <dt><span class="sect2"><a href=
! 143: "#id2495382">3.2.1. Darwin (Mac OS
! 144: X)</a></span></dt>
! 145:
! 146: <dt><span class="sect2"><a href=
! 147: "#id2495681">3.2.2. FreeBSD</a></span></dt>
! 148:
! 149: <dt><span class="sect2"><a href=
! 150: "#id2496397">3.2.3. Interix</a></span></dt>
! 151:
! 152: <dt><span class="sect2"><a href=
! 153: "#id2496488">3.2.4. IRIX</a></span></dt>
! 154:
! 155: <dt><span class="sect2"><a href=
! 156: "#id2496605">3.2.5. OpenBSD</a></span></dt>
! 157:
! 158: <dt><span class="sect2"><a href=
! 159: "#id2496786">3.2.6. Solaris</a></span></dt>
! 160: </dl>
! 161: </dd>
! 162: </dl>
! 163: </dd>
! 164:
! 165: <dt><span class="chapter"><a href="#using">4. Using
! 166: pkgsrc</a></span></dt>
! 167:
! 168: <dd>
! 169: <dl>
! 170: <dt><span class="sect1"><a href=
! 171: "#getting-started">4.1. Working with binary
! 172: packages</a></span></dt>
! 173:
! 174: <dd>
! 175: <dl>
! 176: <dt><span class="sect2"><a href=
! 177: "#id2496922">4.1.1. Where to get binary
! 178: packages</a></span></dt>
! 179:
! 180: <dt><span class="sect2"><a href=
! 181: "#id2496963">4.1.2. How to use binary
! 182: packages</a></span></dt>
! 183:
! 184: <dt><span class="sect2"><a href=
! 185: "#id2497165">4.1.3. A word of
! 186: warning</a></span></dt>
! 187: </dl>
! 188: </dd>
! 189:
! 190: <dt><span class="sect1"><a href="#id2497177">4.2.
! 191: Building packages from source</a></span></dt>
! 192:
! 193: <dd>
! 194: <dl>
! 195: <dt><span class="sect2"><a href=
! 196: "#id2497187">4.2.1.
! 197: Requirements</a></span></dt>
! 198:
! 199: <dt><span class="sect2"><a href=
! 200: "#id2497275">4.2.2. Fetching
! 201: distfiles</a></span></dt>
! 202:
! 203: <dt><span class="sect2"><a href=
! 204: "#id2497328">4.2.3. How to build and
! 205: install</a></span></dt>
! 206:
! 207: <dt><span class="sect2"><a href=
! 208: "#id2498259">4.2.4. Selecting the
! 209: compiler</a></span></dt>
! 210: </dl>
! 211: </dd>
! 212: </dl>
! 213: </dd>
! 214:
! 215: <dt><span class="chapter"><a href="#binary">5. Creating
! 216: binary packages</a></span></dt>
! 217:
! 218: <dd>
! 219: <dl>
! 220: <dt><span class="sect1"><a href="#id2498413">5.1.
! 221: Building a single binary package</a></span></dt>
! 222:
! 223: <dt><span class="sect1"><a href="#id2563208">5.2.
! 224: Settings for creation of binary
! 225: packages</a></span></dt>
! 226:
! 227: <dt><span class="sect1"><a href="#bulkbuild">5.3.
! 228: Doing a bulk build of all packages</a></span></dt>
! 229:
! 230: <dd>
! 231: <dl>
! 232: <dt><span class="sect2"><a href=
! 233: "#binary.configuration">5.3.1.
! 234: Configuration</a></span></dt>
! 235:
! 236: <dt><span class="sect2"><a href=
! 237: "#id2563348">5.3.2. Other environmental
! 238: considerations</a></span></dt>
! 239:
! 240: <dt><span class="sect2"><a href=
! 241: "#id2563388">5.3.3. Operation</a></span></dt>
! 242:
! 243: <dt><span class="sect2"><a href=
! 244: "#id2563595">5.3.4. What it
! 245: does</a></span></dt>
! 246:
! 247: <dt><span class="sect2"><a href=
! 248: "#id2563652">5.3.5. Disk space
! 249: requirements</a></span></dt>
! 250:
! 251: <dt><span class="sect2"><a href=
! 252: "#id2563678">5.3.6. Setting up a sandbox for
! 253: chroot'ed builds</a></span></dt>
! 254:
! 255: <dt><span class="sect2"><a href=
! 256: "#id2564042">5.3.7. Building a partial set of
! 257: packages</a></span></dt>
! 258: </dl>
! 259: </dd>
! 260:
! 261: <dt><span class="sect1"><a href="#id2564085">5.4.
! 262: Creating a multiple CD-ROM packages
! 263: collection</a></span></dt>
! 264:
! 265: <dd>
! 266: <dl>
! 267: <dt><span class="sect2"><a href=
! 268: "#id2564168">5.4.1. Example of
! 269: cdpack</a></span></dt>
! 270: </dl>
! 271: </dd>
! 272: </dl>
! 273: </dd>
! 274:
! 275: <dt><span class="chapter"><a href="#faq">6. Frequently
! 276: Asked Questions</a></span></dt>
! 277:
! 278: <dd>
! 279: <dl>
! 280: <dt><span class="sect1"><a href="#id2564359">6.1.
! 281: Is there a mailing list for pkg-related
! 282: discussion?</a></span></dt>
! 283:
! 284: <dt><span class="sect1"><a href="#id2564457">6.2.
! 285: Where's the pkgviews documentation?</a></span></dt>
! 286:
! 287: <dt><span class="sect1"><a href="#id2564470">6.3.
! 288: Utilities for package management
! 289: (pkgtools)</a></span></dt>
! 290:
! 291: <dt><span class="sect1"><a href="#id2564695">6.4.
! 292: How to use pkgsrc as non-root</a></span></dt>
! 293:
! 294: <dt><span class="sect1"><a href="#id2564707">6.5.
! 295: How can I install/use XFree86 from
! 296: pkgsrc?</a></span></dt>
! 297:
! 298: <dt><span class="sect1"><a href="#id2564803">6.6.
! 299: How can I install/use X.org from
! 300: pkgsrc?</a></span></dt>
! 301:
! 302: <dt><span class="sect1"><a href="#id2564830">6.7.
! 303: How to fetch files from behind a
! 304: firewall</a></span></dt>
! 305:
! 306: <dt><span class="sect1"><a href="#id2564844">6.8.
! 307: How do I tell make fetch to do passive
! 308: FTP?</a></span></dt>
! 309:
! 310: <dt><span class="sect1"><a href="#id2564896">6.9.
! 311: How to fetch all distfiles at once</a></span></dt>
! 312:
! 313: <dt><span class="sect1"><a href="#id2565104">6.10.
! 314: What does Don't know how to make
! 315: /usr/share/tmac/tmac.andoc mean?</a></span></dt>
! 316:
! 317: <dt><span class="sect1"><a href="#id2565142">6.11.
! 318: What does Could not find bsd.own.mk
! 319: mean?</a></span></dt>
! 320:
! 321: <dt><span class="sect1"><a href="#id2565200">6.12.
! 322: Using 'sudo' with pkgsrc</a></span></dt>
! 323:
! 324: <dt><span class="sect1"><a href="#faq.conf">6.13.
! 325: Configuration files handling and
! 326: placement</a></span></dt>
! 327:
! 328: <dt><span class="sect1"><a href=
! 329: "#audit-packages">6.14. Automated security
! 330: checks</a></span></dt>
! 331: </dl>
! 332: </dd>
! 333: </dl>
! 334: </dd>
! 335:
! 336: <dt><span class="part"><a href="#developers-guide">II.
! 337: pkgsrc developer's guide</a></span></dt>
! 338:
! 339: <dd>
! 340: <dl>
! 341: <dt><span class="chapter"><a href="#components">7.
! 342: Package components - files, directories and
! 343: contents</a></span></dt>
! 344:
! 345: <dd>
! 346: <dl>
! 347: <dt><span class="sect1"><a href=
! 348: "#components.Makefile">7.1.
! 349: Makefile</a></span></dt>
! 350:
! 351: <dt><span class="sect1"><a href=
! 352: "#components.distinfo">7.2.
! 353: distinfo</a></span></dt>
! 354:
! 355: <dt><span class="sect1"><a href=
! 356: "#components.patches">7.3.
! 357: patches/*</a></span></dt>
! 358:
! 359: <dt><span class="sect1"><a href="#id2566375">7.4.
! 360: Other mandatory files</a></span></dt>
! 361:
! 362: <dt><span class="sect1"><a href=
! 363: "#components.optional">7.5. Optional
! 364: files</a></span></dt>
! 365:
! 366: <dt><span class="sect1"><a href="#id2566569">7.6.
! 367: work*</a></span></dt>
! 368:
! 369: <dt><span class="sect1"><a href="#id2566657">7.7.
! 370: files/*</a></span></dt>
! 371: </dl>
! 372: </dd>
! 373:
! 374: <dt><span class="chapter"><a href="#plist">8. PLIST
! 375: issues</a></span></dt>
! 376:
! 377: <dd>
! 378: <dl>
! 379: <dt><span class="sect1"><a href="#id2566711">8.1.
! 380: RCS ID</a></span></dt>
! 381:
! 382: <dt><span class="sect1"><a href="#id2566726">8.2.
! 383: Semi-automatic PLIST generation</a></span></dt>
! 384:
! 385: <dt><span class="sect1"><a href="#print-PLIST">8.3.
! 386: Tweaking output of make print-PLIST</a></span></dt>
! 387:
! 388: <dt><span class="sect1"><a href="#plist.misc">8.4.
! 389: Variable substitution in PLIST</a></span></dt>
! 390:
! 391: <dt><span class="sect1"><a href="#id2567047">8.5.
! 392: Manpage-compression</a></span></dt>
! 393:
! 394: <dt><span class="sect1"><a href="#id2567089">8.6.
! 395: Changing PLIST source with
! 396: PLIST_SRC</a></span></dt>
! 397:
! 398: <dt><span class="sect1"><a href="#id2567106">8.7.
! 399: Platform specific and differing
! 400: PLISTs</a></span></dt>
! 401:
! 402: <dt><span class="sect1"><a href=
! 403: "#faq.common-dirs">8.8. Sharing directories between
! 404: packages</a></span></dt>
! 405: </dl>
! 406: </dd>
! 407:
! 408: <dt><span class="chapter"><a href="#buildlink">9.
! 409: Buildlink methodology</a></span></dt>
! 410:
! 411: <dd>
! 412: <dl>
! 413: <dt><span class="sect1"><a href="#id2567378">9.1.
! 414: Converting packages to use
! 415: buildlink3</a></span></dt>
! 416:
! 417: <dt><span class="sect1"><a href="#id2567637">9.2.
! 418: Writing buildlink3.mk files</a></span></dt>
! 419:
! 420: <dd>
! 421: <dl>
! 422: <dt><span class="sect2"><a href=
! 423: "#id2567774">9.2.1. Anatomy of a buildlink3.mk
! 424: file</a></span></dt>
! 425:
! 426: <dt><span class="sect2"><a href=
! 427: "#id2568283">9.2.2. Updating
! 428: BUILDLINK_DEPENDS.pkg in buildlink3.mk
! 429: files</a></span></dt>
! 430: </dl>
! 431: </dd>
! 432:
! 433: <dt><span class="sect1"><a href="#id2568362">9.3.
! 434: Writing builtin.mk files</a></span></dt>
! 435:
! 436: <dd>
! 437: <dl>
! 438: <dt><span class="sect2"><a href=
! 439: "#id2568512">9.3.1. Anatomy of a builtin.mk
! 440: file</a></span></dt>
! 441:
! 442: <dt><span class="sect2"><a href=
! 443: "#id2568739">9.3.2. Global preferences for
! 444: native or pkgsrc software</a></span></dt>
! 445: </dl>
! 446: </dd>
! 447: </dl>
! 448: </dd>
! 449:
! 450: <dt><span class="chapter"><a href="#options">10.
! 451: Options handling</a></span></dt>
! 452:
! 453: <dd>
! 454: <dl>
! 455: <dt><span class="sect1"><a href="#id2568811">10.1.
! 456: Global default options</a></span></dt>
! 457:
! 458: <dt><span class="sect1"><a href="#id2568826">10.2.
! 459: Converting packages to use
! 460: bsd.options.mk</a></span></dt>
! 461: </dl>
! 462: </dd>
! 463:
! 464: <dt><span class="chapter"><a href="#build">11. The
! 465: build process</a></span></dt>
! 466:
! 467: <dd>
! 468: <dl>
! 469: <dt><span class="sect1"><a href=
! 470: "#build.prefix">11.1. Program
! 471: location</a></span></dt>
! 472:
! 473: <dt><span class="sect1"><a href="#id2569571">11.2.
! 474: Main targets</a></span></dt>
! 475:
! 476: <dt><span class="sect1"><a href=
! 477: "#build.helpful-targets">11.3. Other helpful
! 478: targets</a></span></dt>
! 479: </dl>
! 480: </dd>
! 481:
! 482: <dt><span class="chapter"><a href="#fixes">12. Notes on
! 483: fixes for packages</a></span></dt>
! 484:
! 485: <dd>
! 486: <dl>
! 487: <dt><span class="sect1"><a href="#id2570968">12.1.
! 488: General operation</a></span></dt>
! 489:
! 490: <dd>
! 491: <dl>
! 492: <dt><span class="sect2"><a href=
! 493: "#id2570971">12.1.1. How to pull in variables
! 494: from /etc/mk.conf</a></span></dt>
! 495:
! 496: <dt><span class="sect2"><a href=
! 497: "#id2571054">12.1.2. Restricted
! 498: packages</a></span></dt>
! 499:
! 500: <dt><span class="sect2"><a href=
! 501: "#dependencies">12.1.3. Handling
! 502: dependencies</a></span></dt>
! 503:
! 504: <dt><span class="sect2"><a href=
! 505: "#id2571501">12.1.4. Handling conflicts with
! 506: other packages</a></span></dt>
! 507:
! 508: <dt><span class="sect2"><a href=
! 509: "#id2571620">12.1.5. Packages that cannot or
! 510: should not be built</a></span></dt>
! 511:
! 512: <dt><span class="sect2"><a href=
! 513: "#id2571645">12.1.6. Packages which should not
! 514: be deleted, once installed</a></span></dt>
! 515:
! 516: <dt><span class="sect2"><a href=
! 517: "#security-handling">12.1.7. Handling packages
! 518: with security problems</a></span></dt>
! 519:
! 520: <dt><span class="sect2"><a href=
! 521: "#id2571737">12.1.8. How to handle compiler
! 522: bugs</a></span></dt>
! 523:
! 524: <dt><span class="sect2"><a href=
! 525: "#id2571760">12.1.9. How to handle incrementing
! 526: versions when fixing an existing
! 527: package</a></span></dt>
! 528:
! 529: <dt><span class="sect2"><a href=
! 530: "#id2571809">12.1.10. Portability of
! 531: packages</a></span></dt>
! 532: </dl>
! 533: </dd>
! 534:
! 535: <dt><span class="sect1"><a href="#id2571901">12.2.
! 536: Possible downloading issues</a></span></dt>
! 537:
! 538: <dd>
! 539: <dl>
! 540: <dt><span class="sect2"><a href=
! 541: "#id2571905">12.2.1. Packages whose distfiles
! 542: aren't available for plain
! 543: downloading</a></span></dt>
! 544:
! 545: <dt><span class="sect2"><a href=
! 546: "#id2572036">12.2.2. How to handle modified
! 547: distfiles with the 'old' name</a></span></dt>
! 548: </dl>
! 549: </dd>
! 550:
! 551: <dt><span class="sect1"><a href="#id2572048">12.3.
! 552: Configuration gotchas</a></span></dt>
! 553:
! 554: <dd>
! 555: <dl>
! 556: <dt><span class="sect2"><a href=
! 557: "#fixes.libtool">12.3.1. Shared libraries -
! 558: libtool</a></span></dt>
! 559:
! 560: <dt><span class="sect2"><a href=
! 561: "#id2572523">12.3.2. Using libtool on GNU
! 562: packages that already support
! 563: libtool</a></span></dt>
! 564:
! 565: <dt><span class="sect2"><a href=
! 566: "#id2572608">12.3.3. GNU
! 567: Autoconf/Automake</a></span></dt>
! 568: </dl>
! 569: </dd>
! 570:
! 571: <dt><span class="sect1"><a href="#id2572652">12.4.
! 572: Building considerations</a></span></dt>
! 573:
! 574: <dd>
! 575: <dl>
! 576: <dt><span class="sect2"><a href=
! 577: "#id2572656">12.4.1. CPP
! 578: defines</a></span></dt>
! 579: </dl>
! 580: </dd>
! 581:
! 582: <dt><span class="sect1"><a href="#id2572685">12.5.
! 583: Package specific actions</a></span></dt>
! 584:
! 585: <dd>
! 586: <dl>
! 587: <dt><span class="sect2"><a href=
! 588: "#id2572689">12.5.1. Package configuration
! 589: files</a></span></dt>
! 590:
! 591: <dt><span class="sect2"><a href=
! 592: "#id2572859">12.5.2. User
! 593: Interaction</a></span></dt>
! 594:
! 595: <dt><span class="sect2"><a href=
! 596: "#id2572904">12.5.3. Handling
! 597: licenses</a></span></dt>
! 598:
! 599: <dt><span class="sect2"><a href=
! 600: "#id2572987">12.5.4. Creating an account from a
! 601: package</a></span></dt>
! 602:
! 603: <dt><span class="sect2"><a href=
! 604: "#id2573049">12.5.5. Installing score
! 605: files</a></span></dt>
! 606:
! 607: <dt><span class="sect2"><a href=
! 608: "#id2573093">12.5.6. Packages providing login
! 609: shells</a></span></dt>
! 610:
! 611: <dt><span class="sect2"><a href=
! 612: "#id2573424">12.5.7. Packages containing perl
! 613: scripts</a></span></dt>
! 614:
! 615: <dt><span class="sect2"><a href=
! 616: "#id2573442">12.5.8. Packages with hardcoded
! 617: paths to other interpreters</a></span></dt>
! 618:
! 619: <dt><span class="sect2"><a href=
! 620: "#id2573463">12.5.9. Packages installing perl
! 621: modules</a></span></dt>
! 622:
! 623: <dt><span class="sect2"><a href=
! 624: "#faq.info-files">12.5.10. Packages installing
! 625: info files</a></span></dt>
! 626:
! 627: <dt><span class="sect2"><a href=
! 628: "#id2573751">12.5.11. Packages installing
! 629: GConf2 data files</a></span></dt>
! 630:
! 631: <dt><span class="sect2"><a href=
! 632: "#id2573851">12.5.12. Packages installing
! 633: scrollkeeper data files</a></span></dt>
! 634:
! 635: <dt><span class="sect2"><a href=
! 636: "#id2573902">12.5.13. Packages installing X11
! 637: fonts</a></span></dt>
! 638:
! 639: <dt><span class="sect2"><a href=
! 640: "#id2574018">12.5.14. Packages installing GTK2
! 641: modules</a></span></dt>
! 642:
! 643: <dt><span class="sect2"><a href=
! 644: "#id2574087">12.5.15. Packages installing SGML
! 645: or XML data</a></span></dt>
! 646:
! 647: <dt><span class="sect2"><a href=
! 648: "#id2574139">12.5.16. Packages installing
! 649: extensions to the MIME database</a></span></dt>
! 650:
! 651: <dt><span class="sect2"><a href=
! 652: "#id2574210">12.5.17. Packages using
! 653: intltool</a></span></dt>
! 654: </dl>
! 655: </dd>
! 656:
! 657: <dt><span class="sect1"><a href="#id2574224">12.6.
! 658: Feedback to the author</a></span></dt>
! 659: </dl>
! 660: </dd>
! 661:
! 662: <dt><span class="chapter"><a href="#debug">13.
! 663: Debugging</a></span></dt>
! 664:
! 665: <dt><span class="chapter"><a href="#submit">14.
! 666: Submitting and Committing</a></span></dt>
! 667:
! 668: <dd>
! 669: <dl>
! 670: <dt><span class="sect1"><a href="#id2574685">14.1.
! 671: Submitting your packages</a></span></dt>
! 672:
! 673: <dt><span class="sect1"><a href="#id2574732">14.2.
! 674: Committing: Importing a package into
! 675: CVS</a></span></dt>
! 676:
! 677: <dt><span class="sect1"><a href="#id2575000">14.3.
! 678: Updating a Package to a Newer
! 679: Version</a></span></dt>
! 680:
! 681: <dt><span class="sect1"><a href="#id2575019">14.4.
! 682: Moving a Package in pkgsrc</a></span></dt>
! 683: </dl>
! 684: </dd>
! 685: </dl>
! 686: </dd>
! 687:
! 688: <dt><span class="appendix"><a href="#examples">A. A simple
! 689: example package: bison</a></span></dt>
! 690:
! 691: <dd>
! 692: <dl>
! 693: <dt><span class="sect1"><a href="#id2575177">A.1.
! 694: files</a></span></dt>
! 695:
! 696: <dd>
! 697: <dl>
! 698: <dt><span class="sect2"><a href="#id2575180">A.1.1.
! 699: Makefile</a></span></dt>
! 700:
! 701: <dt><span class="sect2"><a href="#id2575188">A.1.2.
! 702: DESCR</a></span></dt>
! 703:
! 704: <dt><span class="sect2"><a href="#id2575203">A.1.3.
! 705: PLIST</a></span></dt>
! 706:
! 707: <dt><span class="sect2"><a href="#id2575210">A.1.4.
! 708: Checking a package with pkglint</a></span></dt>
! 709: </dl>
! 710: </dd>
! 711:
! 712: <dt><span class="sect1"><a href="#id2575319">A.2. Steps
! 713: for building, installing, packaging</a></span></dt>
! 714: </dl>
! 715: </dd>
! 716:
! 717: <dt><span class="appendix"><a href="#logs">B. Build
! 718: logs</a></span></dt>
! 719:
! 720: <dd>
! 721: <dl>
! 722: <dt><span class="sect1"><a href="#logs.building">B.1.
! 723: Building figlet</a></span></dt>
! 724:
! 725: <dt><span class="sect1"><a href="#logs.package">B.2.
! 726: Packaging figlet</a></span></dt>
! 727: </dl>
! 728: </dd>
! 729:
! 730: <dt><span class="appendix"><a href="#ftp-layout">C. Layout
! 731: of the FTP server's package archive</a></span></dt>
! 732: </dl>
! 733: </div>
! 734:
! 735: <div class="chapter" lang="en" xml:lang="en">
! 736: <div class="titlepage">
! 737: <div>
! 738: <div>
! 739: <h2 class="title"><a name="introduction" id=
! 740: "introduction"></a>Chapter 1. Introduction</h2>
! 741: </div>
! 742: </div>
! 743: </div>
! 744:
! 745: <div class="toc">
! 746: <p><b>Table of Contents</b></p>
! 747:
! 748: <dl>
! 749: <dt><span class="sect1"><a href="#id2494471">1.1.
! 750: Introduction</a></span></dt>
! 751:
! 752: <dt><span class="sect1"><a href="#overview">1.2.
! 753: Overview</a></span></dt>
! 754:
! 755: <dt><span class="sect1"><a href="#terminology">1.3.
! 756: Terminology</a></span></dt>
! 757:
! 758: <dt><span class="sect1"><a href="#typography">1.4.
! 759: Typography</a></span></dt>
! 760: </dl>
! 761: </div>
! 762:
! 763: <div class="sect1" lang="en" xml:lang="en">
! 764: <div class="titlepage">
! 765: <div>
! 766: <div>
! 767: <h2 class="title" style="clear: both"><a name=
! 768: "id2494471" id=
! 769: "id2494471"></a>1.1. Introduction</h2>
! 770: </div>
! 771: </div>
! 772: </div>
! 773:
! 774: <p>There is a lot of software freely available for Unix
! 775: based systems, which usually runs on NetBSD and other
! 776: Unix-flavoured systems, too, sometimes with some
! 777: modifications. The NetBSD Packages Collection (pkgsrc)
! 778: incorporates any such changes necessary to make that
! 779: software run, and makes the installation (and
! 780: de-installation) of the software package easy by means of a
! 781: single command.</p>
! 782:
! 783: <p>Once the software has been built, it is manipulated with
! 784: the <span><b class="command">pkg_*</b></span> tools so that
! 785: installation and de-installation, printing of an inventory
! 786: of all installed packages and retrieval of one-line
! 787: comments or more verbose descriptions are all simple.</p>
! 788:
! 789: <p>pkgsrc currently contains several thousand packages,
! 790: including:</p>
! 791:
! 792: <div class="itemizedlist">
! 793: <ul type="disc">
! 794: <li>
! 795: <p><a xmlns=
! 796: "http://www.w3.org/TR/xhtml1/transitional" href=
! 797: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
! 798: class="pkgname">www/apache</a> - The Apache web
! 799: server</p>
! 800: </li>
! 801:
! 802: <li>
! 803: <p><a xmlns=
! 804: "http://www.w3.org/TR/xhtml1/transitional" href=
! 805: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
! 806: class="pkgname">www/mozilla</a> - The Mozilla web
! 807: browser</p>
! 808: </li>
! 809:
! 810: <li>
! 811: <p><a xmlns=
! 812: "http://www.w3.org/TR/xhtml1/transitional" href=
! 813: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
! 814: class="pkgname">meta-pkgs/gnome</a> - The GNOME
! 815: Desktop Environment</p>
! 816: </li>
! 817:
! 818: <li>
! 819: <p><a xmlns=
! 820: "http://www.w3.org/TR/xhtml1/transitional" href=
! 821: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
! 822: class="pkgname">meta-pkgs/kde3</a> - The K Desktop
! 823: Environment</p>
! 824: </li>
! 825: </ul>
! 826: </div>
! 827:
! 828: <p>...just to name a few.</p>
! 829:
! 830: <p>pkgsrc has built-in support for handling varying
! 831: dependencies, such as pthreads and X11, and extended
! 832: features such as IPv6 support on a range of platforms.</p>
! 833:
! 834: <p>pkgsrc was derived from FreeBSD's ports system, and
! 835: initially developed for NetBSD only. Since then, pkgsrc has
! 836: grown a lot, and now supports the following platforms:</p>
! 837:
! 838: <div class="itemizedlist">
! 839: <ul type="disc">
! 840: <li>
! 841: <p><a href="http://developer.apple.com/darwin/"
! 842: target="_top">Darwin</a> (<a href=
! 843: "http://www.apple.com/macosx/" target="_top">Mac OS
! 844: X</a>)</p>
! 845: </li>
! 846:
! 847: <li>
! 848: <p><a href="http://www.FreeBSD.org/" target=
! 849: "_top">FreeBSD</a></p>
! 850: </li>
! 851:
! 852: <li>
! 853: <p><a href="http://www.microsoft.com/windows/sfu/"
! 854: target="_top">Interix</a></p>
! 855: </li>
! 856:
! 857: <li>
! 858: <p><a href="http://www.sgi.com/software/irix6.5/"
! 859: target="_top">IRIX</a></p>
! 860: </li>
! 861:
! 862: <li>
! 863: <p><a href="http://www.linux.org/" target=
! 864: "_top">Linux</a></p>
! 865: </li>
! 866:
! 867: <li>
! 868: <p><a href="http://www.NetBSD.org/" target=
! 869: "_top">NetBSD</a> (of course)</p>
! 870: </li>
! 871:
! 872: <li>
! 873: <p><a href="http://www.openbsd.org/" target=
! 874: "_top">OpenBSD</a></p>
! 875: </li>
! 876:
! 877: <li>
! 878: <p><a href="http://www.sun.com/solaris/" target=
! 879: "_top">Solaris</a></p>
! 880: </li>
! 881: </ul>
! 882: </div>
! 883: </div>
! 884:
! 885: <div class="sect1" lang="en" xml:lang="en">
! 886: <div class="titlepage">
! 887: <div>
! 888: <div>
! 889: <h2 class="title" style="clear: both"><a name=
! 890: "overview" id="overview"></a>1.2. Overview</h2>
! 891: </div>
! 892: </div>
! 893: </div>
! 894:
! 895: <p>This document is divided into two parts. The first,
! 896: <a href="#users-guide" title=
! 897: "Part I. pkgsrc user's guide">pkgsrc user's
! 898: guide</a>, describes how one can use one of the packages in
! 899: the Package Collection, either by installing a precompiled
! 900: binary package, or by building one's own copy using the
! 901: NetBSD package system. The second part, <a href=
! 902: "#developers-guide" title=
! 903: "Part II. pkgsrc developer's guide">pkgsrc
! 904: developer's guide</a>, explains how to prepare a package so
! 905: it can be easily built by other NetBSD users without
! 906: knowing about the package's building details.</p>
! 907:
! 908: <p>This document is available in various formats:</p>
! 909:
! 910: <div class="itemizedlist">
! 911: <ul type="disc">
! 912: <li>
! 913: <p><a href="index.html" target="_top">HTML</a></p>
! 914: </li>
! 915:
! 916: <li>
! 917: <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
! 918: </li>
! 919:
! 920: <li>
! 921: <p><a href="pkgsrc.ps" target="_top">PS</a></p>
! 922: </li>
! 923:
! 924: <li>
! 925: <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
! 926: </li>
! 927: </ul>
! 928: </div>
! 929: </div>
! 930:
! 931: <div class="sect1" lang="en" xml:lang="en">
! 932: <div class="titlepage">
! 933: <div>
! 934: <div>
! 935: <h2 class="title" style="clear: both"><a name=
! 936: "terminology" id=
! 937: "terminology"></a>1.3. Terminology</h2>
! 938: </div>
! 939: </div>
! 940: </div>
! 941:
! 942: <p>There has been a lot of talk about “<span class=
! 943: "quote">ports</span>”, “<span class=
! 944: "quote">packages</span>”, etc. so far. Here is a
! 945: description of all the terminology used within this
! 946: document.</p>
! 947:
! 948: <div class="variablelist">
! 949: <dl>
! 950: <dt><span class="term">Package</span></dt>
! 951:
! 952: <dd>
! 953: <p>A set of files and building instructions that
! 954: describe what's necessary to build a certain piece of
! 955: software using pkgsrc. Packages are traditionally
! 956: stored under <tt class=
! 957: "filename">/usr/pkgsrc</tt>.</p>
! 958: </dd>
! 959:
! 960: <dt><span class="term">The NetBSD package
! 961: system</span></dt>
! 962:
! 963: <dd>
! 964: <p>This is the former name of “<span class=
! 965: "quote">pkgsrc</span>”. It is part of the
! 966: NetBSD operating system and can be bootstrap to run
! 967: on non-NetBSD operating systems as well. It handles
! 968: building (compiling), installing, and removing of
! 969: packages.</p>
! 970: </dd>
! 971:
! 972: <dt><span class="term">Distfile</span></dt>
! 973:
! 974: <dd>
! 975: <p>This term describes the file or files that are
! 976: provided by the author of the piece of software to
! 977: distribute his work. All the changes necessary to
! 978: build on NetBSD are reflected in the corresponding
! 979: package. Usually the distfile is in the form of a
! 980: compressed tar-archive, but other types are possible,
! 981: too. Distfiles are usually stored below <tt class=
! 982: "filename">/usr/pkgsrc/distfiles</tt>.</p>
! 983: </dd>
! 984:
! 985: <dt><span class="term">Port</span></dt>
! 986:
! 987: <dd>
! 988: <p>This is the term used by FreeBSD and OpenBSD
! 989: people for what we call a package. In NetBSD
! 990: terminology, “<span class=
! 991: "quote">port</span>” refers to a different
! 992: architecture.</p>
! 993: </dd>
! 994:
! 995: <dt><span class="term">Precompiled/binary
! 996: package</span></dt>
! 997:
! 998: <dd>
! 999: <p>A set of binaries built with pkgsrc from a
! 1000: distfile and stuffed together in a single <tt class=
! 1001: "filename">.tgz</tt> file so it can be installed on
! 1002: machines of the same machine architecture without the
! 1003: need to recompile. Packages are usually generated in
! 1004: <tt class="filename">/usr/pkgsrc/packages</tt>; there
! 1005: is also an archive on <a href=
! 1006: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
! 1007: "_top">ftp.NetBSD.org</a>.</p>
! 1008:
! 1009: <p>Sometimes, this is referred to by the term
! 1010: “<span class="quote">package</span>” too,
! 1011: especially in the context of precompiled
! 1012: packages.</p>
! 1013: </dd>
! 1014:
! 1015: <dt><span class="term">Program</span></dt>
! 1016:
! 1017: <dd>
! 1018: <p>The piece of software to be installed which will
! 1019: be constructed from all the files in the Distfile by
! 1020: the actions defined in the corresponding package.</p>
! 1021: </dd>
! 1022: </dl>
! 1023: </div>
! 1024: </div>
! 1025:
! 1026: <div class="sect1" lang="en" xml:lang="en">
! 1027: <div class="titlepage">
! 1028: <div>
! 1029: <div>
! 1030: <h2 class="title" style="clear: both"><a name=
! 1031: "typography" id=
! 1032: "typography"></a>1.4. Typography</h2>
! 1033: </div>
! 1034: </div>
! 1035: </div>
! 1036:
! 1037: <p>When giving examples for commands, shell prompts are
! 1038: used to show if the command should/can be issued as root,
! 1039: or if “<span class="quote">normal</span>” user
! 1040: privileges are sufficient. We use a <tt class=
! 1041: "prompt">#</tt> for root's shell prompt, and a <tt class=
! 1042: "prompt">$</tt> for users' shell prompt, assuming they use
! 1043: the C-shell or tcsh.</p>
! 1044: </div>
! 1045: </div>
! 1046:
! 1047: <div class="part" lang="en" xml:lang="en">
! 1048: <div class="titlepage">
! 1049: <div>
! 1050: <div>
! 1051: <h1 class="title"><a name="users-guide" id=
! 1052: "users-guide"></a>pkgsrc user's guide</h1>
! 1053: </div>
! 1054: </div>
! 1055: </div>
! 1056:
! 1057: <div class="toc">
! 1058: <p><b>Table of Contents</b></p>
! 1059:
! 1060: <dl>
! 1061: <dt><span class="chapter"><a href="#getting">2. Where to
! 1062: get pkgsrc</a></span></dt>
! 1063:
! 1064: <dd>
! 1065: <dl>
! 1066: <dt><span class="sect1"><a href="#id2495110">2.1. As
! 1067: tar file</a></span></dt>
! 1068:
! 1069: <dt><span class="sect1"><a href="#id2495127">2.2. Via
! 1070: SUP</a></span></dt>
! 1071:
! 1072: <dt><span class="sect1"><a href="#id2495159">2.3. Via
! 1073: CVS</a></span></dt>
! 1074: </dl>
! 1075: </dd>
! 1076:
! 1077: <dt><span class="chapter"><a href="#platforms">3. Using
! 1078: pkgsrc on systems other than NetBSD</a></span></dt>
! 1079:
! 1080: <dd>
! 1081: <dl>
! 1082: <dt><span class="sect1"><a href="#id2495269">3.1.
! 1083: Bootstrapping pkgsrc</a></span></dt>
! 1084:
! 1085: <dt><span class="sect1"><a href="#id2495376">3.2.
! 1086: Platform specific notes</a></span></dt>
! 1087:
! 1088: <dd>
! 1089: <dl>
! 1090: <dt><span class="sect2"><a href=
! 1091: "#id2495382">3.2.1. Darwin (Mac OS
! 1092: X)</a></span></dt>
! 1093:
! 1094: <dt><span class="sect2"><a href=
! 1095: "#id2495681">3.2.2. FreeBSD</a></span></dt>
! 1096:
! 1097: <dt><span class="sect2"><a href=
! 1098: "#id2496397">3.2.3. Interix</a></span></dt>
! 1099:
! 1100: <dt><span class="sect2"><a href=
! 1101: "#id2496488">3.2.4. IRIX</a></span></dt>
! 1102:
! 1103: <dt><span class="sect2"><a href=
! 1104: "#id2496605">3.2.5. OpenBSD</a></span></dt>
! 1105:
! 1106: <dt><span class="sect2"><a href=
! 1107: "#id2496786">3.2.6. Solaris</a></span></dt>
! 1108: </dl>
! 1109: </dd>
! 1110: </dl>
! 1111: </dd>
! 1112:
! 1113: <dt><span class="chapter"><a href="#using">4. Using
! 1114: pkgsrc</a></span></dt>
! 1115:
! 1116: <dd>
! 1117: <dl>
! 1118: <dt><span class="sect1"><a href=
! 1119: "#getting-started">4.1. Working with binary
! 1120: packages</a></span></dt>
! 1121:
! 1122: <dd>
! 1123: <dl>
! 1124: <dt><span class="sect2"><a href=
! 1125: "#id2496922">4.1.1. Where to get binary
! 1126: packages</a></span></dt>
! 1127:
! 1128: <dt><span class="sect2"><a href=
! 1129: "#id2496963">4.1.2. How to use binary
! 1130: packages</a></span></dt>
! 1131:
! 1132: <dt><span class="sect2"><a href=
! 1133: "#id2497165">4.1.3. A word of
! 1134: warning</a></span></dt>
! 1135: </dl>
! 1136: </dd>
! 1137:
! 1138: <dt><span class="sect1"><a href="#id2497177">4.2.
! 1139: Building packages from source</a></span></dt>
! 1140:
! 1141: <dd>
! 1142: <dl>
! 1143: <dt><span class="sect2"><a href=
! 1144: "#id2497187">4.2.1. Requirements</a></span></dt>
! 1145:
! 1146: <dt><span class="sect2"><a href=
! 1147: "#id2497275">4.2.2. Fetching
! 1148: distfiles</a></span></dt>
! 1149:
! 1150: <dt><span class="sect2"><a href=
! 1151: "#id2497328">4.2.3. How to build and
! 1152: install</a></span></dt>
! 1153:
! 1154: <dt><span class="sect2"><a href=
! 1155: "#id2498259">4.2.4. Selecting the
! 1156: compiler</a></span></dt>
! 1157: </dl>
! 1158: </dd>
! 1159: </dl>
! 1160: </dd>
! 1161:
! 1162: <dt><span class="chapter"><a href="#binary">5. Creating
! 1163: binary packages</a></span></dt>
! 1164:
! 1165: <dd>
! 1166: <dl>
! 1167: <dt><span class="sect1"><a href="#id2498413">5.1.
! 1168: Building a single binary package</a></span></dt>
! 1169:
! 1170: <dt><span class="sect1"><a href="#id2563208">5.2.
! 1171: Settings for creation of binary
! 1172: packages</a></span></dt>
! 1173:
! 1174: <dt><span class="sect1"><a href="#bulkbuild">5.3.
! 1175: Doing a bulk build of all packages</a></span></dt>
! 1176:
! 1177: <dd>
! 1178: <dl>
! 1179: <dt><span class="sect2"><a href=
! 1180: "#binary.configuration">5.3.1.
! 1181: Configuration</a></span></dt>
! 1182:
! 1183: <dt><span class="sect2"><a href=
! 1184: "#id2563348">5.3.2. Other environmental
! 1185: considerations</a></span></dt>
! 1186:
! 1187: <dt><span class="sect2"><a href=
! 1188: "#id2563388">5.3.3. Operation</a></span></dt>
! 1189:
! 1190: <dt><span class="sect2"><a href=
! 1191: "#id2563595">5.3.4. What it does</a></span></dt>
! 1192:
! 1193: <dt><span class="sect2"><a href=
! 1194: "#id2563652">5.3.5. Disk space
! 1195: requirements</a></span></dt>
! 1196:
! 1197: <dt><span class="sect2"><a href=
! 1198: "#id2563678">5.3.6. Setting up a sandbox for
! 1199: chroot'ed builds</a></span></dt>
! 1200:
! 1201: <dt><span class="sect2"><a href=
! 1202: "#id2564042">5.3.7. Building a partial set of
! 1203: packages</a></span></dt>
! 1204: </dl>
! 1205: </dd>
! 1206:
! 1207: <dt><span class="sect1"><a href="#id2564085">5.4.
! 1208: Creating a multiple CD-ROM packages
! 1209: collection</a></span></dt>
! 1210:
! 1211: <dd>
! 1212: <dl>
! 1213: <dt><span class="sect2"><a href=
! 1214: "#id2564168">5.4.1. Example of
! 1215: cdpack</a></span></dt>
! 1216: </dl>
! 1217: </dd>
! 1218: </dl>
! 1219: </dd>
! 1220:
! 1221: <dt><span class="chapter"><a href="#faq">6. Frequently
! 1222: Asked Questions</a></span></dt>
! 1223:
! 1224: <dd>
! 1225: <dl>
! 1226: <dt><span class="sect1"><a href="#id2564359">6.1. Is
! 1227: there a mailing list for pkg-related
! 1228: discussion?</a></span></dt>
! 1229:
! 1230: <dt><span class="sect1"><a href="#id2564457">6.2.
! 1231: Where's the pkgviews documentation?</a></span></dt>
! 1232:
! 1233: <dt><span class="sect1"><a href="#id2564470">6.3.
! 1234: Utilities for package management
! 1235: (pkgtools)</a></span></dt>
! 1236:
! 1237: <dt><span class="sect1"><a href="#id2564695">6.4. How
! 1238: to use pkgsrc as non-root</a></span></dt>
! 1239:
! 1240: <dt><span class="sect1"><a href="#id2564707">6.5. How
! 1241: can I install/use XFree86 from
! 1242: pkgsrc?</a></span></dt>
! 1243:
! 1244: <dt><span class="sect1"><a href="#id2564803">6.6. How
! 1245: can I install/use X.org from pkgsrc?</a></span></dt>
! 1246:
! 1247: <dt><span class="sect1"><a href="#id2564830">6.7. How
! 1248: to fetch files from behind a firewall</a></span></dt>
! 1249:
! 1250: <dt><span class="sect1"><a href="#id2564844">6.8. How
! 1251: do I tell make fetch to do passive
! 1252: FTP?</a></span></dt>
! 1253:
! 1254: <dt><span class="sect1"><a href="#id2564896">6.9. How
! 1255: to fetch all distfiles at once</a></span></dt>
! 1256:
! 1257: <dt><span class="sect1"><a href="#id2565104">6.10.
! 1258: What does Don't know how to make
! 1259: /usr/share/tmac/tmac.andoc mean?</a></span></dt>
! 1260:
! 1261: <dt><span class="sect1"><a href="#id2565142">6.11.
! 1262: What does Could not find bsd.own.mk
! 1263: mean?</a></span></dt>
! 1264:
! 1265: <dt><span class="sect1"><a href="#id2565200">6.12.
! 1266: Using 'sudo' with pkgsrc</a></span></dt>
! 1267:
! 1268: <dt><span class="sect1"><a href="#faq.conf">6.13.
! 1269: Configuration files handling and
! 1270: placement</a></span></dt>
! 1271:
! 1272: <dt><span class="sect1"><a href=
! 1273: "#audit-packages">6.14. Automated security
! 1274: checks</a></span></dt>
! 1275: </dl>
! 1276: </dd>
! 1277: </dl>
! 1278: </div>
! 1279:
! 1280: <div class="chapter" lang="en" xml:lang="en">
! 1281: <div class="titlepage">
! 1282: <div>
! 1283: <div>
! 1284: <h2 class="title"><a name="getting" id=
! 1285: "getting"></a>Chapter 2. Where to get
! 1286: pkgsrc</h2>
! 1287: </div>
! 1288: </div>
! 1289: </div>
! 1290:
! 1291: <div class="toc">
! 1292: <p><b>Table of Contents</b></p>
! 1293:
! 1294: <dl>
! 1295: <dt><span class="sect1"><a href="#id2495110">2.1. As
! 1296: tar file</a></span></dt>
! 1297:
! 1298: <dt><span class="sect1"><a href="#id2495127">2.2. Via
! 1299: SUP</a></span></dt>
! 1300:
! 1301: <dt><span class="sect1"><a href="#id2495159">2.3. Via
! 1302: CVS</a></span></dt>
! 1303: </dl>
! 1304: </div>
! 1305:
! 1306: <p>There are three ways to get pkgsrc. Either as a tar
! 1307: file, via SUP, or via CVS. All three ways are described
! 1308: here.</p>
! 1309:
! 1310: <div class="sect1" lang="en" xml:lang="en">
! 1311: <div class="titlepage">
! 1312: <div>
! 1313: <div>
! 1314: <h2 class="title" style="clear: both"><a name=
! 1315: "id2495110" id="id2495110"></a>2.1. As tar
! 1316: file</h2>
! 1317: </div>
! 1318: </div>
! 1319: </div>
! 1320:
! 1321: <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
! 1322: file from <a href=
! 1323: "ftp://ftp.NetBSD.org/pub/NetBSD-current/tar_files/pkgsrc.tar.gz"
! 1324: target="_top">ftp.NetBSD.org</a> and unpack it into
! 1325: <tt class="filename">/usr/pkgsrc</tt>.</p>
! 1326: </div>
! 1327:
! 1328: <div class="sect1" lang="en" xml:lang="en">
! 1329: <div class="titlepage">
! 1330: <div>
! 1331: <div>
! 1332: <h2 class="title" style="clear: both"><a name=
! 1333: "id2495127" id="id2495127"></a>2.2. Via
! 1334: SUP</h2>
! 1335: </div>
! 1336: </div>
! 1337: </div>
! 1338:
! 1339: <p>As an alternative to the tar file, you can get pkgsrc
! 1340: via the Software Update Protocol, SUP. To do so, make
! 1341: sure your supfile has a line</p>
! 1342: <pre class="programlisting">
! 1343: release=pkgsrc
! 1344: </pre>
! 1345:
! 1346: <p>in it, see the examples in <tt class=
! 1347: "filename">/usr/share/examples/supfiles</tt>, and that
! 1348: the <tt class="filename">/usr/pkgsrc</tt> directory
! 1349: exists. Then, simply run <span><b class="command">sup -v
! 1350: <i class=
! 1351: "replaceable"><tt>/path/to/your/supfile</tt></i></b></span>.</p>
! 1352: </div>
! 1353:
! 1354: <div class="sect1" lang="en" xml:lang="en">
! 1355: <div class="titlepage">
! 1356: <div>
! 1357: <div>
! 1358: <h2 class="title" style="clear: both"><a name=
! 1359: "id2495159" id="id2495159"></a>2.3. Via
! 1360: CVS</h2>
! 1361: </div>
! 1362: </div>
! 1363: </div>
! 1364:
! 1365: <p>To get pkgsrc via CVS, make sure you have
! 1366: “<span class="quote">cvs</span>” installed.
! 1367: If not present on your system, it can be found as
! 1368: precompiled binary on ftp.NetBSD.org. To do an initial
! 1369: (full) checkout of pkgsrc, do the following steps:</p>
! 1370: <pre class="screen">
! 1371: <tt class="prompt">%</tt> <b class=
! 1372: "userinput"><tt>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</tt></b>
! 1373: <tt class="prompt">%</tt> <b class=
! 1374: "userinput"><tt>setenv CVS_RSH ssh</tt></b>
! 1375: <tt class="prompt">%</tt> <b class="userinput"><tt>cd /usr</tt></b>
! 1376: <tt class="prompt">%</tt> <b class=
! 1377: "userinput"><tt>cvs checkout -P pkgsrc</tt></b>
! 1378: </pre>
! 1379:
! 1380: <p>This will create the <tt class="filename">pkgsrc</tt>
! 1381: directory in your <tt class="filename">/usr</tt>, and all
! 1382: the package source will be stored under <tt class=
! 1383: "filename">/usr/pkgsrc</tt>. To update pkgsrc after the
! 1384: initial checkout, make sure you have <tt class=
! 1385: "varname">CVS_RSH</tt> set as above, then do:</p>
! 1386: <pre class="screen">
! 1387: <tt class="prompt">%</tt> <b class=
! 1388: "userinput"><tt>cd /usr/pkgsrc</tt></b>
! 1389: <tt class="prompt">%</tt> <b class=
! 1390: "userinput"><tt>cvs -q update -dP</tt></b>
! 1391: </pre>
! 1392:
! 1393: <p>Please also note that it is possible to have multiple
! 1394: copies of the pkgsrc hierarchy in use at any one time -
! 1395: all work is done relatively within the pkgsrc tree.</p>
! 1396: </div>
! 1397: </div>
! 1398:
! 1399: <div class="chapter" lang="en" xml:lang="en">
! 1400: <div class="titlepage">
! 1401: <div>
! 1402: <div>
! 1403: <h2 class="title"><a name="platforms" id=
! 1404: "platforms"></a>Chapter 3. Using pkgsrc on
! 1405: systems other than NetBSD</h2>
! 1406: </div>
! 1407: </div>
! 1408: </div>
! 1409:
! 1410: <div class="toc">
! 1411: <p><b>Table of Contents</b></p>
! 1412:
! 1413: <dl>
! 1414: <dt><span class="sect1"><a href="#id2495269">3.1.
! 1415: Bootstrapping pkgsrc</a></span></dt>
! 1416:
! 1417: <dt><span class="sect1"><a href="#id2495376">3.2.
! 1418: Platform specific notes</a></span></dt>
! 1419:
! 1420: <dd>
! 1421: <dl>
! 1422: <dt><span class="sect2"><a href="#id2495382">3.2.1.
! 1423: Darwin (Mac OS X)</a></span></dt>
! 1424:
! 1425: <dt><span class="sect2"><a href="#id2495681">3.2.2.
! 1426: FreeBSD</a></span></dt>
! 1427:
! 1428: <dt><span class="sect2"><a href="#id2496397">3.2.3.
! 1429: Interix</a></span></dt>
! 1430:
! 1431: <dt><span class="sect2"><a href="#id2496488">3.2.4.
! 1432: IRIX</a></span></dt>
! 1433:
! 1434: <dt><span class="sect2"><a href="#id2496605">3.2.5.
! 1435: OpenBSD</a></span></dt>
! 1436:
! 1437: <dt><span class="sect2"><a href="#id2496786">3.2.6.
! 1438: Solaris</a></span></dt>
! 1439: </dl>
! 1440: </dd>
! 1441: </dl>
! 1442: </div>
! 1443:
! 1444: <div class="sect1" lang="en" xml:lang="en">
! 1445: <div class="titlepage">
! 1446: <div>
! 1447: <div>
! 1448: <h2 class="title" style="clear: both"><a name=
! 1449: "id2495269" id=
! 1450: "id2495269"></a>3.1. Bootstrapping pkgsrc</h2>
! 1451: </div>
! 1452: </div>
! 1453: </div>
! 1454:
! 1455: <p>For Operating Systems other than NetBSD, we provide a
! 1456: bootstrap kit to build the required tools to use pkgsrc
! 1457: on your platform. Besides support for native NetBSD,
! 1458: pkgsrc and the bootstrap kit have support for the
! 1459: following operating systems:</p>
! 1460:
! 1461: <div class="itemizedlist">
! 1462: <ul type="disc">
! 1463: <li>
! 1464: <p>Darwin (Mac OS X)</p>
! 1465: </li>
! 1466:
! 1467: <li>
! 1468: <p>FreeBSD</p>
! 1469: </li>
! 1470:
! 1471: <li>
! 1472: <p>Interix (Windows 2000, XP, 2003)</p>
! 1473: </li>
! 1474:
! 1475: <li>
! 1476: <p>IRIX</p>
! 1477: </li>
! 1478:
! 1479: <li>
! 1480: <p>Linux</p>
! 1481: </li>
! 1482:
! 1483: <li>
! 1484: <p>OpenBSD</p>
! 1485: </li>
! 1486:
! 1487: <li>
! 1488: <p>Solaris</p>
! 1489: </li>
! 1490: </ul>
! 1491: </div>
! 1492:
! 1493: <p>Support for other platforms is under development.</p>
! 1494:
! 1495: <p>Installing the bootstrap kit should be as simple
! 1496: as:</p>
! 1497: <pre class="screen">
! 1498: <tt class="prompt">#</tt> <b class=
! 1499: "userinput"><tt>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</tt></b>
! 1500: <tt class="prompt">#</tt> <b class=
! 1501: "userinput"><tt>cd pkgsrc/bootstrap</tt></b>
! 1502: <tt class="prompt">#</tt> <b class=
! 1503: "userinput"><tt>./bootstrap</tt></b>
! 1504: </pre>
! 1505:
! 1506: <p>See <a href="#getting" title=
! 1507: "Chapter 2. Where to get pkgsrc">Chapter 2,
! 1508: <i>Where to get pkgsrc</i></a> for other ways to get
! 1509: pkgsrc before bootstrapping. The given <span><b class=
! 1510: "command">bootstrap</b></span> command will use the
! 1511: defaults of <tt class="filename">/usr/pkg</tt> for the
! 1512: <span class="emphasis"><em>prefix</em></span> where
! 1513: programs will be installed in, and <tt class=
! 1514: "filename">/var/db/pkg</tt> for the package database
! 1515: directory where pkgsrc will do it's internal bookkeeping.
! 1516: However, these can also be set using command-line
! 1517: parameters.</p>
! 1518:
! 1519: <p>Binary packages for the pkgsrc tools and an initial
! 1520: set of packages is available for supported platforms. An
! 1521: up-to-date list of these can be found on <a href=
! 1522: "http://www.pkgsrc.org/" target=
! 1523: "_top">www.pkgsrc.org</a>.</p>
! 1524: </div>
! 1525:
! 1526: <div class="sect1" lang="en" xml:lang="en">
! 1527: <div class="titlepage">
! 1528: <div>
! 1529: <div>
! 1530: <h2 class="title" style="clear: both"><a name=
! 1531: "id2495376" id="id2495376"></a>3.2. Platform
! 1532: specific notes</h2>
! 1533: </div>
! 1534: </div>
! 1535: </div>
! 1536:
! 1537: <p>Here are some platform-specific notes you should be
! 1538: aware of.</p>
! 1539:
! 1540: <div class="sect2" lang="en" xml:lang="en">
! 1541: <div class="titlepage">
! 1542: <div>
! 1543: <div>
! 1544: <h3 class="title"><a name="id2495382" id=
! 1545: "id2495382"></a>3.2.1. Darwin (Mac OS
! 1546: X)</h3>
! 1547: </div>
! 1548: </div>
! 1549: </div>
! 1550:
! 1551: <p>Darwin 5.x and 6.x are supported. There are two
! 1552: methods of using pkgsrc on Mac OS X, by using a
! 1553: <a href="#platform.osx-image" title=
! 1554: "3.2.1.1. Using a disk image">disk image</a>, or a
! 1555: <a href="#platform.osx-ufs" title=
! 1556: "3.2.1.2. Using a UFS partition">UFS
! 1557: partition</a>.</p>
! 1558:
! 1559: <p>Before you start, you will need to download and
! 1560: install the Mac OS X Developer Tools from Apple's
! 1561: Developer Connection. See <a href=
! 1562: "http://developer.apple.com/macosx/" target=
! 1563: "_top">http://developer.apple.com/macosx/</a> for
! 1564: details. Also, make sure you install X11 for Mac OS X
! 1565: and the X11 SDK from <a href=
! 1566: "http://www.apple.com/macosx/x11/download/" target=
! 1567: "_top">http://www.apple.com/macosx/x11/download/</a> if
! 1568: you intend to build packages that use the X11 Window
! 1569: System.</p>
! 1570:
! 1571: <p>If you already have a UFS partition, or have a spare
! 1572: partition that you can format as UFS, it is recommended
! 1573: to use that instead of the disk image. It'll be
! 1574: somewhat faster and will mount automatically at boot
! 1575: time, where you must manually mount a disk image.</p>
! 1576:
! 1577: <div class="note" style=
! 1578: "margin-left: 0.5in; margin-right: 0.5in;">
! 1579: <h3 class="title">Note</h3>
! 1580:
! 1581: <p>You cannot use a HFS+ file system for pkgsrc,
! 1582: because pkgsrc currently requires the filesystem to
! 1583: be case-sensitive, and HFS+ is not.</p>
! 1584: </div>
! 1585:
! 1586: <div class="sect3" lang="en" xml:lang="en">
! 1587: <div class="titlepage">
! 1588: <div>
! 1589: <div>
! 1590: <h4 class="title"><a name="platform.osx-image"
! 1591: id="platform.osx-image"></a>3.2.1.1. Using
! 1592: a disk image</h4>
! 1593: </div>
! 1594: </div>
! 1595: </div>
! 1596:
! 1597: <p>Create the disk image:</p>
! 1598: <pre class="screen">
! 1599: <tt class="prompt">#</tt> <b class=
! 1600: "userinput"><tt>cd pkgsrc/bootstrap</tt></b>
! 1601: <tt class="prompt">#</tt> <b class=
! 1602: "userinput"><tt>./ufsdiskimage create ~/Documents/NetBSD 512</tt></b> # megabytes - season to taste
! 1603: <tt class="prompt">#</tt> <b class=
! 1604: "userinput"><tt>./ufsdiskimage mount ~/Documents/NetBSD</tt></b>
! 1605: <tt class="prompt">#</tt> <b class=
! 1606: "userinput"><tt>sudo chown `id -u`:`id -g` /Volumes/NetBSD</tt></b>
! 1607: </pre>
! 1608:
! 1609: <p>That's it!</p>
! 1610: </div>
! 1611:
! 1612: <div class="sect3" lang="en" xml:lang="en">
! 1613: <div class="titlepage">
! 1614: <div>
! 1615: <div>
! 1616: <h4 class="title"><a name="platform.osx-ufs"
! 1617: id="platform.osx-ufs"></a>3.2.1.2. Using a
! 1618: UFS partition</h4>
! 1619: </div>
! 1620: </div>
! 1621: </div>
! 1622:
! 1623: <p>By default, <tt class="filename">/usr</tt> will be
! 1624: on your root file system, normally HFS+. It is
! 1625: possible to use the default <span class=
! 1626: "emphasis"><em>prefix</em></span> of <tt class=
! 1627: "filename">/usr/pkg</tt> by symlinking <tt class=
! 1628: "filename">/usr/pkg</tt> to a directory on a UFS file
! 1629: system. Obviously, another symlink is required if you
! 1630: want to place the package database directory outside
! 1631: the <span class="emphasis"><em>prefix</em></span>.
! 1632: e.g.</p>
! 1633: <pre class="screen">
! 1634: <tt class="prompt">#</tt> <b class=
! 1635: "userinput"><tt>./bootstrap --pkgdbdir=/usr/pkg/pkgdb --pkgsrcdir=/Volumes/ufs/pkgsrc</tt></b>
! 1636: </pre>
! 1637:
! 1638: <p>If you created your partitions at the time of
! 1639: installing Mac OS X and formatted the target
! 1640: partition as UFS, it should automatically mount on
! 1641: <tt class="filename">/Volumes/<volume
! 1642: name></tt> when the machine boots. If you are
! 1643: (re)formatting a partition as UFS, you need to ensure
! 1644: that the partition map correctly reflects
! 1645: “<span class="quote">Apple_UFS</span>”
! 1646: and not “<span class=
! 1647: "quote">Apple_HFS</span>”.</p>
! 1648:
! 1649: <p>The problem is that none of the disk tools will
! 1650: let you touch a disk that is booted from. You can
! 1651: unmount the partition, but even if you newfs it, the
! 1652: partition type will be incorrect and the automounter
! 1653: won't mount it. It can be mounted manually, but it
! 1654: won't appear in Finder.</p>
! 1655:
! 1656: <p>You'll need to boot off of the OS X Installation
! 1657: (User) CD. When the Installation program starts, go
! 1658: up to the menu and select Disk Utility. Now, you will
! 1659: be able to select the partition you want to be UFS,
! 1660: and Format it Apple UFS. Quit the Disk Utility, quit
! 1661: the installer which will reboot your machine. The new
! 1662: UFS file system will appear in Finder.</p>
! 1663:
! 1664: <p>Be aware that the permissions on the new file
! 1665: system will be writable by root only.</p>
! 1666:
! 1667: <p>This note is as of 10.2 (Jaguar) and applies to
! 1668: earlier versions. Hopefully Apple will fix Disk
! 1669: Utility in 10.3 (Panther).</p>
! 1670: </div>
! 1671: </div>
! 1672:
! 1673: <div class="sect2" lang="en" xml:lang="en">
! 1674: <div class="titlepage">
! 1675: <div>
! 1676: <div>
! 1677: <h3 class="title"><a name="id2495681" id=
! 1678: "id2495681"></a>3.2.2. FreeBSD</h3>
! 1679: </div>
! 1680: </div>
! 1681: </div>
! 1682:
! 1683: <p>FreeBSD 4.7 and 5.0 have been tested and are
! 1684: supported, other versions may work.</p>
! 1685:
! 1686: <p>Care should be taken so that the tools that this kit
! 1687: installs do not conflict with the FreeBSD userland
! 1688: tools. There are several steps:</p>
! 1689:
! 1690: <div class="orderedlist">
! 1691: <ol type="1">
! 1692: <li>
! 1693: <p>FreeBSD stores its ports pkg database in
! 1694: <tt class="filename">/var/db/pkg</tt>. It is
! 1695: therefore recommended that you choose a different
! 1696: location (e.g. <tt class=
! 1697: "filename">/usr/pkgdb</tt>) by using the
! 1698: --pkgdbdir option to the bootstrap script.</p>
! 1699: </li>
! 1700:
! 1701: <li>
! 1702: <p>If you do not intend to use the FreeBSD ports
! 1703: tools, it's probably a good idea to move them out
! 1704: of the way to avoid confusion, e.g.</p>
! 1705: <pre class="screen">
! 1706: <tt class="prompt">#</tt> <b class=
! 1707: "userinput"><tt>cd /usr/sbin</tt></b>
! 1708: <tt class="prompt">#</tt> <b class=
! 1709: "userinput"><tt>mv pkg_add pkg_add.orig</tt></b>
! 1710: <tt class="prompt">#</tt> <b class=
! 1711: "userinput"><tt>mv pkg_create pkg_create.orig</tt></b>
! 1712: <tt class="prompt">#</tt> <b class=
! 1713: "userinput"><tt>mv pkg_delete pkg_delete.orig</tt></b>
! 1714: <tt class="prompt">#</tt> <b class=
! 1715: "userinput"><tt>mv pkg_info pkg_info.orig</tt></b>
! 1716: </pre>
! 1717: </li>
! 1718:
! 1719: <li>
! 1720: <p>An example <tt class=
! 1721: "filename">/etc/mk.conf</tt> file will be placed
! 1722: in <tt class="filename">/etc/mk.conf.example</tt>
! 1723: file when you use the bootstrap script.</p>
! 1724: </li>
! 1725: </ol>
! 1726: </div>
! 1727: </div>
! 1728:
! 1729: <div class="sect2" lang="en" xml:lang="en">
! 1730: <div class="titlepage">
! 1731: <div>
! 1732: <div>
! 1733: <h3 class="title"><a name="id2496397" id=
! 1734: "id2496397"></a>3.2.3. Interix</h3>
! 1735: </div>
! 1736: </div>
! 1737: </div>
! 1738:
! 1739: <p>Interix is a POSIX compatible subsystem for the
! 1740: Windows NT kernel, providing a Unix-like environment
! 1741: with a tighter kernel integration than available with
! 1742: Cygwin. It is part of the Windows Services for Unix
! 1743: package, available for free for any licensed copy of
! 1744: Windows 2000, XP, or 2003. SFU can be downloaded from
! 1745: <a href="http://www.microsoft.com/windows/sfu/" target=
! 1746: "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
! 1747:
! 1748: <p>Services for Unix 3.5, current as of this writing,
! 1749: has been tested. 3.0 or 3.1 may work, but are not
! 1750: officially supported. (The main difference in 3.0/3.1
! 1751: is lack of pthreads.)</p>
! 1752:
! 1753: <div class="sect3" lang="en" xml:lang="en">
! 1754: <div class="titlepage">
! 1755: <div>
! 1756: <div>
! 1757: <h4 class="title"><a name=
! 1758: "platform.interix-sfu-install" id=
! 1759: "platform.interix-sfu-install"></a>3.2.3.1. When
! 1760: Installing Interix/SFU</h4>
! 1761: </div>
! 1762: </div>
! 1763: </div>
! 1764:
! 1765: <p>At an absolute minimum, the following packages
! 1766: must be installed from the Windows Services for Unix
! 1767: 3.5 distribution in order to use pkgsrc:</p>
! 1768:
! 1769: <div class="itemizedlist">
! 1770: <ul type="disc">
! 1771: <li>
! 1772: <p>Utilities -> Base Utilities</p>
! 1773: </li>
! 1774:
! 1775: <li>
! 1776: <p>Interix GNU Components -> (all)</p>
! 1777: </li>
! 1778:
! 1779: <li>
! 1780: <p>Remote Connectivity</p>
! 1781: </li>
! 1782:
! 1783: <li>
! 1784: <p>Interix SDK</p>
! 1785: </li>
! 1786: </ul>
! 1787: </div>
! 1788:
! 1789: <p>When using pkgsrc on Interix, DO NOT install the
! 1790: Utilities subcomponent "UNIX Perl". That is Perl 5.6
! 1791: without shared module support, installed to
! 1792: /usr/local, and will only cause confusion. Instead,
! 1793: install Perl 5.8 from pkgsrc (or from a binary
! 1794: package).</p>
! 1795:
! 1796: <p>The Remote Connectivity subcomponent "Windows
! 1797: Remote Shell Service" does not need to be installed,
! 1798: but Remote Connectivity itself should be installed in
! 1799: order to have a working inetd.</p>
! 1800:
! 1801: <p>Finally, during installation you may be asked
! 1802: whether to enable setuid behavior for Interix
! 1803: programs, and whether to make pathnames default to
! 1804: case-sensitive. Setuid should be enabled, and
! 1805: case-sensitivity MUST be enabled. (Without
! 1806: case-sensitivity, a large number of packages
! 1807: including perl will not build.)</p>
! 1808: </div>
! 1809:
! 1810: <div class="sect3" lang="en" xml:lang="en">
! 1811: <div class="titlepage">
! 1812: <div>
! 1813: <div>
! 1814: <h4 class="title"><a name=
! 1815: "platform.interix-sfu-postinstall" id=
! 1816: "platform.interix-sfu-postinstall"></a>3.2.3.2. What
! 1817: to do if Interix/SFU is already installed</h4>
! 1818: </div>
! 1819: </div>
! 1820: </div>
! 1821:
! 1822: <p>If SFU is already installed and you wish to alter
! 1823: these settings to work with pkgsrc, note the
! 1824: following things.</p>
! 1825:
! 1826: <div class="itemizedlist">
! 1827: <ul type="disc">
! 1828: <li>
! 1829: <p>To uninstall UNIX Perl, use Add/Remove
! 1830: Programs, select Microsoft Windows Services for
! 1831: UNIX, then click Change. In the installer,
! 1832: choose Add or Remove, then uncheck
! 1833: Utilities->UNIX Perl.</p>
! 1834: </li>
! 1835:
! 1836: <li>
! 1837: <p>To enable case-sensitivity for the
! 1838: filesystem, run REGEDIT.EXE, and change the
! 1839: following registry key:</p>
! 1840:
! 1841: <p>
! 1842: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
! 1843: Manager\kernel</p>
! 1844:
! 1845: <p>Set the DWORD value "obcaseinsensitive" to
! 1846: 0; then reboot.</p>
! 1847: </li>
! 1848:
! 1849: <li>
! 1850: <p>To enable setuid binaries (optional), run
! 1851: REGEDIT.EXE, and change the following registry
! 1852: key:</p>
! 1853:
! 1854: <p>
! 1855: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
! 1856: for UNIX</p>
! 1857:
! 1858: <p>Set the DWORD value "EnableSetuidBinaries"
! 1859: to 1; then reboot.</p>
! 1860: </li>
! 1861: </ul>
! 1862: </div>
! 1863: </div>
! 1864:
! 1865: <div class="sect3" lang="en" xml:lang="en">
! 1866: <div class="titlepage">
! 1867: <div>
! 1868: <div>
! 1869: <h4 class="title"><a name=
! 1870: "platform.interix-notes" id=
! 1871: "platform.interix-notes"></a>3.2.3.3. Important
! 1872: notes for using pkgsrc</h4>
! 1873: </div>
! 1874: </div>
! 1875: </div>
! 1876:
! 1877: <p>The package imanager (either the pkgsrc "su" user,
! 1878: or the user running "pkg_add") must be a member of
! 1879: the local Administrators group. Such a user must also
! 1880: be used to run the bootstrap. This is slightly
! 1881: relaxed from the normal pkgsrc requirement of
! 1882: "root".</p>
! 1883:
! 1884: <p>The package manager should use a umask of 002.
! 1885: "make install" will automatically complain if this is
! 1886: not the case. This ensures that directories written
! 1887: in /var/db/pkg are Administrators-group
! 1888: writeable.</p>
! 1889:
! 1890: <p>The popular Interix binary packages from
! 1891: http://www.interopsystems.com/ use an older version
! 1892: of pkgsrc's pkg_* tools. Ideally, these should NOT be
! 1893: used in conjunction with pkgsrc. If you choose to use
! 1894: them at the same time as the pkgsrc packages, ensure
! 1895: that you use the proper pkg_* tools for each type of
! 1896: binary package.</p>
! 1897: </div>
! 1898: </div>
! 1899:
! 1900: <div class="sect2" lang="en" xml:lang="en">
! 1901: <div class="titlepage">
! 1902: <div>
! 1903: <div>
! 1904: <h3 class="title"><a name="id2496488" id=
! 1905: "id2496488"></a>3.2.4. IRIX</h3>
! 1906: </div>
! 1907: </div>
! 1908: </div>
! 1909:
! 1910: <p>You will need a working C compiler, either gcc or
! 1911: SGI's MIPS and MIPSpro compiler (cc/c89). Please set
! 1912: the <tt class="varname">CC</tt> environment variable
! 1913: according to your preference. If you do not have a
! 1914: license for the MIPSpro compiler suite, you can
! 1915: download a gcc tardist file from <a href=
! 1916: "http://freeware.sgi.com/" target=
! 1917: "_top">http://freeware.sgi.com/</a>.</p>
! 1918:
! 1919: <p>Please note that you will need IRIX 6.5.17 or
! 1920: higher, as this is the earliest version of IRIX
! 1921: providing support for if_indextoname(3),
! 1922: if_nametoindex(3), etc.</p>
! 1923:
! 1924: <p>At this point in time, pkgsrc only supports one ABI.
! 1925: That is, you can not switch between the old 32-bit ABI,
! 1926: the new 32-bit ABI and the 64-bit ABI. If you start out
! 1927: using "abi=n32", that's what all your packages will be
! 1928: built with.</p>
! 1929:
! 1930: <p>Therefore, please make sure that you have no
! 1931: conflicting <tt class="varname">CFLAGS</tt> in your
! 1932: environment or the <tt class=
! 1933: "filename">/etc/mk.conf</tt>. Particularly, make sure
! 1934: that you do not try to link n32 object files with lib64
! 1935: or vice versa. Check your <tt class=
! 1936: "filename">/etc/compiler.defaults</tt>!</p>
! 1937:
! 1938: <p>If you have the actual pkgsrc tree mounted via NFS
! 1939: from a different host, please make sure to set
! 1940: <tt class="varname">WRKOBJDIR</tt> to a local
! 1941: directory, as it appears that IRIX linker occasionally
! 1942: runs into issues when trying to link over a network
! 1943: mounted filesystem.</p>
! 1944:
! 1945: <p>The bootstrapping process should set all the right
! 1946: options for programs such as imake(1), but you may want
! 1947: to set some options depending on your local setup.
! 1948: Please see <tt class=
! 1949: "filename">pkgsrc/mk/bsd.pkg.defaults.mk</tt> and, of
! 1950: course, your compilers man pages for details.</p>
! 1951: </div>
! 1952:
! 1953: <div class="sect2" lang="en" xml:lang="en">
! 1954: <div class="titlepage">
! 1955: <div>
! 1956: <div>
! 1957: <h3 class="title"><a name="id2496605" id=
! 1958: "id2496605"></a>3.2.5. OpenBSD</h3>
! 1959: </div>
! 1960: </div>
! 1961: </div>
! 1962:
! 1963: <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
! 1964:
! 1965: <p>Care should be taken so that the tools that this kit
! 1966: installs do not conflict with the OpenBSD userland
! 1967: tools. There are several steps:</p>
! 1968:
! 1969: <div class="orderedlist">
! 1970: <ol type="1">
! 1971: <li>
! 1972: <p>OpenBSD stores its ports pkg database in
! 1973: <tt class="filename">/var/db/pkg</tt>. It is
! 1974: therefore recommended that you choose a different
! 1975: location (e.g. <tt class=
! 1976: "filename">/usr/pkgdb</tt>) by using the
! 1977: --pkgdbdir option to the bootstrap script.</p>
! 1978: </li>
! 1979:
! 1980: <li>
! 1981: <p>If you do not intend to use the OpenBSD ports
! 1982: tools, it's probably a good idea to move them out
! 1983: of the way to avoid confusion, e.g.</p>
! 1984: <pre class="screen">
! 1985: <tt class="prompt">#</tt> <b class=
! 1986: "userinput"><tt>cd /usr/sbin</tt></b>
! 1987: <tt class="prompt">#</tt> <b class=
! 1988: "userinput"><tt>mv pkg_add pkg_add.orig</tt></b>
! 1989: <tt class="prompt">#</tt> <b class=
! 1990: "userinput"><tt>mv pkg_create pkg_create.orig</tt></b>
! 1991: <tt class="prompt">#</tt> <b class=
! 1992: "userinput"><tt>mv pkg_delete pkg_delete.orig</tt></b>
! 1993: <tt class="prompt">#</tt> <b class=
! 1994: "userinput"><tt>mv pkg_info pkg_info.orig</tt></b>
! 1995: </pre>
! 1996: </li>
! 1997:
! 1998: <li>
! 1999: <p>An example <tt class=
! 2000: "filename">/etc/mk.conf</tt> file will be placed
! 2001: in <tt class="filename">/etc/mk.conf.example</tt>
! 2002: file when you use the bootstrap script. OpenBSD's
! 2003: make program uses <tt class=
! 2004: "filename">/etc/mk.conf</tt> as well. You can
! 2005: work around this by enclosing all the pkgsrc
! 2006: specific parts of the file with:</p>
! 2007: <pre class="programlisting">
! 2008: .ifdef BSD_PKG_MK
! 2009: # pkgsrc stuff, e.g. insert bsd.pkg.defaults.mk or similar here
! 2010: .else
! 2011: # OpenBSD stuff
! 2012: .endif
! 2013: </pre>
! 2014: </li>
! 2015: </ol>
! 2016: </div>
! 2017: </div>
! 2018:
! 2019: <div class="sect2" lang="en" xml:lang="en">
! 2020: <div class="titlepage">
! 2021: <div>
! 2022: <div>
! 2023: <h3 class="title"><a name="id2496786" id=
! 2024: "id2496786"></a>3.2.6. Solaris</h3>
! 2025: </div>
! 2026: </div>
! 2027: </div>
! 2028:
! 2029: <p>Solaris 2.6 through 9 are supported on both x86 and
! 2030: sparc. You will need a working C compiler. Both gcc
! 2031: 2.95.3 and Sun WorkShop 5 have been tested.</p>
! 2032:
! 2033: <p>The following packages are required on Solaris 8 for
! 2034: the bootstrap process and to build packages.</p>
! 2035:
! 2036: <div class="itemizedlist">
! 2037: <ul type="disc">
! 2038: <li>
! 2039: <p>SUNWsprot</p>
! 2040: </li>
! 2041:
! 2042: <li>
! 2043: <p>SUNWarc</p>
! 2044: </li>
! 2045:
! 2046: <li>
! 2047: <p>SUNWbtool</p>
! 2048: </li>
! 2049:
! 2050: <li>
! 2051: <p>SUNWtoo</p>
! 2052: </li>
! 2053:
! 2054: <li>
! 2055: <p>SUNWlibm</p>
! 2056: </li>
! 2057: </ul>
! 2058: </div>
! 2059:
! 2060: <p>Please note the use of GNU binutils on Solaris is
! 2061: <span class="emphasis"><em>not</em></span>
! 2062: supported.</p>
! 2063:
! 2064: <div class="sect3" lang="en" xml:lang="en">
! 2065: <div class="titlepage">
! 2066: <div>
! 2067: <div>
! 2068: <h4 class="title"><a name="id2496817" id=
! 2069: "id2496817"></a>3.2.6.1. If you are using
! 2070: gcc</h4>
! 2071: </div>
! 2072: </div>
! 2073: </div>
! 2074:
! 2075: <p>It makes life much simpler if you only use the
! 2076: same gcc consistently for building all packages.</p>
! 2077:
! 2078: <p>It is recommended that an external gcc be used
! 2079: only for bootstrapping, then either build gcc from
! 2080: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 2081: href=
! 2082: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
! 2083: class="pkgname">lang/gcc</a> or install a binary gcc
! 2084: package, then remove gcc used during
! 2085: bootstrapping.</p>
! 2086:
! 2087: <p>Binary packages of gcc can be found through
! 2088: <a href=
! 2089: "http://www.sun.com/bigadmin/common/freewareSearch.html"
! 2090: target=
! 2091: "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
! 2092: </div>
! 2093:
! 2094: <div class="sect3" lang="en" xml:lang="en">
! 2095: <div class="titlepage">
! 2096: <div>
! 2097: <div>
! 2098: <h4 class="title"><a name="id2496838" id=
! 2099: "id2496838"></a>3.2.6.2. If you are using
! 2100: Sun WorkShop</h4>
! 2101: </div>
! 2102: </div>
! 2103: </div>
! 2104:
! 2105: <p>You will need at least the following packages
! 2106: installed (from WorkShop 5.0)</p>
! 2107:
! 2108: <div class="itemizedlist">
! 2109: <ul type="disc">
! 2110: <li>
! 2111: <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
! 2112: </li>
! 2113:
! 2114: <li>
! 2115: <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
! 2116: </li>
! 2117:
! 2118: <li>
! 2119: <p>SPROild - Sun WorkShop Incremental
! 2120: Linker</p>
! 2121: </li>
! 2122:
! 2123: <li>
! 2124: <p>SPROlang - Sun WorkShop Compilers common
! 2125: components</p>
! 2126: </li>
! 2127: </ul>
! 2128: </div>
! 2129:
! 2130: <p>You should set <tt class="varname">CC</tt>,
! 2131: <tt class="varname">CXX</tt> and optionally,
! 2132: <tt class="varname">CPP</tt> in <tt class=
! 2133: "filename">/etc/mk.conf</tt>, eg.</p>
! 2134: <pre class="programlisting">
! 2135: CC= cc
! 2136: CXX= CC
! 2137: CPP= /usr/ccs/lib/cpp
! 2138: </pre>
! 2139:
! 2140: <p>You may also want to build 64-bit binaries,
! 2141: eg.</p>
! 2142: <pre class="programlisting">
! 2143: CFLAGS= -xtarget=ultra -xarch=v9
! 2144: </pre>
! 2145:
! 2146: <p>Whichever compiler you use, please ensure the
! 2147: compiler tools and your $prefix are in your
! 2148: <tt class="varname">PATH</tt>. This includes
! 2149: <tt class="filename">/usr/ccs/{bin,lib}</tt> and eg.
! 2150: <tt class="filename">/usr/pkg/{bin,sbin}</tt>.</p>
! 2151: </div>
! 2152: </div>
! 2153: </div>
! 2154: </div>
! 2155:
! 2156: <div class="chapter" lang="en" xml:lang="en">
! 2157: <div class="titlepage">
! 2158: <div>
! 2159: <div>
! 2160: <h2 class="title"><a name="using" id=
! 2161: "using"></a>Chapter 4. Using pkgsrc</h2>
! 2162: </div>
! 2163: </div>
! 2164: </div>
! 2165:
! 2166: <div class="toc">
! 2167: <p><b>Table of Contents</b></p>
! 2168:
! 2169: <dl>
! 2170: <dt><span class="sect1"><a href="#getting-started">4.1.
! 2171: Working with binary packages</a></span></dt>
! 2172:
! 2173: <dd>
! 2174: <dl>
! 2175: <dt><span class="sect2"><a href="#id2496922">4.1.1.
! 2176: Where to get binary packages</a></span></dt>
! 2177:
! 2178: <dt><span class="sect2"><a href="#id2496963">4.1.2.
! 2179: How to use binary packages</a></span></dt>
! 2180:
! 2181: <dt><span class="sect2"><a href="#id2497165">4.1.3.
! 2182: A word of warning</a></span></dt>
! 2183: </dl>
! 2184: </dd>
! 2185:
! 2186: <dt><span class="sect1"><a href="#id2497177">4.2.
! 2187: Building packages from source</a></span></dt>
! 2188:
! 2189: <dd>
! 2190: <dl>
! 2191: <dt><span class="sect2"><a href="#id2497187">4.2.1.
! 2192: Requirements</a></span></dt>
! 2193:
! 2194: <dt><span class="sect2"><a href="#id2497275">4.2.2.
! 2195: Fetching distfiles</a></span></dt>
! 2196:
! 2197: <dt><span class="sect2"><a href="#id2497328">4.2.3.
! 2198: How to build and install</a></span></dt>
! 2199:
! 2200: <dt><span class="sect2"><a href="#id2498259">4.2.4.
! 2201: Selecting the compiler</a></span></dt>
! 2202: </dl>
! 2203: </dd>
! 2204: </dl>
! 2205: </div>
! 2206:
! 2207: <div class="sect1" lang="en" xml:lang="en">
! 2208: <div class="titlepage">
! 2209: <div>
! 2210: <div>
! 2211: <h2 class="title" style="clear: both"><a name=
! 2212: "getting-started" id=
! 2213: "getting-started"></a>4.1. Working with binary
! 2214: packages</h2>
! 2215: </div>
! 2216: </div>
! 2217: </div>
! 2218:
! 2219: <p>This section describes how to find, retrieve and
! 2220: install a precompiled binary package that someone else
! 2221: already prepared for your type of machine.</p>
! 2222:
! 2223: <div class="sect2" lang="en" xml:lang="en">
! 2224: <div class="titlepage">
! 2225: <div>
! 2226: <div>
! 2227: <h3 class="title"><a name="id2496922" id=
! 2228: "id2496922"></a>4.1.1. Where to get binary
! 2229: packages</h3>
! 2230: </div>
! 2231: </div>
! 2232: </div>
! 2233:
! 2234: <p>Precompiled packages are stored on ftp.NetBSD.org
! 2235: and its mirrors in the directory <tt class=
! 2236: "filename">/pub/NetBSD/packages</tt> for anonymous FTP
! 2237: access. Please pick the right subdirectory there as
! 2238: indicated by <span><b class="command">uname
! 2239: -p</b></span>. In that directory, there is a
! 2240: subdirectory for each category plus a subdirectory
! 2241: <tt class="filename">All</tt> which includes the actual
! 2242: binaries in <tt class="filename">.tgz</tt> files. The
! 2243: category subdirectories use symbolic links to those
! 2244: files (this is the same directory layout as in
! 2245: <tt class="filename">/usr/pkgsrc/packages</tt>).</p>
! 2246:
! 2247: <p>This same directory layout applies for CDROM
! 2248: distributions, only that the directory may be rooted
! 2249: somewhere else, probably somewhere below <tt class=
! 2250: "filename">/cdrom</tt>. Please consult your CDROMs
! 2251: documentation for the exact location.</p>
! 2252: </div>
! 2253:
! 2254: <div class="sect2" lang="en" xml:lang="en">
! 2255: <div class="titlepage">
! 2256: <div>
! 2257: <div>
! 2258: <h3 class="title"><a name="id2496963" id=
! 2259: "id2496963"></a>4.1.2. How to use binary
! 2260: packages</h3>
! 2261: </div>
! 2262: </div>
! 2263: </div>
! 2264:
! 2265: <p>If you have the files on a CDROM or downloaded them
! 2266: to your hard disk, youcan install them with the
! 2267: following command (be sure to<span><b class=
! 2268: "command">su</b></span> to root first):</p>
! 2269: <pre class="screen">
! 2270: <tt class="prompt">#</tt> <b class=
! 2271: "userinput"><tt>pkg_add /path/to/package.tgz</tt></b>
! 2272: </pre>
! 2273:
! 2274: <p>If you have FTP access and you don't want to
! 2275: download the packages via FTP prior to installation,
! 2276: you can do this automatically by giving <span><b class=
! 2277: "command">pkg_add</b></span> an FTP URL:</p>
! 2278: <pre class="screen">
! 2279: <tt class="prompt">#</tt> <b class=
! 2280: "userinput"><tt>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/<OSvers>/<arch>/All/package.tgz</tt></b>
! 2281: </pre>
! 2282:
! 2283: <p>If there is any doubt, the uname utility can be used
! 2284: to determine the <OSvers>, and <arch> by
! 2285: running <span><b class="command">uname
! 2286: -rp</b></span>.</p>
! 2287:
! 2288: <p>Also note that any prerequisite packages needed to
! 2289: run the package in question will be installed, too,
! 2290: assuming they are present where you install from.</p>
! 2291:
! 2292: <p>After you've installed packages, be sure to have
! 2293: <tt class="filename">/usr/pkg/bin</tt> in your
! 2294: <tt class="varname">PATH</tt> so you can actually start
! 2295: the just installed program.</p>
! 2296: </div>
! 2297:
! 2298: <div class="sect2" lang="en" xml:lang="en">
! 2299: <div class="titlepage">
! 2300: <div>
! 2301: <div>
! 2302: <h3 class="title"><a name="id2497165" id=
! 2303: "id2497165"></a>4.1.3. A word of
! 2304: warning</h3>
! 2305: </div>
! 2306: </div>
! 2307: </div>
! 2308:
! 2309: <p>Please pay very careful attention to the warnings
! 2310: expressed in the <a href=
! 2311: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
! 2312: <span class="citerefentry"><span class=
! 2313: "refentrytitle">pkg_add</span>(1)</span></a> manual
! 2314: page about the inherent dangers of installing binary
! 2315: packages which you did not create yourself, and the
! 2316: security holes that can be introduced onto your system
! 2317: by indiscriminate adding of such files.</p>
! 2318: </div>
! 2319: </div>
! 2320:
! 2321: <div class="sect1" lang="en" xml:lang="en">
! 2322: <div class="titlepage">
! 2323: <div>
! 2324: <div>
! 2325: <h2 class="title" style="clear: both"><a name=
! 2326: "id2497177" id="id2497177"></a>4.2. Building
! 2327: packages from source</h2>
! 2328: </div>
! 2329: </div>
! 2330: </div>
! 2331:
! 2332: <p>This assumes that the package is already in pkgsrc. If
! 2333: it is not, see <a href="#developers-guide" title=
! 2334: "Part II. pkgsrc developer's guide">Part II,
! 2335: “pkgsrc developer's guide”</a>.</p>
! 2336:
! 2337: <div class="sect2" lang="en" xml:lang="en">
! 2338: <div class="titlepage">
! 2339: <div>
! 2340: <div>
! 2341: <h3 class="title"><a name="id2497187" id=
! 2342: "id2497187"></a>4.2.1. Requirements</h3>
! 2343: </div>
! 2344: </div>
! 2345: </div>
! 2346:
! 2347: <p>To build packages from source on a NetBSD system the
! 2348: “<span class="quote">comp</span>” and the
! 2349: “<span class="quote">text</span>”
! 2350: distribution sets must be installed. If you want to
! 2351: build X11 related packages the “<span class=
! 2352: "quote">xbase</span>” and “<span class=
! 2353: "quote">xcomp</span>” distribution sets are
! 2354: required, too.</p>
! 2355: </div>
! 2356:
! 2357: <div class="sect2" lang="en" xml:lang="en">
! 2358: <div class="titlepage">
! 2359: <div>
! 2360: <div>
! 2361: <h3 class="title"><a name="id2497275" id=
! 2362: "id2497275"></a>4.2.2. Fetching
! 2363: distfiles</h3>
! 2364: </div>
! 2365: </div>
! 2366: </div>
! 2367:
! 2368: <p>The distfile (i.e. the unmodified source) must exist
! 2369: on your system for the packages system to be able to
! 2370: build it. If it does not exist, pkgsrc will use
! 2371: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
! 2372: <span class="citerefentry"><span class=
! 2373: "refentrytitle">ftp</span>(1)</span></a> to fetch it
! 2374: automatically.</p>
! 2375:
! 2376: <p>You can overwrite some of the major distribution
! 2377: sites to fit to sites that are close to your own. Have
! 2378: a look at <tt class=
! 2379: "filename">pkgsrc/mk/bsd.pkg.defaults.mk</tt> to find
! 2380: some examples - in particular, look for the <tt class=
! 2381: "varname">MASTER_SORT</tt>, <tt class=
! 2382: "varname">MASTER_SORT_REGEX</tt> and <tt class=
! 2383: "varname">INET_COUNTRY</tt> definitions. This may save
! 2384: some of your bandwidth and time.</p>
! 2385:
! 2386: <p>You can change these settings either in your shell's
! 2387: environment, or, if you want to keep the settings, by
! 2388: editing the <tt class="filename">/etc/mk.conf</tt>
! 2389: file, and adding the definitions there.</p>
! 2390:
! 2391: <p>If you don't have a permanent Internet connection
! 2392: and you want to know which files to download,
! 2393: <span><b class="command">make fetch-list</b></span>
! 2394: will tell you what you'll need. Put these distfiles
! 2395: into <tt class=
! 2396: "filename">/usr/pkgsrc/distfiles</tt>.</p>
! 2397: </div>
! 2398:
! 2399: <div class="sect2" lang="en" xml:lang="en">
! 2400: <div class="titlepage">
! 2401: <div>
! 2402: <div>
! 2403: <h3 class="title"><a name="id2497328" id=
! 2404: "id2497328"></a>4.2.3. How to build and
! 2405: install</h3>
! 2406: </div>
! 2407: </div>
! 2408: </div>
! 2409:
! 2410: <p>Assuming that the distfile has been fetched (see
! 2411: previous section), become root and change into the
! 2412: relevant directory and running <span><b class=
! 2413: "command">make</b></span>. For example, type</p>
! 2414: <pre class="screen">
! 2415: <tt class="prompt">%</tt> <b class=
! 2416: "userinput"><tt>cd misc/figlet</tt></b>
! 2417: <tt class="prompt">%</tt> <b class="userinput"><tt>make</tt></b>
! 2418: </pre>
! 2419:
! 2420: <p>at the shell prompt to build the various components
! 2421: of the package, and</p>
! 2422: <pre class="screen">
! 2423: <tt class="prompt">#</tt> <b class=
! 2424: "userinput"><tt>make install</tt></b>
! 2425: </pre>
! 2426:
! 2427: <p>to install the various components into the correct
! 2428: places on your system. Installing the package on your
! 2429: system requires you to be root. However, pkgsrc has a
! 2430: <span class="emphasis"><em>just-in-time-su</em></span>
! 2431: feature, which allows you to only become root for the
! 2432: actual installation step</p>
! 2433:
! 2434: <p>Taking the figlet utility as an example, we can
! 2435: install it on our system by building as shown in
! 2436: <a href="#logs" title=
! 2437: "Appendix B. Build logs">Appendix B, <i>Build
! 2438: logs</i></a>.</p>
! 2439:
! 2440: <p>The program is installed under the default root of
! 2441: the packages tree - <tt class="filename">/usr/pkg</tt>.
! 2442: Should this not conform to your tastes, set the
! 2443: <tt class="varname">LOCALBASE</tt> variable in your
! 2444: environment, and it will use that value as the root of
! 2445: your packages tree. So, to use <tt class=
! 2446: "filename">/usr/local</tt>, set <tt class=
! 2447: "varname">LOCALBASE=/usr/local</tt> in your
! 2448: environment. Please note that you should use a
! 2449: directory which is dedicated to packages and not shared
! 2450: with other programs (ie, do not try and use <tt class=
! 2451: "varname">LOCALBASE=/usr</tt>). Also, you should not
! 2452: try to add any of your own files or directories (such
! 2453: as <tt class="filename">src/</tt>, <tt class=
! 2454: "filename">obj/</tt>, or <tt class=
! 2455: "filename">pkgsrc/</tt>) below the <tt class=
! 2456: "varname">LOCALBASE</tt> tree. This is to prevent
! 2457: possible conflicts between programs and other files
! 2458: installed by the package system and whatever else may
! 2459: have been installed there.</p>
! 2460:
! 2461: <p>Some packages look in <tt class=
! 2462: "filename">/etc/mk.conf</tt> to alter some
! 2463: configuration options at build time. Have a look at
! 2464: <tt class="filename">pkgsrc/mk/bsd.pkg.defaults.mk</tt>
! 2465: to get an overview of what will be set there by
! 2466: default. Environment variables such as <tt class=
! 2467: "varname">LOCALBASE</tt> can be set in <tt class=
! 2468: "filename">/etc/mk.conf</tt> to save having to remember
! 2469: to set them each time you want to use pkgsrc.</p>
! 2470:
! 2471: <p>Occasionally, people want to “<span class=
! 2472: "quote">look under the covers</span>” to see what
! 2473: is going on when a package is building or being
! 2474: installed. This may be for debugging purposes, or out
! 2475: of simple curiosity. A number of utility values have
! 2476: been added to help with this.</p>
! 2477:
! 2478: <div class="orderedlist">
! 2479: <ol type="1">
! 2480: <li>
! 2481: <p>If you invoke the <a href=
! 2482: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
! 2483: <span class="citerefentry"><span class=
! 2484: "refentrytitle">make</span>(1)</span></a> command
! 2485: with <tt class="varname">PKG_DEBUG_LEVEL=2</tt>,
! 2486: then a huge amount of information will be
! 2487: displayed. For example,</p>
! 2488: <pre class="screen">
! 2489: <b class="userinput"><tt>make patch PKG_DEBUG_LEVEL=2</tt></b>
! 2490: </pre>
! 2491:
! 2492: <p>will show all the commands that are invoked,
! 2493: up to and including the “<span class=
! 2494: "quote">patch</span>” stage.</p>
! 2495: </li>
! 2496:
! 2497: <li>
! 2498: <p>If you want to know the value of a certain
! 2499: make(1) definition, then the <tt class=
! 2500: "varname">VARNAME</tt> definition should be used,
! 2501: in conjunction with the show-var target. e.g. to
! 2502: show the expansion of the <a href=
! 2503: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
! 2504: <span class="citerefentry"><span class=
! 2505: "refentrytitle">make</span>(1)</span></a>
! 2506: variable <tt class="varname">DISTFILES</tt>:</p>
! 2507: <pre class="screen">
! 2508: <tt class="prompt">%</tt> <b class=
! 2509: "userinput"><tt>make show-var VARNAME=LOCALBASE</tt></b>
! 2510: /usr/pkg
! 2511: <tt class="prompt">%</tt>
! 2512:
! 2513: </pre>
! 2514: </li>
! 2515: </ol>
! 2516: </div>
! 2517:
! 2518: <p>If you want to install a binary package that you've
! 2519: either created yourself (see next section), that you
! 2520: put into pkgsrc/packages manually or that is located on
! 2521: a remote FTP server, you can use the the "bin-install"
! 2522: target. This target will install a binary package - if
! 2523: available - via <a href=
! 2524: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
! 2525: <span class="citerefentry"><span class=
! 2526: "refentrytitle">pkg_add</span>(1)</span></a>, else do a
! 2527: <span><b class="command">make package</b></span>. The
! 2528: list of remote FTP sites searched is kept in the
! 2529: variable <tt class="varname">BINPKG_SITE</tt>, which
! 2530: defaults to ftp.NetBSD.org. Any flags that should be
! 2531: added to <a href=
! 2532: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
! 2533: <span class="citerefentry"><span class=
! 2534: "refentrytitle">pkg_add</span>(1)</span></a> can be put
! 2535: into <tt class="varname">BIN_INSTALL_FLAGS</tt>. See
! 2536: <tt class="filename">pkgsrc/mk/bsd.pkg.defaults.mk</tt>
! 2537: for more details.</p>
! 2538:
! 2539: <p>A final word of warning: If you setup a system that
! 2540: has a non-standard setting for <tt class=
! 2541: "varname">LOCALBASE</tt>, be sure to set that before
! 2542: any packages are installed, as you can not use several
! 2543: directories for the same purpose. Doing so will result
! 2544: in pkgsrc not being able to properly detect your
! 2545: installed packages, and fail miserably. Note also that
! 2546: precompiled binary packages are usually built with the
! 2547: default <tt class="varname">LOCALBASE</tt> of
! 2548: <tt class="filename">/usr/pkg</tt>, and that you should
! 2549: <span class="emphasis"><em>not</em></span> install any
! 2550: if you use a non-standard <tt class=
! 2551: "varname">LOCALBASE</tt>.</p>
! 2552: </div>
! 2553:
! 2554: <div class="sect2" lang="en" xml:lang="en">
! 2555: <div class="titlepage">
! 2556: <div>
! 2557: <div>
! 2558: <h3 class="title"><a name="id2498259" id=
! 2559: "id2498259"></a>4.2.4. Selecting the
! 2560: compiler</h3>
! 2561: </div>
! 2562: </div>
! 2563: </div>
! 2564:
! 2565: <p>By default, pkgsrc will use GCC to build packages.
! 2566: This may be overridden by setting the following
! 2567: variables in /etc/mk.conf:</p>
! 2568:
! 2569: <div class="variablelist">
! 2570: <dl>
! 2571: <dt><span class="term"><tt class=
! 2572: "varname">PKGSRC_COMPILER</tt>:</span></dt>
! 2573:
! 2574: <dd>
! 2575: <p>This is a list of values specifying the chain
! 2576: of compilers to invoke when building packages.
! 2577: Valid values are:</p>
! 2578:
! 2579: <div class="itemizedlist">
! 2580: <ul type="disc">
! 2581: <li>
! 2582: <p><tt class="varname">distcc</tt>:
! 2583: distributed C/C++ (chainable)</p>
! 2584: </li>
! 2585:
! 2586: <li>
! 2587: <p><tt class="varname">ccache</tt>:
! 2588: compiler cache (chainable)</p>
! 2589: </li>
! 2590:
! 2591: <li>
! 2592: <p><tt class="varname">gcc</tt>: GNU C/C++
! 2593: Compiler</p>
! 2594: </li>
! 2595:
! 2596: <li>
! 2597: <p><tt class="varname">mipspro</tt>:
! 2598: Silicon Graphics, Inc. MIPSpro
! 2599: (n32/n64)</p>
! 2600: </li>
! 2601:
! 2602: <li>
! 2603: <p><tt class="varname">mipspro</tt>:
! 2604: Silicon Graphics, Inc. MIPSpro (o32)</p>
! 2605: </li>
! 2606:
! 2607: <li>
! 2608: <p><tt class="varname">sunpro</tt>:
! 2609: Microsystems, Inc. WorkShip/Forte/Sun ONE
! 2610: Studio</p>
! 2611: </li>
! 2612: </ul>
! 2613: </div>
! 2614:
! 2615: <p>The default is “<span class=
! 2616: "quote"><tt class=
! 2617: "varname">gcc</tt></span>”. You can use
! 2618: <tt class="varname">ccache</tt> and/or <tt class=
! 2619: "varname">distcc</tt> with an appropriate
! 2620: <tt class="varname">PKGSRC_COMPILER</tt> setting,
! 2621: e.g. “<span class="quote"><tt class=
! 2622: "varname">ccache gcc</tt></span>”. This
! 2623: variable should always be terminated with a value
! 2624: for a real compiler.</p>
! 2625: </dd>
! 2626:
! 2627: <dt><span class="term"><tt class=
! 2628: "varname">GCC_REQD</tt>:</span></dt>
! 2629:
! 2630: <dd>
! 2631: <p>This specifies the minimum version of GCC to
! 2632: use when building packages. If the system GCC
! 2633: doesn't satisfy this requirement, then pkgsrc
! 2634: will build and install one of the GCC packages to
! 2635: use instead.</p>
! 2636: </dd>
! 2637: </dl>
! 2638: </div>
! 2639: </div>
! 2640: </div>
! 2641: </div>
! 2642:
! 2643: <div class="chapter" lang="en" xml:lang="en">
! 2644: <div class="titlepage">
! 2645: <div>
! 2646: <div>
! 2647: <h2 class="title"><a name="binary" id=
! 2648: "binary"></a>Chapter 5. Creating binary
! 2649: packages</h2>
! 2650: </div>
! 2651: </div>
! 2652: </div>
! 2653:
! 2654: <div class="toc">
! 2655: <p><b>Table of Contents</b></p>
! 2656:
! 2657: <dl>
! 2658: <dt><span class="sect1"><a href="#id2498413">5.1.
! 2659: Building a single binary package</a></span></dt>
! 2660:
! 2661: <dt><span class="sect1"><a href="#id2563208">5.2.
! 2662: Settings for creation of binary
! 2663: packages</a></span></dt>
! 2664:
! 2665: <dt><span class="sect1"><a href="#bulkbuild">5.3. Doing
! 2666: a bulk build of all packages</a></span></dt>
! 2667:
! 2668: <dd>
! 2669: <dl>
! 2670: <dt><span class="sect2"><a href=
! 2671: "#binary.configuration">5.3.1.
! 2672: Configuration</a></span></dt>
! 2673:
! 2674: <dt><span class="sect2"><a href="#id2563348">5.3.2.
! 2675: Other environmental considerations</a></span></dt>
! 2676:
! 2677: <dt><span class="sect2"><a href="#id2563388">5.3.3.
! 2678: Operation</a></span></dt>
! 2679:
! 2680: <dt><span class="sect2"><a href="#id2563595">5.3.4.
! 2681: What it does</a></span></dt>
! 2682:
! 2683: <dt><span class="sect2"><a href="#id2563652">5.3.5.
! 2684: Disk space requirements</a></span></dt>
! 2685:
! 2686: <dt><span class="sect2"><a href="#id2563678">5.3.6.
! 2687: Setting up a sandbox for chroot'ed
! 2688: builds</a></span></dt>
! 2689:
! 2690: <dt><span class="sect2"><a href="#id2564042">5.3.7.
! 2691: Building a partial set of packages</a></span></dt>
! 2692: </dl>
! 2693: </dd>
! 2694:
! 2695: <dt><span class="sect1"><a href="#id2564085">5.4.
! 2696: Creating a multiple CD-ROM packages
! 2697: collection</a></span></dt>
! 2698:
! 2699: <dd>
! 2700: <dl>
! 2701: <dt><span class="sect2"><a href="#id2564168">5.4.1.
! 2702: Example of cdpack</a></span></dt>
! 2703: </dl>
! 2704: </dd>
! 2705: </dl>
! 2706: </div>
! 2707:
! 2708: <div class="sect1" lang="en" xml:lang="en">
! 2709: <div class="titlepage">
! 2710: <div>
! 2711: <div>
! 2712: <h2 class="title" style="clear: both"><a name=
! 2713: "id2498413" id="id2498413"></a>5.1. Building a
! 2714: single binary package</h2>
! 2715: </div>
! 2716: </div>
! 2717: </div>
! 2718:
! 2719: <p>Once you have built and installed a package, you can
! 2720: create a <span class="emphasis"><em>binary
! 2721: package</em></span> which can be installed on another
! 2722: system with <a href=
! 2723: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
! 2724: <span class="citerefentry"><span class=
! 2725: "refentrytitle">pkg_add</span>(1)</span></a> This saves
! 2726: having to build the same package on a group of hosts and
! 2727: wasting CPU time. It also provides a simple means for
! 2728: others to install your package, should you distribute
! 2729: it.</p>
! 2730:
! 2731: <p>To create a binary package, change into the
! 2732: appropriate directory in pkgsrc, and run <span><b class=
! 2733: "command">make package</b></span>:</p>
! 2734: <pre class="screen">
! 2735: <tt class="prompt">#</tt> <b class=
! 2736: "userinput"><tt>cd misc/figlet</tt></b>
! 2737: <tt class="prompt">#</tt> <b class=
! 2738: "userinput"><tt>make package</tt></b>
! 2739: </pre>
! 2740:
! 2741: <p>This will build and install your package (if not
! 2742: already done), and then build a binary package from what
! 2743: was installed. You can then use the <span><b class=
! 2744: "command">pkg_*</b></span> tools to manipulate it. Binary
! 2745: packages are created by default in <tt class=
! 2746: "filename">/usr/pkgsrc/packages</tt>, in the form of a
! 2747: gzipped tar file. See <a href="#logs.package" title=
! 2748: "B.2. Packaging figlet">Section B.2,
! 2749: “Packaging figlet”</a> for a continuation of
! 2750: the above <a xmlns=
! 2751: "http://www.w3.org/TR/xhtml1/transitional" href=
! 2752: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
! 2753: class="pkgname">misc/figlet</a> example.</p>
! 2754:
! 2755: <p>See <a href="#submit" title=
! 2756: "Chapter 14. Submitting and Committing">Chapter
! 2757: 14, <i>Submitting and Committing</i></a> for information
! 2758: on how to submit such a binary package.</p>
! 2759: </div>
! 2760:
! 2761: <div class="sect1" lang="en" xml:lang="en">
! 2762: <div class="titlepage">
! 2763: <div>
! 2764: <div>
! 2765: <h2 class="title" style="clear: both"><a name=
! 2766: "id2563208" id="id2563208"></a>5.2. Settings
! 2767: for creation of binary packages</h2>
! 2768: </div>
! 2769: </div>
! 2770: </div>
! 2771:
! 2772: <p>See <a href="#build.helpful-targets" title=
! 2773: "11.3. Other helpful targets">Section 11.3,
! 2774: “Other helpful targets”</a>.</p>
! 2775: </div>
! 2776:
! 2777: <div class="sect1" lang="en" xml:lang="en">
! 2778: <div class="titlepage">
! 2779: <div>
! 2780: <div>
! 2781: <h2 class="title" style="clear: both"><a name=
! 2782: "bulkbuild" id="bulkbuild"></a>5.3. Doing a
! 2783: bulk build of all packages</h2>
! 2784: </div>
! 2785: </div>
! 2786: </div>
! 2787:
! 2788: <p>If you want to get a full set of precompiled binary
! 2789: packages, this section describes how to get them. Beware
! 2790: that the bulk build will remove all currently installed
! 2791: packages from your system! Having a FTP server configured
! 2792: either on the machine doing the bulk builds or on a
! 2793: nearby NFS server can help to make the packages available
! 2794: to everyone. See <a href=
! 2795: "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
! 2796: <span class="citerefentry"><span class=
! 2797: "refentrytitle">ftpd</span>(8)</span></a> for more
! 2798: information. If you use a remote NFS server's storage, be
! 2799: sure to not actually compile on NFS storage, as this
! 2800: slows things down a lot.</p>
! 2801:
! 2802: <div class="sect2" lang="en" xml:lang="en">
! 2803: <div class="titlepage">
! 2804: <div>
! 2805: <div>
! 2806: <h3 class="title"><a name="binary.configuration"
! 2807: id=
! 2808: "binary.configuration"></a>5.3.1. Configuration</h3>
! 2809: </div>
! 2810: </div>
! 2811: </div>
! 2812:
! 2813: <div class="sect3" lang="en" xml:lang="en">
! 2814: <div class="titlepage">
! 2815: <div>
! 2816: <div>
! 2817: <h4 class="title"><a name="binary.mk.conf" id=
! 2818: "binary.mk.conf"></a>5.3.1.1. /etc/mk.conf</h4>
! 2819: </div>
! 2820: </div>
! 2821: </div>
! 2822:
! 2823: <p>You may want to set things in <tt class=
! 2824: "filename">/etc/mk.conf</tt>. Look at <tt class=
! 2825: "filename">pkgsrc/mk/bsd.pkg.defaults.mk</tt> for
! 2826: details of the default settings. You will want to
! 2827: ensure that <tt class=
! 2828: "varname">ACCEPTABLE_LICENSES</tt> meet your local
! 2829: policy. As used in this example, <tt class=
! 2830: "varname">_ACCEPTABLE=yes</tt> accepts <span class=
! 2831: "emphasis"><em>all</em></span> licenses.</p>
! 2832: <pre class="programlisting">
! 2833: PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
! 2834: WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc
! 2835: BSDSRCDIR= /usr/src
! 2836: BSDXSRCDIR= /usr/xsrc # for x11/xservers
! 2837: OBJHOSTNAME?= yes # use work.`hostname`
! 2838: FAILOVER_FETCH= yes # insist on the correct checksum
! 2839: PKG_DEVELOPER?= yes
! 2840: _ACCEPTABLE= yes
! 2841: </pre>
! 2842: </div>
! 2843:
! 2844: <div class="sect3" lang="en" xml:lang="en">
! 2845: <div class="titlepage">
! 2846: <div>
! 2847: <div>
! 2848: <h4 class="title"><a name="id2563272" id=
! 2849: "id2563272"></a>5.3.1.2. <tt class=
! 2850: "filename">build.conf</tt></h4>
! 2851: </div>
! 2852: </div>
! 2853: </div>
! 2854:
! 2855: <p>In <tt class="filename">pkgsrc/mk/bulk</tt>, copy
! 2856: <tt class="filename">build.conf-example</tt> to
! 2857: <tt class="filename">build.conf</tt> and edit it,
! 2858: following the comments in that file. This is the
! 2859: config file that determines where log files are
! 2860: generated after the build, where to mail the build
! 2861: report to, where your pkgsrc tree is located and
! 2862: which user to <a href=
! 2863: "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
! 2864: <span class="citerefentry"><span class=
! 2865: "refentrytitle">su</span>(8)</span></a> to to do a
! 2866: <span><b class="command">cvs update</b></span>.</p>
! 2867: </div>
! 2868:
! 2869: <div class="sect3" lang="en" xml:lang="en">
! 2870: <div class="titlepage">
! 2871: <div>
! 2872: <div>
! 2873: <h4 class="title"><a name="id2563308" id=
! 2874: "id2563308"></a>5.3.1.3. <tt class=
! 2875: "filename">pre-build.local</tt></h4>
! 2876: </div>
! 2877: </div>
! 2878: </div>
! 2879:
! 2880: <p>It is possible to configure the bulk build to
! 2881: perform certain site specific tasks at the end of the
! 2882: pre-build stage. If the file <tt class=
! 2883: "filename">pre-build.local</tt> exists in <tt class=
! 2884: "filename">/usr/pkgsrc/mk/bulk</tt> it will be
! 2885: executed (as a sh(1) script) at the end of the usual
! 2886: pre-build stage. An example use of <tt class=
! 2887: "filename">pre-build.local</tt> is to have the
! 2888: line:</p>
! 2889: <pre class="screen">
! 2890: <tt class="prompt">#</tt> <b class=
! 2891: "userinput"><tt>echo "I do not have enough disk space to build this pig." \
! 2892: > pkgsrc/games/crafty-book-enormous/$BROKENF</tt></b>
! 2893: </pre>
! 2894:
! 2895: <p>to prevent the system from trying to build a
! 2896: particular package which requires nearly 3 GB of disk
! 2897: space.</p>
! 2898: </div>
! 2899: </div>
! 2900:
! 2901: <div class="sect2" lang="en" xml:lang="en">
! 2902: <div class="titlepage">
! 2903: <div>
! 2904: <div>
! 2905: <h3 class="title"><a name="id2563348" id=
! 2906: "id2563348"></a>5.3.2. Other environmental
! 2907: considerations</h3>
! 2908: </div>
! 2909: </div>
! 2910: </div>
! 2911:
! 2912: <p>As <tt class="filename">/usr/pkg</tt> will be
! 2913: completely deleted at the start of bulk builds, make
! 2914: sure your login shell is placed somewhere else. Either
! 2915: drop it into <tt class="filename">/usr/local/bin</tt>
! 2916: (and adjust your login shell in the passwd file), or
! 2917: (re-)install it via <a href=
! 2918: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
! 2919: <span class="citerefentry"><span class=
! 2920: "refentrytitle">pkg_add</span>(1)</span></a> from
! 2921: <tt class="filename">/etc/rc.local</tt>, so you can
! 2922: login after a reboot (remember that your current
! 2923: process won't die if the package is removed, you just
! 2924: can't start any new instances of the shell any more).
! 2925: Also, if you use NetBSD earlier than 1.5, or you still
! 2926: want to use the pkgsrc version of ssh for some reason,
! 2927: be sure to install ssh before starting it from
! 2928: <tt class="filename">rc.local</tt>:</p>
! 2929: <pre class="programlisting">
! 2930: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
! 2931: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
! 2932: /usr/pkg/etc/rc.d/sshd
! 2933: fi
! 2934: </pre>
! 2935:
! 2936: <p>Not doing so will result in you being not able to
! 2937: log in via ssh after the bulk build is finished or if
! 2938: the machine gets rebooted or crashes. You have been
! 2939: warned! :)</p>
! 2940: </div>
! 2941:
! 2942: <div class="sect2" lang="en" xml:lang="en">
! 2943: <div class="titlepage">
! 2944: <div>
! 2945: <div>
! 2946: <h3 class="title"><a name="id2563388" id=
! 2947: "id2563388"></a>5.3.3. Operation</h3>
! 2948: </div>
! 2949: </div>
! 2950: </div>
! 2951:
! 2952: <p>Make sure you don't need any of the packages still
! 2953: installed.</p>
! 2954:
! 2955: <div class="warning" style=
! 2956: "margin-left: 0.5in; margin-right: 0.5in;">
! 2957: <h3 class="title">Warning</h3>
! 2958:
! 2959: <p>During the bulk build, <span class=
! 2960: "emphasis"><em>all packages will be
! 2961: removed!</em></span></p>
! 2962: </div>
! 2963:
! 2964: <p>Be sure to remove all other things that might
! 2965: interfere with builds, like some libs installed in
! 2966: <tt class="filename">/usr/local</tt>, etc. then become
! 2967: root and type:</p>
! 2968: <pre class="screen">
! 2969: <tt class="prompt">#</tt> <b class=
! 2970: "userinput"><tt>cd /usr/pkgsrc</tt></b>
! 2971: <tt class="prompt">#</tt> <b class=
! 2972: "userinput"><tt>sh mk/bulk/build</tt></b>
! 2973: </pre>
! 2974:
! 2975: <p>If for some reason your last build didn't complete
! 2976: (power failure, system panic, ...), you can continue it
! 2977: by running:</p>
! 2978: <pre class="screen">
! 2979: <tt class="prompt">#</tt> <b class=
! 2980: "userinput"><tt>sh mk/bulk/build restart</tt></b>
! 2981: </pre>
! 2982:
! 2983: <p>At the end of the bulk build, you will get a summary
! 2984: via mail, and find build logs in the directory
! 2985: specified by <tt class="varname">FTP</tt> in the
! 2986: <tt class="filename">build.conf</tt> file.</p>
! 2987: </div>
! 2988:
! 2989: <div class="sect2" lang="en" xml:lang="en">
! 2990: <div class="titlepage">
! 2991: <div>
! 2992: <div>
! 2993: <h3 class="title"><a name="id2563595" id=
! 2994: "id2563595"></a>5.3.4. What it does</h3>
! 2995: </div>
! 2996: </div>
! 2997: </div>
! 2998:
! 2999: <p>The bulk builds consist of three steps:</p>
! 3000:
! 3001: <div class="variablelist">
! 3002: <dl>
! 3003: <dt><span class="term">1. pre-build</span></dt>
! 3004:
! 3005: <dd>
! 3006: <p>The script updates your pkgsrc tree via
! 3007: (anon)cvs, then cleans out any broken distfiles,
! 3008: and removes all packages installed.</p>
! 3009: </dd>
! 3010:
! 3011: <dt><span class="term">2. the bulk
! 3012: build</span></dt>
! 3013:
! 3014: <dd>
! 3015: <p>This is basically “<span class=
! 3016: "quote">make bulk-package</span>” with an
! 3017: optimised order in which packages will be built.
! 3018: Packages that don't require other packages will
! 3019: be built first, and packages with many
! 3020: dependencies will be built later.</p>
! 3021: </dd>
! 3022:
! 3023: <dt><span class="term">3. post-build</span></dt>
! 3024:
! 3025: <dd>
! 3026: <p>Generates a report that's placed in the
! 3027: directory specified in the <tt class=
! 3028: "filename">build.conf</tt> file named <tt class=
! 3029: "filename">broken.html</tt>, a short version of
! 3030: that report will also be mailed to the build's
! 3031: admin.</p>
! 3032: </dd>
! 3033: </dl>
! 3034: </div>
! 3035:
! 3036: <p>During the build, a list of broken packages will be
! 3037: compiled in <tt class=
! 3038: "filename">/usr/pkgsrc/.broken</tt> (or <tt class=
! 3039: "filename">.../.broken.${MACHINE}</tt> if <tt class=
! 3040: "varname">OBJMACHINE</tt> is set), individual build
! 3041: logs of broken builds can be found in the package's
! 3042: directory. These files are used by the bulk-targets to
! 3043: mark broken builds to not waste time trying to rebuild
! 3044: them, and they can be used to debug these broken
! 3045: package builds later.</p>
! 3046: </div>
! 3047:
! 3048: <div class="sect2" lang="en" xml:lang="en">
! 3049: <div class="titlepage">
! 3050: <div>
! 3051: <div>
! 3052: <h3 class="title"><a name="id2563652" id=
! 3053: "id2563652"></a>5.3.5. Disk space
! 3054: requirements</h3>
! 3055: </div>
! 3056: </div>
! 3057: </div>
! 3058:
! 3059: <p>Currently, roughly the following requirements are
! 3060: valid for NetBSD 2.0/i386:</p>
! 3061:
! 3062: <div class="itemizedlist">
! 3063: <ul type="disc">
! 3064: <li>
! 3065: <p>10 GB - distfiles (NFS ok)</p>
! 3066: </li>
! 3067:
! 3068: <li>
! 3069: <p>8 GB - full set of all binaries (NFS ok)</p>
! 3070: </li>
! 3071:
! 3072: <li>
! 3073: <p>5 GB - temp space for compiling (local disk
! 3074: recommended)</p>
! 3075: </li>
! 3076: </ul>
! 3077: </div>
! 3078:
! 3079: <p>Note that all pkgs will be de-installed as soon as
! 3080: they are turned into a binary package, and that sources
! 3081: are removed, so there is no excessively huge demand to
! 3082: disk space. Afterwards, if the package is needed again,
! 3083: it will be installed via <a href=
! 3084: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
! 3085: <span class="citerefentry"><span class=
! 3086: "refentrytitle">pkg_add</span>(1)</span></a> instead of
! 3087: building again, so there are no cycles wasted by
! 3088: recompiling.</p>
! 3089: </div>
! 3090:
! 3091: <div class="sect2" lang="en" xml:lang="en">
! 3092: <div class="titlepage">
! 3093: <div>
! 3094: <div>
! 3095: <h3 class="title"><a name="id2563678" id=
! 3096: "id2563678"></a>5.3.6. Setting up a sandbox
! 3097: for chroot'ed builds</h3>
! 3098: </div>
! 3099: </div>
! 3100: </div>
! 3101:
! 3102: <p>If you don't want all the pkgs nuked from a machine
! 3103: (rendering it useless for anything but pkg compiling),
! 3104: there is the possibility of doing the pkg bulk build
! 3105: inside a chroot environment.</p>
! 3106:
! 3107: <p>The first step to do so is setting up a chroot
! 3108: sandbox, e.g. <tt class="filename">/usr/sandbox</tt>.
! 3109: After extracting all the sets from a NetBSD
! 3110: installation or doing a <span><b class="command">make
! 3111: distribution DESTDIR=/usr/sandbox</b></span> in
! 3112: <tt class="filename">/usr/src/etc</tt>, be sure the
! 3113: following items are present and properly
! 3114: configured:</p>
! 3115:
! 3116: <div class="procedure">
! 3117: <ol type="1">
! 3118: <li>
! 3119: <p>Kernel</p>
! 3120: <pre class="screen">
! 3121: <tt class="prompt">#</tt> <b class=
! 3122: "userinput"><tt>cp /netbsd /usr/sandbox</tt></b>
! 3123: </pre>
! 3124: </li>
! 3125:
! 3126: <li>
! 3127: <p><tt class="filename">/dev/*</tt></p>
! 3128: <pre class="screen">
! 3129: <tt class="prompt">#</tt> <b class=
! 3130: "userinput"><tt>cd /usr/sandbox/dev ; sh MAKEDEV all</tt></b>
! 3131: </pre>
! 3132: </li>
! 3133:
! 3134: <li>
! 3135: <p><tt class="filename">/etc/resolv.conf</tt>
! 3136: (for <a xmlns=
! 3137: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3138: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
! 3139: class="pkgname">security/smtpd</a> and mail):</p>
! 3140: <pre class="screen">
! 3141: <tt class="prompt">#</tt> <b class=
! 3142: "userinput"><tt>cp /etc/resolv.conf /usr/sandbox/etc</tt></b>
! 3143: </pre>
! 3144: </li>
! 3145:
! 3146: <li>
! 3147: <p>Working(!) mail config (hostname,
! 3148: sendmail.cf):</p>
! 3149: <pre class="screen">
! 3150: <tt class="prompt">#</tt> <b class=
! 3151: "userinput"><tt>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</tt></b>
! 3152: </pre>
! 3153: </li>
! 3154:
! 3155: <li>
! 3156: <p><tt class="filename">/etc/localtime</tt> (for
! 3157: <a xmlns=
! 3158: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3159: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
! 3160: class="pkgname">security/smtpd</a>):</p>
! 3161: <pre class="screen">
! 3162: <tt class="prompt">#</tt> <b class=
! 3163: "userinput"><tt>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</tt></b>
! 3164: </pre>
! 3165: </li>
! 3166:
! 3167: <li>
! 3168: <p><tt class="filename">/usr/src</tt> (system
! 3169: sources, for <a xmlns=
! 3170: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3171: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
! 3172: class="pkgname">sysutils/aperture</a>, <a xmlns=
! 3173: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3174: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
! 3175: class="pkgname">net/ppp-mppe</a>):</p>
! 3176: <pre class="screen">
! 3177: <tt class="prompt">#</tt> <b class=
! 3178: "userinput"><tt>ln -s ../disk1/cvs .</tt></b>
! 3179: <tt class="prompt">#</tt> <b class=
! 3180: "userinput"><tt>ln -s cvs/src-1.6 src</tt></b>
! 3181: </pre>
! 3182: </li>
! 3183:
! 3184: <li>
! 3185: <p>Create <tt class="filename">/var/db/pkg</tt>
! 3186: (not part of default install):</p>
! 3187: <pre class="screen">
! 3188: <tt class="prompt">#</tt> <b class=
! 3189: "userinput"><tt>mkdir /usr/sandbox/var/db/pkg</tt></b>
! 3190: </pre>
! 3191: </li>
! 3192:
! 3193: <li>
! 3194: <p>Create <tt class="filename">/usr/pkg</tt> (not
! 3195: part of default install):</p>
! 3196: <pre class="screen">
! 3197: <tt class="prompt">#</tt> <b class=
! 3198: "userinput"><tt>mkdir /usr/sandbox/usr/pkg</tt></b>
! 3199: </pre>
! 3200: </li>
! 3201:
! 3202: <li>
! 3203: <p>Checkout pkgsrc via cvs into <tt class=
! 3204: "filename">/usr/sandbox/usr/pkgsrc</tt>:</p>
! 3205: <pre class="screen">
! 3206: <tt class="prompt">#</tt> <b class=
! 3207: "userinput"><tt>cd /usr/sandbox/usr</tt></b>
! 3208: <tt class="prompt">#</tt> <b class=
! 3209: "userinput"><tt>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</tt></b>
! 3210: </pre>
! 3211:
! 3212: <p>Do not mount/link this to the copy of your
! 3213: pkgsrc tree you do development in, as this will
! 3214: likely cause problems!</p>
! 3215: </li>
! 3216:
! 3217: <li>
! 3218: <p>Make <tt class=
! 3219: "filename">/usr/sandbox/usr/pkgsrc/packages</tt>
! 3220: and <tt class="filename">.../distfiles</tt> point
! 3221: somewhere appropriate. NFS- and/or nullfs-mounts
! 3222: may come in handy!</p>
! 3223: </li>
! 3224:
! 3225: <li>
! 3226: <p>Edit <tt class="filename">/etc/mk.conf</tt>,
! 3227: see <a href="#binary.mk.conf" title=
! 3228: "5.3.1.1. /etc/mk.conf">Section 5.3.1.1,
! 3229: “/etc/mk.conf”</a>.</p>
! 3230: </li>
! 3231:
! 3232: <li>
! 3233: <p>Adjust <tt class=
! 3234: "filename">mk/bulk/build.conf</tt> to suit your
! 3235: needs.</p>
! 3236: </li>
! 3237:
! 3238: <li>
! 3239: <p>If you have set <tt class=
! 3240: "varname">CVS_USER</tt> in <tt class=
! 3241: "filename">build.conf</tt>, make sure that
! 3242: account exists and can do a <span><b class=
! 3243: "command">cvs ${CVS_FLAGS} update</b></span>
! 3244: properly!</p>
! 3245: </li>
! 3246: </ol>
! 3247: </div>
! 3248:
! 3249: <p>When the chroot sandbox is setup, you can start the
! 3250: build with the following steps:</p>
! 3251: <pre class="screen">
! 3252: <tt class="prompt">#</tt> <b class=
! 3253: "userinput"><tt>cd /usr/sandbox/usr/pkgsrc</tt></b>
! 3254: <tt class="prompt">#</tt> <b class=
! 3255: "userinput"><tt>sh mk/bulk/do-sandbox-build</tt></b>
! 3256: </pre>
! 3257:
! 3258: <p>This will just jump inside the sandbox and start
! 3259: building. At the end of the build, mail will be sent
! 3260: with the results of the build. Created binary pkgs will
! 3261: be in <tt class=
! 3262: "filename">/usr/sandbox/usr/pkgsrc/packages</tt>
! 3263: (wherever that points/mounts to/from).</p>
! 3264: </div>
! 3265:
! 3266: <div class="sect2" lang="en" xml:lang="en">
! 3267: <div class="titlepage">
! 3268: <div>
! 3269: <div>
! 3270: <h3 class="title"><a name="id2564042" id=
! 3271: "id2564042"></a>5.3.7. Building a partial
! 3272: set of packages</h3>
! 3273: </div>
! 3274: </div>
! 3275: </div>
! 3276:
! 3277: <p>In addition to building a complete set of all
! 3278: packages in pkgsrc, the <tt class=
! 3279: "filename">pkgsrc/mk/bulk/build</tt> script may be used
! 3280: to build a subset of the packages contained in pkgsrc.
! 3281: By setting defining <tt class=
! 3282: "varname">SPECIFIC_PKGS</tt> in <tt class=
! 3283: "filename">/etc/mk.conf</tt>, the variables</p>
! 3284:
! 3285: <div class="itemizedlist">
! 3286: <ul type="disc">
! 3287: <li>
! 3288: <p>SITE_SPECIFIC_PKGS</p>
! 3289: </li>
! 3290:
! 3291: <li>
! 3292: <p>HOST_SPECIFIC_PKGS</p>
! 3293: </li>
! 3294:
! 3295: <li>
! 3296: <p>GROUP_SPECIFIC_PKGS</p>
! 3297: </li>
! 3298:
! 3299: <li>
! 3300: <p>USER_SPECIFIC_PKGS</p>
! 3301: </li>
! 3302: </ul>
! 3303: </div>
! 3304:
! 3305: <p>will define the set of packages which should be
! 3306: built. The bulk build code will also include any
! 3307: packages which are needed as dependencies for the
! 3308: explicitly listed packages.</p>
! 3309:
! 3310: <p>One use of this is to do a bulk build with
! 3311: <tt class="varname">SPECIFIC_PKGS</tt> in a chroot
! 3312: sandbox periodically to have a complete set of the
! 3313: binary packages needed for your site available without
! 3314: the overhead of building extra packages that are not
! 3315: needed.</p>
! 3316: </div>
! 3317: </div>
! 3318:
! 3319: <div class="sect1" lang="en" xml:lang="en">
! 3320: <div class="titlepage">
! 3321: <div>
! 3322: <div>
! 3323: <h2 class="title" style="clear: both"><a name=
! 3324: "id2564085" id="id2564085"></a>5.4. Creating a
! 3325: multiple CD-ROM packages collection</h2>
! 3326: </div>
! 3327: </div>
! 3328: </div>
! 3329:
! 3330: <p>After your pkgsrc bulk-build has completed, you may
! 3331: wish to create a CD-ROM set of the resulting binary
! 3332: packages to assist in installing packages on other
! 3333: machines. The <a xmlns=
! 3334: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3335: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
! 3336: class="pkgname">pkgtools/cdpack</a> package provides a
! 3337: simple tool for creating the ISO 9660 images.
! 3338: <span><b class="command">cdpack</b></span> arranges the
! 3339: packages on the CD-ROMs in a way that keeps all the
! 3340: dependencies for given package on the same CD as that
! 3341: package.</p>
! 3342:
! 3343: <div class="sect2" lang="en" xml:lang="en">
! 3344: <div class="titlepage">
! 3345: <div>
! 3346: <div>
! 3347: <h3 class="title"><a name="id2564168" id=
! 3348: "id2564168"></a>5.4.1. Example of
! 3349: cdpack</h3>
! 3350: </div>
! 3351: </div>
! 3352: </div>
! 3353:
! 3354: <p>Complete documentation for cdpack is found in the
! 3355: cdpack(1) manpage. The following short example assumes
! 3356: that the binary packages are left in <tt class=
! 3357: "filename">/usr/pkgsrc/packages/All</tt> and that
! 3358: sufficient disk space exists in <tt class=
! 3359: "filename">/u2</tt> to hold the ISO 9660 images.</p>
! 3360: <pre class="screen">
! 3361: <tt class="prompt">#</tt> <b class=
! 3362: "userinput"><tt>mkdir /u2/images</tt></b>
! 3363: <tt class="prompt">#</tt> <b class=
! 3364: "userinput"><tt>pkg_add /usr/pkgsrc/packages/All/cdpack</tt></b>
! 3365: <tt class="prompt">#</tt> <b class=
! 3366: "userinput"><tt>cdpack /usr/pkgsrc/packages/All /u2/images</tt></b>
! 3367: </pre>
! 3368:
! 3369: <p>If you wish to include a common set of files
! 3370: (<tt class="filename">COPYRIGHT</tt>, <tt class=
! 3371: "filename">README</tt>, etc.) on each CD in the
! 3372: collection, then you need to create a directory which
! 3373: contains these files. e.g.</p>
! 3374: <pre class="screen">
! 3375: <tt class="prompt">#</tt> <b class=
! 3376: "userinput"><tt>mkdir /tmp/common</tt></b>
! 3377: <tt class="prompt">#</tt> <b class=
! 3378: "userinput"><tt>echo "This is a README" > /tmp/common/README</tt></b>
! 3379: <tt class="prompt">#</tt> <b class=
! 3380: "userinput"><tt>echo "Another file" > /tmp/common/COPYING</tt></b>
! 3381: <tt class="prompt">#</tt> <b class=
! 3382: "userinput"><tt>mkdir /tmp/common/bin</tt></b>
! 3383: <tt class="prompt">#</tt> <b class=
! 3384: "userinput"><tt>echo "#!/bin/sh" > /tmp/common/bin/myscript</tt></b>
! 3385: <tt class="prompt">#</tt> <b class=
! 3386: "userinput"><tt>echo "echo Hello world" >> /tmp/common/bin/myscript</tt></b>
! 3387: <tt class="prompt">#</tt> <b class=
! 3388: "userinput"><tt>chmod 755 /tmp/common/bin/myscript</tt></b>
! 3389: </pre>
! 3390:
! 3391: <p>Now create the images:</p>
! 3392: <pre class="screen">
! 3393: <tt class="prompt">#</tt> <b class=
! 3394: "userinput"><tt>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</tt></b>
! 3395: </pre>
! 3396:
! 3397: <p>Each image will contain <tt class=
! 3398: "filename">README</tt>, <tt class=
! 3399: "filename">COPYING</tt>, and <tt class=
! 3400: "filename">bin/myscript</tt> in their root
! 3401: directories.</p>
! 3402: </div>
! 3403: </div>
! 3404: </div>
! 3405:
! 3406: <div class="chapter" lang="en" xml:lang="en">
! 3407: <div class="titlepage">
! 3408: <div>
! 3409: <div>
! 3410: <h2 class="title"><a name="faq" id=
! 3411: "faq"></a>Chapter 6. Frequently Asked
! 3412: Questions</h2>
! 3413: </div>
! 3414: </div>
! 3415: </div>
! 3416:
! 3417: <div class="toc">
! 3418: <p><b>Table of Contents</b></p>
! 3419:
! 3420: <dl>
! 3421: <dt><span class="sect1"><a href="#id2564359">6.1. Is
! 3422: there a mailing list for pkg-related
! 3423: discussion?</a></span></dt>
! 3424:
! 3425: <dt><span class="sect1"><a href="#id2564457">6.2.
! 3426: Where's the pkgviews documentation?</a></span></dt>
! 3427:
! 3428: <dt><span class="sect1"><a href="#id2564470">6.3.
! 3429: Utilities for package management
! 3430: (pkgtools)</a></span></dt>
! 3431:
! 3432: <dt><span class="sect1"><a href="#id2564695">6.4. How
! 3433: to use pkgsrc as non-root</a></span></dt>
! 3434:
! 3435: <dt><span class="sect1"><a href="#id2564707">6.5. How
! 3436: can I install/use XFree86 from pkgsrc?</a></span></dt>
! 3437:
! 3438: <dt><span class="sect1"><a href="#id2564803">6.6. How
! 3439: can I install/use X.org from pkgsrc?</a></span></dt>
! 3440:
! 3441: <dt><span class="sect1"><a href="#id2564830">6.7. How
! 3442: to fetch files from behind a firewall</a></span></dt>
! 3443:
! 3444: <dt><span class="sect1"><a href="#id2564844">6.8. How
! 3445: do I tell make fetch to do passive FTP?</a></span></dt>
! 3446:
! 3447: <dt><span class="sect1"><a href="#id2564896">6.9. How
! 3448: to fetch all distfiles at once</a></span></dt>
! 3449:
! 3450: <dt><span class="sect1"><a href="#id2565104">6.10. What
! 3451: does Don't know how to make /usr/share/tmac/tmac.andoc
! 3452: mean?</a></span></dt>
! 3453:
! 3454: <dt><span class="sect1"><a href="#id2565142">6.11. What
! 3455: does Could not find bsd.own.mk mean?</a></span></dt>
! 3456:
! 3457: <dt><span class="sect1"><a href="#id2565200">6.12.
! 3458: Using 'sudo' with pkgsrc</a></span></dt>
! 3459:
! 3460: <dt><span class="sect1"><a href="#faq.conf">6.13.
! 3461: Configuration files handling and
! 3462: placement</a></span></dt>
! 3463:
! 3464: <dt><span class="sect1"><a href="#audit-packages">6.14.
! 3465: Automated security checks</a></span></dt>
! 3466: </dl>
! 3467: </div>
! 3468:
! 3469: <p>This section contains hints, tips & tricks on
! 3470: special things in pkgsrc that we didn't find a better place
! 3471: for in the previous chapters, and it contains items for
! 3472: both pkgsrc users and developers.</p>
! 3473:
! 3474: <div class="sect1" lang="en" xml:lang="en">
! 3475: <div class="titlepage">
! 3476: <div>
! 3477: <div>
! 3478: <h2 class="title" style="clear: both"><a name=
! 3479: "id2564359" id="id2564359"></a>6.1. Is there a
! 3480: mailing list for pkg-related discussion?</h2>
! 3481: </div>
! 3482: </div>
! 3483: </div>
! 3484:
! 3485: <p>Yes, <tt class="email"><<a href=
! 3486: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></tt>
! 3487: is the list for discussing package related issues. To
! 3488: subscribe do:</p>
! 3489: <pre class="programlisting">
! 3490: <tt class=
! 3491: "prompt">%</tt> echo subscribe tech-pkg | mail majordomo@NetBSD.org
! 3492: </pre>
! 3493:
! 3494: <p>An archive of the list is available at <a href=
! 3495: "http://mail-index.NetBSD.org/tech-pkg/" target=
! 3496: "_top">http://mail-index.NetBSD.org/tech-pkg/</a>.</p>
! 3497: </div>
! 3498:
! 3499: <div class="sect1" lang="en" xml:lang="en">
! 3500: <div class="titlepage">
! 3501: <div>
! 3502: <div>
! 3503: <h2 class="title" style="clear: both"><a name=
! 3504: "id2564457" id="id2564457"></a>6.2. Where's
! 3505: the pkgviews documentation?</h2>
! 3506: </div>
! 3507: </div>
! 3508: </div>
! 3509:
! 3510: <p>Pkgviews is tightly integrated with buildlink. You can
! 3511: find a pkgviews User's guide in <tt class=
! 3512: "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</tt>.</p>
! 3513: </div>
! 3514:
! 3515: <div class="sect1" lang="en" xml:lang="en">
! 3516: <div class="titlepage">
! 3517: <div>
! 3518: <div>
! 3519: <h2 class="title" style="clear: both"><a name=
! 3520: "id2564470" id="id2564470"></a>6.3. Utilities
! 3521: for package management (pkgtools)</h2>
! 3522: </div>
! 3523: </div>
! 3524: </div>
! 3525:
! 3526: <p>The <tt class="filename">pkgsrc/pkgtools</tt>
! 3527: directory pkgtools contains a number of useful utilities
! 3528: for both users and developers of pkgsrc. This section
! 3529: attempts only to make the reader aware of the utilities
! 3530: and when they might be useful, and not to duplicate the
! 3531: documentation that comes with each package.</p>
! 3532:
! 3533: <p>Utilities used by pkgsrc (automatically installed when
! 3534: needed):</p>
! 3535:
! 3536: <div class="itemizedlist">
! 3537: <ul type="disc">
! 3538: <li>
! 3539: <p><a xmlns=
! 3540: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3541: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
! 3542: class="pkgname">pkgtools/x11-links</a>: symlinks
! 3543: for use by buildlink</p>
! 3544: </li>
! 3545: </ul>
! 3546: </div>
! 3547:
! 3548: <p>OS tool augmentation (automatically installed when
! 3549: needed):</p>
! 3550:
! 3551: <div class="itemizedlist">
! 3552: <ul type="disc">
! 3553: <li>
! 3554: <p><a xmlns=
! 3555: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3556: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
! 3557: class="pkgname">pkgtools/digest</a>: calculates
! 3558: SHA1 checksums (and other kinds)</p>
! 3559: </li>
! 3560:
! 3561: <li>
! 3562: <p><a xmlns=
! 3563: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3564: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
! 3565: class="pkgname">pkgtools/libnbcompat</a>: compat
! 3566: library for pkg tools</p>
! 3567: </li>
! 3568:
! 3569: <li>
! 3570: <p><a xmlns=
! 3571: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3572: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
! 3573: class="pkgname">pkgtools/mtree</a>: installed on
! 3574: non-BSD systems due to lack of native mtree</p>
! 3575: </li>
! 3576:
! 3577: <li>
! 3578: <p><a xmlns=
! 3579: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3580: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
! 3581: class="pkgname">pkgtools/pkg_install</a>:
! 3582: up-to-date replacement for /usr/sbin/pkg_install,
! 3583: or for use on operating systems where pkg_install
! 3584: is not present</p>
! 3585: </li>
! 3586: </ul>
! 3587: </div>
! 3588:
! 3589: <p>Utilities used by pkgsrc (not automatically
! 3590: installed):</p>
! 3591:
! 3592: <div class="itemizedlist">
! 3593: <ul type="disc">
! 3594: <li>
! 3595: <p><a xmlns=
! 3596: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3597: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
! 3598: class="pkgname">pkgtools/pkg_tarup</a>: create a
! 3599: binary package from an already-installed package.
! 3600: used by 'make replace' to save the old package</p>
! 3601: </li>
! 3602:
! 3603: <li>
! 3604: <p><a xmlns=
! 3605: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3606: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
! 3607: class="pkgname">pkgtools/xpkgwedge</a>: put X11
! 3608: packages someplace else (enabled by default)</p>
! 3609: </li>
! 3610: </ul>
! 3611: </div>
! 3612:
! 3613: <p>Utilities for keeping track of installed packages,
! 3614: being up to date, etc:</p>
! 3615:
! 3616: <div class="itemizedlist">
! 3617: <ul type="disc">
! 3618: <li>
! 3619: <p><a xmlns=
! 3620: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3621: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
! 3622: class="pkgname">pkgtools/pkg_chk</a>: installs
! 3623: pkg_chk, which reports on packages whose installed
! 3624: versions do not match the latest pkgsrc entries</p>
! 3625: </li>
! 3626:
! 3627: <li>
! 3628: <p><a xmlns=
! 3629: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3630: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
! 3631: class="pkgname">pkgtools/pkgdep</a>: makes
! 3632: dependency graphs of packages, to aid in choosing a
! 3633: strategy for updating</p>
! 3634: </li>
! 3635:
! 3636: <li>
! 3637: <p><a xmlns=
! 3638: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3639: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
! 3640: class="pkgname">pkgtools/pkgdepgraph</a>: make
! 3641: graph from above (uses graphviz)</p>
! 3642: </li>
! 3643:
! 3644: <li>
! 3645: <p><a xmlns=
! 3646: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3647: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
! 3648: class="pkgname">pkgtools/pkglint</a>: This provides
! 3649: two distinct abilities: check a pkgsrc entry for
! 3650: correctness (pkglint) check for and remove
! 3651: out-of-date distfiles and binary packages
! 3652: (lintpkgsrc)</p>
! 3653: </li>
! 3654:
! 3655: <li>
! 3656: <p><a xmlns=
! 3657: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3658: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
! 3659: class="pkgname">pkgtools/pkgsurvey</a>: report what
! 3660: packages you have installed</p>
! 3661: </li>
! 3662: </ul>
! 3663: </div>
! 3664:
! 3665: <p>Utilities for people maintaining or creating
! 3666: individual packages:</p>
! 3667:
! 3668: <div class="itemizedlist">
! 3669: <ul type="disc">
! 3670: <li>
! 3671: <p><a xmlns=
! 3672: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3673: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
! 3674: class="pkgname">pkgtools/pkgdiff</a>: automate
! 3675: making and maintaining patches for a package
! 3676: (includes pkgdiff, pkgvi, mkpatches, ...)</p>
! 3677: </li>
! 3678:
! 3679: <li>
! 3680: <p><a xmlns=
! 3681: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3682: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
! 3683: class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
! 3684: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3685: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
! 3686: class="pkgname">pkgtools/url2pkg</a>: aids in
! 3687: converting to pkgsrc</p>
! 3688: </li>
! 3689:
! 3690: <li>
! 3691: <p><a xmlns=
! 3692: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3693: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
! 3694: class="pkgname">pkgtools/gensolpkg</a>: convert
! 3695: pkgsrc to a Solaris package</p>
! 3696: </li>
! 3697: </ul>
! 3698: </div>
! 3699:
! 3700: <p>Utilities for people maintaining pkgsrc (or more
! 3701: obscure pkg utilities)</p>
! 3702:
! 3703: <div class="itemizedlist">
! 3704: <ul type="disc">
! 3705: <li>
! 3706: <p><a xmlns=
! 3707: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3708: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
! 3709: class="pkgname">pkgtools/pkgconflict</a>: find
! 3710: packages that conflict but aren't marked as
! 3711: such</p>
! 3712: </li>
! 3713:
! 3714: <li>
! 3715: <p><a xmlns=
! 3716: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3717: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
! 3718: class="pkgname">pkgtools/pkg_comp</a>: build
! 3719: packages in a chrooted area</p>
! 3720: </li>
! 3721:
! 3722: <li>
! 3723: <p><a xmlns=
! 3724: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3725: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
! 3726: class="pkgname">pkgtools/libkver</a>: spoof kernel
! 3727: version for chrooted cross builds</p>
! 3728: </li>
! 3729: </ul>
! 3730: </div>
! 3731: </div>
! 3732:
! 3733: <div class="sect1" lang="en" xml:lang="en">
! 3734: <div class="titlepage">
! 3735: <div>
! 3736: <div>
! 3737: <h2 class="title" style="clear: both"><a name=
! 3738: "id2564695" id="id2564695"></a>6.4. How to use
! 3739: pkgsrc as non-root</h2>
! 3740: </div>
! 3741: </div>
! 3742: </div>
! 3743:
! 3744: <p>If you want to use pkgsrc as non-root user, you can
! 3745: set some variables to make pkgsrc work under these
! 3746: conditions. Please see <a href=
! 3747: "http://mail-index.NetBSD.org/tech-pkg/2003/09/27/0023.html"
! 3748: target="_top">this message</a> for more details.</p>
! 3749: </div>
! 3750:
! 3751: <div class="sect1" lang="en" xml:lang="en">
! 3752: <div class="titlepage">
! 3753: <div>
! 3754: <div>
! 3755: <h2 class="title" style="clear: both"><a name=
! 3756: "id2564707" id="id2564707"></a>6.5. How can I
! 3757: install/use XFree86 from pkgsrc?</h2>
! 3758: </div>
! 3759: </div>
! 3760: </div>
! 3761:
! 3762: <p>If you want to use XFree86 from pkgsrc instead of your
! 3763: system's own X11 (<tt class="filename">/usr/X11R6</tt>,
! 3764: <tt class="filename">/usr/openwin</tt>, ...), you will
! 3765: have to add the following lines into <tt class=
! 3766: "filename">mk.conf</tt>:</p>
! 3767: <pre class="programlisting">
! 3768: X11_TYPE=XFree86
! 3769:
! 3770: </pre>
! 3771: </div>
! 3772:
! 3773: <div class="sect1" lang="en" xml:lang="en">
! 3774: <div class="titlepage">
! 3775: <div>
! 3776: <div>
! 3777: <h2 class="title" style="clear: both"><a name=
! 3778: "id2564803" id="id2564803"></a>6.6. How can I
! 3779: install/use X.org from pkgsrc?</h2>
! 3780: </div>
! 3781: </div>
! 3782: </div>
! 3783:
! 3784: <p>If you want to use X.org from pkgsrc instead of your
! 3785: system's own X11 (<tt class="filename">/usr/X11R6</tt>,
! 3786: <tt class="filename">/usr/openwin</tt>, ...) you will
! 3787: have to add the following lines into <tt class=
! 3788: "filename">mk.conf</tt>:</p>
! 3789: <pre class="programlisting">
! 3790: X11_TYPE=xorg
! 3791:
! 3792: </pre>
! 3793: </div>
! 3794:
! 3795: <div class="sect1" lang="en" xml:lang="en">
! 3796: <div class="titlepage">
! 3797: <div>
! 3798: <div>
! 3799: <h2 class="title" style="clear: both"><a name=
! 3800: "id2564830" id="id2564830"></a>6.7. How to
! 3801: fetch files from behind a firewall</h2>
! 3802: </div>
! 3803: </div>
! 3804: </div>
! 3805:
! 3806: <p>If you are sitting behind a firewall which does not
! 3807: allow direct connections to Internet hosts (i.e.
! 3808: non-NAT), you may specify the relevant proxy hosts. This
! 3809: is done using an environment variable in the form of a
! 3810: URL e.g. in Amdahl, the machine “<span class=
! 3811: "quote">orpheus.amdahl.com</span>” is one of the
! 3812: firewalls, and it uses port 80 as the proxy port number.
! 3813: So the proxy environment variables are:</p>
! 3814: <pre class="programlisting">
! 3815: ftp_proxy=ftp://orpheus.amdahl.com:80/
! 3816: http_proxy=http://orpheus.amdahl.com:80/
! 3817: </pre>
! 3818: </div>
! 3819:
! 3820: <div class="sect1" lang="en" xml:lang="en">
! 3821: <div class="titlepage">
! 3822: <div>
! 3823: <div>
! 3824: <h2 class="title" style="clear: both"><a name=
! 3825: "id2564844" id="id2564844"></a>6.8. How do I
! 3826: tell <span><b class="command">make fetch</b></span>
! 3827: to do passive FTP?</h2>
! 3828: </div>
! 3829: </div>
! 3830: </div>
! 3831:
! 3832: <p>This depends on which utility is used to retrieve
! 3833: distfiles. From <tt class="filename">bsd.pkg.mk</tt>,
! 3834: <tt class="varname">FETCH_CMD</tt> is assigned the first
! 3835: available command from the following list:</p>
! 3836: <pre class="programlisting">
! 3837: ${LOCALBASE}/bin/ftp
! 3838: /usr/bin/ftp
! 3839: </pre>
! 3840:
! 3841: <p>On a default NetBSD installation, this will be
! 3842: <tt class="filename">/usr/bin/ftp</tt>, which
! 3843: automatically tries passive connections first, and falls
! 3844: back to active connections if the server refuses to do
! 3845: passive. For the other tools, add the following to your
! 3846: <tt class="filename">/etc/mk.conf</tt> file: <tt class=
! 3847: "varname">PASSIVE_FETCH=1</tt>.</p>
! 3848:
! 3849: <p>Having that option present will prevent <tt class=
! 3850: "filename">/usr/bin/ftp</tt> from falling back to active
! 3851: transfers.</p>
! 3852: </div>
! 3853:
! 3854: <div class="sect1" lang="en" xml:lang="en">
! 3855: <div class="titlepage">
! 3856: <div>
! 3857: <div>
! 3858: <h2 class="title" style="clear: both"><a name=
! 3859: "id2564896" id="id2564896"></a>6.9. How to
! 3860: fetch all distfiles at once</h2>
! 3861: </div>
! 3862: </div>
! 3863: </div>
! 3864:
! 3865: <p>You would like to download all the distfiles in a
! 3866: single batch from work or university, where you can't run
! 3867: a <span><b class="command">make fetch</b></span>. There
! 3868: is an archive of distfiles on <a href=
! 3869: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
! 3870: target="_top">ftp.NetBSD.org</a>, but downloading the
! 3871: entire directory may not be appropriate.</p>
! 3872:
! 3873: <p>The answer here is to do a <span><b class=
! 3874: "command">make fetch-list</b></span> in <tt class=
! 3875: "filename">/usr/pkgsrc</tt> or one of it's
! 3876: subdirectories, carry the resulting list to your machine
! 3877: at work/school and use it there If you don't have a
! 3878: NetBSD-compatible ftp(1) (like lukemftp) at work, don't
! 3879: forget to set <tt class="varname">FETCH_CMD</tt> to
! 3880: something that fetches a URL:</p>
! 3881:
! 3882: <p>At home:</p>
! 3883: <pre class="screen">
! 3884: <tt class="prompt">%</tt> <b class=
! 3885: "userinput"><tt>cd /usr/pkgsrc</tt></b>
! 3886: <tt class="prompt">%</tt> <b class=
! 3887: "userinput"><tt>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</tt></b>
! 3888: <tt class="prompt">%</tt> <b class=
! 3889: "userinput"><tt>scp /tmp/fetch.sh work:/tmp</tt></b>
! 3890: </pre>
! 3891:
! 3892: <p>At work:</p>
! 3893: <pre class="screen">
! 3894: <tt class="prompt">%</tt> <b class=
! 3895: "userinput"><tt>sh /tmp/fetch.sh</tt></b>
! 3896: </pre>
! 3897:
! 3898: <p>then tar up <tt class="filename">/tmp/distfiles</tt>
! 3899: and take it home.</p>
! 3900:
! 3901: <p>If you have a machine running NetBSD, and you want to
! 3902: get <span class="emphasis"><em>all</em></span> distfiles
! 3903: (even ones that aren't for your machine architecture),
! 3904: you can do so by using the above-mentioned
! 3905: <span><b class="command">make fetch-list</b></span>
! 3906: approach, or fetch the distfiles directly by running:</p>
! 3907: <pre class="screen">
! 3908: <tt class="prompt">%</tt> <b class=
! 3909: "userinput"><tt>make mirror-distfiles</tt></b>
! 3910: </pre>
! 3911:
! 3912: <p>If you even decide to ignore <tt class=
! 3913: "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</tt>, then you can
! 3914: get everything by running:</p>
! 3915: <pre class="screen">
! 3916: <tt class="prompt">%</tt> <b class=
! 3917: "userinput"><tt>make fetch NO_SKIP=yes</tt></b>
! 3918: </pre>
! 3919: </div>
! 3920:
! 3921: <div class="sect1" lang="en" xml:lang="en">
! 3922: <div class="titlepage">
! 3923: <div>
! 3924: <div>
! 3925: <h2 class="title" style="clear: both"><a name=
! 3926: "id2565104" id="id2565104"></a>6.10. What does
! 3927: “<span class="quote">Don't know how to make
! 3928: /usr/share/tmac/tmac.andoc</span>” mean?</h2>
! 3929: </div>
! 3930: </div>
! 3931: </div>
! 3932:
! 3933: <p>When compiling the <a xmlns=
! 3934: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3935: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
! 3936: class="pkgname">pkgtools/pkg_install</a> package, you get
! 3937: the error from make that it doesn't know how to make
! 3938: <tt class="filename">/usr/share/tmac/tmac.andoc</tt>?
! 3939: This indicates that you don't have installed the
! 3940: “<span class="quote">text</span>” set on your
! 3941: machine (nroff, ...). It is recommended to do that to
! 3942: format manpages.</p>
! 3943:
! 3944: <p>In the case of the <a xmlns=
! 3945: "http://www.w3.org/TR/xhtml1/transitional" href=
! 3946: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
! 3947: class="pkgname">pkgtools/pkg_install</a> package, you can
! 3948: get away with setting <tt class="varname">NOMAN=YES</tt>
! 3949: either in the environment or in <tt class=
! 3950: "filename">/etc/mk.conf</tt>.</p>
! 3951: </div>
! 3952:
! 3953: <div class="sect1" lang="en" xml:lang="en">
! 3954: <div class="titlepage">
! 3955: <div>
! 3956: <div>
! 3957: <h2 class="title" style="clear: both"><a name=
! 3958: "id2565142" id="id2565142"></a>6.11. What does
! 3959: “<span class="quote">Could not find
! 3960: bsd.own.mk</span>” mean?</h2>
! 3961: </div>
! 3962: </div>
! 3963: </div>
! 3964:
! 3965: <p>You didn't install the compiler set, <tt class=
! 3966: "filename">comp.tgz</tt>, when you installed your NetBSD
! 3967: machine. Please get it and install it, by extracting it
! 3968: in <tt class="filename">/</tt>:</p>
! 3969: <pre class="screen">
! 3970: <tt class="prompt">#</tt> <b class="userinput"><tt>cd /</tt></b>
! 3971: <tt class="prompt">#</tt> <b class=
! 3972: "userinput"><tt>tar --unlink -zxvpf .../comp.tgz</tt></b>
! 3973: </pre>
! 3974:
! 3975: <p><tt class="filename">comp.tgz</tt> is part of every
! 3976: NetBSD release. Get the one that corresponds to your
! 3977: release (determine via <span><b class="command">uname
! 3978: -r</b></span>).</p>
! 3979: </div>
! 3980:
! 3981: <div class="sect1" lang="en" xml:lang="en">
! 3982: <div class="titlepage">
! 3983: <div>
! 3984: <div>
! 3985: <h2 class="title" style="clear: both"><a name=
! 3986: "id2565200" id="id2565200"></a>6.12. Using
! 3987: 'sudo' with pkgsrc</h2>
! 3988: </div>
! 3989: </div>
! 3990: </div>
! 3991:
! 3992: <p>When installing packages as non-root user and using
! 3993: the just-in-time su(1) feature of pkgsrc, it can become
! 3994: annoying to type in the root password for each required
! 3995: package installed. To avoid this, the sudo package can be
! 3996: used, which does password caching over a limited time. To
! 3997: use it, install sudo (either as binary package or from
! 3998: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
! 3999: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
! 4000: class="pkgname">security/sudo</a>) and then put the
! 4001: following into your <tt class=
! 4002: "filename">/etc/mk.conf</tt>:</p>
! 4003: <pre class="programlisting">
! 4004: .if exists(/usr/pkg/bin/sudo)
! 4005: SU_CMD=/usr/pkg/bin/sudo /bin/sh -c
! 4006: .endif
! 4007:
! 4008: </pre>
! 4009: </div>
! 4010:
! 4011: <div class="sect1" lang="en" xml:lang="en">
! 4012: <div class="titlepage">
! 4013: <div>
! 4014: <div>
! 4015: <h2 class="title" style="clear: both"><a name=
! 4016: "faq.conf" id=
! 4017: "faq.conf"></a>6.13. Configuration files
! 4018: handling and placement</h2>
! 4019: </div>
! 4020: </div>
! 4021: </div>
! 4022:
! 4023: <p>The global variable <tt class=
! 4024: "varname">PKG_SYSCONFBASE</tt> (and some others) can be
! 4025: set by the system administrator in <tt class=
! 4026: "filename">/etc/mk.conf</tt> to define the place where
! 4027: configuration files get installed. Therefore, packages
! 4028: must be adapted to support this feature. Keep in mind
! 4029: that you should only install files that are strictly
! 4030: necessary in the configuration directory, files that can
! 4031: go to <tt class="filename">$PREFIX/share</tt> should go
! 4032: there.</p>
! 4033:
! 4034: <p>We will take a look at available variables first
! 4035: (<tt class="filename">bsd.pkg.mk</tt> contains more
! 4036: information). <tt class="varname">PKG_SYSCONFDIR</tt> is
! 4037: where the configuration files for a package may be found
! 4038: (that is, the full path, e.g. <tt class=
! 4039: "filename">/etc</tt> or <tt class=
! 4040: "filename">/usr/pkg/etc</tt>). This value may be
! 4041: customized in various ways:</p>
! 4042:
! 4043: <div class="orderedlist">
! 4044: <ol type="1">
! 4045: <li>
! 4046: <p><tt class="varname">PKG_SYSCONFBASE</tt> is the
! 4047: main config directory under which all package
! 4048: configuration files are to be found. Users will
! 4049: typically want to set it to <tt class=
! 4050: "filename">/etc</tt>, or accept the default
! 4051: location of <tt class=
! 4052: "filename">$PREFIX/etc</tt>.</p>
! 4053: </li>
! 4054:
! 4055: <li>
! 4056: <p><tt class="varname">PKG_SYSCONFSUBDIR</tt> is
! 4057: the subdirectory of <tt class=
! 4058: "varname">PKG_SYSCONFBASE</tt> under which the
! 4059: configuration files for a particular package may be
! 4060: found. Defaults to <tt class=
! 4061: "varname">${SYSCONFBASE}</tt>.</p>
! 4062: </li>
! 4063:
! 4064: <li>
! 4065: <p><tt class="varname">PKG_SYSCONFVAR</tt> is the
! 4066: special suffix used to distinguish any overriding
! 4067: values for a particular package (see next item). It
! 4068: defaults to <tt class="varname">${PKGBASE}</tt>,
! 4069: but for a collection of related packages that
! 4070: should all have the same <tt class=
! 4071: "varname">PKG_SYSCONFDIR</tt> value, it can be set
! 4072: in each of the package Makefiles to a common
! 4073: value.</p>
! 4074: </li>
! 4075:
! 4076: <li>
! 4077: <p><tt class=
! 4078: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</tt>
! 4079: overrides the value of <tt class=
! 4080: "varname">${PKG_SYSCONFDIR}</tt> for packages with
! 4081: the same value for <tt class=
! 4082: "varname">PKG_SYSCONFVAR</tt>.</p>
! 4083:
! 4084: <p>As an example, all the various KDE packages may
! 4085: want to set <tt class="varname">PKG_SYSCONFVAR</tt>
! 4086: to “<span class="quote">kde</span>” so
! 4087: admins can set <tt class=
! 4088: "varname">PKG_SYSCONFDIR.kde</tt> in <tt class=
! 4089: "filename">/etc/mk.conf</tt> to define where to
! 4090: install KDE config files.</p>
! 4091: </li>
! 4092: </ol>
! 4093: </div>
! 4094:
! 4095: <p>Programs' configuration directory should be defined
! 4096: during the configure stage. Packages that use GNU
! 4097: autoconf can usually do this by using the
! 4098: “<span class="quote">--sysconfdir</span>”
! 4099: parameter, but this brings some problems as we will see
! 4100: now. When you change this pathname in packages, you
! 4101: should not allow them to install files in that directory
! 4102: directly. Instead they need to install those files under
! 4103: <tt class="filename">share/examples/${PKGNAME}</tt> so
! 4104: <tt class="filename">PLIST</tt> can register them.</p>
! 4105:
! 4106: <p>Once you have the required configuration files in
! 4107: place (under the <tt class="filename">share/examples</tt>
! 4108: directory) the variable <tt class=
! 4109: "varname">CONF_FILES</tt> should be set to copy them into
! 4110: <tt class="varname">PKG_SYSCONFDIR</tt>. The contents of
! 4111: this variable is formed by pairs of filenames; the first
! 4112: element of the pair specifies the file inside the
! 4113: examples directory (registered by <tt class=
! 4114: "filename">PLIST</tt>) and the second element specifies
! 4115: the target file. This is done this way to allow binary
! 4116: packages to place files in the right directory using
! 4117: <tt class="filename">INSTALL</tt>/<tt class=
! 4118: "filename">DEINSTALL</tt> scripts which are created
! 4119: automatically. The package <tt class=
! 4120: "filename">Makefile</tt> must also set <tt class=
! 4121: "varname">USE_PKGINSTALL=YES</tt> to use these
! 4122: automatically generated scripts. The automatic copying of
! 4123: config files can be toggled by setting the environment
! 4124: variable <tt class="varname">PKG_CONFIG</tt> prior to
! 4125: package installation.</p>
! 4126:
! 4127: <p>Here is an example, taken from mail/mutt/Makefile:</p>
! 4128: <pre class="programlisting">
! 4129: EGDIR= ${PREFIX}/share/doc/mutt/samples
! 4130: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
! 4131: </pre>
! 4132:
! 4133: <p>As you can see, this package installs configuration
! 4134: files inside <tt class="varname">EGDIR</tt>, which are
! 4135: registered by <tt class="filename">PLIST</tt>. After
! 4136: that, the variable <tt class="varname">CONF_FILES</tt>
! 4137: lists the installed file first and then the target file.
! 4138: Users will also get an automatic message when files are
! 4139: installed using this method.</p>
! 4140: </div>
! 4141:
! 4142: <div class="sect1" lang="en" xml:lang="en">
! 4143: <div class="titlepage">
! 4144: <div>
! 4145: <div>
! 4146: <h2 class="title" style="clear: both"><a name=
! 4147: "audit-packages" id=
! 4148: "audit-packages"></a>6.14. Automated security
! 4149: checks</h2>
! 4150: </div>
! 4151: </div>
! 4152: </div>
! 4153:
! 4154: <p>Please be aware that there can often be bugs in
! 4155: third-party software, and some of these bugs can leave a
! 4156: machine vulnerable to exploitation by attackers. In an
! 4157: effort to lessen the exposure, the NetBSD packages team
! 4158: maintains a database of known-exploits to packages which
! 4159: have at one time been included in pkgsrc. The database
! 4160: can be downloaded automatically, and a security audit of
! 4161: all packages installed on a system can take place. To do
! 4162: this, install the <a xmlns=
! 4163: "http://www.w3.org/TR/xhtml1/transitional" href=
! 4164: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
! 4165: class="pkgname">security/audit-packages</a> package. It
! 4166: has two components:</p>
! 4167:
! 4168: <div class="orderedlist">
! 4169: <ol type="1">
! 4170: <li>
! 4171: <p>“<span class=
! 4172: "quote">download-vulnerability-list</span>”,
! 4173: an easy way to download a list of the security
! 4174: vulnerabilities information. This list is kept up
! 4175: to date by the NetBSD security officer and the
! 4176: NetBSD packages team, and is distributed from the
! 4177: NetBSD ftp server:</p>
! 4178:
! 4179: <p><a href=
! 4180: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
! 4181: target=
! 4182: "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
! 4183: </li>
! 4184:
! 4185: <li>
! 4186: <p>“<span class=
! 4187: "quote">audit-packages</span>”, an easy way
! 4188: to audit the current machine, checking each
! 4189: vulnerability which is known. If a vulnerable
! 4190: package is installed, it will be shown by output to
! 4191: stdout, including a description of the type of
! 4192: vulnerability, and a URL containing more
! 4193: information.</p>
! 4194: </li>
! 4195: </ol>
! 4196: </div>
! 4197:
! 4198: <p>Use of the audit-packages package is strongly
! 4199: recommended!</p>
! 4200:
! 4201: <p>The following message is displayed as part of the
! 4202: audit-packages installation procedure:</p>
! 4203: <pre class="screen">
! 4204: ===========================================================================
! 4205: $NetBSD: faq.xml,v 1.1.1.1 2004/10/21 14:27:43 grant Exp $
! 4206:
! 4207: You may wish to have the vulnerabilities file downloaded daily so that
! 4208: it remains current. This may be done by adding an appropriate entry
! 4209: to the root users crontab(5) entry. For example the entry
! 4210:
! 4211: # download vulnerabilities file
! 4212: 0 3 * * * ${PREFIX}/sbin/download-vulnerability-list >/dev/null 2>&1
! 4213:
! 4214: will update the vulnerability list every day at 3AM. You may wish to do
! 4215: this more often than once a day.
! 4216:
! 4217: In addition, you may wish to run the package audit from the daily
! 4218: security script. This may be accomplished by adding the following
! 4219: lines to /etc/security.local
! 4220:
! 4221: if [ -x ${PREFIX}/sbin/audit-packages ]; then
! 4222: ${PREFIX}/sbin/audit-packages
! 4223: fi
! 4224:
! 4225: ===========================================================================
! 4226:
! 4227: </pre>
! 4228: </div>
! 4229: </div>
! 4230: </div>
! 4231:
! 4232: <div class="part" lang="en" xml:lang="en">
! 4233: <div class="titlepage">
! 4234: <div>
! 4235: <div>
! 4236: <h1 class="title"><a name="developers-guide" id=
! 4237: "developers-guide"></a>pkgsrc developer's guide</h1>
! 4238: </div>
! 4239: </div>
! 4240: </div>
! 4241:
! 4242: <div class="toc">
! 4243: <p><b>Table of Contents</b></p>
! 4244:
! 4245: <dl>
! 4246: <dt><span class="chapter"><a href="#components">7.
! 4247: Package components - files, directories and
! 4248: contents</a></span></dt>
! 4249:
! 4250: <dd>
! 4251: <dl>
! 4252: <dt><span class="sect1"><a href=
! 4253: "#components.Makefile">7.1. Makefile</a></span></dt>
! 4254:
! 4255: <dt><span class="sect1"><a href=
! 4256: "#components.distinfo">7.2. distinfo</a></span></dt>
! 4257:
! 4258: <dt><span class="sect1"><a href=
! 4259: "#components.patches">7.3. patches/*</a></span></dt>
! 4260:
! 4261: <dt><span class="sect1"><a href="#id2566375">7.4.
! 4262: Other mandatory files</a></span></dt>
! 4263:
! 4264: <dt><span class="sect1"><a href=
! 4265: "#components.optional">7.5. Optional
! 4266: files</a></span></dt>
! 4267:
! 4268: <dt><span class="sect1"><a href="#id2566569">7.6.
! 4269: work*</a></span></dt>
! 4270:
! 4271: <dt><span class="sect1"><a href="#id2566657">7.7.
! 4272: files/*</a></span></dt>
! 4273: </dl>
! 4274: </dd>
! 4275:
! 4276: <dt><span class="chapter"><a href="#plist">8. PLIST
! 4277: issues</a></span></dt>
! 4278:
! 4279: <dd>
! 4280: <dl>
! 4281: <dt><span class="sect1"><a href="#id2566711">8.1. RCS
! 4282: ID</a></span></dt>
! 4283:
! 4284: <dt><span class="sect1"><a href="#id2566726">8.2.
! 4285: Semi-automatic PLIST generation</a></span></dt>
! 4286:
! 4287: <dt><span class="sect1"><a href="#print-PLIST">8.3.
! 4288: Tweaking output of make print-PLIST</a></span></dt>
! 4289:
! 4290: <dt><span class="sect1"><a href="#plist.misc">8.4.
! 4291: Variable substitution in PLIST</a></span></dt>
! 4292:
! 4293: <dt><span class="sect1"><a href="#id2567047">8.5.
! 4294: Manpage-compression</a></span></dt>
! 4295:
! 4296: <dt><span class="sect1"><a href="#id2567089">8.6.
! 4297: Changing PLIST source with PLIST_SRC</a></span></dt>
! 4298:
! 4299: <dt><span class="sect1"><a href="#id2567106">8.7.
! 4300: Platform specific and differing
! 4301: PLISTs</a></span></dt>
! 4302:
! 4303: <dt><span class="sect1"><a href=
! 4304: "#faq.common-dirs">8.8. Sharing directories between
! 4305: packages</a></span></dt>
! 4306: </dl>
! 4307: </dd>
! 4308:
! 4309: <dt><span class="chapter"><a href="#buildlink">9.
! 4310: Buildlink methodology</a></span></dt>
! 4311:
! 4312: <dd>
! 4313: <dl>
! 4314: <dt><span class="sect1"><a href="#id2567378">9.1.
! 4315: Converting packages to use buildlink3</a></span></dt>
! 4316:
! 4317: <dt><span class="sect1"><a href="#id2567637">9.2.
! 4318: Writing buildlink3.mk files</a></span></dt>
! 4319:
! 4320: <dd>
! 4321: <dl>
! 4322: <dt><span class="sect2"><a href=
! 4323: "#id2567774">9.2.1. Anatomy of a buildlink3.mk
! 4324: file</a></span></dt>
! 4325:
! 4326: <dt><span class="sect2"><a href=
! 4327: "#id2568283">9.2.2. Updating
! 4328: BUILDLINK_DEPENDS.pkg in buildlink3.mk
! 4329: files</a></span></dt>
! 4330: </dl>
! 4331: </dd>
! 4332:
! 4333: <dt><span class="sect1"><a href="#id2568362">9.3.
! 4334: Writing builtin.mk files</a></span></dt>
! 4335:
! 4336: <dd>
! 4337: <dl>
! 4338: <dt><span class="sect2"><a href=
! 4339: "#id2568512">9.3.1. Anatomy of a builtin.mk
! 4340: file</a></span></dt>
! 4341:
! 4342: <dt><span class="sect2"><a href=
! 4343: "#id2568739">9.3.2. Global preferences for native
! 4344: or pkgsrc software</a></span></dt>
! 4345: </dl>
! 4346: </dd>
! 4347: </dl>
! 4348: </dd>
! 4349:
! 4350: <dt><span class="chapter"><a href="#options">10. Options
! 4351: handling</a></span></dt>
! 4352:
! 4353: <dd>
! 4354: <dl>
! 4355: <dt><span class="sect1"><a href="#id2568811">10.1.
! 4356: Global default options</a></span></dt>
! 4357:
! 4358: <dt><span class="sect1"><a href="#id2568826">10.2.
! 4359: Converting packages to use
! 4360: bsd.options.mk</a></span></dt>
! 4361: </dl>
! 4362: </dd>
! 4363:
! 4364: <dt><span class="chapter"><a href="#build">11. The build
! 4365: process</a></span></dt>
! 4366:
! 4367: <dd>
! 4368: <dl>
! 4369: <dt><span class="sect1"><a href="#build.prefix">11.1.
! 4370: Program location</a></span></dt>
! 4371:
! 4372: <dt><span class="sect1"><a href="#id2569571">11.2.
! 4373: Main targets</a></span></dt>
! 4374:
! 4375: <dt><span class="sect1"><a href=
! 4376: "#build.helpful-targets">11.3. Other helpful
! 4377: targets</a></span></dt>
! 4378: </dl>
! 4379: </dd>
! 4380:
! 4381: <dt><span class="chapter"><a href="#fixes">12. Notes on
! 4382: fixes for packages</a></span></dt>
! 4383:
! 4384: <dd>
! 4385: <dl>
! 4386: <dt><span class="sect1"><a href="#id2570968">12.1.
! 4387: General operation</a></span></dt>
! 4388:
! 4389: <dd>
! 4390: <dl>
! 4391: <dt><span class="sect2"><a href=
! 4392: "#id2570971">12.1.1. How to pull in variables
! 4393: from /etc/mk.conf</a></span></dt>
! 4394:
! 4395: <dt><span class="sect2"><a href=
! 4396: "#id2571054">12.1.2. Restricted
! 4397: packages</a></span></dt>
! 4398:
! 4399: <dt><span class="sect2"><a href=
! 4400: "#dependencies">12.1.3. Handling
! 4401: dependencies</a></span></dt>
! 4402:
! 4403: <dt><span class="sect2"><a href=
! 4404: "#id2571501">12.1.4. Handling conflicts with
! 4405: other packages</a></span></dt>
! 4406:
! 4407: <dt><span class="sect2"><a href=
! 4408: "#id2571620">12.1.5. Packages that cannot or
! 4409: should not be built</a></span></dt>
! 4410:
! 4411: <dt><span class="sect2"><a href=
! 4412: "#id2571645">12.1.6. Packages which should not be
! 4413: deleted, once installed</a></span></dt>
! 4414:
! 4415: <dt><span class="sect2"><a href=
! 4416: "#security-handling">12.1.7. Handling packages
! 4417: with security problems</a></span></dt>
! 4418:
! 4419: <dt><span class="sect2"><a href=
! 4420: "#id2571737">12.1.8. How to handle compiler
! 4421: bugs</a></span></dt>
! 4422:
! 4423: <dt><span class="sect2"><a href=
! 4424: "#id2571760">12.1.9. How to handle incrementing
! 4425: versions when fixing an existing
! 4426: package</a></span></dt>
! 4427:
! 4428: <dt><span class="sect2"><a href=
! 4429: "#id2571809">12.1.10. Portability of
! 4430: packages</a></span></dt>
! 4431: </dl>
! 4432: </dd>
! 4433:
! 4434: <dt><span class="sect1"><a href="#id2571901">12.2.
! 4435: Possible downloading issues</a></span></dt>
! 4436:
! 4437: <dd>
! 4438: <dl>
! 4439: <dt><span class="sect2"><a href=
! 4440: "#id2571905">12.2.1. Packages whose distfiles
! 4441: aren't available for plain
! 4442: downloading</a></span></dt>
! 4443:
! 4444: <dt><span class="sect2"><a href=
! 4445: "#id2572036">12.2.2. How to handle modified
! 4446: distfiles with the 'old' name</a></span></dt>
! 4447: </dl>
! 4448: </dd>
! 4449:
! 4450: <dt><span class="sect1"><a href="#id2572048">12.3.
! 4451: Configuration gotchas</a></span></dt>
! 4452:
! 4453: <dd>
! 4454: <dl>
! 4455: <dt><span class="sect2"><a href=
! 4456: "#fixes.libtool">12.3.1. Shared libraries -
! 4457: libtool</a></span></dt>
! 4458:
! 4459: <dt><span class="sect2"><a href=
! 4460: "#id2572523">12.3.2. Using libtool on GNU
! 4461: packages that already support
! 4462: libtool</a></span></dt>
! 4463:
! 4464: <dt><span class="sect2"><a href=
! 4465: "#id2572608">12.3.3. GNU
! 4466: Autoconf/Automake</a></span></dt>
! 4467: </dl>
! 4468: </dd>
! 4469:
! 4470: <dt><span class="sect1"><a href="#id2572652">12.4.
! 4471: Building considerations</a></span></dt>
! 4472:
! 4473: <dd>
! 4474: <dl>
! 4475: <dt><span class="sect2"><a href=
! 4476: "#id2572656">12.4.1. CPP defines</a></span></dt>
! 4477: </dl>
! 4478: </dd>
! 4479:
! 4480: <dt><span class="sect1"><a href="#id2572685">12.5.
! 4481: Package specific actions</a></span></dt>
! 4482:
! 4483: <dd>
! 4484: <dl>
! 4485: <dt><span class="sect2"><a href=
! 4486: "#id2572689">12.5.1. Package configuration
! 4487: files</a></span></dt>
! 4488:
! 4489: <dt><span class="sect2"><a href=
! 4490: "#id2572859">12.5.2. User
! 4491: Interaction</a></span></dt>
! 4492:
! 4493: <dt><span class="sect2"><a href=
! 4494: "#id2572904">12.5.3. Handling
! 4495: licenses</a></span></dt>
! 4496:
! 4497: <dt><span class="sect2"><a href=
! 4498: "#id2572987">12.5.4. Creating an account from a
! 4499: package</a></span></dt>
! 4500:
! 4501: <dt><span class="sect2"><a href=
! 4502: "#id2573049">12.5.5. Installing score
! 4503: files</a></span></dt>
! 4504:
! 4505: <dt><span class="sect2"><a href=
! 4506: "#id2573093">12.5.6. Packages providing login
! 4507: shells</a></span></dt>
! 4508:
! 4509: <dt><span class="sect2"><a href=
! 4510: "#id2573424">12.5.7. Packages containing perl
! 4511: scripts</a></span></dt>
! 4512:
! 4513: <dt><span class="sect2"><a href=
! 4514: "#id2573442">12.5.8. Packages with hardcoded
! 4515: paths to other interpreters</a></span></dt>
! 4516:
! 4517: <dt><span class="sect2"><a href=
! 4518: "#id2573463">12.5.9. Packages installing perl
! 4519: modules</a></span></dt>
! 4520:
! 4521: <dt><span class="sect2"><a href=
! 4522: "#faq.info-files">12.5.10. Packages installing
! 4523: info files</a></span></dt>
! 4524:
! 4525: <dt><span class="sect2"><a href=
! 4526: "#id2573751">12.5.11. Packages installing GConf2
! 4527: data files</a></span></dt>
! 4528:
! 4529: <dt><span class="sect2"><a href=
! 4530: "#id2573851">12.5.12. Packages installing
! 4531: scrollkeeper data files</a></span></dt>
! 4532:
! 4533: <dt><span class="sect2"><a href=
! 4534: "#id2573902">12.5.13. Packages installing X11
! 4535: fonts</a></span></dt>
! 4536:
! 4537: <dt><span class="sect2"><a href=
! 4538: "#id2574018">12.5.14. Packages installing GTK2
! 4539: modules</a></span></dt>
! 4540:
! 4541: <dt><span class="sect2"><a href=
! 4542: "#id2574087">12.5.15. Packages installing SGML or
! 4543: XML data</a></span></dt>
! 4544:
! 4545: <dt><span class="sect2"><a href=
! 4546: "#id2574139">12.5.16. Packages installing
! 4547: extensions to the MIME database</a></span></dt>
! 4548:
! 4549: <dt><span class="sect2"><a href=
! 4550: "#id2574210">12.5.17. Packages using
! 4551: intltool</a></span></dt>
! 4552: </dl>
! 4553: </dd>
! 4554:
! 4555: <dt><span class="sect1"><a href="#id2574224">12.6.
! 4556: Feedback to the author</a></span></dt>
! 4557: </dl>
! 4558: </dd>
! 4559:
! 4560: <dt><span class="chapter"><a href="#debug">13.
! 4561: Debugging</a></span></dt>
! 4562:
! 4563: <dt><span class="chapter"><a href="#submit">14.
! 4564: Submitting and Committing</a></span></dt>
! 4565:
! 4566: <dd>
! 4567: <dl>
! 4568: <dt><span class="sect1"><a href="#id2574685">14.1.
! 4569: Submitting your packages</a></span></dt>
! 4570:
! 4571: <dt><span class="sect1"><a href="#id2574732">14.2.
! 4572: Committing: Importing a package into
! 4573: CVS</a></span></dt>
! 4574:
! 4575: <dt><span class="sect1"><a href="#id2575000">14.3.
! 4576: Updating a Package to a Newer Version</a></span></dt>
! 4577:
! 4578: <dt><span class="sect1"><a href="#id2575019">14.4.
! 4579: Moving a Package in pkgsrc</a></span></dt>
! 4580: </dl>
! 4581: </dd>
! 4582: </dl>
! 4583: </div>
! 4584:
! 4585: <div class="chapter" lang="en" xml:lang="en">
! 4586: <div class="titlepage">
! 4587: <div>
! 4588: <div>
! 4589: <h2 class="title"><a name="components" id=
! 4590: "components"></a>Chapter 7. Package
! 4591: components - files, directories and contents</h2>
! 4592: </div>
! 4593: </div>
! 4594: </div>
! 4595:
! 4596: <div class="toc">
! 4597: <p><b>Table of Contents</b></p>
! 4598:
! 4599: <dl>
! 4600: <dt><span class="sect1"><a href=
! 4601: "#components.Makefile">7.1. Makefile</a></span></dt>
! 4602:
! 4603: <dt><span class="sect1"><a href=
! 4604: "#components.distinfo">7.2. distinfo</a></span></dt>
! 4605:
! 4606: <dt><span class="sect1"><a href=
! 4607: "#components.patches">7.3. patches/*</a></span></dt>
! 4608:
! 4609: <dt><span class="sect1"><a href="#id2566375">7.4. Other
! 4610: mandatory files</a></span></dt>
! 4611:
! 4612: <dt><span class="sect1"><a href=
! 4613: "#components.optional">7.5. Optional
! 4614: files</a></span></dt>
! 4615:
! 4616: <dt><span class="sect1"><a href="#id2566569">7.6.
! 4617: work*</a></span></dt>
! 4618:
! 4619: <dt><span class="sect1"><a href="#id2566657">7.7.
! 4620: files/*</a></span></dt>
! 4621: </dl>
! 4622: </div>
! 4623:
! 4624: <p>Whenever you're preparing a package, there are a number
! 4625: of files involved which are described in the following
! 4626: sections.</p>
! 4627:
! 4628: <div class="sect1" lang="en" xml:lang="en">
! 4629: <div class="titlepage">
! 4630: <div>
! 4631: <div>
! 4632: <h2 class="title" style="clear: both"><a name=
! 4633: "components.Makefile" id=
! 4634: "components.Makefile"></a>7.1. <tt class=
! 4635: "filename">Makefile</tt></h2>
! 4636: </div>
! 4637: </div>
! 4638: </div>
! 4639:
! 4640: <p>Building, installation and creation of a binary
! 4641: package are all controlled by the package's <tt class=
! 4642: "filename">Makefile</tt>.</p>
! 4643:
! 4644: <p>There is a <tt class="filename">Makefile</tt> for each
! 4645: package. This file includes the standard <tt class=
! 4646: "filename">bsd.pkg.mk</tt> file (referenced as <tt class=
! 4647: "filename">../../mk/bsd.pkg.mk</tt>), which sets all the
! 4648: definitions and actions necessary for the package to
! 4649: compile and install itself. The mandatory variables are
! 4650: the <tt class="varname">DISTNAME</tt> which specifies the
! 4651: base name of the distribution file to be downloaded from
! 4652: the site on the Internet, <tt class=
! 4653: "varname">MASTER_SITES</tt> which specifies that site,
! 4654: <tt class="varname">CATEGORIES</tt> which denotes the
! 4655: categories into which the package falls, <tt class=
! 4656: "varname">PKGNAME</tt> which is the name of the package,
! 4657: the <tt class="varname">MAINTAINER</tt>'s name, and the
! 4658: <tt class="varname">COMMENT</tt> variable, which should
! 4659: contain a one-line description of the package (the
! 4660: package name should not appear, it will be added
! 4661: automatically). The maintainer variable is there so that
! 4662: anyone who quibbles with the (always completely correct)
! 4663: decisions taken by the guy who maintains the package can
! 4664: complain vigorously, or send chocolate as a sign of
! 4665: appreciation.</p>
! 4666:
! 4667: <p>The <tt class="varname">MASTER_SITES</tt> may be set
! 4668: to one of the predefined sites:</p>
! 4669: <pre class="programlisting">
! 4670: ${MASTER_SITE_APACHE}
! 4671: ${MASTER_SITE_DEBIAN}
! 4672: ${MASTER_SITE_GNOME}
! 4673: ${MASTER_SITE_GNU}
! 4674: ${MASTER_SITE_GNUSTEP}
! 4675: ${MASTER_SITE_MOZILLA}
! 4676: ${MASTER_SITE_PERL_CPAN}
! 4677: ${MASTER_SITE_SOURCEFORGE}
! 4678: ${MASTER_SITE_SUNSITE}
! 4679: ${MASTER_SITE_R_CRAN}
! 4680: ${MASTER_SITE_SUSE}
! 4681: ${MASTER_SITE_TEX_CTAN}
! 4682: ${MASTER_SITE_XCONTRIB}
! 4683: ${MASTER_SITE_XEMACS}
! 4684: </pre>
! 4685:
! 4686: <p>If one of these predefined sites is chosen, you may
! 4687: require the ability to specify a subdirectory of that
! 4688: site. Since these macros may expand to more than one
! 4689: actual site, you <span class=
! 4690: "emphasis"><em>must</em></span> use the following
! 4691: construct to specify a subdirectory:</p>
! 4692: <pre class="programlisting">
! 4693: ${MASTER_SITE_GNU:=subdirectory/name/}
! 4694: ${MASTER_SITE_SOURCEFORGE:=project_name/}
! 4695: </pre>
! 4696:
! 4697: <p>Note the trailing slash after the subdirectory
! 4698: name.</p>
! 4699:
! 4700: <div class="note" style=
! 4701: "margin-left: 0.5in; margin-right: 0.5in;">
! 4702: <h3 class="title">Note</h3>
! 4703:
! 4704: <p><tt class="varname">MASTER_SITE_SUBDIR</tt> has been
! 4705: deprecated and <span class="emphasis"><em>should no
! 4706: longer be used</em></span>.</p>
! 4707: </div>
! 4708:
! 4709: <p>If the package has multiple <tt class=
! 4710: "varname">DISTFILES</tt> or multiple <tt class=
! 4711: "varname">PATCHFILES</tt> from different sites, set
! 4712: <tt class="varname">SITES_foo</tt> to a list of URI's
! 4713: where file “<span class="quote">foo</span>”
! 4714: may be found. “<span class=
! 4715: "quote">foo</span>” includes the suffix, e.g.</p>
! 4716: <pre class="programlisting">
! 4717: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
! 4718: DISTFILES+= foo-file.tar.gz
! 4719: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
! 4720: http://www.somewhereelse.com/mirror/somehow/
! 4721: </pre>
! 4722:
! 4723: <p>Note that the normal default setting of <tt class=
! 4724: "varname">DISTFILES</tt> must be made explicit if you
! 4725: want to add to it (rather than replace it), as you
! 4726: usually would.</p>
! 4727:
! 4728: <p>Currently the following values are available for
! 4729: <tt class="varname">CATEGORIES</tt>. If more than one is
! 4730: used, they need to be separated by spaces:</p>
! 4731: <pre class="programlisting">
! 4732: archivers cross geography meta-pkgs security
! 4733: audio databases graphics misc shells
! 4734: benchmarks devel ham multimedia sysutils
! 4735: biology editors inputmethod net textproc
! 4736: cad emulators lang news time
! 4737: chat finance mail parallel wm
! 4738: comms fonts math pkgtools www
! 4739: converters games mbone print x11
! 4740: </pre>
! 4741:
! 4742: <p>Please pay attention to the following gotchas:</p>
! 4743:
! 4744: <div class="itemizedlist">
! 4745: <ul type="disc">
! 4746: <li>
! 4747: <p>Add <tt class="varname">MANCOMPRESSED</tt> if
! 4748: manpages are installed in compressed form by the
! 4749: package; see comment in <tt class=
! 4750: "filename">bsd.pkg.mk</tt>.</p>
! 4751: </li>
! 4752:
! 4753: <li>
! 4754: <p>Replace <tt class="filename">/usr/local</tt>
! 4755: with “<span class=
! 4756: "quote">${PREFIX}</span>” in all files (see
! 4757: patches, below).</p>
! 4758: </li>
! 4759:
! 4760: <li>
! 4761: <p>If the package installs any info files, see
! 4762: <a href="#faq.info-files" title=
! 4763: "12.5.10. Packages installing info files">Section
! 4764: 12.5.10, “Packages installing info
! 4765: files”</a>.</p>
! 4766: </li>
! 4767:
! 4768: <li>
! 4769: <p>Set <tt class="varname">MAINTAINER</tt> to be
! 4770: yourself. If you really can't maintain the package
! 4771: for future updates, set it to <tt class=
! 4772: "email"><<a href=
! 4773: "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>></tt>.</p>
! 4774: </li>
! 4775:
! 4776: <li>
! 4777: <p>If a home page for the software in question
! 4778: exists, add the variable <tt class=
! 4779: "varname">HOMEPAGE</tt> right after <tt class=
! 4780: "varname">MAINTAINER</tt>. The value of this
! 4781: variable should be the URL for the home page.</p>
! 4782: </li>
! 4783:
! 4784: <li>
! 4785: <p>Be sure to set the <tt class=
! 4786: "varname">COMMENT</tt> variable to a short
! 4787: description of the package, not containing the
! 4788: pkg's name.</p>
! 4789: </li>
! 4790: </ul>
! 4791: </div>
! 4792: </div>
! 4793:
! 4794: <div class="sect1" lang="en" xml:lang="en">
! 4795: <div class="titlepage">
! 4796: <div>
! 4797: <div>
! 4798: <h2 class="title" style="clear: both"><a name=
! 4799: "components.distinfo" id=
! 4800: "components.distinfo"></a>7.2. <tt class=
! 4801: "filename">distinfo</tt></h2>
! 4802: </div>
! 4803: </div>
! 4804: </div>
! 4805:
! 4806: <p>Most important, the mandatory message digest, or
! 4807: checksum, of all the distfiles needed for the package to
! 4808: compile, confirming they match the original file
! 4809: distributed by the author. This ensures that the distfile
! 4810: retrieved from the Internet has not been corrupted during
! 4811: transfer or altered by a malign force to introduce a
! 4812: security hole. It is generated using the <span><b class=
! 4813: "command">make makesum</b></span> command. The digest
! 4814: algorithm used was, at one stage, md5, but that was felt
! 4815: lacking compared to sha1, and so sha1 is now the default
! 4816: algorithm. The distfile size is also generated and stored
! 4817: in new distinfo files. The <a xmlns=
! 4818: "http://www.w3.org/TR/xhtml1/transitional" href=
! 4819: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
! 4820: class="pkgname">pkgtools/digest</a> utility calculates
! 4821: all of the digests in the distinfo file, and it provides
! 4822: various different algorithms. At the current time, the
! 4823: algorithms provided are: <span class=
! 4824: "emphasis"><em>md5</em></span>, <span class=
! 4825: "emphasis"><em>rmd160</em></span>, <span class=
! 4826: "emphasis"><em>sha1</em></span>, <span class=
! 4827: "emphasis"><em>sha256</em></span>, <span class=
! 4828: "emphasis"><em>sha384</em></span> and <span class=
! 4829: "emphasis"><em>sha512</em></span>.</p>
! 4830:
! 4831: <p>Some packages have different sets of distfiles on a
! 4832: per architecture basis, for example <a xmlns=
! 4833: "http://www.w3.org/TR/xhtml1/transitional" href=
! 4834: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
! 4835: class="pkgname">www/navigator</a>). These are kept in the
! 4836: same distinfo file and care should be taken when
! 4837: upgrading such a package to ensure distfile information
! 4838: is not lost.</p>
! 4839:
! 4840: <p>The message digest/checksum for all the official
! 4841: patches found in the <tt class="filename">patches/</tt>
! 4842: directory (see <a href="#components.patches" title=
! 4843: "7.3. patches/*">Section 7.3,
! 4844: “patches/*”</a>) for the package is also
! 4845: stored in the <tt class="filename">distinfo</tt> file.
! 4846: This is a message digest/checksum of all lines in the
! 4847: patch file except the NetBSD RCS Id. This file is
! 4848: generated by invoking <span><b class="command">make
! 4849: makepatchsum</b></span> (or <span><b class="command">make
! 4850: mps</b></span> if you're in a hurry).</p>
! 4851: </div>
! 4852:
! 4853: <div class="sect1" lang="en" xml:lang="en">
! 4854: <div class="titlepage">
! 4855: <div>
! 4856: <div>
! 4857: <h2 class="title" style="clear: both"><a name=
! 4858: "components.patches" id=
! 4859: "components.patches"></a>7.3. patches/*</h2>
! 4860: </div>
! 4861: </div>
! 4862: </div>
! 4863:
! 4864: <p>This directory contains files that are used by the
! 4865: <a href=
! 4866: "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
! 4867: <span class="citerefentry"><span class=
! 4868: "refentrytitle">patch</span>(1)</span></a> command to
! 4869: modify the sources as distributed in the distribution
! 4870: file into a form that will compile and run perfectly on
! 4871: NetBSD. The files are applied successively in alphabetic
! 4872: order (as returned by a shell “<span class=
! 4873: "quote">patches/patch-*</span>” glob expansion), so
! 4874: <tt class="filename">patch-aa</tt> is applied before
! 4875: <tt class="filename">patch-ab</tt>, etc.</p>
! 4876:
! 4877: <p>Patch files which are optional and will depend on
! 4878: local site configuration can be included with names
! 4879: matching the pattern <tt class=
! 4880: "filename">patches/patch-optional-*</tt>. Their suffixes
! 4881: should match the configuration options. The selected
! 4882: optional patch file names should be assigned to the
! 4883: variable <tt class="varname">OPTIONAL_PATCHFILES</tt>.
! 4884: They will not be applied by default.</p>
! 4885:
! 4886: <p>For example if a package data file needs patching to
! 4887: indicate the default local printer paper size as
! 4888: specified in the <tt class="varname">$PAPERSIZE</tt> file
! 4889: you can include patches for all the possible paper sizes
! 4890: other than the one the package comes configured for by
! 4891: default. In this case you might have a patch called
! 4892: "<tt class=
! 4893: "filename">patch-optional-Letter-papersize</tt>" and/or
! 4894: another patch called "<tt class=
! 4895: "filename">patch-optional-A4-papersize</tt>". In your
! 4896: <tt class="filename">Makefile</tt> you would select
! 4897: between them with the following construct:</p>
! 4898: <pre class="programlisting">
! 4899:
! 4900: PATCHDIR= ${.CURDIR}/patches
! 4901: .if exists(${PATCHDIR}/patch-optional-${PAPERSIZE}-papersize)
! 4902: OPTIONAL_PATCHFILES+= ${PATCHDIR}/patch-optional-${PAPERSIZE}-papersize
! 4903: .endif
! 4904: </pre>
! 4905:
! 4906: <p>Note that you have to define the value of <tt class=
! 4907: "varname">PATCHDIR</tt> in order to use it in a
! 4908: “<span class="quote"><span><b class=
! 4909: "command">.if</b></span></span>” statement like
! 4910: this as otherwise it's not defined until too late during
! 4911: the processing of the Makefile. You should use a
! 4912: “<span class="quote"><span><b class=
! 4913: "command">.if</b></span></span>” statement in order
! 4914: to avoid problems should the configuration item
! 4915: (<tt class="varname">$PAPERSIZE</tt> in this example) be
! 4916: set to an unexpected value.</p>
! 4917:
! 4918: <p>The <tt class="filename">patch-*</tt> files should be
! 4919: in <span><b class="command">diff -bu</b></span> format,
! 4920: and apply without a fuzz to avoid problems. (To force
! 4921: patches to apply with fuzz you can set <tt class=
! 4922: "varname">PATCH_FUZZ_FACTOR=-F2</tt>). Furthermore, do
! 4923: not put changes for more than one file into a single
! 4924: patch-file, as this will make future modifications more
! 4925: difficult.</p>
! 4926:
! 4927: <p>Similar, a file should be patched at most once, not
! 4928: several times by several different patches. If a file
! 4929: needs several patches, they should be combined into one
! 4930: file.</p>
! 4931:
! 4932: <p>One important thing to mention is to pay attention
! 4933: that no RCS IDs get stored in the patch files, as these
! 4934: will cause problems when later checked into the NetBSD
! 4935: CVS tree. Use the <span><b class=
! 4936: "command">pkgdiff</b></span> from the <a xmlns=
! 4937: "http://www.w3.org/TR/xhtml1/transitional" href=
! 4938: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
! 4939: class="pkgname">pkgtools/pkgdiff</a> package to avoid
! 4940: these problems.</p>
! 4941:
! 4942: <p>For even more automation, we recommend using
! 4943: <span><b class="command">mkpatches</b></span> from the
! 4944: same package to make a whole set of patches. You just
! 4945: have to backup files before you edit them to <tt class=
! 4946: "filename">filename.orig</tt>, e.g. with <span><b class=
! 4947: "command">cp -p filename filename.orig</b></span> or,
! 4948: easier, by using <span><b class=
! 4949: "command">pkgvi</b></span> again from the same package.
! 4950: If you upgrade a package this way, you can easily compare
! 4951: the new set of patches with the previously existing one
! 4952: with <span><b class="command">patchdiff</b></span>.</p>
! 4953:
! 4954: <p>When you have finished a package, remember to generate
! 4955: the checksums for the patch files by using the
! 4956: <span><b class="command">make makepatchsum</b></span>
! 4957: command, see <a href="#components.distinfo" title=
! 4958: "7.2. distinfo">Section 7.2,
! 4959: “distinfo”</a>.</p>
! 4960:
! 4961: <p>Patch files that are distributed by the author or
! 4962: other maintainers can be listed in <tt class=
! 4963: "varname">$PATCHFILES</tt>.</p>
! 4964:
! 4965: <p>If it is desired to store any patches that should not
! 4966: be committed into pkgsrc, they can be kept outside the
! 4967: pkgsrc tree in the <tt class=
! 4968: "filename">$LOCALPATCHES</tt> directory. The directory
! 4969: tree there is expected to have the same
! 4970: “<span class="quote">category/package</span>”
! 4971: structure as pkgsrc, and patches are expected to be
! 4972: stored inside these dirs (also known as <tt class=
! 4973: "filename">$LOCALPATCHES/$PKGPATH</tt>). For example if
! 4974: you want to keep a private patch for <tt class=
! 4975: "filename">pkgsrc/graphics/png</tt>, keep it in
! 4976: <tt class="filename">$LOCALPATCHES/graphics/png/mypatch</tt>.
! 4977: All files in the named directory are expected to be patch
! 4978: files, and <span class="emphasis"><em>they are applied
! 4979: after pkgsrc patches are applied</em></span>.</p>
! 4980: </div>
! 4981:
! 4982: <div class="sect1" lang="en" xml:lang="en">
! 4983: <div class="titlepage">
! 4984: <div>
! 4985: <div>
! 4986: <h2 class="title" style="clear: both"><a name=
! 4987: "id2566375" id="id2566375"></a>7.4. Other
! 4988: mandatory files</h2>
! 4989: </div>
! 4990: </div>
! 4991: </div>
! 4992:
! 4993: <div class="variablelist">
! 4994: <dl>
! 4995: <dt><span class="term"><tt class=
! 4996: "filename">DESCR</tt></span></dt>
! 4997:
! 4998: <dd>
! 4999: <p>A multi-line description of the piece of
! 5000: software. This should include any credits where
! 5001: they are due. Please bear in mind that others do
! 5002: not share your sense of humour (or spelling
! 5003: idiosyncrasies), and that others will read
! 5004: everything that you write here.</p>
! 5005: </dd>
! 5006:
! 5007: <dt><span class="term"><tt class=
! 5008: "filename">PLIST</tt></span></dt>
! 5009:
! 5010: <dd>
! 5011: <p>This file governs the files that are installed
! 5012: on your system: all the binaries, manual pages,
! 5013: etc. There are other directives which may be
! 5014: entered in this file, to control the creation and
! 5015: deletion of directories, and the location of
! 5016: inserted files. See <a href="#plist" title=
! 5017: "Chapter 8. PLIST issues">Chapter 8,
! 5018: <i>PLIST issues</i></a> for more information.</p>
! 5019: </dd>
! 5020: </dl>
! 5021: </div>
! 5022: </div>
! 5023:
! 5024: <div class="sect1" lang="en" xml:lang="en">
! 5025: <div class="titlepage">
! 5026: <div>
! 5027: <div>
! 5028: <h2 class="title" style="clear: both"><a name=
! 5029: "components.optional" id=
! 5030: "components.optional"></a>7.5. Optional
! 5031: files</h2>
! 5032: </div>
! 5033: </div>
! 5034: </div>
! 5035:
! 5036: <div class="variablelist">
! 5037: <dl>
! 5038: <dt><span class="term"><tt class=
! 5039: "filename">INSTALL</tt></span></dt>
! 5040:
! 5041: <dd>
! 5042: <p>This shell script is invoked twice by <a href=
! 5043: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
! 5044: <span class="citerefentry"><span class=
! 5045: "refentrytitle">pkg_add</span>(1)</span></a>. First
! 5046: time after package extraction and before files are
! 5047: moved in place, the second time after the files to
! 5048: install are moved in place. This can be used to do
! 5049: any custom procedures not possible with @exec
! 5050: commands in <tt class="filename">PLIST</tt>. See
! 5051: <a href=
! 5052: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
! 5053: <span class="citerefentry"><span class=
! 5054: "refentrytitle">pkg_add</span>(1)</span></a> and
! 5055: <a href=
! 5056: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
! 5057: <span class="citerefentry"><span class=
! 5058: "refentrytitle">pkg_create</span>(1)</span></a> for
! 5059: more information.</p>
! 5060: </dd>
! 5061:
! 5062: <dt><span class="term"><tt class=
! 5063: "filename">DEINSTALL</tt></span></dt>
! 5064:
! 5065: <dd>
! 5066: <p>This script is executed before and after any
! 5067: files are removed. It is this script's
! 5068: responsibility to clean up any additional messy
! 5069: details around the package's installation, since
! 5070: all pkg_delete knows is how to delete the files
! 5071: created in the original distribution. See <a href=
! 5072: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
! 5073: <span class="citerefentry"><span class=
! 5074: "refentrytitle">pkg_delete</span>(1)</span></a> and
! 5075: <a href=
! 5076: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
! 5077: <span class="citerefentry"><span class=
! 5078: "refentrytitle">pkg_create</span>(1)</span></a> for
! 5079: more information.</p>
! 5080: </dd>
! 5081:
! 5082: <dt><span class="term"><tt class=
! 5083: "filename">MESSAGE</tt></span></dt>
! 5084:
! 5085: <dd>
! 5086: <p>Display this file after installation of the
! 5087: package. Useful for things like legal notices on
! 5088: almost-free software and hints for updating config
! 5089: files after installing modules for apache, PHP etc.
! 5090: Please note that you can modify variables in it
! 5091: easily by using <tt class=
! 5092: "varname">MESSAGE_SUBST</tt> in the package's
! 5093: <tt class="filename">Makefile</tt>:</p>
! 5094: <pre class="programlisting">
! 5095: MESSAGE_SUBST+= SOMEVAR="somevalue"
! 5096: </pre>
! 5097:
! 5098: <p>replaces "${SOMEVAR}" with “<span class=
! 5099: "quote">somevalue</span>” in <tt class=
! 5100: "filename">MESSAGE</tt>.</p>
! 5101: </dd>
! 5102: </dl>
! 5103: </div>
! 5104: </div>
! 5105:
! 5106: <div class="sect1" lang="en" xml:lang="en">
! 5107: <div class="titlepage">
! 5108: <div>
! 5109: <div>
! 5110: <h2 class="title" style="clear: both"><a name=
! 5111: "id2566569" id="id2566569"></a>7.6. <tt class=
! 5112: "filename">work*</tt></h2>
! 5113: </div>
! 5114: </div>
! 5115: </div>
! 5116:
! 5117: <p>When you type <span><b class="command">make</b></span>
! 5118: the distribution files are unpacked into this directory.
! 5119: It can be removed by running <span><b class=
! 5120: "command">make clean</b></span>. Besides the sources,
! 5121: this directory is also used to keep various timestamp
! 5122: files.</p>
! 5123:
! 5124: <p>If a package doesn't create a subdirectory for itself
! 5125: (like GNU software does, for instance), but extracts
! 5126: itself in the current directory, you should set
! 5127: <tt class="varname">WRKSRC</tt> accordingly, e.g.
! 5128: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
! 5129: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
! 5130: class="pkgname">editors/sam</a> again, but the quick
! 5131: answer is:</p>
! 5132: <pre class="programlisting">
! 5133: WRKSRC= ${WRKDIR}
! 5134: </pre>
! 5135:
! 5136: <p>Please note that the old <tt class=
! 5137: "varname">NO_WRKSUBDIR</tt> has been deprecated and
! 5138: should not be used. Also, if your package doesn't create
! 5139: a subdir with the name of <tt class=
! 5140: "varname">DISTNAME</tt> but some different name, set
! 5141: <tt class="varname">WRKSRC</tt> to point to the proper
! 5142: name in <tt class="filename">${WRKDIR}</tt>. See
! 5143: <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
! 5144: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
! 5145: class="pkgname">lang/tcl</a> and <a xmlns=
! 5146: "http://www.w3.org/TR/xhtml1/transitional" href=
! 5147: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
! 5148: class="pkgname">x11/tk</a> for examples, and here is
! 5149: another one:</p>
! 5150: <pre class="programlisting">
! 5151: WRKSRC= ${WRKDIR}/${DISTNAME}/unix
! 5152: </pre>
! 5153:
! 5154: <p>The name of the working directory created by pkgsrc is
! 5155: <tt class="filename">work</tt> by default. If the same
! 5156: pkgsrc tree should be used on several different
! 5157: platforms, the variable <tt class=
! 5158: "varname">OBJMACHINE</tt> can be set in /etc/mk.conf to
! 5159: attach the platform to the directory name, e.g.
! 5160: <tt class="filename">work.i386</tt> or <tt class=
! 5161: "filename">work.sparc</tt>.</p>
! 5162: </div>
! 5163:
! 5164: <div class="sect1" lang="en" xml:lang="en">
! 5165: <div class="titlepage">
! 5166: <div>
! 5167: <div>
! 5168: <h2 class="title" style="clear: both"><a name=
! 5169: "id2566657" id="id2566657"></a>7.7. <tt class=
! 5170: "filename">files/*</tt></h2>
! 5171: </div>
! 5172: </div>
! 5173: </div>
! 5174:
! 5175: <p>If you have any files that you wish to be placed in
! 5176: the package prior to configuration or building, you could
! 5177: place these files here and use a “<span class=
! 5178: "quote">${CP}</span>” command in the
! 5179: “<span class="quote">pre-configure</span>”
! 5180: target to achieve this. Alternatively, you could simply
! 5181: diff the file against <tt class="filename">/dev/null</tt>
! 5182: and use the patch mechanism to manage the creation of
! 5183: this file.</p>
! 5184: </div>
! 5185: </div>
! 5186:
! 5187: <div class="chapter" lang="en" xml:lang="en">
! 5188: <div class="titlepage">
! 5189: <div>
! 5190: <div>
! 5191: <h2 class="title"><a name="plist" id=
! 5192: "plist"></a>Chapter 8. PLIST issues</h2>
! 5193: </div>
! 5194: </div>
! 5195: </div>
! 5196:
! 5197: <div class="toc">
! 5198: <p><b>Table of Contents</b></p>
! 5199:
! 5200: <dl>
! 5201: <dt><span class="sect1"><a href="#id2566711">8.1. RCS
! 5202: ID</a></span></dt>
! 5203:
! 5204: <dt><span class="sect1"><a href="#id2566726">8.2.
! 5205: Semi-automatic PLIST generation</a></span></dt>
! 5206:
! 5207: <dt><span class="sect1"><a href="#print-PLIST">8.3.
! 5208: Tweaking output of make print-PLIST</a></span></dt>
! 5209:
! 5210: <dt><span class="sect1"><a href="#plist.misc">8.4.
! 5211: Variable substitution in PLIST</a></span></dt>
! 5212:
! 5213: <dt><span class="sect1"><a href="#id2567047">8.5.
! 5214: Manpage-compression</a></span></dt>
! 5215:
! 5216: <dt><span class="sect1"><a href="#id2567089">8.6.
! 5217: Changing PLIST source with PLIST_SRC</a></span></dt>
! 5218:
! 5219: <dt><span class="sect1"><a href="#id2567106">8.7.
! 5220: Platform specific and differing PLISTs</a></span></dt>
! 5221:
! 5222: <dt><span class="sect1"><a href="#faq.common-dirs">8.8.
! 5223: Sharing directories between packages</a></span></dt>
! 5224: </dl>
! 5225: </div>
! 5226:
! 5227: <p>The <tt class="filename">PLIST</tt> file contains a
! 5228: package's “<span class="quote">packing
! 5229: list</span>”, i.e. a list of files that belong to the
! 5230: package (relative to the <tt class=
! 5231: "filename">${PREFIX}</tt> directory it's been installed in)
! 5232: plus some additional statements - see the <a href=
! 5233: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
! 5234: <span class="citerefentry"><span class=
! 5235: "refentrytitle">pkg_create</span>(1)</span></a> manpage for
! 5236: a full list. This chapter addresses some issues that need
! 5237: attention when dealing with the <tt class=
! 5238: "filename">PLIST</tt> file (or files, see below!).</p>
! 5239:
! 5240: <div class="sect1" lang="en" xml:lang="en">
! 5241: <div class="titlepage">
! 5242: <div>
! 5243: <div>
! 5244: <h2 class="title" style="clear: both"><a name=
! 5245: "id2566711" id="id2566711"></a>8.1. RCS
! 5246: ID</h2>
! 5247: </div>
! 5248: </div>
! 5249: </div>
! 5250:
! 5251: <p>Be sure to add a RCS ID line as the first thing in any
! 5252: <tt class="filename">PLIST</tt> file you write:</p>
! 5253: <pre class="programlisting">
! 5254: @comment $NetBSD$
! 5255: </pre>
! 5256: </div>
! 5257:
! 5258: <div class="sect1" lang="en" xml:lang="en">
! 5259: <div class="titlepage">
! 5260: <div>
! 5261: <div>
! 5262: <h2 class="title" style="clear: both"><a name=
! 5263: "id2566726" id=
! 5264: "id2566726"></a>8.2. Semi-automatic <tt class=
! 5265: "filename">PLIST</tt> generation</h2>
! 5266: </div>
! 5267: </div>
! 5268: </div>
! 5269:
! 5270: <p>You can use the <span><b class="command">make
! 5271: print-PLIST</b></span> command to output a PLIST that
! 5272: matches any new files since the package was extracted.
! 5273: See <a href="#build.helpful-targets" title=
! 5274: "11.3. Other helpful targets">Section 11.3,
! 5275: “Other helpful targets”</a> for more
! 5276: information on this target.</p>
! 5277: </div>
! 5278:
! 5279: <div class="sect1" lang="en" xml:lang="en">
! 5280: <div class="titlepage">
! 5281: <div>
! 5282: <div>
! 5283: <h2 class="title" style="clear: both"><a name=
! 5284: "print-PLIST" id=
! 5285: "print-PLIST"></a>8.3. Tweaking output of
! 5286: <span><b class="command">make
! 5287: print-PLIST</b></span></h2>
! 5288: </div>
! 5289: </div>
! 5290: </div>
! 5291:
! 5292: <p>If you have used any of the *-dirs packages, as
! 5293: explained in <a href="#faq.common-dirs" title=
! 5294: "8.8. Sharing directories between packages">Section 8.8,
! 5295: “Sharing directories between packages”</a>,
! 5296: you may have noticed that <span><b class="command">make
! 5297: print-PLIST</b></span> outputs a set of <tt class=
! 5298: "varname">@comment</tt>s instead of real <tt class=
! 5299: "varname">@dirrm</tt> lines. You can also do this for
! 5300: specific directories and files, so that the results of
! 5301: that command are very close to reality. This helps
! 5302: <span class="emphasis"><em>a lot</em></span> during the
! 5303: update of packages.</p>
! 5304:
! 5305: <p>The <tt class="varname">PRINT_PLIST_AWK</tt> variable
! 5306: takes a set of AWK patterns and actions that are used to
! 5307: filter the output of print-PLIST. You can <span class=
! 5308: "emphasis"><em>append</em></span> any chunk of AWK
! 5309: scripting you like to it, but be careful with
! 5310: quoting.</p>
! 5311:
! 5312: <p>For example, to get all files inside the <tt class=
! 5313: "filename">libdata/foo</tt> directory removed from the
! 5314: resulting PLIST:</p>
! 5315: <pre class="programlisting">
! 5316: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
! 5317:
! 5318: </pre>
! 5319:
! 5320: <p>And to get all the <tt class="varname">@dirrm</tt>
! 5321: lines referring to a specific (shared) directory
! 5322: converted to <tt class="varname">@comment</tt>s:</p>
! 5323: <pre class="programlisting">
! 5324: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
! 5325:
! 5326: </pre>
! 5327: </div>
! 5328:
! 5329: <div class="sect1" lang="en" xml:lang="en">
! 5330: <div class="titlepage">
! 5331: <div>
! 5332: <div>
! 5333: <h2 class="title" style="clear: both"><a name=
! 5334: "plist.misc" id="plist.misc"></a>8.4. Variable
! 5335: substitution in PLIST</h2>
! 5336: </div>
! 5337: </div>
! 5338: </div>
! 5339:
! 5340: <p>A number of variables are substituted automatically in
! 5341: PLISTs when a package is installed on a system. This
! 5342: includes the following variables:</p>
! 5343:
! 5344: <div class="variablelist">
! 5345: <dl>
! 5346: <dt><span class="term"><tt class=
! 5347: "varname">${MACHINE_ARCH}</tt>, <tt class=
! 5348: "varname">${MACHINE_GNU_ARCH}</tt></span></dt>
! 5349:
! 5350: <dd>
! 5351: <p>Some packages like emacs and perl embed
! 5352: information about which architecture they were
! 5353: built on into the pathnames where they install
! 5354: their file. To handle this case, PLIST will be
! 5355: preprocessed before actually used, and the symbol
! 5356: “<span class="quote"><tt class=
! 5357: "varname">${MACHINE_ARCH}</tt></span>” will
! 5358: be replaced by what <span><b class="command">uname
! 5359: -p</b></span> gives. The same is done if the string
! 5360: <tt class="varname">${MACHINE_GNU_ARCH}</tt> is
! 5361: embedded in PLIST somewhere - use this on packages
! 5362: that have GNU autoconf created configure
! 5363: scripts.</p>
! 5364:
! 5365: <div class="note" style=
! 5366: "margin-left: 0.5in; margin-right: 0.5in;">
! 5367: <h3 class="title">Legacy note</h3>
! 5368:
! 5369: <p>There used to be a symbol “<span class=
! 5370: "quote"><tt class=
! 5371: "varname">$ARCH</tt></span>” that was
! 5372: replaced by the output of <span><b class=
! 5373: "command">uname -m</b></span>, but that's no
! 5374: longer supported and has been removed.</p>
! 5375: </div>
! 5376: </dd>
! 5377:
! 5378: <dt><span class="term"><tt class=
! 5379: "varname">${OPSYS}</tt>, <tt class=
! 5380: "varname">${LOWER_OPSYS}</tt>, <tt class=
! 5381: "varname">${OS_VERSION}</tt></span></dt>
! 5382:
! 5383: <dd>
! 5384: <p>Some packages want to embed the OS name and
! 5385: version into some paths. To do this, use these
! 5386: variables in the <tt class=
! 5387: "filename">PLIST</tt>:</p>
! 5388:
! 5389: <div class="itemizedlist">
! 5390: <ul type="disc">
! 5391: <li>
! 5392: <p><tt class="varname">${OPSYS}</tt> - output
! 5393: of “<span class="quote"><span><b class=
! 5394: "command">uname
! 5395: -s</b></span></span>”</p>
! 5396: </li>
! 5397:
! 5398: <li>
! 5399: <p><tt class="varname">${LOWER_OPSYS}</tt> -
! 5400: lowercase common name (eg.
! 5401: “<span class="quote">solaris</span>”)</p>
! 5402: </li>
! 5403:
! 5404: <li>
! 5405: <p><tt class="varname">${OS_VERSION}</tt> -
! 5406: “<span class="quote"><span><b class=
! 5407: "command">uname
! 5408: -r</b></span></span>”</p>
! 5409: </li>
! 5410: </ul>
! 5411: </div>
! 5412: </dd>
! 5413:
! 5414: <dt><span class="term"><tt class=
! 5415: "varname">${PKGLOCALEDIR}</tt></span></dt>
! 5416:
! 5417: <dd>
! 5418: <p>Packages that install locale files should list
! 5419: them in the PLIST as “<span class=
! 5420: "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>”
! 5421: instead of “<span class=
! 5422: "quote">share/locale/de/LC_MESSAGES/...</span>”.
! 5423: This properly handles the fact that different
! 5424: operating systems expect locale files to be either
! 5425: in <tt class="filename">share</tt> or <tt class=
! 5426: "filename">lib</tt> by default.</p>
! 5427: </dd>
! 5428: </dl>
! 5429: </div>
! 5430:
! 5431: <p>For a complete list of values which are replaced by
! 5432: default, please look in <tt class=
! 5433: "filename">bsd.pkg.mk</tt> (and search for <span class=
! 5434: "emphasis"><em>PLIST_SUBST</em></span>).</p>
! 5435:
! 5436: <p>If you want to change other variables not listed
! 5437: above, you can add variables and their expansions to this
! 5438: variable in the following way, similar to <tt class=
! 5439: "varname">MESSAGE_SUBST</tt> (see <a href=
! 5440: "#components.optional" title=
! 5441: "7.5. Optional files">Section 7.5,
! 5442: “Optional files”</a>):</p>
! 5443: <pre class="programlisting">
! 5444: PLIST_SUBST+= SOMEVAR="somevalue"
! 5445: </pre>
! 5446:
! 5447: <p>This replaces all occurrences of “<span class=
! 5448: "quote">${SOMEVAR}</span>” in the PLIST with
! 5449: “<span class="quote">somevalue</span>”.</p>
! 5450: </div>
! 5451:
! 5452: <div class="sect1" lang="en" xml:lang="en">
! 5453: <div class="titlepage">
! 5454: <div>
! 5455: <div>
! 5456: <h2 class="title" style="clear: both"><a name=
! 5457: "id2567047" id=
! 5458: "id2567047"></a>8.5. Manpage-compression</h2>
! 5459: </div>
! 5460: </div>
! 5461: </div>
! 5462:
! 5463: <p>Manpages should be installed in compressed form if
! 5464: <tt class="varname">MANZ</tt> is set (in <tt class=
! 5465: "filename">bsd.own.mk</tt>), and uncompressed otherwise.
! 5466: To handle this in the <tt class="filename">PLIST</tt>
! 5467: file, the suffix “<span class=
! 5468: "quote">.gz</span>” is appended/removed
! 5469: automatically for manpages according to <tt class=
! 5470: "varname">MANZ</tt> and <tt class=
! 5471: "varname">MANCOMPRESSED</tt> being set or not, see above
! 5472: for details. This modification of the <tt class=
! 5473: "filename">PLIST</tt> file is done on a copy of it, not
! 5474: <tt class="filename">PLIST</tt> itself.</p>
! 5475: </div>
! 5476:
! 5477: <div class="sect1" lang="en" xml:lang="en">
! 5478: <div class="titlepage">
! 5479: <div>
! 5480: <div>
! 5481: <h2 class="title" style="clear: both"><a name=
! 5482: "id2567089" id="id2567089"></a>8.6. Changing
! 5483: PLIST source with <tt class=
! 5484: "varname">PLIST_SRC</tt></h2>
! 5485: </div>
! 5486: </div>
! 5487: </div>
! 5488:
! 5489: <p>To use one or more files as source for the <tt class=
! 5490: "filename">PLIST</tt> used in generating the binary
! 5491: package, set the variable <tt class=
! 5492: "varname">PLIST_SRC</tt> to the names of that file(s).
! 5493: The files are later concatenated using cat(1), and order
! 5494: of things is important.</p>
! 5495: </div>
! 5496:
! 5497: <div class="sect1" lang="en" xml:lang="en">
! 5498: <div class="titlepage">
! 5499: <div>
! 5500: <div>
! 5501: <h2 class="title" style="clear: both"><a name=
! 5502: "id2567106" id="id2567106"></a>8.7. Platform
! 5503: specific and differing PLISTs</h2>
! 5504: </div>
! 5505: </div>
! 5506: </div>
! 5507:
! 5508: <p>Some packages decide to install a different set of
! 5509: files based on the operating system being used. These
! 5510: differences can be automatically handled by using the
! 5511: following files:</p>
! 5512:
! 5513: <div class="itemizedlist">
! 5514: <ul type="disc">
! 5515: <li>
! 5516: <p><tt class="filename">PLIST.common</tt></p>
! 5517: </li>
! 5518:
! 5519: <li>
! 5520: <p><tt class="filename">PLIST.${OPSYS}</tt></p>
! 5521: </li>
! 5522:
! 5523: <li>
! 5524: <p><tt class="filename">PLIST.common_end</tt></p>
! 5525: </li>
! 5526: </ul>
! 5527: </div>
! 5528:
! 5529: <p>If <tt class="filename">PLIST.${OPSYS}</tt> exists,
! 5530: these files are used instead of <tt class=
! 5531: "filename">PLIST</tt>. This allows packages which behave
! 5532: in this way to be handled gracefully. Manually overriding
! 5533: <tt class="varname">PLIST_SRC</tt> for other more exotic
! 5534: uses is also possible.</p>
! 5535: </div>
! 5536:
! 5537: <div class="sect1" lang="en" xml:lang="en">
! 5538: <div class="titlepage">
! 5539: <div>
! 5540: <div>
! 5541: <h2 class="title" style="clear: both"><a name=
! 5542: "faq.common-dirs" id=
! 5543: "faq.common-dirs"></a>8.8. Sharing directories
! 5544: between packages</h2>
! 5545: </div>
! 5546: </div>
! 5547: </div>
! 5548:
! 5549: <p>A “<span class="quote">shared
! 5550: directory</span>” is a directory where multiple
! 5551: (and unrelated) packages install files. These directories
! 5552: are problematic because you have to add special tricks in
! 5553: the PLIST to conditionally remove them, or have some
! 5554: centralized package handle them.</p>
! 5555:
! 5556: <p>Within pkgsrc, you'll find both approaches. If a
! 5557: directory is shared by a few unrelated packages, it's
! 5558: often not worth to add an extra package to remove it.
! 5559: Therefore, one simply does:</p>
! 5560: <pre class="programlisting">
! 5561: @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
! 5562:
! 5563: </pre>
! 5564:
! 5565: <p>in the PLISTs of all affected packages, instead of the
! 5566: regular "@dirrm" line.</p>
! 5567:
! 5568: <p>However, if the directory is shared across many
! 5569: packages, two different solutions are available:</p>
! 5570:
! 5571: <div class="orderedlist">
! 5572: <ol type="1">
! 5573: <li>
! 5574: <p>If the packages have a common dependency, the
! 5575: directory can be removed in that. For example, see
! 5576: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 5577: href=
! 5578: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
! 5579: class="pkgname">textproc/scrollkeeper</a>, which
! 5580: removes the shared directory <tt class=
! 5581: "filename">share/omf</tt>.</p>
! 5582: </li>
! 5583:
! 5584: <li>
! 5585: <p>If the packages using the directory are not
! 5586: related at all (they have no common dependencies),
! 5587: a *-dirs package is used.</p>
! 5588: </li>
! 5589: </ol>
! 5590: </div>
! 5591:
! 5592: <p>From now on, we'll discuss the second solution. To get
! 5593: an idea of the *-dirs packages available, issue:</p>
! 5594: <pre class="programlisting">
! 5595: <tt class="prompt">%</tt> cd .../pkgsrc
! 5596: <tt class="prompt">%</tt> ls -d */*-dirs
! 5597:
! 5598: </pre>
! 5599:
! 5600: <p>Their use from other packages is very simple. The
! 5601: <tt class="varname">USE_DIRS</tt> variable takes a list
! 5602: of package names (without the “<span class=
! 5603: "quote">-dirs</span>” part) together with the
! 5604: required version number (always pick the latest one when
! 5605: writting new packages).</p>
! 5606:
! 5607: <p>For example, if a package installs files under
! 5608: <tt class="filename">share/applications</tt>, it should
! 5609: have the following line in it:</p>
! 5610: <pre class="programlisting">
! 5611: USE_DIRS+= xdg-1.1
! 5612:
! 5613: </pre>
! 5614:
! 5615: <p>After regenerating the PLIST using <span><b class=
! 5616: "command">make print-PLIST</b></span>, you should get the
! 5617: right (commented out) lines.</p>
! 5618:
! 5619: <p>Note that, even if your package is using <tt class=
! 5620: "filename">$X11BASE</tt>, it must not depend on the
! 5621: *-x11-dirs packages. Just specify the name without that
! 5622: part and pkgsrc (in particular, <tt class=
! 5623: "filename">mk/dirs.mk</tt>) will take care of it.</p>
! 5624: </div>
! 5625: </div>
! 5626:
! 5627: <div class="chapter" lang="en" xml:lang="en">
! 5628: <div class="titlepage">
! 5629: <div>
! 5630: <div>
! 5631: <h2 class="title"><a name="buildlink" id=
! 5632: "buildlink"></a>Chapter 9. Buildlink
! 5633: methodology</h2>
! 5634: </div>
! 5635: </div>
! 5636: </div>
! 5637:
! 5638: <div class="toc">
! 5639: <p><b>Table of Contents</b></p>
! 5640:
! 5641: <dl>
! 5642: <dt><span class="sect1"><a href="#id2567378">9.1.
! 5643: Converting packages to use buildlink3</a></span></dt>
! 5644:
! 5645: <dt><span class="sect1"><a href="#id2567637">9.2.
! 5646: Writing buildlink3.mk files</a></span></dt>
! 5647:
! 5648: <dd>
! 5649: <dl>
! 5650: <dt><span class="sect2"><a href="#id2567774">9.2.1.
! 5651: Anatomy of a buildlink3.mk file</a></span></dt>
! 5652:
! 5653: <dt><span class="sect2"><a href="#id2568283">9.2.2.
! 5654: Updating BUILDLINK_DEPENDS.pkg in buildlink3.mk
! 5655: files</a></span></dt>
! 5656: </dl>
! 5657: </dd>
! 5658:
! 5659: <dt><span class="sect1"><a href="#id2568362">9.3.
! 5660: Writing builtin.mk files</a></span></dt>
! 5661:
! 5662: <dd>
! 5663: <dl>
! 5664: <dt><span class="sect2"><a href="#id2568512">9.3.1.
! 5665: Anatomy of a builtin.mk file</a></span></dt>
! 5666:
! 5667: <dt><span class="sect2"><a href="#id2568739">9.3.2.
! 5668: Global preferences for native or pkgsrc
! 5669: software</a></span></dt>
! 5670: </dl>
! 5671: </dd>
! 5672: </dl>
! 5673: </div>
! 5674:
! 5675: <p>Buildlink is a framework in pkgsrc that controls what
! 5676: headers and libraries are seen by a package's configure and
! 5677: build processes. This is implemented in a two step
! 5678: process:</p>
! 5679:
! 5680: <div class="orderedlist">
! 5681: <ol type="1">
! 5682: <li>
! 5683: <p>Symlink headers and libraries for dependencies
! 5684: into <tt class="varname">BUILDLINK_DIR</tt>, which by
! 5685: default is a subdirectory of <tt class=
! 5686: "varname">WRKDIR</tt>.</p>
! 5687: </li>
! 5688:
! 5689: <li>
! 5690: <p>Create wrapper scripts that are used in place of
! 5691: the normal compiler tools that translate <tt class=
! 5692: "option">-I${LOCALBASE}/include</tt> and <tt class=
! 5693: "option">-L${LOCALBASE}/lib</tt> into references to
! 5694: <tt class="varname">BUILDLINK_DIR</tt>. The wrapper
! 5695: scripts also make native compiler on some operating
! 5696: systems look like GCC, so that packages that expect
! 5697: GCC won't require modifications to build with those
! 5698: native compilers.</p>
! 5699: </li>
! 5700: </ol>
! 5701: </div>
! 5702:
! 5703: <p>This normalizes the environment in which a package is
! 5704: built so that the package may be built consistently despite
! 5705: what other software may be installed. Please note that the
! 5706: normal system header and library paths, e.g. <tt class=
! 5707: "filename">/usr/include</tt>, <tt class=
! 5708: "filename">/usr/lib</tt>, etc., are always searched --
! 5709: buildlink3 is designed to insulate the package build from
! 5710: non-system-supplied software.</p>
! 5711:
! 5712: <div class="sect1" lang="en" xml:lang="en">
! 5713: <div class="titlepage">
! 5714: <div>
! 5715: <div>
! 5716: <h2 class="title" style="clear: both"><a name=
! 5717: "id2567378" id="id2567378"></a>9.1. Converting
! 5718: packages to use buildlink3</h2>
! 5719: </div>
! 5720: </div>
! 5721: </div>
! 5722:
! 5723: <p>The process of converting packages to use the
! 5724: buildlink3 framework (“<span class=
! 5725: "quote">bl3ifying</span>”) is fairly
! 5726: straightforward. The things to keep in mind are:</p>
! 5727:
! 5728: <div class="orderedlist">
! 5729: <ol type="1">
! 5730: <li>
! 5731: <p>Set <tt class="varname">USE_BUILDLINK3</tt> to
! 5732: “<span class="quote">yes</span>”.</p>
! 5733: </li>
! 5734:
! 5735: <li>
! 5736: <p>Ensure that the build always calls the wrapper
! 5737: scripts instead of the actual toolchain. Some
! 5738: packages are tricky, and the only way to know for
! 5739: sure is the check <tt class=
! 5740: "filename">${WRKDIR}/.work.log</tt> to see if the
! 5741: wrappers are being invoked.</p>
! 5742: </li>
! 5743:
! 5744: <li>
! 5745: <p>Don't override <tt class="varname">PREFIX</tt>
! 5746: from within the package Makefile, e.g. Java VMs,
! 5747: standalone shells, etc., because the code to
! 5748: symlink files into <tt class=
! 5749: "filename">${BUILDLINK_DIR}</tt> looks for files
! 5750: relative to “<span class="quote">pkg_info -qp
! 5751: <i class=
! 5752: "replaceable"><tt>pkgname</tt></i></span>”.</p>
! 5753: </li>
! 5754:
! 5755: <li>
! 5756: <p>Remember that <span class=
! 5757: "emphasis"><em>only</em></span> the <tt class=
! 5758: "filename">buildlink3.mk</tt> files that you list
! 5759: in a package's Makefile are added as dependencies
! 5760: for that package.</p>
! 5761: </li>
! 5762: </ol>
! 5763: </div>
! 5764:
! 5765: <p>If a dependency on a particular package is required
! 5766: for its libraries and headers, then we replace:</p>
! 5767: <pre class="programlisting">
! 5768: DEPENDS+= foo>=1.1.0:../../category/foo
! 5769: </pre>
! 5770:
! 5771: <p>with</p>
! 5772: <pre class="programlisting">
! 5773: .include "../../category/foo/buildlink3.mk"
! 5774: </pre>
! 5775:
! 5776: <p>There are several <tt class=
! 5777: "filename">buildlink3.mk</tt> files in <tt class=
! 5778: "filename">pkgsrc/mk</tt> that handle special package
! 5779: issues:</p>
! 5780:
! 5781: <div class="itemizedlist">
! 5782: <ul type="disc">
! 5783: <li>
! 5784: <p><tt class="filename">bdb.buildlink3.mk</tt>
! 5785: chooses either the native or a pkgsrc Berkeley DB
! 5786: implementation based on the values of <tt class=
! 5787: "varname">BDB_ACCEPTED</tt> and <tt class=
! 5788: "varname">BDB_DEFAULT</tt>.</p>
! 5789: </li>
! 5790:
! 5791: <li>
! 5792: <p><tt class="filename">curses.buildlink3.mk</tt>
! 5793: If the system comes with neither Curses nor
! 5794: NCurses, this will take care to install the
! 5795: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 5796: href=
! 5797: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
! 5798: class="pkgname">devel/ncurses</a> package.</p>
! 5799: </li>
! 5800:
! 5801: <li>
! 5802: <p><tt class="filename">krb5.buildlink3.mk</tt>
! 5803: uses the value of <tt class=
! 5804: "varname">KRB5_ACCEPTED</tt> to choose between
! 5805: adding a dependency on Heimdal or MIT-krb5 for
! 5806: packages that require a Kerberos 5
! 5807: implementation.</p>
! 5808: </li>
! 5809:
! 5810: <li>
! 5811: <p><tt class="filename">motif.buildlink3.mk</tt>
! 5812: checks for a system-provided Motif installation or
! 5813: adds a dependency on <a xmlns=
! 5814: "http://www.w3.org/TR/xhtml1/transitional" href=
! 5815: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
! 5816: class="pkgname">x11/lesstif</a> or <a xmlns=
! 5817: "http://www.w3.org/TR/xhtml1/transitional" href=
! 5818: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
! 5819: class="pkgname">x11/openmotif</a>;</p>
! 5820: </li>
! 5821:
! 5822: <li>
! 5823: <p><tt class="filename">ossaudio.buildlink3.mk</tt>
! 5824: defines several variables that may be used by
! 5825: packages that use the Open Sound System (OSS)
! 5826: API;</p>
! 5827: </li>
! 5828:
! 5829: <li>
! 5830: <p><tt class="filename">pgsql.buildlink3.mk</tt>
! 5831: will accept either Postgres 7.3 or 7.4, whichever
! 5832: is found installed. See the file for more
! 5833: information.</p>
! 5834: </li>
! 5835:
! 5836: <li>
! 5837: <p><tt class="filename">pthread.buildlink3.mk</tt>
! 5838: uses the value of <tt class=
! 5839: "varname">PTHREAD_OPTS</tt> and checks for native
! 5840: pthreads or adds a dependency on <a xmlns=
! 5841: "http://www.w3.org/TR/xhtml1/transitional" href=
! 5842: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
! 5843: class="pkgname">devel/pth</a> as needed;</p>
! 5844: </li>
! 5845:
! 5846: <li>
! 5847: <p><tt class="filename">xaw.buildlink3.mk</tt> uses
! 5848: the value of <tt class="varname">XAW_TYPE</tt> to
! 5849: choose a particular Athena widgets library.</p>
! 5850: </li>
! 5851: </ul>
! 5852: </div>
! 5853:
! 5854: <p>The comments in those <tt class=
! 5855: "filename">buildlink3.mk</tt> files provide a more
! 5856: complete description of how to use them properly.</p>
! 5857: </div>
! 5858:
! 5859: <div class="sect1" lang="en" xml:lang="en">
! 5860: <div class="titlepage">
! 5861: <div>
! 5862: <div>
! 5863: <h2 class="title" style="clear: both"><a name=
! 5864: "id2567637" id="id2567637"></a>9.2. Writing
! 5865: <tt class="filename">buildlink3.mk</tt> files</h2>
! 5866: </div>
! 5867: </div>
! 5868: </div>
! 5869:
! 5870: <p>A package's <tt class="filename">buildlink3.mk</tt>
! 5871: file is included by Makefiles to indicate the need to
! 5872: compile and link against header files and libraries
! 5873: provided by the package. A <tt class=
! 5874: "filename">buildlink3.mk</tt> file should always provide
! 5875: enough information to add the correct type of dependency
! 5876: relationship and include any other <tt class=
! 5877: "filename">buildlink3.mk</tt> files that it needs to find
! 5878: headers and libraries that it needs in turn.</p>
! 5879:
! 5880: <p>To generate an initial <tt class=
! 5881: "filename">buildlink3.mk</tt> file for further editing,
! 5882: Rene Hexel's <a xmlns=
! 5883: "http://www.w3.org/TR/xhtml1/transitional" href=
! 5884: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
! 5885: class="pkgname">pkgtools/createbuildlink</a> package is
! 5886: highly recommended. For most packages, the following
! 5887: command will generate a good starting point for
! 5888: <tt class="filename">buildlink3.mk</tt> files:</p>
! 5889: <pre class="screen">
! 5890: <tt class="prompt">%</tt> <b class=
! 5891: "userinput"><tt>cd pkgsrc/<i class=
! 5892: "replaceable"><tt>category</tt></i>/<i class=
! 5893: "replaceable"><tt>pkgdir</tt></i>
! 5894: <tt class=
! 5895: "prompt">%</tt> createbuildlink -3 >buildlink3.mk</tt></b>
! 5896: </pre>
! 5897:
! 5898: <div class="sect2" lang="en" xml:lang="en">
! 5899: <div class="titlepage">
! 5900: <div>
! 5901: <div>
! 5902: <h3 class="title"><a name="id2567774" id=
! 5903: "id2567774"></a>9.2.1. Anatomy of a buildlink3.mk
! 5904: file</h3>
! 5905: </div>
! 5906: </div>
! 5907: </div>
! 5908:
! 5909: <p>The following real-life example <tt class=
! 5910: "filename">buildlink3.mk</tt> is taken from <tt class=
! 5911: "filename">pkgsrc/graphics/tiff</tt>:</p>
! 5912: <pre class="programlisting">
! 5913: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
! 5914:
! 5915: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
! 5916: TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
! 5917:
! 5918: .if !empty(BUILDLINK_DEPTH:M+)
! 5919: BUILDLINK_DEPENDS+= tiff
! 5920: .endif
! 5921:
! 5922: BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff}
! 5923: BUILDLINK_PACKAGES+= tiff
! 5924:
! 5925: .if !empty(TIFF_BUILDLINK3_MK:M+)
! 5926: BUILDLINK_DEPENDS.tiff+= tiff>=3.6.1
! 5927: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
! 5928: .endif # TIFF_BUILDLINK3_MK
! 5929:
! 5930: .include "../../devel/zlib/buildlink3.mk"
! 5931: .include "../../graphics/jpeg/buildlink3.mk"
! 5932:
! 5933: BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
! 5934: </pre>
! 5935:
! 5936: <p>The header and footer manipulate <tt class=
! 5937: "varname">BUILDLINK_DEPTH</tt>, which is common across
! 5938: all <tt class="filename">buildlink3.mk</tt> files and
! 5939: is used to track at what depth we are including
! 5940: <tt class="filename">buildlink3.mk</tt> files.</p>
! 5941:
! 5942: <p>The first section controls if the dependency on
! 5943: <i class="replaceable"><tt>pkg</tt></i> is added.
! 5944: <tt class="varname">BUILDLINK_DEPENDS</tt> is the
! 5945: global list of packages for which dependencies are
! 5946: added by buildlink3.</p>
! 5947:
! 5948: <p>The second section advises pkgsrc that the
! 5949: <tt class="filename">buildlink3.mk</tt> file for
! 5950: <i class="replaceable"><tt>pkg</tt></i> has been
! 5951: included at some point. <tt class=
! 5952: "varname">BUILDLINK_PACKAGES</tt> is the global list of
! 5953: packages for which <tt class=
! 5954: "filename">buildlink3.mk</tt> files have been included.
! 5955: It must <span class="emphasis"><em>always</em></span>
! 5956: be appended to within a <tt class=
! 5957: "filename">buildlink3.mk</tt> file.</p>
! 5958:
! 5959: <p>The third section is protected from multiple
! 5960: inclusion and controls how the dependency on <i class=
! 5961: "replaceable"><tt>pkg</tt></i> is added. Several
! 5962: important variables are set in the section:</p>
! 5963:
! 5964: <div class="itemizedlist">
! 5965: <ul type="disc">
! 5966: <li>
! 5967: <p><tt class=
! 5968: "varname">BUILDLINK_DEPENDS.<i class="replaceable">
! 5969: <tt>pkg</tt></i></tt> is the actual dependency
! 5970: recorded in the installed package; this should
! 5971: always be set using <span><b class=
! 5972: "command">+=</b></span> to ensure that we're
! 5973: appending to any pre-existing list of values.
! 5974: This variable should be set to the first version
! 5975: of the package that had the last change in the
! 5976: major number of a shared library or that had a
! 5977: major API change.</p>
! 5978: </li>
! 5979:
! 5980: <li>
! 5981: <p><tt class=
! 5982: "varname">BUILDLINK_PKGSRCDIR.<i class=
! 5983: "replaceable"><tt>pkg</tt></i></tt> is the
! 5984: location of the <i class=
! 5985: "replaceable"><tt>pkg</tt></i> pkgsrc
! 5986: directory;</p>
! 5987: </li>
! 5988:
! 5989: <li>
! 5990: <p><tt class=
! 5991: "varname">BUILDLINK_DEPMETHOD.<i class=
! 5992: "replaceable"><tt>pkg</tt></i></tt> (not shown
! 5993: above) controls whether we use <tt class=
! 5994: "varname">BUILD_DEPENDS</tt> or <tt class=
! 5995: "varname">DEPENDS</tt> to add the dependency on
! 5996: <i class="replaceable"><tt>pkg</tt></i>. The
! 5997: build dependency is selected by setting
! 5998: <tt class="varname">BUILDLINK_DEPMETHOD.<i class=
! 5999: "replaceable"><tt>pkg</tt></i></tt> to
! 6000: “<span class="quote">build</span>”.
! 6001: By default, the full dependency is used.</p>
! 6002: </li>
! 6003:
! 6004: <li>
! 6005: <p><tt class=
! 6006: "varname">BUILDLINK_INCDIRS.<i class="replaceable">
! 6007: <tt>pkg</tt></i></tt> and <tt class=
! 6008: "varname">BUILDLINK_LIBDIRS.<i class=
! 6009: "replaceable"><tt>pkg</tt></i></tt> (not shown
! 6010: above) are lists of subdirectories of <tt class=
! 6011: "filename">${BUILDLINK_PREFIX.<i class=
! 6012: "replaceable"><tt>pkg</tt></i>}</tt> to add to
! 6013: the header and library search paths. These
! 6014: default to “<span class=
! 6015: "quote">include</span>” and
! 6016: “<span class="quote">lib</span>”
! 6017: respectively.</p>
! 6018: </li>
! 6019:
! 6020: <li>
! 6021: <p><tt class=
! 6022: "varname">BUILDLINK_CPPFLAGS.<i class=
! 6023: "replaceable"><tt>pkg</tt></i></tt> (not shown
! 6024: above) is the list of preprocessor flags to add
! 6025: to <tt class="varname">CPPFLAGS</tt>, which are
! 6026: passed on to the configure and build phases. The
! 6027: “<span class="quote">-I</span>”
! 6028: option should be avoided and instead be handled
! 6029: using <tt class=
! 6030: "varname">BUILDLINK_INCDIRS.<i class=
! 6031: "replaceable"><tt>pkg</tt></i></tt> as above.</p>
! 6032: </li>
! 6033: </ul>
! 6034: </div>
! 6035:
! 6036: <p>The following variables are all optionally defined
! 6037: within this second section (protected against multiple
! 6038: inclusion) and control which package files are
! 6039: symlinked into <tt class=
! 6040: "filename">${BUILDLINK_DIR}</tt> and how their names
! 6041: are transformed during the symlinking:</p>
! 6042:
! 6043: <div class="itemizedlist">
! 6044: <ul type="disc">
! 6045: <li>
! 6046: <p><tt class="varname">BUILDLINK_FILES.<i class=
! 6047: "replaceable"><tt>pkg</tt></i></tt> (not shown
! 6048: above) is a shell glob pattern relative to
! 6049: <tt class="filename">${BUILDLINK_PREFIX.<i class=
! 6050: "replaceable"><tt>pkg</tt></i>}</tt> to be
! 6051: symlinked into <tt class=
! 6052: "filename">${BUILDLINK_DIR}</tt>, e.g. <tt class=
! 6053: "filename">include/*.h</tt>.</p>
! 6054: </li>
! 6055:
! 6056: <li>
! 6057: <p><tt class=
! 6058: "varname">BUILDLINK_FILES_CMD.<i class=
! 6059: "replaceable"><tt>pkg</tt></i></tt> (not shown
! 6060: above) is a shell pipeline that outputs to stdout
! 6061: a list of files relative to <tt class=
! 6062: "filename">${BUILDLINK_PREFIX.<i class=
! 6063: "replaceable"><tt>pkg</tt></i>}</tt>. The
! 6064: resulting files are to be symlinked into
! 6065: <tt class="filename">${BUILDLINK_DIR}</tt>. By
! 6066: default, this takes the <tt class=
! 6067: "filename">+CONTENTS</tt> of a <i class=
! 6068: "replaceable"><tt>pkg</tt></i> and filters it
! 6069: through <tt class=
! 6070: "varname">${BUILDLINK_CONTENTS_FILTER.<i class=
! 6071: "replaceable"><tt>pkg</tt></i>}</tt>.</p>
! 6072: </li>
! 6073:
! 6074: <li>
! 6075: <p><tt class=
! 6076: "varname">BUILDLINK_CONTENTS_FILTER.<i class=
! 6077: "replaceable"><tt>pkg</tt></i></tt> (not shown
! 6078: above) is a filter command that filters
! 6079: <tt class="filename">+CONTENTS</tt> input into a
! 6080: list of files relative to <tt class=
! 6081: "filename">${BUILDLINK_PREFIX.<i class=
! 6082: "replaceable"><tt>pkg</tt></i>}</tt> on stdout.
! 6083: By default for overwrite packages, <tt class=
! 6084: "varname">BUILDLINK_CONTENTS_FILTER.<i class=
! 6085: "replaceable"><tt>pkg</tt></i></tt> outputs the
! 6086: contents of the <tt class="filename">include</tt>
! 6087: and <tt class="filename">lib</tt> directories in
! 6088: the package <tt class="filename">+CONTENTS</tt>,
! 6089: and for pkgviews packages, it outputs any libtool
! 6090: archives in <tt class="filename">lib</tt>
! 6091: directories.</p>
! 6092: </li>
! 6093:
! 6094: <li>
! 6095: <p><tt class=
! 6096: "varname">BUILDLINK_TRANSFORM.<i class=
! 6097: "replaceable"><tt>pkg</tt></i></tt> (not shown
! 6098: above) is a list of sed arguments used to
! 6099: transform the name of the source filename into a
! 6100: destination filename, e.g. <span><b class=
! 6101: "command">-e
! 6102: "s|/curses.h|/ncurses.h|g"</b></span>.</p>
! 6103: </li>
! 6104: </ul>
! 6105: </div>
! 6106:
! 6107: <p>The last section includes any <tt class=
! 6108: "filename">buildlink3.mk</tt> needed for <i class=
! 6109: "replaceable"><tt>pkg</tt></i>'s library dependencies.
! 6110: Including these <tt class="filename">buildlink3.mk</tt>
! 6111: files means that the headers and libraries for these
! 6112: dependencies are also symlinked into <tt class=
! 6113: "filename">${BUILDLINK_DIR}</tt> whenever the <i class=
! 6114: "replaceable"><tt>pkg</tt></i> <tt class=
! 6115: "filename">buildlink3.mk</tt> file is included.</p>
! 6116: </div>
! 6117:
! 6118: <div class="sect2" lang="en" xml:lang="en">
! 6119: <div class="titlepage">
! 6120: <div>
! 6121: <div>
! 6122: <h3 class="title"><a name="id2568283" id=
! 6123: "id2568283"></a>9.2.2. Updating <tt class=
! 6124: "varname">BUILDLINK_DEPENDS.<i class=
! 6125: "replaceable"><tt>pkg</tt></i></tt> in <tt class=
! 6126: "filename">buildlink3.mk</tt> files</h3>
! 6127: </div>
! 6128: </div>
! 6129: </div>
! 6130:
! 6131: <p>There are two situations that require increasing the
! 6132: dependency listed in <tt class=
! 6133: "varname">BUILDLINK_DEPENDS.<i class=
! 6134: "replaceable"><tt>pkg</tt></i></tt> after a package
! 6135: update:</p>
! 6136:
! 6137: <div class="orderedlist">
! 6138: <ol type="1">
! 6139: <li>
! 6140: <p>if the sonames (major number of the library
! 6141: version) of any installed shared libraries
! 6142: change;</p>
! 6143: </li>
! 6144:
! 6145: <li>
! 6146: <p>if the API or interface to the header files
! 6147: change.</p>
! 6148: </li>
! 6149: </ol>
! 6150: </div>
! 6151:
! 6152: <p>In these cases, <tt class=
! 6153: "varname">BUILDLINK_DEPENDS.<i class=
! 6154: "replaceable"><tt>pkg</tt></i></tt> should be adjusted
! 6155: to require at least the new package version. In some
! 6156: cases, the packages that depend on this new version may
! 6157: need their <tt class="varname">PKGREVISION</tt>s
! 6158: increased and, if they have <tt class=
! 6159: "filename">buildlink3.mk</tt> files, their <tt class=
! 6160: "varname">BUILDLINK_DEPENDS.<i class=
! 6161: "replaceable"><tt>pkg</tt></i></tt> adjusted, too. This
! 6162: is needed so that binary packages made using it will
! 6163: require the correct package dependency and not settle
! 6164: for an older one which will not contain the necessary
! 6165: shared libraries.</p>
! 6166:
! 6167: <p>Please take careful consideration before adjusting
! 6168: <tt class="varname">BUILDLINK_DEPENDS.<i class=
! 6169: "replaceable"><tt>pkg</tt></i></tt> as we don't want to
! 6170: cause unneeded package deletions and rebuilds. In many
! 6171: cases, new versions of packages work just fine with
! 6172: older dependencies. See <a href="#dependencies" title=
! 6173: "12.1.3. Handling dependencies">Section 12.1.3,
! 6174: “Handling dependencies”</a> and <a href=
! 6175: "#buildlink" title=
! 6176: "Chapter 9. Buildlink methodology">Chapter 9,
! 6177: <i>Buildlink methodology</i></a> for more information
! 6178: about dependencies on other packages, including the
! 6179: <tt class="varname">BUILDLINK_RECOMMENDED</tt> and
! 6180: <tt class="varname">RECOMMENDED</tt> definitions.</p>
! 6181: </div>
! 6182: </div>
! 6183:
! 6184: <div class="sect1" lang="en" xml:lang="en">
! 6185: <div class="titlepage">
! 6186: <div>
! 6187: <div>
! 6188: <h2 class="title" style="clear: both"><a name=
! 6189: "id2568362" id="id2568362"></a>9.3. Writing
! 6190: <tt class="filename">builtin.mk</tt> files</h2>
! 6191: </div>
! 6192: </div>
! 6193: </div>
! 6194:
! 6195: <p>Some packages in pkgsrc install headers and libraries
! 6196: that coincide with headers and libraries present in the
! 6197: base system. Aside from a <tt class=
! 6198: "filename">buildlink3.mk</tt> file, these packages should
! 6199: also include a <tt class="filename">builtin.mk</tt> file
! 6200: that includes the necessary checks to decide whether
! 6201: using the built-in software or the pkgsrc software is
! 6202: appropriate.</p>
! 6203:
! 6204: <p>The only requirements of a builtin.mk file for
! 6205: <i class="replaceable"><tt>pkg</tt></i> are:</p>
! 6206:
! 6207: <div class="orderedlist">
! 6208: <ol type="1">
! 6209: <li>
! 6210: <p>It should set <tt class=
! 6211: "varname">USE_BUILTIN.<i class=
! 6212: "replaceable"><tt>pkg</tt></i></tt> to either
! 6213: “<span class="quote">yes</span>” or
! 6214: “<span class="quote">no</span>” after
! 6215: it is included.</p>
! 6216: </li>
! 6217:
! 6218: <li>
! 6219: <p>It should <span class=
! 6220: "emphasis"><em>not</em></span> override any
! 6221: <tt class="varname">USE_BUILTIN.<i class=
! 6222: "replaceable"><tt>pkg</tt></i></tt> which is
! 6223: already set before the <tt class=
! 6224: "filename">builtin.mk</tt> file is included.</p>
! 6225: </li>
! 6226:
! 6227: <li>
! 6228: <p>It should be written to allow multiple
! 6229: inclusion. This is <span class=
! 6230: "emphasis"><em>very</em></span> important and takes
! 6231: careful attention to <tt class=
! 6232: "filename">Makefile</tt> coding.</p>
! 6233: </li>
! 6234: </ol>
! 6235: </div>
! 6236:
! 6237: <div class="sect2" lang="en" xml:lang="en">
! 6238: <div class="titlepage">
! 6239: <div>
! 6240: <div>
! 6241: <h3 class="title"><a name="id2568512" id=
! 6242: "id2568512"></a>9.3.1. Anatomy of a
! 6243: <tt class="filename">builtin.mk</tt> file</h3>
! 6244: </div>
! 6245: </div>
! 6246: </div>
! 6247:
! 6248: <p>The following is the recommended template for
! 6249: builtin.mk files:</p>
! 6250: <pre class="programlisting">
! 6251: .if !defined(IS_BUILTIN.foo)
! 6252: #
! 6253: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
! 6254: # genuinely exists in the system or not.
! 6255: #
! 6256: IS_BUILTIN.foo?= no
! 6257:
! 6258: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
! 6259: # version can be determined.
! 6260: #
! 6261: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
! 6262: BUILTIN_PKG.foo?= foo-1.0
! 6263: . endif
! 6264: .endif # IS_BUILTIN.foo
! 6265:
! 6266: .if !defined(USE_BUILTIN.foo)
! 6267: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
! 6268: . if defined(BUILTIN_PKG.foo)
! 6269: . for _depend_ in ${BUILDLINK_DEPENDS.foo}
! 6270: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
! 6271: USE_BUILTIN.foo!= \
! 6272: if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \
! 6273: ${ECHO} "yes"; \
! 6274: else \
! 6275: ${ECHO} "no"; \
! 6276: fi
! 6277: . endif
! 6278: . endfor
! 6279: . endif
! 6280: .endif # USE_BUILTIN.foo
! 6281:
! 6282: CHECK_BUILTIN.foo?= no
! 6283: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
! 6284: #
! 6285: # Here we place code that depends on whether USE_BUILTIN.foo is set to
! 6286: # "yes" or "no".
! 6287: #
! 6288: .endif # CHECK_BUILTIN.foo
! 6289:
! 6290: </pre>
! 6291:
! 6292: <p>The first section sets <tt class=
! 6293: "varname">IS_BUILTIN.<i class=
! 6294: "replaceable"><tt>pkg</tt></i></tt> depending on if
! 6295: <i class="replaceable"><tt>pkg</tt></i> really exists
! 6296: in the base system. This should not be a base system
! 6297: software with similar functionality to <i class=
! 6298: "replaceable"><tt>pkg</tt></i>; it should only be
! 6299: “<span class="quote">yes</span>” if the
! 6300: actual package is included as part of the base system.
! 6301: This variable is only used internally within the
! 6302: <tt class="filename">builtin.mk</tt> file.</p>
! 6303:
! 6304: <p>The second section sets <tt class=
! 6305: "varname">BUILTIN_PKG.<i class=
! 6306: "replaceable"><tt>pkg</tt></i></tt> to the version of
! 6307: <i class="replaceable"><tt>pkg</tt></i> in the base
! 6308: system if it exists (if <tt class=
! 6309: "varname">IS_BUILTIN.<i class=
! 6310: "replaceable"><tt>pkg</tt></i></tt> is
! 6311: “<span class="quote">yes</span>”). This
! 6312: variable is only used internally within the <tt class=
! 6313: "filename">builtin.mk</tt> file.</p>
! 6314:
! 6315: <p>The third section sets <tt class=
! 6316: "varname">USE_BUILTIN.<i class=
! 6317: "replaceable"><tt>pkg</tt></i></tt> and is <span class=
! 6318: "emphasis"><em>required</em></span> in all <tt class=
! 6319: "filename">builtin.mk</tt> files. The code in this
! 6320: section must make the determination whether the
! 6321: built-in software is adequate to satisfy the
! 6322: dependencies listed in <tt class=
! 6323: "varname">BUILDLINK_DEPENDS.<i class=
! 6324: "replaceable"><tt>pkg</tt></i></tt>. This is typically
! 6325: done by comparing <tt class=
! 6326: "varname">BUILTIN_PKG.<i class=
! 6327: "replaceable"><tt>pkg</tt></i></tt> against each of the
! 6328: dependencies in <tt class=
! 6329: "varname">BUILDLINK_DEPENDS.<i class=
! 6330: "replaceable"><tt>pkg</tt></i></tt>. <tt class=
! 6331: "varname">USE_BUILTIN.<i class=
! 6332: "replaceable"><tt>pkg</tt></i></tt> <span class=
! 6333: "emphasis"><em>must</em></span> be set to the correct
! 6334: value by the end of the <tt class=
! 6335: "filename">builtin.mk</tt> file. Note that <tt class=
! 6336: "varname">USE_BUILTIN.<i class=
! 6337: "replaceable"><tt>pkg</tt></i></tt> may be
! 6338: “<span class="quote">yes</span>” even if
! 6339: <tt class="varname">IS_BUILTIN.<i class=
! 6340: "replaceable"><tt>pkg</tt></i></tt> is
! 6341: “<span class="quote">no</span>” because we
! 6342: may make the determination that the built-in version of
! 6343: the software is similar enough to be used as a
! 6344: replacement.</p>
! 6345:
! 6346: <p>The last section is guarded by <tt class=
! 6347: "varname">CHECK_BUILTIN.<i class=
! 6348: "replaceable"><tt>pkg</tt></i></tt>, and includes code
! 6349: that uses the value of <tt class=
! 6350: "varname">USE_BUILTIN.<i class=
! 6351: "replaceable"><tt>pkg</tt></i></tt> set in the previous
! 6352: section. This typically includes, e.g., adding
! 6353: additional dependency restrictions and listing
! 6354: additional files to symlink into <tt class=
! 6355: "filename">${BUILDLINK_DIR}</tt> (via <tt class=
! 6356: "varname">BUILDLINK_FILES.<i class=
! 6357: "replaceable"><tt>pkg</tt></i></tt>).</p>
! 6358: </div>
! 6359:
! 6360: <div class="sect2" lang="en" xml:lang="en">
! 6361: <div class="titlepage">
! 6362: <div>
! 6363: <div>
! 6364: <h3 class="title"><a name="id2568739" id=
! 6365: "id2568739"></a>9.3.2. Global preferences
! 6366: for native or pkgsrc software</h3>
! 6367: </div>
! 6368: </div>
! 6369: </div>
! 6370:
! 6371: <p>When building packages, it's possible to choose
! 6372: whether to set a global preference for using either the
! 6373: built-in (native) version or the pkgsrc version of
! 6374: software to satisfy a dependency. This is controlled by
! 6375: setting <tt class="varname">PREFER_PKGSRC</tt> and
! 6376: <tt class="varname">PREFER_NATIVE</tt>. These variables
! 6377: take values of either “<span class=
! 6378: "quote">yes</span>”, “<span class=
! 6379: "quote">no</span>”, or a list of packages.
! 6380: <tt class="varname">PREFER_PKGSRC</tt> tells pkgsrc to
! 6381: use the pkgsrc versions of software, while <tt class=
! 6382: "varname">PREFER_NATIVE</tt> tells pkgsrc to use the
! 6383: built-in versions. Preferences are determined by the
! 6384: most specific instance of the package in either
! 6385: <tt class="varname">PREFER_PKGSRC</tt> or <tt class=
! 6386: "varname">PREFER_NATIVE</tt>. If a package is specified
! 6387: in neither or in both variables, then <tt class=
! 6388: "varname">PREFER_PKGSRC</tt> has precedence over
! 6389: <tt class="varname">PREFER_NATIVE</tt>. For example, to
! 6390: require using pkgsrc versions of software for all but
! 6391: the most basic bits on a NetBSD system, you can
! 6392: set:</p>
! 6393: <pre class="programlisting">
! 6394: PREFER_PKGSRC= yes
! 6395: PREFER_NATIVE= getopt skey tcp_wrappers
! 6396:
! 6397: </pre>
! 6398:
! 6399: <p>A package <span class=
! 6400: "emphasis"><em>must</em></span> have a <tt class=
! 6401: "filename">builtin.mk</tt> file to be listed in
! 6402: <tt class="varname">PREFER_NATIVE</tt>, otherwise it is
! 6403: simply ignored in that list.</p>
! 6404: </div>
! 6405: </div>
! 6406: </div>
! 6407:
! 6408: <div class="chapter" lang="en" xml:lang="en">
! 6409: <div class="titlepage">
! 6410: <div>
! 6411: <div>
! 6412: <h2 class="title"><a name="options" id=
! 6413: "options"></a>Chapter 10. Options
! 6414: handling</h2>
! 6415: </div>
! 6416: </div>
! 6417: </div>
! 6418:
! 6419: <div class="toc">
! 6420: <p><b>Table of Contents</b></p>
! 6421:
! 6422: <dl>
! 6423: <dt><span class="sect1"><a href="#id2568811">10.1.
! 6424: Global default options</a></span></dt>
! 6425:
! 6426: <dt><span class="sect1"><a href="#id2568826">10.2.
! 6427: Converting packages to use
! 6428: bsd.options.mk</a></span></dt>
! 6429: </dl>
! 6430: </div>
! 6431:
! 6432: <p>Many packages have the ability to be built to support
! 6433: different sets of features. <tt class=
! 6434: "filename">bsd.options.mk</tt> is a framework in pkgsrc
! 6435: that provides generic handling of those options that
! 6436: determine different ways in which the packages can be
! 6437: built. It's possible for the user to specify exactly which
! 6438: sets of options will be built into a package or to allow a
! 6439: set of global default options apply.</p>
! 6440:
! 6441: <div class="sect1" lang="en" xml:lang="en">
! 6442: <div class="titlepage">
! 6443: <div>
! 6444: <div>
! 6445: <h2 class="title" style="clear: both"><a name=
! 6446: "id2568811" id="id2568811"></a>10.1. Global
! 6447: default options</h2>
! 6448: </div>
! 6449: </div>
! 6450: </div>
! 6451:
! 6452: <p>Global default options are listed in <tt class=
! 6453: "varname">PKG_DEFAULT_OPTIONS</tt>, which is a list of
! 6454: the options that should be built into every package if
! 6455: that option is supported. This variable should be set in
! 6456: <tt class="filename">/etc/mk.conf</tt>.</p>
! 6457: </div>
! 6458:
! 6459: <div class="sect1" lang="en" xml:lang="en">
! 6460: <div class="titlepage">
! 6461: <div>
! 6462: <div>
! 6463: <h2 class="title" style="clear: both"><a name=
! 6464: "id2568826" id=
! 6465: "id2568826"></a>10.2. Converting packages to
! 6466: use <tt class="filename">bsd.options.mk</tt></h2>
! 6467: </div>
! 6468: </div>
! 6469: </div>
! 6470:
! 6471: <p>The following example shows how <tt class=
! 6472: "filename">bsd.options.mk</tt> should be use in a package
! 6473: <tt class="filename">Makefile</tt>, or in a file, e.g.
! 6474: <tt class="filename">options.mk</tt>, that is included by
! 6475: the main package <tt class="filename">Makefile</tt>.</p>
! 6476: <pre class="programlisting">
! 6477: # Global and legacy options
! 6478: .if defined(WIBBLE_USE_OPENLDAP) && !empty(WIBBLE_USE_OPENLDAP:M[yY][eE][sS])
! 6479: PKG_DEFAULT_OPTIONS+= ldap
! 6480: .endif
! 6481: .if defined(USE_SASL2) && !empty(USE_SASL2:M[yY][eE][sS])
! 6482: PKG_DEFAULT_OPTIONS+= sasl
! 6483: .endif
! 6484:
! 6485: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
! 6486: PKG_SUPPORTED_OPTIONS= ldap sasl
! 6487: #
! 6488: # Default options for "wibble" package.
! 6489: #
! 6490: .if !defined(PKG_OPTIONS.wibble)
! 6491: PKG_DEFAULT_OPTIONS+= sasl
! 6492: endif
! 6493: .include "../../mk/bsd.options.mk"
! 6494:
! 6495: # Package-specific option-handling
! 6496:
! 6497: ###
! 6498: ### LDAP support
! 6499: ###
! 6500: .if !empty(PKG_OPTIONS:Mldap)
! 6501: . include "../../databases/openldap/buildlink3.mk"
! 6502: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap}
! 6503: .endif
! 6504:
! 6505: ###
! 6506: ### SASL authentication
! 6507: ###
! 6508: .if !empty(PKG_OPTIONS:Msasl)
! 6509: . include "../../security/cyrus-sasl2/buildlink3.mk"
! 6510: CONFIGURE_ARGS+= --enable-sasl=${BUILDLINK_PREFIX.sasl}
! 6511: .endif
! 6512:
! 6513: </pre>
! 6514:
! 6515: <p>The first section only exists if you are converting a
! 6516: package that had its own ad-hoc options handling to use
! 6517: <tt class="filename">bsd.options.mk</tt>. It converts
! 6518: global or legacy options variables into an equivalent
! 6519: <tt class="varname">PKG_OPTIONS.<i class=
! 6520: "replaceable"><tt>pkg</tt></i></tt> value. These sections
! 6521: will be removed over time as the old options are in turn
! 6522: deprecated and removed.</p>
! 6523:
! 6524: <p>The second section contains the information about
! 6525: which build options are supported by the package, and any
! 6526: default options settings if needed.</p>
! 6527:
! 6528: <div class="orderedlist">
! 6529: <ol type="1">
! 6530: <li>
! 6531: <p><tt class="varname">PKG_OPTIONS_VAR</tt> is a
! 6532: list of the name of the <a href=
! 6533: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
! 6534: <span class="citerefentry"><span class=
! 6535: "refentrytitle">make</span>(1)</span></a> variables
! 6536: that contain the options the user wishes to select.
! 6537: The recommended value is “<span class=
! 6538: "quote">PKG_OPTIONS.<i class=
! 6539: "replaceable"><tt>pkg</tt></i></span>” but
! 6540: any package-specific value may be used. This
! 6541: variable should be set in a package Makefile.</p>
! 6542: </li>
! 6543:
! 6544: <li>
! 6545: <p><tt class="varname">PKG_SUPPORTED_OPTIONS</tt>
! 6546: is a list of build options supported by the
! 6547: package. This variable should be set in a package
! 6548: Makefile.</p>
! 6549: </li>
! 6550:
! 6551: <li>
! 6552: <p><tt class="varname">${PKG_OPTIONS_VAR}</tt> (the
! 6553: variables named in <tt class=
! 6554: "varname">PKG_OPTIONS_VAR</tt>) are variables that
! 6555: list the selected build options and override any
! 6556: default options given in <tt class=
! 6557: "varname">PKG_DEFAULT_OPTIONS</tt>. If any of the
! 6558: options begin with a “<span class=
! 6559: "quote">-</span>”, then that option is always
! 6560: removed from the selected build options, e.g.</p>
! 6561: <pre class="programlisting">
! 6562: PKG_DEFAULT_OPTIONS= kerberos ldap sasl
! 6563: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
! 6564: WIBBLE_OPTIONS= ${PKG_DEFAULT_OPTIONS} -sasl
! 6565: # implies PKG_OPTIONS == "kerberos ldap"
! 6566:
! 6567: </pre>
! 6568:
! 6569: <p>or</p>
! 6570: <pre class="programlisting">
! 6571: PKG_OPTIONS_VAR= WIBBLE_OPTIONS
! 6572: WIBBLE_OPTIONS= kerberos -ldap ldap
! 6573: # implies PKG_OPTIONS == "kerberos"
! 6574:
! 6575: </pre>
! 6576:
! 6577: <p>This variable should be set in <tt class=
! 6578: "filename">/etc/mk.conf</tt>.</p>
! 6579: </li>
! 6580: </ol>
! 6581: </div>
! 6582:
! 6583: <p>After the inclusion of bsd.options.mk, the following
! 6584: variables are set:</p>
! 6585:
! 6586: <div class="itemizedlist">
! 6587: <ul type="disc">
! 6588: <li>
! 6589: <p><tt class="varname">PKG_OPTIONS</tt> contains
! 6590: the list of the selected build options, properly
! 6591: filtered to remove unsupported and duplicate
! 6592: options.</p>
! 6593: </li>
! 6594: </ul>
! 6595: </div>
! 6596:
! 6597: <p>The remaining sections contain the logic that is
! 6598: specific to each option. There should be a check for
! 6599: every option listed in <tt class=
! 6600: "varname">PKG_SUPPORTED_OPTIONS</tt>, and there should be
! 6601: clear documentation on what turning on the option will do
! 6602: in the comments preceding each section. The correct way
! 6603: to check for an option is to check whether it is listed
! 6604: in <tt class="varname">PKG_OPTIONS</tt>.</p>
! 6605: </div>
! 6606: </div>
! 6607:
! 6608: <div class="chapter" lang="en" xml:lang="en">
! 6609: <div class="titlepage">
! 6610: <div>
! 6611: <div>
! 6612: <h2 class="title"><a name="build" id=
! 6613: "build"></a>Chapter 11. The build
! 6614: process</h2>
! 6615: </div>
! 6616: </div>
! 6617: </div>
! 6618:
! 6619: <div class="toc">
! 6620: <p><b>Table of Contents</b></p>
! 6621:
! 6622: <dl>
! 6623: <dt><span class="sect1"><a href="#build.prefix">11.1.
! 6624: Program location</a></span></dt>
! 6625:
! 6626: <dt><span class="sect1"><a href="#id2569571">11.2. Main
! 6627: targets</a></span></dt>
! 6628:
! 6629: <dt><span class="sect1"><a href=
! 6630: "#build.helpful-targets">11.3. Other helpful
! 6631: targets</a></span></dt>
! 6632: </dl>
! 6633: </div>
! 6634:
! 6635: <p>The basic steps for building a program are always the
! 6636: same. First the program's source (<span class=
! 6637: "emphasis"><em>distfile</em></span>) must be brought to the
! 6638: local system and then extracted. After any patches to
! 6639: compile properly on NetBSD are applied, the software can be
! 6640: configured, then built (usually by compiling), and finally
! 6641: the generated binaries, etc. can be put into place on the
! 6642: system. These are exactly the steps performed by the NetBSD
! 6643: package system, which is implemented as a series of targets
! 6644: in a central Makefile, <tt class=
! 6645: "filename">pkgsrc/mk/bsd.pkg.mk</tt>.</p>
! 6646:
! 6647: <div class="sect1" lang="en" xml:lang="en">
! 6648: <div class="titlepage">
! 6649: <div>
! 6650: <div>
! 6651: <h2 class="title" style="clear: both"><a name=
! 6652: "build.prefix" id=
! 6653: "build.prefix"></a>11.1. Program location</h2>
! 6654: </div>
! 6655: </div>
! 6656: </div>
! 6657:
! 6658: <p>Before outlining the process performed by the NetBSD
! 6659: package system in the next section, here's a brief
! 6660: discussion on where programs are installed, and which
! 6661: variables influence this.</p>
! 6662:
! 6663: <p>The automatic variable <tt class="varname">PREFIX</tt>
! 6664: indicates where all files of the final program shall be
! 6665: installed. It is usually set to <tt class=
! 6666: "varname">LOCALBASE</tt> (<tt class=
! 6667: "filename">/usr/pkg</tt>), or <tt class=
! 6668: "varname">CROSSBASE</tt> for pkgs in the
! 6669: “<span class="quote">cross</span>” category.
! 6670: The value of <tt class="varname">PREFIX</tt> needs to be
! 6671: put into the various places in the program's source where
! 6672: paths to these files are encoded. See <a href=
! 6673: "#components.patches" title=
! 6674: "7.3. patches/*">Section 7.3,
! 6675: “patches/*”</a> and <a href="#fixes.libtool"
! 6676: title=
! 6677: "12.3.1. Shared libraries - libtool">Section 12.3.1,
! 6678: “Shared libraries - libtool”</a> for more
! 6679: details.</p>
! 6680:
! 6681: <p>When choosing which of these variables to use, follow
! 6682: the following rules:</p>
! 6683:
! 6684: <div class="itemizedlist">
! 6685: <ul type="disc">
! 6686: <li>
! 6687: <p><tt class="varname">PREFIX</tt> always points to
! 6688: the location where the current pkg will be
! 6689: installed. When referring to a pkg's own
! 6690: installation path, use “<span class=
! 6691: "quote">${PREFIX}</span>”.</p>
! 6692: </li>
! 6693:
! 6694: <li>
! 6695: <p><tt class="varname">LOCALBASE</tt> is where all
! 6696: non-X11 pkgs are installed. If you need to
! 6697: construct a -I or -L argument to the compiler to
! 6698: find includes and libraries installed by another
! 6699: non-X11 pkg, use “<span class=
! 6700: "quote">${LOCALBASE}</span>”.</p>
! 6701: </li>
! 6702:
! 6703: <li>
! 6704: <p><tt class="varname">X11BASE</tt> is where the
! 6705: actual X11 distribution (from xsrc, etc.) is
! 6706: installed. When looking for <span class=
! 6707: "emphasis"><em>standard</em></span> X11 includes
! 6708: (not those installed by a pkg), use
! 6709: “<span class=
! 6710: "quote">${X11BASE}</span>”.</p>
! 6711: </li>
! 6712:
! 6713: <li>
! 6714: <p>X11 based are special in that they may be
! 6715: installed in either <tt class=
! 6716: "varname">X11BASE</tt> or <tt class=
! 6717: "varname">LOCALBASE</tt>.</p>
! 6718:
! 6719: <p>Usually, X11 packages should be installed under
! 6720: <tt class="varname">LOCALBASE</tt> whenever
! 6721: possible. Note that you will need to set <tt class=
! 6722: "varname">USE_X11</tt> in them to request the
! 6723: presence of X11 and to get the right compilation
! 6724: flags.</p>
! 6725:
! 6726: <p>Even though, there are some packages that cannot
! 6727: be installed under <tt class=
! 6728: "varname">LOCALBASE</tt>: those that come with
! 6729: app-defaults files. These packages are special and
! 6730: they must be placed under <tt class=
! 6731: "varname">X11BASE</tt>. To accomplish this, set
! 6732: either <tt class="varname">USE_X11BASE</tt> or
! 6733: <tt class="varname">USE_IMAKE</tt> in your
! 6734: package.</p>
! 6735:
! 6736: <p>Some notes: <tt class="varname">USE_X11</tt> and
! 6737: <tt class="varname">USE_X11BASE</tt> are mutually
! 6738: exclusive. If you need to find includes or
! 6739: libraries installed by a pkg that has <tt class=
! 6740: "varname">USE_IMAKE</tt> or <tt class=
! 6741: "varname">USE_X11BASE</tt> in its pkg <tt class=
! 6742: "filename">Makefile</tt>, you need to use
! 6743: <span class="emphasis"><em>both</em></span>
! 6744: <tt class="filename">${X11BASE}</tt> and <tt class=
! 6745: "filename">${LOCALBASE}</tt>. To force installation
! 6746: of all X11 packages in <tt class=
! 6747: "varname">LOCALBASE</tt>, the <a xmlns=
! 6748: "http://www.w3.org/TR/xhtml1/transitional" href=
! 6749: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
! 6750: class="pkgname">pkgtools/xpkgwedge</a> is enabled
! 6751: by default.</p>
! 6752: </li>
! 6753:
! 6754: <li>
! 6755: <p><tt class="varname">X11PREFIX</tt> should be
! 6756: used to refer to the installed location of an X11
! 6757: package. <tt class="varname">X11PREFIX</tt> will be
! 6758: set to <tt class="varname">X11BASE</tt> if
! 6759: xpkgwedge is not installed, and to <tt class=
! 6760: "varname">LOCALBASE</tt> if xpkgwedge is
! 6761: installed.</p>
! 6762: </li>
! 6763:
! 6764: <li>
! 6765: <p>If xpkgwedge is installed, it is possible to
! 6766: have some packages installed in <tt class=
! 6767: "varname">X11BASE</tt> and some in <tt class=
! 6768: "varname">LOCALBASE</tt>. To determine the prefix
! 6769: of an installed package, the <tt class=
! 6770: "varname">EVAL_PREFIX</tt> definition can be used.
! 6771: It takes pairs in the format “<span class=
! 6772: "quote">DIRNAME=<package></span>”, and
! 6773: the make(1) variable <tt class=
! 6774: "varname">DIRNAME</tt> will be set to the prefix of
! 6775: the installed package <package>, or
! 6776: “<span class=
! 6777: "quote">${X11PREFIX}</span>” if the package
! 6778: is not installed.</p>
! 6779:
! 6780: <p>This is best illustrated by example.</p>
! 6781:
! 6782: <p>The following lines are taken from <tt class=
! 6783: "filename">pkgsrc/wm/scwm/Makefile</tt>:</p>
! 6784: <pre class="programlisting">
! 6785: EVAL_PREFIX+= GTKDIR=gtk+
! 6786: CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE} \
! 6787: --with-gtk-prefix="${GTKDIR}" \
! 6788: --enable-multibyte
! 6789: </pre>
! 6790:
! 6791: <p>Specific defaults can be defined for the
! 6792: packages evaluated using <tt class=
! 6793: "varname">EVAL_PREFIX</tt>, by using a definition
! 6794: of the form:</p>
! 6795: <pre class="programlisting">
! 6796: GTKDIR_DEFAULT= ${LOCALBASE}
! 6797: </pre>
! 6798:
! 6799: <p>where <tt class="varname">GTKDIR</tt>
! 6800: corresponds to the first definition in the
! 6801: <tt class="varname">EVAL_PREFIX</tt> pair.</p>
! 6802: </li>
! 6803:
! 6804: <li>
! 6805: <p>Within <tt class="filename">${PREFIX}</tt>,
! 6806: packages should install files according to hier(7),
! 6807: with the exception that manual pages go into
! 6808: <tt class="filename">${PREFIX}/man</tt>, not
! 6809: <tt class="filename">${PREFIX}/share/man</tt>.</p>
! 6810: </li>
! 6811: </ul>
! 6812: </div>
! 6813: </div>
! 6814:
! 6815: <div class="sect1" lang="en" xml:lang="en">
! 6816: <div class="titlepage">
! 6817: <div>
! 6818: <div>
! 6819: <h2 class="title" style="clear: both"><a name=
! 6820: "id2569571" id="id2569571"></a>11.2. Main
! 6821: targets</h2>
! 6822: </div>
! 6823: </div>
! 6824: </div>
! 6825:
! 6826: <p>The main targets used during the build process defined
! 6827: in <tt class="filename">bsd.pkg.mk</tt> are:</p>
! 6828:
! 6829: <div class="variablelist">
! 6830: <dl>
! 6831: <dt><span class="term">fetch</span></dt>
! 6832:
! 6833: <dd>
! 6834: <p>This will check if the file(s) given in the
! 6835: variables <tt class="varname">DISTFILES</tt> and
! 6836: <tt class="varname">PATCHFILES</tt> (as defined in
! 6837: the package's Makefile) are present on the local
! 6838: system in <tt class=
! 6839: "filename">/usr/pkgsrc/distfiles</tt>. If they are
! 6840: not present, an attempt will be made to fetch them
! 6841: using commands of the form:</p>
! 6842: <pre class="programlisting">
! 6843: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
! 6844: </pre>
! 6845:
! 6846: <p>where ${site} varies through several
! 6847: possibilities in turn: first, <tt class=
! 6848: "varname">MASTER_SITE_OVERRIDE</tt> is tried, then
! 6849: the sites specified in either <tt class=
! 6850: "varname">SITES_file</tt> if defined, else
! 6851: <tt class="varname">MASTER_SITES</tt> or <tt class=
! 6852: "varname">PATCH_SITES</tt>, as applies, then
! 6853: finally the value of <tt class=
! 6854: "varname">MASTER_SITE_BACKUP</tt>. The order of all
! 6855: except the first can be optionally sorted by the
! 6856: user, via setting either <tt class=
! 6857: "varname">MASTER_SORT_AWK</tt> or <tt class=
! 6858: "varname">MASTER_SORT_REGEX</tt>.</p>
! 6859: </dd>
! 6860:
! 6861: <dt><span class="term">checksum</span></dt>
! 6862:
! 6863: <dd>
! 6864: <p>After the distfile(s) are fetched, their
! 6865: checksum is generated and compared with the
! 6866: checksums stored in the distinfo file. If the
! 6867: checksums don't match, the build is aborted. This
! 6868: is to ensure the same distfile is used for
! 6869: building, and that the distfile wasn't changed,
! 6870: e.g. by some malign force, deliberately changed
! 6871: distfiles on the master distribution site or
! 6872: network lossage.</p>
! 6873: </dd>
! 6874:
! 6875: <dt><span class="term">extract</span></dt>
! 6876:
! 6877: <dd>
! 6878: <p>When the distfiles are present on the local
! 6879: system, they need to be extracted, as they are
! 6880: usually in the form of some compressed archive
! 6881: format, most commonly <tt class=
! 6882: "filename">.tar.gz</tt>.</p>
! 6883:
! 6884: <p>If only some of the distfiles need to be
! 6885: uncompressed, the files to be uncompressed should
! 6886: be put into <tt class=
! 6887: "varname">EXTRACT_ONLY</tt>.</p>
! 6888:
! 6889: <p>If the distfiles are not in <tt class=
! 6890: "filename">.tar.gz</tt> format, they can be
! 6891: extracted by setting either <tt class=
! 6892: "varname">EXTRACT_SUFX</tt>, or <tt class=
! 6893: "varname">EXTRACT_CMD</tt>, <tt class=
! 6894: "varname">EXTRACT_BEFORE_ARGS</tt> and <tt class=
! 6895: "varname">EXTRACT_AFTER_ARGS</tt>. In the former
! 6896: case, pkgsrc knows how to extract a number of
! 6897: suffixes (<tt class="filename">.tar.gz</tt>,
! 6898: <tt class="filename">.tgz</tt>, <tt class=
! 6899: "filename">.tar.gz2</tt>, <tt class=
! 6900: "filename">.tbz</tt>, <tt class=
! 6901: "filename">.tar.Z</tt>, <tt class=
! 6902: "filename">.tar</tt>, <tt class=
! 6903: "filename">.shar.gz</tt>, <tt class=
! 6904: "filename">.shar.bz2</tt>, <tt class=
! 6905: "filename">.shar.Z</tt>, <tt class=
! 6906: "filename">.shar</tt>, <tt class=
! 6907: "filename">.Z</tt>, <tt class="filename">.bz2</tt>
! 6908: and <tt class="filename">.gz</tt>; see the
! 6909: definition of the various <tt class=
! 6910: "varname">DECOMPRESS_CMD</tt> variables <tt class=
! 6911: "filename">bsd.pkg.mk</tt> for a complete list).
! 6912: Here's an example on how to use the other variables
! 6913: for a program that comes with a compressed shell
! 6914: archive whose name ends in <tt class=
! 6915: "filename">.msg.gz</tt>:</p>
! 6916: <pre class="programlisting">
! 6917: EXTRACT_SUFX= .msg.gz
! 6918: EXTRACT_CMD= zcat
! 6919: EXTRACT_BEFORE_ARGS=
! 6920: EXTRACT_AFTER_ARGS= |sh
! 6921: </pre>
! 6922: </dd>
! 6923:
! 6924: <dt><span class="term">patch</span></dt>
! 6925:
! 6926: <dd>
! 6927: <p>After extraction, all the patches named by the
! 6928: <tt class="varname">PATCHFILES</tt>, those present
! 6929: in the patches subdirectory of the package as well
! 6930: as in $LOCALPATCHES/$PKGPATH (e.g. <tt class=
! 6931: "filename">/usr/local/patches/graphics/png</tt>)
! 6932: are applied. Patchfiles ending in <tt class=
! 6933: "filename">.Z</tt> or <tt class="filename">.gz</tt>
! 6934: are uncompressed before they are applied, files
! 6935: ending in <tt class="filename">.orig</tt> or
! 6936: <tt class="filename">.rej</tt> are ignored. Any
! 6937: special options to patch(1) can be handed in
! 6938: <tt class="varname">PATCH_DIST_ARGS</tt>. See
! 6939: <a href="#components.patches" title=
! 6940: "7.3. patches/*">Section 7.3,
! 6941: “patches/*”</a> for more details.</p>
! 6942:
! 6943: <p>By default patch(1) is given special args to
! 6944: make it fail if the patches apply with some lines
! 6945: of fuzz. Please fix (regen) the patches so that
! 6946: they apply cleanly. The rationale behind this is
! 6947: that patches that don't apply cleanly may end up
! 6948: being applied in the wrong place, and cause severe
! 6949: harm there.</p>
! 6950: </dd>
! 6951:
! 6952: <dt><span class="term">configure</span></dt>
! 6953:
! 6954: <dd>
! 6955: <p>Most pieces of software need information on the
! 6956: header files, system calls, and library routines
! 6957: which are available in NetBSD. This is the process
! 6958: known as configuration, and is usually automated.
! 6959: In most cases, a script is supplied with the
! 6960: source, and its invocation results in generation of
! 6961: header files, Makefiles, etc.</p>
! 6962:
! 6963: <p>If the program's distfile contains its own
! 6964: configure script, this can be invoked by setting
! 6965: <tt class="varname">HAS_CONFIGURE</tt>. If the
! 6966: configure script is a GNU autoconf script,
! 6967: <tt class="varname">GNU_CONFIGURE</tt> should be
! 6968: specified instead. In either case, any arguments to
! 6969: the configure script can be specified in the
! 6970: <tt class="varname">CONFIGURE_ARGS</tt> variable,
! 6971: and the configure script's name can be set in
! 6972: <tt class="varname">CONFIGURE_SCRIPT</tt> if it
! 6973: differs from the default “<span class=
! 6974: "quote">configure</span>”. Here's an example
! 6975: from the <a xmlns=
! 6976: "http://www.w3.org/TR/xhtml1/transitional" href=
! 6977: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
! 6978: class="pkgname">sysutils/top</a> package:</p>
! 6979: <pre class="programlisting">
! 6980: HAS_CONFIGURE= yes
! 6981: CONFIGURE_SCRIPT= Configure
! 6982: CONFIGURE_ARGS+= netbsd13
! 6983: </pre>
! 6984:
! 6985: <p>If the program uses an Imakefile for
! 6986: configuration, the appropriate steps can be invoked
! 6987: by setting <tt class="varname">USE_IMAKE</tt> to
! 6988: “<span class="quote">YES</span>”. (If
! 6989: you only want the package installed in <tt class=
! 6990: "varname">$X11PREFIX</tt> but xmkmf not being run,
! 6991: set <tt class="varname">USE_X11BASE</tt>
! 6992: instead!)</p>
! 6993: </dd>
! 6994:
! 6995: <dt><span class="term">build</span></dt>
! 6996:
! 6997: <dd>
! 6998: <p>Once configuration has taken place, the software
! 6999: will be built by invoking <tt class=
! 7000: "varname">$MAKE_PROGRAM</tt> on <tt class=
! 7001: "varname">$MAKEFILE</tt> with <tt class=
! 7002: "varname">$ALL_TARGET</tt> as the target to build.
! 7003: The default <tt class="varname">MAKE_PROGRAM</tt>
! 7004: is “<span class="quote">gmake</span>”
! 7005: if <tt class="varname">USE_GMAKE</tt> is set,
! 7006: “<span class="quote">make</span>”
! 7007: otherwise. <tt class="varname">MAKEFILE</tt> is set
! 7008: to “<span class=
! 7009: "quote">Makefile</span>” by default, and
! 7010: <tt class="varname">ALL_TARGET</tt> defaults to
! 7011: “<span class="quote">all</span>”. Any
! 7012: of these variables can be set in the package's
! 7013: Makefile to change the default build process.</p>
! 7014: </dd>
! 7015:
! 7016: <dt><span class="term">install</span></dt>
! 7017:
! 7018: <dd>
! 7019: <p>Once the build stage has completed, the final
! 7020: step is to install the software in public
! 7021: directories, so users can access the programs and
! 7022: files. As in the build-target, <tt class=
! 7023: "varname">$MAKE_PROGRAM</tt> is invoked on
! 7024: <tt class="varname">$MAKEFILE</tt> here, but with
! 7025: the <tt class="varname">$INSTALL_TARGET</tt>
! 7026: instead, the latter defaulting to
! 7027: “<span class="quote">install</span>”
! 7028: (plus “<span class=
! 7029: "quote">install.man</span>”, if <tt class=
! 7030: "varname">USE_IMAKE</tt> is set).</p>
! 7031: </dd>
! 7032: </dl>
! 7033: </div>
! 7034:
! 7035: <p>If no target is specified, the default is
! 7036: “<span class="quote">build</span>”. If a
! 7037: subsequent stage is requested, all prior stages are made:
! 7038: e.g. <span><b class="command">make build</b></span> will
! 7039: also perform the equivalent of:</p>
! 7040: <pre class="programlisting">
! 7041: make fetch
! 7042: make checksum
! 7043: make extract
! 7044: make patch
! 7045: make configure
! 7046: make build
! 7047: </pre>
! 7048: </div>
! 7049:
! 7050: <div class="sect1" lang="en" xml:lang="en">
! 7051: <div class="titlepage">
! 7052: <div>
! 7053: <div>
! 7054: <h2 class="title" style="clear: both"><a name=
! 7055: "build.helpful-targets" id=
! 7056: "build.helpful-targets"></a>11.3. Other
! 7057: helpful targets</h2>
! 7058: </div>
! 7059: </div>
! 7060: </div>
! 7061:
! 7062: <div class="variablelist">
! 7063: <dl>
! 7064: <dt><span class="term">pre/post-*</span></dt>
! 7065:
! 7066: <dd>
! 7067: <p>For any of the main targets described in the
! 7068: previous section, two auxiliary targets exist with
! 7069: “<span class="quote">pre-</span>” and
! 7070: “<span class="quote">post-</span>” used
! 7071: as a prefix for the main target's name. These
! 7072: targets are invoked before and after the main
! 7073: target is called, allowing extra configuration or
! 7074: installation steps be performed from a package's
! 7075: Makefile, for example, which a program's configure
! 7076: script or install target omitted.</p>
! 7077: </dd>
! 7078:
! 7079: <dt><span class="term">do-*</span></dt>
! 7080:
! 7081: <dd>
! 7082: <p>Should one of the main targets do the wrong
! 7083: thing, and should there be no variable to fix this,
! 7084: you can redefine it with the do-* target. (Note
! 7085: that redefining the target itself instead of the
! 7086: do-* target is a bad idea, as the pre-* and post-*
! 7087: targets won't be called anymore, etc.) You will not
! 7088: usually need to do this.</p>
! 7089: </dd>
! 7090:
! 7091: <dt><span class="term">reinstall</span></dt>
! 7092:
! 7093: <dd>
! 7094: <p>If you did a <span><b class="command">make
! 7095: install</b></span> and you noticed some file was
! 7096: not installed properly, you can repeat the
! 7097: installation with this target, which will ignore
! 7098: the “<span class="quote">already
! 7099: installed</span>” flag.</p>
! 7100: </dd>
! 7101:
! 7102: <dt><span class="term">deinstall</span></dt>
! 7103:
! 7104: <dd>
! 7105: <p>This target does a pkg_delete(1) in the current
! 7106: directory, effectively de-installing the package.
! 7107: The following variables can be used to tune the
! 7108: behaviour:</p>
! 7109:
! 7110: <div class="variablelist">
! 7111: <dl>
! 7112: <dt><span class="term"><tt class=
! 7113: "varname">PKG_VERBOSE</tt></span></dt>
! 7114:
! 7115: <dd>
! 7116: <p>Add a "-v" to the <a href=
! 7117: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
! 7118: <span class="citerefentry"><span class=
! 7119: "refentrytitle">pkg_delete</span>(1)</span></a>
! 7120: command.</p>
! 7121: </dd>
! 7122:
! 7123: <dt><span class="term"><tt class=
! 7124: "varname">DEINSTALLDEPENDS</tt></span></dt>
! 7125:
! 7126: <dd>
! 7127: <p>Remove all packages that require (depend
! 7128: on) the given package. This can be used to
! 7129: remove any packages that may have been pulled
! 7130: in by a given package, e.g. if
! 7131: <span><b class="command">make deinstall
! 7132: DEINSTALLDEPENDS=1</b></span> is done in
! 7133: <tt class="filename">pkgsrc/x11/kde</tt>,
! 7134: this is likely to remove whole KDE. Works by
! 7135: adding “<span class=
! 7136: "quote">-R</span>” to the <a href=
! 7137: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
! 7138: <span class="citerefentry"><span class=
! 7139: "refentrytitle">pkg_delete</span>(1)</span></a>
! 7140: command line.</p>
! 7141: </dd>
! 7142: </dl>
! 7143: </div>
! 7144: </dd>
! 7145:
! 7146: <dt><span class="term">update</span></dt>
! 7147:
! 7148: <dd>
! 7149: <p>This target causes the current package to be
! 7150: updated to the latest version. The package and all
! 7151: depending packages first get de-installed, then
! 7152: current versions of the corresponding packages get
! 7153: compiled and installed. This is similar to manually
! 7154: noting which packages are currently installed, then
! 7155: performing a series of <span><b class=
! 7156: "command">make deinstall</b></span> and
! 7157: <span><b class="command">make install</b></span>
! 7158: (or whatever <tt class="varname">UPDATE_TARGET</tt>
! 7159: is set to) for these packages.</p>
! 7160:
! 7161: <p>You can use the “<span class=
! 7162: "quote">update</span>” target to resume
! 7163: package updating in case a previous <span><b class=
! 7164: "command">make update</b></span> was interrupted
! 7165: for some reason. However, in this case, make sure
! 7166: you don't call <span><b class="command">make
! 7167: clean</b></span> or otherwise remove the list of
! 7168: dependent packages in <tt class=
! 7169: "varname">WRKDIR</tt>. Otherwise you lose the
! 7170: ability to automatically update the current package
! 7171: along with the dependent packages you have
! 7172: installed.</p>
! 7173:
! 7174: <p>Resuming an interrupted <span><b class=
! 7175: "command">make update</b></span> will only work as
! 7176: long as the package tree remains unchanged. If the
! 7177: source code for one of the packages to be updated
! 7178: has been changed, resuming <span><b class=
! 7179: "command">make update</b></span> will most
! 7180: certainly fail!</p>
! 7181:
! 7182: <p>The following variables can be used either on
! 7183: the command line or in <tt class=
! 7184: "filename">/etc/mk.conf</tt> to alter the behaviour
! 7185: of <span><b class="command">make
! 7186: update</b></span>:</p>
! 7187:
! 7188: <div class="variablelist">
! 7189: <dl>
! 7190: <dt><span class="term"><tt class=
! 7191: "varname">UPDATE_TARGET</tt></span></dt>
! 7192:
! 7193: <dd>
! 7194: <p>Install target to recursively use for the
! 7195: updated package and the dependent packages.
! 7196: Defaults to <tt class=
! 7197: "varname">DEPENDS_TARGET</tt> if set,
! 7198: “<span class=
! 7199: "quote">install</span>” otherwise for
! 7200: <span><b class="command">make
! 7201: update</b></span>. e.g. <span><b class=
! 7202: "command">make update
! 7203: UPDATE_TARGET=package</b></span></p>
! 7204: </dd>
! 7205:
! 7206: <dt><span class="term"><tt class=
! 7207: "varname">NOCLEAN</tt></span></dt>
! 7208:
! 7209: <dd>
! 7210: <p>Don't clean up after updating. Useful if
! 7211: you want to leave the work sources of the
! 7212: updated packages around for inspection or
! 7213: other purposes. Be sure you eventually clean
! 7214: up the source tree (see the
! 7215: “<span class=
! 7216: "quote">clean-update</span>” target
! 7217: below) or you may run into troubles with old
! 7218: source code still lying around on your next
! 7219: <span><b class="command">make</b></span> or
! 7220: <span><b class="command">make
! 7221: update</b></span>.</p>
! 7222: </dd>
! 7223:
! 7224: <dt><span class="term"><tt class=
! 7225: "varname">REINSTALL</tt></span></dt>
! 7226:
! 7227: <dd>
! 7228: <p>Deinstall each package before installing
! 7229: (making <tt class=
! 7230: "varname">DEPENDS_TARGET</tt>). This may be
! 7231: necessary if the “<span class=
! 7232: "quote">clean-update</span>” target
! 7233: (see below) was called after interrupting a
! 7234: running <span><b class="command">make
! 7235: update</b></span>.</p>
! 7236: </dd>
! 7237:
! 7238: <dt><span class="term"><tt class=
! 7239: "varname">DEPENDS_TARGET</tt></span></dt>
! 7240:
! 7241: <dd>
! 7242: <p>Allows you to disable recursion and
! 7243: hardcode the target for packages. The default
! 7244: is “<span class=
! 7245: "quote">update</span>” for the update
! 7246: target, facilitating a recursive update of
! 7247: prerequisite packages. Only set <tt class=
! 7248: "varname">DEPENDS_TARGET</tt> if you want to
! 7249: disable recursive updates. Use <tt class=
! 7250: "varname">UPDATE_TARGET</tt> instead to just
! 7251: set a specific target for each package to be
! 7252: installed during <span><b class=
! 7253: "command">make update</b></span> (see
! 7254: above).</p>
! 7255: </dd>
! 7256: </dl>
! 7257: </div>
! 7258: </dd>
! 7259:
! 7260: <dt><span class="term">clean-update</span></dt>
! 7261:
! 7262: <dd>
! 7263: <p>Clean the source tree for all packages that
! 7264: would get updated if <span><b class="command">make
! 7265: update</b></span> was called from the current
! 7266: directory. This target should not be used if the
! 7267: current package (or any of its depending packages)
! 7268: have already been de-installed (e.g., after calling
! 7269: <span><b class="command">make update</b></span>) or
! 7270: you may lose some packages you intended to update.
! 7271: As a rule of thumb: only use this target
! 7272: <span class="emphasis"><em>before</em></span> the
! 7273: first time you run <span><b class="command">make
! 7274: update</b></span> and only if you have a dirty
! 7275: package tree (e.g., if you used <tt class=
! 7276: "varname">NOCLEAN</tt>).</p>
! 7277:
! 7278: <p>If you unsure about whether your tree is clean
! 7279: you can either perform a <span><b class=
! 7280: "command">make clean</b></span> at the top of the
! 7281: tree, or use the following sequence of commands
! 7282: from the directory of the package you want to
! 7283: update (<span class=
! 7284: "emphasis"><em>before</em></span> running
! 7285: <span><b class="command">make update</b></span> for
! 7286: the first time, otherwise you lose all the packages
! 7287: you wanted to update!):</p>
! 7288: <pre class="screen">
! 7289: <tt class="prompt">#</tt> <b class=
! 7290: "userinput"><tt>make clean-update</tt></b>
! 7291: <tt class="prompt">#</tt> <b class=
! 7292: "userinput"><tt>make clean CLEANDEPENDS=YES</tt></b>
! 7293: <tt class="prompt">#</tt> <b class=
! 7294: "userinput"><tt>make update</tt></b>
! 7295: </pre>
! 7296:
! 7297: <p>The following variables can be used either on
! 7298: the command line or in <tt class=
! 7299: "filename">/etc/mk.conf</tt> to alter the behaviour
! 7300: of <span><b class="command">make
! 7301: clean-update</b></span>:</p>
! 7302:
! 7303: <div class="variablelist">
! 7304: <dl>
! 7305: <dt><span class="term"><tt class=
! 7306: "varname">CLEAR_DIRLIST</tt></span></dt>
! 7307:
! 7308: <dd>
! 7309: <p>After <span><b class="command">make
! 7310: clean</b></span>, do not reconstruct the list
! 7311: of directories to update for this package.
! 7312: Only use this if <span><b class=
! 7313: "command">make update</b></span> successfully
! 7314: installed all packages you wanted to update.
! 7315: Normally, this is done automatically on
! 7316: <span><b class="command">make
! 7317: update</b></span>, but may have been
! 7318: suppressed by the <tt class=
! 7319: "varname">NOCLEAN</tt> variable (see
! 7320: above).</p>
! 7321: </dd>
! 7322: </dl>
! 7323: </div>
! 7324: </dd>
! 7325:
! 7326: <dt><span class="term">info</span></dt>
! 7327:
! 7328: <dd>
! 7329: <p>This target invokes <a href=
! 7330: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
! 7331: <span class="citerefentry"><span class=
! 7332: "refentrytitle">pkg_info</span>(1)</span></a> for
! 7333: the current package. You can use this to check
! 7334: which version of a package is installed.</p>
! 7335: </dd>
! 7336:
! 7337: <dt><span class="term">readme</span></dt>
! 7338:
! 7339: <dd>
! 7340: <p>This target generates a <tt class=
! 7341: "filename">README.html</tt> file, which can be
! 7342: viewed using a browser such as <a xmlns=
! 7343: "http://www.w3.org/TR/xhtml1/transitional" href=
! 7344: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
! 7345: class="pkgname">www/mozilla</a> or <a xmlns=
! 7346: "http://www.w3.org/TR/xhtml1/transitional" href=
! 7347: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
! 7348: class="pkgname">www/links</a>. The generated files
! 7349: contain references to any packages which are in the
! 7350: <tt class="varname">PACKAGES</tt> directory on the
! 7351: local host. The generated files can be made to
! 7352: refer to URLs based on <tt class=
! 7353: "varname">FTP_PKG_URL_HOST</tt> and <tt class=
! 7354: "varname">FTP_PKG_URL_DIR</tt>. For example, if I
! 7355: wanted to generate <tt class=
! 7356: "filename">README.html</tt> files which pointed to
! 7357: binary packages on the local machine, in the
! 7358: directory <tt class="filename">/usr/packages</tt>,
! 7359: set <tt class=
! 7360: "varname">FTP_PKG_URL_HOST=file://localhost</tt>
! 7361: and <tt class=
! 7362: "varname">FTP_PKG_URL_DIR=/usr/packages</tt>. The
! 7363: <tt class="varname">${PACKAGES}</tt> directory and
! 7364: its subdirectories will be searched for all the
! 7365: binary packages.</p>
! 7366: </dd>
! 7367:
! 7368: <dt><span class="term">readme-all</span></dt>
! 7369:
! 7370: <dd>
! 7371: <p>Use this target to create a file <tt class=
! 7372: "filename">README-all.html</tt> which contains a
! 7373: list of all packages currently available in the
! 7374: NetBSD Packages Collection, together with the
! 7375: category they belong to and a short description.
! 7376: This file is compiled from the <tt class=
! 7377: "filename">pkgsrc/*/README.html</tt> files, so be
! 7378: sure to run this <span class=
! 7379: "emphasis"><em>after</em></span> a <span><b class=
! 7380: "command">make readme</b></span>.</p>
! 7381: </dd>
! 7382:
! 7383: <dt><span class="term">cdrom-readme</span></dt>
! 7384:
! 7385: <dd>
! 7386: <p>This is very much the same as the
! 7387: “<span class="quote">readme</span>”
! 7388: target (see above), but is to be used when
! 7389: generating a pkgsrc tree to be written to a CD-ROM.
! 7390: This target also produces <tt class=
! 7391: "filename">README.html</tt> files, and can be made
! 7392: to refer to URLs based on <tt class=
! 7393: "varname">CDROM_PKG_URL_HOST</tt> and <tt class=
! 7394: "varname">CDROM_PKG_URL_DIR</tt>.</p>
! 7395: </dd>
! 7396:
! 7397: <dt><span class="term">show-distfiles</span></dt>
! 7398:
! 7399: <dd>
! 7400: <p>This target shows which distfiles and patchfiles
! 7401: are needed to build the package. (<tt class=
! 7402: "varname">DISTFILES</tt> and <tt class=
! 7403: "varname">PATCHFILES</tt>, but not <tt class=
! 7404: "filename">patches/*</tt>)</p>
! 7405: </dd>
! 7406:
! 7407: <dt><span class="term">show-downlevel</span></dt>
! 7408:
! 7409: <dd>
! 7410: <p>This target shows nothing if the package is not
! 7411: installed. If a version of this package is
! 7412: installed, but is not the version provided in this
! 7413: version of pkgsrc, then a warning message is
! 7414: displayed. This target can be used to show which of
! 7415: your installed packages are downlevel, and so the
! 7416: old versions can be deleted, and the current ones
! 7417: added.</p>
! 7418: </dd>
! 7419:
! 7420: <dt><span class="term">show-pkgsrc-dir</span></dt>
! 7421:
! 7422: <dd>
! 7423: <p>This target shows the directory in the pkgsrc
! 7424: hierarchy from which the package can be built and
! 7425: installed. This may not be the same directory as
! 7426: the one from which the package was installed. This
! 7427: target is intended to be used by people who may
! 7428: wish to upgrade many packages on a single host, and
! 7429: can be invoked from the top-level pkgsrc Makefile
! 7430: by using the “<span class=
! 7431: "quote">show-host-specific-pkgs</span>”
! 7432: target.</p>
! 7433: </dd>
! 7434:
! 7435: <dt><span class=
! 7436: "term">show-installed-depends</span></dt>
! 7437:
! 7438: <dd>
! 7439: <p>This target shows which installed packages match
! 7440: the current package's <tt class=
! 7441: "varname">DEPENDS</tt>. Useful if out of date
! 7442: dependencies are causing build problems.</p>
! 7443: </dd>
! 7444:
! 7445: <dt><span class="term">check-shlibs</span></dt>
! 7446:
! 7447: <dd>
! 7448: <p>After a package is installed, check all its
! 7449: binaries and (on ELF platforms) shared libraries to
! 7450: see if they find the shared libs they need. Run by
! 7451: default if <tt class="varname">PKG_DEVELOPER</tt>
! 7452: is set in <tt class=
! 7453: "filename">/etc/mk.conf</tt>.</p>
! 7454: </dd>
! 7455:
! 7456: <dt><span class="term">print-PLIST</span></dt>
! 7457:
! 7458: <dd>
! 7459: <p>After a “<span class="quote">make
! 7460: install</span>” from a new or upgraded pkg,
! 7461: this prints out an attempt to generate a new
! 7462: <tt class="filename">PLIST</tt> from a
! 7463: <span><b class="command">find -newer
! 7464: work/.extract_done</b></span>. An attempt is made
! 7465: to care for shared libs etc., but it is
! 7466: <span class="emphasis"><em>strongly</em></span>
! 7467: recommended to review the result before putting it
! 7468: into <tt class="filename">PLIST</tt>. On upgrades,
! 7469: it's useful to diff the output of this command
! 7470: against an already existing <tt class=
! 7471: "filename">PLIST</tt> file.</p>
! 7472:
! 7473: <p>If the package installs files via tar(1) or
! 7474: other methods that don't update file access times,
! 7475: be sure to add these files manually to your
! 7476: <tt class="filename">PLIST</tt>, as the
! 7477: “<span class="quote">find
! 7478: -newer</span>” command used by this target
! 7479: won't catch them!</p>
! 7480:
! 7481: <p>See <a href="#print-PLIST" title=
! 7482: "8.3. Tweaking output of make print-PLIST">Section 8.3,
! 7483: “Tweaking output of make
! 7484: print-PLIST”</a> for more information on this
! 7485: target.</p>
! 7486: </dd>
! 7487:
! 7488: <dt><span class="term">bulk-package</span></dt>
! 7489:
! 7490: <dd>
! 7491: <p>Used to do bulk builds. If an appropriate binary
! 7492: package already exists, no action is taken. If not,
! 7493: this target will compile, install and package it
! 7494: (and it's depends, if <tt class=
! 7495: "varname">PKG_DEPENDS</tt> is set properly. See
! 7496: <a href="#binary.configuration" title=
! 7497: "5.3.1. Configuration">Section 5.3.1,
! 7498: “Configuration”</a>. After creating the
! 7499: binary package, the sources, the just-installed
! 7500: package and it's required packages are removed,
! 7501: preserving free disk space.</p>
! 7502:
! 7503: <p><span class="emphasis"><em>Beware that this
! 7504: target may deinstall all packages installed on a
! 7505: system!</em></span></p>
! 7506: </dd>
! 7507:
! 7508: <dt><span class="term">bulk-install</span></dt>
! 7509:
! 7510: <dd>
! 7511: <p>Used during bulk-installs to install required
! 7512: packages. If an upto-date binary package is
! 7513: available, it will be installed via <a href=
! 7514: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
! 7515: <span class="citerefentry"><span class=
! 7516: "refentrytitle">pkg_add</span>(1)</span></a>. If
! 7517: not, <span><b class="command">make
! 7518: bulk-package</b></span> will be executed, but the
! 7519: installed binary not be removed.</p>
! 7520:
! 7521: <p>A binary package is considered
! 7522: “<span class="quote">upto-date</span>”
! 7523: to be installed via <a href=
! 7524: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
! 7525: <span class="citerefentry"><span class=
! 7526: "refentrytitle">pkg_add</span>(1)</span></a>
! 7527: if:</p>
! 7528:
! 7529: <div class="itemizedlist">
! 7530: <ul type="disc">
! 7531: <li>
! 7532: <p>None of the package's files (<tt class=
! 7533: "filename">Makefile</tt>, ...) were modified
! 7534: since it was built.</p>
! 7535: </li>
! 7536:
! 7537: <li>
! 7538: <p>None of the package's required (binary)
! 7539: packages were modified since it was
! 7540: built.</p>
! 7541: </li>
! 7542: </ul>
! 7543: </div>
! 7544:
! 7545: <p><span class="emphasis"><em>Beware that this
! 7546: target may deinstall all packages installed on a
! 7547: system!</em></span></p>
! 7548: </dd>
! 7549: </dl>
! 7550: </div>
! 7551: </div>
! 7552: </div>
! 7553:
! 7554: <div class="chapter" lang="en" xml:lang="en">
! 7555: <div class="titlepage">
! 7556: <div>
! 7557: <div>
! 7558: <h2 class="title"><a name="fixes" id=
! 7559: "fixes"></a>Chapter 12. Notes on fixes for
! 7560: packages</h2>
! 7561: </div>
! 7562: </div>
! 7563: </div>
! 7564:
! 7565: <div class="toc">
! 7566: <p><b>Table of Contents</b></p>
! 7567:
! 7568: <dl>
! 7569: <dt><span class="sect1"><a href="#id2570968">12.1.
! 7570: General operation</a></span></dt>
! 7571:
! 7572: <dd>
! 7573: <dl>
! 7574: <dt><span class="sect2"><a href=
! 7575: "#id2570971">12.1.1. How to pull in variables from
! 7576: /etc/mk.conf</a></span></dt>
! 7577:
! 7578: <dt><span class="sect2"><a href=
! 7579: "#id2571054">12.1.2. Restricted
! 7580: packages</a></span></dt>
! 7581:
! 7582: <dt><span class="sect2"><a href=
! 7583: "#dependencies">12.1.3. Handling
! 7584: dependencies</a></span></dt>
! 7585:
! 7586: <dt><span class="sect2"><a href=
! 7587: "#id2571501">12.1.4. Handling conflicts with other
! 7588: packages</a></span></dt>
! 7589:
! 7590: <dt><span class="sect2"><a href=
! 7591: "#id2571620">12.1.5. Packages that cannot or should
! 7592: not be built</a></span></dt>
! 7593:
! 7594: <dt><span class="sect2"><a href=
! 7595: "#id2571645">12.1.6. Packages which should not be
! 7596: deleted, once installed</a></span></dt>
! 7597:
! 7598: <dt><span class="sect2"><a href=
! 7599: "#security-handling">12.1.7. Handling packages with
! 7600: security problems</a></span></dt>
! 7601:
! 7602: <dt><span class="sect2"><a href=
! 7603: "#id2571737">12.1.8. How to handle compiler
! 7604: bugs</a></span></dt>
! 7605:
! 7606: <dt><span class="sect2"><a href=
! 7607: "#id2571760">12.1.9. How to handle incrementing
! 7608: versions when fixing an existing
! 7609: package</a></span></dt>
! 7610:
! 7611: <dt><span class="sect2"><a href=
! 7612: "#id2571809">12.1.10. Portability of
! 7613: packages</a></span></dt>
! 7614: </dl>
! 7615: </dd>
! 7616:
! 7617: <dt><span class="sect1"><a href="#id2571901">12.2.
! 7618: Possible downloading issues</a></span></dt>
! 7619:
! 7620: <dd>
! 7621: <dl>
! 7622: <dt><span class="sect2"><a href=
! 7623: "#id2571905">12.2.1. Packages whose distfiles
! 7624: aren't available for plain
! 7625: downloading</a></span></dt>
! 7626:
! 7627: <dt><span class="sect2"><a href=
! 7628: "#id2572036">12.2.2. How to handle modified
! 7629: distfiles with the 'old' name</a></span></dt>
! 7630: </dl>
! 7631: </dd>
! 7632:
! 7633: <dt><span class="sect1"><a href="#id2572048">12.3.
! 7634: Configuration gotchas</a></span></dt>
! 7635:
! 7636: <dd>
! 7637: <dl>
! 7638: <dt><span class="sect2"><a href=
! 7639: "#fixes.libtool">12.3.1. Shared libraries -
! 7640: libtool</a></span></dt>
! 7641:
! 7642: <dt><span class="sect2"><a href=
! 7643: "#id2572523">12.3.2. Using libtool on GNU packages
! 7644: that already support libtool</a></span></dt>
! 7645:
! 7646: <dt><span class="sect2"><a href=
! 7647: "#id2572608">12.3.3. GNU
! 7648: Autoconf/Automake</a></span></dt>
! 7649: </dl>
! 7650: </dd>
! 7651:
! 7652: <dt><span class="sect1"><a href="#id2572652">12.4.
! 7653: Building considerations</a></span></dt>
! 7654:
! 7655: <dd>
! 7656: <dl>
! 7657: <dt><span class="sect2"><a href=
! 7658: "#id2572656">12.4.1. CPP defines</a></span></dt>
! 7659: </dl>
! 7660: </dd>
! 7661:
! 7662: <dt><span class="sect1"><a href="#id2572685">12.5.
! 7663: Package specific actions</a></span></dt>
! 7664:
! 7665: <dd>
! 7666: <dl>
! 7667: <dt><span class="sect2"><a href=
! 7668: "#id2572689">12.5.1. Package configuration
! 7669: files</a></span></dt>
! 7670:
! 7671: <dt><span class="sect2"><a href=
! 7672: "#id2572859">12.5.2. User
! 7673: Interaction</a></span></dt>
! 7674:
! 7675: <dt><span class="sect2"><a href=
! 7676: "#id2572904">12.5.3. Handling
! 7677: licenses</a></span></dt>
! 7678:
! 7679: <dt><span class="sect2"><a href=
! 7680: "#id2572987">12.5.4. Creating an account from a
! 7681: package</a></span></dt>
! 7682:
! 7683: <dt><span class="sect2"><a href=
! 7684: "#id2573049">12.5.5. Installing score
! 7685: files</a></span></dt>
! 7686:
! 7687: <dt><span class="sect2"><a href=
! 7688: "#id2573093">12.5.6. Packages providing login
! 7689: shells</a></span></dt>
! 7690:
! 7691: <dt><span class="sect2"><a href=
! 7692: "#id2573424">12.5.7. Packages containing perl
! 7693: scripts</a></span></dt>
! 7694:
! 7695: <dt><span class="sect2"><a href=
! 7696: "#id2573442">12.5.8. Packages with hardcoded paths
! 7697: to other interpreters</a></span></dt>
! 7698:
! 7699: <dt><span class="sect2"><a href=
! 7700: "#id2573463">12.5.9. Packages installing perl
! 7701: modules</a></span></dt>
! 7702:
! 7703: <dt><span class="sect2"><a href=
! 7704: "#faq.info-files">12.5.10. Packages installing info
! 7705: files</a></span></dt>
! 7706:
! 7707: <dt><span class="sect2"><a href=
! 7708: "#id2573751">12.5.11. Packages installing GConf2
! 7709: data files</a></span></dt>
! 7710:
! 7711: <dt><span class="sect2"><a href=
! 7712: "#id2573851">12.5.12. Packages installing
! 7713: scrollkeeper data files</a></span></dt>
! 7714:
! 7715: <dt><span class="sect2"><a href=
! 7716: "#id2573902">12.5.13. Packages installing X11
! 7717: fonts</a></span></dt>
! 7718:
! 7719: <dt><span class="sect2"><a href=
! 7720: "#id2574018">12.5.14. Packages installing GTK2
! 7721: modules</a></span></dt>
! 7722:
! 7723: <dt><span class="sect2"><a href=
! 7724: "#id2574087">12.5.15. Packages installing SGML or
! 7725: XML data</a></span></dt>
! 7726:
! 7727: <dt><span class="sect2"><a href=
! 7728: "#id2574139">12.5.16. Packages installing
! 7729: extensions to the MIME database</a></span></dt>
! 7730:
! 7731: <dt><span class="sect2"><a href=
! 7732: "#id2574210">12.5.17. Packages using
! 7733: intltool</a></span></dt>
! 7734: </dl>
! 7735: </dd>
! 7736:
! 7737: <dt><span class="sect1"><a href="#id2574224">12.6.
! 7738: Feedback to the author</a></span></dt>
! 7739: </dl>
! 7740: </div>
! 7741:
! 7742: <div class="sect1" lang="en" xml:lang="en">
! 7743: <div class="titlepage">
! 7744: <div>
! 7745: <div>
! 7746: <h2 class="title" style="clear: both"><a name=
! 7747: "id2570968" id="id2570968"></a>12.1. General
! 7748: operation</h2>
! 7749: </div>
! 7750: </div>
! 7751: </div>
! 7752:
! 7753: <div class="sect2" lang="en" xml:lang="en">
! 7754: <div class="titlepage">
! 7755: <div>
! 7756: <div>
! 7757: <h3 class="title"><a name="id2570971" id=
! 7758: "id2570971"></a>12.1.1. How to pull in
! 7759: variables from /etc/mk.conf</h3>
! 7760: </div>
! 7761: </div>
! 7762: </div>
! 7763:
! 7764: <p>The problem with package-defined variables that can
! 7765: be overridden via <tt class="varname">MAKECONF</tt> or
! 7766: <tt class="filename">/etc/mk.conf</tt> is that <a href=
! 7767: "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
! 7768: <span class="citerefentry"><span class=
! 7769: "refentrytitle">make</span>(1)</span></a> expands a
! 7770: variable as it is used, but evaluates preprocessor like
! 7771: statements (.if, .ifdef and .ifndef) as they are read.
! 7772: So, to use any variable (which may be set in <tt class=
! 7773: "filename">/etc/mk.conf</tt>) in one of the .if*
! 7774: statements, the file <tt class=
! 7775: "filename">/etc/mk.conf</tt> must be included before
! 7776: that .if* statement.</p>
! 7777:
! 7778: <p>Rather than have a number of ad-hoc ways of
! 7779: including <tt class="filename">/etc/mk.conf</tt>,
! 7780: should it exist, or <tt class="varname">MAKECONF</tt>,
! 7781: should it exist, include the <tt class=
! 7782: "filename">pkgsrc/mk/bsd.prefs.mk</tt> file in the
! 7783: package Makefile before any preprocessor-like .if,
! 7784: .ifdef, or .ifndef statements:</p>
! 7785: <pre class="programlisting">
! 7786: .include "../../mk/bsd.prefs.mk"
! 7787:
! 7788: .if defined(USE_MENUS)
! 7789: ...
! 7790: .endif
! 7791: </pre>
! 7792:
! 7793: <p>If you wish to set the <tt class=
! 7794: "varname">CFLAGS</tt> variable in <tt class=
! 7795: "filename">/etc/mk.conf</tt> please make sure to
! 7796: use:</p>
! 7797: <pre class="programlisting">
! 7798: CFLAGS+= -your -flags
! 7799: </pre>
! 7800:
! 7801: <p>Using <tt class="varname">CFLAGS=</tt> (i.e. without
! 7802: the “<span class="quote">+</span>”) may
! 7803: lead to problems with packages that need to add their
! 7804: own flags. Also, you may want to take a look at the
! 7805: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 7806: href=
! 7807: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
! 7808: class="pkgname">devel/cpuflags</a> package if you're
! 7809: interested in optimization for the current CPU.</p>
! 7810: </div>
! 7811:
! 7812: <div class="sect2" lang="en" xml:lang="en">
! 7813: <div class="titlepage">
! 7814: <div>
! 7815: <div>
! 7816: <h3 class="title"><a name="id2571054" id=
! 7817: "id2571054"></a>12.1.2. Restricted
! 7818: packages</h3>
! 7819: </div>
! 7820: </div>
! 7821: </div>
! 7822:
! 7823: <p>Some licenses restrict how software may be
! 7824: re-distributed. In order to satisfy these restrictions,
! 7825: the package system defines five make variables that can
! 7826: be set to note these restrictions:</p>
! 7827:
! 7828: <div class="itemizedlist">
! 7829: <ul type="disc">
! 7830: <li>
! 7831: <p><tt class="varname">RESTRICTED</tt></p>
! 7832:
! 7833: <p>This variable should be set whenever a
! 7834: restriction exists (regardless of its kind). Set
! 7835: this variable to a string containing the reason
! 7836: for the restriction.</p>
! 7837: </li>
! 7838:
! 7839: <li>
! 7840: <p><tt class="varname">NO_BIN_ON_CDROM</tt></p>
! 7841:
! 7842: <p>Binaries may not be placed on CD-ROM. Set this
! 7843: variable to <tt class=
! 7844: "varname">${RESTRICTED}</tt> whenever a binary
! 7845: package may not be included on a CD-ROM.</p>
! 7846: </li>
! 7847:
! 7848: <li>
! 7849: <p><tt class="varname">NO_BIN_ON_FTP</tt></p>
! 7850:
! 7851: <p>Binaries may not be placed on an FTP server.
! 7852: Set this variable to <tt class=
! 7853: "varname">${RESTRICTED}</tt> whenever a binary
! 7854: package may not not be made available on the
! 7855: Internet.</p>
! 7856: </li>
! 7857:
! 7858: <li>
! 7859: <p><tt class="varname">NO_SRC_ON_CDROM</tt></p>
! 7860:
! 7861: <p>Distfiles may not be placed on CD-ROM. Set
! 7862: this variable to <tt class=
! 7863: "varname">${RESTRICTED}</tt> if re-distribution
! 7864: of the source code or other distfile(s) is not
! 7865: allowed on CD-ROMs.</p>
! 7866: </li>
! 7867:
! 7868: <li>
! 7869: <p><tt class="varname">NO_SRC_ON_FTP</tt></p>
! 7870:
! 7871: <p>Distfiles may not be placed on FTP. Set this
! 7872: variable to <tt class=
! 7873: "varname">${RESTRICTED}</tt> if re-distribution
! 7874: of the source code or other distfile(s) via the
! 7875: Internet is not allowed.</p>
! 7876: </li>
! 7877: </ul>
! 7878: </div>
! 7879:
! 7880: <p>Please note that the use of <tt class=
! 7881: "varname">NO_PACKAGE</tt>, <tt class=
! 7882: "varname">IGNORE</tt>, <tt class=
! 7883: "varname">NO_CDROM</tt>, or other generic make
! 7884: variables to denote restrictions is deprecated, because
! 7885: they unconditionally prevent users from generating
! 7886: binary packages!</p>
! 7887: </div>
! 7888:
! 7889: <div class="sect2" lang="en" xml:lang="en">
! 7890: <div class="titlepage">
! 7891: <div>
! 7892: <div>
! 7893: <h3 class="title"><a name="dependencies" id=
! 7894: "dependencies"></a>12.1.3. Handling
! 7895: dependencies</h3>
! 7896: </div>
! 7897: </div>
! 7898: </div>
! 7899:
! 7900: <p>Your package may depend on some other package being
! 7901: present - and there are various ways of expressing this
! 7902: dependency. pkgsrc supports the <tt class=
! 7903: "varname">BUILD_DEPENDS</tt> and <tt class=
! 7904: "varname">DEPENDS</tt> definitions, as well as
! 7905: dependencies via <tt class=
! 7906: "filename">buildlink3.mk</tt>, which is the preferred
! 7907: way to handle dependencies, and which uses the
! 7908: variables named above. See <a href="#buildlink" title=
! 7909: "Chapter 9. Buildlink methodology">Chapter 9,
! 7910: <i>Buildlink methodology</i></a> for more
! 7911: information.</p>
! 7912:
! 7913: <p>The basic difference between the two variables is as
! 7914: follows: The <tt class="varname">DEPENDS</tt>
! 7915: definition registers that pre-requisite in the binary
! 7916: package so it will be pulled in when the binary package
! 7917: is later installed, whilst the <tt class=
! 7918: "varname">BUILD_DEPENDS</tt> definition does not,
! 7919: marking a dependency that is only needed for building
! 7920: the package.</p>
! 7921:
! 7922: <p>This means that if you only need a package present
! 7923: whilst you are building, it should be noted as a
! 7924: <tt class="varname">BUILD_DEPENDS</tt>.</p>
! 7925:
! 7926: <p>The format for a <tt class=
! 7927: "varname">BUILD_DEPENDS</tt> and a <tt class=
! 7928: "varname">DEPENDS</tt> definition is:</p>
! 7929: <pre class="programlisting">
! 7930: <pre-req-package-name>:../../<category>/<pre-req-package>
! 7931: </pre>
! 7932:
! 7933: <p>Please note that the “<span class=
! 7934: "quote">pre-req-package-name</span>” may include
! 7935: any of the wildcard version numbers recognised by
! 7936: <a href=
! 7937: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
! 7938: <span class="citerefentry"><span class=
! 7939: "refentrytitle">pkg_info</span>(1)</span></a>.</p>
! 7940:
! 7941: <div class="orderedlist">
! 7942: <ol type="1">
! 7943: <li>
! 7944: <p>If your package needs another package's
! 7945: binaries or libraries to build or run, and if
! 7946: that package has a <tt class=
! 7947: "filename">buildlink3.mk</tt> file available, use
! 7948: it:</p>
! 7949: <pre class="programlisting">
! 7950: .include "../../graphics/jpeg/buildlink3.mk"
! 7951:
! 7952: </pre>
! 7953: </li>
! 7954:
! 7955: <li>
! 7956: <p>If your package needs to use another package
! 7957: to build itself and there is no <tt class=
! 7958: "filename">buildlink3.mk</tt> file available, use
! 7959: the <tt class="varname">BUILD_DEPENDS</tt>
! 7960: definition:</p>
! 7961: <pre class="programlisting">
! 7962: BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
! 7963: </pre>
! 7964: </li>
! 7965:
! 7966: <li>
! 7967: <p>If your package needs a library with which to
! 7968: link and again there is no <tt class=
! 7969: "filename">buildlink3.mk</tt> file available,
! 7970: this is specified using the <tt class=
! 7971: "varname">DEPENDS</tt> definition. An example of
! 7972: this is the <a xmlns=
! 7973: "http://www.w3.org/TR/xhtml1/transitional" href=
! 7974: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
! 7975: class="pkgname">print/lyx</a> package, which uses
! 7976: the xpm library, version 3.4j to build:</p>
! 7977: <pre class="programlisting">
! 7978: DEPENDS+= xpm-3.4j:../../graphics/xpm
! 7979: </pre>
! 7980:
! 7981: <p>You can also use wildcards in package
! 7982: dependences:</p>
! 7983: <pre class="programlisting">
! 7984: DEPENDS+= xpm-[0-9]*:../../graphics/xpm
! 7985: </pre>
! 7986:
! 7987: <p>Note that such wildcard dependencies are
! 7988: retained when creating binary packages. The
! 7989: dependency is checked when installing the binary
! 7990: package and any package which matches the pattern
! 7991: will be used. Wildcard dependencies should be
! 7992: used with care.</p>
! 7993:
! 7994: <p>The “<span class=
! 7995: "quote">-[0-9]*</span>” should be used
! 7996: instead of “<span class=
! 7997: "quote">-*</span>” to avoid potentially
! 7998: ambiguous matches such as “<span class=
! 7999: "quote">tk-postgresql</span>” matching a
! 8000: “<span class="quote">tk-*</span>”
! 8001: <tt class="varname">DEPENDS</tt>.</p>
! 8002:
! 8003: <p>Wildcards can also be used to specify that a
! 8004: package will only build against a certain minimum
! 8005: version of a pre-requisite:</p>
! 8006: <pre class="programlisting">
! 8007: DEPENDS+= tiff>=3.5.4:../../graphics/tiff
! 8008: </pre>
! 8009:
! 8010: <p>This means that the package will build against
! 8011: version 3.5.4 of the tiff library or newer. Such
! 8012: a dependency may be warranted if, for example,
! 8013: the API of the library has changed with version
! 8014: 3.5.4 and a package would not compile against an
! 8015: earlier version of tiff.</p>
! 8016:
! 8017: <p>Please note that such dependencies should only
! 8018: be updated if a package requires a newer
! 8019: pre-requisite, but not to denote recommendations
! 8020: such as security updates or ABI changes that do
! 8021: not prevent a package from building correctly.
! 8022: Such recommendations can be expressed using
! 8023: <tt class="varname">RECOMMENDED</tt>:</p>
! 8024: <pre class="programlisting">
! 8025: RECOMMENDED+= tiff>=3.6.1:../../graphics/tiff
! 8026: </pre>
! 8027:
! 8028: <p>In addition to the above <tt class=
! 8029: "varname">DEPENDS</tt> line, this denotes that
! 8030: while a package will build against
! 8031: tiff>=3.5.4, at least version 3.6.1 is
! 8032: recommended. <tt class="varname">RECOMMENDED</tt>
! 8033: entries will be turned into dependencies unless
! 8034: explicitly ignored (in which case a warning will
! 8035: be printed). Packages that are built with
! 8036: recommendations ignored may not be uploaded to
! 8037: ftp.NetBSD.org by developers and should not be
! 8038: used across different systems that may have
! 8039: different versions of binary packages
! 8040: installed.</p>
! 8041:
! 8042: <p>For security fixes, please update the package
! 8043: vulnerabilities file as well as setting
! 8044: <tt class="varname">RECOMMENDED</tt>, see
! 8045: <a href="#security-handling" title=
! 8046: "12.1.7. Handling packages with security problems">
! 8047: Section 12.1.7, “Handling packages with
! 8048: security problems”</a> for more
! 8049: information.</p>
! 8050: </li>
! 8051:
! 8052: <li>
! 8053: <p>If your package needs some executable to be
! 8054: able to run correctly and if there's agail no
! 8055: <tt class="filename">buildlink3.mk</tt> file,
! 8056: this is specified using the <tt class=
! 8057: "varname">DEPENDS</tt> variable. The <a xmlns=
! 8058: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8059: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
! 8060: class="pkgname">print/lyx</a> package needs to be
! 8061: able to execute the latex binary from the teTeX
! 8062: package when it runs, and that is specified:</p>
! 8063: <pre class="programlisting">
! 8064: DEPENDS+= teTeX-[0-9]*:../../print/teTeX
! 8065: </pre>
! 8066:
! 8067: <p>The comment about wildcard dependencies from
! 8068: previous paragraph applies here, too.</p>
! 8069: </li>
! 8070: </ol>
! 8071: </div>
! 8072:
! 8073: <p>If your package needs files from another package to
! 8074: build, see the first part of the “<span class=
! 8075: "quote">do-configure</span>” target <a xmlns=
! 8076: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8077: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
! 8078: class="pkgname">print/ghostscript5</a> package (it
! 8079: relies on the jpeg sources being present in source form
! 8080: during the build):</p>
! 8081: <pre class="programlisting">
! 8082: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
! 8083: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} extract; \
! 8084: fi
! 8085: </pre>
! 8086:
! 8087: <p>If you build any other packages that way, please
! 8088: make sure the working files are deleted too when this
! 8089: package's working files are cleaned up. The easiest way
! 8090: to do so is by adding a pre-clean target:</p>
! 8091: <pre class="programlisting">
! 8092: pre-clean:
! 8093: cd ${_PKGSRCDIR}/../../graphics/jpeg && ${MAKE} clean
! 8094: </pre>
! 8095:
! 8096: <p>Please also note the <tt class=
! 8097: "varname">BUILD_USES_MSGFMT</tt> and <tt class=
! 8098: "varname">BUILD_USES_GETTEXT_M4</tt> definitions, which
! 8099: are provided as convenience definitions. The former
! 8100: works out whether msgfmt(1) is part of the base system,
! 8101: and, if it isn't, installs the <a xmlns=
! 8102: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8103: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
! 8104: class="pkgname">devel/gettext</a> package. The latter
! 8105: adds a build dependency on either an installed version
! 8106: of an older gettext package, or if it isn't, installs
! 8107: the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 8108: href=
! 8109: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
! 8110: class="pkgname">devel/gettext-m4</a> package.</p>
! 8111: </div>
! 8112:
! 8113: <div class="sect2" lang="en" xml:lang="en">
! 8114: <div class="titlepage">
! 8115: <div>
! 8116: <div>
! 8117: <h3 class="title"><a name="id2571501" id=
! 8118: "id2571501"></a>12.1.4. Handling conflicts
! 8119: with other packages</h3>
! 8120: </div>
! 8121: </div>
! 8122: </div>
! 8123:
! 8124: <p>Your package may conflict with other packages a user
! 8125: might already have installed on his system, e.g. if
! 8126: your package installs the same set of files like
! 8127: another package in our pkgsrc tree.</p>
! 8128:
! 8129: <p>In this case you can set <tt class=
! 8130: "varname">CONFLICTS</tt> to a space separated list of
! 8131: packages (including version string) your package
! 8132: conflicts with.</p>
! 8133:
! 8134: <p>For example <a xmlns=
! 8135: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8136: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
! 8137: class="pkgname">x11/Xaw3d</a> and <a xmlns=
! 8138: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8139: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
! 8140: class="pkgname">x11/Xaw-Xpm</a> install provide the
! 8141: same shared library, thus you set in <tt class=
! 8142: "filename">pkgsrc/x11/Xaw3d/Makefile</tt>:</p>
! 8143: <pre class="programlisting">
! 8144: CONFLICTS= Xaw-Xpm-[0-9]*
! 8145: </pre>
! 8146:
! 8147: <p>and in <tt class=
! 8148: "filename">pkgsrc/x11/Xaw-Xpm/Makefile</tt>:</p>
! 8149: <pre class="programlisting">
! 8150: CONFLICTS= Xaw3d-[0-9]*
! 8151: </pre>
! 8152:
! 8153: <p>Packages will automatically conflict with other
! 8154: packages with the name prefix and a different version
! 8155: string. “<span class=
! 8156: "quote">Xaw3d-1.5</span>” e.g. will automatically
! 8157: conflict with the older version “<span class=
! 8158: "quote">Xaw3d-1.3</span>”.</p>
! 8159: </div>
! 8160:
! 8161: <div class="sect2" lang="en" xml:lang="en">
! 8162: <div class="titlepage">
! 8163: <div>
! 8164: <div>
! 8165: <h3 class="title"><a name="id2571620" id=
! 8166: "id2571620"></a>12.1.5. Packages that cannot
! 8167: or should not be built</h3>
! 8168: </div>
! 8169: </div>
! 8170: </div>
! 8171:
! 8172: <p>There are several reasons why a package might be
! 8173: instructed to not build under certain circumstances. If
! 8174: the package builds and runs on most platforms, the
! 8175: exceptions should be noted with <tt class=
! 8176: "varname">NOT_FOR_PLATFORM</tt>. If the package builds
! 8177: and runs on a small handful of platforms, set
! 8178: <tt class="varname">ONLY_FOR_PLATFORM</tt> instead. If
! 8179: the package should be skipped (for example, because it
! 8180: provides functionality already provided by the system),
! 8181: set <tt class="varname">PKG_SKIP_REASON</tt> to a
! 8182: descriptive message. If the package should fail because
! 8183: some preconditions are not met, set <tt class=
! 8184: "varname">PKG_FAIL_REASON</tt> to a descriptive
! 8185: message.</p>
! 8186:
! 8187: <p><tt class="varname">IGNORE</tt> is deprecated
! 8188: because it didn't provide enough information to
! 8189: determine whether the build should fail.</p>
! 8190: </div>
! 8191:
! 8192: <div class="sect2" lang="en" xml:lang="en">
! 8193: <div class="titlepage">
! 8194: <div>
! 8195: <div>
! 8196: <h3 class="title"><a name="id2571645" id=
! 8197: "id2571645"></a>12.1.6. Packages which
! 8198: should not be deleted, once installed</h3>
! 8199: </div>
! 8200: </div>
! 8201: </div>
! 8202:
! 8203: <p>To ensure that a package may not be deleted, once it
! 8204: has been installed, the <tt class=
! 8205: "varname">PKG_PRESERVE</tt> definition should be set in
! 8206: the package Makefile. This will be carried into any
! 8207: binary package that is made from this pkgsrc entry. A
! 8208: “<span class="quote">preserved</span>”
! 8209: package will not be deleted using <a href=
! 8210: "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
! 8211: <span class="citerefentry"><span class=
! 8212: "refentrytitle">pkg_delete</span>(1)</span></a> unless
! 8213: the “<span class="quote">-f</span>” option
! 8214: is used.</p>
! 8215: </div>
! 8216:
! 8217: <div class="sect2" lang="en" xml:lang="en">
! 8218: <div class="titlepage">
! 8219: <div>
! 8220: <div>
! 8221: <h3 class="title"><a name="security-handling" id=
! 8222: "security-handling"></a>12.1.7. Handling
! 8223: packages with security problems</h3>
! 8224: </div>
! 8225: </div>
! 8226: </div>
! 8227:
! 8228: <p>When a vulnerability is found, this should be noted
! 8229: in <tt class=
! 8230: "filename">localsrc/security/advisories/pkg-vulnerabilities</tt>,
! 8231: and after the commit of that file, it should be copied
! 8232: to both <tt class=
! 8233: "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</tt>
! 8234: and <tt class=
! 8235: "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</tt>
! 8236: on ftp.NetBSD.org using <tt class=
! 8237: "filename">localsrc/security/advisories/Makefile</tt>.
! 8238: In addition, if a <tt class=
! 8239: "filename">buildlink3.mk</tt> file exists for an
! 8240: affected package, bumping <tt class=
! 8241: "varname">PKGREVISION</tt> and creating a corresponding
! 8242: <tt class="varname">BUILDLINK_RECOMMENDED.<i class=
! 8243: "replaceable"><tt>pkg</tt></i></tt> entry should be
! 8244: considered. See <a href="#buildlink" title=
! 8245: "Chapter 9. Buildlink methodology">Chapter 9,
! 8246: <i>Buildlink methodology</i></a> for more information
! 8247: about writing <tt class="filename">buildlink3.mk</tt>
! 8248: files and <tt class="varname">BUILDLINK_*</tt>
! 8249: definitions.</p>
! 8250:
! 8251: <p>Also, if the fix should be applied to the stable
! 8252: pkgsrc branch, be sure to submit a pullup request!</p>
! 8253: </div>
! 8254:
! 8255: <div class="sect2" lang="en" xml:lang="en">
! 8256: <div class="titlepage">
! 8257: <div>
! 8258: <div>
! 8259: <h3 class="title"><a name="id2571737" id=
! 8260: "id2571737"></a>12.1.8. How to handle
! 8261: compiler bugs</h3>
! 8262: </div>
! 8263: </div>
! 8264: </div>
! 8265:
! 8266: <p>Some source files trigger bugs in the compiler,
! 8267: based on combinations of compiler version and
! 8268: architecture and almost always relation to optimisation
! 8269: being enabled. Common symptoms are gcc internal errors
! 8270: or never finishing compiling a file.</p>
! 8271:
! 8272: <p>Typically a workaround involves testing the
! 8273: <tt class="varname">MACHINE_ARCH</tt> and compiler
! 8274: version, disabling optimisation for that
! 8275: file/<tt class="varname">MACHINE_ARCH</tt>/compiler
! 8276: combination, and documenting it in <tt class=
! 8277: "filename">pkgsrc/doc/HACKS</tt>. See that file for a
! 8278: number of examples!</p>
! 8279: </div>
! 8280:
! 8281: <div class="sect2" lang="en" xml:lang="en">
! 8282: <div class="titlepage">
! 8283: <div>
! 8284: <div>
! 8285: <h3 class="title"><a name="id2571760" id=
! 8286: "id2571760"></a>12.1.9. How to handle
! 8287: incrementing versions when fixing an existing
! 8288: package</h3>
! 8289: </div>
! 8290: </div>
! 8291: </div>
! 8292:
! 8293: <p>When making fixes to an existing package it can be
! 8294: useful to change the version number in <tt class=
! 8295: "varname">PKGNAME</tt>. To avoid conflicting with
! 8296: future versions by the original author, a
! 8297: “<span class="quote">nb1</span>”,
! 8298: “<span class="quote">nb2</span>”, ...
! 8299: suffix can be used on package versions by setting
! 8300: <tt class="varname">PKGREVISION=1</tt> (2, ...). The
! 8301: “<span class="quote">nb</span>” is treated
! 8302: like a “<span class="quote">.</span>” by
! 8303: the pkg tools. e.g.</p>
! 8304: <pre class="programlisting">
! 8305: DISTNAME= foo-17.42
! 8306: PKGREVISION= 9
! 8307: </pre>
! 8308:
! 8309: <p>will result in a <tt class="varname">PKGNAME</tt> of
! 8310: “<span class=
! 8311: "quote">foo-17.42nb9</span>”.</p>
! 8312:
! 8313: <p>When a new release of the package is released, the
! 8314: <tt class="varname">PKGREVISION</tt> should be removed.
! 8315: e.g. on a new minor release of the above package,
! 8316: things should be like:</p>
! 8317: <pre class="programlisting">
! 8318: DISTNAME= foo-17.43
! 8319: </pre>
! 8320: </div>
! 8321:
! 8322: <div class="sect2" lang="en" xml:lang="en">
! 8323: <div class="titlepage">
! 8324: <div>
! 8325: <div>
! 8326: <h3 class="title"><a name="id2571809" id=
! 8327: "id2571809"></a>12.1.10. Portability of
! 8328: packages</h3>
! 8329: </div>
! 8330: </div>
! 8331: </div>
! 8332:
! 8333: <p>One appealing feature of pkgsrc is that it runs on
! 8334: many different platforms. As a result, it is important
! 8335: to ensure, where possible, that packages in pkgsrc are
! 8336: portable. There are some particular details you should
! 8337: pay attention to while working on pkgsrc.</p>
! 8338:
! 8339: <div class="sect3" lang="en" xml:lang="en">
! 8340: <div class="titlepage">
! 8341: <div>
! 8342: <div>
! 8343: <h4 class="title"><a name="id2571882" id=
! 8344: "id2571882"></a>12.1.10.1. ${INSTALL},
! 8345: ${INSTALL_DATA_DIR}, ...</h4>
! 8346: </div>
! 8347: </div>
! 8348: </div>
! 8349:
! 8350: <p>The BSD-compatible <span><b class=
! 8351: "command">install</b></span> supplied with some
! 8352: operating systems will not perform more than one
! 8353: operation at a time. As such, you should call
! 8354: “<span class="quote">${INSTALL}</span>”,
! 8355: etc. like this:</p>
! 8356: <pre class="programlisting">
! 8357: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
! 8358: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
! 8359: </pre>
! 8360: </div>
! 8361: </div>
! 8362: </div>
! 8363:
! 8364: <div class="sect1" lang="en" xml:lang="en">
! 8365: <div class="titlepage">
! 8366: <div>
! 8367: <div>
! 8368: <h2 class="title" style="clear: both"><a name=
! 8369: "id2571901" id="id2571901"></a>12.2. Possible
! 8370: downloading issues</h2>
! 8371: </div>
! 8372: </div>
! 8373: </div>
! 8374:
! 8375: <div class="sect2" lang="en" xml:lang="en">
! 8376: <div class="titlepage">
! 8377: <div>
! 8378: <div>
! 8379: <h3 class="title"><a name="id2571905" id=
! 8380: "id2571905"></a>12.2.1. Packages whose
! 8381: distfiles aren't available for plain
! 8382: downloading</h3>
! 8383: </div>
! 8384: </div>
! 8385: </div>
! 8386:
! 8387: <p>If you need to download from a dynamic URL you can
! 8388: set <tt class="varname">DYNAMIC_MASTER_SITES</tt> and a
! 8389: <span><b class="command">make fetch</b></span> will
! 8390: call <tt class="filename">files/getsite.sh</tt> with
! 8391: the name of each file to download as an argument,
! 8392: expecting it to output the URL of the directory from
! 8393: which to download it. <a xmlns=
! 8394: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8395: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
! 8396: class="pkgname">graphics/ns-cult3d</a> is an example of
! 8397: this usage.</p>
! 8398:
! 8399: <p>If the download can't be automated, because the user
! 8400: must submit personal information to apply for a
! 8401: password, or must pay for the source, or whatever, you
! 8402: can set <tt class="varname">_FETCH_MESSAGE</tt> to a
! 8403: macro which displays a message explaining the
! 8404: situation. <tt class="varname">_FETCH_MESSAGE</tt> must
! 8405: be executable shell commands, not just a message.
! 8406: (Generally, it executes <tt class=
! 8407: "varname">${ECHO}</tt>). As of this writing, the
! 8408: following packages use this: <a xmlns=
! 8409: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8410: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
! 8411: class="pkgname">audio/realplayer</a>, <a xmlns=
! 8412: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8413: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
! 8414: class="pkgname">cad/simian</a>, <a xmlns=
! 8415: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8416: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
! 8417: class="pkgname">devel/ipv6socket</a>, <a xmlns=
! 8418: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8419: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
! 8420: class="pkgname">emulators/vmware-module</a>, <a xmlns=
! 8421: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8422: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
! 8423: class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
! 8424: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8425: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
! 8426: class="pkgname">sysutils/storage-manager</a>, <a xmlns=
! 8427: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8428: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
! 8429: class="pkgname">www/ap-aolserver</a>, <a xmlns=
! 8430: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8431: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
! 8432: class="pkgname">www/openacs</a>. Try to be consistent
! 8433: with them.</p>
! 8434: </div>
! 8435:
! 8436: <div class="sect2" lang="en" xml:lang="en">
! 8437: <div class="titlepage">
! 8438: <div>
! 8439: <div>
! 8440: <h3 class="title"><a name="id2572036" id=
! 8441: "id2572036"></a>12.2.2. How to handle
! 8442: modified distfiles with the 'old' name</h3>
! 8443: </div>
! 8444: </div>
! 8445: </div>
! 8446:
! 8447: <p>Sometimes authors of a software package make some
! 8448: modifications after the software was released, and they
! 8449: put up a new distfile without changing the package's
! 8450: version number. If a package is already in pkgsrc at
! 8451: that time, the md5 checksum will no longer match. The
! 8452: correct way to work around this is to update the
! 8453: package's md5 checksum to match the package on the
! 8454: master site (beware, any mirrors may not be up to date
! 8455: yet!), and to remove the old distfile from
! 8456: ftp.NetBSD.org's <tt class=
! 8457: "filename">/pub/NetBSD/packages/distfiles</tt>
! 8458: directory. Furthermore, a mail to the package's author
! 8459: seems appropriate making sure the distfile was really
! 8460: updated on purpose, and that no trojan horse or so
! 8461: crept in.</p>
! 8462: </div>
! 8463: </div>
! 8464:
! 8465: <div class="sect1" lang="en" xml:lang="en">
! 8466: <div class="titlepage">
! 8467: <div>
! 8468: <div>
! 8469: <h2 class="title" style="clear: both"><a name=
! 8470: "id2572048" id=
! 8471: "id2572048"></a>12.3. Configuration
! 8472: gotchas</h2>
! 8473: </div>
! 8474: </div>
! 8475: </div>
! 8476:
! 8477: <div class="sect2" lang="en" xml:lang="en">
! 8478: <div class="titlepage">
! 8479: <div>
! 8480: <div>
! 8481: <h3 class="title"><a name="fixes.libtool" id=
! 8482: "fixes.libtool"></a>12.3.1. Shared libraries
! 8483: - libtool</h3>
! 8484: </div>
! 8485: </div>
! 8486: </div>
! 8487:
! 8488: <p>pkgsrc supports many different machines, with
! 8489: different object formats like a.out and ELF, and
! 8490: varying abilities to do shared library and dynamic
! 8491: loading at all. To accompany this, varying commands and
! 8492: options have to be passed to the compiler, linker, etc.
! 8493: to get the Right Thing, which can be pretty annoying
! 8494: especially if you don't have all the machines at your
! 8495: hand to test things. The <a xmlns=
! 8496: "http://www.w3.org/TR/xhtml1/transitional" href=
! 8497: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
! 8498: class="pkgname">devel/libtool</a> pkg can help here, as
! 8499: it just “<span class="quote">knows</span>”
! 8500: how to build both static and dynamic libraries from a
! 8501: set of source files, thus being platform
! 8502: independent.</p>
! 8503:
! 8504: <p>Here's how to use libtool in a pkg in seven simple
! 8505: steps:</p>
! 8506:
! 8507: <div class="orderedlist">
! 8508: <ol type="1">
! 8509: <li>
! 8510: <p>Add <tt class="varname">USE_LIBTOOL=yes</tt>
! 8511: to the package Makefile.</p>
! 8512: </li>
! 8513:
! 8514: <li>
! 8515: <p>For library objects, use “<span class=
! 8516: "quote">${LIBTOOL} --mode=compile
! 8517: ${CC}</span>” in place of
! 8518: “<span class="quote">${CC}</span>”.
! 8519: You could even add it to the definition of
! 8520: <tt class="varname">CC</tt>, if only libraries
! 8521: are being built in a given Makefile. This one
! 8522: command will build both PIC and non-PIC library
! 8523: objects, so you need not have separate shared and
! 8524: non-shared library rules.</p>
! 8525: </li>
! 8526:
! 8527: <li>
! 8528: <p>For the linking of the library, remove any
! 8529: “<span class="quote">ar</span>”,
! 8530: “<span class="quote">ranlib</span>”,
! 8531: and “<span class="quote">ld
! 8532: -Bshareable</span>” commands, and instead
! 8533: use:</p>
! 8534: <pre class="programlisting">
! 8535: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
! 8536: </pre>
! 8537:
! 8538: <p>Note that the library is changed to have a
! 8539: <tt class="filename">.la</tt> extension, and the
! 8540: objects are changed to have a <tt class=
! 8541: "filename">.lo</tt> extension. Change <tt class=
! 8542: "varname">OBJS</tt> as necessary. This
! 8543: automatically creates all of the <tt class=
! 8544: "filename">.a</tt>, <tt class=
! 8545: "filename">.so.major.minor</tt>, and ELF symlinks
! 8546: (if necessary) in the build directory. Be sure to
! 8547: include “<span class=
! 8548: "quote">-version-info</span>”, especially
! 8549: when major and minor are zero, as libtool will
! 8550: otherwise strip off the shared library
! 8551: version.</p>
! 8552:
! 8553: <p>From the libtool manual:</p>
! 8554: <pre class="programlisting">
! 8555: So, libtool library versions are described by three integers:
! 8556:
! 8557: CURRENT
! 8558: The most recent interface number that this library implements.
! 8559:
! 8560: REVISION
! 8561: The implementation number of the CURRENT interface.
! 8562:
! 8563: AGE
! 8564: The difference between the newest and oldest interfaces that this
! 8565: library implements. In other words, the library implements all the
! 8566: interface numbers in the range from number `CURRENT - AGE' to
! 8567: `CURRENT'.
! 8568:
! 8569: If two libraries have identical CURRENT and AGE numbers, then the
! 8570: dynamic linker chooses the library with the greater REVISION number.
! 8571: </pre>
! 8572:
! 8573: <p>The “<span class=
! 8574: "quote">-release</span>” option will
! 8575: produce different results for a.out and ELF
! 8576: (excluding symlinks) in only one case. An ELF
! 8577: library of the form “<span class=
! 8578: "quote">libfoo-release.so.<span class=
! 8579: "emphasis"><em>x</em></span>.<span class=
! 8580: "emphasis"><em>y</em></span></span>” will
! 8581: have a symlink of “<span class=
! 8582: "quote">libfoo.so.<span class=
! 8583: "emphasis"><em>x</em></span>.<span class=
! 8584: "emphasis"><em>y</em></span></span>” on an
! 8585: a.out platform. This is handled
! 8586: automatically.</p>
! 8587:
! 8588: <p>The “<span class="quote">-rpath
! 8589: argument</span>” is the install directory
! 8590: of the library being built.</p>
! 8591:
! 8592: <p>In the <tt class="filename">PLIST</tt>,
! 8593: include all of the <tt class="filename">.a</tt>,
! 8594: <tt class="filename">.la</tt>, and <tt class=
! 8595: "filename">.so</tt>, <tt class=
! 8596: "filename">.so.<i class=
! 8597: "replaceable"><tt>major</tt></i></tt> and
! 8598: <tt class="filename">.so.<i class=
! 8599: "replaceable"><tt>major</tt></i>.<i class=
! 8600: "replaceable"><tt>minor</tt></i></tt> files.</p>
! 8601: </li>
! 8602:
! 8603: <li>
! 8604: <p>When linking shared object (<tt class=
! 8605: "filename">.so</tt>) files, i.e. files that are
! 8606: loaded via dlopen(3), NOT shared libraries, use
! 8607: “<span class="quote">-module
! 8608: -avoid-version</span>” to prevent them
! 8609: getting version tacked on.</p>
! 8610:
! 8611: <p>The <tt class="filename">PLIST</tt> file gets
! 8612: the <tt class="filename">foo.so</tt> entry.</p>
! 8613: </li>
! 8614:
! 8615: <li>
! 8616: <p>When linking programs that depend on these
! 8617: libraries <span class=
! 8618: "emphasis"><em>before</em></span> they are
! 8619: installed, preface the <a href=
! 8620: "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
! 8621: <span class="citerefentry"><span class=
! 8622: "refentrytitle">cc</span>(1)</span></a> or
! 8623: <a href=
! 8624: "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
! 8625: <span class="citerefentry"><span class=
! 8626: "refentrytitle">ld</span>(1)</span></a> line with
! 8627: “<span class="quote">${LIBTOOL}
! 8628: --mode=link</span>”, and it will find the
! 8629: correct libraries (static or shared), but please
! 8630: be aware that libtool will not allow you to
! 8631: specify a relative path in -L (such as
! 8632: “<span class=
! 8633: "quote">-L../somelib</span>”), because it
! 8634: expects you to change that argument to be the
! 8635: <tt class="filename">.la</tt> file. e.g.</p>
! 8636: <pre class="programlisting">
! 8637: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
! 8638: </pre>
! 8639:
! 8640: <p>should be changed to:</p>
! 8641: <pre class="programlisting">
! 8642: ${LIBTOOL} --mode=link ${CC} -o <i class=
! 8643: "replaceable"><tt>someprog</tt></i> <i class=
! 8644: "replaceable"><tt>../somelib/somelib.la</tt></i>
! 8645: </pre>
! 8646:
! 8647: <p>and it will do the right thing with the
! 8648: libraries.</p>
! 8649: </li>
! 8650:
! 8651: <li>
! 8652: <p>When installing libraries, preface the
! 8653: <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
! 8654: <span class="citerefentry"><span class=
! 8655: "refentrytitle">install</span>(1)</span></a> or
! 8656: <a href=
! 8657: "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
! 8658: <span class="citerefentry"><span class=
! 8659: "refentrytitle">cp</span>(1)</span></a> command
! 8660: with “<span class="quote">${LIBTOOL}
! 8661: --mode=install</span>”, and change the
! 8662: library name to <tt class="filename">.la</tt>.
! 8663: e.g.</p>
! 8664: <pre class="programlisting">
! 8665: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
! 8666: </pre>
! 8667:
! 8668: <p>This will install the static <tt class=
! 8669: "filename">.a</tt>, shared library, any needed
! 8670: symlinks, and run <a href=
! 8671: "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
! 8672: <span class="citerefentry"><span class=
! 8673: "refentrytitle">ldconfig</span>(8)</span></a>.</p>
! 8674: </li>
! 8675:
! 8676: <li>
! 8677: <p>In your <tt class="filename">PLIST</tt>,
! 8678: include all of the <tt class="filename">.a</tt>,
! 8679: <tt class="filename">.la</tt>, and <tt class=
! 8680: "filename">.so</tt>, <tt class=
! 8681: "filename">.so.CURRENT</tt> and <tt class=
! 8682: "filename">.so.CURRENT.REVISION</tt> files (this
! 8683: is a change from the previous behaviour).</p>
! 8684: </li>
! 8685: </ol>
! 8686: </div>
! 8687: </div>
! 8688:
! 8689: <div class="sect2" lang="en" xml:lang="en">
! 8690: <div class="titlepage">
! 8691: <div>
! 8692: <div>
! 8693: <h3 class="title"><a name="id2572523" id=
! 8694: "id2572523"></a>12.3.2. Using libtool on GNU
! 8695: packages that already support libtool</h3>
! 8696: </div>
! 8697: </div>
! 8698: </div>
! 8699:
! 8700: <p>Add <tt class="varname">USE_LIBTOOL=yes</tt> to the
! 8701: package Makefile. This will override the package's own
! 8702: libtool in most cases. For older libtool using
! 8703: packages, libtool is made by ltconfig script during the
! 8704: do-configure step; you can check the libtool script
! 8705: location by doing <span><b class="command">make
! 8706: configure; find work*/ -name libtool</b></span>.</p>
! 8707:
! 8708: <p><tt class="varname">LIBTOOL_OVERRIDE</tt> specifies
! 8709: which libtool scripts, relative to <tt class=
! 8710: "varname">WRKSRC</tt>, to override. By default, it is
! 8711: set to “<span class="quote">libtool */libtool
! 8712: */*/libtool</span>”. If this does not match the
! 8713: location of the package's libtool script(s), set it as
! 8714: appropriate.</p>
! 8715:
! 8716: <p>If you do not need <tt class="filename">*.a</tt>
! 8717: static libraries built and installed, then use
! 8718: <tt class="varname">SHLIBTOOL_OVERRIDE</tt>
! 8719: instead.</p>
! 8720:
! 8721: <p>If your package makes use of the platform
! 8722: independent library for loading dynamic shared objects,
! 8723: that comes with libtool (libltdl), you should include
! 8724: the libtool buildlink3.mk (and set <tt class=
! 8725: "varname">USE_BUILDLINK3=YES</tt>).</p>
! 8726:
! 8727: <p>Some packages use libtool incorrectly so that the
! 8728: package may not work or build in some circumstances.
! 8729: Some of the more common errors are:</p>
! 8730:
! 8731: <div class="itemizedlist">
! 8732: <ul type="disc">
! 8733: <li>
! 8734: <p>The inclusion of a shared object (-module) as
! 8735: a dependent library in an executable or library.
! 8736: This in itself isn't a problem if one of two
! 8737: things has been done:</p>
! 8738:
! 8739: <div class="orderedlist">
! 8740: <ol type="1">
! 8741: <li>
! 8742: <p>The shared object is named correctly,
! 8743: i.e. <tt class="filename">libfoo.la</tt>,
! 8744: not <tt class="filename">foo.la</tt></p>
! 8745: </li>
! 8746:
! 8747: <li>
! 8748: <p>The -dlopen option is used when linking
! 8749: an executable.</p>
! 8750: </li>
! 8751: </ol>
! 8752: </div>
! 8753: </li>
! 8754:
! 8755: <li>
! 8756: <p>The use of libltdl without the correct calls
! 8757: to initialisation routines. The function
! 8758: lt_dlinit() should be called and the macro
! 8759: <tt class=
! 8760: "varname">LTDL_SET_PRELOADED_SYMBOLS</tt>
! 8761: included in executables.</p>
! 8762: </li>
! 8763: </ul>
! 8764: </div>
! 8765: </div>
! 8766:
! 8767: <div class="sect2" lang="en" xml:lang="en">
! 8768: <div class="titlepage">
! 8769: <div>
! 8770: <div>
! 8771: <h3 class="title"><a name="id2572608" id=
! 8772: "id2572608"></a>12.3.3. GNU
! 8773: Autoconf/Automake</h3>
! 8774: </div>
! 8775: </div>
! 8776: </div>
! 8777:
! 8778: <p>If a package needs GNU autoconf or automake to be
! 8779: executed to regenerate the configure script and
! 8780: Makefile.in makefile templates, then they should be
! 8781: executed in a pre-configure target. Two Makefile
! 8782: fragments are provided in <tt class=
! 8783: "filename">pkgsrc/mk/autoconf.mk</tt> and <tt class=
! 8784: "filename">pkgsrc/mk/automake.mk</tt> to help dealing
! 8785: with these tools. See comments in these files for
! 8786: details.</p>
! 8787:
! 8788: <p>For packages that need only autoconf:</p>
! 8789: <pre class="programlisting">
! 8790: AUTOCONF_REQD= 2.50 # if default version is not good enough
! 8791: ...
! 8792:
! 8793: pre-configure:
! 8794: cd ${WRKSRC}; ${AUTOCONF}
! 8795:
! 8796: ...
! 8797: .include "../../mk/autoconf.mk"
! 8798: </pre>
! 8799:
! 8800: <p>and for packages that need automake and
! 8801: autoconf:</p>
! 8802: <pre class="programlisting">
! 8803: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
! 8804: ...
! 8805:
! 8806: pre-configure:
! 8807: cd ${WRKSRC}; \
! 8808: ${ACLOCAL}; \
! 8809: ${AUTOHEADER}; \
! 8810: ${AUTOMAKE} -a --foreign -i; \
! 8811: ${AUTOCONF}
! 8812:
! 8813: ...
! 8814: .include "../mk/automake.mk"
! 8815: </pre>
! 8816:
! 8817: <p>Packages which use GNU Automake will almost
! 8818: certainly require GNU Make, but that's automatically
! 8819: provided for you in <tt class=
! 8820: "filename">mk/automake.mk</tt>.</p>
! 8821:
! 8822: <p>There are times when the configure process makes
! 8823: additional changes to the generated files, which then
! 8824: causes the build process to try to re-execute the
! 8825: automake sequence. This is prevented by touching
! 8826: various files in the configure stage. If this causes
! 8827: problems with your package you can set <tt class=
! 8828: "varname">AUTOMAKE_OVERRIDE=NO</tt> in the package
! 8829: Makefile.</p>
! 8830: </div>
! 8831: </div>
! 8832:
! 8833: <div class="sect1" lang="en" xml:lang="en">
! 8834: <div class="titlepage">
! 8835: <div>
! 8836: <div>
! 8837: <h2 class="title" style="clear: both"><a name=
! 8838: "id2572652" id="id2572652"></a>12.4. Building
! 8839: considerations</h2>
! 8840: </div>
! 8841: </div>
! 8842: </div>
! 8843:
! 8844: <div class="sect2" lang="en" xml:lang="en">
! 8845: <div class="titlepage">
! 8846: <div>
! 8847: <div>
! 8848: <h3 class="title"><a name="id2572656" id=
! 8849: "id2572656"></a>12.4.1. CPP defines</h3>
! 8850: </div>
! 8851: </div>
! 8852: </div>
! 8853:
! 8854: <p>To port an application to NetBSD, it's usually
! 8855: necessary for the compiler to be able to judge the
! 8856: system on which it's compiling, and we use definitions
! 8857: so that the C pre-processor can do this.</p>
! 8858:
! 8859: <p>To test whether you are working on a 4.4 BSD-derived
! 8860: system, you should use the BSD definition, which is
! 8861: defined in <tt class=
! 8862: "filename"><sys/param.h></tt> on said
! 8863: systems.</p>
! 8864: <pre class="programlisting">
! 8865: #include <sys/param.h>
! 8866: </pre>
! 8867:
! 8868: <p>and then you can surround the BSD-specific parts of
! 8869: your package's C/C++ code using this conditional:</p>
! 8870: <pre class="programlisting">
! 8871: #if (defined(BSD) && BSD >= 199306)
! 8872: ...
! 8873: #endif
! 8874: </pre>
! 8875:
! 8876: <p>Please use the “<span class=
! 8877: "quote">__NetBSD__</span>” definition sparingly -
! 8878: it should only apply to features of NetBSD that are not
! 8879: present in other 4.4-lite derived BSDs.</p>
! 8880: </div>
! 8881: </div>
! 8882:
! 8883: <div class="sect1" lang="en" xml:lang="en">
! 8884: <div class="titlepage">
! 8885: <div>
! 8886: <div>
! 8887: <h2 class="title" style="clear: both"><a name=
! 8888: "id2572685" id="id2572685"></a>12.5. Package
! 8889: specific actions</h2>
! 8890: </div>
! 8891: </div>
! 8892: </div>
! 8893:
! 8894: <div class="sect2" lang="en" xml:lang="en">
! 8895: <div class="titlepage">
! 8896: <div>
! 8897: <div>
! 8898: <h3 class="title"><a name="id2572689" id=
! 8899: "id2572689"></a>12.5.1. Package
! 8900: configuration files</h3>
! 8901: </div>
! 8902: </div>
! 8903: </div>
! 8904:
! 8905: <p>Packages should be taught to look for their
! 8906: configuration files in <tt class=
! 8907: "varname">${PKG_SYSCONFDIR}</tt>, which is passed
! 8908: through to the configure and build processes.
! 8909: <tt class="varname">PKG_SYSCONFDIR</tt> may be
! 8910: customized in various ways by setting other make
! 8911: variables:</p>
! 8912:
! 8913: <div class="itemizedlist">
! 8914: <ul type="disc">
! 8915: <li>
! 8916: <p><tt class="varname">PKG_SYSCONFBASE</tt> is
! 8917: the main config directory under which all package
! 8918: configuration files are to be found. This
! 8919: defaults to <tt class=
! 8920: "filename">${PREFIX}/etc</tt>, but may be
! 8921: overridden in <tt class=
! 8922: "filename">/etc/mk.conf</tt>.</p>
! 8923: </li>
! 8924:
! 8925: <li>
! 8926: <p><tt class="varname">PKG_SYSCONFSUBDIR</tt> is
! 8927: the subdirectory of <tt class=
! 8928: "varname">PKG_SYSCONFBASE</tt> under which the
! 8929: configuration files for a particular package may
! 8930: be found, e.g. the Apache configuration files may
! 8931: all be found under the <tt class=
! 8932: "filename">httpd/</tt> subdirectory of <tt class=
! 8933: "varname">${PKG_SYSCONFBASE}</tt>. This should be
! 8934: set in the package Makefile.</p>
! 8935: </li>
! 8936:
! 8937: <li>
! 8938: <p>By default, <tt class=
! 8939: "varname">PKG_SYSCONFDIR</tt> is set to
! 8940: <tt class="varname">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</tt>,
! 8941: but this may be overridden by setting <tt class=
! 8942: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</tt>
! 8943: for a particular package, where <tt class=
! 8944: "varname">PKG_SYSCONFVAR</tt> defaults to
! 8945: <tt class="varname">${PKGBASE}</tt>. This is not
! 8946: meant to be set by a package Makefile, but is
! 8947: reserved for users who wish to override the
! 8948: <tt class="varname">PKG_SYSCONFDIR</tt> setting
! 8949: for a particular package with a special
! 8950: location.</p>
! 8951: </li>
! 8952: </ul>
! 8953: </div>
! 8954:
! 8955: <p>The only variables that users should customize are
! 8956: <tt class="varname">PKG_SYSCONFBASE</tt> and <tt class=
! 8957: "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</tt>. Users
! 8958: will typically want to set <tt class=
! 8959: "varname">PKG_SYSCONFBASE</tt> to <tt class=
! 8960: "filename">/etc</tt>, or to accept the default location
! 8961: of <tt class="filename">${PREFIX}/etc</tt>.</p>
! 8962: </div>
! 8963:
! 8964: <div class="sect2" lang="en" xml:lang="en">
! 8965: <div class="titlepage">
! 8966: <div>
! 8967: <div>
! 8968: <h3 class="title"><a name="id2572859" id=
! 8969: "id2572859"></a>12.5.2. User
! 8970: Interaction</h3>
! 8971: </div>
! 8972: </div>
! 8973: </div>
! 8974:
! 8975: <p>Occasionally, packages require interaction from the
! 8976: user, and this can be in a number of ways:</p>
! 8977:
! 8978: <div class="itemizedlist">
! 8979: <ul type="disc">
! 8980: <li>
! 8981: <p>help in fetching the distfiles</p>
! 8982: </li>
! 8983:
! 8984: <li>
! 8985: <p>help to configure the package before it is
! 8986: built</p>
! 8987: </li>
! 8988:
! 8989: <li>
! 8990: <p>help during the build process</p>
! 8991: </li>
! 8992:
! 8993: <li>
! 8994: <p>help during the installation of a package</p>
! 8995: </li>
! 8996: </ul>
! 8997: </div>
! 8998:
! 8999: <p>The <tt class="varname">INTERACTIVE_STAGE</tt>
! 9000: definition is provided to notify the pkgsrc mechanism
! 9001: of an interactive stage which will be needed, and this
! 9002: should be set in the package's <tt class=
! 9003: "filename">Makefile</tt>. e.g.</p>
! 9004: <pre class="programlisting">
! 9005: INTERACTIVE_STAGE= build
! 9006: </pre>
! 9007:
! 9008: <p>Multiple interactive stages can be specified:</p>
! 9009: <pre class="programlisting">
! 9010: INTERACTIVE_STAGE= configure install
! 9011: </pre>
! 9012: </div>
! 9013:
! 9014: <div class="sect2" lang="en" xml:lang="en">
! 9015: <div class="titlepage">
! 9016: <div>
! 9017: <div>
! 9018: <h3 class="title"><a name="id2572904" id=
! 9019: "id2572904"></a>12.5.3. Handling
! 9020: licenses</h3>
! 9021: </div>
! 9022: </div>
! 9023: </div>
! 9024:
! 9025: <p>A package may underly a license which the user has
! 9026: or has not agreed to accept. Usually, packages that
! 9027: underly well-known Open Source licenses (e.g. the GNU
! 9028: Public License, GPL) won't have any special license
! 9029: tags added in pkgsrc which require special action by
! 9030: the user of such packages, but there are quite a number
! 9031: of other licenses out there that pkgsrc users may not
! 9032: be able to follow, for whatever reasons. For these
! 9033: cases, pkgsrc contains a mechanism to note that a
! 9034: package underlies a certain license, and the user has
! 9035: to accept the license before the package can be
! 9036: installed.</p>
! 9037:
! 9038: <p>Placing a certain package under a certain license
! 9039: works by setting the <tt class="varname">LICENSE</tt>
! 9040: variable to a string identifying the license, e.g. in
! 9041: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 9042: href=
! 9043: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
! 9044: class="pkgname">graphics/graphviz</a>:</p>
! 9045: <pre class="programlisting">
! 9046: LICENSE= graphviz-license
! 9047: </pre>
! 9048:
! 9049: <p>When trying to build, the user will get a notice
! 9050: that the package underlies a license which he hasn't
! 9051: accepted (yet):</p>
! 9052: <pre class="programlisting">
! 9053: <tt class="prompt">%</tt> <b class="userinput"><tt>make</tt></b>
! 9054: ===> graphviz-1.12 has an unacceptable license: graphviz-license.
! 9055: ===> To build this package, add this line to your /etc/mk.conf:
! 9056: ===> ACCEPTABLE_LICENSES+=graphviz-license
! 9057: ===> To view the license, enter "/usr/bin/make show-license".
! 9058: *** Error code 1
! 9059: </pre>
! 9060:
! 9061: <p>The license can be viewed with <span><b class=
! 9062: "command">make show-license</b></span>, and if it is
! 9063: considered appropriate, the line printed above can be
! 9064: added to <tt class="filename">/etc/mk.conf</tt> to
! 9065: indicate acceptance of the particular license:</p>
! 9066: <pre class="programlisting">
! 9067: ACCEPTABLE_LICENSES+=graphviz-license
! 9068: </pre>
! 9069:
! 9070: <p>When adding a package with a new license, the
! 9071: license text should be added to <tt class=
! 9072: "filename">pkgsrc/licenses</tt> for displaying. A list
! 9073: of known licenses can be seen in this directory as well
! 9074: as by looking at the list of (commented out) <tt class=
! 9075: "varname">ACCEPTABLE_LICENSES</tt> variable settings in
! 9076: <tt class=
! 9077: "filename">pkgsrc/mk/bsd.pkg.defaults.mk</tt>.</p>
! 9078:
! 9079: <p>Is there is a <span class=
! 9080: "emphasis"><em>really</em></span> pressing need to
! 9081: accept all licenses at once, like when trying to
! 9082: download or mirror all distfiles or doing a bulk build
! 9083: to test if all packages in pkgsrc build, this can be
! 9084: done by setting <tt class=
! 9085: "varname">_ACCEPTABLE=yes</tt>.</p>
! 9086: </div>
! 9087:
! 9088: <div class="sect2" lang="en" xml:lang="en">
! 9089: <div class="titlepage">
! 9090: <div>
! 9091: <div>
! 9092: <h3 class="title"><a name="id2572987" id=
! 9093: "id2572987"></a>12.5.4. Creating an account
! 9094: from a package</h3>
! 9095: </div>
! 9096: </div>
! 9097: </div>
! 9098:
! 9099: <p>There are two make variables used to control the
! 9100: creation of package-specific groups and users at
! 9101: pre-install time. The first is <tt class=
! 9102: "varname">PKG_GROUPS</tt>, which is a list of
! 9103: group[:groupid] elements, where the groupid is
! 9104: optional. The second is <tt class=
! 9105: "varname">PKG_USERS</tt>, which is a list of elements
! 9106: of the form:</p>
! 9107: <pre class="programlisting">
! 9108: user:group[:[userid][:[description][:[home][:shell]]]]
! 9109: </pre>
! 9110:
! 9111: <p>where only the user and group are required, the rest
! 9112: being optional. A simple example is:</p>
! 9113: <pre class="programlisting">
! 9114: PKG_GROUPS= foogroup
! 9115: PKG_USERS= foouser:foogroup
! 9116: </pre>
! 9117:
! 9118: <p>A more complex example is that creates two groups
! 9119: and two users is:</p>
! 9120: <pre class="programlisting">
! 9121: PKG_GROUPS= group1 group2:1005
! 9122: PKG_USERS= first:group1::First\\ User \
! 9123: second:group2::Second\\ User:/home/second:${SH}
! 9124: </pre>
! 9125:
! 9126: <p>By default, a new user will have home directory
! 9127: <tt class="filename">/nonexistent</tt>, and login shell
! 9128: <tt class="filename">/sbin/nologin</tt> unless they are
! 9129: specified as part of the user element.</p>
! 9130:
! 9131: <p>The package <tt class="filename">Makefile</tt> must
! 9132: also set <tt class="varname">USE_PKGINSTALL=YES</tt>.
! 9133: This will cause the users and groups to be created at
! 9134: pre-install time, and the admin will be prompted to
! 9135: remove them at post-deinstall time. Automatic creation
! 9136: of the users and groups can be toggled on and off by
! 9137: setting the <tt class=
! 9138: "varname">PKG_CREATE_USERGROUP</tt> variable prior to
! 9139: package installation.</p>
! 9140: </div>
! 9141:
! 9142: <div class="sect2" lang="en" xml:lang="en">
! 9143: <div class="titlepage">
! 9144: <div>
! 9145: <div>
! 9146: <h3 class="title"><a name="id2573049" id=
! 9147: "id2573049"></a>12.5.5. Installing score
! 9148: files</h3>
! 9149: </div>
! 9150: </div>
! 9151: </div>
! 9152:
! 9153: <p>Certain packages, most of them in the games
! 9154: category, install a score file that allows all users on
! 9155: the system to record their highscores. In order for
! 9156: this to work, the binaries need to be installed setgid
! 9157: and the score files owned by the appropriate group
! 9158: and/or owner (traditionally the "games" user/group).
! 9159: The following variables, documented in more detail in
! 9160: <tt class="filename">mk/bsd.pkg.defaults.mk</tt>,
! 9161: control this behaviour: <tt class=
! 9162: "varname">SETGIDGAME</tt>, <tt class=
! 9163: "varname">GAMEDATAMODE</tt>, <tt class=
! 9164: "varname">GAMEGRP</tt>, <tt class=
! 9165: "varname">GAMEMODE</tt>, <tt class=
! 9166: "varname">GAMEOWN</tt>.</p>
! 9167:
! 9168: <p>Note that per default, setgid installation of games
! 9169: is disabled; setting <tt class=
! 9170: "varname">SETGIDGAME=YES</tt> will set all the other
! 9171: variables accordingly.</p>
! 9172:
! 9173: <p>A package should therefor never hard code file
! 9174: ownership or access permissions but rely on <tt class=
! 9175: "varname">INSTALL_GAME</tt> and <tt class=
! 9176: "varname">INSTALL_GAME_DATA</tt> to set these
! 9177: correctly.</p>
! 9178: </div>
! 9179:
! 9180: <div class="sect2" lang="en" xml:lang="en">
! 9181: <div class="titlepage">
! 9182: <div>
! 9183: <div>
! 9184: <h3 class="title"><a name="id2573093" id=
! 9185: "id2573093"></a>12.5.6. Packages providing
! 9186: login shells</h3>
! 9187: </div>
! 9188: </div>
! 9189: </div>
! 9190:
! 9191: <p>If the purpose of the package is to provide a login
! 9192: shell, the variable <tt class="varname">PKG_SHELL</tt>
! 9193: should contain the full pathname of the shell
! 9194: executable installed by this package. The package
! 9195: <tt class="filename">Makefile</tt> must also set
! 9196: <tt class="varname">USE_PKGINSTALL=YES</tt> to use the
! 9197: automatically generated <tt class=
! 9198: "filename">INSTALL</tt>/<tt class=
! 9199: "filename">DEINSTALL</tt> scripts.</p>
! 9200:
! 9201: <p>An example taken from shells/zsh:</p>
! 9202: <pre class="programlisting">
! 9203: USE_PKGINSTALL= YES
! 9204: PKG_SHELL= ${PREFIX}/bin/zsh
! 9205: </pre>
! 9206:
! 9207: <p>The shell is registered into <tt class=
! 9208: "filename">/etc/shells</tt> file automatically in the
! 9209: post-install target by the generated <tt class=
! 9210: "filename">INSTALL</tt> script and removed in the
! 9211: deinstall target by the <tt class=
! 9212: "filename">DEINSTALL</tt> script.</p>
! 9213: </div>
! 9214:
! 9215: <div class="sect2" lang="en" xml:lang="en">
! 9216: <div class="titlepage">
! 9217: <div>
! 9218: <div>
! 9219: <h3 class="title"><a name="id2573424" id=
! 9220: "id2573424"></a>12.5.7. Packages containing
! 9221: perl scripts</h3>
! 9222: </div>
! 9223: </div>
! 9224: </div>
! 9225:
! 9226: <p>If your package contains interpreted perl scripts,
! 9227: set <tt class="varname">REPLACE_PERL</tt> to ensure
! 9228: that the proper interpreter path is set. <tt class=
! 9229: "varname">REPLACE_PERL</tt> should contain a list of
! 9230: scripts, relative to <tt class="varname">WRKSRC</tt>,
! 9231: that you want adjusted.</p>
! 9232: </div>
! 9233:
! 9234: <div class="sect2" lang="en" xml:lang="en">
! 9235: <div class="titlepage">
! 9236: <div>
! 9237: <div>
! 9238: <h3 class="title"><a name="id2573442" id=
! 9239: "id2573442"></a>12.5.8. Packages with
! 9240: hardcoded paths to other interpreters</h3>
! 9241: </div>
! 9242: </div>
! 9243: </div>
! 9244:
! 9245: <p>Your package may also contain scripts with hardcoded
! 9246: paths to other interpreters besides (or as well as)
! 9247: perl. To correct the full pathname to the script
! 9248: interpreter, you need to set the following definitions
! 9249: in your <tt class="filename">Makefile</tt> (we shall
! 9250: use <span><b class="command">tclsh</b></span> in this
! 9251: example):</p>
! 9252: <pre class="programlisting">
! 9253: REPLACE_INTERPRETER+= tcl
! 9254: _REPLACE.tcl.old= .*/bin/tclsh
! 9255: _REPLACE.tcl.new= ${PREFIX}/bin/tclsh
! 9256: _REPLACE_FILES.tcl= ...list of tcl scripts which need to be fixed,
! 9257: relative to ${WRKSRC}, just as in REPLACE_PERL
! 9258: </pre>
! 9259: </div>
! 9260:
! 9261: <div class="sect2" lang="en" xml:lang="en">
! 9262: <div class="titlepage">
! 9263: <div>
! 9264: <div>
! 9265: <h3 class="title"><a name="id2573463" id=
! 9266: "id2573463"></a>12.5.9. Packages installing
! 9267: perl modules</h3>
! 9268: </div>
! 9269: </div>
! 9270: </div>
! 9271:
! 9272: <p>Makefiles of packages providing perl5 modules should
! 9273: include the Makefile fragment <tt class=
! 9274: "filename">../../lang/perl5/module.mk</tt>. It provides
! 9275: a <span><b class="command">do-configure</b></span>
! 9276: target for the standard perl configuration for such
! 9277: modules as well as various hooks to tune this
! 9278: configuration. See comments in this file for
! 9279: details.</p>
! 9280:
! 9281: <p>Perl5 modules will install into different places
! 9282: depending on the version of perl used during the build
! 9283: process. To address this, pkgsrc will append lines to
! 9284: the <tt class="filename">PLIST</tt> corresponding to
! 9285: the files listed in the installed <tt class=
! 9286: "filename">.packlist</tt> file generated by most perl5
! 9287: modules. This is invoked by defining <tt class=
! 9288: "varname">PERL5_PACKLIST</tt> to a space-separated list
! 9289: of paths to packlist files, e.g.:</p>
! 9290: <pre class="programlisting">
! 9291: PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
! 9292: </pre>
! 9293:
! 9294: <p>The variables <tt class=
! 9295: "varname">PERL5_SITELIB</tt>, <tt class=
! 9296: "varname">PERL5_SITEARCH</tt>, and <tt class=
! 9297: "varname">PERL5_ARCHLIB</tt> represent the three
! 9298: locations in which perl5 modules may be installed, and
! 9299: may be used by perl5 packages that don't have a
! 9300: packlist. These three variables are also substituted
! 9301: for in the <tt class="filename">PLIST</tt>.</p>
! 9302: </div>
! 9303:
! 9304: <div class="sect2" lang="en" xml:lang="en">
! 9305: <div class="titlepage">
! 9306: <div>
! 9307: <div>
! 9308: <h3 class="title"><a name="faq.info-files" id=
! 9309: "faq.info-files"></a>12.5.10. Packages
! 9310: installing info files</h3>
! 9311: </div>
! 9312: </div>
! 9313: </div>
! 9314:
! 9315: <p>Some packages install info files or use the
! 9316: “<span class="quote">makeinfo</span>” or
! 9317: “<span class="quote">install-info</span>”
! 9318: commands. Each of the info files:</p>
! 9319:
! 9320: <div class="itemizedlist">
! 9321: <ul type="disc">
! 9322: <li>
! 9323: <p>is considered to be installed in the directory
! 9324: <tt class=
! 9325: "filename">${PREFIX}/${INFO_DIR}</tt>,</p>
! 9326: </li>
! 9327:
! 9328: <li>
! 9329: <p>is registered in the Info directory file
! 9330: <tt class=
! 9331: "filename">${PREFIX}/${INFO_DIR}/dir</tt>,</p>
! 9332: </li>
! 9333:
! 9334: <li>
! 9335: <p>and must be listed as a filename in the
! 9336: <tt class="varname">INFO_FILES</tt> variable in
! 9337: the package Makefile.</p>
! 9338: </li>
! 9339: </ul>
! 9340: </div>
! 9341:
! 9342: <p><tt class="varname">INFO_DIR</tt> defaults to
! 9343: “<span class="quote">info</span>” and can
! 9344: be overridden in the package Makefile. <tt class=
! 9345: "filename">INSTALL</tt> and <tt class=
! 9346: "filename">DEINSTALL</tt> scripts will be generated to
! 9347: handle registration of the info files in the Info
! 9348: directory file. The “<span class=
! 9349: "quote">install-info</span>” command used for the
! 9350: info files registration is either provided by the
! 9351: system, or by a special purpose package automatically
! 9352: added as dependency if needed.</p>
! 9353:
! 9354: <p>A package which needs the “<span class=
! 9355: "quote">makeinfo</span>” command at build time
! 9356: must define the variable <tt class=
! 9357: "varname">USE_MAKEINFO</tt> in its Makefile. If a
! 9358: minimum version of the “<span class=
! 9359: "quote">makeinfo</span>” command is needed it
! 9360: should be noted with the <tt class=
! 9361: "varname">TEXINFO_REQD</tt> variable in the package
! 9362: <tt class="filename">Makefile</tt>. By default, a
! 9363: minimum version of 3.12 is required. If the system does
! 9364: not provide a <span><b class=
! 9365: "command">makeinfo</b></span> command or if it does not
! 9366: match the required minimum, a build dependency on the
! 9367: <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
! 9368: href=
! 9369: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
! 9370: class="pkgname">devel/gtexinfo</a> package will be
! 9371: added automatically.</p>
! 9372:
! 9373: <p>The build and installation process of the software
! 9374: provided by the package should not use the
! 9375: <span><b class="command">install-info</b></span>
! 9376: command as the registration of info files is the task
! 9377: of the package <tt class="filename">INSTALL</tt>
! 9378: script, and it must use the appropriate <span><b class=
! 9379: "command">makeinfo</b></span> command.</p>
! 9380:
! 9381: <p>To achieve this goal the pkgsrc infrastructure
! 9382: creates overriding scripts for the <span><b class=
! 9383: "command">install-info</b></span> and <span><b class=
! 9384: "command">makeinfo</b></span> commands in a directory
! 9385: listed early in <tt class="varname">PATH</tt>.</p>
! 9386:
! 9387: <p>The script overriding <span><b class=
! 9388: "command">install-info</b></span> has no effect except
! 9389: the logging of a message. The script overriding
! 9390: <span><b class="command">makeinfo</b></span> logs a
! 9391: message and according to the value of <tt class=
! 9392: "varname">USE_MAKEINFO</tt> and <tt class=
! 9393: "varname">TEXINFO_REQD</tt> either run the appropriate
! 9394: <span><b class="command">makeinfo</b></span> command or
! 9395: exit on error.</p>
! 9396: </div>
! 9397:
! 9398: <div class="sect2" lang="en" xml:lang="en">
! 9399: <div class="titlepage">
! 9400: <div>
! 9401: <div>
! 9402: <h3 class="title"><a name="id2573751" id=
! 9403: "id2573751"></a>12.5.11. Packages installing
! 9404: GConf2 data files</h3>
! 9405: </div>
! 9406: </div>
! 9407: </div>
! 9408:
! 9409: <p>If a package installs <tt class=
! 9410: "filename">.schemas</tt> or <tt class=
! 9411: "filename">.entries</tt> files, used by GConf2, you
! 9412: need to take some extra steps to make sure they get
! 9413: registered in the database:</p>
! 9414:
! 9415: <div class="orderedlist">
! 9416: <ol type="1">
! 9417: <li>
! 9418: <p>Include <tt class=
! 9419: "filename">../../devel/GConf2/schemas.mk</tt>
! 9420: instead of its <tt class=
! 9421: "filename">buildlink3.mk</tt> file. This takes
! 9422: care of rebuilding the GConf2 database at
! 9423: installation and deinstallation time, and tells
! 9424: the package where to install GConf2 data files
! 9425: using some standard configure arguments. It also
! 9426: disallows any access to the database directly
! 9427: from the package.</p>
! 9428: </li>
! 9429:
! 9430: <li>
! 9431: <p>Ensure that the package installs its
! 9432: <tt class="filename">.schemas</tt> files under
! 9433: <tt class=
! 9434: "filename">${PREFIX}/share/gconf/schemas</tt>. If
! 9435: they get installed under <tt class=
! 9436: "filename">${PREFIX}/etc</tt>, you will need to
! 9437: manually patch the package.</p>
! 9438: </li>
! 9439:
! 9440: <li>
! 9441: <p>Check the PLIST and remove any entries under
! 9442: the etc/gconf directory, as they will be handled
! 9443: automatically. See <a href="#faq.conf" title=
! 9444: "6.13. Configuration files handling and placement">
! 9445: Section 6.13, “Configuration files
! 9446: handling and placement”</a> for more
! 9447: information.</p>
! 9448: </li>
! 9449:
! 9450: <li>
! 9451: <p>Define the <tt class=
! 9452: "varname">GCONF2_SCHEMAS</tt> variable in your
! 9453: <tt class="filename">Makefile</tt> with a list of
! 9454: all <tt class="filename">.schemas</tt> files
! 9455: installed by the package, if any. Names must not
! 9456: contain any directories in them.</p>
! 9457: </li>
! 9458:
! 9459: <li>
! 9460: <p>Define the <tt class=
! 9461: "varname">GCONF2_ENTRIES</tt> variable in your
! 9462: <tt class="filename">Makefile</tt> with a list of
! 9463: all <tt class="filename">.entries</tt> files
! 9464: installed by the package, if any. Names must not
! 9465: contain any directories in them.</p>
! 9466: </li>
! 9467: </ol>
! 9468: </div>
! 9469: </div>
! 9470:
! 9471: <div class="sect2" lang="en" xml:lang="en">
! 9472: <div class="titlepage">
! 9473: <div>
! 9474: <div>
! 9475: <h3 class="title"><a name="id2573851" id=
! 9476: "id2573851"></a>12.5.12. Packages installing
! 9477: scrollkeeper data files</h3>
! 9478: </div>
! 9479: </div>
! 9480: </div>
! 9481:
! 9482: <p>If a package installs <tt class="filename">.omf</tt>
! 9483: files, used by scrollkeeper, you need to take some
! 9484: extra steps to make sure they get registered in the
! 9485: database:</p>
! 9486:
! 9487: <div class="orderedlist">
! 9488: <ol type="1">
! 9489: <li>
! 9490: <p>Include <tt class=
! 9491: "filename">../../textproc/scrollkeeper/omf.mk</tt>
! 9492: instead of its <tt class=
! 9493: "filename">buildlink3.mk</tt> file. This takes
! 9494: care of rebuilding the scrollkeeper database at
! 9495: installation and deinstallation time, and
! 9496: disallows any access to it directly from the
! 9497: package.</p>
! 9498: </li>
! 9499:
! 9500: <li>
! 9501: <p>Check the PLIST and remove any entries under
! 9502: the <tt class=
! 9503: "filename">libdata/scrollkeeper</tt> directory,
! 9504: as they will be handled automatically.</p>
! 9505: </li>
! 9506:
! 9507: <li>
! 9508: <p>Remove the <tt class="filename">share/omf</tt>
! 9509: directory from the PLIST. It will be handled by
! 9510: scrollkeeper.</p>
! 9511: </li>
! 9512: </ol>
! 9513: </div>
! 9514: </div>
! 9515:
! 9516: <div class="sect2" lang="en" xml:lang="en">
! 9517: <div class="titlepage">
! 9518: <div>
! 9519: <div>
! 9520: <h3 class="title"><a name="id2573902" id=
! 9521: "id2573902"></a>12.5.13. Packages installing
! 9522: X11 fonts</h3>
! 9523: </div>
! 9524: </div>
! 9525: </div>
! 9526:
! 9527: <p>If a package installs font files, you will need to
! 9528: rebuild the fonts database in the directory where they
! 9529: get installed at installation and deinstallation time.
! 9530: This can be automatically done by using <tt class=
! 9531: "filename">mk/fonts.mk</tt>, which you need to include
! 9532: in your <tt class="filename">Makefile</tt>.</p>
! 9533:
! 9534: <p>When the file is included, you can list the
! 9535: directories where fonts are installed in the <tt class=
! 9536: "varname">FONTS_<i class=
! 9537: "replaceable"><tt>type</tt></i>_DIRS</tt> variables,
! 9538: where <i class="replaceable"><tt>type</tt></i> can be
! 9539: one of “<span class="quote">TTF</span>”,
! 9540: “<span class="quote">TYPE1</span>” or
! 9541: “<span class="quote">X11</span>”. Also make
! 9542: sure that the database file <tt class=
! 9543: "filename">fonts.dir</tt> is not listed in the
! 9544: PLIST.</p>
! 9545:
! 9546: <p>Note that you should not create new directories for
! 9547: fonts; instead use the standard ones to avoid that the
! 9548: user needs to manually configure his X server to find
! 9549: them.</p>
! 9550: </div>
! 9551:
! 9552: <div class="sect2" lang="en" xml:lang="en">
! 9553: <div class="titlepage">
! 9554: <div>
! 9555: <div>
! 9556: <h3 class="title"><a name="id2574018" id=
! 9557: "id2574018"></a>12.5.14. Packages installing
! 9558: GTK2 modules</h3>
! 9559: </div>
! 9560: </div>
! 9561: </div>
! 9562:
! 9563: <p>If a package installs gtk2 immodules or loaders, you
! 9564: need to take some extra steps to get them registered in
! 9565: the GTK2 database properly:</p>
! 9566:
! 9567: <div class="orderedlist">
! 9568: <ol type="1">
! 9569: <li>
! 9570: <p>Include <tt class=
! 9571: "filename">../../x11/gtk2/modules.mk</tt> instead
! 9572: of its <tt class="filename">buildlink3.mk</tt>
! 9573: file. This takes care of rebuilding the database
! 9574: at installation and deinstallation time.</p>
! 9575: </li>
! 9576:
! 9577: <li>
! 9578: <p>Set <tt class=
! 9579: "varname">GTK2_IMMODULES=YES</tt> if your package
! 9580: installs GTK2 immodules.</p>
! 9581: </li>
! 9582:
! 9583: <li>
! 9584: <p>Set <tt class="varname">GTK2_LOADERS=YES</tt>
! 9585: if your package installs GTK2 loaders.</p>
! 9586: </li>
! 9587:
! 9588: <li>
! 9589: <p>Patch the package to not touch any of the gtk2
! 9590: databases directly. These are:</p>
! 9591:
! 9592: <div class="itemizedlist">
! 9593: <ul type="disc">
! 9594: <li>
! 9595: <p><tt class=
! 9596: "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</tt></p>
! 9597: </li>
! 9598:
! 9599: <li>
! 9600: <p><tt class=
! 9601: "filename">libdata/gtk-2.0/gtk.immodules</tt></p>
! 9602: </li>
! 9603: </ul>
! 9604: </div>
! 9605: </li>
! 9606:
! 9607: <li>
! 9608: <p>Check the PLIST and remove any entries under
! 9609: the <tt class="filename">libdata/gtk-2.0</tt>
! 9610: directory, as they will be handled
! 9611: automatically.</p>
! 9612: </li>
! 9613: </ol>
! 9614: </div>
! 9615: </div>
! 9616:
! 9617: <div class="sect2" lang="en" xml:lang="en">
! 9618: <div class="titlepage">
! 9619: <div>
! 9620: <div>
! 9621: <h3 class="title"><a name="id2574087" id=
! 9622: "id2574087"></a>12.5.15. Packages installing
! 9623: SGML or XML data</h3>
! 9624: </div>
! 9625: </div>
! 9626: </div>
! 9627:
! 9628: <p>If a package installs SGML or XML data files that
! 9629: need to be registered in system-wide catalogs (like
! 9630: DTDs, sub-catalogs, etc.), you need to take some extra
! 9631: steps:</p>
! 9632:
! 9633: <div class="orderedlist">
! 9634: <ol type="1">
! 9635: <li>
! 9636: <p>Include <tt class=
! 9637: "filename">../../textproc/xmlcatmgr/catalogs.mk</tt>
! 9638: in your <tt class="filename">Makefile</tt>, which
! 9639: takes care of registering those files in
! 9640: system-wide catalogs at installation and
! 9641: deinstallation time.</p>
! 9642: </li>
! 9643:
! 9644: <li>
! 9645: <p>Set <tt class="varname">SGML_CATALOGS</tt> to
! 9646: the full path of any SGML catalogs installed by
! 9647: the package.</p>
! 9648: </li>
! 9649:
! 9650: <li>
! 9651: <p>Set <tt class="varname">XML_CATALOGS</tt> to
! 9652: the full path of any XML catalogs installed by
! 9653: the package.</p>
! 9654: </li>
! 9655:
! 9656: <li>
! 9657: <p>Set <tt class="varname">SGML_ENTRIES</tt> to
! 9658: individual entries to be added to the SGML
! 9659: catalog. These come in groups of three strings;
! 9660: see xmlcatmgr(1) for more information
! 9661: (specifically, arguments recognized by the 'add'
! 9662: action). Note that you will normally not use this
! 9663: variable.</p>
! 9664: </li>
! 9665:
! 9666: <li>
! 9667: <p>Set <tt class="varname">XML_ENTRIES</tt> to
! 9668: individual entries to be added to the XML
! 9669: catalog. These come in groups of three strings;
! 9670: see xmlcatmgr(1) for more information
! 9671: (specifically, arguments recognized by the 'add'
! 9672: action). Note that you will normally not use this
! 9673: variable.</p>
! 9674: </li>
! 9675: </ol>
! 9676: </div>
! 9677: </div>
! 9678:
! 9679: <div class="sect2" lang="en" xml:lang="en">
! 9680: <div class="titlepage">
! 9681: <div>
! 9682: <div>
! 9683: <h3 class="title"><a name="id2574139" id=
! 9684: "id2574139"></a>12.5.16. Packages installing
! 9685: extensions to the MIME database</h3>
! 9686: </div>
! 9687: </div>
! 9688: </div>
! 9689:
! 9690: <p>If a package provides extensions to the MIME
! 9691: database by installing <tt class="filename">.xml</tt>
! 9692: files inside <tt class=
! 9693: "filename">${PREFIX}/share/mime/packages</tt>, you need
! 9694: to take some extra steps to ensure that the database is
! 9695: kept consistent with respect to these new files:</p>
! 9696:
! 9697: <div class="orderedlist">
! 9698: <ol type="1">
! 9699: <li>
! 9700: <p>Include <tt class=
! 9701: "filename">../../databases/shared-mime-info/mimedb.mk</tt>
! 9702: (avoid using the <tt class=
! 9703: "filename">buildlink3.mk</tt> file from this same
! 9704: directory, which is reserved for inclusion from
! 9705: other <tt class="filename">buildlink3.mk</tt>
! 9706: files). It takes care of rebuilding the MIME
! 9707: database at installation and deinstallation time,
! 9708: and disallows any access to it directly from the
! 9709: package.</p>
! 9710: </li>
! 9711:
! 9712: <li>
! 9713: <p>Check the PLIST and remove any entries under
! 9714: the <tt class="filename">share/mime</tt>
! 9715: directory, <span class=
! 9716: "emphasis"><em>except</em></span> for files saved
! 9717: under <tt class=
! 9718: "filename">share/mime/packages</tt>. The former
! 9719: are handled automatically by the
! 9720: update-mime-database program, but the later are
! 9721: package-dependent and must be removed by the
! 9722: package that installed them in the first
! 9723: place.</p>
! 9724: </li>
! 9725:
! 9726: <li>
! 9727: <p>Remove any <tt class=
! 9728: "filename">share/mime/*</tt> directories from the
! 9729: PLIST. They will be handled by the
! 9730: shared-mime-info package.</p>
! 9731: </li>
! 9732: </ol>
! 9733: </div>
! 9734: </div>
! 9735:
! 9736: <div class="sect2" lang="en" xml:lang="en">
! 9737: <div class="titlepage">
! 9738: <div>
! 9739: <div>
! 9740: <h3 class="title"><a name="id2574210" id=
! 9741: "id2574210"></a>12.5.17. Packages using
! 9742: intltool</h3>
! 9743: </div>
! 9744: </div>
! 9745: </div>
! 9746:
! 9747: <p>If a package uses intltool during its build, include
! 9748: the <tt class=
! 9749: "filename">../../textproc/intltool/buildlink3.mk</tt>
! 9750: file, which forces it to use the intltool package
! 9751: provided by pkgsrc, instead of the one bundled with the
! 9752: distribution file.</p>
! 9753:
! 9754: <p>This tracks intltool's build-time dependencies and
! 9755: uses the latest available version; this way, the
! 9756: package benefits of any bug fixes that may have
! 9757: appeared since it was released.</p>
! 9758: </div>
! 9759: </div>
! 9760:
! 9761: <div class="sect1" lang="en" xml:lang="en">
! 9762: <div class="titlepage">
! 9763: <div>
! 9764: <div>
! 9765: <h2 class="title" style="clear: both"><a name=
! 9766: "id2574224" id="id2574224"></a>12.6. Feedback
! 9767: to the author</h2>
! 9768: </div>
! 9769: </div>
! 9770: </div>
! 9771:
! 9772: <p>If you have found any bugs in the package you make
! 9773: available, if you had to do special steps to make it run
! 9774: under NetBSD or if you enhanced the software in various
! 9775: other ways, be sure to report these changes back to the
! 9776: original author of the program! With that kind of
! 9777: support, the next release of the program can incorporate
! 9778: these fixes, and people not using the NetBSD packages
! 9779: system can win from your efforts.</p>
! 9780:
! 9781: <p>Support the idea of free software!</p>
! 9782: </div>
! 9783: </div>
! 9784:
! 9785: <div class="chapter" lang="en" xml:lang="en">
! 9786: <div class="titlepage">
! 9787: <div>
! 9788: <div>
! 9789: <h2 class="title"><a name="debug" id=
! 9790: "debug"></a>Chapter 13. Debugging</h2>
! 9791: </div>
! 9792: </div>
! 9793: </div>
! 9794:
! 9795: <p>To check out all the gotchas when building a package,
! 9796: here are the steps that I do in order to get a package
! 9797: working. Please note this is basically the same as what was
! 9798: explained in the previous sections, only with some
! 9799: debugging aids.</p>
! 9800:
! 9801: <div class="itemizedlist">
! 9802: <ul type="disc">
! 9803: <li>
! 9804: <p>Be sure to set <tt class=
! 9805: "varname">PKG_DEVELOPER=1</tt> in <tt class=
! 9806: "filename">/etc/mk.conf</tt></p>
! 9807: </li>
! 9808:
! 9809: <li>
! 9810: <p>Install <a xmlns=
! 9811: "http://www.w3.org/TR/xhtml1/transitional" href=
! 9812: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
! 9813: class="pkgname">pkgtools/url2pkg</a>, create a
! 9814: directory for a new package, change into it, then run
! 9815: <span><b class="command">url2pkg</b></span>:</p>
! 9816: <pre class="screen">
! 9817: <tt class="prompt">%</tt> <b class=
! 9818: "userinput"><tt>mkdir /usr/pkgsrc/<i class=
! 9819: "replaceable"><tt>category</tt></i>/<i class=
! 9820: "replaceable"><tt>examplepkg</tt></i></tt></b>
! 9821: <tt class="prompt">%</tt> <b class=
! 9822: "userinput"><tt>cd /usr/pkgsrc/<i class=
! 9823: "replaceable"><tt>category</tt></i>/<i class=
! 9824: "replaceable"><tt>examplepkg</tt></i></tt></b>
! 9825: <tt class="prompt">%</tt> <b class=
! 9826: "userinput"><tt>url2pkg http://www.example.com/path/to/distfile.tar.gz</tt></b>
! 9827: </pre>
! 9828: </li>
! 9829:
! 9830: <li>
! 9831: <p>Edit the <tt class="filename">Makefile</tt> as
! 9832: requested.</p>
! 9833: </li>
! 9834:
! 9835: <li>
! 9836: <p>Fill in the <tt class="filename">DESCR</tt>
! 9837: file</p>
! 9838: </li>
! 9839:
! 9840: <li>
! 9841: <p>Run <span><b class="command">make
! 9842: configure</b></span></p>
! 9843: </li>
! 9844:
! 9845: <li>
! 9846: <p>Add any dependencies glimpsed from documentation
! 9847: and the configure step to the package's <tt class=
! 9848: "filename">Makefile</tt>.</p>
! 9849: </li>
! 9850:
! 9851: <li>
! 9852: <p>Make the package compile, doing multiple rounds
! 9853: of</p>
! 9854: <pre class="screen">
! 9855: <tt class="prompt">%</tt> <b class="userinput"><tt>make</tt></b>
! 9856: <tt class="prompt">%</tt> <b class=
! 9857: "userinput"><tt>pkgvi ${WRKSRC}/some/file/that/does/not/compile</tt></b>
! 9858: <tt class="prompt">%</tt> <b class=
! 9859: "userinput"><tt>mkpatches</tt></b>
! 9860: <tt class="prompt">%</tt> <b class=
! 9861: "userinput"><tt>patchdiff</tt></b>
! 9862: <tt class="prompt">%</tt> <b class=
! 9863: "userinput"><tt>mv ${WRKDIR}/.newpatches/* patches</tt></b>
! 9864: <tt class="prompt">%</tt> <b class=
! 9865: "userinput"><tt>make mps</tt></b>
! 9866: <tt class="prompt">%</tt> <b class=
! 9867: "userinput"><tt>make clean</tt></b>
! 9868: </pre>
! 9869:
! 9870: <p>Doing as non-root user will ensure that no files
! 9871: are modified that shouldn't be, especially during the
! 9872: build phase. <span><b class=
! 9873: "command">mkpatches</b></span>, <span><b class=
! 9874: "command">patchdiff</b></span> and <span><b class=
! 9875: "command">pkgvi</b></span> are from the <a xmlns=
! 9876: "http://www.w3.org/TR/xhtml1/transitional" href=
! 9877: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
! 9878: class="pkgname">pkgtools/pkgdiff</a> package.</p>
! 9879: </li>
! 9880:
! 9881: <li>
! 9882: <p>Look at the <tt class="filename">Makefile</tt>,
! 9883: fix if necessary; see <a href="#components.Makefile"
! 9884: title="7.1. Makefile">Section 7.1,
! 9885: “Makefile”</a>.</p>
! 9886: </li>
! 9887:
! 9888: <li>
! 9889: <p>Generate a <tt class="filename">PLIST</tt>:</p>
! 9890: <pre class="screen">
! 9891: <tt class="prompt">#</tt> <b class=
! 9892: "userinput"><tt>make install</tt></b>
! 9893: <tt class="prompt">#</tt> <b class=
! 9894: "userinput"><tt>make print-PLIST >PLIST</tt></b>
! 9895: <tt class="prompt">#</tt> <b class=
! 9896: "userinput"><tt>make deinstall</tt></b>
! 9897: <tt class="prompt">#</tt> <b class=
! 9898: "userinput"><tt>make install</tt></b>
! 9899: <tt class="prompt">#</tt> <b class=
! 9900: "userinput"><tt>make deinstall</tt></b>
! 9901: </pre>
! 9902:
! 9903: <p>You usually need to be <tt class=
! 9904: "username">root</tt> to do this. Look if there are
! 9905: any files left:</p>
! 9906: <pre class="screen">
! 9907: <tt class="prompt">#</tt> <b class=
! 9908: "userinput"><tt>make print-PLIST</tt></b>
! 9909: </pre>
! 9910:
! 9911: <p>If this reveals any files that are missing in
! 9912: <tt class="filename">PLIST</tt>, add them.</p>
! 9913: </li>
! 9914:
! 9915: <li>
! 9916: <p>Now that the <tt class="filename">PLIST</tt> is
! 9917: OK, install the package again and make a binary
! 9918: package:</p>
! 9919: <pre class="screen">
! 9920: <tt class="prompt">#</tt> <b class=
! 9921: "userinput"><tt>make reinstall</tt></b>
! 9922: <tt class="prompt">#</tt> <b class=
! 9923: "userinput"><tt>make package</tt></b>
! 9924: </pre>
! 9925: </li>
! 9926:
! 9927: <li>
! 9928: <p>Delete the installed package:</p>
! 9929: <pre class="screen">
! 9930: <tt class="prompt">#</tt> <b class=
! 9931: "userinput"><tt>pkg_delete blub</tt></b>
! 9932: </pre>
! 9933: </li>
! 9934:
! 9935: <li>
! 9936: <p>Repeat the above <span><b class="command">make
! 9937: print-PLIST</b></span> command, which shouldn't find
! 9938: anything now:</p>
! 9939: <pre class="screen">
! 9940: <tt class="prompt">#</tt> <b class=
! 9941: "userinput"><tt>make print-PLIST</tt></b>
! 9942: </pre>
! 9943: </li>
! 9944:
! 9945: <li>
! 9946: <p>Reinstall the binary package:</p>
! 9947: <pre class="screen">
! 9948: <tt class="prompt">#</tt> <b class=
! 9949: "userinput"><tt>pkgadd .../blub.tgz</tt></b>
! 9950: </pre>
! 9951: </li>
! 9952:
! 9953: <li>
! 9954: <p>Play with it. Make sure everything works.</p>
! 9955: </li>
! 9956:
! 9957: <li>
! 9958: <p>Run <span><b class="command">pkglint</b></span>
! 9959: from <a xmlns=
! 9960: "http://www.w3.org/TR/xhtml1/transitional" href=
! 9961: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
! 9962: class="pkgname">pkgtools/pkglint</a>, and fix the
! 9963: problems it reports:</p>
! 9964: <pre class="screen">
! 9965: <tt class="prompt">#</tt> <b class="userinput"><tt>pkglint</tt></b>
! 9966: </pre>
! 9967: </li>
! 9968:
! 9969: <li>
! 9970: <p>Submit (or commit, if you have cvs access); see
! 9971: <a href="#submit" title=
! 9972: "Chapter 14. Submitting and Committing">Chapter 14,
! 9973: <i>Submitting and Committing</i></a>.</p>
! 9974: </li>
! 9975: </ul>
! 9976: </div>
! 9977: </div>
! 9978:
! 9979: <div class="chapter" lang="en" xml:lang="en">
! 9980: <div class="titlepage">
! 9981: <div>
! 9982: <div>
! 9983: <h2 class="title"><a name="submit" id=
! 9984: "submit"></a>Chapter 14. Submitting and
! 9985: Committing</h2>
! 9986: </div>
! 9987: </div>
! 9988: </div>
! 9989:
! 9990: <div class="toc">
! 9991: <p><b>Table of Contents</b></p>
! 9992:
! 9993: <dl>
! 9994: <dt><span class="sect1"><a href="#id2574685">14.1.
! 9995: Submitting your packages</a></span></dt>
! 9996:
! 9997: <dt><span class="sect1"><a href="#id2574732">14.2.
! 9998: Committing: Importing a package into
! 9999: CVS</a></span></dt>
! 10000:
! 10001: <dt><span class="sect1"><a href="#id2575000">14.3.
! 10002: Updating a Package to a Newer Version</a></span></dt>
! 10003:
! 10004: <dt><span class="sect1"><a href="#id2575019">14.4.
! 10005: Moving a Package in pkgsrc</a></span></dt>
! 10006: </dl>
! 10007: </div>
! 10008:
! 10009: <div class="sect1" lang="en" xml:lang="en">
! 10010: <div class="titlepage">
! 10011: <div>
! 10012: <div>
! 10013: <h2 class="title" style="clear: both"><a name=
! 10014: "id2574685" id=
! 10015: "id2574685"></a>14.1. Submitting your
! 10016: packages</h2>
! 10017: </div>
! 10018: </div>
! 10019: </div>
! 10020:
! 10021: <p>You have to separate between binary and
! 10022: “<span class="quote">normal</span>” (source)
! 10023: packages here:</p>
! 10024:
! 10025: <div class="itemizedlist">
! 10026: <ul type="disc">
! 10027: <li>
! 10028: <p>precompiled binary packages</p>
! 10029:
! 10030: <p>Our policy is that we accept binaries only from
! 10031: pkgsrc developers to guarantee that the packages
! 10032: don't contain any trojan horses etc. This is not to
! 10033: piss anyone off but rather to protect our users!
! 10034: You're still free to put up your home-made binary
! 10035: packages and tell the world where to get them.</p>
! 10036: </li>
! 10037:
! 10038: <li>
! 10039: <p>packages</p>
! 10040:
! 10041: <p>First, check that your package is complete,
! 10042: compiles and runs well; see <a href="#debug" title=
! 10043: "Chapter 13. Debugging">Chapter 13,
! 10044: <i>Debugging</i></a> and the rest of this document.
! 10045: Next, generate an uuencoded gzipped tar(1) archive,
! 10046: preferably with all files in a single directory.
! 10047: Finally, <span><b class=
! 10048: "command">send-pr</b></span> with category
! 10049: “<span class="quote">pkg</span>”, a
! 10050: synopsis which includes the package name and
! 10051: version number, a short description of your package
! 10052: (contents of the COMMENT variable or DESCR file are
! 10053: OK) and attach the archive to your PR.</p>
! 10054:
! 10055: <p>If you want to submit several packages, please
! 10056: send a separate PR for each one, it's easier for us
! 10057: to track things that way.</p>
! 10058:
! 10059: <p>Alternatively, you can also import new packages
! 10060: into pkgsrc-wip (“<span class="quote">pkgsrc
! 10061: work-in-progress</span>”); see the homepage
! 10062: at <a href="http://pkgsrc-wip.sourceforge.net/"
! 10063: target=
! 10064: "_top">http://pkgsrc-wip.sourceforge.net/</a> for
! 10065: details.</p>
! 10066: </li>
! 10067: </ul>
! 10068: </div>
! 10069: </div>
! 10070:
! 10071: <div class="sect1" lang="en" xml:lang="en">
! 10072: <div class="titlepage">
! 10073: <div>
! 10074: <div>
! 10075: <h2 class="title" style="clear: both"><a name=
! 10076: "id2574732" id=
! 10077: "id2574732"></a>14.2. Committing: Importing a
! 10078: package into CVS</h2>
! 10079: </div>
! 10080: </div>
! 10081: </div>
! 10082:
! 10083: <p>This section is only of interest for pkgsrc developers
! 10084: with write access to the pkgsrc repository. Please
! 10085: remember that cvs imports files relative to the current
! 10086: working directory, and that the pathname that you give
! 10087: the <span><b class="command">cvs import</b></span>
! 10088: command is so that it knows where to place the files in
! 10089: the repository. Newly created packages should be imported
! 10090: with a vendor tag of “<span class=
! 10091: "quote">TNF</span>” and a release tag of
! 10092: “<span class="quote">pkgsrc-base</span>”,
! 10093: e.g:</p>
! 10094: <pre class="programlisting">
! 10095: % cd .../pkgsrc/category/pkgname
! 10096: % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
! 10097: </pre>
! 10098:
! 10099: <p>Remember to move the directory from which you imported
! 10100: out of the way, or cvs will complain the next time you
! 10101: “<span class="quote">cvs update</span>” your
! 10102: source tree. Also don't forget to add the new package to
! 10103: the category's <tt class="filename">Makefile</tt>.</p>
! 10104:
! 10105: <p>The commit message of the initial import should
! 10106: include part of the <tt class="filename">DESCR</tt> file,
! 10107: so people reading the mailing lists know what the package
! 10108: is/does.</p>
! 10109:
! 10110: <p>Please note all package updates/additions in
! 10111: <tt class="filename">pkgsrc/doc/CHANGES</tt>. It's very
! 10112: important to keep this file up to date and conforming to
! 10113: the existing format, because it will be used by scripts
! 10114: to automatically update pages on <a href=
! 10115: "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
! 10116: and other sites. Additionally, check the pkgsrc/doc/TODO
! 10117: file and remove the entry for the package you updated, in
! 10118: case it was mentioned there.</p>
! 10119:
! 10120: <p>For new packages, “<span class="quote">cvs
! 10121: import</span>” is preferred to “<span class=
! 10122: "quote">cvs add</span>” because the former gets
! 10123: everything with a single command, and provides a
! 10124: consistent tag.</p>
! 10125: </div>
! 10126:
! 10127: <div class="sect1" lang="en" xml:lang="en">
! 10128: <div class="titlepage">
! 10129: <div>
! 10130: <div>
! 10131: <h2 class="title" style="clear: both"><a name=
! 10132: "id2575000" id="id2575000"></a>14.3. Updating
! 10133: a Package to a Newer Version</h2>
! 10134: </div>
! 10135: </div>
! 10136: </div>
! 10137:
! 10138: <p>Please always put a concise, appropriate and relevant
! 10139: summary of the changes between old and new versions into
! 10140: the commit log when updating a package. There are various
! 10141: reasons for this:</p>
! 10142:
! 10143: <div class="itemizedlist">
! 10144: <ul type="disc">
! 10145: <li>
! 10146: <p>A URL is volatile, and can change over time. It
! 10147: may go away completely or its information may be
! 10148: overwritten by newer information.</p>
! 10149: </li>
! 10150:
! 10151: <li>
! 10152: <p>Having the change information between old and
! 10153: new versions in our CVS repository is very useful
! 10154: for people who use either cvs or anoncvs.</p>
! 10155: </li>
! 10156:
! 10157: <li>
! 10158: <p>Having the change information between old and
! 10159: new versions in our CVS repository is very useful
! 10160: for people who read the pkgsrc-changes mailing
! 10161: list, so that they can make tactical decisions
! 10162: about when to upgrade the package.</p>
! 10163: </li>
! 10164: </ul>
! 10165: </div>
! 10166:
! 10167: <p>Please also recognise that, just because a new version
! 10168: of a package has been released, it should not
! 10169: automatically be upgraded in the CVS repository. We
! 10170: prefer to be conservative in the packages that are
! 10171: included in pkgsrc - development or beta packages are not
! 10172: really the best thing for most places in which pkgsrc is
! 10173: used. Please use your judgement about what should go into
! 10174: pkgsrc, and bear in mind that stability is to be
! 10175: preferred above new and possibly untested features.</p>
! 10176: </div>
! 10177:
! 10178: <div class="sect1" lang="en" xml:lang="en">
! 10179: <div class="titlepage">
! 10180: <div>
! 10181: <div>
! 10182: <h2 class="title" style="clear: both"><a name=
! 10183: "id2575019" id="id2575019"></a>14.4. Moving a
! 10184: Package in pkgsrc</h2>
! 10185: </div>
! 10186: </div>
! 10187: </div>
! 10188:
! 10189: <div class="orderedlist">
! 10190: <ol type="1">
! 10191: <li>
! 10192: <p>Make a copy of the directory somewhere else.</p>
! 10193: </li>
! 10194:
! 10195: <li>
! 10196: <p>Remove all CVS dirs.</p>
! 10197:
! 10198: <p>Alternatively to the first two steps you can
! 10199: also do:</p>
! 10200: <pre class="screen">
! 10201: <tt class="prompt">%</tt> <b class=
! 10202: "userinput"><tt>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</tt></b>
! 10203: </pre>
! 10204:
! 10205: <p>and use that for further work.</p>
! 10206: </li>
! 10207:
! 10208: <li>
! 10209: <p>Fix <tt class="varname">CATEGORIES</tt> and any
! 10210: <tt class="varname">DEPENDS</tt> paths that just
! 10211: did “<span class=
! 10212: "quote">../package</span>” instead of
! 10213: “<span class=
! 10214: "quote">../../category/package</span>”.</p>
! 10215: </li>
! 10216:
! 10217: <li>
! 10218: <p><span><b class="command">cvs import</b></span>
! 10219: the modified package in the new place.</p>
! 10220: </li>
! 10221:
! 10222: <li>
! 10223: <p>Check if any package depends on it:</p>
! 10224: <pre class="screen">
! 10225: <tt class="prompt">%</tt> <b class=
! 10226: "userinput"><tt>cd /usr/pkgsrc</tt></b>
! 10227: <tt class="prompt">%</tt> <b class=
! 10228: "userinput"><tt>grep /package */*/Makefile* */*/buildlink*</tt></b>
! 10229: </pre>
! 10230: </li>
! 10231:
! 10232: <li>
! 10233: <p>Fix paths in packages from step 5 to point to
! 10234: new location.</p>
! 10235: </li>
! 10236:
! 10237: <li>
! 10238: <p><span><b class="command">cvs rm (-f)</b></span>
! 10239: the package at the old location.</p>
! 10240: </li>
! 10241:
! 10242: <li>
! 10243: <p>Remove from <tt class=
! 10244: "filename">oldcategory/Makefile</tt>.</p>
! 10245: </li>
! 10246:
! 10247: <li>
! 10248: <p>Add to <tt class=
! 10249: "filename">newcategory/Makefile</tt>.</p>
! 10250: </li>
! 10251:
! 10252: <li>
! 10253: <p>Commit the changed and removed files:</p>
! 10254: <pre class="screen">
! 10255: <tt class="prompt">%</tt> <b class=
! 10256: "userinput"><tt>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</tt></b>
! 10257: </pre>
! 10258:
! 10259: <p>(and any packages from step 5, of course).</p>
! 10260: </li>
! 10261: </ol>
! 10262: </div>
! 10263: </div>
! 10264: </div>
! 10265: </div>
! 10266:
! 10267: <div class="appendix" lang="en" xml:lang="en">
! 10268: <div class="titlepage">
! 10269: <div>
! 10270: <div>
! 10271: <h2 class="title"><a name="examples" id=
! 10272: "examples"></a>Appendix A. A simple example
! 10273: package: bison</h2>
! 10274: </div>
! 10275: </div>
! 10276: </div>
! 10277:
! 10278: <div class="toc">
! 10279: <p><b>Table of Contents</b></p>
! 10280:
! 10281: <dl>
! 10282: <dt><span class="sect1"><a href="#id2575177">A.1.
! 10283: files</a></span></dt>
! 10284:
! 10285: <dd>
! 10286: <dl>
! 10287: <dt><span class="sect2"><a href="#id2575180">A.1.1.
! 10288: Makefile</a></span></dt>
! 10289:
! 10290: <dt><span class="sect2"><a href="#id2575188">A.1.2.
! 10291: DESCR</a></span></dt>
! 10292:
! 10293: <dt><span class="sect2"><a href="#id2575203">A.1.3.
! 10294: PLIST</a></span></dt>
! 10295:
! 10296: <dt><span class="sect2"><a href="#id2575210">A.1.4.
! 10297: Checking a package with pkglint</a></span></dt>
! 10298: </dl>
! 10299: </dd>
! 10300:
! 10301: <dt><span class="sect1"><a href="#id2575319">A.2. Steps
! 10302: for building, installing, packaging</a></span></dt>
! 10303: </dl>
! 10304: </div>
! 10305:
! 10306: <p>We checked to find a piece of software that wasn't in the
! 10307: packages collection, and picked GNU bison. Quite why someone
! 10308: would want to have <span><b class="command">bison</b></span>
! 10309: when Berkeley <span><b class="command">yacc</b></span> is
! 10310: already present in the tree is beyond us, but it's useful for
! 10311: the purposes of this exercise.</p>
! 10312:
! 10313: <div class="sect1" lang="en" xml:lang="en">
! 10314: <div class="titlepage">
! 10315: <div>
! 10316: <div>
! 10317: <h2 class="title" style="clear: both"><a name=
! 10318: "id2575177" id="id2575177"></a>A.1. files</h2>
! 10319: </div>
! 10320: </div>
! 10321: </div>
! 10322:
! 10323: <div class="sect2" lang="en" xml:lang="en">
! 10324: <div class="titlepage">
! 10325: <div>
! 10326: <div>
! 10327: <h3 class="title"><a name="id2575180" id=
! 10328: "id2575180"></a>A.1.1. Makefile</h3>
! 10329: </div>
! 10330: </div>
! 10331: </div>
! 10332: <pre class="programlisting">
! 10333: # $NetBSD$
! 10334: #
! 10335:
! 10336: DISTNAME= bison-1.25
! 10337: CATEGORIES= devel
! 10338: MASTER_SITES= ${MASTER_SITE_GNU}
! 10339:
! 10340: MAINTAINER= thorpej@NetBSD.org
! 10341: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
! 10342: COMMENT= GNU yacc clone
! 10343:
! 10344: GNU_CONFIGURE= yes
! 10345: INFO_FILES= bison.info
! 10346:
! 10347: .include "../../mk/bsd.pkg.mk"
! 10348: </pre>
! 10349: </div>
! 10350:
! 10351: <div class="sect2" lang="en" xml:lang="en">
! 10352: <div class="titlepage">
! 10353: <div>
! 10354: <div>
! 10355: <h3 class="title"><a name="id2575188" id=
! 10356: "id2575188"></a>A.1.2. DESCR</h3>
! 10357: </div>
! 10358: </div>
! 10359: </div>
! 10360: <pre class="programlisting">
! 10361: GNU version of yacc. Can make re-entrant parsers, and numerous other
! 10362: improvements. Why you would want this when Berkeley <a href=
! 10363: "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
! 10364: of the NetBSD source tree is beyond me.
! 10365: </pre>
! 10366: </div>
! 10367:
! 10368: <div class="sect2" lang="en" xml:lang="en">
! 10369: <div class="titlepage">
! 10370: <div>
! 10371: <div>
! 10372: <h3 class="title"><a name="id2575203" id=
! 10373: "id2575203"></a>A.1.3. PLIST</h3>
! 10374: </div>
! 10375: </div>
! 10376: </div>
! 10377: <pre class="programlisting">
! 10378: @comment $NetBSD$
! 10379: bin/bison
! 10380: man/man1/bison.1.gz
! 10381: info/bison.info
! 10382: info/bison.info-1
! 10383: info/bison.info-2
! 10384: info/bison.info-3
! 10385: info/bison.info-4
! 10386: info/bison.info-5
! 10387: share/bison.simple
! 10388: share/bison.hairy
! 10389: </pre>
! 10390: </div>
! 10391:
! 10392: <div class="sect2" lang="en" xml:lang="en">
! 10393: <div class="titlepage">
! 10394: <div>
! 10395: <div>
! 10396: <h3 class="title"><a name="id2575210" id=
! 10397: "id2575210"></a>A.1.4. Checking a package with
! 10398: <span><b class="command">pkglint</b></span></h3>
! 10399: </div>
! 10400: </div>
! 10401: </div>
! 10402:
! 10403: <p>The NetBSD package system comes with <a xmlns=
! 10404: "http://www.w3.org/TR/xhtml1/transitional" href=
! 10405: "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
! 10406: class="pkgname">pkgtools/pkglint</a> which helps to check
! 10407: the contents of these files. After installation it is
! 10408: quite easy to use, just change to the directory of the
! 10409: package you wish to examine and execute <span><b class=
! 10410: "command">pkglint</b></span>:</p>
! 10411: <pre class="screen">
! 10412: <tt class="prompt">$</tt> <b class="userinput"><tt>pkglint</tt></b>
! 10413: OK: checking ./DESCR.
! 10414: OK: checking Makefile.
! 10415: OK: checking distinfo.
! 10416: OK: checking patches/patch-aa.
! 10417: looks fine.
! 10418: </pre>
! 10419:
! 10420: <p>Depending on the supplied command line arguments (see
! 10421: pkglint(1)) more verbose checks will be performed. Use
! 10422: e.g. <span><b class="command">pkglint -v</b></span> for a
! 10423: very verbose check.</p>
! 10424: </div>
! 10425: </div>
! 10426:
! 10427: <div class="sect1" lang="en" xml:lang="en">
! 10428: <div class="titlepage">
! 10429: <div>
! 10430: <div>
! 10431: <h2 class="title" style="clear: both"><a name=
! 10432: "id2575319" id="id2575319"></a>A.2. Steps for
! 10433: building, installing, packaging</h2>
! 10434: </div>
! 10435: </div>
! 10436: </div>
! 10437:
! 10438: <p>Create the directory where the package lives, plus any
! 10439: auxiliary directories:</p>
! 10440: <pre class="screen">
! 10441: <tt class="prompt">#</tt> <b class=
! 10442: "userinput"><tt>cd /usr/pkgsrc/lang</tt></b>
! 10443: <tt class="prompt">#</tt> <b class=
! 10444: "userinput"><tt>mkdir bison</tt></b>
! 10445: <tt class="prompt">#</tt> <b class=
! 10446: "userinput"><tt>cd bison</tt></b>
! 10447: <tt class="prompt">#</tt> <b class=
! 10448: "userinput"><tt>mkdir patches</tt></b>
! 10449: </pre>
! 10450:
! 10451: <p>Create <tt class="filename">Makefile</tt>, <tt class=
! 10452: "filename">DESCR</tt> and <tt class="filename">PLIST</tt>
! 10453: (see <a href="#components" title=
! 10454: "Chapter 7. Package components - files, directories and contents">
! 10455: Chapter 7, <i>Package components - files, directories and
! 10456: contents</i></a>) then continue with fetching the
! 10457: distfile:</p>
! 10458: <pre class="screen">
! 10459: <tt class="prompt">#</tt> <b class=
! 10460: "userinput"><tt>make fetch</tt></b>
! 10461: >> bison-1.25.tar.gz doesn't seem to exist on this system.
! 10462: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
! 10463: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
! 10464: ftp: Error retrieving file: 500 Internal error
! 10465:
! 10466: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
! 10467: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
! 10468: ftp: Error retrieving file: 500 Internal error
! 10469:
! 10470: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
! 10471: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
! 10472: Successfully retrieved file.
! 10473: </pre>
! 10474:
! 10475: <p>Generate the checksum of the distfile into <tt class=
! 10476: "filename">distinfo</tt>:</p>
! 10477: <pre class="screen">
! 10478: <tt class="prompt">#</tt> <b class=
! 10479: "userinput"><tt>make makesum</tt></b>
! 10480: </pre>
! 10481:
! 10482: <p>Now compile:</p>
! 10483: <pre class="screen">
! 10484: <tt class="prompt">#</tt> <b class="userinput"><tt>make</tt></b>
! 10485: >> Checksum OK for bison-1.25.tar.gz.
! 10486: ===> Extracting for bison-1.25
! 10487: ===> Patching for bison-1.25
! 10488: ===> Ignoring empty patch directory
! 10489: ===> Configuring for bison-1.25
! 10490: creating cache ./config.cache
! 10491: checking for gcc... cc
! 10492: checking whether we are using GNU C... yes
! 10493: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
! 10494: checking how to run the C preprocessor... cc -E
! 10495: checking for minix/config.h... no
! 10496: checking for POSIXized ISC... no
! 10497: checking whether cross-compiling... no
! 10498: checking for ANSI C header files... yes
! 10499: checking for string.h... yes
! 10500: checking for stdlib.h... yes
! 10501: checking for memory.h... yes
! 10502: checking for working const... yes
! 10503: checking for working alloca.h... no
! 10504: checking for alloca... yes
! 10505: checking for strerror... yes
! 10506: updating cache ./config.cache
! 10507: creating ./config.status
! 10508: creating Makefile
! 10509: ===> Building for bison-1.25
! 10510: 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
! 10511: 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
! 10512: 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
! 10513: 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
! 10514: 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
! 10515: 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
! 10516: 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
! 10517: 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
! 10518: 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
! 10519: 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
! 10520: 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
! 10521: 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
! 10522: 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
! 10523: 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
! 10524: 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
! 10525: 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
! 10526: 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
! 10527: 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
! 10528: 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
! 10529: 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
! 10530: 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
! 10531: 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
! 10532: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
! 10533: rm -f bison.s1
! 10534: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
! 10535: </pre>
! 10536:
! 10537: <p>Everything seems OK, so install the files:</p>
! 10538: <pre class="screen">
! 10539: <tt class="prompt">#</tt> <b class=
! 10540: "userinput"><tt>make install</tt></b>
! 10541: >> Checksum OK for bison-1.25.tar.gz.
! 10542: ===> Installing for bison-1.25
! 10543: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
! 10544: rm -f /usr/pkg/bin/bison
! 10545: cd /usr/pkg/share; rm -f bison.simple bison.hairy
! 10546: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
! 10547: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
! 10548: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
! 10549: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
! 10550: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
! 10551: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
! 10552: ===> Registering installation for bison-1.25
! 10553: </pre>
! 10554:
! 10555: <p>You can now use bison, and also - if you decide so -
! 10556: remove it with <span><b class="command">pkg_delete
! 10557: bison</b></span>. Should you decide that you want a binary
! 10558: package, do this now:</p>
! 10559: <pre class="screen">
! 10560: <tt class="prompt">#</tt> <b class=
! 10561: "userinput"><tt>make package</tt></b>
! 10562: >> Checksum OK for bison-1.25.tar.gz.
! 10563: ===> Building package for bison-1.25
! 10564: Creating package bison-1.25.tgz
! 10565: Registering depends:.
! 10566: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
! 10567: </pre>
! 10568:
! 10569: <p>Now that you don't need the source and object files any
! 10570: more, clean up:</p>
! 10571: <pre class="screen">
! 10572: <tt class="prompt">#</tt> <b class=
! 10573: "userinput"><tt>make clean</tt></b>
! 10574: ===> Cleaning for bison-1.25
! 10575: </pre>
! 10576: </div>
! 10577: </div>
! 10578:
! 10579: <div class="appendix" lang="en" xml:lang="en">
! 10580: <div class="titlepage">
! 10581: <div>
! 10582: <div>
! 10583: <h2 class="title"><a name="logs" id=
! 10584: "logs"></a>Appendix B. Build logs</h2>
! 10585: </div>
! 10586: </div>
! 10587: </div>
! 10588:
! 10589: <div class="toc">
! 10590: <p><b>Table of Contents</b></p>
! 10591:
! 10592: <dl>
! 10593: <dt><span class="sect1"><a href="#logs.building">B.1.
! 10594: Building figlet</a></span></dt>
! 10595:
! 10596: <dt><span class="sect1"><a href="#logs.package">B.2.
! 10597: Packaging figlet</a></span></dt>
! 10598: </dl>
! 10599: </div>
! 10600:
! 10601: <div class="sect1" lang="en" xml:lang="en">
! 10602: <div class="titlepage">
! 10603: <div>
! 10604: <div>
! 10605: <h2 class="title" style="clear: both"><a name=
! 10606: "logs.building" id=
! 10607: "logs.building"></a>B.1. Building figlet</h2>
! 10608: </div>
! 10609: </div>
! 10610: </div>
! 10611: <pre class="screen">
! 10612: <tt class="prompt">#</tt> <b class="userinput"><tt>make</tt></b>
! 10613: ===> Checking for vulnerabilities in figlet-2.2.1nb2
! 10614: => figlet221.tar.gz doesn't seem to exist on this system.
! 10615: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
! 10616: => [172219 bytes]
! 10617: Connected to ftp.plig.net.
! 10618: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
! 10619: 331 Guest login ok, send your complete e-mail address as password.
! 10620: 230-You are user #5 of 500 simultaneous users allowed.
! 10621: 230-
! 10622: 230- ___ _ _ _
! 10623: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
! 10624: 230- | _| _| . |_| . | | | . |_| . | _| . |
! 10625: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
! 10626: 230- |_| |_| |___| |___|
! 10627: 230-
! 10628: 230-** Welcome to ftp.plig.org **
! 10629: 230-
! 10630: 230-Please note that all transfers from this FTP site are logged. If you
! 10631: 230-do not like this, please disconnect now.
! 10632: 230-
! 10633: 230-This arhive is available via
! 10634: 230-
! 10635: 230-HTTP: http://ftp.plig.org/
! 10636: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
! 10637: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
! 10638: 230-
! 10639: 230-Please email comments, bug reports and requests for packages to be
! 10640: 230-mirrored to ftp-admin@plig.org.
! 10641: 230-
! 10642: 230-
! 10643: 230 Logged in anonymously.
! 10644: Remote system type is UNIX.
! 10645: Using binary mode to transfer files.
! 10646: 200 Type okay.
! 10647: 250 "/pub" is new cwd.
! 10648: 250-"/pub/figlet" is new cwd.
! 10649: 250-
! 10650: 250-Welcome to the figlet archive at ftp.figlet.org
! 10651: 250-
! 10652: 250- ftp://ftp.figlet.org/pub/figlet/
! 10653: 250-
! 10654: 250-The official FIGlet web page is:
! 10655: 250- http://www.figlet.org/
! 10656: 250-
! 10657: 250-If you have questions, please mailto:info@figlet.org. If you want to
! 10658: 250-contribute a font or something else, you can email us.
! 10659: 250
! 10660: 250 "/pub/figlet/program" is new cwd.
! 10661: 250 "/pub/figlet/program/unix" is new cwd.
! 10662: local: figlet221.tar.gz remote: figlet221.tar.gz
! 10663: 502 Unimplemented command.
! 10664: 227 Entering Passive Mode (195,40,6,41,246,104)
! 10665: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
! 10666: 38% |************** | 65800 64.16 KB/s 00:01 ETA
! 10667: 226 Transfer completed.
! 10668: 172219 bytes received in 00:02 (75.99 KB/s)
! 10669: 221 Goodbye.
! 10670: => Checksum OK for figlet221.tar.gz.
! 10671: ===> Extracting for figlet-2.2.1nb2
! 10672: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
! 10673: ===> Patching for figlet-2.2.1nb2
! 10674: ===> Applying pkgsrc patches for figlet-2.2.1nb2
! 10675: ===> Overriding tools for figlet-2.2.1nb2
! 10676: ===> Creating toolchain wrappers for figlet-2.2.1nb2
! 10677: ===> Configuring for figlet-2.2.1nb2
! 10678: ===> Building for figlet-2.2.1nb2
! 10679: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
! 10680: chmod a+x figlet
! 10681: gcc -O2 -o chkfont chkfont.c
! 10682: => Unwrapping files-to-be-installed.
! 10683: <tt class="prompt">#</tt>
! 10684: <tt class="prompt">#</tt> <b class=
! 10685: "userinput"><tt>make install</tt></b>
! 10686: ===> Checking for vulnerabilities in figlet-2.2.1nb2
! 10687: ===> Installing for figlet-2.2.1nb2
! 10688: install -d -o root -g wheel -m 755 /usr/pkg/bin
! 10689: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
! 10690: mkdir -p /usr/pkg/share/figlet
! 10691: cp figlet /usr/pkg/bin
! 10692: cp chkfont /usr/pkg/bin
! 10693: chmod 555 figlist showfigfonts
! 10694: cp figlist /usr/pkg/bin
! 10695: cp showfigfonts /usr/pkg/bin
! 10696: cp fonts/*.flf /usr/pkg/share/figlet
! 10697: cp fonts/*.flc /usr/pkg/share/figlet
! 10698: cp figlet.6 /usr/pkg/man/man6
! 10699: ===> Registering installation for figlet-2.2.1nb2
! 10700: <tt class="prompt">#</tt>
! 10701: </pre>
! 10702: </div>
! 10703:
! 10704: <div class="sect1" lang="en" xml:lang="en">
! 10705: <div class="titlepage">
! 10706: <div>
! 10707: <div>
! 10708: <h2 class="title" style="clear: both"><a name=
! 10709: "logs.package" id=
! 10710: "logs.package"></a>B.2. Packaging figlet</h2>
! 10711: </div>
! 10712: </div>
! 10713: </div>
! 10714: <pre class="screen">
! 10715: <tt class="prompt">#</tt> <b class=
! 10716: "userinput"><tt>make package</tt></b>
! 10717: ===> Checking for vulnerabilities in figlet-2.2.1nb2
! 10718: ===> Packaging figlet-2.2.1nb2
! 10719: ===> Building binary package for figlet-2.2.1nb2
! 10720: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
! 10721: Using SrcDir value of /usr/pkg
! 10722: Registering depends:.
! 10723: <tt class="prompt">#</tt>
! 10724: </pre>
! 10725: </div>
! 10726: </div>
! 10727:
! 10728: <div class="appendix" lang="en" xml:lang="en">
! 10729: <div class="titlepage">
! 10730: <div>
! 10731: <div>
! 10732: <h2 class="title"><a name="ftp-layout" id=
! 10733: "ftp-layout"></a>Appendix C. Layout of the
! 10734: FTP server's package archive</h2>
! 10735: </div>
! 10736: </div>
! 10737: </div>
! 10738:
! 10739: <p>Layout for precompiled binary packages on
! 10740: ftp.NetBSD.org:</p>
! 10741: <pre class="programlisting">
! 10742: /pub/NetBSD/packages/
! 10743: distfiles/
! 10744:
! 10745: # Unpacked pkgsrc trees
! 10746: pkgsrc-current -> /pub/NetBSD/NetBSD-current/pkgsrc
! 10747: pkgsrc-2003Q4 -> N/A
! 10748: pkgsrc-2004Q1/pkgsrc
! 10749:
! 10750: # pkgsrc archives
! 10751: pkgsrc-current.tar.gz -> ../NetBSD-current/tar_files/pkgsrc.tar.gz
! 10752: pkgsrc-2003Q4.tar.gz -> N/A
! 10753: pkgsrc-2004Q1.tar.gz -> N/A
! 10754:
! 10755: # Per pkgsrc-release/OS-release/arch package archives
! 10756: pkgsrc-2003Q4/
! 10757: NetBSD-1.6.2/
! 10758: i386/
! 10759: All/
! 10760: archivers/
! 10761: foo -> ../All/foo
! 10762: ...
! 10763: pkgsrc-2004Q1/
! 10764: NetBSD-1.6.2/
! 10765: i386/
! 10766: All/
! 10767: ...
! 10768: NetBSD-2.0/
! 10769: i386/
! 10770: All/
! 10771: ...
! 10772: SunOS-5.9/
! 10773: sparc/
! 10774: All/
! 10775: ...
! 10776: x86/
! 10777: All/
! 10778: ...
! 10779:
! 10780: # Per os-release package archive convenience links
! 10781: NetBSD-1.6.2 -> 1.6.2
! 10782: 1.6.2/
! 10783: i386 -> ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
! 10784: m68k/
! 10785: All/
! 10786: archivers/
! 10787: foo -> ../All/foo
! 10788: ...
! 10789: amiga -> m68k
! 10790: atari -> m68k
! 10791: ...
! 10792:
! 10793: 2.0 -> NetBSD-2.0 # backward compat, historic
! 10794: NetBSD-2.0/
! 10795: i386 -> ../pkgsrc-2004Q1/NetBSD-2.0/i386
! 10796: SunOS-5.9/
! 10797: sparc -> ../pkgsrc-2004Q1/SunOS-5.9/sparc
! 10798: x86 -> ../pkgsrc-2004Q1/SunOS-5.9/x86
! 10799:
! 10800: </pre>
! 10801:
! 10802: <p>To create:</p>
! 10803:
! 10804: <div class="orderedlist">
! 10805: <ol type="1">
! 10806: <li>
! 10807: <p>Run bulk build, see <a href="#bulkbuild" title=
! 10808: "5.3. Doing a bulk build of all packages">Section
! 10809: 5.3, “Doing a bulk build of all
! 10810: packages”</a></p>
! 10811: </li>
! 10812:
! 10813: <li>
! 10814: <p>Upload /usr/pkgsrc/packages to</p>
! 10815: <pre class="programlisting">
! 10816: ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
! 10817: pkgsrc-2004Q3/\ # pkgsrc-branch
! 10818: `uname -s`-`uname -r`/ # OS & version
! 10819: `uname -p` # architecture
! 10820:
! 10821: </pre>
! 10822: </li>
! 10823:
! 10824: <li>
! 10825: <p>If necessary, create a symlink <span><b class=
! 10826: "command">ln -s `uname -m` `uname -p`</b></span> (amiga
! 10827: -> m68k, ...)</p>
! 10828: </li>
! 10829: </ol>
! 10830: </div>
! 10831: </div>
! 10832: </div>
! 10833: </body>
! 10834: </html>
CVSweb <webmaster@jp.NetBSD.org>