Annotation of pkgsrc/doc/pkgsrc.html, revision 1.66

1.1       grant       1: <html xmlns="http://www.w3.org/1999/xhtml">
                      2: <head>
                      3:   <meta name="generator" content=
1.66    ! rillig      4:   "HTML Tidy for NetBSD (vers 1st August 2004), see www.w3.org" />
1.1       grant       5:   <meta http-equiv="Content-Type" content=
                      6:   "text/html; charset=us-ascii" />
                      7: 
                      8:   <title>The pkgsrc guide</title>
                      9:   <link rel="stylesheet" href="/NetBSD.css" type="text/css" />
                     10:   <meta name="generator" content=
1.23      wiz        11:   "DocBook XSL Stylesheets VX.X.X" />
1.1       grant      12:   <meta name="description" content=
                     13:   "Information about using the NetBSD package system (pkgsrc) from both a user view for installing packages as well as from a pkgsrc developers' view for creating new packages." />
                     14:   </head>
                     15: 
                     16: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084"
                     17: alink="#0000FF">
1.66    ! rillig     18:   <div class="book" lang="en" xml:lang="en">
1.1       grant      19:     <div class="titlepage">
                     20:       <div>
                     21:         <div>
1.66    ! rillig     22:           <h1 class="title"><a name="the-pkgsrc-guide" id=
        !            23:           "the-pkgsrc-guide"></a>The pkgsrc guide</h1>
1.1       grant      24:         </div>
                     25: 
                     26:         <div>
1.2       hubertf    27:           <h2 class="subtitle">Documentation on the NetBSD packages
1.1       grant      28:           system</h2>
                     29:         </div>
                     30: 
                     31:         <div>
                     32:           <div class="authorgroup">
                     33:             <div class="author">
                     34:               <h3 class="author"><span class=
                     35:               "firstname">Alistair</span> <span class=
                     36:               "surname">Crooks</span></h3>
                     37: 
                     38:               <div class="affiliation">
                     39:                 <div class="address">
1.14      xtraeme    40:                   <p><code class="email">&lt;<a href=
                     41:                   "mailto:agc@NetBSD.org">agc@NetBSD.org</a>&gt;</code></p>
1.1       grant      42:                 </div>
                     43:               </div>
                     44:             </div>
                     45: 
                     46:             <div class="author">
                     47:               <h3 class="author"><span class=
                     48:               "firstname">Hubert</span> <span class=
                     49:               "surname">Feyrer</span></h3>
                     50: 
                     51:               <div class="affiliation">
                     52:                 <div class="address">
1.14      xtraeme    53:                   <p><code class="email">&lt;<a href=
                     54:                   "mailto:hubertf@NetBSD.org">hubertf@NetBSD.org</a>&gt;</code></p>
1.1       grant      55:                 </div>
                     56:               </div>
                     57:             </div>
1.2       hubertf    58: 
1.3       hubertf    59:             <h3 class="corpauthor">The pkgsrc Developers</h3>
1.1       grant      60:           </div>
                     61:         </div>
                     62: 
                     63:         <div>
1.48      dillo      64:           <p class="copyright">Copyright &#169; 1994-2005 The
1.1       grant      65:           NetBSD Foundation, Inc</p>
                     66:         </div>
                     67: 
1.23      wiz        68:         <div xmlns="http://www.w3.org/TR/xhtml1/transitional">
1.48      dillo      69:           <p xmlns="" class="pubdate">$NetBSD: pkgsrc.xml,v 1.10
                     70:           2005/10/05 13:59:56 dillo Exp $</p>
1.1       grant      71:         </div>
                     72: 
                     73:         <div>
                     74:           <div class="abstract">
                     75:             <p class="title"><b>Abstract</b></p>
                     76: 
                     77:             <p>Information about using the NetBSD package system
                     78:             (pkgsrc) from both a user view for installing packages
                     79:             as well as from a pkgsrc developers' view for creating
                     80:             new packages.</p>
                     81:           </div>
                     82:         </div>
                     83:       </div>
                     84:       <hr />
                     85:     </div>
                     86: 
                     87:     <div class="toc">
                     88:       <p><b>Table of Contents</b></p>
                     89: 
                     90:       <dl>
1.51      rillig     91:         <dt><span class="chapter"><a href="#introduction">1. What
                     92:         is pkgsrc?</a></span></dt>
1.1       grant      93: 
                     94:         <dd>
                     95:           <dl>
1.30      wiz        96:             <dt><span class="sect1"><a href=
                     97:             "#introduction-section">1.1.
1.1       grant      98:             Introduction</a></span></dt>
                     99: 
                    100:             <dt><span class="sect1"><a href="#overview">1.2.
                    101:             Overview</a></span></dt>
                    102: 
                    103:             <dt><span class="sect1"><a href="#terminology">1.3.
                    104:             Terminology</a></span></dt>
                    105: 
                    106:             <dt><span class="sect1"><a href="#typography">1.4.
                    107:             Typography</a></span></dt>
                    108:           </dl>
                    109:         </dd>
                    110: 
1.46      gdt       111:         <dt><span class="part"><a href="#users-guide">I. The pkgsrc
1.1       grant     112:         user's guide</a></span></dt>
                    113: 
                    114:         <dd>
                    115:           <dl>
                    116:             <dt><span class="chapter"><a href="#getting">2. Where
1.59      rillig    117:             to get pkgsrc and how to keep it
                    118:             up-to-date</a></span></dt>
1.1       grant     119: 
                    120:             <dd>
                    121:               <dl>
1.30      wiz       122:                 <dt><span class="sect1"><a href="#as-tar-file">2.1.
1.1       grant     123:                 As tar file</a></span></dt>
                    124: 
1.30      wiz       125:                 <dt><span class="sect1"><a href="#via-sup">2.2. Via
                    126:                 SUP</a></span></dt>
1.1       grant     127: 
1.30      wiz       128:                 <dt><span class="sect1"><a href="#via-cvs">2.3. Via
                    129:                 CVS</a></span></dt>
1.59      rillig    130: 
                    131:                 <dt><span class="sect1"><a href=
                    132:                 "#uptodate-cvs">2.4. Keeping pkgsrc up-to-date via
                    133:                 CVS</a></span></dt>
1.1       grant     134:               </dl>
                    135:             </dd>
                    136: 
                    137:             <dt><span class="chapter"><a href="#platforms">3. Using
                    138:             pkgsrc on systems other than NetBSD</a></span></dt>
                    139: 
                    140:             <dd>
                    141:               <dl>
1.30      wiz       142:                 <dt><span class="sect1"><a href=
                    143:                 "#bootstrapping-pkgsrc">3.1. Bootstrapping
                    144:                 pkgsrc</a></span></dt>
1.1       grant     145: 
1.30      wiz       146:                 <dt><span class="sect1"><a href=
1.47      reed      147:                 "#platform-specific-notes">3.2. Platform-specific
1.30      wiz       148:                 notes</a></span></dt>
1.1       grant     149: 
                    150:                 <dd>
                    151:                   <dl>
                    152:                     <dt><span class="sect2"><a href=
1.30      wiz       153:                     "#darwin">3.2.1. Darwin (Mac OS
1.1       grant     154:                     X)</a></span></dt>
                    155: 
                    156:                     <dt><span class="sect2"><a href=
1.30      wiz       157:                     "#freebsd">3.2.2. FreeBSD</a></span></dt>
1.1       grant     158: 
                    159:                     <dt><span class="sect2"><a href=
1.30      wiz       160:                     "#interix">3.2.3. Interix</a></span></dt>
1.1       grant     161: 
1.30      wiz       162:                     <dt><span class="sect2"><a href="#irix">3.2.4.
                    163:                     IRIX</a></span></dt>
1.1       grant     164: 
1.30      wiz       165:                     <dt><span class="sect2"><a href="#linux">3.2.5.
                    166:                     Linux</a></span></dt>
1.1       grant     167: 
                    168:                     <dt><span class="sect2"><a href=
1.30      wiz       169:                     "#openbsd">3.2.6. OpenBSD</a></span></dt>
1.22      tv        170: 
                    171:                     <dt><span class="sect2"><a href=
1.30      wiz       172:                     "#solaris">3.2.7. Solaris</a></span></dt>
1.1       grant     173:                   </dl>
                    174:                 </dd>
                    175:               </dl>
                    176:             </dd>
                    177: 
                    178:             <dt><span class="chapter"><a href="#using">4. Using
                    179:             pkgsrc</a></span></dt>
                    180: 
                    181:             <dd>
                    182:               <dl>
                    183:                 <dt><span class="sect1"><a href=
                    184:                 "#getting-started">4.1. Working with binary
                    185:                 packages</a></span></dt>
                    186: 
                    187:                 <dd>
                    188:                   <dl>
                    189:                     <dt><span class="sect2"><a href=
1.30      wiz       190:                     "#where-to-get-binary-packages">4.1.1. Where to
                    191:                     get binary packages</a></span></dt>
1.1       grant     192: 
                    193:                     <dt><span class="sect2"><a href=
1.30      wiz       194:                     "#how-to-use-binary-packages">4.1.2. How to use
                    195:                     binary packages</a></span></dt>
1.1       grant     196: 
                    197:                     <dt><span class="sect2"><a href=
1.30      wiz       198:                     "#a-word-of-warning">4.1.3. A word of
1.1       grant     199:                     warning</a></span></dt>
                    200:                   </dl>
                    201:                 </dd>
                    202: 
1.30      wiz       203:                 <dt><span class="sect1"><a href=
                    204:                 "#building-packages-from-source">4.2. Building
                    205:                 packages from source</a></span></dt>
1.1       grant     206: 
                    207:                 <dd>
                    208:                   <dl>
                    209:                     <dt><span class="sect2"><a href=
1.30      wiz       210:                     "#requirements">4.2.1.
1.1       grant     211:                     Requirements</a></span></dt>
                    212: 
                    213:                     <dt><span class="sect2"><a href=
1.30      wiz       214:                     "#fetching-distfiles">4.2.2. Fetching
1.1       grant     215:                     distfiles</a></span></dt>
                    216: 
                    217:                     <dt><span class="sect2"><a href=
1.30      wiz       218:                     "#how-to-build-and-install">4.2.3. How to build
                    219:                     and install</a></span></dt>
1.1       grant     220: 
                    221:                     <dt><span class="sect2"><a href=
1.30      wiz       222:                     "#selecting-the-compiler">4.2.4. Selecting the
1.1       grant     223:                     compiler</a></span></dt>
                    224:                   </dl>
                    225:                 </dd>
                    226:               </dl>
                    227:             </dd>
                    228: 
1.38      dillo     229:             <dt><span class="chapter"><a href="#configuring">5.
                    230:             Configuring pkgsrc</a></span></dt>
                    231: 
                    232:             <dd>
                    233:               <dl>
                    234:                 <dt><span class="sect1"><a href=
1.45      wiz       235:                 "#general-configuration">5.1. General
                    236:                 configuration</a></span></dt>
                    237: 
                    238:                 <dt><span class="sect1"><a href=
                    239:                 "#variables-affecting-build">5.2. Variables
                    240:                 affecting the build process</a></span></dt>
                    241: 
                    242:                 <dt><span class="sect1"><a href=
                    243:                 "#developer-advanced-settings">5.3.
                    244:                 Developer/advanced settings</a></span></dt>
                    245: 
                    246:                 <dt><span class="sect1"><a href=
                    247:                 "#selecting-build-options">5.4. Selecting Build
1.42      dillo     248:                 Options</a></span></dt>
1.38      dillo     249:               </dl>
                    250:             </dd>
                    251: 
                    252:             <dt><span class="chapter"><a href="#binary">6. Creating
1.1       grant     253:             binary packages</a></span></dt>
                    254: 
                    255:             <dd>
                    256:               <dl>
1.30      wiz       257:                 <dt><span class="sect1"><a href=
1.38      dillo     258:                 "#building-a-single-binary-package">6.1. Building a
1.30      wiz       259:                 single binary package</a></span></dt>
1.1       grant     260: 
1.30      wiz       261:                 <dt><span class="sect1"><a href=
1.38      dillo     262:                 "#settings-for-creationg-of-binary-packages">6.2.
1.1       grant     263:                 Settings for creation of binary
                    264:                 packages</a></span></dt>
                    265: 
1.38      dillo     266:                 <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1       grant     267:                 Doing a bulk build of all packages</a></span></dt>
                    268: 
                    269:                 <dd>
                    270:                   <dl>
                    271:                     <dt><span class="sect2"><a href=
1.38      dillo     272:                     "#binary.configuration">6.3.1.
1.1       grant     273:                     Configuration</a></span></dt>
                    274: 
                    275:                     <dt><span class="sect2"><a href=
1.38      dillo     276:                     "#other-environmental-considerations">6.3.2.
1.30      wiz       277:                     Other environmental
1.1       grant     278:                     considerations</a></span></dt>
                    279: 
                    280:                     <dt><span class="sect2"><a href=
1.38      dillo     281:                     "#operation">6.3.3. Operation</a></span></dt>
1.1       grant     282: 
                    283:                     <dt><span class="sect2"><a href=
1.38      dillo     284:                     "#what-it-does">6.3.4. What it
1.1       grant     285:                     does</a></span></dt>
                    286: 
                    287:                     <dt><span class="sect2"><a href=
1.38      dillo     288:                     "#disk-space-requirements">6.3.5. Disk space
1.1       grant     289:                     requirements</a></span></dt>
                    290: 
                    291:                     <dt><span class="sect2"><a href=
1.38      dillo     292:                     "#setting-up-a-sandbox">6.3.6. Setting up a
1.47      reed      293:                     sandbox for chrooted builds</a></span></dt>
1.1       grant     294: 
                    295:                     <dt><span class="sect2"><a href=
1.38      dillo     296:                     "#building-a-partial-set">6.3.7. Building a
1.30      wiz       297:                     partial set of packages</a></span></dt>
1.13      hubertf   298: 
                    299:                     <dt><span class="sect2"><a href=
1.38      dillo     300:                     "#bulk-upload">6.3.8. Uploading results of a
1.13      hubertf   301:                     bulk build</a></span></dt>
1.1       grant     302:                   </dl>
                    303:                 </dd>
                    304: 
1.30      wiz       305:                 <dt><span class="sect1"><a href=
1.38      dillo     306:                 "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30      wiz       307:                 packages collection</a></span></dt>
1.1       grant     308: 
                    309:                 <dd>
                    310:                   <dl>
                    311:                     <dt><span class="sect2"><a href=
1.38      dillo     312:                     "#cdpack-example">6.4.1. Example of
1.1       grant     313:                     cdpack</a></span></dt>
                    314:                   </dl>
                    315:                 </dd>
                    316:               </dl>
                    317:             </dd>
                    318: 
1.38      dillo     319:             <dt><span class="chapter"><a href="#faq">7. Frequently
1.1       grant     320:             Asked Questions</a></span></dt>
                    321: 
                    322:             <dd>
                    323:               <dl>
1.30      wiz       324:                 <dt><span class="sect1"><a href=
1.38      dillo     325:                 "#mailing-list-pointers">7.1. Are there any mailing
1.30      wiz       326:                 lists for pkg-related discussion?</a></span></dt>
1.1       grant     327: 
1.30      wiz       328:                 <dt><span class="sect1"><a href=
1.38      dillo     329:                 "#pkgviews-docs">7.2. Where's the pkgviews
1.30      wiz       330:                 documentation?</a></span></dt>
1.1       grant     331: 
1.5       hubertf   332:                 <dt><span class="sect1"><a href=
1.38      dillo     333:                 "#faq-pkgtools">7.3. Utilities for package
1.5       hubertf   334:                 management (pkgtools)</a></span></dt>
1.1       grant     335: 
1.30      wiz       336:                 <dt><span class="sect1"><a href=
1.38      dillo     337:                 "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30      wiz       338:                 non-root</a></span></dt>
                    339: 
                    340:                 <dt><span class="sect1"><a href=
1.38      dillo     341:                 "#resume-transfers">7.5. How to resume transfers
1.30      wiz       342:                 when fetching distfiles?</a></span></dt>
                    343: 
                    344:                 <dt><span class="sect1"><a href=
1.38      dillo     345:                 "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30      wiz       346:                 XFree86 from pkgsrc?</a></span></dt>
                    347: 
                    348:                 <dt><span class="sect1"><a href=
1.38      dillo     349:                 "#x.org-from-pkgsrc">7.7. How can I install/use
1.30      wiz       350:                 X.org from pkgsrc?</a></span></dt>
1.1       grant     351: 
1.30      wiz       352:                 <dt><span class="sect1"><a href=
1.38      dillo     353:                 "#fetch-behind-firewall">7.8. How to fetch files
1.30      wiz       354:                 from behind a firewall</a></span></dt>
1.1       grant     355: 
1.38      dillo     356:                 <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.14      xtraeme   357:                 How do I tell <span><strong class="command">make
                    358:                 fetch</strong></span> to do passive
1.1       grant     359:                 FTP?</a></span></dt>
                    360: 
1.30      wiz       361:                 <dt><span class="sect1"><a href=
1.38      dillo     362:                 "#fetching-all-distfiles">7.10. How to fetch all
1.30      wiz       363:                 distfiles at once</a></span></dt>
1.1       grant     364: 
1.30      wiz       365:                 <dt><span class="sect1"><a href=
1.38      dillo     366:                 "#tmac.andoc-missing">7.11. What does
1.30      wiz       367:                 &#8220;<span class="quote">Don't know how to make
                    368:                 /usr/share/tmac/tmac.andoc</span>&#8221;
1.14      xtraeme   369:                 mean?</a></span></dt>
1.13      hubertf   370: 
1.30      wiz       371:                 <dt><span class="sect1"><a href=
1.38      dillo     372:                 "#bsd.own.mk-missing">7.12. What does
1.30      wiz       373:                 &#8220;<span class="quote">Could not find
1.14      xtraeme   374:                 bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant     375: 
1.30      wiz       376:                 <dt><span class="sect1"><a href=
1.38      dillo     377:                 "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30      wiz       378:                 pkgsrc</a></span></dt>
1.1       grant     379: 
1.38      dillo     380:                 <dt><span class="sect1"><a href="#faq.conf">7.14.
1.35      jmmv      381:                 How do I change the location of configuration
                    382:                 files?</a></span></dt>
1.1       grant     383: 
                    384:                 <dt><span class="sect1"><a href=
1.38      dillo     385:                 "#audit-packages">7.15. Automated security
1.1       grant     386:                 checks</a></span></dt>
                    387:               </dl>
                    388:             </dd>
                    389:           </dl>
                    390:         </dd>
                    391: 
1.46      gdt       392:         <dt><span class="part"><a href="#developers-guide">II. The
1.1       grant     393:         pkgsrc developer's guide</a></span></dt>
                    394: 
                    395:         <dd>
                    396:           <dl>
1.38      dillo     397:             <dt><span class="chapter"><a href="#components">8.
1.27      rillig    398:             Package components - files, directories and
                    399:             contents</a></span></dt>
                    400: 
                    401:             <dd>
                    402:               <dl>
                    403:                 <dt><span class="sect1"><a href=
1.45      wiz       404:                 "#components.Makefile">8.1. <code xmlns=
                    405:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig    406:                 "filename">Makefile</code></a></span></dt>
                    407: 
                    408:                 <dt><span class="sect1"><a href=
1.45      wiz       409:                 "#components.distinfo">8.2. <code xmlns=
                    410:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig    411:                 "filename">distinfo</code></a></span></dt>
                    412: 
                    413:                 <dt><span class="sect1"><a href=
1.38      dillo     414:                 "#components.patches">8.3.
1.27      rillig    415:                 patches/*</a></span></dt>
                    416: 
1.30      wiz       417:                 <dt><span class="sect1"><a href=
1.38      dillo     418:                 "#other-mandatory-files">8.4. Other mandatory
1.30      wiz       419:                 files</a></span></dt>
1.27      rillig    420: 
                    421:                 <dt><span class="sect1"><a href=
1.38      dillo     422:                 "#components.optional">8.5. Optional
1.27      rillig    423:                 files</a></span></dt>
                    424: 
1.38      dillo     425:                 <dt><span class="sect1"><a href="#work-dir">8.6.
1.45      wiz       426:                 <code xmlns=
                    427:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                    428:                 "filename">work*</code></a></span></dt>
1.27      rillig    429: 
1.38      dillo     430:                 <dt><span class="sect1"><a href="#files-dir">8.7.
1.45      wiz       431:                 <code xmlns=
                    432:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig    433:                 "filename">files/*</code></a></span></dt>
                    434:               </dl>
                    435:             </dd>
                    436: 
1.38      dillo     437:             <dt><span class="chapter"><a href="#makefile">9.
1.45      wiz       438:             Programming in <code xmlns=
                    439:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.25      rillig    440:             "filename">Makefile</code>s</a></span></dt>
                    441: 
                    442:             <dd>
                    443:               <dl>
                    444:                 <dt><span class="sect1"><a href=
1.45      wiz       445:                 "#makefile.variables">9.1. <code xmlns=
                    446:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.25      rillig    447:                 "filename">Makefile</code>
                    448:                 variables</a></span></dt>
                    449: 
1.27      rillig    450:                 <dd>
                    451:                   <dl>
                    452:                     <dt><span class="sect2"><a href=
1.38      dillo     453:                     "#makefile.variables.names">9.1.1. Naming
1.27      rillig    454:                     conventions</a></span></dt>
                    455:                   </dl>
                    456:                 </dd>
                    457: 
1.25      rillig    458:                 <dt><span class="sect1"><a href=
1.38      dillo     459:                 "#makefile.code">9.2. Code snippets</a></span></dt>
1.25      rillig    460: 
                    461:                 <dd>
                    462:                   <dl>
                    463:                     <dt><span class="sect2"><a href=
1.38      dillo     464:                     "#adding-to-list">9.2.1. Adding things to a
1.25      rillig    465:                     list</a></span></dt>
                    466: 
                    467:                     <dt><span class="sect2"><a href=
1.38      dillo     468:                     "#converting-internal-to-external">9.2.2.
1.30      wiz       469:                     Converting an internal list into an external
                    470:                     list</a></span></dt>
1.25      rillig    471: 
                    472:                     <dt><span class="sect2"><a href=
1.38      dillo     473:                     "#passing-variable-to-shell">9.2.3. Passing
1.30      wiz       474:                     variables to a shell command</a></span></dt>
1.27      rillig    475: 
                    476:                     <dt><span class="sect2"><a href=
1.38      dillo     477:                     "#quoting-guideline">9.2.4. Quoting
1.27      rillig    478:                     guideline</a></span></dt>
                    479: 
                    480:                     <dt><span class="sect2"><a href=
1.38      dillo     481:                     "#bsd-make-bug-workaround">9.2.5. Workaround
1.30      wiz       482:                     for a bug in BSD Make</a></span></dt>
1.25      rillig    483:                   </dl>
                    484:                 </dd>
                    485:               </dl>
                    486:             </dd>
                    487: 
1.38      dillo     488:             <dt><span class="chapter"><a href="#plist">10. PLIST
1.1       grant     489:             issues</a></span></dt>
                    490: 
                    491:             <dd>
                    492:               <dl>
1.38      dillo     493:                 <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.30      wiz       494:                 ID</a></span></dt>
1.1       grant     495: 
1.30      wiz       496:                 <dt><span class="sect1"><a href=
1.38      dillo     497:                 "#automatic-plist-generation">10.2. Semi-automatic
1.45      wiz       498:                 <code xmlns=
                    499:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                    500:                 "filename">PLIST</code> generation</a></span></dt>
1.1       grant     501: 
1.38      dillo     502:                 <dt><span class="sect1"><a href=
                    503:                 "#print-PLIST">10.3. Tweaking output of
                    504:                 <span><strong class="command">make
1.14      xtraeme   505:                 print-PLIST</strong></span></a></span></dt>
1.1       grant     506: 
1.38      dillo     507:                 <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1       grant     508:                 Variable substitution in PLIST</a></span></dt>
                    509: 
1.30      wiz       510:                 <dt><span class="sect1"><a href=
1.48      dillo     511:                 "#manpage-compression">10.5. Man page
                    512:                 compression</a></span></dt>
1.1       grant     513: 
1.30      wiz       514:                 <dt><span class="sect1"><a href=
1.38      dillo     515:                 "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30      wiz       516:                 <code class=
1.14      xtraeme   517:                 "varname">PLIST_SRC</code></a></span></dt>
1.1       grant     518: 
1.30      wiz       519:                 <dt><span class="sect1"><a href=
1.47      reed      520:                 "#platform-specific-plist">10.7. Platform-specific
1.30      wiz       521:                 and differing PLISTs</a></span></dt>
1.1       grant     522: 
                    523:                 <dt><span class="sect1"><a href=
1.38      dillo     524:                 "#faq.common-dirs">10.8. Sharing directories
                    525:                 between packages</a></span></dt>
1.1       grant     526:               </dl>
                    527:             </dd>
                    528: 
1.38      dillo     529:             <dt><span class="chapter"><a href="#buildlink">11.
1.1       grant     530:             Buildlink methodology</a></span></dt>
                    531: 
                    532:             <dd>
                    533:               <dl>
1.30      wiz       534:                 <dt><span class="sect1"><a href=
1.38      dillo     535:                 "#converting-to-buildlink3">11.1. Converting
1.30      wiz       536:                 packages to use buildlink3</a></span></dt>
1.1       grant     537: 
1.30      wiz       538:                 <dt><span class="sect1"><a href=
1.38      dillo     539:                 "#creating-buildlink3.mk">11.2. Writing
1.45      wiz       540:                 <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                    541:                 class="filename">buildlink3.mk</code>
1.14      xtraeme   542:                 files</a></span></dt>
1.1       grant     543: 
                    544:                 <dd>
                    545:                   <dl>
                    546:                     <dt><span class="sect2"><a href=
1.38      dillo     547:                     "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30      wiz       548:                     buildlink3.mk file</a></span></dt>
1.1       grant     549: 
                    550:                     <dt><span class="sect2"><a href=
1.38      dillo     551:                     "#updating-buildlink-depends">11.2.2. Updating
1.30      wiz       552:                     <code class=
1.14      xtraeme   553:                     "varname">BUILDLINK_DEPENDS.<em class=
                    554:                     "replaceable"><code>pkg</code></em></code> in
1.45      wiz       555:                     <code xmlns=
                    556:                     "http://www.w3.org/TR/xhtml1/transitional"
                    557:                     class="filename">buildlink3.mk</code>
1.1       grant     558:                     files</a></span></dt>
                    559:                   </dl>
                    560:                 </dd>
                    561: 
1.30      wiz       562:                 <dt><span class="sect1"><a href=
1.45      wiz       563:                 "#writing-builtin.mk">11.3. Writing <code xmlns=
                    564:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz       565:                 "filename">builtin.mk</code> files</a></span></dt>
1.1       grant     566: 
                    567:                 <dd>
                    568:                   <dl>
                    569:                     <dt><span class="sect2"><a href=
1.38      dillo     570:                     "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45      wiz       571:                     <code xmlns=
                    572:                     "http://www.w3.org/TR/xhtml1/transitional"
                    573:                     class="filename">builtin.mk</code>
1.1       grant     574:                     file</a></span></dt>
                    575: 
                    576:                     <dt><span class="sect2"><a href=
1.38      dillo     577:                     "#native-or-pkgsrc-preference">11.3.2. Global
1.30      wiz       578:                     preferences for native or pkgsrc
                    579:                     software</a></span></dt>
1.1       grant     580:                   </dl>
                    581:                 </dd>
                    582:               </dl>
                    583:             </dd>
                    584: 
1.38      dillo     585:             <dt><span class="chapter"><a href="#pkginstall">12. The
1.35      jmmv      586:             pkginstall framework</a></span></dt>
                    587: 
                    588:             <dd>
                    589:               <dl>
                    590:                 <dt><span class="sect1"><a href=
1.38      dillo     591:                 "#files-and-dirs-outside-prefix">12.1. Files and
1.35      jmmv      592:                 directories outside the installation
                    593:                 prefix</a></span></dt>
                    594: 
                    595:                 <dd>
                    596:                   <dl>
                    597:                     <dt><span class="sect2"><a href=
1.38      dillo     598:                     "#dirs-outside-prefix">12.1.1. Directory
1.35      jmmv      599:                     manipulation</a></span></dt>
                    600: 
                    601:                     <dt><span class="sect2"><a href=
1.38      dillo     602:                     "#files-outside-prefix">12.1.2. File
1.35      jmmv      603:                     manipulation</a></span></dt>
                    604:                   </dl>
                    605:                 </dd>
                    606: 
1.38      dillo     607:                 <dt><span class="sect1"><a href="#conf-files">12.2.
1.35      jmmv      608:                 Configuration files</a></span></dt>
                    609: 
                    610:                 <dd>
                    611:                   <dl>
                    612:                     <dt><span class="sect2"><a href=
1.38      dillo     613:                     "#conf-files-sysconfdir">12.2.1. How
1.35      jmmv      614:                     <code class="varname">PKG_SYSCONFDIR</code> is
                    615:                     set</a></span></dt>
                    616: 
                    617:                     <dt><span class="sect2"><a href=
1.38      dillo     618:                     "#conf-files-configure">12.2.2. Telling the
1.47      reed      619:                     software where configuration files
1.35      jmmv      620:                     are</a></span></dt>
                    621: 
                    622:                     <dt><span class="sect2"><a href=
1.38      dillo     623:                     "#conf-files-patching">12.2.3. Patching
1.35      jmmv      624:                     installations</a></span></dt>
                    625: 
                    626:                     <dt><span class="sect2"><a href=
1.38      dillo     627:                     "#conf-files-disable">12.2.4. Disabling
1.35      jmmv      628:                     handling of configuration files</a></span></dt>
                    629:                   </dl>
                    630:                 </dd>
                    631: 
                    632:                 <dt><span class="sect1"><a href=
1.38      dillo     633:                 "#rcd-scripts">12.3. System startup
1.35      jmmv      634:                 scripts</a></span></dt>
                    635: 
                    636:                 <dd>
                    637:                   <dl>
                    638:                     <dt><span class="sect2"><a href=
1.38      dillo     639:                     "#rcd-scripts-disable">12.3.1. Disabling
1.35      jmmv      640:                     handling of system startup
                    641:                     scripts</a></span></dt>
                    642:                   </dl>
                    643:                 </dd>
                    644: 
                    645:                 <dt><span class="sect1"><a href=
1.38      dillo     646:                 "#users-and-groups">12.4. System users and
1.35      jmmv      647:                 groups</a></span></dt>
                    648: 
1.38      dillo     649:                 <dt><span class="sect1"><a href="#shells">12.5.
1.35      jmmv      650:                 System shells</a></span></dt>
                    651: 
                    652:                 <dd>
                    653:                   <dl>
                    654:                     <dt><span class="sect2"><a href=
1.65      hubertf   655:                     "#shells-disable">12.5.1. Disabling shell
                    656:                     registration</a></span></dt>
                    657:                   </dl>
                    658:                 </dd>
                    659: 
                    660:                 <dt><span class="sect1"><a href="#fonts">12.6.
                    661:                 Fonts</a></span></dt>
                    662: 
                    663:                 <dd>
                    664:                   <dl>
                    665:                     <dt><span class="sect2"><a href=
                    666:                     "#fonts-disable">12.6.1. Disabling automatic
                    667:                     update of the fonts databases</a></span></dt>
1.35      jmmv      668:                   </dl>
                    669:                 </dd>
                    670:               </dl>
                    671:             </dd>
                    672: 
1.38      dillo     673:             <dt><span class="chapter"><a href="#options">13.
1.1       grant     674:             Options handling</a></span></dt>
                    675: 
                    676:             <dd>
                    677:               <dl>
1.30      wiz       678:                 <dt><span class="sect1"><a href=
1.38      dillo     679:                 "#global-default-options">13.1. Global default
1.30      wiz       680:                 options</a></span></dt>
1.1       grant     681: 
1.30      wiz       682:                 <dt><span class="sect1"><a href=
1.38      dillo     683:                 "#converting-to-options">13.2. Converting packages
1.45      wiz       684:                 to use <code xmlns=
                    685:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme   686:                 "filename">bsd.options.mk</code></a></span></dt>
1.48      dillo     687: 
                    688:                 <dt><span class="sect1"><a href=
                    689:                 "#option-names">13.3. Option Names</a></span></dt>
1.1       grant     690:               </dl>
                    691:             </dd>
                    692: 
1.38      dillo     693:             <dt><span class="chapter"><a href="#build">14. The
1.1       grant     694:             build process</a></span></dt>
                    695: 
                    696:             <dd>
                    697:               <dl>
                    698:                 <dt><span class="sect1"><a href=
1.56      rillig    699:                 "#build.intro">14.1. Introduction</a></span></dt>
                    700: 
                    701:                 <dt><span class="sect1"><a href=
                    702:                 "#build.prefix">14.2. Program
1.1       grant     703:                 location</a></span></dt>
                    704: 
1.30      wiz       705:                 <dt><span class="sect1"><a href=
1.56      rillig    706:                 "#build.builddirs">14.3. Directories used during
                    707:                 the build process</a></span></dt>
                    708: 
                    709:                 <dt><span class="sect1"><a href=
                    710:                 "#build.running">14.4. Running a
                    711:                 phase</a></span></dt>
                    712: 
                    713:                 <dt><span class="sect1"><a href=
                    714:                 "#build.fetch">14.5. The <span class=
                    715:                 "emphasis"><em>fetch</em></span>
                    716:                 phase</a></span></dt>
                    717: 
                    718:                 <dt><span class="sect1"><a href=
                    719:                 "#build.checksum">14.6. The <span class=
                    720:                 "emphasis"><em>checksum</em></span>
                    721:                 phase</a></span></dt>
                    722: 
                    723:                 <dt><span class="sect1"><a href=
                    724:                 "#build.extract">14.7. The <span class=
                    725:                 "emphasis"><em>extract</em></span>
                    726:                 phase</a></span></dt>
                    727: 
                    728:                 <dt><span class="sect1"><a href=
                    729:                 "#build.patch">14.8. The <span class=
                    730:                 "emphasis"><em>patch</em></span>
                    731:                 phase</a></span></dt>
                    732: 
                    733:                 <dt><span class="sect1"><a href=
                    734:                 "#build.tools">14.9. The <span class=
                    735:                 "emphasis"><em>tools</em></span>
                    736:                 phase</a></span></dt>
                    737: 
                    738:                 <dt><span class="sect1"><a href=
                    739:                 "#build.wrapper">14.10. The <span class=
                    740:                 "emphasis"><em>wrapper</em></span>
                    741:                 phase</a></span></dt>
                    742: 
                    743:                 <dt><span class="sect1"><a href=
                    744:                 "#build.configure">14.11. The <span class=
                    745:                 "emphasis"><em>configure</em></span>
                    746:                 phase</a></span></dt>
                    747: 
                    748:                 <dt><span class="sect1"><a href=
                    749:                 "#build.build">14.12. The <span class=
                    750:                 "emphasis"><em>build</em></span>
                    751:                 phase</a></span></dt>
                    752: 
                    753:                 <dt><span class="sect1"><a href=
                    754:                 "#build.test">14.13. The <span class=
                    755:                 "emphasis"><em>test</em></span>
                    756:                 phase</a></span></dt>
                    757: 
                    758:                 <dt><span class="sect1"><a href=
                    759:                 "#build.install">14.14. The <span class=
                    760:                 "emphasis"><em>install</em></span>
                    761:                 phase</a></span></dt>
1.1       grant     762: 
                    763:                 <dt><span class="sect1"><a href=
1.56      rillig    764:                 "#build.package">14.15. The <span class=
                    765:                 "emphasis"><em>package</em></span>
                    766:                 phase</a></span></dt>
                    767: 
                    768:                 <dt><span class="sect1"><a href=
                    769:                 "#build.helpful-targets">14.16. Other helpful
1.1       grant     770:                 targets</a></span></dt>
                    771:               </dl>
                    772:             </dd>
                    773: 
1.55      rillig    774:             <dt><span class="chapter"><a href="#fixes">15. Making
                    775:             your package work</a></span></dt>
1.1       grant     776: 
                    777:             <dd>
                    778:               <dl>
1.30      wiz       779:                 <dt><span class="sect1"><a href=
1.38      dillo     780:                 "#general-operation">15.1. General
1.30      wiz       781:                 operation</a></span></dt>
1.1       grant     782: 
                    783:                 <dd>
                    784:                   <dl>
                    785:                     <dt><span class="sect2"><a href=
1.38      dillo     786:                     "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30      wiz       787:                     pull in variables from
                    788:                     /etc/mk.conf</a></span></dt>
1.1       grant     789: 
                    790:                     <dt><span class="sect2"><a href=
1.38      dillo     791:                     "#where-to-install-documentation">15.1.2. Where
1.31      wiz       792:                     to install documentation</a></span></dt>
                    793: 
                    794:                     <dt><span class="sect2"><a href=
1.38      dillo     795:                     "#restricted-packages">15.1.3. Restricted
1.1       grant     796:                     packages</a></span></dt>
                    797: 
                    798:                     <dt><span class="sect2"><a href=
1.38      dillo     799:                     "#dependencies">15.1.4. Handling
1.1       grant     800:                     dependencies</a></span></dt>
                    801: 
                    802:                     <dt><span class="sect2"><a href=
1.38      dillo     803:                     "#conflicts">15.1.5. Handling conflicts with
1.1       grant     804:                     other packages</a></span></dt>
                    805: 
                    806:                     <dt><span class="sect2"><a href=
1.38      dillo     807:                     "#not-building-packages">15.1.6. Packages that
1.30      wiz       808:                     cannot or should not be built</a></span></dt>
1.1       grant     809: 
                    810:                     <dt><span class="sect2"><a href=
1.38      dillo     811:                     "#undeletable-packages">15.1.7. Packages which
1.30      wiz       812:                     should not be deleted, once
                    813:                     installed</a></span></dt>
1.1       grant     814: 
                    815:                     <dt><span class="sect2"><a href=
1.38      dillo     816:                     "#security-handling">15.1.8. Handling packages
1.1       grant     817:                     with security problems</a></span></dt>
                    818: 
                    819:                     <dt><span class="sect2"><a href=
1.38      dillo     820:                     "#compiler-bugs">15.1.9. How to handle compiler
1.1       grant     821:                     bugs</a></span></dt>
                    822: 
                    823:                     <dt><span class="sect2"><a href=
1.38      dillo     824:                     "#bumping-pkgrevision">15.1.10. How to handle
1.30      wiz       825:                     incrementing versions when fixing an existing
1.1       grant     826:                     package</a></span></dt>
                    827: 
                    828:                     <dt><span class="sect2"><a href=
1.38      dillo     829:                     "#portability-of-packages">15.1.11. Portability
1.30      wiz       830:                     of packages</a></span></dt>
1.1       grant     831:                   </dl>
                    832:                 </dd>
                    833: 
1.30      wiz       834:                 <dt><span class="sect1"><a href=
1.38      dillo     835:                 "#downloading-issues">15.2. Possible downloading
1.30      wiz       836:                 issues</a></span></dt>
1.1       grant     837: 
                    838:                 <dd>
                    839:                   <dl>
                    840:                     <dt><span class="sect2"><a href=
1.38      dillo     841:                     "#no-plain-download">15.2.1. Packages whose
1.30      wiz       842:                     distfiles aren't available for plain
1.1       grant     843:                     downloading</a></span></dt>
                    844: 
                    845:                     <dt><span class="sect2"><a href=
1.38      dillo     846:                     "#modified-distfiles-same-name">15.2.2. How to
1.30      wiz       847:                     handle modified distfiles with the 'old'
                    848:                     name</a></span></dt>
1.1       grant     849:                   </dl>
                    850:                 </dd>
                    851: 
1.30      wiz       852:                 <dt><span class="sect1"><a href=
1.38      dillo     853:                 "#configuration-gotchas">15.3. Configuration
1.30      wiz       854:                 gotchas</a></span></dt>
1.1       grant     855: 
                    856:                 <dd>
                    857:                   <dl>
                    858:                     <dt><span class="sect2"><a href=
1.38      dillo     859:                     "#fixes.libtool">15.3.1. Shared libraries -
1.1       grant     860:                     libtool</a></span></dt>
                    861: 
                    862:                     <dt><span class="sect2"><a href=
1.38      dillo     863:                     "#using-libtool">15.3.2. Using libtool on GNU
1.1       grant     864:                     packages that already support
                    865:                     libtool</a></span></dt>
                    866: 
                    867:                     <dt><span class="sect2"><a href=
1.38      dillo     868:                     "#autoconf-automake">15.3.3. GNU
1.1       grant     869:                     Autoconf/Automake</a></span></dt>
                    870:                   </dl>
                    871:                 </dd>
                    872: 
1.30      wiz       873:                 <dt><span class="sect1"><a href=
1.55      rillig    874:                 "#fixes-build">15.4. Building the
                    875:                 package</a></span></dt>
1.1       grant     876: 
                    877:                 <dd>
                    878:                   <dl>
                    879:                     <dt><span class="sect2"><a href=
1.38      dillo     880:                     "#cpp-defines">15.4.1. CPP
1.1       grant     881:                     defines</a></span></dt>
1.51      rillig    882: 
                    883:                     <dt><span class="sect2"><a href=
1.60      rillig    884:                     "#cpp-list-examples">15.4.2. Examples of CPP
                    885:                     defines for some platforms</a></span></dt>
                    886: 
                    887:                     <dt><span class="sect2"><a href=
                    888:                     "#cpp-list">15.4.3. Getting a list of CPP
1.51      rillig    889:                     defines</a></span></dt>
1.1       grant     890:                   </dl>
                    891:                 </dd>
                    892: 
1.30      wiz       893:                 <dt><span class="sect1"><a href=
1.38      dillo     894:                 "#package-specific-actions">15.5. Package specific
1.30      wiz       895:                 actions</a></span></dt>
1.1       grant     896: 
                    897:                 <dd>
                    898:                   <dl>
                    899:                     <dt><span class="sect2"><a href=
1.38      dillo     900:                     "#user-interaction">15.5.1. User
1.2       hubertf   901:                     interaction</a></span></dt>
1.1       grant     902: 
                    903:                     <dt><span class="sect2"><a href=
1.38      dillo     904:                     "#handling-licenses">15.5.2. Handling
1.1       grant     905:                     licenses</a></span></dt>
                    906: 
                    907:                     <dt><span class="sect2"><a href=
1.38      dillo     908:                     "#installing-score-files">15.5.3. Installing
1.30      wiz       909:                     score files</a></span></dt>
1.1       grant     910: 
                    911:                     <dt><span class="sect2"><a href=
1.38      dillo     912:                     "#perl-scripts">15.5.4. Packages containing
1.30      wiz       913:                     perl scripts</a></span></dt>
1.1       grant     914: 
                    915:                     <dt><span class="sect2"><a href=
1.38      dillo     916:                     "#hardcoded-paths">15.5.5. Packages with
1.30      wiz       917:                     hardcoded paths to other
                    918:                     interpreters</a></span></dt>
1.1       grant     919: 
                    920:                     <dt><span class="sect2"><a href=
1.38      dillo     921:                     "#perl-modules">15.5.6. Packages installing
1.30      wiz       922:                     perl modules</a></span></dt>
1.1       grant     923: 
                    924:                     <dt><span class="sect2"><a href=
1.38      dillo     925:                     "#faq.info-files">15.5.7. Packages installing
1.1       grant     926:                     info files</a></span></dt>
                    927: 
                    928:                     <dt><span class="sect2"><a href=
1.57      minskim   929:                     "#manpages">15.5.8. Packages installing man
                    930:                     pages</a></span></dt>
                    931: 
                    932:                     <dt><span class="sect2"><a href=
                    933:                     "#gconf2-data-files">15.5.9. Packages
1.30      wiz       934:                     installing GConf2 data files</a></span></dt>
1.1       grant     935: 
                    936:                     <dt><span class="sect2"><a href=
1.57      minskim   937:                     "#scrollkeeper-data-files">15.5.10. Packages
1.30      wiz       938:                     installing scrollkeeper data
                    939:                     files</a></span></dt>
1.1       grant     940: 
                    941:                     <dt><span class="sect2"><a href=
1.57      minskim   942:                     "#x11-fonts">15.5.11. Packages installing X11
1.1       grant     943:                     fonts</a></span></dt>
                    944: 
                    945:                     <dt><span class="sect2"><a href=
1.57      minskim   946:                     "#gtk2-modules">15.5.12. Packages installing
1.30      wiz       947:                     GTK2 modules</a></span></dt>
1.1       grant     948: 
                    949:                     <dt><span class="sect2"><a href=
1.57      minskim   950:                     "#sgml-xml-data">15.5.13. Packages installing
1.30      wiz       951:                     SGML or XML data</a></span></dt>
1.1       grant     952: 
                    953:                     <dt><span class="sect2"><a href=
1.57      minskim   954:                     "#mime-database">15.5.14. Packages installing
1.1       grant     955:                     extensions to the MIME database</a></span></dt>
                    956: 
                    957:                     <dt><span class="sect2"><a href=
1.57      minskim   958:                     "#intltool">15.5.15. Packages using
1.1       grant     959:                     intltool</a></span></dt>
1.18      xtraeme   960: 
                    961:                     <dt><span class="sect2"><a href=
1.57      minskim   962:                     "#startup-scripts">15.5.16. Packages installing
1.18      xtraeme   963:                     startup scripts</a></span></dt>
1.57      minskim   964: 
                    965:                     <dt><span class="sect2"><a href=
                    966:                     "#tex-packages">15.5.17. Packages installing
                    967:                     TeX modules</a></span></dt>
1.1       grant     968:                   </dl>
                    969:                 </dd>
                    970: 
1.30      wiz       971:                 <dt><span class="sect1"><a href=
1.38      dillo     972:                 "#feedback-to-author">15.6. Feedback to the
1.30      wiz       973:                 author</a></span></dt>
1.1       grant     974:               </dl>
                    975:             </dd>
                    976: 
1.38      dillo     977:             <dt><span class="chapter"><a href="#debug">16.
1.1       grant     978:             Debugging</a></span></dt>
                    979: 
1.38      dillo     980:             <dt><span class="chapter"><a href="#submit">17.
1.1       grant     981:             Submitting and Committing</a></span></dt>
                    982: 
                    983:             <dd>
                    984:               <dl>
1.30      wiz       985:                 <dt><span class="sect1"><a href=
1.38      dillo     986:                 "#submitting-your-package">17.1. Submitting your
1.30      wiz       987:                 packages</a></span></dt>
1.1       grant     988: 
1.30      wiz       989:                 <dt><span class="sect1"><a href=
1.41      wiz       990:                 "#general-notes-for-changes">17.2. General notes
                    991:                 when adding, updating, or removing
                    992:                 packages</a></span></dt>
                    993: 
                    994:                 <dt><span class="sect1"><a href=
                    995:                 "#committing-importing">17.3. Committing: Importing
1.30      wiz       996:                 a package into CVS</a></span></dt>
1.1       grant     997: 
1.30      wiz       998:                 <dt><span class="sect1"><a href=
1.41      wiz       999:                 "#updating-package">17.4. Updating a package to a
1.30      wiz      1000:                 newer version</a></span></dt>
1.1       grant    1001: 
1.30      wiz      1002:                 <dt><span class="sect1"><a href=
1.41      wiz      1003:                 "#moving-package">17.5. Moving a package in
1.30      wiz      1004:                 pkgsrc</a></span></dt>
1.1       grant    1005:               </dl>
                   1006:             </dd>
                   1007:           </dl>
                   1008:         </dd>
                   1009: 
1.46      gdt      1010:         <dt><span class="appendix"><a href="#examples">A. A simple
1.1       grant    1011:         example package: bison</a></span></dt>
                   1012: 
                   1013:         <dd>
                   1014:           <dl>
1.46      gdt      1015:             <dt><span class="sect1"><a href="#example-files">A.1.
1.1       grant    1016:             files</a></span></dt>
                   1017: 
                   1018:             <dd>
                   1019:               <dl>
1.30      wiz      1020:                 <dt><span class="sect2"><a href=
1.46      gdt      1021:                 "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1       grant    1022: 
1.30      wiz      1023:                 <dt><span class="sect2"><a href=
1.46      gdt      1024:                 "#example-descr">A.1.2. DESCR</a></span></dt>
1.1       grant    1025: 
1.30      wiz      1026:                 <dt><span class="sect2"><a href=
1.46      gdt      1027:                 "#example-plist">A.1.3. PLIST</a></span></dt>
1.1       grant    1028: 
1.30      wiz      1029:                 <dt><span class="sect2"><a href=
1.46      gdt      1030:                 "#checking-package-with-pkglint">A.1.4. Checking a
1.30      wiz      1031:                 package with <span><strong class=
1.14      xtraeme  1032:                 "command">pkglint</strong></span></a></span></dt>
1.1       grant    1033:               </dl>
                   1034:             </dd>
                   1035: 
1.46      gdt      1036:             <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30      wiz      1037:             Steps for building, installing,
                   1038:             packaging</a></span></dt>
1.1       grant    1039:           </dl>
                   1040:         </dd>
                   1041: 
1.46      gdt      1042:         <dt><span class="appendix"><a href="#logs">B. Build
1.1       grant    1043:         logs</a></span></dt>
                   1044: 
                   1045:         <dd>
                   1046:           <dl>
1.46      gdt      1047:             <dt><span class="sect1"><a href="#logs.building">B.1.
1.1       grant    1048:             Building figlet</a></span></dt>
                   1049: 
1.46      gdt      1050:             <dt><span class="sect1"><a href="#logs.package">B.2.
1.1       grant    1051:             Packaging figlet</a></span></dt>
                   1052:           </dl>
                   1053:         </dd>
                   1054: 
1.46      gdt      1055:         <dt><span class="appendix"><a href="#ftp-layout">C. Layout
1.1       grant    1056:         of the FTP server's package archive</a></span></dt>
1.2       hubertf  1057: 
1.46      gdt      1058:         <dt><span class="appendix"><a href="#editing">D. Editing
1.2       hubertf  1059:         guidelines for the pkgsrc guide</a></span></dt>
                   1060: 
                   1061:         <dd>
                   1062:           <dl>
1.46      gdt      1063:             <dt><span class="sect1"><a href="#targets">D.1.
1.2       hubertf  1064:             Targets</a></span></dt>
                   1065: 
1.46      gdt      1066:             <dt><span class="sect1"><a href="#procedure">D.2.
1.2       hubertf  1067:             Procedure</a></span></dt>
                   1068:           </dl>
                   1069:         </dd>
1.1       grant    1070:       </dl>
                   1071:     </div>
                   1072: 
1.66    ! rillig   1073:     <div class="chapter" lang="en" xml:lang="en">
1.1       grant    1074:       <div class="titlepage">
                   1075:         <div>
                   1076:           <div>
1.66    ! rillig   1077:             <h2 class="title"><a name="introduction" id=
1.51      rillig   1078:             "introduction"></a>Chapter&nbsp;1.&nbsp;What is
                   1079:             pkgsrc?</h2>
1.1       grant    1080:           </div>
                   1081:         </div>
                   1082:       </div>
                   1083: 
                   1084:       <div class="toc">
                   1085:         <p><b>Table of Contents</b></p>
                   1086: 
                   1087:         <dl>
1.30      wiz      1088:           <dt><span class="sect1"><a href=
                   1089:           "#introduction-section">1.1. Introduction</a></span></dt>
1.1       grant    1090: 
                   1091:           <dt><span class="sect1"><a href="#overview">1.2.
                   1092:           Overview</a></span></dt>
                   1093: 
                   1094:           <dt><span class="sect1"><a href="#terminology">1.3.
                   1095:           Terminology</a></span></dt>
                   1096: 
                   1097:           <dt><span class="sect1"><a href="#typography">1.4.
                   1098:           Typography</a></span></dt>
                   1099:         </dl>
                   1100:       </div>
                   1101: 
1.66    ! rillig   1102:       <div class="sect1" lang="en" xml:lang="en">
1.1       grant    1103:         <div class="titlepage">
                   1104:           <div>
                   1105:             <div>
                   1106:               <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   1107:               "introduction-section" id=
1.30      wiz      1108:               "introduction-section"></a>1.1.&nbsp;Introduction</h2>
1.1       grant    1109:             </div>
                   1110:           </div>
                   1111:         </div>
                   1112: 
1.47      reed     1113:         <p>There is a lot of software freely available for
                   1114:         Unix-based systems, which usually runs on NetBSD and other
1.1       grant    1115:         Unix-flavoured systems, too, sometimes with some
                   1116:         modifications. The NetBSD Packages Collection (pkgsrc)
                   1117:         incorporates any such changes necessary to make that
                   1118:         software run, and makes the installation (and
                   1119:         de-installation) of the software package easy by means of a
                   1120:         single command.</p>
                   1121: 
                   1122:         <p>Once the software has been built, it is manipulated with
1.14      xtraeme  1123:         the <span><strong class="command">pkg_*</strong></span>
                   1124:         tools so that installation and de-installation, printing of
                   1125:         an inventory of all installed packages and retrieval of
                   1126:         one-line comments or more verbose descriptions are all
                   1127:         simple.</p>
1.1       grant    1128: 
                   1129:         <p>pkgsrc currently contains several thousand packages,
                   1130:         including:</p>
                   1131: 
                   1132:         <div class="itemizedlist">
                   1133:           <ul type="disc">
                   1134:             <li>
                   1135:               <p><a xmlns=
                   1136:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1137:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.45      wiz      1138:               target="_top"><code xmlns="" class=
                   1139:               "filename">www/apache</code></a> - The Apache web
1.20      ben      1140:               server</p>
1.1       grant    1141:             </li>
                   1142: 
                   1143:             <li>
                   1144:               <p><a xmlns=
                   1145:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1146:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45      wiz      1147:               target="_top"><code xmlns="" class=
                   1148:               "filename">www/mozilla</code></a> - The Mozilla web
1.20      ben      1149:               browser</p>
1.1       grant    1150:             </li>
                   1151: 
                   1152:             <li>
                   1153:               <p><a xmlns=
                   1154:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1155:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.45      wiz      1156:               target="_top"><code xmlns="" class=
                   1157:               "filename">meta-pkgs/gnome</code></a> - The GNOME
1.20      ben      1158:               Desktop Environment</p>
1.1       grant    1159:             </li>
                   1160: 
                   1161:             <li>
                   1162:               <p><a xmlns=
                   1163:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1164:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.45      wiz      1165:               target="_top"><code xmlns="" class=
                   1166:               "filename">meta-pkgs/kde3</code></a> - The K Desktop
1.20      ben      1167:               Environment</p>
1.1       grant    1168:             </li>
                   1169:           </ul>
                   1170:         </div>
                   1171: 
                   1172:         <p>...just to name a few.</p>
                   1173: 
                   1174:         <p>pkgsrc has built-in support for handling varying
                   1175:         dependencies, such as pthreads and X11, and extended
                   1176:         features such as IPv6 support on a range of platforms.</p>
                   1177: 
                   1178:         <p>pkgsrc was derived from FreeBSD's ports system, and
                   1179:         initially developed for NetBSD only. Since then, pkgsrc has
                   1180:         grown a lot, and now supports the following platforms:</p>
                   1181: 
                   1182:         <div class="itemizedlist">
                   1183:           <ul type="disc">
                   1184:             <li>
                   1185:               <p><a href="http://developer.apple.com/darwin/"
                   1186:               target="_top">Darwin</a> (<a href=
                   1187:               "http://www.apple.com/macosx/" target="_top">Mac OS
                   1188:               X</a>)</p>
                   1189:             </li>
                   1190: 
                   1191:             <li>
1.3       hubertf  1192:               <p><a href="http://www.DragonFlyBSD.org/" target=
                   1193:               "_top">DragonFlyBSD</a></p>
                   1194:             </li>
                   1195: 
                   1196:             <li>
1.1       grant    1197:               <p><a href="http://www.FreeBSD.org/" target=
                   1198:               "_top">FreeBSD</a></p>
                   1199:             </li>
                   1200: 
                   1201:             <li>
1.3       hubertf  1202:               <p>Microsoft Windows, via <a href=
                   1203:               "http://www.microsoft.com/windows/sfu/" target=
                   1204:               "_top">Interix</a></p>
1.1       grant    1205:             </li>
                   1206: 
                   1207:             <li>
                   1208:               <p><a href="http://www.sgi.com/software/irix6.5/"
                   1209:               target="_top">IRIX</a></p>
                   1210:             </li>
                   1211: 
                   1212:             <li>
                   1213:               <p><a href="http://www.linux.org/" target=
                   1214:               "_top">Linux</a></p>
                   1215:             </li>
                   1216: 
                   1217:             <li>
                   1218:               <p><a href="http://www.NetBSD.org/" target=
                   1219:               "_top">NetBSD</a> (of course)</p>
                   1220:             </li>
                   1221: 
                   1222:             <li>
1.17      sketch   1223:               <p><a href="http://h30097.www3.hp.com/" target=
                   1224:               "_top">Tru64</a> (Digital UNIX, OSF1)</p>
                   1225:             </li>
                   1226: 
                   1227:             <li>
1.1       grant    1228:               <p><a href="http://www.openbsd.org/" target=
                   1229:               "_top">OpenBSD</a></p>
                   1230:             </li>
                   1231: 
                   1232:             <li>
                   1233:               <p><a href="http://www.sun.com/solaris/" target=
                   1234:               "_top">Solaris</a></p>
                   1235:             </li>
                   1236:           </ul>
                   1237:         </div>
                   1238:       </div>
                   1239: 
1.66    ! rillig   1240:       <div class="sect1" lang="en" xml:lang="en">
1.1       grant    1241:         <div class="titlepage">
                   1242:           <div>
                   1243:             <div>
                   1244:               <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   1245:               "overview" id="overview"></a>1.2.&nbsp;Overview</h2>
1.1       grant    1246:             </div>
                   1247:           </div>
                   1248:         </div>
                   1249: 
                   1250:         <p>This document is divided into two parts. The first,
                   1251:         <a href="#users-guide" title=
1.46      gdt      1252:         "Part&nbsp;I.&nbsp;The pkgsrc user's guide">The pkgsrc
1.2       hubertf  1253:         user's guide</a>, describes how one can use one of the
                   1254:         packages in the Package Collection, either by installing a
                   1255:         precompiled binary package, or by building one's own copy
                   1256:         using the NetBSD package system. The second part, <a href=
1.1       grant    1257:         "#developers-guide" title=
1.46      gdt      1258:         "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">The
                   1259:         pkgsrc developer's guide</a>, explains how to prepare a
                   1260:         package so it can be easily built by other NetBSD users
                   1261:         without knowing about the package's building details.</p>
1.1       grant    1262: 
                   1263:         <p>This document is available in various formats:</p>
                   1264: 
                   1265:         <div class="itemizedlist">
                   1266:           <ul type="disc">
                   1267:             <li>
                   1268:               <p><a href="index.html" target="_top">HTML</a></p>
                   1269:             </li>
                   1270: 
                   1271:             <li>
                   1272:               <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
                   1273:             </li>
                   1274: 
                   1275:             <li>
                   1276:               <p><a href="pkgsrc.ps" target="_top">PS</a></p>
                   1277:             </li>
                   1278: 
                   1279:             <li>
                   1280:               <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
                   1281:             </li>
                   1282:           </ul>
                   1283:         </div>
                   1284:       </div>
                   1285: 
1.66    ! rillig   1286:       <div class="sect1" lang="en" xml:lang="en">
1.1       grant    1287:         <div class="titlepage">
                   1288:           <div>
                   1289:             <div>
                   1290:               <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   1291:               "terminology" id=
1.1       grant    1292:               "terminology"></a>1.3.&nbsp;Terminology</h2>
                   1293:             </div>
                   1294:           </div>
                   1295:         </div>
                   1296: 
                   1297:         <p>There has been a lot of talk about &#8220;<span class=
                   1298:         "quote">ports</span>&#8221;, &#8220;<span class=
                   1299:         "quote">packages</span>&#8221;, etc. so far. Here is a
                   1300:         description of all the terminology used within this
                   1301:         document.</p>
                   1302: 
                   1303:         <div class="variablelist">
                   1304:           <dl>
                   1305:             <dt><span class="term">Package</span></dt>
                   1306: 
                   1307:             <dd>
                   1308:               <p>A set of files and building instructions that
                   1309:               describe what's necessary to build a certain piece of
                   1310:               software using pkgsrc. Packages are traditionally
1.45      wiz      1311:               stored under <code xmlns=
                   1312:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1313:               "filename">/usr/pkgsrc</code>.</p>
1.1       grant    1314:             </dd>
                   1315: 
                   1316:             <dt><span class="term">The NetBSD package
                   1317:             system</span></dt>
                   1318: 
                   1319:             <dd>
                   1320:               <p>This is the former name of &#8220;<span class=
                   1321:               "quote">pkgsrc</span>&#8221;. It is part of the
1.27      rillig   1322:               NetBSD operating system and can be bootstrapped to
                   1323:               run on non-NetBSD operating systems as well. It
                   1324:               handles building (compiling), installing, and
                   1325:               removing of packages.</p>
1.1       grant    1326:             </dd>
                   1327: 
                   1328:             <dt><span class="term">Distfile</span></dt>
                   1329: 
                   1330:             <dd>
                   1331:               <p>This term describes the file or files that are
                   1332:               provided by the author of the piece of software to
                   1333:               distribute his work. All the changes necessary to
                   1334:               build on NetBSD are reflected in the corresponding
                   1335:               package. Usually the distfile is in the form of a
                   1336:               compressed tar-archive, but other types are possible,
1.45      wiz      1337:               too. Distfiles are usually stored below <code xmlns=
                   1338:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1339:               "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    1340:             </dd>
                   1341: 
                   1342:             <dt><span class="term">Port</span></dt>
                   1343: 
                   1344:             <dd>
                   1345:               <p>This is the term used by FreeBSD and OpenBSD
                   1346:               people for what we call a package. In NetBSD
                   1347:               terminology, &#8220;<span class=
                   1348:               "quote">port</span>&#8221; refers to a different
                   1349:               architecture.</p>
                   1350:             </dd>
                   1351: 
                   1352:             <dt><span class="term">Precompiled/binary
                   1353:             package</span></dt>
                   1354: 
                   1355:             <dd>
                   1356:               <p>A set of binaries built with pkgsrc from a
1.14      xtraeme  1357:               distfile and stuffed together in a single
1.45      wiz      1358:               <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   1359:               class="filename">.tgz</code> file so it can be
1.14      xtraeme  1360:               installed on machines of the same machine
                   1361:               architecture without the need to recompile. Packages
1.45      wiz      1362:               are usually generated in <code xmlns=
                   1363:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1364:               "filename">/usr/pkgsrc/packages</code>; there is also
                   1365:               an archive on <a href=
1.1       grant    1366:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
                   1367:               "_top">ftp.NetBSD.org</a>.</p>
                   1368: 
                   1369:               <p>Sometimes, this is referred to by the term
                   1370:               &#8220;<span class="quote">package</span>&#8221; too,
                   1371:               especially in the context of precompiled
                   1372:               packages.</p>
                   1373:             </dd>
                   1374: 
                   1375:             <dt><span class="term">Program</span></dt>
                   1376: 
                   1377:             <dd>
                   1378:               <p>The piece of software to be installed which will
1.47      reed     1379:               be constructed from all the files in the distfile by
1.1       grant    1380:               the actions defined in the corresponding package.</p>
                   1381:             </dd>
                   1382:           </dl>
                   1383:         </div>
                   1384:       </div>
                   1385: 
1.66    ! rillig   1386:       <div class="sect1" lang="en" xml:lang="en">
1.1       grant    1387:         <div class="titlepage">
                   1388:           <div>
                   1389:             <div>
                   1390:               <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   1391:               "typography" id=
1.1       grant    1392:               "typography"></a>1.4.&nbsp;Typography</h2>
                   1393:             </div>
                   1394:           </div>
                   1395:         </div>
                   1396: 
                   1397:         <p>When giving examples for commands, shell prompts are
                   1398:         used to show if the command should/can be issued as root,
                   1399:         or if &#8220;<span class="quote">normal</span>&#8221; user
1.14      xtraeme  1400:         privileges are sufficient. We use a <code class=
                   1401:         "prompt">#</code> for root's shell prompt, and a
1.27      rillig   1402:         <code class="prompt">%</code> for users' shell prompt,
1.14      xtraeme  1403:         assuming they use the C-shell or tcsh.</p>
1.1       grant    1404:       </div>
                   1405:     </div>
                   1406: 
1.66    ! rillig   1407:     <div class="part" lang="en" xml:lang="en">
1.1       grant    1408:       <div class="titlepage">
                   1409:         <div>
                   1410:           <div>
1.66    ! rillig   1411:             <h1 class="title"><a name="users-guide" id=
1.48      dillo    1412:             "users-guide"></a>Part&nbsp;I.&nbsp;The pkgsrc user's
                   1413:             guide</h1>
1.1       grant    1414:           </div>
                   1415:         </div>
                   1416:       </div>
                   1417: 
                   1418:       <div class="toc">
                   1419:         <p><b>Table of Contents</b></p>
                   1420: 
                   1421:         <dl>
                   1422:           <dt><span class="chapter"><a href="#getting">2. Where to
1.59      rillig   1423:           get pkgsrc and how to keep it up-to-date</a></span></dt>
1.1       grant    1424: 
                   1425:           <dd>
                   1426:             <dl>
1.30      wiz      1427:               <dt><span class="sect1"><a href="#as-tar-file">2.1.
                   1428:               As tar file</a></span></dt>
1.1       grant    1429: 
1.30      wiz      1430:               <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1       grant    1431:               SUP</a></span></dt>
                   1432: 
1.30      wiz      1433:               <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1       grant    1434:               CVS</a></span></dt>
1.59      rillig   1435: 
                   1436:               <dt><span class="sect1"><a href="#uptodate-cvs">2.4.
                   1437:               Keeping pkgsrc up-to-date via CVS</a></span></dt>
1.1       grant    1438:             </dl>
                   1439:           </dd>
                   1440: 
                   1441:           <dt><span class="chapter"><a href="#platforms">3. Using
                   1442:           pkgsrc on systems other than NetBSD</a></span></dt>
                   1443: 
                   1444:           <dd>
                   1445:             <dl>
1.30      wiz      1446:               <dt><span class="sect1"><a href=
                   1447:               "#bootstrapping-pkgsrc">3.1. Bootstrapping
                   1448:               pkgsrc</a></span></dt>
1.1       grant    1449: 
1.30      wiz      1450:               <dt><span class="sect1"><a href=
1.47      reed     1451:               "#platform-specific-notes">3.2. Platform-specific
1.30      wiz      1452:               notes</a></span></dt>
1.1       grant    1453: 
                   1454:               <dd>
                   1455:                 <dl>
1.30      wiz      1456:                   <dt><span class="sect2"><a href="#darwin">3.2.1.
                   1457:                   Darwin (Mac OS X)</a></span></dt>
1.1       grant    1458: 
1.30      wiz      1459:                   <dt><span class="sect2"><a href="#freebsd">3.2.2.
                   1460:                   FreeBSD</a></span></dt>
1.22      tv       1461: 
1.30      wiz      1462:                   <dt><span class="sect2"><a href="#interix">3.2.3.
                   1463:                   Interix</a></span></dt>
1.1       grant    1464: 
1.30      wiz      1465:                   <dt><span class="sect2"><a href="#irix">3.2.4.
                   1466:                   IRIX</a></span></dt>
1.1       grant    1467: 
1.30      wiz      1468:                   <dt><span class="sect2"><a href="#linux">3.2.5.
                   1469:                   Linux</a></span></dt>
1.1       grant    1470: 
1.30      wiz      1471:                   <dt><span class="sect2"><a href="#openbsd">3.2.6.
                   1472:                   OpenBSD</a></span></dt>
1.1       grant    1473: 
1.30      wiz      1474:                   <dt><span class="sect2"><a href="#solaris">3.2.7.
                   1475:                   Solaris</a></span></dt>
1.1       grant    1476:                 </dl>
                   1477:               </dd>
                   1478:             </dl>
                   1479:           </dd>
                   1480: 
                   1481:           <dt><span class="chapter"><a href="#using">4. Using
                   1482:           pkgsrc</a></span></dt>
                   1483: 
                   1484:           <dd>
                   1485:             <dl>
                   1486:               <dt><span class="sect1"><a href=
                   1487:               "#getting-started">4.1. Working with binary
                   1488:               packages</a></span></dt>
                   1489: 
                   1490:               <dd>
                   1491:                 <dl>
                   1492:                   <dt><span class="sect2"><a href=
1.30      wiz      1493:                   "#where-to-get-binary-packages">4.1.1. Where to
                   1494:                   get binary packages</a></span></dt>
1.1       grant    1495: 
                   1496:                   <dt><span class="sect2"><a href=
1.30      wiz      1497:                   "#how-to-use-binary-packages">4.1.2. How to use
                   1498:                   binary packages</a></span></dt>
1.1       grant    1499: 
                   1500:                   <dt><span class="sect2"><a href=
1.30      wiz      1501:                   "#a-word-of-warning">4.1.3. A word of
1.1       grant    1502:                   warning</a></span></dt>
                   1503:                 </dl>
                   1504:               </dd>
                   1505: 
1.30      wiz      1506:               <dt><span class="sect1"><a href=
                   1507:               "#building-packages-from-source">4.2. Building
                   1508:               packages from source</a></span></dt>
1.1       grant    1509: 
                   1510:               <dd>
                   1511:                 <dl>
                   1512:                   <dt><span class="sect2"><a href=
1.30      wiz      1513:                   "#requirements">4.2.1.
                   1514:                   Requirements</a></span></dt>
1.1       grant    1515: 
                   1516:                   <dt><span class="sect2"><a href=
1.30      wiz      1517:                   "#fetching-distfiles">4.2.2. Fetching
1.1       grant    1518:                   distfiles</a></span></dt>
                   1519: 
                   1520:                   <dt><span class="sect2"><a href=
1.30      wiz      1521:                   "#how-to-build-and-install">4.2.3. How to build
                   1522:                   and install</a></span></dt>
1.1       grant    1523: 
                   1524:                   <dt><span class="sect2"><a href=
1.30      wiz      1525:                   "#selecting-the-compiler">4.2.4. Selecting the
1.1       grant    1526:                   compiler</a></span></dt>
                   1527:                 </dl>
                   1528:               </dd>
                   1529:             </dl>
                   1530:           </dd>
                   1531: 
1.38      dillo    1532:           <dt><span class="chapter"><a href="#configuring">5.
                   1533:           Configuring pkgsrc</a></span></dt>
                   1534: 
                   1535:           <dd>
                   1536:             <dl>
                   1537:               <dt><span class="sect1"><a href=
1.45      wiz      1538:               "#general-configuration">5.1. General
                   1539:               configuration</a></span></dt>
                   1540: 
                   1541:               <dt><span class="sect1"><a href=
                   1542:               "#variables-affecting-build">5.2. Variables affecting
                   1543:               the build process</a></span></dt>
                   1544: 
                   1545:               <dt><span class="sect1"><a href=
                   1546:               "#developer-advanced-settings">5.3.
                   1547:               Developer/advanced settings</a></span></dt>
                   1548: 
                   1549:               <dt><span class="sect1"><a href=
                   1550:               "#selecting-build-options">5.4. Selecting Build
1.42      dillo    1551:               Options</a></span></dt>
1.38      dillo    1552:             </dl>
                   1553:           </dd>
                   1554: 
                   1555:           <dt><span class="chapter"><a href="#binary">6. Creating
1.1       grant    1556:           binary packages</a></span></dt>
                   1557: 
                   1558:           <dd>
                   1559:             <dl>
1.30      wiz      1560:               <dt><span class="sect1"><a href=
1.38      dillo    1561:               "#building-a-single-binary-package">6.1. Building a
1.30      wiz      1562:               single binary package</a></span></dt>
1.1       grant    1563: 
1.30      wiz      1564:               <dt><span class="sect1"><a href=
1.38      dillo    1565:               "#settings-for-creationg-of-binary-packages">6.2.
1.1       grant    1566:               Settings for creation of binary
                   1567:               packages</a></span></dt>
                   1568: 
1.38      dillo    1569:               <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1       grant    1570:               Doing a bulk build of all packages</a></span></dt>
                   1571: 
                   1572:               <dd>
                   1573:                 <dl>
                   1574:                   <dt><span class="sect2"><a href=
1.38      dillo    1575:                   "#binary.configuration">6.3.1.
1.1       grant    1576:                   Configuration</a></span></dt>
                   1577: 
                   1578:                   <dt><span class="sect2"><a href=
1.38      dillo    1579:                   "#other-environmental-considerations">6.3.2.
1.30      wiz      1580:                   Other environmental
1.1       grant    1581:                   considerations</a></span></dt>
                   1582: 
                   1583:                   <dt><span class="sect2"><a href=
1.38      dillo    1584:                   "#operation">6.3.3. Operation</a></span></dt>
1.1       grant    1585: 
                   1586:                   <dt><span class="sect2"><a href=
1.38      dillo    1587:                   "#what-it-does">6.3.4. What it
1.30      wiz      1588:                   does</a></span></dt>
1.1       grant    1589: 
                   1590:                   <dt><span class="sect2"><a href=
1.38      dillo    1591:                   "#disk-space-requirements">6.3.5. Disk space
1.1       grant    1592:                   requirements</a></span></dt>
                   1593: 
                   1594:                   <dt><span class="sect2"><a href=
1.38      dillo    1595:                   "#setting-up-a-sandbox">6.3.6. Setting up a
1.47      reed     1596:                   sandbox for chrooted builds</a></span></dt>
1.1       grant    1597: 
                   1598:                   <dt><span class="sect2"><a href=
1.38      dillo    1599:                   "#building-a-partial-set">6.3.7. Building a
1.30      wiz      1600:                   partial set of packages</a></span></dt>
1.13      hubertf  1601: 
                   1602:                   <dt><span class="sect2"><a href=
1.38      dillo    1603:                   "#bulk-upload">6.3.8. Uploading results of a bulk
1.13      hubertf  1604:                   build</a></span></dt>
1.1       grant    1605:                 </dl>
                   1606:               </dd>
                   1607: 
1.30      wiz      1608:               <dt><span class="sect1"><a href=
1.38      dillo    1609:               "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30      wiz      1610:               packages collection</a></span></dt>
1.1       grant    1611: 
                   1612:               <dd>
                   1613:                 <dl>
                   1614:                   <dt><span class="sect2"><a href=
1.38      dillo    1615:                   "#cdpack-example">6.4.1. Example of
1.1       grant    1616:                   cdpack</a></span></dt>
                   1617:                 </dl>
                   1618:               </dd>
                   1619:             </dl>
                   1620:           </dd>
                   1621: 
1.38      dillo    1622:           <dt><span class="chapter"><a href="#faq">7. Frequently
1.1       grant    1623:           Asked Questions</a></span></dt>
                   1624: 
                   1625:           <dd>
                   1626:             <dl>
1.30      wiz      1627:               <dt><span class="sect1"><a href=
1.38      dillo    1628:               "#mailing-list-pointers">7.1. Are there any mailing
1.30      wiz      1629:               lists for pkg-related discussion?</a></span></dt>
1.1       grant    1630: 
1.38      dillo    1631:               <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1       grant    1632:               Where's the pkgviews documentation?</a></span></dt>
                   1633: 
1.38      dillo    1634:               <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1       grant    1635:               Utilities for package management
                   1636:               (pkgtools)</a></span></dt>
                   1637: 
1.30      wiz      1638:               <dt><span class="sect1"><a href=
1.38      dillo    1639:               "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30      wiz      1640:               non-root</a></span></dt>
1.1       grant    1641: 
1.30      wiz      1642:               <dt><span class="sect1"><a href=
1.38      dillo    1643:               "#resume-transfers">7.5. How to resume transfers when
1.30      wiz      1644:               fetching distfiles?</a></span></dt>
1.14      xtraeme  1645: 
1.30      wiz      1646:               <dt><span class="sect1"><a href=
1.38      dillo    1647:               "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30      wiz      1648:               XFree86 from pkgsrc?</a></span></dt>
1.1       grant    1649: 
1.30      wiz      1650:               <dt><span class="sect1"><a href=
1.38      dillo    1651:               "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30      wiz      1652:               from pkgsrc?</a></span></dt>
1.1       grant    1653: 
1.30      wiz      1654:               <dt><span class="sect1"><a href=
1.38      dillo    1655:               "#fetch-behind-firewall">7.8. How to fetch files from
1.30      wiz      1656:               behind a firewall</a></span></dt>
1.1       grant    1657: 
1.38      dillo    1658:               <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.30      wiz      1659:               How do I tell <span><strong class="command">make
1.14      xtraeme  1660:               fetch</strong></span> to do passive
1.1       grant    1661:               FTP?</a></span></dt>
                   1662: 
1.30      wiz      1663:               <dt><span class="sect1"><a href=
1.38      dillo    1664:               "#fetching-all-distfiles">7.10. How to fetch all
1.30      wiz      1665:               distfiles at once</a></span></dt>
1.1       grant    1666: 
1.30      wiz      1667:               <dt><span class="sect1"><a href=
1.38      dillo    1668:               "#tmac.andoc-missing">7.11. What does
1.30      wiz      1669:               &#8220;<span class="quote">Don't know how to make
                   1670:               /usr/share/tmac/tmac.andoc</span>&#8221;
1.14      xtraeme  1671:               mean?</a></span></dt>
1.13      hubertf  1672: 
1.30      wiz      1673:               <dt><span class="sect1"><a href=
1.38      dillo    1674:               "#bsd.own.mk-missing">7.12. What does
1.30      wiz      1675:               &#8220;<span class="quote">Could not find
1.14      xtraeme  1676:               bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    1677: 
1.30      wiz      1678:               <dt><span class="sect1"><a href=
1.38      dillo    1679:               "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30      wiz      1680:               pkgsrc</a></span></dt>
1.1       grant    1681: 
1.38      dillo    1682:               <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35      jmmv     1683:               do I change the location of configuration
                   1684:               files?</a></span></dt>
1.1       grant    1685: 
                   1686:               <dt><span class="sect1"><a href=
1.38      dillo    1687:               "#audit-packages">7.15. Automated security
1.1       grant    1688:               checks</a></span></dt>
                   1689:             </dl>
                   1690:           </dd>
                   1691:         </dl>
                   1692:       </div>
                   1693: 
1.66    ! rillig   1694:       <div class="chapter" lang="en" xml:lang="en">
1.1       grant    1695:         <div class="titlepage">
                   1696:           <div>
                   1697:             <div>
1.66    ! rillig   1698:               <h2 class="title"><a name="getting" id=
1.1       grant    1699:               "getting"></a>Chapter&nbsp;2.&nbsp;Where to get
1.59      rillig   1700:               pkgsrc and how to keep it up-to-date</h2>
1.1       grant    1701:             </div>
                   1702:           </div>
                   1703:         </div>
                   1704: 
                   1705:         <div class="toc">
                   1706:           <p><b>Table of Contents</b></p>
                   1707: 
                   1708:           <dl>
1.30      wiz      1709:             <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1       grant    1710:             tar file</a></span></dt>
                   1711: 
1.30      wiz      1712:             <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1       grant    1713:             SUP</a></span></dt>
                   1714: 
1.30      wiz      1715:             <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1       grant    1716:             CVS</a></span></dt>
1.59      rillig   1717: 
                   1718:             <dt><span class="sect1"><a href="#uptodate-cvs">2.4.
                   1719:             Keeping pkgsrc up-to-date via CVS</a></span></dt>
1.1       grant    1720:           </dl>
                   1721:         </div>
                   1722: 
                   1723:         <p>There are three ways to get pkgsrc. Either as a tar
                   1724:         file, via SUP, or via CVS. All three ways are described
                   1725:         here.</p>
                   1726: 
1.66    ! rillig   1727:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    1728:           <div class="titlepage">
                   1729:             <div>
                   1730:               <div>
                   1731:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   1732:                 "as-tar-file" id="as-tar-file"></a>2.1.&nbsp;As tar
        !          1733:                 file</h2>
1.1       grant    1734:               </div>
                   1735:             </div>
                   1736:           </div>
                   1737: 
                   1738:           <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
                   1739:           file from <a href=
1.11      ben      1740:           "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20      ben      1741:           target="_top">ftp.NetBSD.org</a> and unpack it into
1.45      wiz      1742:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   1743:           class="filename">/usr/pkgsrc</code>.</p>
1.1       grant    1744:         </div>
                   1745: 
1.66    ! rillig   1746:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    1747:           <div class="titlepage">
                   1748:             <div>
                   1749:               <div>
                   1750:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   1751:                 "via-sup" id="via-sup"></a>2.2.&nbsp;Via SUP</h2>
1.1       grant    1752:               </div>
                   1753:             </div>
                   1754:           </div>
                   1755: 
                   1756:           <p>As an alternative to the tar file, you can get pkgsrc
                   1757:           via the Software Update Protocol, SUP. To do so, make
                   1758:           sure your supfile has a line</p>
                   1759:           <pre class="programlisting">
1.51      rillig   1760:     release=pkgsrc
1.1       grant    1761: </pre>
                   1762: 
1.45      wiz      1763:           <p>in it, see the examples in <code xmlns=
                   1764:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1765:           "filename">/usr/share/examples/supfiles</code>, and that
1.45      wiz      1766:           the <code xmlns=
                   1767:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1768:           "filename">/usr/pkgsrc</code> directory exists. Then,
                   1769:           simply run <span><strong class="command">sup -v
                   1770:           <em class="replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1       grant    1771:         </div>
                   1772: 
1.66    ! rillig   1773:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    1774:           <div class="titlepage">
                   1775:             <div>
                   1776:               <div>
                   1777:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   1778:                 "via-cvs" id="via-cvs"></a>2.3.&nbsp;Via CVS</h2>
1.1       grant    1779:               </div>
                   1780:             </div>
                   1781:           </div>
                   1782: 
                   1783:           <p>To get pkgsrc via CVS, make sure you have
                   1784:           &#8220;<span class="quote">cvs</span>&#8221; installed.
1.27      rillig   1785:           To do an initial (full) checkout of pkgsrc, do the
                   1786:           following steps:</p>
1.1       grant    1787:           <pre class="screen">
1.14      xtraeme  1788: <code class="prompt">%</code> <strong class=
                   1789: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
                   1790: <code class="prompt">%</code> <strong class=
                   1791: "userinput"><code>setenv CVS_RSH ssh</code></strong>
                   1792: <code class="prompt">%</code> <strong class=
                   1793: "userinput"><code>cd /usr</code></strong>
                   1794: <code class="prompt">%</code> <strong class=
                   1795: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
                   1796: </pre>
                   1797: 
1.45      wiz      1798:           <p>This will create the <code xmlns=
                   1799:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1800:           "filename">pkgsrc</code> directory in your <code xmlns=
                   1801:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1802:           "filename">/usr</code>, and all the package source will
1.45      wiz      1803:           be stored under <code xmlns=
                   1804:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1805:           "filename">/usr/pkgsrc</code>. To update pkgsrc after the
                   1806:           initial checkout, make sure you have <code class=
                   1807:           "varname">CVS_RSH</code> set as above, then do:</p>
1.1       grant    1808:           <pre class="screen">
1.14      xtraeme  1809: <code class="prompt">%</code> <strong class=
                   1810: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   1811: <code class="prompt">%</code> <strong class=
                   1812: "userinput"><code>cvs -q update -dP</code></strong>
1.1       grant    1813: </pre>
                   1814: 
                   1815:           <p>Please also note that it is possible to have multiple
                   1816:           copies of the pkgsrc hierarchy in use at any one time -
                   1817:           all work is done relatively within the pkgsrc tree.</p>
                   1818:         </div>
1.59      rillig   1819: 
1.66    ! rillig   1820:         <div class="sect1" lang="en" xml:lang="en">
1.59      rillig   1821:           <div class="titlepage">
                   1822:             <div>
                   1823:               <div>
                   1824:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   1825:                 "uptodate-cvs" id=
1.59      rillig   1826:                 "uptodate-cvs"></a>2.4.&nbsp;Keeping pkgsrc
                   1827:                 up-to-date via CVS</h2>
                   1828:               </div>
                   1829:             </div>
                   1830:           </div>
                   1831: 
                   1832:           <p>If your copy of pkgsrc contains a lot of <code xmlns=
                   1833:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1834:           "filename">CVS</code> directories, you can update it
                   1835:           using the <a href=
                   1836:           "http://netbsd.gw.com/cgi-bin/man-cgi?cvs+1+NetBSD-current">
                   1837:           <span class="citerefentry"><span class=
                   1838:           "refentrytitle">cvs</span>(1)</span></a> program. First,
                   1839:           <span><strong class="command">cd</strong></span> to the
                   1840:           top level directory of pkgsrc. Then run
                   1841:           <span><strong class="command">cvs -q update
                   1842:           -dP</strong></span>, and you're done.</p>
                   1843: 
                   1844:           <p>If that doesn't work and the file <code xmlns=
                   1845:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1846:           "filename">CVS/Root</code> contains the string
                   1847:           &#8220;<span class="quote">:pserver:</span>&#8221;, you
                   1848:           have to run <span><strong class="command">cvs
                   1849:           login</strong></span> once to get known to the NetBSD CVS
                   1850:           server. The <span><strong class=
                   1851:           "command">cvs</strong></span> utility will then ask you
                   1852:           for a password. Just enter &#8220;<span class=
                   1853:           "quote">anoncvs</span>&#8221;. Then try again to
                   1854:           update.</p>
                   1855:         </div>
1.1       grant    1856:       </div>
                   1857: 
1.66    ! rillig   1858:       <div class="chapter" lang="en" xml:lang="en">
1.1       grant    1859:         <div class="titlepage">
                   1860:           <div>
                   1861:             <div>
1.66    ! rillig   1862:               <h2 class="title"><a name="platforms" id=
1.1       grant    1863:               "platforms"></a>Chapter&nbsp;3.&nbsp;Using pkgsrc on
                   1864:               systems other than NetBSD</h2>
                   1865:             </div>
                   1866:           </div>
                   1867:         </div>
                   1868: 
                   1869:         <div class="toc">
                   1870:           <p><b>Table of Contents</b></p>
                   1871: 
                   1872:           <dl>
1.30      wiz      1873:             <dt><span class="sect1"><a href=
                   1874:             "#bootstrapping-pkgsrc">3.1. Bootstrapping
                   1875:             pkgsrc</a></span></dt>
1.1       grant    1876: 
1.30      wiz      1877:             <dt><span class="sect1"><a href=
1.47      reed     1878:             "#platform-specific-notes">3.2. Platform-specific
1.30      wiz      1879:             notes</a></span></dt>
1.1       grant    1880: 
                   1881:             <dd>
                   1882:               <dl>
1.30      wiz      1883:                 <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1       grant    1884:                 Darwin (Mac OS X)</a></span></dt>
                   1885: 
1.30      wiz      1886:                 <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1       grant    1887:                 FreeBSD</a></span></dt>
                   1888: 
1.30      wiz      1889:                 <dt><span class="sect2"><a href="#interix">3.2.3.
1.1       grant    1890:                 Interix</a></span></dt>
                   1891: 
1.30      wiz      1892:                 <dt><span class="sect2"><a href="#irix">3.2.4.
1.1       grant    1893:                 IRIX</a></span></dt>
                   1894: 
1.30      wiz      1895:                 <dt><span class="sect2"><a href="#linux">3.2.5.
1.22      tv       1896:                 Linux</a></span></dt>
                   1897: 
1.30      wiz      1898:                 <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1       grant    1899:                 OpenBSD</a></span></dt>
                   1900: 
1.30      wiz      1901:                 <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1       grant    1902:                 Solaris</a></span></dt>
                   1903:               </dl>
                   1904:             </dd>
                   1905:           </dl>
                   1906:         </div>
                   1907: 
1.66    ! rillig   1908:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    1909:           <div class="titlepage">
                   1910:             <div>
                   1911:               <div>
                   1912:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   1913:                 "bootstrapping-pkgsrc" id=
1.30      wiz      1914:                 "bootstrapping-pkgsrc"></a>3.1.&nbsp;Bootstrapping
                   1915:                 pkgsrc</h2>
1.1       grant    1916:               </div>
                   1917:             </div>
                   1918:           </div>
                   1919: 
1.27      rillig   1920:           <p>For operating systems other than NetBSD, we provide a
1.1       grant    1921:           bootstrap kit to build the required tools to use pkgsrc
                   1922:           on your platform. Besides support for native NetBSD,
                   1923:           pkgsrc and the bootstrap kit have support for the
                   1924:           following operating systems:</p>
                   1925: 
                   1926:           <div class="itemizedlist">
                   1927:             <ul type="disc">
                   1928:               <li>
                   1929:                 <p>Darwin (Mac OS X)</p>
                   1930:               </li>
                   1931: 
                   1932:               <li>
1.16      grant    1933:                 <p>DragonFlyBSD</p>
                   1934:               </li>
                   1935: 
                   1936:               <li>
1.1       grant    1937:                 <p>FreeBSD</p>
                   1938:               </li>
                   1939: 
                   1940:               <li>
                   1941:                 <p>Interix (Windows 2000, XP, 2003)</p>
                   1942:               </li>
                   1943: 
                   1944:               <li>
                   1945:                 <p>IRIX</p>
                   1946:               </li>
                   1947: 
                   1948:               <li>
                   1949:                 <p>Linux</p>
                   1950:               </li>
                   1951: 
                   1952:               <li>
                   1953:                 <p>OpenBSD</p>
                   1954:               </li>
                   1955: 
                   1956:               <li>
                   1957:                 <p>Solaris</p>
                   1958:               </li>
1.16      grant    1959: 
                   1960:               <li>
                   1961:                 <p>Tru64 (Digital UNIX/OSF1)</p>
                   1962:               </li>
1.1       grant    1963:             </ul>
                   1964:           </div>
                   1965: 
                   1966:           <p>Support for other platforms is under development.</p>
                   1967: 
                   1968:           <p>Installing the bootstrap kit should be as simple
                   1969:           as:</p>
                   1970:           <pre class="screen">
1.14      xtraeme  1971: <code class="prompt">#</code> <strong class=
                   1972: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
                   1973: <code class="prompt">#</code> <strong class=
                   1974: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1975: <code class="prompt">#</code> <strong class=
                   1976: "userinput"><code>./bootstrap</code></strong>
1.1       grant    1977: </pre>
                   1978: 
                   1979:           <p>See <a href="#getting" title=
1.59      rillig   1980:           "Chapter&nbsp;2.&nbsp;Where to get pkgsrc and how to keep it up-to-date">
1.66    ! rillig   1981:           Chapter 2, <i>Where to get pkgsrc and how to keep it
1.59      rillig   1982:           up-to-date</i></a> for other ways to get pkgsrc before
                   1983:           bootstrapping. The given <span><strong class=
                   1984:           "command">bootstrap</strong></span> command will use the
                   1985:           defaults of <code xmlns=
1.45      wiz      1986:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1987:           "filename">/usr/pkg</code> for the <span class=
                   1988:           "emphasis"><em>prefix</em></span> where programs will be
1.45      wiz      1989:           installed in, and <code xmlns=
                   1990:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1991:           "filename">/var/db/pkg</code> for the package database
1.27      rillig   1992:           directory where pkgsrc will do its internal bookkeeping.
1.1       grant    1993:           However, these can also be set using command-line
1.27      rillig   1994:           arguments.</p>
1.1       grant    1995: 
                   1996:           <p>Binary packages for the pkgsrc tools and an initial
                   1997:           set of packages is available for supported platforms. An
                   1998:           up-to-date list of these can be found on <a href=
                   1999:           "http://www.pkgsrc.org/" target=
1.63      dillo    2000:           "_top">www.pkgsrc.org</a>. Note that this only works for
                   2001:           privileged builds that install into <code xmlns=
                   2002:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   2003:           "filename">/usr/pkg</code>.</p>
1.47      reed     2004: 
                   2005:           <div class="note" style=
                   2006:           "margin-left: 0.5in; margin-right: 0.5in;">
                   2007:             <h3 class="title">Note</h3>
                   2008: 
                   2009:             <p>The bootstrap installs a <span><strong class=
                   2010:             "command">bmake</strong></span> tool. Use this
                   2011:             <span><strong class="command">bmake</strong></span>
                   2012:             when building via pkgsrc. For examples in this guide,
                   2013:             use <span><strong class="command">bmake</strong></span>
                   2014:             instead of &#8220;<span class=
                   2015:             "quote">make</span>&#8221;.</p>
                   2016:           </div>
1.1       grant    2017:         </div>
                   2018: 
1.66    ! rillig   2019:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    2020:           <div class="titlepage">
                   2021:             <div>
                   2022:               <div>
                   2023:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   2024:                 "platform-specific-notes" id=
1.47      reed     2025:                 "platform-specific-notes"></a>3.2.&nbsp;Platform-specific
                   2026:                 notes</h2>
1.1       grant    2027:               </div>
                   2028:             </div>
                   2029:           </div>
                   2030: 
                   2031:           <p>Here are some platform-specific notes you should be
                   2032:           aware of.</p>
                   2033: 
1.66    ! rillig   2034:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    2035:             <div class="titlepage">
                   2036:               <div>
                   2037:                 <div>
1.66    ! rillig   2038:                   <h3 class="title"><a name="darwin" id=
1.30      wiz      2039:                   "darwin"></a>3.2.1.&nbsp;Darwin (Mac OS X)</h3>
1.1       grant    2040:                 </div>
                   2041:               </div>
                   2042:             </div>
                   2043: 
                   2044:             <p>Darwin 5.x and 6.x are supported. There are two
                   2045:             methods of using pkgsrc on Mac OS X, by using a
                   2046:             <a href="#platform.osx-image" title=
                   2047:             "3.2.1.1.&nbsp;Using a disk image">disk image</a>, or a
                   2048:             <a href="#platform.osx-ufs" title=
                   2049:             "3.2.1.2.&nbsp;Using a UFS partition">UFS
                   2050:             partition</a>.</p>
                   2051: 
                   2052:             <p>Before you start, you will need to download and
                   2053:             install the Mac OS X Developer Tools from Apple's
                   2054:             Developer Connection. See <a href=
                   2055:             "http://developer.apple.com/macosx/" target=
                   2056:             "_top">http://developer.apple.com/macosx/</a> for
                   2057:             details. Also, make sure you install X11 for Mac OS X
                   2058:             and the X11 SDK from <a href=
                   2059:             "http://www.apple.com/macosx/x11/download/" target=
                   2060:             "_top">http://www.apple.com/macosx/x11/download/</a> if
                   2061:             you intend to build packages that use the X11 Window
                   2062:             System.</p>
                   2063: 
                   2064:             <p>If you already have a UFS partition, or have a spare
                   2065:             partition that you can format as UFS, it is recommended
                   2066:             to use that instead of the disk image. It'll be
                   2067:             somewhat faster and will mount automatically at boot
                   2068:             time, where you must manually mount a disk image.</p>
                   2069: 
                   2070:             <div class="note" style=
                   2071:             "margin-left: 0.5in; margin-right: 0.5in;">
                   2072:               <h3 class="title">Note</h3>
                   2073: 
                   2074:               <p>You cannot use a HFS+ file system for pkgsrc,
1.47      reed     2075:               because pkgsrc currently requires the file system to
1.1       grant    2076:               be case-sensitive, and HFS+ is not.</p>
                   2077:             </div>
                   2078: 
1.66    ! rillig   2079:             <div class="sect3" lang="en" xml:lang="en">
1.1       grant    2080:               <div class="titlepage">
                   2081:                 <div>
                   2082:                   <div>
1.66    ! rillig   2083:                     <h4 class="title"><a name="platform.osx-image"
        !          2084:                     id="platform.osx-image"></a>3.2.1.1.&nbsp;Using
        !          2085:                     a disk image</h4>
1.1       grant    2086:                   </div>
                   2087:                 </div>
                   2088:               </div>
                   2089: 
                   2090:               <p>Create the disk image:</p>
                   2091:               <pre class="screen">
1.14      xtraeme  2092: <code class="prompt">#</code> <strong class=
                   2093: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   2094: <code class="prompt">#</code> <strong class=
                   2095: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
                   2096: <code class="prompt">#</code> <strong class=
                   2097: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
                   2098: <code class="prompt">#</code> <strong class=
                   2099: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1       grant    2100: </pre>
                   2101: 
                   2102:               <p>That's it!</p>
                   2103:             </div>
                   2104: 
1.66    ! rillig   2105:             <div class="sect3" lang="en" xml:lang="en">
1.1       grant    2106:               <div class="titlepage">
                   2107:                 <div>
                   2108:                   <div>
1.66    ! rillig   2109:                     <h4 class="title"><a name="platform.osx-ufs"
        !          2110:                     id="platform.osx-ufs"></a>3.2.1.2.&nbsp;Using a
1.1       grant    2111:                     UFS partition</h4>
                   2112:                   </div>
                   2113:                 </div>
                   2114:               </div>
                   2115: 
1.45      wiz      2116:               <p>By default, <code xmlns=
                   2117:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   2118:               "filename">/usr</code> will be on your root file
                   2119:               system, normally HFS+. It is possible to use the
                   2120:               default <span class="emphasis"><em>prefix</em></span>
                   2121:               of <code xmlns=
                   2122:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   2123:               "filename">/usr/pkg</code> by symlinking <code xmlns=
                   2124:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2125:               "filename">/usr/pkg</code> to a directory on a UFS
                   2126:               file system. Obviously, another symlink is required
                   2127:               if you want to place the package database directory
                   2128:               outside the <span class=
                   2129:               "emphasis"><em>prefix</em></span>. e.g.</p>
1.1       grant    2130:               <pre class="screen">
1.14      xtraeme  2131: <code class="prompt">#</code> <strong class=
1.59      rillig   2132: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb</code></strong>
1.1       grant    2133: </pre>
                   2134: 
                   2135:               <p>If you created your partitions at the time of
                   2136:               installing Mac OS X and formatted the target
                   2137:               partition as UFS, it should automatically mount on
1.45      wiz      2138:               <code xmlns=
                   2139:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   2140:               "filename">/Volumes/&lt;volume name&gt;</code> when
                   2141:               the machine boots. If you are (re)formatting a
                   2142:               partition as UFS, you need to ensure that the
                   2143:               partition map correctly reflects &#8220;<span class=
                   2144:               "quote">Apple_UFS</span>&#8221; and not
                   2145:               &#8220;<span class=
1.1       grant    2146:               "quote">Apple_HFS</span>&#8221;.</p>
                   2147: 
                   2148:               <p>The problem is that none of the disk tools will
                   2149:               let you touch a disk that is booted from. You can
                   2150:               unmount the partition, but even if you newfs it, the
                   2151:               partition type will be incorrect and the automounter
                   2152:               won't mount it. It can be mounted manually, but it
                   2153:               won't appear in Finder.</p>
                   2154: 
                   2155:               <p>You'll need to boot off of the OS X Installation
                   2156:               (User) CD. When the Installation program starts, go
                   2157:               up to the menu and select Disk Utility. Now, you will
                   2158:               be able to select the partition you want to be UFS,
                   2159:               and Format it Apple UFS. Quit the Disk Utility, quit
                   2160:               the installer which will reboot your machine. The new
                   2161:               UFS file system will appear in Finder.</p>
                   2162: 
                   2163:               <p>Be aware that the permissions on the new file
                   2164:               system will be writable by root only.</p>
                   2165: 
                   2166:               <p>This note is as of 10.2 (Jaguar) and applies to
                   2167:               earlier versions. Hopefully Apple will fix Disk
                   2168:               Utility in 10.3 (Panther).</p>
                   2169:             </div>
                   2170:           </div>
                   2171: 
1.66    ! rillig   2172:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    2173:             <div class="titlepage">
                   2174:               <div>
                   2175:                 <div>
1.66    ! rillig   2176:                   <h3 class="title"><a name="freebsd" id=
1.30      wiz      2177:                   "freebsd"></a>3.2.2.&nbsp;FreeBSD</h3>
1.1       grant    2178:                 </div>
                   2179:               </div>
                   2180:             </div>
                   2181: 
                   2182:             <p>FreeBSD 4.7 and 5.0 have been tested and are
                   2183:             supported, other versions may work.</p>
                   2184: 
                   2185:             <p>Care should be taken so that the tools that this kit
                   2186:             installs do not conflict with the FreeBSD userland
                   2187:             tools. There are several steps:</p>
                   2188: 
                   2189:             <div class="orderedlist">
                   2190:               <ol type="1">
                   2191:                 <li>
                   2192:                   <p>FreeBSD stores its ports pkg database in
1.45      wiz      2193:                   <code xmlns=
                   2194:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   2195:                   "filename">/var/db/pkg</code>. It is therefore
                   2196:                   recommended that you choose a different location
                   2197:                   (e.g. <code xmlns=
                   2198:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2199:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2200:                   --pkgdbdir option to the bootstrap script.</p>
                   2201:                 </li>
                   2202: 
                   2203:                 <li>
                   2204:                   <p>If you do not intend to use the FreeBSD ports
                   2205:                   tools, it's probably a good idea to move them out
                   2206:                   of the way to avoid confusion, e.g.</p>
                   2207:                   <pre class="screen">
1.14      xtraeme  2208: <code class="prompt">#</code> <strong class=
                   2209: "userinput"><code>cd /usr/sbin</code></strong>
                   2210: <code class="prompt">#</code> <strong class=
                   2211: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2212: <code class="prompt">#</code> <strong class=
                   2213: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2214: <code class="prompt">#</code> <strong class=
                   2215: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2216: <code class="prompt">#</code> <strong class=
                   2217: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2218: </pre>
                   2219:                 </li>
                   2220: 
                   2221:                 <li>
1.45      wiz      2222:                   <p>An example <code xmlns=
                   2223:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2224:                   "filename">/etc/mk.conf</code> file will be
1.45      wiz      2225:                   placed in <code xmlns=
                   2226:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2227:                   "filename">/etc/mk.conf.example</code> file when
                   2228:                   you use the bootstrap script.</p>
1.1       grant    2229:                 </li>
                   2230:               </ol>
                   2231:             </div>
                   2232:           </div>
                   2233: 
1.66    ! rillig   2234:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    2235:             <div class="titlepage">
                   2236:               <div>
                   2237:                 <div>
1.66    ! rillig   2238:                   <h3 class="title"><a name="interix" id=
1.30      wiz      2239:                   "interix"></a>3.2.3.&nbsp;Interix</h3>
1.1       grant    2240:                 </div>
                   2241:               </div>
                   2242:             </div>
                   2243: 
1.47      reed     2244:             <p>Interix is a POSIX-compatible subsystem for the
1.1       grant    2245:             Windows NT kernel, providing a Unix-like environment
                   2246:             with a tighter kernel integration than available with
                   2247:             Cygwin. It is part of the Windows Services for Unix
                   2248:             package, available for free for any licensed copy of
1.22      tv       2249:             Windows 2000, XP (not including XP Home), or 2003. SFU
                   2250:             can be downloaded from <a href=
                   2251:             "http://www.microsoft.com/windows/sfu/" target=
1.1       grant    2252:             "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
                   2253: 
                   2254:             <p>Services for Unix 3.5, current as of this writing,
                   2255:             has been tested. 3.0 or 3.1 may work, but are not
                   2256:             officially supported. (The main difference in 3.0/3.1
                   2257:             is lack of pthreads.)</p>
                   2258: 
1.66    ! rillig   2259:             <div class="sect3" lang="en" xml:lang="en">
1.1       grant    2260:               <div class="titlepage">
                   2261:                 <div>
                   2262:                   <div>
                   2263:                     <h4 class="title"><a name=
1.66    ! rillig   2264:                     "platform.interix-sfu-install" id=
1.1       grant    2265:                     "platform.interix-sfu-install"></a>3.2.3.1.&nbsp;When
1.2       hubertf  2266:                     installing Interix/SFU</h4>
1.1       grant    2267:                   </div>
                   2268:                 </div>
                   2269:               </div>
                   2270: 
                   2271:               <p>At an absolute minimum, the following packages
                   2272:               must be installed from the Windows Services for Unix
                   2273:               3.5 distribution in order to use pkgsrc:</p>
                   2274: 
                   2275:               <div class="itemizedlist">
                   2276:                 <ul type="disc">
                   2277:                   <li>
                   2278:                     <p>Utilities -&gt; Base Utilities</p>
                   2279:                   </li>
                   2280: 
                   2281:                   <li>
                   2282:                     <p>Interix GNU Components -&gt; (all)</p>
                   2283:                   </li>
                   2284: 
                   2285:                   <li>
                   2286:                     <p>Remote Connectivity</p>
                   2287:                   </li>
                   2288: 
                   2289:                   <li>
                   2290:                     <p>Interix SDK</p>
                   2291:                   </li>
                   2292:                 </ul>
                   2293:               </div>
                   2294: 
                   2295:               <p>When using pkgsrc on Interix, DO NOT install the
                   2296:               Utilities subcomponent "UNIX Perl". That is Perl 5.6
                   2297:               without shared module support, installed to
                   2298:               /usr/local, and will only cause confusion. Instead,
                   2299:               install Perl 5.8 from pkgsrc (or from a binary
                   2300:               package).</p>
                   2301: 
                   2302:               <p>The Remote Connectivity subcomponent "Windows
                   2303:               Remote Shell Service" does not need to be installed,
                   2304:               but Remote Connectivity itself should be installed in
                   2305:               order to have a working inetd.</p>
                   2306: 
1.52      tv       2307:               <p>During installation you may be asked whether to
                   2308:               enable setuid behavior for Interix programs, and
                   2309:               whether to make pathnames default to case-sensitive.
                   2310:               Setuid should be enabled, and case-sensitivity MUST
                   2311:               be enabled. (Without case-sensitivity, a large number
                   2312:               of packages including perl will not build.)</p>
                   2313: 
                   2314:               <p>NOTE: Newer Windows service packs change the way
                   2315:               binary execution works (via the Data Execution
                   2316:               Prevention feature). In order to use pkgsrc and other
                   2317:               gcc-compiled binaries reliably, a hotfix containing
                   2318:               POSIX.EXE, PSXDLL.DLL, PSXRUN.EXE, and PSXSS.EXE
                   2319:               (899522 or newer) must be installed. Hotfixes are
                   2320:               available from Microsoft through a support contract;
                   2321:               however, a NetBSD developer has made most Interix
                   2322:               hotfixes available for personal use from <a href=
                   2323:               "http://www.duh.org/interix/hotfixes.php" target=
                   2324:               "_top">http://www.duh.org/interix/hotfixes.php</a>.</p>
1.1       grant    2325:             </div>
                   2326: 
1.66    ! rillig   2327:             <div class="sect3" lang="en" xml:lang="en">
1.1       grant    2328:               <div class="titlepage">
                   2329:                 <div>
                   2330:                   <div>
                   2331:                     <h4 class="title"><a name=
1.66    ! rillig   2332:                     "platform.interix-sfu-postinstall" id=
1.1       grant    2333:                     "platform.interix-sfu-postinstall"></a>3.2.3.2.&nbsp;What
                   2334:                     to do if Interix/SFU is already installed</h4>
                   2335:                   </div>
                   2336:                 </div>
                   2337:               </div>
                   2338: 
                   2339:               <p>If SFU is already installed and you wish to alter
                   2340:               these settings to work with pkgsrc, note the
                   2341:               following things.</p>
                   2342: 
                   2343:               <div class="itemizedlist">
                   2344:                 <ul type="disc">
                   2345:                   <li>
                   2346:                     <p>To uninstall UNIX Perl, use Add/Remove
                   2347:                     Programs, select Microsoft Windows Services for
                   2348:                     UNIX, then click Change. In the installer,
                   2349:                     choose Add or Remove, then uncheck
                   2350:                     Utilities-&gt;UNIX Perl.</p>
                   2351:                   </li>
                   2352: 
                   2353:                   <li>
1.47      reed     2354:                     <p>To enable case-sensitivity for the file
                   2355:                     system, run REGEDIT.EXE, and change the
1.1       grant    2356:                     following registry key:</p>
                   2357: 
                   2358:                     <p>
                   2359:                     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
                   2360:                     Manager\kernel</p>
                   2361: 
                   2362:                     <p>Set the DWORD value "obcaseinsensitive" to
                   2363:                     0; then reboot.</p>
                   2364:                   </li>
                   2365: 
                   2366:                   <li>
                   2367:                     <p>To enable setuid binaries (optional), run
                   2368:                     REGEDIT.EXE, and change the following registry
                   2369:                     key:</p>
                   2370: 
                   2371:                     <p>
                   2372:                     HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
                   2373:                     for UNIX</p>
                   2374: 
                   2375:                     <p>Set the DWORD value "EnableSetuidBinaries"
                   2376:                     to 1; then reboot.</p>
                   2377:                   </li>
                   2378:                 </ul>
                   2379:               </div>
                   2380:             </div>
                   2381: 
1.66    ! rillig   2382:             <div class="sect3" lang="en" xml:lang="en">
1.1       grant    2383:               <div class="titlepage">
                   2384:                 <div>
                   2385:                   <div>
                   2386:                     <h4 class="title"><a name=
1.66    ! rillig   2387:                     "platform.interix-notes" id=
1.1       grant    2388:                     "platform.interix-notes"></a>3.2.3.3.&nbsp;Important
                   2389:                     notes for using pkgsrc</h4>
                   2390:                   </div>
                   2391:                 </div>
                   2392:               </div>
                   2393: 
1.52      tv       2394:               <p>The package manager (either the pkgsrc "su" user,
1.1       grant    2395:               or the user running "pkg_add") must be a member of
                   2396:               the local Administrators group. Such a user must also
                   2397:               be used to run the bootstrap. This is slightly
                   2398:               relaxed from the normal pkgsrc requirement of
                   2399:               "root".</p>
                   2400: 
                   2401:               <p>The package manager should use a umask of 002.
                   2402:               "make install" will automatically complain if this is
                   2403:               not the case. This ensures that directories written
                   2404:               in /var/db/pkg are Administrators-group
                   2405:               writeable.</p>
                   2406: 
                   2407:               <p>The popular Interix binary packages from
                   2408:               http://www.interopsystems.com/ use an older version
                   2409:               of pkgsrc's pkg_* tools. Ideally, these should NOT be
                   2410:               used in conjunction with pkgsrc. If you choose to use
                   2411:               them at the same time as the pkgsrc packages, ensure
                   2412:               that you use the proper pkg_* tools for each type of
                   2413:               binary package.</p>
1.22      tv       2414: 
                   2415:               <p>The TERM setting used for DOS-type console windows
                   2416:               (including those invoked by the csh and ksh startup
                   2417:               shortcuts) is "interix". Most systems don't have a
                   2418:               termcap/terminfo entry for it, but the following
                   2419:               .termcap entry provides adequate emulation in most
                   2420:               cases:</p>
                   2421:               <pre class="programlisting">
1.51      rillig   2422:     interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
1.22      tv       2423: </pre>
1.1       grant    2424:             </div>
1.52      tv       2425: 
1.66    ! rillig   2426:             <div class="sect3" lang="en" xml:lang="en">
1.52      tv       2427:               <div class="titlepage">
                   2428:                 <div>
                   2429:                   <div>
                   2430:                     <h4 class="title"><a name=
1.66    ! rillig   2431:                     "platform.interix-limits" id=
1.52      tv       2432:                     "platform.interix-limits"></a>3.2.3.4.&nbsp;Limitations
                   2433:                     of the Interix platform</h4>
                   2434:                   </div>
                   2435:                 </div>
                   2436:               </div>
                   2437: 
                   2438:               <p>Though Interix suffices as a familiar and flexible
                   2439:               substitute for a full Unix-like platform, it has some
                   2440:               drawbacks that should be noted for those desiring to
                   2441:               make the most of Interix.</p>
                   2442: 
                   2443:               <div class="itemizedlist">
                   2444:                 <ul type="disc">
                   2445:                   <li>
1.54      tv       2446:                     <p><span class=
1.57      minskim  2447:                     "strong"><strong>X11:</strong></span></p>
1.52      tv       2448: 
                   2449:                     <p>Interix comes with the standard set of X11R6
1.57      minskim  2450:                     client libraries, and can run X11 based
1.52      tv       2451:                     applications, but it does <span class=
                   2452:                     "emphasis"><em>not</em></span> come with an X
                   2453:                     server. Some options are <a href=
                   2454:                     "http://www.starnet.com/products/xwin32/"
                   2455:                     target="_top">StarNet X-Win32</a>, <a href=
                   2456:                     "http://connectivity.hummingbird.com/products/nc/exceed/"
1.57      minskim  2457:                     target="_top">Hummingbird Exceed</a> (available
                   2458:                     in a trimmed version for Interix from Interop
                   2459:                     Systems as the <a href=
                   2460:                     "http://www.interopsystems.com/InteropXserver.htm"
                   2461:                     target="_top">Interop X Server</a>), and the
                   2462:                     free X11 server included with <a href=
1.52      tv       2463:                     "http://x.cygwin.com/" target=
                   2464:                     "_top">Cygwin</a>.</p>
                   2465: 
                   2466:                     <p>Also, StarNet Communications has graciously
                   2467:                     provided a free version of their X-Win32
                   2468:                     product that accepts connections only from
                   2469:                     localhost: <a href=
                   2470:                     "http://www.starnet.com/xwin32LX/get_xwin32LX.htm"
                   2471:                     target="_top">X-Win32 LX</a>, recommended by
                   2472:                     the maintainer of Interix pkgsrc support.</p>
                   2473:                   </li>
                   2474: 
                   2475:                   <li>
1.57      minskim  2476:                     <p><span class="strong"><strong>X11
1.54      tv       2477:                     acceleration:</strong></span></p>
1.52      tv       2478: 
                   2479:                     <p>Because Interix runs in a completely
                   2480:                     different NT subsystem from Win32 applications,
                   2481:                     it does not currently support various X11
                   2482:                     protocol extensions for acceleration (such as
                   2483:                     MIT-SHM or DGA). Most interactive applications
                   2484:                     to a local X server will run reasonably fast,
                   2485:                     but full motion video and other graphics
                   2486:                     intensive applications may require a
                   2487:                     faster-than-expected CPU.</p>
                   2488:                   </li>
                   2489: 
                   2490:                   <li>
1.54      tv       2491:                     <p><span class=
                   2492:                     "strong"><strong>Audio:</strong></span></p>
1.52      tv       2493: 
                   2494:                     <p>Interix has no native support for audio
1.53      tv       2495:                     output. For audio support, pkgsrc uses the
                   2496:                     <span><strong class=
1.52      tv       2497:                     "command">esound</strong></span> client/server
                   2498:                     audio system on Interix. Unlike on most
                   2499:                     platforms, the <a xmlns=
                   2500:                     "http://www.w3.org/TR/xhtml1/transitional"
                   2501:                     href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/esound/README.html"
                   2502:                     target="_top"><code xmlns="" class=
                   2503:                     "filename">audio/esound</code></a> package does
                   2504:                     <span class="emphasis"><em>not</em></span>
                   2505:                     contain the <span><strong class=
1.53      tv       2506:                     "command">esd</strong></span> server component.
                   2507:                     To output audio via an Interix host, the
                   2508:                     <a xmlns=
1.52      tv       2509:                     "http://www.w3.org/TR/xhtml1/transitional"
                   2510:                     href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/cygwin_esound/README.html"
                   2511:                     target="_top"><code xmlns="" class=
                   2512:                     "filename">emulators/cygwin_esound</code></a>
                   2513:                     package must also be installed.</p>
                   2514:                   </li>
                   2515: 
                   2516:                   <li>
1.54      tv       2517:                     <p><span class="strong"><strong>CD/DVDs, USB,
                   2518:                     and SCSI:</strong></span></p>
1.52      tv       2519: 
                   2520:                     <p>Direct device access is not currently
                   2521:                     supported in Interix, so it is not currently
                   2522:                     possible to access CD/DVD drives, USB devices,
                   2523:                     or SCSI devices through non-filesystem means.
                   2524:                     Among other things, this makes it impossible to
                   2525:                     use Interix directly for CD/DVD burning.</p>
                   2526:                   </li>
                   2527: 
                   2528:                   <li>
1.54      tv       2529:                     <p><span class="strong"><strong>Tape
                   2530:                     drives:</strong></span></p>
1.52      tv       2531: 
                   2532:                     <p>Due to the same limitations as for CD-ROMs
                   2533:                     and SCSI devices, tape drives are also not
                   2534:                     directly accessible in Interix. However,
                   2535:                     support is in work to make tape drive access
                   2536:                     possible by using Cygwin as a bridge (similarly
                   2537:                     to audio bridged via Cygwin's esound
                   2538:                     server).</p>
                   2539:                   </li>
                   2540:                 </ul>
                   2541:               </div>
                   2542:             </div>
                   2543: 
1.66    ! rillig   2544:             <div class="sect3" lang="en" xml:lang="en">
1.52      tv       2545:               <div class="titlepage">
                   2546:                 <div>
                   2547:                   <div>
                   2548:                     <h4 class="title"><a name=
1.66    ! rillig   2549:                     "platform.interix-knownissues" id=
1.52      tv       2550:                     "platform.interix-knownissues"></a>3.2.3.5.&nbsp;Known
                   2551:                     issues for pkgsrc on Interix</h4>
                   2552:                   </div>
                   2553:                 </div>
                   2554:               </div>
                   2555: 
                   2556:               <p>It is not necessary, in general, to have a "root"
                   2557:               user on the Windows system; any member of the local
                   2558:               Administrators group will suffice. However, some
                   2559:               packages currently assume that the user named "root"
                   2560:               is the privileged user. To accommodate these, you may
                   2561:               create such a user; make sure it is in the local
                   2562:               group Administrators (or your language
                   2563:               equivalent).</p>
                   2564: 
                   2565:               <p>"pkg_add" creates directories of mode 0755, not
                   2566:               0775, in $PKG_DBDIR. For the time being, install
                   2567:               packages as the local Administrator (or your language
                   2568:               equivalent), or run the following command after
                   2569:               installing a package to work around the issue:</p>
                   2570:               <pre class="screen">
                   2571: <code class="prompt">#</code> <strong class=
                   2572: "userinput"><code>chmod -R g+w $PKG_DBDIR</code></strong>
                   2573: </pre>
                   2574:             </div>
1.1       grant    2575:           </div>
                   2576: 
1.66    ! rillig   2577:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    2578:             <div class="titlepage">
                   2579:               <div>
                   2580:                 <div>
1.66    ! rillig   2581:                   <h3 class="title"><a name="irix" id=
1.30      wiz      2582:                   "irix"></a>3.2.4.&nbsp;IRIX</h3>
1.1       grant    2583:                 </div>
                   2584:               </div>
                   2585:             </div>
                   2586: 
                   2587:             <p>You will need a working C compiler, either gcc or
                   2588:             SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14      xtraeme  2589:             the <code class="varname">CC</code> environment
                   2590:             variable according to your preference. If you do not
                   2591:             have a license for the MIPSpro compiler suite, you can
1.1       grant    2592:             download a gcc tardist file from <a href=
                   2593:             "http://freeware.sgi.com/" target=
                   2594:             "_top">http://freeware.sgi.com/</a>.</p>
                   2595: 
                   2596:             <p>Please note that you will need IRIX 6.5.17 or
                   2597:             higher, as this is the earliest version of IRIX
1.24      wiz      2598:             providing support for <a href=
                   2599:             "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
                   2600:             <span class="citerefentry"><span class=
                   2601:             "refentrytitle">if_indextoname</span>(3)</span></a>,
                   2602:             <a href=
                   2603:             "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
                   2604:             <span class="citerefentry"><span class=
                   2605:             "refentrytitle">if_nametoindex</span>(3)</span></a>,
                   2606:             etc.</p>
1.1       grant    2607: 
1.27      rillig   2608:             <p>At this point in time, pkgsrc only supports one ABI
                   2609:             at a time. That is, you can not switch between the old
                   2610:             32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
                   2611:             you start out using "abi=n32", that's what all your
                   2612:             packages will be built with.</p>
1.1       grant    2613: 
                   2614:             <p>Therefore, please make sure that you have no
1.14      xtraeme  2615:             conflicting <code class="varname">CFLAGS</code> in your
1.45      wiz      2616:             environment or the <code xmlns=
                   2617:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2618:             "filename">/etc/mk.conf</code>. Particularly, make sure
1.1       grant    2619:             that you do not try to link n32 object files with lib64
1.45      wiz      2620:             or vice versa. Check your <code xmlns=
                   2621:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2622:             "filename">/etc/compiler.defaults</code>!</p>
1.1       grant    2623: 
                   2624:             <p>If you have the actual pkgsrc tree mounted via NFS
                   2625:             from a different host, please make sure to set
1.14      xtraeme  2626:             <code class="varname">WRKOBJDIR</code> to a local
1.1       grant    2627:             directory, as it appears that IRIX linker occasionally
1.47      reed     2628:             runs into issues when trying to link over a
                   2629:             network-mounted file system.</p>
1.1       grant    2630: 
                   2631:             <p>The bootstrapping process should set all the right
                   2632:             options for programs such as imake(1), but you may want
                   2633:             to set some options depending on your local setup.
1.45      wiz      2634:             Please see <code xmlns=
                   2635:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2636:             "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27      rillig   2637:             course, your compiler's man pages for details.</p>
1.22      tv       2638: 
                   2639:             <p>If you are using SGI's MIPSPro compiler, please
                   2640:             set</p>
                   2641:             <pre class="programlisting">
1.51      rillig   2642:     PKGSRC_COMPILER=        mipspro
1.22      tv       2643: </pre>
                   2644: 
1.45      wiz      2645:             <p>in <code xmlns=
                   2646:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   2647:             "filename">/etc/mk.conf</code>. Otherwise, pkgsrc will
                   2648:             assume you are using gcc and may end up passing invalid
                   2649:             flags to the compiler. Note that bootstrap should
                   2650:             create an appropriate <code xmlns=
                   2651:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2652:             "filename">mk.conf.example</code> by default.</p>
                   2653: 
                   2654:             <p>If you have both the MIPSPro compiler chain
                   2655:             installed as well as gcc, but want to make sure that
                   2656:             MIPRPro is used, please set your <code class=
                   2657:             "varname">PATH</code> to <span class=
                   2658:             "emphasis"><em>not</em></span> include the location of
1.45      wiz      2659:             gcc (often <code xmlns=
                   2660:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2661:             "filename">/usr/freeware/bin</code>), and (important)
                   2662:             pass the '--preserve-path' flag.</p>
1.1       grant    2663:           </div>
                   2664: 
1.66    ! rillig   2665:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    2666:             <div class="titlepage">
                   2667:               <div>
                   2668:                 <div>
1.66    ! rillig   2669:                   <h3 class="title"><a name="linux" id=
1.30      wiz      2670:                   "linux"></a>3.2.5.&nbsp;Linux</h3>
1.22      tv       2671:                 </div>
                   2672:               </div>
                   2673:             </div>
                   2674: 
                   2675:             <p>Some versions of Linux (for example Debian
                   2676:             GNU/Linux) need either libtermcap or libcurses
                   2677:             (libncurses). Installing the distributions
                   2678:             libncurses-dev package (or equivalent) should fix the
                   2679:             problem.</p>
                   2680: 
                   2681:             <p>pkgsrc supports both gcc (GNU Compiler Collection)
                   2682:             and icc (Intel C++ Compiler). gcc is the default. icc
                   2683:             8.0 and 8.1 on i386 have been tested.</p>
                   2684: 
                   2685:             <p>To bootstrap using icc, assuming the default icc
                   2686:             installation directory:</p>
                   2687:             <pre class="programlisting">
1.51      rillig   2688:     env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
                   2689:             ac_cv___attribute__=yes ./bootstrap
1.22      tv       2690: </pre>
                   2691: 
                   2692:             <div class="note" style=
                   2693:             "margin-left: 0.5in; margin-right: 0.5in;">
                   2694:               <h3 class="title">Note</h3>
                   2695: 
                   2696:               <p>icc 8.1 needs the `-i-static' argument instead of
                   2697:               -static-libcxa.</p>
                   2698:             </div>
                   2699: 
                   2700:             <p>icc supports __attribute__, but the GNU configure
                   2701:             test uses a nested function, which icc does not
                   2702:             support. #undef'ing __attribute__ has the unfortunate
                   2703:             side-effect of breaking many of the Linux header files,
                   2704:             which cannot be compiled properly without
                   2705:             __attribute__. The test must be overridden so that
                   2706:             __attribute__ is assumed supported by the compiler.</p>
                   2707: 
                   2708:             <p>After bootstrapping, you should set <code class=
1.45      wiz      2709:             "varname">PKGSRC_COMPILER</code> in <code xmlns=
                   2710:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2711:             "filename">/etc/mk.conf</code>:</p>
                   2712:             <pre class="programlisting">
1.51      rillig   2713:     PKGSRC_COMPILER=        icc
1.22      tv       2714: </pre>
                   2715: 
                   2716:             <p>The default installation directory for icc is
1.45      wiz      2717:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2718:             class="filename">/opt/intel_cc_80</code>, which is also
                   2719:             the pkgsrc default. If you have installed it into a
                   2720:             different directory, set <code class=
                   2721:             "varname">ICCBASE</code> in <code xmlns=
                   2722:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2723:             "filename">/etc/mk.conf</code>:</p>
                   2724:             <pre class="programlisting">
1.51      rillig   2725:     ICCBASE=                /opt/icc
1.22      tv       2726: </pre>
                   2727: 
                   2728:             <p>pkgsrc uses the static linking method of the runtime
                   2729:             libraries provided by icc, so binaries can be run on
                   2730:             other systems which do not have the shared libraries
                   2731:             installed.</p>
                   2732: 
                   2733:             <p>Libtool, however, extracts a list of libraries from
1.24      wiz      2734:             the <a href=
                   2735:             "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   2736:             <span class="citerefentry"><span class=
                   2737:             "refentrytitle">ld</span>(1)</span></a> command run
                   2738:             when linking a C++ shared library and records it,
                   2739:             throwing away the -Bstatic and -Bdynamic options
                   2740:             interspersed between the libraries. This means that
                   2741:             libtool-linked C++ shared libraries will have a runtime
                   2742:             dependency on the icc libraries until this is fixed in
                   2743:             libtool.</p>
1.22      tv       2744:           </div>
                   2745: 
1.66    ! rillig   2746:           <div class="sect2" lang="en" xml:lang="en">
1.22      tv       2747:             <div class="titlepage">
                   2748:               <div>
                   2749:                 <div>
1.66    ! rillig   2750:                   <h3 class="title"><a name="openbsd" id=
1.30      wiz      2751:                   "openbsd"></a>3.2.6.&nbsp;OpenBSD</h3>
1.1       grant    2752:                 </div>
                   2753:               </div>
                   2754:             </div>
                   2755: 
                   2756:             <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
                   2757: 
                   2758:             <p>Care should be taken so that the tools that this kit
                   2759:             installs do not conflict with the OpenBSD userland
                   2760:             tools. There are several steps:</p>
                   2761: 
                   2762:             <div class="orderedlist">
                   2763:               <ol type="1">
                   2764:                 <li>
                   2765:                   <p>OpenBSD stores its ports pkg database in
1.45      wiz      2766:                   <code xmlns=
                   2767:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   2768:                   "filename">/var/db/pkg</code>. It is therefore
                   2769:                   recommended that you choose a different location
                   2770:                   (e.g. <code xmlns=
                   2771:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2772:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2773:                   --pkgdbdir option to the bootstrap script.</p>
                   2774:                 </li>
                   2775: 
                   2776:                 <li>
                   2777:                   <p>If you do not intend to use the OpenBSD ports
                   2778:                   tools, it's probably a good idea to move them out
                   2779:                   of the way to avoid confusion, e.g.</p>
                   2780:                   <pre class="screen">
1.14      xtraeme  2781: <code class="prompt">#</code> <strong class=
                   2782: "userinput"><code>cd /usr/sbin</code></strong>
                   2783: <code class="prompt">#</code> <strong class=
                   2784: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2785: <code class="prompt">#</code> <strong class=
                   2786: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2787: <code class="prompt">#</code> <strong class=
                   2788: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2789: <code class="prompt">#</code> <strong class=
                   2790: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2791: </pre>
                   2792:                 </li>
                   2793: 
                   2794:                 <li>
1.45      wiz      2795:                   <p>An example <code xmlns=
                   2796:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2797:                   "filename">/etc/mk.conf</code> file will be
1.45      wiz      2798:                   placed in <code xmlns=
                   2799:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2800:                   "filename">/etc/mk.conf.example</code> file when
                   2801:                   you use the bootstrap script. OpenBSD's make
1.45      wiz      2802:                   program uses <code xmlns=
                   2803:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2804:                   "filename">/etc/mk.conf</code> as well. You can
1.47      reed     2805:                   work around this by enclosing all the
                   2806:                   pkgsrc-specific parts of the file with:</p>
1.1       grant    2807:                   <pre class="programlisting">
1.51      rillig   2808:     .ifdef BSD_PKG_MK
                   2809:     # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
                   2810:     .else
                   2811:     # OpenBSD stuff
                   2812:     .endif
1.1       grant    2813: </pre>
                   2814:                 </li>
                   2815:               </ol>
                   2816:             </div>
                   2817:           </div>
                   2818: 
1.66    ! rillig   2819:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    2820:             <div class="titlepage">
                   2821:               <div>
                   2822:                 <div>
1.66    ! rillig   2823:                   <h3 class="title"><a name="solaris" id=
1.30      wiz      2824:                   "solaris"></a>3.2.7.&nbsp;Solaris</h3>
1.1       grant    2825:                 </div>
                   2826:               </div>
                   2827:             </div>
                   2828: 
                   2829:             <p>Solaris 2.6 through 9 are supported on both x86 and
                   2830:             sparc. You will need a working C compiler. Both gcc
                   2831:             2.95.3 and Sun WorkShop 5 have been tested.</p>
                   2832: 
                   2833:             <p>The following packages are required on Solaris 8 for
                   2834:             the bootstrap process and to build packages.</p>
                   2835: 
                   2836:             <div class="itemizedlist">
                   2837:               <ul type="disc">
                   2838:                 <li>
                   2839:                   <p>SUNWsprot</p>
                   2840:                 </li>
                   2841: 
                   2842:                 <li>
                   2843:                   <p>SUNWarc</p>
                   2844:                 </li>
                   2845: 
                   2846:                 <li>
                   2847:                   <p>SUNWbtool</p>
                   2848:                 </li>
                   2849: 
                   2850:                 <li>
                   2851:                   <p>SUNWtoo</p>
                   2852:                 </li>
                   2853: 
                   2854:                 <li>
                   2855:                   <p>SUNWlibm</p>
                   2856:                 </li>
                   2857:               </ul>
                   2858:             </div>
                   2859: 
                   2860:             <p>Please note the use of GNU binutils on Solaris is
                   2861:             <span class="emphasis"><em>not</em></span>
                   2862:             supported.</p>
                   2863: 
1.66    ! rillig   2864:             <div class="sect3" lang="en" xml:lang="en">
1.1       grant    2865:               <div class="titlepage">
                   2866:                 <div>
                   2867:                   <div>
1.66    ! rillig   2868:                     <h4 class="title"><a name="solaris-gcc-note"
        !          2869:                     id="solaris-gcc-note"></a>3.2.7.1.&nbsp;If you
        !          2870:                     are using gcc</h4>
1.1       grant    2871:                   </div>
                   2872:                 </div>
                   2873:               </div>
                   2874: 
                   2875:               <p>It makes life much simpler if you only use the
                   2876:               same gcc consistently for building all packages.</p>
                   2877: 
                   2878:               <p>It is recommended that an external gcc be used
                   2879:               only for bootstrapping, then either build gcc from
                   2880:               <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2881:               href=
                   2882:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.45      wiz      2883:               target="_top"><code xmlns="" class=
                   2884:               "filename">lang/gcc</code></a> or install a binary
                   2885:               gcc package, then remove gcc used during
1.20      ben      2886:               bootstrapping.</p>
1.1       grant    2887: 
                   2888:               <p>Binary packages of gcc can be found through
                   2889:               <a href=
                   2890:               "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20      ben      2891:               target=
                   2892:               "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1       grant    2893:             </div>
                   2894: 
1.66    ! rillig   2895:             <div class="sect3" lang="en" xml:lang="en">
1.1       grant    2896:               <div class="titlepage">
                   2897:                 <div>
                   2898:                   <div>
1.30      wiz      2899:                     <h4 class="title"><a name=
1.66    ! rillig   2900:                     "solaris-sun-workshop-note" id=
1.30      wiz      2901:                     "solaris-sun-workshop-note"></a>3.2.7.2.&nbsp;If
                   2902:                     you are using Sun WorkShop</h4>
1.1       grant    2903:                   </div>
                   2904:                 </div>
                   2905:               </div>
                   2906: 
                   2907:               <p>You will need at least the following packages
                   2908:               installed (from WorkShop 5.0)</p>
                   2909: 
                   2910:               <div class="itemizedlist">
                   2911:                 <ul type="disc">
                   2912:                   <li>
                   2913:                     <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
                   2914:                   </li>
                   2915: 
                   2916:                   <li>
                   2917:                     <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
                   2918:                   </li>
                   2919: 
                   2920:                   <li>
                   2921:                     <p>SPROild - Sun WorkShop Incremental
                   2922:                     Linker</p>
                   2923:                   </li>
                   2924: 
                   2925:                   <li>
                   2926:                     <p>SPROlang - Sun WorkShop Compilers common
                   2927:                     components</p>
                   2928:                   </li>
                   2929:                 </ul>
                   2930:               </div>
                   2931: 
1.14      xtraeme  2932:               <p>You should set <code class="varname">CC</code>,
                   2933:               <code class="varname">CXX</code> and optionally,
1.45      wiz      2934:               <code class="varname">CPP</code> in <code xmlns=
                   2935:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     2936:               "filename">/etc/mk.conf</code>, e.g.:</p>
1.1       grant    2937:               <pre class="programlisting">
1.51      rillig   2938:     CC=     cc
                   2939:     CXX=    CC
                   2940:     CPP=    /usr/ccs/lib/cpp
1.1       grant    2941: </pre>
                   2942: 
                   2943:               <p>You may also want to build 64-bit binaries,
1.47      reed     2944:               e.g.:</p>
1.1       grant    2945:               <pre class="programlisting">
1.51      rillig   2946:     CFLAGS= -xtarget=ultra -xarch=v9
1.1       grant    2947: </pre>
                   2948: 
                   2949:               <p>Whichever compiler you use, please ensure the
                   2950:               compiler tools and your $prefix are in your
1.14      xtraeme  2951:               <code class="varname">PATH</code>. This includes
1.45      wiz      2952:               <code xmlns=
                   2953:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     2954:               "filename">/usr/ccs/{bin,lib}</code> and e.g.
1.45      wiz      2955:               <code xmlns=
                   2956:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2957:               "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1       grant    2958:             </div>
                   2959:           </div>
                   2960:         </div>
                   2961:       </div>
                   2962: 
1.66    ! rillig   2963:       <div class="chapter" lang="en" xml:lang="en">
1.1       grant    2964:         <div class="titlepage">
                   2965:           <div>
                   2966:             <div>
1.66    ! rillig   2967:               <h2 class="title"><a name="using" id=
1.1       grant    2968:               "using"></a>Chapter&nbsp;4.&nbsp;Using pkgsrc</h2>
                   2969:             </div>
                   2970:           </div>
                   2971:         </div>
                   2972: 
                   2973:         <div class="toc">
                   2974:           <p><b>Table of Contents</b></p>
                   2975: 
                   2976:           <dl>
                   2977:             <dt><span class="sect1"><a href="#getting-started">4.1.
                   2978:             Working with binary packages</a></span></dt>
                   2979: 
                   2980:             <dd>
                   2981:               <dl>
1.30      wiz      2982:                 <dt><span class="sect2"><a href=
                   2983:                 "#where-to-get-binary-packages">4.1.1. Where to get
                   2984:                 binary packages</a></span></dt>
1.1       grant    2985: 
1.30      wiz      2986:                 <dt><span class="sect2"><a href=
                   2987:                 "#how-to-use-binary-packages">4.1.2. How to use
                   2988:                 binary packages</a></span></dt>
1.1       grant    2989: 
1.30      wiz      2990:                 <dt><span class="sect2"><a href=
                   2991:                 "#a-word-of-warning">4.1.3. A word of
                   2992:                 warning</a></span></dt>
1.1       grant    2993:               </dl>
                   2994:             </dd>
                   2995: 
1.30      wiz      2996:             <dt><span class="sect1"><a href=
                   2997:             "#building-packages-from-source">4.2. Building packages
                   2998:             from source</a></span></dt>
1.1       grant    2999: 
                   3000:             <dd>
                   3001:               <dl>
1.30      wiz      3002:                 <dt><span class="sect2"><a href=
                   3003:                 "#requirements">4.2.1. Requirements</a></span></dt>
1.1       grant    3004: 
1.30      wiz      3005:                 <dt><span class="sect2"><a href=
                   3006:                 "#fetching-distfiles">4.2.2. Fetching
                   3007:                 distfiles</a></span></dt>
1.1       grant    3008: 
1.30      wiz      3009:                 <dt><span class="sect2"><a href=
                   3010:                 "#how-to-build-and-install">4.2.3. How to build and
                   3011:                 install</a></span></dt>
1.1       grant    3012: 
1.30      wiz      3013:                 <dt><span class="sect2"><a href=
                   3014:                 "#selecting-the-compiler">4.2.4. Selecting the
                   3015:                 compiler</a></span></dt>
1.1       grant    3016:               </dl>
                   3017:             </dd>
                   3018:           </dl>
                   3019:         </div>
                   3020: 
1.66    ! rillig   3021:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    3022:           <div class="titlepage">
                   3023:             <div>
                   3024:               <div>
                   3025:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   3026:                 "getting-started" id=
1.1       grant    3027:                 "getting-started"></a>4.1.&nbsp;Working with binary
                   3028:                 packages</h2>
                   3029:               </div>
                   3030:             </div>
                   3031:           </div>
                   3032: 
                   3033:           <p>This section describes how to find, retrieve and
                   3034:           install a precompiled binary package that someone else
                   3035:           already prepared for your type of machine.</p>
                   3036: 
1.66    ! rillig   3037:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    3038:             <div class="titlepage">
                   3039:               <div>
                   3040:                 <div>
1.30      wiz      3041:                   <h3 class="title"><a name=
1.66    ! rillig   3042:                   "where-to-get-binary-packages" id=
1.30      wiz      3043:                   "where-to-get-binary-packages"></a>4.1.1.&nbsp;Where
                   3044:                   to get binary packages</h3>
1.1       grant    3045:                 </div>
                   3046:               </div>
                   3047:             </div>
                   3048: 
                   3049:             <p>Precompiled packages are stored on ftp.NetBSD.org
1.45      wiz      3050:             and its mirrors in the directory <code xmlns=
                   3051:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   3052:             "filename">/pub/NetBSD/packages/&lt;OSVERSION&gt;/&lt;ARCH&gt;/</code>
                   3053:             for anonymous FTP access. <code class=
                   3054:             "varname">OSVERSION</code> is the NetBSD version
                   3055:             (<span><strong class="command">uname
                   3056:             -r</strong></span>), <code class="varname">ARCH</code>
                   3057:             is the architecture (<span><strong class=
                   3058:             "command">uname -p</strong></span>). In that directory,
                   3059:             there is a subdirectory for each category plus a
1.45      wiz      3060:             subdirectory <code xmlns=
                   3061:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3062:             "filename">All</code> which includes the actual
                   3063:             binaries in <code xmlns=
                   3064:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   3065:             "filename">.tgz</code> files. The category
                   3066:             subdirectories use symbolic links to those files (this
1.45      wiz      3067:             is the same directory layout as in <code xmlns=
                   3068:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3069:             "filename">/usr/pkgsrc/packages</code>).</p>
1.1       grant    3070: 
1.47      reed     3071:             <p>This same directory layout applies for CD-ROM
1.1       grant    3072:             distributions, only that the directory may be rooted
1.45      wiz      3073:             somewhere else, probably somewhere below <code xmlns=
                   3074:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     3075:             "filename">/cdrom</code>. Please consult your CD-ROMs
1.1       grant    3076:             documentation for the exact location.</p>
                   3077:           </div>
                   3078: 
1.66    ! rillig   3079:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    3080:             <div class="titlepage">
                   3081:               <div>
                   3082:                 <div>
1.30      wiz      3083:                   <h3 class="title"><a name=
1.66    ! rillig   3084:                   "how-to-use-binary-packages" id=
1.30      wiz      3085:                   "how-to-use-binary-packages"></a>4.1.2.&nbsp;How
                   3086:                   to use binary packages</h3>
1.1       grant    3087:                 </div>
                   3088:               </div>
                   3089:             </div>
                   3090: 
1.47      reed     3091:             <p>If you have the files on a CD-ROM or downloaded them
1.23      wiz      3092:             to your hard disk, you can install them with the
1.27      rillig   3093:             following command (be sure to <span><strong class=
1.14      xtraeme  3094:             "command">su</strong></span> to root first):</p>
1.1       grant    3095:             <pre class="screen">
1.14      xtraeme  3096: <code class="prompt">#</code> <strong class=
                   3097: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1       grant    3098: </pre>
                   3099: 
                   3100:             <p>If you have FTP access and you don't want to
                   3101:             download the packages via FTP prior to installation,
1.14      xtraeme  3102:             you can do this automatically by giving
                   3103:             <span><strong class="command">pkg_add</strong></span>
                   3104:             an FTP URL:</p>
1.1       grant    3105:             <pre class="screen">
1.14      xtraeme  3106: <code class="prompt">#</code> <strong class=
1.27      rillig   3107: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/&lt;OSVERSION&gt;/&lt;ARCH&gt;/All/package.tgz</code></strong>
1.1       grant    3108: </pre>
                   3109: 
1.27      rillig   3110:             <p>Note that any prerequisite packages needed to run
                   3111:             the package in question will be installed, too,
1.1       grant    3112:             assuming they are present where you install from.</p>
                   3113: 
1.23      wiz      3114:             <p>To save some typing, you can set the <code class=
                   3115:             "varname">PKG_PATH</code> environment variable to a
1.47      reed     3116:             semicolon-separated list of paths (including remote
1.23      wiz      3117:             URLs); trailing slashes are not allowed.</p>
                   3118: 
1.45      wiz      3119:             <p>Additionally to the <code xmlns=
                   3120:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.23      wiz      3121:             "filename">All</code> directory there exists a
1.45      wiz      3122:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3123:             class="filename">vulnerable</code> directory to which
                   3124:             binary packages with known vulnerabilities are moved,
                   3125:             since removing them could cause missing dependencies.
                   3126:             To use these packages, add the <code xmlns=
                   3127:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3128:             "filename">vulnerable</code> directory to your
                   3129:             <code class="varname">PKG_PATH</code>. However, you
                   3130:             should run <a xmlns=
1.23      wiz      3131:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   3132:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45      wiz      3133:             target="_top"><code xmlns="" class=
                   3134:             "filename">security/audit-packages</code></a>
1.47      reed     3135:             regularly, especially after installing new packages,
                   3136:             and verify that the vulnerabilities are acceptable for
                   3137:             your configuration. An example <code class=
                   3138:             "varname">PKG_PATH</code> would be: <code xmlns=
                   3139:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   3140:             "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/&lt;OSVERSION&gt;/&lt;ARCH&gt;/All;ftp://ftp.NetBSD.org/pub/NetBSD/packages/&lt;OSVERSION&gt;/&lt;ARCH&gt;/vulnerable</code>
1.23      wiz      3141:             Please note that semicolon (';') is a shell
                   3142:             meta-character, so you'll probably have to quote
                   3143:             it.</p>
                   3144: 
1.1       grant    3145:             <p>After you've installed packages, be sure to have
1.45      wiz      3146:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3147:             class="filename">/usr/pkg/bin</code> and <code xmlns=
                   3148:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3149:             "filename">/usr/pkg/sbin</code> in your <code class=
                   3150:             "varname">PATH</code> so you can actually start the
                   3151:             just installed program.</p>
1.1       grant    3152:           </div>
                   3153: 
1.66    ! rillig   3154:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    3155:             <div class="titlepage">
                   3156:               <div>
                   3157:                 <div>
1.66    ! rillig   3158:                   <h3 class="title"><a name="a-word-of-warning" id=
1.30      wiz      3159:                   "a-word-of-warning"></a>4.1.3.&nbsp;A word of
1.1       grant    3160:                   warning</h3>
                   3161:                 </div>
                   3162:               </div>
                   3163:             </div>
                   3164: 
                   3165:             <p>Please pay very careful attention to the warnings
                   3166:             expressed in the <a href=
                   3167:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3168:             <span class="citerefentry"><span class=
                   3169:             "refentrytitle">pkg_add</span>(1)</span></a> manual
                   3170:             page about the inherent dangers of installing binary
                   3171:             packages which you did not create yourself, and the
                   3172:             security holes that can be introduced onto your system
                   3173:             by indiscriminate adding of such files.</p>
1.66    ! rillig   3174: 
        !          3175:             <p>The same warning of course applies to every package
        !          3176:             you install from source when you haven't completely
        !          3177:             read and understood the source code of the package, the
        !          3178:             compiler that is used to build the package and all the
        !          3179:             other tools that are involved.</p>
1.1       grant    3180:           </div>
                   3181:         </div>
                   3182: 
1.66    ! rillig   3183:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    3184:           <div class="titlepage">
                   3185:             <div>
                   3186:               <div>
                   3187:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   3188:                 "building-packages-from-source" id=
1.30      wiz      3189:                 "building-packages-from-source"></a>4.2.&nbsp;Building
1.1       grant    3190:                 packages from source</h2>
                   3191:               </div>
                   3192:             </div>
                   3193:           </div>
                   3194: 
                   3195:           <p>This assumes that the package is already in pkgsrc. If
                   3196:           it is not, see <a href="#developers-guide" title=
1.46      gdt      3197:           "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">Part&nbsp;II,
1.27      rillig   3198:           &#8220;The pkgsrc developer's guide&#8221;</a> for
                   3199:           instructions how to create your own packages.</p>
1.1       grant    3200: 
1.66    ! rillig   3201:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    3202:             <div class="titlepage">
                   3203:               <div>
                   3204:                 <div>
1.66    ! rillig   3205:                   <h3 class="title"><a name="requirements" id=
1.30      wiz      3206:                   "requirements"></a>4.2.1.&nbsp;Requirements</h3>
1.1       grant    3207:                 </div>
                   3208:               </div>
                   3209:             </div>
                   3210: 
                   3211:             <p>To build packages from source on a NetBSD system the
                   3212:             &#8220;<span class="quote">comp</span>&#8221; and the
                   3213:             &#8220;<span class="quote">text</span>&#8221;
                   3214:             distribution sets must be installed. If you want to
1.47      reed     3215:             build X11-related packages the &#8220;<span class=
1.1       grant    3216:             "quote">xbase</span>&#8221; and &#8220;<span class=
                   3217:             "quote">xcomp</span>&#8221; distribution sets are
                   3218:             required, too.</p>
                   3219:           </div>
                   3220: 
1.66    ! rillig   3221:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    3222:             <div class="titlepage">
                   3223:               <div>
                   3224:                 <div>
1.66    ! rillig   3225:                   <h3 class="title"><a name="fetching-distfiles"
        !          3226:                   id="fetching-distfiles"></a>4.2.2.&nbsp;Fetching
1.1       grant    3227:                   distfiles</h3>
                   3228:                 </div>
                   3229:               </div>
                   3230:             </div>
                   3231: 
1.27      rillig   3232:             <p>The first step for building a package is downloading
                   3233:             the distfiles (i.e. the unmodified source). If they
                   3234:             have not yet been downloaded, pkgsrc will fetch them
1.1       grant    3235:             automatically.</p>
                   3236: 
                   3237:             <p>You can overwrite some of the major distribution
                   3238:             sites to fit to sites that are close to your own. Have
1.45      wiz      3239:             a look at <code xmlns=
                   3240:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3241:             "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27      rillig   3242:             some examples &#8212; in particular, look for the
1.14      xtraeme  3243:             <code class="varname">MASTER_SORT</code>, <code class=
                   3244:             "varname">MASTER_SORT_REGEX</code> and <code class=
                   3245:             "varname">INET_COUNTRY</code> definitions. This may
                   3246:             save some of your bandwidth and time.</p>
1.1       grant    3247: 
                   3248:             <p>You can change these settings either in your shell's
                   3249:             environment, or, if you want to keep the settings, by
1.45      wiz      3250:             editing the <code xmlns=
                   3251:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3252:             "filename">/etc/mk.conf</code> file, and adding the
                   3253:             definitions there.</p>
1.1       grant    3254: 
                   3255:             <p>If you don't have a permanent Internet connection
                   3256:             and you want to know which files to download,
1.14      xtraeme  3257:             <span><strong class="command">make
                   3258:             fetch-list</strong></span> will tell you what you'll
1.45      wiz      3259:             need. Put these distfiles into <code xmlns=
                   3260:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3261:             "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    3262:           </div>
                   3263: 
1.66    ! rillig   3264:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    3265:             <div class="titlepage">
                   3266:               <div>
                   3267:                 <div>
1.30      wiz      3268:                   <h3 class="title"><a name=
1.66    ! rillig   3269:                   "how-to-build-and-install" id=
1.30      wiz      3270:                   "how-to-build-and-install"></a>4.2.3.&nbsp;How to
                   3271:                   build and install</h3>
1.1       grant    3272:                 </div>
                   3273:               </div>
                   3274:             </div>
                   3275: 
                   3276:             <p>Assuming that the distfile has been fetched (see
                   3277:             previous section), become root and change into the
1.47      reed     3278:             relevant directory and run <span><strong class=
                   3279:             "command">make</strong></span>.</p>
                   3280: 
                   3281:             <div class="note" style=
                   3282:             "margin-left: 0.5in; margin-right: 0.5in;">
                   3283:               <h3 class="title">Note</h3>
                   3284: 
                   3285:               <p>If using bootstrap or pkgsrc on a non-NetBSD
                   3286:               system, use the pkgsrc <span><strong class=
                   3287:               "command">bmake</strong></span> command instead of
                   3288:               &#8220;<span class="quote">make</span>&#8221; in the
                   3289:               examples in this guide.</p>
                   3290:             </div>
                   3291: 
                   3292:             <p>For example, type</p>
1.1       grant    3293:             <pre class="screen">
1.14      xtraeme  3294: <code class="prompt">%</code> <strong class=
                   3295: "userinput"><code>cd misc/figlet</code></strong>
                   3296: <code class="prompt">%</code> <strong class=
                   3297: "userinput"><code>make</code></strong>
1.1       grant    3298: </pre>
                   3299: 
                   3300:             <p>at the shell prompt to build the various components
                   3301:             of the package, and</p>
                   3302:             <pre class="screen">
1.14      xtraeme  3303: <code class="prompt">#</code> <strong class=
                   3304: "userinput"><code>make install</code></strong>
1.1       grant    3305: </pre>
                   3306: 
                   3307:             <p>to install the various components into the correct
                   3308:             places on your system. Installing the package on your
                   3309:             system requires you to be root. However, pkgsrc has a
                   3310:             <span class="emphasis"><em>just-in-time-su</em></span>
                   3311:             feature, which allows you to only become root for the
                   3312:             actual installation step</p>
                   3313: 
                   3314:             <p>Taking the figlet utility as an example, we can
                   3315:             install it on our system by building as shown in
                   3316:             <a href="#logs" title=
1.66    ! rillig   3317:             "Appendix&nbsp;B.&nbsp;Build logs">Appendix B, <i>Build
        !          3318:             logs</i></a>.</p>
1.1       grant    3319: 
                   3320:             <p>The program is installed under the default root of
1.45      wiz      3321:             the packages tree - <code xmlns=
                   3322:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3323:             "filename">/usr/pkg</code>. Should this not conform to
                   3324:             your tastes, set the <code class=
                   3325:             "varname">LOCALBASE</code> variable in your
1.1       grant    3326:             environment, and it will use that value as the root of
1.45      wiz      3327:             your packages tree. So, to use <code xmlns=
                   3328:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3329:             "filename">/usr/local</code>, set <code class=
                   3330:             "varname">LOCALBASE=/usr/local</code> in your
1.1       grant    3331:             environment. Please note that you should use a
                   3332:             directory which is dedicated to packages and not shared
1.47      reed     3333:             with other programs (i.e., do not try and use
1.14      xtraeme  3334:             <code class="varname">LOCALBASE=/usr</code>). Also, you
                   3335:             should not try to add any of your own files or
1.45      wiz      3336:             directories (such as <code xmlns=
                   3337:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3338:             "filename">src/</code>, <code xmlns=
                   3339:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3340:             "filename">obj/</code>, or <code xmlns=
                   3341:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3342:             "filename">pkgsrc/</code>) below the <code class=
                   3343:             "varname">LOCALBASE</code> tree. This is to prevent
1.1       grant    3344:             possible conflicts between programs and other files
                   3345:             installed by the package system and whatever else may
                   3346:             have been installed there.</p>
                   3347: 
1.45      wiz      3348:             <p>Some packages look in <code xmlns=
                   3349:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3350:             "filename">/etc/mk.conf</code> to alter some
1.1       grant    3351:             configuration options at build time. Have a look at
1.45      wiz      3352:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3353:             class="filename">pkgsrc/mk/defaults/mk.conf</code> to
                   3354:             get an overview of what will be set there by default.
1.14      xtraeme  3355:             Environment variables such as <code class=
1.45      wiz      3356:             "varname">LOCALBASE</code> can be set in <code xmlns=
                   3357:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3358:             "filename">/etc/mk.conf</code> to save having to
                   3359:             remember to set them each time you want to use
                   3360:             pkgsrc.</p>
1.1       grant    3361: 
                   3362:             <p>Occasionally, people want to &#8220;<span class=
                   3363:             "quote">look under the covers</span>&#8221; to see what
                   3364:             is going on when a package is building or being
                   3365:             installed. This may be for debugging purposes, or out
                   3366:             of simple curiosity. A number of utility values have
                   3367:             been added to help with this.</p>
                   3368: 
                   3369:             <div class="orderedlist">
                   3370:               <ol type="1">
                   3371:                 <li>
                   3372:                   <p>If you invoke the <a href=
                   3373:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   3374:                   <span class="citerefentry"><span class=
                   3375:                   "refentrytitle">make</span>(1)</span></a> command
1.14      xtraeme  3376:                   with <code class=
                   3377:                   "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
                   3378:                   amount of information will be displayed. For
                   3379:                   example,</p>
1.1       grant    3380:                   <pre class="screen">
1.14      xtraeme  3381: <strong class=
                   3382: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1       grant    3383: </pre>
                   3384: 
                   3385:                   <p>will show all the commands that are invoked,
                   3386:                   up to and including the &#8220;<span class=
                   3387:                   "quote">patch</span>&#8221; stage.</p>
                   3388:                 </li>
                   3389: 
                   3390:                 <li>
                   3391:                   <p>If you want to know the value of a certain
1.22      tv       3392:                   <a href=
                   3393:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   3394:                   <span class="citerefentry"><span class=
                   3395:                   "refentrytitle">make</span>(1)</span></a>
                   3396:                   definition, then the <code class=
1.14      xtraeme  3397:                   "varname">VARNAME</code> definition should be
                   3398:                   used, in conjunction with the show-var target.
                   3399:                   e.g. to show the expansion of the <a href=
1.1       grant    3400:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   3401:                   <span class="citerefentry"><span class=
                   3402:                   "refentrytitle">make</span>(1)</span></a>
1.14      xtraeme  3403:                   variable <code class=
1.22      tv       3404:                   "varname">LOCALBASE</code>:</p>
1.1       grant    3405:                   <pre class="screen">
1.14      xtraeme  3406: <code class="prompt">%</code> <strong class=
                   3407: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1       grant    3408: /usr/pkg
1.14      xtraeme  3409: <code class="prompt">%</code>
1.1       grant    3410:           
                   3411: </pre>
                   3412:                 </li>
                   3413:               </ol>
                   3414:             </div>
                   3415: 
                   3416:             <p>If you want to install a binary package that you've
                   3417:             either created yourself (see next section), that you
                   3418:             put into pkgsrc/packages manually or that is located on
1.8       wiz      3419:             a remote FTP server, you can use the "bin-install"
1.1       grant    3420:             target. This target will install a binary package - if
                   3421:             available - via <a href=
                   3422:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3423:             <span class="citerefentry"><span class=
                   3424:             "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14      xtraeme  3425:             <span><strong class="command">make
                   3426:             package</strong></span>. The list of remote FTP sites
                   3427:             searched is kept in the variable <code class=
                   3428:             "varname">BINPKG_SITES</code>, which defaults to
                   3429:             ftp.NetBSD.org. Any flags that should be added to
                   3430:             <a href=
1.1       grant    3431:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3432:             <span class="citerefentry"><span class=
                   3433:             "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14      xtraeme  3434:             into <code class="varname">BIN_INSTALL_FLAGS</code>.
1.45      wiz      3435:             See <code xmlns=
                   3436:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3437:             "filename">pkgsrc/mk/defaults/mk.conf</code> for more
                   3438:             details.</p>
1.1       grant    3439: 
1.47      reed     3440:             <p>A final word of warning: If you set up a system that
1.14      xtraeme  3441:             has a non-standard setting for <code class=
                   3442:             "varname">LOCALBASE</code>, be sure to set that before
1.1       grant    3443:             any packages are installed, as you can not use several
                   3444:             directories for the same purpose. Doing so will result
                   3445:             in pkgsrc not being able to properly detect your
                   3446:             installed packages, and fail miserably. Note also that
                   3447:             precompiled binary packages are usually built with the
1.14      xtraeme  3448:             default <code class="varname">LOCALBASE</code> of
1.45      wiz      3449:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3450:             class="filename">/usr/pkg</code>, and that you should
                   3451:             <span class="emphasis"><em>not</em></span> install any
                   3452:             if you use a non-standard <code class=
1.14      xtraeme  3453:             "varname">LOCALBASE</code>.</p>
1.1       grant    3454:           </div>
                   3455: 
1.66    ! rillig   3456:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    3457:             <div class="titlepage">
                   3458:               <div>
                   3459:                 <div>
1.30      wiz      3460:                   <h3 class="title"><a name=
1.66    ! rillig   3461:                   "selecting-the-compiler" id=
1.30      wiz      3462:                   "selecting-the-compiler"></a>4.2.4.&nbsp;Selecting
                   3463:                   the compiler</h3>
1.1       grant    3464:                 </div>
                   3465:               </div>
                   3466:             </div>
                   3467: 
                   3468:             <p>By default, pkgsrc will use GCC to build packages.
                   3469:             This may be overridden by setting the following
                   3470:             variables in /etc/mk.conf:</p>
                   3471: 
                   3472:             <div class="variablelist">
                   3473:               <dl>
1.14      xtraeme  3474:                 <dt><span class="term"><code class=
                   3475:                 "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1       grant    3476: 
                   3477:                 <dd>
                   3478:                   <p>This is a list of values specifying the chain
                   3479:                   of compilers to invoke when building packages.
                   3480:                   Valid values are:</p>
                   3481: 
                   3482:                   <div class="itemizedlist">
                   3483:                     <ul type="disc">
                   3484:                       <li>
1.14      xtraeme  3485:                         <p><code class="varname">distcc</code>:
1.1       grant    3486:                         distributed C/C++ (chainable)</p>
                   3487:                       </li>
                   3488: 
                   3489:                       <li>
1.14      xtraeme  3490:                         <p><code class="varname">ccache</code>:
1.1       grant    3491:                         compiler cache (chainable)</p>
                   3492:                       </li>
                   3493: 
                   3494:                       <li>
1.14      xtraeme  3495:                         <p><code class="varname">gcc</code>: GNU
                   3496:                         C/C++ Compiler</p>
1.1       grant    3497:                       </li>
                   3498: 
                   3499:                       <li>
1.14      xtraeme  3500:                         <p><code class="varname">mipspro</code>:
1.1       grant    3501:                         Silicon Graphics, Inc. MIPSpro
                   3502:                         (n32/n64)</p>
                   3503:                       </li>
                   3504: 
                   3505:                       <li>
1.14      xtraeme  3506:                         <p><code class="varname">mipspro</code>:
1.1       grant    3507:                         Silicon Graphics, Inc. MIPSpro (o32)</p>
                   3508:                       </li>
                   3509: 
                   3510:                       <li>
1.64      kim      3511:                         <p><code class="varname">sunpro</code>: Sun
1.1       grant    3512:                         Microsystems, Inc. WorkShip/Forte/Sun ONE
                   3513:                         Studio</p>
                   3514:                       </li>
                   3515:                     </ul>
                   3516:                   </div>
                   3517: 
                   3518:                   <p>The default is &#8220;<span class=
1.14      xtraeme  3519:                   "quote"><code class=
                   3520:                   "varname">gcc</code></span>&#8221;. You can use
                   3521:                   <code class="varname">ccache</code> and/or
                   3522:                   <code class="varname">distcc</code> with an
                   3523:                   appropriate <code class=
                   3524:                   "varname">PKGSRC_COMPILER</code> setting, e.g.
                   3525:                   &#8220;<span class="quote"><code class=
                   3526:                   "varname">ccache gcc</code></span>&#8221;. This
1.1       grant    3527:                   variable should always be terminated with a value
                   3528:                   for a real compiler.</p>
                   3529:                 </dd>
                   3530: 
1.14      xtraeme  3531:                 <dt><span class="term"><code class=
                   3532:                 "varname">GCC_REQD</code>:</span></dt>
1.1       grant    3533: 
                   3534:                 <dd>
                   3535:                   <p>This specifies the minimum version of GCC to
                   3536:                   use when building packages. If the system GCC
                   3537:                   doesn't satisfy this requirement, then pkgsrc
                   3538:                   will build and install one of the GCC packages to
                   3539:                   use instead.</p>
                   3540:                 </dd>
                   3541:               </dl>
                   3542:             </div>
                   3543:           </div>
                   3544:         </div>
                   3545:       </div>
                   3546: 
1.66    ! rillig   3547:       <div class="chapter" lang="en" xml:lang="en">
1.1       grant    3548:         <div class="titlepage">
                   3549:           <div>
                   3550:             <div>
1.66    ! rillig   3551:               <h2 class="title"><a name="configuring" id=
1.38      dillo    3552:               "configuring"></a>Chapter&nbsp;5.&nbsp;Configuring
                   3553:               pkgsrc</h2>
                   3554:             </div>
                   3555:           </div>
                   3556:         </div>
                   3557: 
                   3558:         <div class="toc">
                   3559:           <p><b>Table of Contents</b></p>
                   3560: 
                   3561:           <dl>
                   3562:             <dt><span class="sect1"><a href=
1.45      wiz      3563:             "#general-configuration">5.1. General
                   3564:             configuration</a></span></dt>
                   3565: 
                   3566:             <dt><span class="sect1"><a href=
                   3567:             "#variables-affecting-build">5.2. Variables affecting
                   3568:             the build process</a></span></dt>
                   3569: 
                   3570:             <dt><span class="sect1"><a href=
                   3571:             "#developer-advanced-settings">5.3. Developer/advanced
                   3572:             settings</a></span></dt>
                   3573: 
                   3574:             <dt><span class="sect1"><a href=
                   3575:             "#selecting-build-options">5.4. Selecting Build
1.42      dillo    3576:             Options</a></span></dt>
1.38      dillo    3577:           </dl>
                   3578:         </div>
                   3579: 
1.66    ! rillig   3580:         <div class="sect1" lang="en" xml:lang="en">
1.38      dillo    3581:           <div class="titlepage">
                   3582:             <div>
                   3583:               <div>
                   3584:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   3585:                 "general-configuration" id=
1.45      wiz      3586:                 "general-configuration"></a>5.1.&nbsp;General
                   3587:                 configuration</h2>
                   3588:               </div>
                   3589:             </div>
                   3590:           </div>
                   3591: 
1.47      reed     3592:           <p>In this section, you can find some variables that
                   3593:           apply to all pkgsrc packages. The preferred method of
                   3594:           setting these variables is by setting them in
                   3595:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3596:           class="filename">/etc/mk.conf</code>.</p>
1.45      wiz      3597: 
                   3598:           <div class="itemizedlist">
                   3599:             <ul type="disc">
                   3600:               <li>
                   3601:                 <p><code class="varname">LOCALBASE</code>: Where
                   3602:                 packages will be installed. The default is
                   3603:                 <code xmlns=
                   3604:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3605:                 "filename">/usr/pkg</code>. Do not mix binary
                   3606:                 packages with different <code class=
                   3607:                 "varname">LOCALBASE</code>s!</p>
                   3608:               </li>
                   3609: 
                   3610:               <li>
                   3611:                 <p><code class="varname">CROSSBASE</code>: Where
                   3612:                 &#8220;<span class="quote">cross</span>&#8221;
                   3613:                 category packages will be installed. The default is
                   3614:                 <code xmlns=
                   3615:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3616:                 "filename">${LOCALBASE}/cross</code>.</p>
                   3617:               </li>
                   3618: 
                   3619:               <li>
                   3620:                 <p><code class="varname">X11BASE</code>: Where X11
                   3621:                 is installed on the system. The default is
                   3622:                 <code xmlns=
                   3623:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3624:                 "filename">/usr/X11R6</code>.</p>
                   3625:               </li>
                   3626: 
                   3627:               <li>
                   3628:                 <p><code class="varname">DISTDIR</code>: Where to
                   3629:                 store the downloaded copies of the original source
                   3630:                 distributions used for building pkgsrc packages.
                   3631:                 The default is <code xmlns=
                   3632:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3633:                 "filename">${PKGSRCDIR}/distfiles</code>.</p>
                   3634:               </li>
                   3635: 
                   3636:               <li>
                   3637:                 <p><code class=
                   3638:                 "varname">MASTER_SITE_OVERRIDE</code>: If set,
                   3639:                 override the packages' <code class=
                   3640:                 "varname">MASTER_SITES</code> with this value.</p>
                   3641:               </li>
                   3642: 
                   3643:               <li>
                   3644:                 <p><code class="varname">MASTER_SITE_BACKUP</code>:
                   3645:                 Backup location(s) for distribution files and patch
                   3646:                 files if not found locally or in <code xmlns=
                   3647:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3648:                 "filename">${MASTER_SITES}</code> or <code xmlns=
                   3649:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3650:                 "filename">${PATCH_SITES}</code> respectively. The
                   3651:                 defaults are <code xmlns=
                   3652:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3653:                 "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/${DIST_SUBDIR}/</code>
                   3654:                 and <code xmlns=
                   3655:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3656:                 "filename">ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/</code>.</p>
                   3657:               </li>
                   3658: 
                   3659:               <li>
                   3660:                 <p><code class="varname">BINPKG_SITES</code>: List
                   3661:                 of sites carrying binary pkgs.</p>
                   3662:               </li>
                   3663:             </ul>
                   3664:           </div>
                   3665:         </div>
                   3666: 
1.66    ! rillig   3667:         <div class="sect1" lang="en" xml:lang="en">
1.45      wiz      3668:           <div class="titlepage">
                   3669:             <div>
                   3670:               <div>
                   3671:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   3672:                 "variables-affecting-build" id=
1.45      wiz      3673:                 "variables-affecting-build"></a>5.2.&nbsp;Variables
                   3674:                 affecting the build process</h2>
                   3675:               </div>
                   3676:             </div>
                   3677:           </div>
                   3678: 
                   3679:           <p>XXX</p>
                   3680: 
                   3681:           <div class="itemizedlist">
                   3682:             <ul type="disc">
                   3683:               <li>
                   3684:                 <p><code class="varname">PACKAGES</code>: The top
                   3685:                 level directory for the binary packages. The
                   3686:                 default is <code xmlns=
                   3687:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3688:                 "filename">${PKGSRCDIR}/packages</code>.</p>
                   3689:               </li>
                   3690: 
                   3691:               <li>
                   3692:                 <p><code class="varname">WRKOBJDIR</code>: The top
                   3693:                 level directory where, if defined, the separate
                   3694:                 working directories will get created, and
                   3695:                 symbolically linked to from <code xmlns=
                   3696:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3697:                 "filename">${WRKDIR}</code> (see below). This is
                   3698:                 useful for building packages on several
                   3699:                 architectures, then <code xmlns=
                   3700:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3701:                 "filename">${PKGSRCDIR}</code> can be NFS-mounted
                   3702:                 while <code xmlns=
                   3703:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3704:                 "filename">${WRKOBJDIR}</code> is local to every
                   3705:                 architecture. (It should be noted that <code class=
                   3706:                 "varname">PKGSRCDIR</code> should not be set by the
                   3707:                 user &#8212; it is an internal definition which
                   3708:                 refers to the root of the pkgsrc tree. It is
                   3709:                 possible to have many pkgsrc tree instances.)</p>
                   3710:               </li>
                   3711: 
                   3712:               <li>
                   3713:                 <p><code class="varname">LOCALPATCHES</code>:
                   3714:                 Directory for local patches that aren't part of
                   3715:                 pkgsrc. See <a href="#components.patches" title=
                   3716:                 "8.3.&nbsp;patches/*">Section&nbsp;8.3,
                   3717:                 &#8220;patches/*&#8221;</a> for more information.
                   3718:                 <em class="replaceable"><code>rel</code></em> and
                   3719:                 <em class="replaceable"><code>arch</code></em> are
                   3720:                 replaced with OS release (&#8220;<span class=
                   3721:                 "quote">2.0</span>&#8221;, etc.) and architecture
                   3722:                 (&#8220;<span class="quote">mipsel</span>&#8221;,
                   3723:                 etc.).</p>
                   3724:               </li>
                   3725: 
                   3726:               <li>
                   3727:                 <p><code class="varname">PKGMAKECONF</code>:
                   3728:                 Location of the <code xmlns=
                   3729:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3730:                 "filename">mk.conf</code> file used by a package's
                   3731:                 BSD-style Makefile. If this is not set,
                   3732:                 <code class="varname">MAKECONF</code> is set to
                   3733:                 <code xmlns=
                   3734:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3735:                 "filename">/dev/null</code> to avoid picking up
                   3736:                 settings used by builds in <code xmlns=
                   3737:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3738:                 "filename">/usr/src</code>.</p>
                   3739:               </li>
                   3740:             </ul>
                   3741:           </div>
                   3742:         </div>
                   3743: 
1.66    ! rillig   3744:         <div class="sect1" lang="en" xml:lang="en">
1.45      wiz      3745:           <div class="titlepage">
                   3746:             <div>
                   3747:               <div>
                   3748:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   3749:                 "developer-advanced-settings" id=
1.45      wiz      3750:                 "developer-advanced-settings"></a>5.3.&nbsp;Developer/advanced
                   3751:                 settings</h2>
                   3752:               </div>
                   3753:             </div>
                   3754:           </div>
                   3755: 
                   3756:           <p>XXX</p>
                   3757: 
                   3758:           <div class="itemizedlist">
                   3759:             <ul type="disc">
                   3760:               <li>
                   3761:                 <p><code class="varname">PKG_DEVELOPER</code>: Run
                   3762:                 some sanity checks that package developers
                   3763:                 want:</p>
                   3764: 
                   3765:                 <div class="itemizedlist">
                   3766:                   <ul type="circle">
                   3767:                     <li>
                   3768:                       <p>make sure patches apply with zero fuzz</p>
                   3769:                     </li>
                   3770: 
                   3771:                     <li>
                   3772:                       <p>run check-shlibs to see that all binaries
                   3773:                       will find their shared libs.</p>
                   3774:                     </li>
                   3775:                   </ul>
                   3776:                 </div>
                   3777:               </li>
                   3778: 
                   3779:               <li>
                   3780:                 <p><code class="varname">PKG_DEBUG_LEVEL</code>:
                   3781:                 The level of debugging output which is displayed
                   3782:                 whilst making and installing the package. The
                   3783:                 default value for this is 0, which will not display
                   3784:                 the commands as they are executed (normal, default,
                   3785:                 quiet operation); the value 1 will display all
                   3786:                 shell commands before their invocation, and the
                   3787:                 value 2 will display both the shell commands before
                   3788:                 their invocation, and their actual execution
                   3789:                 progress with <span><strong class="command">set
                   3790:                 -x</strong></span> will be displayed.</p>
                   3791:               </li>
1.58      erh      3792: 
                   3793:               <li>
                   3794:                 <p><code class=
                   3795:                 "varname">ALLOW_VULNERABILITIES.<em class=
                   3796:                 "replaceable"><code>pkgbase</code></em></code>: A
                   3797:                 space separated list of vulnerability IDs that may
                   3798:                 be ignored when performing the automated security
                   3799:                 checks. These IDs are listed in the
                   3800:                 pkg-vulnerabilities file and are displayed by
                   3801:                 <span><strong class=
                   3802:                 "command">audit-packages</strong></span> when it
                   3803:                 finds a vulnerable package.</p>
                   3804:               </li>
                   3805: 
                   3806:               <li>
                   3807:                 <p><code class=
                   3808:                 "varname">SKIP_AUDIT_PACKAGES</code>: If this is
                   3809:                 set to &#8220;<span class=
                   3810:                 "quote">yes</span>&#8221;, the automated security
                   3811:                 checks (which use the <a xmlns=
                   3812:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3813:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
                   3814:                 target="_top"><code xmlns="" class=
                   3815:                 "filename">security/audit-packages</code></a>
                   3816:                 package) will be <span class=
                   3817:                 "strong"><strong>entirely</strong></span> skipped
                   3818:                 for <span class=
                   3819:                 "strong"><strong>all</strong></span> packages
                   3820:                 built. Normally you'll want to use
                   3821:                 ALLOW_VULNERABILITIES instead of this.</p>
                   3822:               </li>
1.45      wiz      3823:             </ul>
                   3824:           </div>
                   3825:         </div>
                   3826: 
1.66    ! rillig   3827:         <div class="sect1" lang="en" xml:lang="en">
1.45      wiz      3828:           <div class="titlepage">
                   3829:             <div>
                   3830:               <div>
                   3831:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   3832:                 "selecting-build-options" id=
1.45      wiz      3833:                 "selecting-build-options"></a>5.4.&nbsp;Selecting
                   3834:                 Build Options</h2>
1.38      dillo    3835:               </div>
                   3836:             </div>
                   3837:           </div>
                   3838: 
                   3839:           <p>Some packages have build time options, usually to
                   3840:           select between different dependencies, enable optional
                   3841:           support for big dependencies or enable experimental
                   3842:           features.</p>
                   3843: 
                   3844:           <p>To see which options, if any, a package supports, and
                   3845:           which options are mutually exclusive, run
                   3846:           <span><strong class="command">make
                   3847:           show-options</strong></span>, for example:</p>
                   3848:           <pre class="programlisting">
1.51      rillig   3849:     The following options are supported by this package:
                   3850:     ssl      Enable SSL support.
                   3851:     Exactly one of the following gecko options is required:
                   3852:     firefox  Use firefox as gecko rendering engine.
                   3853:     mozilla  Use mozilla as gecko rendering engine.
                   3854:     At most one of the following database options may be selected:
                   3855:     mysql    Enable support for MySQL database.
                   3856:     pgsql    Enable support for PostgreSQL database.
                   3857: 
                   3858:     These options are enabled by default: firefox
                   3859:     These options are currently enabled: mozilla ssl
1.38      dillo    3860: </pre>
                   3861: 
1.45      wiz      3862:           <p>The following variables can be defined in <code xmlns=
                   3863:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.38      dillo    3864:           "filename">/etc/mk.conf</code> to select which options to
                   3865:           enable for a package: <code class=
                   3866:           "varname">PKG_DEFAULT_OPTIONS</code>, which can be used
                   3867:           to select or disable options for all packages that
                   3868:           support them, and <code class=
                   3869:           "varname">PKG_OPTIONS.<em class=
                   3870:           "replaceable"><code>pkgbase</code></em></code>, which can
                   3871:           be used to select or disable options specifically for
                   3872:           package <em class=
                   3873:           "replaceable"><code>pkgbase</code></em>. Options listed
                   3874:           in these variables are selected, options preceded by
                   3875:           &#8220;<span class="quote">-</span>&#8221; are
                   3876:           disabled.</p>
                   3877: 
1.39      dillo    3878:           <p>The following settings are consulted in the order
                   3879:           given, and the last setting that selects or disables an
                   3880:           option is used:</p>
1.38      dillo    3881: 
                   3882:           <div class="orderedlist">
                   3883:             <ol type="1">
                   3884:               <li>
                   3885:                 <p>the default options as suggested by the package
                   3886:                 maintainer</p>
                   3887:               </li>
                   3888: 
                   3889:               <li>
                   3890:                 <p>the options implied by the settings of legacy
                   3891:                 variables (see below)</p>
                   3892:               </li>
                   3893: 
                   3894:               <li>
                   3895:                 <p><code class=
                   3896:                 "varname">PKG_DEFAULT_OPTIONS</code></p>
                   3897:               </li>
                   3898: 
                   3899:               <li>
                   3900:                 <p><code class="varname">PKG_OPTIONS.<em class=
                   3901:                 "replaceable"><code>pkgbase</code></em></code></p>
                   3902:               </li>
                   3903:             </ol>
                   3904:           </div>
                   3905: 
                   3906:           <p>For groups of mutually exclusive options, the last
                   3907:           option selected is used, all others are automatically
                   3908:           disabled. If an option of the group is explicitly
                   3909:           disabled, the previously selected option, if any, is
                   3910:           used. It is an error if no option from a required group
                   3911:           of options is selected, and building the package will
                   3912:           fail.</p>
                   3913: 
                   3914:           <p>Before the options framework was introduced, build
1.65      hubertf  3915:           options were selected by setting a variable (often named
                   3916:           <code class="varname">USE_<em class=
                   3917:           "replaceable"><code>FOO</code></em></code>) in
1.45      wiz      3918:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3919:           class="filename">/etc/mk.conf</code> for each option. To
                   3920:           ease transition to the options framework for the user,
                   3921:           these legacy variables are converted to the appropriate
1.65      hubertf  3922:           options setting (<code class=
                   3923:           "varname">PKG_OPTIONS.<em class=
                   3924:           "replaceable"><code>pkgbase</code></em></code>)
                   3925:           automatically. A warning is issued to prompt the user to
                   3926:           update <code xmlns=
1.45      wiz      3927:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.38      dillo    3928:           "filename">/etc/mk.conf</code> to use the options
1.65      hubertf  3929:           framework directly. Support for the legacy variables will
                   3930:           be removed eventually.</p>
1.38      dillo    3931:         </div>
                   3932:       </div>
                   3933: 
1.66    ! rillig   3934:       <div class="chapter" lang="en" xml:lang="en">
1.38      dillo    3935:         <div class="titlepage">
                   3936:           <div>
                   3937:             <div>
1.66    ! rillig   3938:               <h2 class="title"><a name="binary" id=
1.38      dillo    3939:               "binary"></a>Chapter&nbsp;6.&nbsp;Creating binary
1.1       grant    3940:               packages</h2>
                   3941:             </div>
                   3942:           </div>
                   3943:         </div>
                   3944: 
                   3945:         <div class="toc">
                   3946:           <p><b>Table of Contents</b></p>
                   3947: 
                   3948:           <dl>
1.30      wiz      3949:             <dt><span class="sect1"><a href=
1.38      dillo    3950:             "#building-a-single-binary-package">6.1. Building a
1.30      wiz      3951:             single binary package</a></span></dt>
1.1       grant    3952: 
1.30      wiz      3953:             <dt><span class="sect1"><a href=
1.38      dillo    3954:             "#settings-for-creationg-of-binary-packages">6.2.
1.1       grant    3955:             Settings for creation of binary
                   3956:             packages</a></span></dt>
                   3957: 
1.38      dillo    3958:             <dt><span class="sect1"><a href="#bulkbuild">6.3. Doing
1.1       grant    3959:             a bulk build of all packages</a></span></dt>
                   3960: 
                   3961:             <dd>
                   3962:               <dl>
                   3963:                 <dt><span class="sect2"><a href=
1.38      dillo    3964:                 "#binary.configuration">6.3.1.
1.1       grant    3965:                 Configuration</a></span></dt>
                   3966: 
1.30      wiz      3967:                 <dt><span class="sect2"><a href=
1.38      dillo    3968:                 "#other-environmental-considerations">6.3.2. Other
1.30      wiz      3969:                 environmental considerations</a></span></dt>
1.1       grant    3970: 
1.38      dillo    3971:                 <dt><span class="sect2"><a href="#operation">6.3.3.
1.1       grant    3972:                 Operation</a></span></dt>
                   3973: 
1.30      wiz      3974:                 <dt><span class="sect2"><a href=
1.38      dillo    3975:                 "#what-it-does">6.3.4. What it does</a></span></dt>
1.1       grant    3976: 
1.30      wiz      3977:                 <dt><span class="sect2"><a href=
1.38      dillo    3978:                 "#disk-space-requirements">6.3.5. Disk space
1.30      wiz      3979:                 requirements</a></span></dt>
1.1       grant    3980: 
1.30      wiz      3981:                 <dt><span class="sect2"><a href=
1.38      dillo    3982:                 "#setting-up-a-sandbox">6.3.6. Setting up a sandbox
1.47      reed     3983:                 for chrooted builds</a></span></dt>
1.1       grant    3984: 
1.30      wiz      3985:                 <dt><span class="sect2"><a href=
1.38      dillo    3986:                 "#building-a-partial-set">6.3.7. Building a partial
1.30      wiz      3987:                 set of packages</a></span></dt>
1.13      hubertf  3988: 
                   3989:                 <dt><span class="sect2"><a href=
1.38      dillo    3990:                 "#bulk-upload">6.3.8. Uploading results of a bulk
1.13      hubertf  3991:                 build</a></span></dt>
1.1       grant    3992:               </dl>
                   3993:             </dd>
                   3994: 
1.38      dillo    3995:             <dt><span class="sect1"><a href="#creating-cdroms">6.4.
1.1       grant    3996:             Creating a multiple CD-ROM packages
                   3997:             collection</a></span></dt>
                   3998: 
                   3999:             <dd>
                   4000:               <dl>
1.30      wiz      4001:                 <dt><span class="sect2"><a href=
1.38      dillo    4002:                 "#cdpack-example">6.4.1. Example of
1.30      wiz      4003:                 cdpack</a></span></dt>
1.1       grant    4004:               </dl>
                   4005:             </dd>
                   4006:           </dl>
                   4007:         </div>
                   4008: 
1.66    ! rillig   4009:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    4010:           <div class="titlepage">
                   4011:             <div>
                   4012:               <div>
                   4013:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   4014:                 "building-a-single-binary-package" id=
1.38      dillo    4015:                 "building-a-single-binary-package"></a>6.1.&nbsp;Building
1.30      wiz      4016:                 a single binary package</h2>
1.1       grant    4017:               </div>
                   4018:             </div>
                   4019:           </div>
                   4020: 
                   4021:           <p>Once you have built and installed a package, you can
                   4022:           create a <span class="emphasis"><em>binary
                   4023:           package</em></span> which can be installed on another
                   4024:           system with <a href=
                   4025:           "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   4026:           <span class="citerefentry"><span class=
1.47      reed     4027:           "refentrytitle">pkg_add</span>(1)</span></a>. This saves
1.1       grant    4028:           having to build the same package on a group of hosts and
                   4029:           wasting CPU time. It also provides a simple means for
                   4030:           others to install your package, should you distribute
                   4031:           it.</p>
                   4032: 
                   4033:           <p>To create a binary package, change into the
1.14      xtraeme  4034:           appropriate directory in pkgsrc, and run
                   4035:           <span><strong class="command">make
                   4036:           package</strong></span>:</p>
1.1       grant    4037:           <pre class="screen">
1.14      xtraeme  4038: <code class="prompt">#</code> <strong class=
                   4039: "userinput"><code>cd misc/figlet</code></strong>
                   4040: <code class="prompt">#</code> <strong class=
                   4041: "userinput"><code>make package</code></strong>
1.1       grant    4042: </pre>
                   4043: 
                   4044:           <p>This will build and install your package (if not
                   4045:           already done), and then build a binary package from what
1.14      xtraeme  4046:           was installed. You can then use the <span><strong class=
                   4047:           "command">pkg_*</strong></span> tools to manipulate it.
1.45      wiz      4048:           Binary packages are created by default in <code xmlns=
                   4049:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4050:           "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1       grant    4051:           gzipped tar file. See <a href="#logs.package" title=
1.66    ! rillig   4052:           "B.2.&nbsp;Packaging figlet">Section B.2,
1.1       grant    4053:           &#8220;Packaging figlet&#8221;</a> for a continuation of
                   4054:           the above <a xmlns=
                   4055:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4056:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.45      wiz      4057:           target="_top"><code xmlns="" class=
                   4058:           "filename">misc/figlet</code></a> example.</p>
1.1       grant    4059: 
                   4060:           <p>See <a href="#submit" title=
1.66    ! rillig   4061:           "Chapter&nbsp;17.&nbsp;Submitting and Committing">Chapter
        !          4062:           17, <i>Submitting and Committing</i></a> for information
        !          4063:           on how to submit such a binary package.</p>
1.1       grant    4064:         </div>
                   4065: 
1.66    ! rillig   4066:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    4067:           <div class="titlepage">
                   4068:             <div>
                   4069:               <div>
                   4070:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   4071:                 "settings-for-creationg-of-binary-packages" id=
1.38      dillo    4072:                 "settings-for-creationg-of-binary-packages"></a>6.2.&nbsp;Settings
1.1       grant    4073:                 for creation of binary packages</h2>
                   4074:               </div>
                   4075:             </div>
                   4076:           </div>
                   4077: 
                   4078:           <p>See <a href="#build.helpful-targets" title=
1.56      rillig   4079:           "14.16.&nbsp;Other helpful targets">Section&nbsp;14.16,
1.1       grant    4080:           &#8220;Other helpful targets&#8221;</a>.</p>
                   4081:         </div>
                   4082: 
1.66    ! rillig   4083:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    4084:           <div class="titlepage">
                   4085:             <div>
                   4086:               <div>
                   4087:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   4088:                 "bulkbuild" id="bulkbuild"></a>6.3.&nbsp;Doing a
        !          4089:                 bulk build of all packages</h2>
1.1       grant    4090:               </div>
                   4091:             </div>
                   4092:           </div>
                   4093: 
                   4094:           <p>If you want to get a full set of precompiled binary
                   4095:           packages, this section describes how to get them. Beware
                   4096:           that the bulk build will remove all currently installed
1.63      dillo    4097:           packages from your system!</p>
                   4098: 
                   4099:           <p>Having an FTP server configured either on the machine
                   4100:           doing the bulk builds or on a nearby NFS server can help
                   4101:           to make the packages available to other machines that can
                   4102:           then save time by installing only the binary packages.
                   4103:           See <a href=
1.1       grant    4104:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
                   4105:           <span class="citerefentry"><span class=
                   4106:           "refentrytitle">ftpd</span>(8)</span></a> for more
                   4107:           information. If you use a remote NFS server's storage, be
                   4108:           sure to not actually compile on NFS storage, as this
                   4109:           slows things down a lot.</p>
                   4110: 
1.66    ! rillig   4111:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    4112:             <div class="titlepage">
                   4113:               <div>
                   4114:                 <div>
1.66    ! rillig   4115:                   <h3 class="title"><a name="binary.configuration"
        !          4116:                   id=
1.38      dillo    4117:                   "binary.configuration"></a>6.3.1.&nbsp;Configuration</h3>
1.1       grant    4118:                 </div>
                   4119:               </div>
                   4120:             </div>
                   4121: 
1.66    ! rillig   4122:             <div class="sect3" lang="en" xml:lang="en">
1.1       grant    4123:               <div class="titlepage">
                   4124:                 <div>
                   4125:                   <div>
1.63      dillo    4126:                     <h4 class="title"><a name=
1.66    ! rillig   4127:                     "binary.bulk.build.conf" id=
1.63      dillo    4128:                     "binary.bulk.build.conf"></a>6.3.1.1.&nbsp;<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4129:                     class="filename">build.conf</code></h4>
                   4130:                   </div>
                   4131:                 </div>
                   4132:               </div>
                   4133: 
                   4134:               <p>The <code xmlns=
                   4135:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4136:               "filename">build.conf</code> file is the main
                   4137:               configuration file for bulk builds. You can configure
                   4138:               how your copy of pkgsrc is kept up to date, how the
                   4139:               distfiles are downloaded, how the packages are built
                   4140:               and how the report is generated. You can find an
                   4141:               annotated example file in <code xmlns=
                   4142:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4143:               "filename">pkgsrc/mk/bulk/build.conf-example</code>.
                   4144:               To use it, copy <code xmlns=
                   4145:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4146:               "filename">build.conf-example</code> to <code xmlns=
                   4147:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4148:               "filename">build.conf</code> and edit it, following
                   4149:               the comments in that file.</p>
                   4150:             </div>
                   4151: 
1.66    ! rillig   4152:             <div class="sect3" lang="en" xml:lang="en">
1.63      dillo    4153:               <div class="titlepage">
                   4154:                 <div>
                   4155:                   <div>
1.66    ! rillig   4156:                     <h4 class="title"><a name="binary.mk.conf" id=
1.63      dillo    4157:                     "binary.mk.conf"></a>6.3.1.2.&nbsp;/etc/mk.conf</h4>
1.1       grant    4158:                   </div>
                   4159:                 </div>
                   4160:               </div>
                   4161: 
1.45      wiz      4162:               <p>You may want to set variables in <code xmlns=
                   4163:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4164:               "filename">/etc/mk.conf</code>. Look at <code xmlns=
                   4165:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4166:               "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1       grant    4167:               details of the default settings. You will want to
1.14      xtraeme  4168:               ensure that <code class=
                   4169:               "varname">ACCEPTABLE_LICENSES</code> meet your local
                   4170:               policy. As used in this example, <code class=
                   4171:               "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1       grant    4172:               "emphasis"><em>all</em></span> licenses.</p>
                   4173:               <pre class="programlisting">
1.51      rillig   4174:     PACKAGES?=      ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
                   4175:     WRKOBJDIR?=     /usr/tmp/pkgsrc   # build here instead of in pkgsrc
                   4176:     BSDSRCDIR=      /usr/src
                   4177:     BSDXSRCDIR=     /usr/xsrc         # for x11/xservers
                   4178:     OBJHOSTNAME?=   yes               # use work.`hostname`
                   4179:     FAILOVER_FETCH= yes               # insist on the correct checksum
                   4180:     PKG_DEVELOPER?= yes
                   4181:     _ACCEPTABLE=    yes
1.1       grant    4182: </pre>
                   4183: 
1.63      dillo    4184:               <p>Some options that are especially useful for bulk
                   4185:               builds can be found at the top lines of the file
                   4186:               <code xmlns=
                   4187:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4188:               "filename">mk/bulk/bsd.bulk-pkg.mk</code>. The most
                   4189:               useful options of these are briefly described
                   4190:               here.</p>
                   4191: 
                   4192:               <div class="itemizedlist">
                   4193:                 <ul type="disc">
                   4194:                   <li>
                   4195:                     <p>If you are on a slow machine, you may want
                   4196:                     to set <code class=
                   4197:                     "varname">USE_BULK_BROKEN_CHECK</code> to
                   4198:                     &#8220;<span class=
                   4199:                     "quote">no</span>&#8221;.</p>
                   4200:                   </li>
                   4201: 
                   4202:                   <li>
                   4203:                     <p>If you are doing bulk builds from a
                   4204:                     read-only copy of pkgsrc, you have to set
                   4205:                     <code class="varname">BULKFILESDIR</code> to
                   4206:                     the directory where all log files are created.
                   4207:                     Otherwise the log files are created in the
                   4208:                     pkgsrc directory.</p>
                   4209:                   </li>
                   4210: 
                   4211:                   <li>
                   4212:                     <p>Another important variable is <code class=
                   4213:                     "varname">BULK_PREREQ</code>, which is a list
                   4214:                     of packages that should be always available
                   4215:                     while building other packages.</p>
                   4216:                   </li>
                   4217:                 </ul>
1.1       grant    4218:               </div>
1.66    ! rillig   4219: 
        !          4220:               <p>Some other options are scattered in the pkgsrc
        !          4221:               infrastructure:</p>
        !          4222: 
        !          4223:               <div class="itemizedlist">
        !          4224:                 <ul type="disc">
        !          4225:                   <li>
        !          4226:                     <p><code class="varname">CHECK_FILES</code> can
        !          4227:                     be set to &#8220;<span class=
        !          4228:                     "quote">yes</span>&#8221; to check that the
        !          4229:                     installed set of files matches the <code xmlns=
        !          4230:                     "http://www.w3.org/TR/xhtml1/transitional"
        !          4231:                     class="filename">PLIST</code>.</p>
        !          4232:                   </li>
        !          4233: 
        !          4234:                   <li>
        !          4235:                     <p><code class=
        !          4236:                     "varname">CHECK_INTERPRETER</code> can be set
        !          4237:                     to &#8220;<span class="quote">yes</span>&#8221;
        !          4238:                     to check that the installed &#8220;<span class=
        !          4239:                     "quote">#!</span>&#8221;-scripts will find
        !          4240:                     their interpreter.</p>
        !          4241:                   </li>
        !          4242:                 </ul>
        !          4243:               </div>
1.1       grant    4244:             </div>
                   4245: 
1.66    ! rillig   4246:             <div class="sect3" lang="en" xml:lang="en">
1.1       grant    4247:               <div class="titlepage">
                   4248:                 <div>
                   4249:                   <div>
1.66    ! rillig   4250:                     <h4 class="title"><a name="pre-build.local" id=
1.45      wiz      4251:                     "pre-build.local"></a>6.3.1.3.&nbsp;<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4252:                     class="filename">pre-build.local</code></h4>
1.1       grant    4253:                   </div>
                   4254:                 </div>
                   4255:               </div>
                   4256: 
                   4257:               <p>It is possible to configure the bulk build to
1.47      reed     4258:               perform certain site-specific tasks at the end of the
1.45      wiz      4259:               pre-build stage. If the file <code xmlns=
                   4260:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4261:               "filename">pre-build.local</code> exists in
1.45      wiz      4262:               <code xmlns=
                   4263:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4264:               "filename">/usr/pkgsrc/mk/bulk</code>, it will be
                   4265:               executed (as a <a href=
1.24      wiz      4266:               "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
                   4267:               <span class="citerefentry"><span class=
                   4268:               "refentrytitle">sh</span>(1)</span></a> script) at
                   4269:               the end of the usual pre-build stage. An example use
1.45      wiz      4270:               of <code xmlns=
                   4271:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4272:               "filename">pre-build.local</code> is to have the
                   4273:               line:</p>
1.1       grant    4274:               <pre class="screen">
1.14      xtraeme  4275: <code class="prompt">#</code> <strong class=
                   4276: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23      wiz      4277:     &gt; pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1       grant    4278: </pre>
                   4279: 
                   4280:               <p>to prevent the system from trying to build a
                   4281:               particular package which requires nearly 3 GB of disk
                   4282:               space.</p>
                   4283:             </div>
                   4284:           </div>
                   4285: 
1.66    ! rillig   4286:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    4287:             <div class="titlepage">
                   4288:               <div>
                   4289:                 <div>
1.30      wiz      4290:                   <h3 class="title"><a name=
1.66    ! rillig   4291:                   "other-environmental-considerations" id=
1.38      dillo    4292:                   "other-environmental-considerations"></a>6.3.2.&nbsp;Other
1.30      wiz      4293:                   environmental considerations</h3>
1.1       grant    4294:                 </div>
                   4295:               </div>
                   4296:             </div>
                   4297: 
1.45      wiz      4298:             <p>As <code xmlns=
                   4299:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4300:             "filename">/usr/pkg</code> will be completely deleted
                   4301:             at the start of bulk builds, make sure your login shell
                   4302:             is placed somewhere else. Either drop it into
                   4303:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4304:             class="filename">/usr/local/bin</code> (and adjust your
                   4305:             login shell in the passwd file), or (re-)install it via
1.14      xtraeme  4306:             <a href=
1.1       grant    4307:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   4308:             <span class="citerefentry"><span class=
                   4309:             "refentrytitle">pkg_add</span>(1)</span></a> from
1.45      wiz      4310:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4311:             class="filename">/etc/rc.local</code>, so you can login
                   4312:             after a reboot (remember that your current process
                   4313:             won't die if the package is removed, you just can't
                   4314:             start any new instances of the shell any more). Also,
                   4315:             if you use NetBSD earlier than 1.5, or you still want
                   4316:             to use the pkgsrc version of ssh for some reason, be
                   4317:             sure to install ssh before starting it from
                   4318:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4319:             class="filename">rc.local</code>:</p>
1.1       grant    4320:             <pre class="programlisting">
1.51      rillig   4321:     ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
                   4322:     if [ -f /usr/pkg/etc/rc.d/sshd ]; then
                   4323:         /usr/pkg/etc/rc.d/sshd
                   4324:     fi
1.1       grant    4325: </pre>
                   4326: 
                   4327:             <p>Not doing so will result in you being not able to
                   4328:             log in via ssh after the bulk build is finished or if
                   4329:             the machine gets rebooted or crashes. You have been
                   4330:             warned! :)</p>
                   4331:           </div>
                   4332: 
1.66    ! rillig   4333:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    4334:             <div class="titlepage">
                   4335:               <div>
                   4336:                 <div>
1.66    ! rillig   4337:                   <h3 class="title"><a name="operation" id=
1.38      dillo    4338:                   "operation"></a>6.3.3.&nbsp;Operation</h3>
1.1       grant    4339:                 </div>
                   4340:               </div>
                   4341:             </div>
                   4342: 
                   4343:             <p>Make sure you don't need any of the packages still
                   4344:             installed.</p>
                   4345: 
                   4346:             <div class="warning" style=
                   4347:             "margin-left: 0.5in; margin-right: 0.5in;">
                   4348:               <h3 class="title">Warning</h3>
                   4349: 
                   4350:               <p>During the bulk build, <span class=
                   4351:               "emphasis"><em>all packages will be
                   4352:               removed!</em></span></p>
                   4353:             </div>
                   4354: 
                   4355:             <p>Be sure to remove all other things that might
                   4356:             interfere with builds, like some libs installed in
1.45      wiz      4357:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4358:             class="filename">/usr/local</code>, etc. then become
                   4359:             root and type:</p>
1.1       grant    4360:             <pre class="screen">
1.14      xtraeme  4361: <code class="prompt">#</code> <strong class=
                   4362: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   4363: <code class="prompt">#</code> <strong class=
                   4364: "userinput"><code>sh mk/bulk/build</code></strong>
1.1       grant    4365: </pre>
                   4366: 
                   4367:             <p>If for some reason your last build didn't complete
                   4368:             (power failure, system panic, ...), you can continue it
                   4369:             by running:</p>
                   4370:             <pre class="screen">
1.14      xtraeme  4371: <code class="prompt">#</code> <strong class=
                   4372: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1       grant    4373: </pre>
                   4374: 
                   4375:             <p>At the end of the bulk build, you will get a summary
                   4376:             via mail, and find build logs in the directory
1.14      xtraeme  4377:             specified by <code class="varname">FTP</code> in the
1.45      wiz      4378:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4379:             class="filename">build.conf</code> file.</p>
1.1       grant    4380:           </div>
                   4381: 
1.66    ! rillig   4382:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    4383:             <div class="titlepage">
                   4384:               <div>
                   4385:                 <div>
1.66    ! rillig   4386:                   <h3 class="title"><a name="what-it-does" id=
1.38      dillo    4387:                   "what-it-does"></a>6.3.4.&nbsp;What it does</h3>
1.1       grant    4388:                 </div>
                   4389:               </div>
                   4390:             </div>
                   4391: 
                   4392:             <p>The bulk builds consist of three steps:</p>
                   4393: 
                   4394:             <div class="variablelist">
                   4395:               <dl>
                   4396:                 <dt><span class="term">1. pre-build</span></dt>
                   4397: 
                   4398:                 <dd>
                   4399:                   <p>The script updates your pkgsrc tree via
                   4400:                   (anon)cvs, then cleans out any broken distfiles,
                   4401:                   and removes all packages installed.</p>
                   4402:                 </dd>
                   4403: 
                   4404:                 <dt><span class="term">2. the bulk
                   4405:                 build</span></dt>
                   4406: 
                   4407:                 <dd>
                   4408:                   <p>This is basically &#8220;<span class=
                   4409:                   "quote">make bulk-package</span>&#8221; with an
                   4410:                   optimised order in which packages will be built.
                   4411:                   Packages that don't require other packages will
                   4412:                   be built first, and packages with many
                   4413:                   dependencies will be built later.</p>
                   4414:                 </dd>
                   4415: 
                   4416:                 <dt><span class="term">3. post-build</span></dt>
                   4417: 
                   4418:                 <dd>
                   4419:                   <p>Generates a report that's placed in the
1.45      wiz      4420:                   directory specified in the <code xmlns=
                   4421:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4422:                   "filename">build.conf</code> file named
1.45      wiz      4423:                   <code xmlns=
                   4424:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4425:                   "filename">broken.html</code>, a short version of
                   4426:                   that report will also be mailed to the build's
                   4427:                   admin.</p>
1.1       grant    4428:                 </dd>
                   4429:               </dl>
                   4430:             </div>
                   4431: 
                   4432:             <p>During the build, a list of broken packages will be
1.45      wiz      4433:             compiled in <code xmlns=
                   4434:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4435:             "filename">/usr/pkgsrc/.broken</code> (or <code xmlns=
                   4436:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4437:             "filename">.../.broken.${MACHINE}</code> if
                   4438:             <code class="varname">OBJMACHINE</code> is set),
                   4439:             individual build logs of broken builds can be found in
                   4440:             the package's directory. These files are used by the
                   4441:             bulk-targets to mark broken builds to not waste time
                   4442:             trying to rebuild them, and they can be used to debug
                   4443:             these broken package builds later.</p>
1.1       grant    4444:           </div>
                   4445: 
1.66    ! rillig   4446:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    4447:             <div class="titlepage">
                   4448:               <div>
                   4449:                 <div>
1.30      wiz      4450:                   <h3 class="title"><a name=
1.66    ! rillig   4451:                   "disk-space-requirements" id=
1.38      dillo    4452:                   "disk-space-requirements"></a>6.3.5.&nbsp;Disk
1.30      wiz      4453:                   space requirements</h3>
1.1       grant    4454:                 </div>
                   4455:               </div>
                   4456:             </div>
                   4457: 
                   4458:             <p>Currently, roughly the following requirements are
                   4459:             valid for NetBSD 2.0/i386:</p>
                   4460: 
                   4461:             <div class="itemizedlist">
                   4462:               <ul type="disc">
                   4463:                 <li>
                   4464:                   <p>10 GB - distfiles (NFS ok)</p>
                   4465:                 </li>
                   4466: 
                   4467:                 <li>
                   4468:                   <p>8 GB - full set of all binaries (NFS ok)</p>
                   4469:                 </li>
                   4470: 
                   4471:                 <li>
                   4472:                   <p>5 GB - temp space for compiling (local disk
                   4473:                   recommended)</p>
                   4474:                 </li>
                   4475:               </ul>
                   4476:             </div>
                   4477: 
                   4478:             <p>Note that all pkgs will be de-installed as soon as
                   4479:             they are turned into a binary package, and that sources
                   4480:             are removed, so there is no excessively huge demand to
                   4481:             disk space. Afterwards, if the package is needed again,
                   4482:             it will be installed via <a href=
                   4483:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   4484:             <span class="citerefentry"><span class=
                   4485:             "refentrytitle">pkg_add</span>(1)</span></a> instead of
                   4486:             building again, so there are no cycles wasted by
                   4487:             recompiling.</p>
                   4488:           </div>
                   4489: 
1.66    ! rillig   4490:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    4491:             <div class="titlepage">
                   4492:               <div>
                   4493:                 <div>
1.66    ! rillig   4494:                   <h3 class="title"><a name="setting-up-a-sandbox"
        !          4495:                   id="setting-up-a-sandbox"></a>6.3.6.&nbsp;Setting
        !          4496:                   up a sandbox for chrooted builds</h3>
1.1       grant    4497:                 </div>
                   4498:               </div>
                   4499:             </div>
                   4500: 
1.12      agc      4501:             <p>If you don't want all the packages nuked from a
                   4502:             machine (rendering it useless for anything but pkg
1.23      wiz      4503:             compiling), there is the possibility of doing the
                   4504:             package bulk build inside a chroot environment.</p>
1.12      agc      4505: 
                   4506:             <p>The first step is to set up a chroot sandbox, e.g.
1.45      wiz      4507:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4508:             class="filename">/usr/sandbox</code>. This can be done
                   4509:             by using null mounts, or manually.</p>
1.12      agc      4510: 
1.45      wiz      4511:             <p>There is a shell script called <code xmlns=
                   4512:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4513:             "filename">pkgsrc/mk/bulk/mksandbox</code> which will
                   4514:             set up the sandbox environment using null mounts. It
1.45      wiz      4515:             will also create a script called <code xmlns=
                   4516:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4517:             "filename">sandbox</code> in the root of the sandbox
1.12      agc      4518:             environment, which will allow the null mounts to be
1.14      xtraeme  4519:             activated using the <span><strong class=
                   4520:             "command">sandbox mount</strong></span> command and
                   4521:             deactivated using the <span><strong class=
                   4522:             "command">sandbox umount</strong></span> command.</p>
1.12      agc      4523: 
                   4524:             <p>To set up a sandbox environment by hand, after
                   4525:             extracting all the sets from a NetBSD installation or
1.14      xtraeme  4526:             doing a <span><strong class="command">make distribution
1.45      wiz      4527:             DESTDIR=/usr/sandbox</strong></span> in <code xmlns=
                   4528:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4529:             "filename">/usr/src/etc</code>, be sure the following
1.7       wiz      4530:             items are present and properly configured:</p>
1.1       grant    4531: 
                   4532:             <div class="procedure">
                   4533:               <ol type="1">
                   4534:                 <li>
                   4535:                   <p>Kernel</p>
                   4536:                   <pre class="screen">
1.14      xtraeme  4537: <code class="prompt">#</code> <strong class=
                   4538: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1       grant    4539: </pre>
                   4540:                 </li>
                   4541: 
                   4542:                 <li>
1.45      wiz      4543:                   <p><code xmlns=
                   4544:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4545:                   "filename">/dev/*</code></p>
1.1       grant    4546:                   <pre class="screen">
1.14      xtraeme  4547: <code class="prompt">#</code> <strong class=
                   4548: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1       grant    4549: </pre>
                   4550:                 </li>
                   4551: 
                   4552:                 <li>
1.45      wiz      4553:                   <p><code xmlns=
                   4554:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4555:                   "filename">/etc/resolv.conf</code> (for <a xmlns=
1.1       grant    4556:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   4557:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45      wiz      4558:                   target="_top"><code xmlns="" class=
                   4559:                   "filename">security/smtpd</code></a> and
                   4560:                   mail):</p>
1.1       grant    4561:                   <pre class="screen">
1.14      xtraeme  4562: <code class="prompt">#</code> <strong class=
                   4563: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1       grant    4564: </pre>
                   4565:                 </li>
                   4566: 
                   4567:                 <li>
                   4568:                   <p>Working(!) mail config (hostname,
                   4569:                   sendmail.cf):</p>
                   4570:                   <pre class="screen">
1.14      xtraeme  4571: <code class="prompt">#</code> <strong class=
                   4572: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1       grant    4573: </pre>
                   4574:                 </li>
                   4575: 
                   4576:                 <li>
1.45      wiz      4577:                   <p><code xmlns=
                   4578:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4579:                   "filename">/etc/localtime</code> (for <a xmlns=
1.1       grant    4580:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   4581:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45      wiz      4582:                   target="_top"><code xmlns="" class=
                   4583:                   "filename">security/smtpd</code></a>):</p>
1.1       grant    4584:                   <pre class="screen">
1.14      xtraeme  4585: <code class="prompt">#</code> <strong class=
                   4586: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1       grant    4587: </pre>
                   4588:                 </li>
                   4589: 
                   4590:                 <li>
1.45      wiz      4591:                   <p><code xmlns=
                   4592:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4593:                   "filename">/usr/src</code> (system sources, for
                   4594:                   <a xmlns=
1.1       grant    4595:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   4596:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.45      wiz      4597:                   target="_top"><code xmlns="" class=
                   4598:                   "filename">sysutils/aperture</code></a>,
                   4599:                   <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4600:                   href=
1.20      ben      4601:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
1.45      wiz      4602:                   target="_top"><code xmlns="" class=
                   4603:                   "filename">net/ppp-mppe</code></a>):</p>
1.1       grant    4604:                   <pre class="screen">
1.14      xtraeme  4605: <code class="prompt">#</code> <strong class=
                   4606: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
                   4607: <code class="prompt">#</code> <strong class=
1.23      wiz      4608: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1       grant    4609: </pre>
                   4610:                 </li>
                   4611: 
                   4612:                 <li>
1.45      wiz      4613:                   <p>Create <code xmlns=
                   4614:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4615:                   "filename">/var/db/pkg</code> (not part of
                   4616:                   default install):</p>
1.1       grant    4617:                   <pre class="screen">
1.14      xtraeme  4618: <code class="prompt">#</code> <strong class=
                   4619: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1       grant    4620: </pre>
                   4621:                 </li>
                   4622: 
                   4623:                 <li>
1.45      wiz      4624:                   <p>Create <code xmlns=
                   4625:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4626:                   "filename">/usr/pkg</code> (not part of default
                   4627:                   install):</p>
1.1       grant    4628:                   <pre class="screen">
1.14      xtraeme  4629: <code class="prompt">#</code> <strong class=
                   4630: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1       grant    4631: </pre>
                   4632:                 </li>
                   4633: 
                   4634:                 <li>
1.45      wiz      4635:                   <p>Checkout pkgsrc via cvs into <code xmlns=
                   4636:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4637:                   "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1       grant    4638:                   <pre class="screen">
1.14      xtraeme  4639: <code class="prompt">#</code> <strong class=
                   4640: "userinput"><code>cd /usr/sandbox/usr</code></strong>
                   4641: <code class="prompt">#</code> <strong class=
                   4642: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1       grant    4643: </pre>
                   4644: 
                   4645:                   <p>Do not mount/link this to the copy of your
                   4646:                   pkgsrc tree you do development in, as this will
                   4647:                   likely cause problems!</p>
                   4648:                 </li>
                   4649: 
                   4650:                 <li>
1.45      wiz      4651:                   <p>Make <code xmlns=
                   4652:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4653:                   "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.45      wiz      4654:                   and <code xmlns=
                   4655:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4656:                   "filename">.../distfiles</code> point somewhere
                   4657:                   appropriate. NFS- and/or nullfs-mounts may come
                   4658:                   in handy!</p>
1.1       grant    4659:                 </li>
                   4660: 
                   4661:                 <li>
1.45      wiz      4662:                   <p>Edit <code xmlns=
                   4663:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4664:                   "filename">/etc/mk.conf</code>, see <a href=
                   4665:                   "#binary.mk.conf" title=
1.63      dillo    4666:                   "6.3.1.2.&nbsp;/etc/mk.conf">Section&nbsp;6.3.1.2,
1.1       grant    4667:                   &#8220;/etc/mk.conf&#8221;</a>.</p>
                   4668:                 </li>
                   4669: 
                   4670:                 <li>
1.45      wiz      4671:                   <p>Adjust <code xmlns=
                   4672:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4673:                   "filename">mk/bulk/build.conf</code> to suit your
1.1       grant    4674:                   needs.</p>
                   4675:                 </li>
                   4676: 
                   4677:                 <li>
1.14      xtraeme  4678:                   <p>If you have set <code class=
1.45      wiz      4679:                   "varname">CVS_USER</code> in <code xmlns=
                   4680:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4681:                   "filename">build.conf</code>, make sure that
                   4682:                   account exists and can do a <span><strong class=
                   4683:                   "command">cvs ${CVS_FLAGS} update</strong></span>
1.1       grant    4684:                   properly!</p>
                   4685:                 </li>
                   4686:               </ol>
                   4687:             </div>
                   4688: 
1.47      reed     4689:             <p>When the chroot sandbox is set up, you can start the
1.1       grant    4690:             build with the following steps:</p>
                   4691:             <pre class="screen">
1.14      xtraeme  4692: <code class="prompt">#</code> <strong class=
                   4693: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
                   4694: <code class="prompt">#</code> <strong class=
                   4695: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1       grant    4696: </pre>
                   4697: 
                   4698:             <p>This will just jump inside the sandbox and start
                   4699:             building. At the end of the build, mail will be sent
                   4700:             with the results of the build. Created binary pkgs will
1.45      wiz      4701:             be in <code xmlns=
                   4702:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4703:             "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1       grant    4704:             (wherever that points/mounts to/from).</p>
                   4705:           </div>
                   4706: 
1.66    ! rillig   4707:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    4708:             <div class="titlepage">
                   4709:               <div>
                   4710:                 <div>
1.30      wiz      4711:                   <h3 class="title"><a name=
1.66    ! rillig   4712:                   "building-a-partial-set" id=
1.38      dillo    4713:                   "building-a-partial-set"></a>6.3.7.&nbsp;Building
1.30      wiz      4714:                   a partial set of packages</h3>
1.1       grant    4715:                 </div>
                   4716:               </div>
                   4717:             </div>
                   4718: 
                   4719:             <p>In addition to building a complete set of all
1.45      wiz      4720:             packages in pkgsrc, the <code xmlns=
                   4721:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4722:             "filename">pkgsrc/mk/bulk/build</code> script may be
                   4723:             used to build a subset of the packages contained in
1.47      reed     4724:             pkgsrc. By setting <code class=
1.45      wiz      4725:             "varname">SPECIFIC_PKGS</code> in <code xmlns=
                   4726:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4727:             "filename">/etc/mk.conf</code>, the variables</p>
1.1       grant    4728: 
                   4729:             <div class="itemizedlist">
                   4730:               <ul type="disc">
                   4731:                 <li>
                   4732:                   <p>SITE_SPECIFIC_PKGS</p>
                   4733:                 </li>
                   4734: 
                   4735:                 <li>
                   4736:                   <p>HOST_SPECIFIC_PKGS</p>
                   4737:                 </li>
                   4738: 
                   4739:                 <li>
                   4740:                   <p>GROUP_SPECIFIC_PKGS</p>
                   4741:                 </li>
                   4742: 
                   4743:                 <li>
                   4744:                   <p>USER_SPECIFIC_PKGS</p>
                   4745:                 </li>
                   4746:               </ul>
                   4747:             </div>
                   4748: 
                   4749:             <p>will define the set of packages which should be
                   4750:             built. The bulk build code will also include any
                   4751:             packages which are needed as dependencies for the
                   4752:             explicitly listed packages.</p>
                   4753: 
                   4754:             <p>One use of this is to do a bulk build with
1.14      xtraeme  4755:             <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1       grant    4756:             sandbox periodically to have a complete set of the
                   4757:             binary packages needed for your site available without
                   4758:             the overhead of building extra packages that are not
                   4759:             needed.</p>
                   4760:           </div>
1.13      hubertf  4761: 
1.66    ! rillig   4762:           <div class="sect2" lang="en" xml:lang="en">
1.13      hubertf  4763:             <div class="titlepage">
                   4764:               <div>
                   4765:                 <div>
1.66    ! rillig   4766:                   <h3 class="title"><a name="bulk-upload" id=
1.38      dillo    4767:                   "bulk-upload"></a>6.3.8.&nbsp;Uploading results
1.13      hubertf  4768:                   of a bulk build</h3>
                   4769:                 </div>
                   4770:               </div>
                   4771:             </div>
                   4772: 
                   4773:             <p>This section describes how pkgsrc developers can
                   4774:             upload binary pkgs built by bulk builds to
                   4775:             ftp.NetBSD.org.</p>
                   4776: 
1.17      sketch   4777:             <p>If you would like to automatically create checksum
                   4778:             files for the binary packages you intend to upload,
                   4779:             remember to set <code class="varname">MKSUMS=yes</code>
1.45      wiz      4780:             in your <code xmlns=
                   4781:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.17      sketch   4782:             "filename">mk/bulk/build.conf</code>.</p>
                   4783: 
                   4784:             <p>If you would like to PGP sign the checksum files
                   4785:             (highly recommended!), remember to set <code class=
                   4786:             "varname">SIGN_AS=username@NetBSD.org</code> in your
1.45      wiz      4787:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4788:             class="filename">mk/bulk/build.conf</code>. This will
                   4789:             prompt you for your GPG password to sign the files
1.17      sketch   4790:             before uploading everything.</p>
                   4791: 
                   4792:             <p>Then, make sure that you have <code class=
1.14      xtraeme  4793:             "varname">RSYNC_DST</code> set properly in your
1.45      wiz      4794:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4795:             class="filename">mk/bulk/build.conf</code> file, i.e.
                   4796:             adjust it to something like one of the following:</p>
1.13      hubertf  4797:             <pre class="screen">
                   4798: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   4799: </pre>
                   4800: 
1.47      reed     4801:             <p>Please use appropriate values for "pkgsrc-200xQy",
1.13      hubertf  4802:             "NetBSD-a.b.c" and "arch" here. If your login on
1.14      xtraeme  4803:             ftp.NetBSD.org is different from <code class=
                   4804:             "varname">CVS_USER</code>, write your login directly
                   4805:             into the variable, e.g. my local account is "feyrer",
                   4806:             but for my login "hubertf", I use:</p>
1.13      hubertf  4807:             <pre class="screen">
                   4808: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   4809: </pre>
                   4810: 
1.45      wiz      4811:             <p>A separate <code xmlns=
                   4812:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4813:             "filename">upload</code> directory is used here to
                   4814:             allow "closing" the directory during upload. To do so,
                   4815:             run the following command on ftp.NetBSD.org next:</p>
1.13      hubertf  4816:             <pre class="screen">
1.14      xtraeme  4817: nbftp% <strong class=
                   4818: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13      hubertf  4819: </pre>
                   4820: 
1.45      wiz      4821:             <p>Please note that <code xmlns=
                   4822:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4823:             "filename">/pub/NetBSD/packages</code> is only
1.13      hubertf  4824:             appropriate for packages for the NetBSD operating
                   4825:             system. Binary packages for other operating systems
1.45      wiz      4826:             should go into <code xmlns=
                   4827:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4828:             "filename">/pub/pkgsrc</code>.</p>
1.13      hubertf  4829: 
                   4830:             <p>Before uploading the binary pkgs, ssh authentication
1.47      reed     4831:             needs to be set up. This example shows how to set up
1.13      hubertf  4832:             temporary keys for the root account <span class=
                   4833:             "emphasis"><em>inside the sandbox</em></span> (assuming
                   4834:             that no keys should be present there usually):</p>
                   4835:             <pre class="screen">
1.14      xtraeme  4836: <code class="prompt">#</code> <strong class=
                   4837: "userinput"><code>chroot /usr/sandbox</code></strong>        
                   4838: chroot-<code class="prompt">#</code> <strong class=
                   4839: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>        
                   4840: chroot-<code class="prompt">#</code> <strong class=
                   4841: "userinput"><code>ssh-keygen -t dsa</code></strong>        
                   4842: chroot-<code class="prompt">#</code> <strong class=
                   4843: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong> 
1.13      hubertf  4844: </pre>
                   4845: 
1.45      wiz      4846:             <p>Now take the output of <code xmlns=
                   4847:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4848:             "filename">id-dsa.pub</code> and append it to your
1.45      wiz      4849:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4850:             class="filename">~/.ssh/authorized_keys</code> file on
                   4851:             ftp.NetBSD.org. You can remove the key after the upload
                   4852:             is done!</p>
1.13      hubertf  4853: 
                   4854:             <p>Next, test if your ssh connection really works:</p>
                   4855:             <pre class="screen">
1.14      xtraeme  4856: chroot-<code class="prompt">#</code> <strong class=
                   4857: "userinput"><code>ssh ftp.NetBSD.org date</code></strong> 
1.13      hubertf  4858: </pre>
                   4859: 
                   4860:             <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
                   4861: 
                   4862:             <p>Now after all this works, you can exit the sandbox
                   4863:             and start the upload:</p>
                   4864:             <pre class="screen">
1.14      xtraeme  4865: chroot-<code class="prompt">#</code> <strong class=
                   4866: "userinput"><code>exit</code></strong>        
                   4867: <code class="prompt">#</code> <strong class=
                   4868: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>        
                   4869: <code class="prompt">#</code> <strong class=
                   4870: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong> 
1.13      hubertf  4871: </pre>
                   4872: 
                   4873:             <p>The upload process may take quite some time. Use
1.24      wiz      4874:             <a href=
                   4875:             "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
                   4876:             <span class="citerefentry"><span class=
                   4877:             "refentrytitle">ls</span>(1)</span></a> or <a href=
                   4878:             "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
                   4879:             <span class="citerefentry"><span class=
                   4880:             "refentrytitle">du</span>(1)</span></a> on the FTP
                   4881:             server to monitor progress of the upload. The upload
                   4882:             script will take care of not uploading restricted
                   4883:             packages and putting vulnerable packages into the
1.45      wiz      4884:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4885:             class="filename">vulnerable</code> subdirectory.</p>
1.13      hubertf  4886: 
                   4887:             <p>After the upload has ended, first thing is to revoke
                   4888:             ssh access:</p>
                   4889:             <pre class="screen">
1.14      xtraeme  4890: nbftp% <strong class=
                   4891: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13      hubertf  4892: Gdd:x! 
                   4893: </pre>
                   4894: 
                   4895:             <p>Use whatever is needed to remove the key you've
                   4896:             entered before! Last, move the uploaded packages out of
1.45      wiz      4897:             the <code xmlns=
                   4898:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4899:             "filename">upload</code> directory to have them
                   4900:             accessible to everyone:</p>
1.13      hubertf  4901:             <pre class="screen">
1.14      xtraeme  4902: nbftp% <strong class=
                   4903: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
                   4904: nbftp% <strong class=
                   4905: "userinput"><code>mv upload/* .</code></strong>
                   4906: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
                   4907: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong> 
1.13      hubertf  4908: </pre>
                   4909:           </div>
1.1       grant    4910:         </div>
                   4911: 
1.66    ! rillig   4912:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    4913:           <div class="titlepage">
                   4914:             <div>
                   4915:               <div>
                   4916:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   4917:                 "creating-cdroms" id=
1.38      dillo    4918:                 "creating-cdroms"></a>6.4.&nbsp;Creating a multiple
1.30      wiz      4919:                 CD-ROM packages collection</h2>
1.1       grant    4920:               </div>
                   4921:             </div>
                   4922:           </div>
                   4923: 
                   4924:           <p>After your pkgsrc bulk-build has completed, you may
                   4925:           wish to create a CD-ROM set of the resulting binary
                   4926:           packages to assist in installing packages on other
                   4927:           machines. The <a xmlns=
                   4928:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4929:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.45      wiz      4930:           target="_top"><code xmlns="" class=
                   4931:           "filename">pkgtools/cdpack</code></a> package provides a
1.20      ben      4932:           simple tool for creating the ISO 9660 images.
                   4933:           <span><strong class="command">cdpack</strong></span>
                   4934:           arranges the packages on the CD-ROMs in a way that keeps
1.47      reed     4935:           all the dependencies for a given package on the same CD
                   4936:           as that package.</p>
1.1       grant    4937: 
1.66    ! rillig   4938:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    4939:             <div class="titlepage">
                   4940:               <div>
                   4941:                 <div>
1.66    ! rillig   4942:                   <h3 class="title"><a name="cdpack-example" id=
1.38      dillo    4943:                   "cdpack-example"></a>6.4.1.&nbsp;Example of
1.1       grant    4944:                   cdpack</h3>
                   4945:                 </div>
                   4946:               </div>
                   4947:             </div>
                   4948: 
                   4949:             <p>Complete documentation for cdpack is found in the
1.47      reed     4950:             cdpack(1) man page. The following short example assumes
1.45      wiz      4951:             that the binary packages are left in <code xmlns=
                   4952:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4953:             "filename">/usr/pkgsrc/packages/All</code> and that
1.45      wiz      4954:             sufficient disk space exists in <code xmlns=
                   4955:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4956:             "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1       grant    4957:             <pre class="screen">
1.14      xtraeme  4958: <code class="prompt">#</code> <strong class=
                   4959: "userinput"><code>mkdir /u2/images</code></strong>
                   4960: <code class="prompt">#</code> <strong class=
                   4961: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
                   4962: <code class="prompt">#</code> <strong class=
                   4963: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    4964: </pre>
                   4965: 
                   4966:             <p>If you wish to include a common set of files
1.45      wiz      4967:             (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4968:             class="filename">COPYRIGHT</code>, <code xmlns=
                   4969:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4970:             "filename">README</code>, etc.) on each CD in the
1.1       grant    4971:             collection, then you need to create a directory which
                   4972:             contains these files. e.g.</p>
                   4973:             <pre class="screen">
1.14      xtraeme  4974: <code class="prompt">#</code> <strong class=
                   4975: "userinput"><code>mkdir /tmp/common</code></strong>
                   4976: <code class="prompt">#</code> <strong class=
                   4977: "userinput"><code>echo "This is a README" &gt; /tmp/common/README</code></strong>
                   4978: <code class="prompt">#</code> <strong class=
                   4979: "userinput"><code>echo "Another file" &gt; /tmp/common/COPYING</code></strong>
                   4980: <code class="prompt">#</code> <strong class=
                   4981: "userinput"><code>mkdir /tmp/common/bin</code></strong>
                   4982: <code class="prompt">#</code> <strong class=
                   4983: "userinput"><code>echo "#!/bin/sh" &gt; /tmp/common/bin/myscript</code></strong>
                   4984: <code class="prompt">#</code> <strong class=
                   4985: "userinput"><code>echo "echo Hello world" &gt;&gt; /tmp/common/bin/myscript</code></strong>
                   4986: <code class="prompt">#</code> <strong class=
                   4987: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1       grant    4988: </pre>
                   4989: 
                   4990:             <p>Now create the images:</p>
                   4991:             <pre class="screen">
1.14      xtraeme  4992: <code class="prompt">#</code> <strong class=
                   4993: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    4994: </pre>
                   4995: 
1.45      wiz      4996:             <p>Each image will contain <code xmlns=
                   4997:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4998:             "filename">README</code>, <code xmlns=
                   4999:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   5000:             "filename">COPYING</code>, and <code xmlns=
                   5001:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5002:             "filename">bin/myscript</code> in their root
1.1       grant    5003:             directories.</p>
                   5004:           </div>
                   5005:         </div>
                   5006:       </div>
                   5007: 
1.66    ! rillig   5008:       <div class="chapter" lang="en" xml:lang="en">
1.1       grant    5009:         <div class="titlepage">
                   5010:           <div>
                   5011:             <div>
1.66    ! rillig   5012:               <h2 class="title"><a name="faq" id=
1.38      dillo    5013:               "faq"></a>Chapter&nbsp;7.&nbsp;Frequently Asked
1.1       grant    5014:               Questions</h2>
                   5015:             </div>
                   5016:           </div>
                   5017:         </div>
                   5018: 
                   5019:         <div class="toc">
                   5020:           <p><b>Table of Contents</b></p>
                   5021: 
                   5022:           <dl>
1.30      wiz      5023:             <dt><span class="sect1"><a href=
1.38      dillo    5024:             "#mailing-list-pointers">7.1. Are there any mailing
1.30      wiz      5025:             lists for pkg-related discussion?</a></span></dt>
1.1       grant    5026: 
1.38      dillo    5027:             <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1       grant    5028:             Where's the pkgviews documentation?</a></span></dt>
                   5029: 
1.38      dillo    5030:             <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1       grant    5031:             Utilities for package management
                   5032:             (pkgtools)</a></span></dt>
                   5033: 
1.38      dillo    5034:             <dt><span class="sect1"><a href="#non-root-pkgsrc">7.4.
1.30      wiz      5035:             How to use pkgsrc as non-root</a></span></dt>
1.1       grant    5036: 
1.30      wiz      5037:             <dt><span class="sect1"><a href=
1.38      dillo    5038:             "#resume-transfers">7.5. How to resume transfers when
1.30      wiz      5039:             fetching distfiles?</a></span></dt>
1.14      xtraeme  5040: 
1.30      wiz      5041:             <dt><span class="sect1"><a href=
1.38      dillo    5042:             "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30      wiz      5043:             XFree86 from pkgsrc?</a></span></dt>
1.1       grant    5044: 
1.30      wiz      5045:             <dt><span class="sect1"><a href=
1.38      dillo    5046:             "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30      wiz      5047:             from pkgsrc?</a></span></dt>
1.1       grant    5048: 
1.30      wiz      5049:             <dt><span class="sect1"><a href=
1.38      dillo    5050:             "#fetch-behind-firewall">7.8. How to fetch files from
1.30      wiz      5051:             behind a firewall</a></span></dt>
1.1       grant    5052: 
1.38      dillo    5053:             <dt><span class="sect1"><a href="#passive-ftp">7.9. How
1.14      xtraeme  5054:             do I tell <span><strong class="command">make
                   5055:             fetch</strong></span> to do passive
                   5056:             FTP?</a></span></dt>
1.1       grant    5057: 
1.30      wiz      5058:             <dt><span class="sect1"><a href=
1.38      dillo    5059:             "#fetching-all-distfiles">7.10. How to fetch all
1.30      wiz      5060:             distfiles at once</a></span></dt>
1.1       grant    5061: 
1.30      wiz      5062:             <dt><span class="sect1"><a href=
1.38      dillo    5063:             "#tmac.andoc-missing">7.11. What does
1.30      wiz      5064:             &#8220;<span class="quote">Don't know how to make
1.14      xtraeme  5065:             /usr/share/tmac/tmac.andoc</span>&#8221;
1.1       grant    5066:             mean?</a></span></dt>
                   5067: 
1.30      wiz      5068:             <dt><span class="sect1"><a href=
1.38      dillo    5069:             "#bsd.own.mk-missing">7.12. What does
1.30      wiz      5070:             &#8220;<span class="quote">Could not find
1.14      xtraeme  5071:             bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    5072: 
1.30      wiz      5073:             <dt><span class="sect1"><a href=
1.38      dillo    5074:             "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30      wiz      5075:             pkgsrc</a></span></dt>
1.1       grant    5076: 
1.38      dillo    5077:             <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35      jmmv     5078:             do I change the location of configuration
                   5079:             files?</a></span></dt>
1.1       grant    5080: 
1.38      dillo    5081:             <dt><span class="sect1"><a href="#audit-packages">7.15.
1.1       grant    5082:             Automated security checks</a></span></dt>
                   5083:           </dl>
                   5084:         </div>
                   5085: 
                   5086:         <p>This section contains hints, tips &amp; tricks on
                   5087:         special things in pkgsrc that we didn't find a better place
                   5088:         for in the previous chapters, and it contains items for
                   5089:         both pkgsrc users and developers.</p>
                   5090: 
1.66    ! rillig   5091:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5092:           <div class="titlepage">
                   5093:             <div>
                   5094:               <div>
                   5095:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   5096:                 "mailing-list-pointers" id=
1.38      dillo    5097:                 "mailing-list-pointers"></a>7.1.&nbsp;Are there any
1.30      wiz      5098:                 mailing lists for pkg-related discussion?</h2>
1.1       grant    5099:               </div>
                   5100:             </div>
                   5101:           </div>
                   5102: 
1.18      xtraeme  5103:           <p>The following mailing lists may be of interest to
                   5104:           pkgsrc users:</p>
                   5105: 
                   5106:           <div class="itemizedlist">
                   5107:             <ul type="disc">
                   5108:               <li>
                   5109:                 <p><a href=
                   5110:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.34      wiz      5111:                 target="_top">pkgsrc-bugs</a>: A list where problem
                   5112:                 reports related to pkgsrc are sent and
                   5113:                 discussed.</p>
1.18      xtraeme  5114:               </li>
                   5115: 
                   5116:               <li>
                   5117:                 <p><a href=
                   5118:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34      wiz      5119:                 target="_top">pkgsrc-bulk</a>: A list where the
1.20      ben      5120:                 results of pkgsrc bulk builds are sent and
1.34      wiz      5121:                 discussed.</p>
1.18      xtraeme  5122:               </li>
                   5123: 
                   5124:               <li>
                   5125:                 <p><a href=
                   5126:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.34      wiz      5127:                 target="_top">pkgsrc-changes</a>: A list where all
                   5128:                 commit messages to pkgsrc are sent.</p>
1.18      xtraeme  5129:               </li>
                   5130: 
                   5131:               <li>
                   5132:                 <p><a href=
                   5133:                 "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.34      wiz      5134:                 target="_top">tech-pkg</a>: A general discussion
                   5135:                 list for all things related to pkgsrc.</p>
1.18      xtraeme  5136:               </li>
                   5137:             </ul>
                   5138:           </div>
                   5139: 
                   5140:           <p>To subscribe, do:</p>
1.1       grant    5141:           <pre class="programlisting">
1.51      rillig   5142:     <code class="prompt">%</code> echo subscribe <em class=
1.18      xtraeme  5143: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1       grant    5144: </pre>
                   5145: 
1.18      xtraeme  5146:           <p>Archives for all these mailing lists are available
                   5147:           from <a href="http://mail-index.NetBSD.org/" target=
                   5148:           "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1       grant    5149:         </div>
                   5150: 
1.66    ! rillig   5151:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5152:           <div class="titlepage">
                   5153:             <div>
                   5154:               <div>
                   5155:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   5156:                 "pkgviews-docs" id=
1.38      dillo    5157:                 "pkgviews-docs"></a>7.2.&nbsp;Where's the pkgviews
1.30      wiz      5158:                 documentation?</h2>
1.1       grant    5159:               </div>
                   5160:             </div>
                   5161:           </div>
                   5162: 
                   5163:           <p>Pkgviews is tightly integrated with buildlink. You can
1.45      wiz      5164:           find a pkgviews User's guide in <code xmlns=
                   5165:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5166:           "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1       grant    5167:         </div>
                   5168: 
1.66    ! rillig   5169:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5170:           <div class="titlepage">
                   5171:             <div>
                   5172:               <div>
                   5173:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   5174:                 "faq-pkgtools" id=
1.38      dillo    5175:                 "faq-pkgtools"></a>7.3.&nbsp;Utilities for package
1.5       hubertf  5176:                 management (pkgtools)</h2>
1.1       grant    5177:               </div>
                   5178:             </div>
                   5179:           </div>
                   5180: 
1.45      wiz      5181:           <p>The <code xmlns=
                   5182:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5183:           "filename">pkgsrc/pkgtools</code> directory pkgtools
                   5184:           contains a number of useful utilities for both users and
                   5185:           developers of pkgsrc. This section attempts only to make
                   5186:           the reader aware of the utilities and when they might be
                   5187:           useful, and not to duplicate the documentation that comes
                   5188:           with each package.</p>
1.1       grant    5189: 
                   5190:           <p>Utilities used by pkgsrc (automatically installed when
                   5191:           needed):</p>
                   5192: 
                   5193:           <div class="itemizedlist">
                   5194:             <ul type="disc">
                   5195:               <li>
                   5196:                 <p><a xmlns=
                   5197:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5198:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.45      wiz      5199:                 target="_top"><code xmlns="" class=
                   5200:                 "filename">pkgtools/x11-links</code></a>: Symlinks
1.34      wiz      5201:                 for use by buildlink.</p>
1.1       grant    5202:               </li>
                   5203:             </ul>
                   5204:           </div>
                   5205: 
                   5206:           <p>OS tool augmentation (automatically installed when
                   5207:           needed):</p>
                   5208: 
                   5209:           <div class="itemizedlist">
                   5210:             <ul type="disc">
                   5211:               <li>
                   5212:                 <p><a xmlns=
                   5213:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5214:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.45      wiz      5215:                 target="_top"><code xmlns="" class=
                   5216:                 "filename">pkgtools/digest</code></a>: Calculates
1.34      wiz      5217:                 various kinds of checksums (including SHA1).</p>
1.1       grant    5218:               </li>
                   5219: 
                   5220:               <li>
                   5221:                 <p><a xmlns=
                   5222:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5223:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.45      wiz      5224:                 target="_top"><code xmlns="" class=
                   5225:                 "filename">pkgtools/libnbcompat</code></a>:
1.34      wiz      5226:                 Compatibility library for pkgsrc tools.</p>
1.1       grant    5227:               </li>
                   5228: 
                   5229:               <li>
                   5230:                 <p><a xmlns=
                   5231:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5232:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.45      wiz      5233:                 target="_top"><code xmlns="" class=
                   5234:                 "filename">pkgtools/mtree</code></a>: Installed on
1.34      wiz      5235:                 non-BSD systems due to lack of native mtree.</p>
1.1       grant    5236:               </li>
                   5237: 
                   5238:               <li>
                   5239:                 <p><a xmlns=
                   5240:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5241:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45      wiz      5242:                 target="_top"><code xmlns="" class=
                   5243:                 "filename">pkgtools/pkg_install</code></a>:
                   5244:                 Up-to-date replacement for <code xmlns=
                   5245:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.34      wiz      5246:                 "filename">/usr/sbin/pkg_install</code>, or for use
                   5247:                 on operating systems where pkg_install is not
                   5248:                 present.</p>
1.1       grant    5249:               </li>
                   5250:             </ul>
                   5251:           </div>
                   5252: 
                   5253:           <p>Utilities used by pkgsrc (not automatically
                   5254:           installed):</p>
                   5255: 
                   5256:           <div class="itemizedlist">
                   5257:             <ul type="disc">
                   5258:               <li>
                   5259:                 <p><a xmlns=
                   5260:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5261:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.45      wiz      5262:                 target="_top"><code xmlns="" class=
                   5263:                 "filename">pkgtools/pkg_tarup</code></a>: Create a
1.20      ben      5264:                 binary package from an already-installed package.
1.34      wiz      5265:                 Used by <span><strong class="command">make
                   5266:                 replace</strong></span> to save the old
                   5267:                 package.</p>
1.1       grant    5268:               </li>
                   5269: 
                   5270:               <li>
                   5271:                 <p><a xmlns=
                   5272:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.5       hubertf  5273:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.45      wiz      5274:                 target="_top"><code xmlns="" class=
                   5275:                 "filename">pkgtools/dfdisk</code></a>: Adds extra
1.20      ben      5276:                 functionality to pkgsrc, allowing it to fetch
                   5277:                 distfiles from multiple locations. It currently
                   5278:                 supports the following methods: multiple CD-ROMs
                   5279:                 and network FTP/HTTP connections.</p>
1.5       hubertf  5280:               </li>
                   5281: 
                   5282:               <li>
                   5283:                 <p><a xmlns=
                   5284:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    5285:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45      wiz      5286:                 target="_top"><code xmlns="" class=
                   5287:                 "filename">pkgtools/xpkgwedge</code></a>: Put X11
1.34      wiz      5288:                 packages someplace else (enabled by default).</p>
1.1       grant    5289:               </li>
1.5       hubertf  5290: 
                   5291:               <li>
                   5292:                 <p><a xmlns=
                   5293:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5294:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45      wiz      5295:                 target="_top"><code xmlns="" class=
                   5296:                 "filename">devel/cpuflags</code></a>: Determine the
1.34      wiz      5297:                 best compiler flags to optimise code for your
1.20      ben      5298:                 current CPU and compiler.</p>
1.5       hubertf  5299:               </li>
1.1       grant    5300:             </ul>
                   5301:           </div>
                   5302: 
                   5303:           <p>Utilities for keeping track of installed packages,
                   5304:           being up to date, etc:</p>
                   5305: 
                   5306:           <div class="itemizedlist">
                   5307:             <ul type="disc">
                   5308:               <li>
                   5309:                 <p><a xmlns=
                   5310:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5311:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.45      wiz      5312:                 target="_top"><code xmlns="" class=
                   5313:                 "filename">pkgtools/pkg_chk</code></a>: Reports on
1.27      rillig   5314:                 packages whose installed versions do not match the
1.34      wiz      5315:                 latest pkgsrc entries.</p>
1.1       grant    5316:               </li>
                   5317: 
                   5318:               <li>
                   5319:                 <p><a xmlns=
                   5320:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5321:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45      wiz      5322:                 target="_top"><code xmlns="" class=
                   5323:                 "filename">pkgtools/pkgdep</code></a>: Makes
1.20      ben      5324:                 dependency graphs of packages, to aid in choosing a
1.34      wiz      5325:                 strategy for updating.</p>
1.1       grant    5326:               </li>
                   5327: 
                   5328:               <li>
                   5329:                 <p><a xmlns=
                   5330:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5331:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.45      wiz      5332:                 target="_top"><code xmlns="" class=
                   5333:                 "filename">pkgtools/pkgdepgraph</code></a>: Makes
1.27      rillig   5334:                 graphs from the output of <a xmlns=
                   5335:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5336:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45      wiz      5337:                 target="_top"><code xmlns="" class=
                   5338:                 "filename">pkgtools/pkgdep</code></a> (uses
1.34      wiz      5339:                 graphviz).</p>
1.1       grant    5340:               </li>
                   5341: 
                   5342:               <li>
                   5343:                 <p><a xmlns=
                   5344:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5345:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45      wiz      5346:                 target="_top"><code xmlns="" class=
                   5347:                 "filename">pkgtools/pkglint</code></a>: The
1.27      rillig   5348:                 pkglint(1) program checks a pkgsrc entry for
                   5349:                 errors, lintpkgsrc(1) does various checks on the
                   5350:                 complete pkgsrc system.</p>
1.1       grant    5351:               </li>
                   5352: 
                   5353:               <li>
                   5354:                 <p><a xmlns=
                   5355:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5356:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.45      wiz      5357:                 target="_top"><code xmlns="" class=
                   5358:                 "filename">pkgtools/pkgsurvey</code></a>: Report
                   5359:                 what packages you have installed.</p>
1.1       grant    5360:               </li>
                   5361:             </ul>
                   5362:           </div>
                   5363: 
                   5364:           <p>Utilities for people maintaining or creating
                   5365:           individual packages:</p>
                   5366: 
                   5367:           <div class="itemizedlist">
                   5368:             <ul type="disc">
                   5369:               <li>
                   5370:                 <p><a xmlns=
                   5371:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5372:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45      wiz      5373:                 target="_top"><code xmlns="" class=
                   5374:                 "filename">pkgtools/pkgdiff</code></a>: Automate
1.20      ben      5375:                 making and maintaining patches for a package
1.34      wiz      5376:                 (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1       grant    5377:               </li>
                   5378: 
                   5379:               <li>
                   5380:                 <p><a xmlns=
                   5381:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5382:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.45      wiz      5383:                 target="_top"><code xmlns="" class=
                   5384:                 "filename">pkgtools/rpm2pkg</code></a>, <a xmlns=
1.20      ben      5385:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5386:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45      wiz      5387:                 target="_top"><code xmlns="" class=
                   5388:                 "filename">pkgtools/url2pkg</code></a>: Aids in
1.34      wiz      5389:                 converting to pkgsrc.</p>
1.1       grant    5390:               </li>
                   5391: 
                   5392:               <li>
                   5393:                 <p><a xmlns=
                   5394:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5395:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.45      wiz      5396:                 target="_top"><code xmlns="" class=
                   5397:                 "filename">pkgtools/gensolpkg</code></a>: Convert
1.34      wiz      5398:                 pkgsrc to a Solaris package.</p>
1.1       grant    5399:               </li>
                   5400:             </ul>
                   5401:           </div>
                   5402: 
1.47      reed     5403:           <p>Utilities for people maintaining pkgsrc (or: more
1.1       grant    5404:           obscure pkg utilities)</p>
                   5405: 
                   5406:           <div class="itemizedlist">
                   5407:             <ul type="disc">
                   5408:               <li>
                   5409:                 <p><a xmlns=
                   5410:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5411:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.45      wiz      5412:                 target="_top"><code xmlns="" class=
                   5413:                 "filename">pkgtools/pkg_comp</code></a>: Build
1.34      wiz      5414:                 packages in a chrooted area.</p>
1.1       grant    5415:               </li>
                   5416: 
                   5417:               <li>
                   5418:                 <p><a xmlns=
                   5419:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5420:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.45      wiz      5421:                 target="_top"><code xmlns="" class=
                   5422:                 "filename">pkgtools/libkver</code></a>: Spoof
                   5423:                 kernel version for chrooted cross builds.</p>
1.1       grant    5424:               </li>
                   5425:             </ul>
                   5426:           </div>
                   5427:         </div>
                   5428: 
1.66    ! rillig   5429:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5430:           <div class="titlepage">
                   5431:             <div>
                   5432:               <div>
                   5433:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   5434:                 "non-root-pkgsrc" id=
1.38      dillo    5435:                 "non-root-pkgsrc"></a>7.4.&nbsp;How to use pkgsrc
1.30      wiz      5436:                 as non-root</h2>
1.1       grant    5437:               </div>
                   5438:             </div>
                   5439:           </div>
                   5440: 
                   5441:           <p>If you want to use pkgsrc as non-root user, you can
                   5442:           set some variables to make pkgsrc work under these
1.33      jmmv     5443:           conditions. At the very least, you need to set
                   5444:           <code class="varname">UNPRIVILEGED</code> to
                   5445:           &#8220;<span class="quote">yes</span>&#8221;; this will
                   5446:           turn on unprivileged mode and set multiple related
                   5447:           variables to allow installation of packages as
                   5448:           non-root.</p>
                   5449: 
                   5450:           <p>In case the defaults are not enough, you may want to
                   5451:           tune some other variables used. For example, if the
                   5452:           automatic user/group detection leads to incorrect values
                   5453:           (or not the ones you would like to use), you can change
                   5454:           them by setting <code class=
                   5455:           "varname">UNPRIVILEGED_USER</code> and <code class=
                   5456:           "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
                   5457: 
                   5458:           <p>As regards bootstrapping, please note that the
                   5459:           <span><strong class="command">bootstrap</strong></span>
                   5460:           script will ease non-root configuration when given the
                   5461:           &#8220;<span class=
                   5462:           "quote">--ignore-user-check</span>&#8221; flag, as it
                   5463:           will choose and use multiple default directories under
1.45      wiz      5464:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5465:           class="filename">~/pkg</code> as the installation
1.33      jmmv     5466:           targets. These directories can be overriden by the
                   5467:           &#8220;<span class="quote">--prefix</span>&#8221; flag
                   5468:           provided by the script, as well as some others that allow
                   5469:           finer tuning of the tree layout.</p>
1.14      xtraeme  5470:         </div>
                   5471: 
1.66    ! rillig   5472:         <div class="sect1" lang="en" xml:lang="en">
1.14      xtraeme  5473:           <div class="titlepage">
                   5474:             <div>
                   5475:               <div>
                   5476:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   5477:                 "resume-transfers" id=
1.38      dillo    5478:                 "resume-transfers"></a>7.5.&nbsp;How to resume
1.30      wiz      5479:                 transfers when fetching distfiles?</h2>
1.14      xtraeme  5480:               </div>
                   5481:             </div>
                   5482:           </div>
                   5483: 
1.47      reed     5484:           <p>By default, resuming transfers in pkgsrc is disabled,
1.15      xtraeme  5485:           but you can enable this feature by adding the option
                   5486:           <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
1.45      wiz      5487:           into <code xmlns=
                   5488:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5489:           "filename">/etc/mk.conf</code>. If, during a fetch step,
                   5490:           an incomplete distfile is found, pkgsrc will try to
                   5491:           resume it.</p>
1.15      xtraeme  5492: 
                   5493:           <p>You can also use a different program than the default
1.24      wiz      5494:           <a href=
                   5495:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   5496:           <span class="citerefentry"><span class=
                   5497:           "refentrytitle">ftp</span>(1)</span></a> by changing the
                   5498:           <code class="varname">FETCH_CMD</code> variable. Don't
                   5499:           forget to set <code class=
                   5500:           "varname">FETCH_RESUME_ARGS</code> and <code class=
                   5501:           "varname">FETCH_OUTPUT_ARGS</code> if you are not using
                   5502:           default values.</p>
1.14      xtraeme  5503: 
1.45      wiz      5504:           <p>For example, if you want to use <code xmlns=
                   5505:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5506:           "filename">wget</code> to resume downloads, you'll have
                   5507:           to use something like:</p>
                   5508:           <pre class="programlisting">
1.51      rillig   5509:     FETCH_CMD=             wget
                   5510:     FETCH_BEFORE_ARGS=     --passive-ftp
                   5511:     FETCH_RESUME_ARGS=     -c
                   5512:     FETCH_OUTPUT_ARGS=     -O
1.14      xtraeme  5513: </pre>
1.1       grant    5514:         </div>
                   5515: 
1.66    ! rillig   5516:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5517:           <div class="titlepage">
                   5518:             <div>
                   5519:               <div>
                   5520:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   5521:                 "XFree86-from-pkgsrc" id=
1.38      dillo    5522:                 "XFree86-from-pkgsrc"></a>7.6.&nbsp;How can I
1.1       grant    5523:                 install/use XFree86 from pkgsrc?</h2>
                   5524:               </div>
                   5525:             </div>
                   5526:           </div>
                   5527: 
                   5528:           <p>If you want to use XFree86 from pkgsrc instead of your
1.45      wiz      5529:           system's own X11 (<code xmlns=
                   5530:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5531:           "filename">/usr/X11R6</code>, <code xmlns=
                   5532:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5533:           "filename">/usr/openwin</code>, ...), you will have to
1.45      wiz      5534:           add the following line into <code xmlns=
                   5535:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.15      xtraeme  5536:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    5537:           <pre class="programlisting">
1.51      rillig   5538:     X11_TYPE=XFree86
1.1       grant    5539: </pre>
                   5540:         </div>
                   5541: 
1.66    ! rillig   5542:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5543:           <div class="titlepage">
                   5544:             <div>
                   5545:               <div>
                   5546:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   5547:                 "x.org-from-pkgsrc" id=
1.38      dillo    5548:                 "x.org-from-pkgsrc"></a>7.7.&nbsp;How can I
1.1       grant    5549:                 install/use X.org from pkgsrc?</h2>
                   5550:               </div>
                   5551:             </div>
                   5552:           </div>
                   5553: 
                   5554:           <p>If you want to use X.org from pkgsrc instead of your
1.45      wiz      5555:           system's own X11 (<code xmlns=
                   5556:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5557:           "filename">/usr/X11R6</code>, <code xmlns=
                   5558:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5559:           "filename">/usr/openwin</code>, ...) you will have to add
1.45      wiz      5560:           the following line into <code xmlns=
                   5561:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.15      xtraeme  5562:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    5563:           <pre class="programlisting">
1.51      rillig   5564:     X11_TYPE=xorg
1.1       grant    5565: </pre>
                   5566:         </div>
                   5567: 
1.66    ! rillig   5568:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5569:           <div class="titlepage">
                   5570:             <div>
                   5571:               <div>
                   5572:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   5573:                 "fetch-behind-firewall" id=
1.38      dillo    5574:                 "fetch-behind-firewall"></a>7.8.&nbsp;How to fetch
1.30      wiz      5575:                 files from behind a firewall</h2>
1.1       grant    5576:               </div>
                   5577:             </div>
                   5578:           </div>
                   5579: 
                   5580:           <p>If you are sitting behind a firewall which does not
                   5581:           allow direct connections to Internet hosts (i.e.
                   5582:           non-NAT), you may specify the relevant proxy hosts. This
                   5583:           is done using an environment variable in the form of a
1.47      reed     5584:           URL, e.g. in Amdahl, the machine &#8220;<span class=
1.1       grant    5585:           "quote">orpheus.amdahl.com</span>&#8221; is one of the
                   5586:           firewalls, and it uses port 80 as the proxy port number.
                   5587:           So the proxy environment variables are:</p>
                   5588:           <pre class="programlisting">
1.51      rillig   5589:     ftp_proxy=ftp://orpheus.amdahl.com:80/
                   5590:     http_proxy=http://orpheus.amdahl.com:80/
1.1       grant    5591: </pre>
                   5592:         </div>
                   5593: 
1.66    ! rillig   5594:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5595:           <div class="titlepage">
                   5596:             <div>
                   5597:               <div>
                   5598:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   5599:                 "passive-ftp" id="passive-ftp"></a>7.9.&nbsp;How do
        !          5600:                 I tell <span><strong class="command">make
1.14      xtraeme  5601:                 fetch</strong></span> to do passive FTP?</h2>
1.1       grant    5602:               </div>
                   5603:             </div>
                   5604:           </div>
                   5605: 
                   5606:           <p>This depends on which utility is used to retrieve
1.45      wiz      5607:           distfiles. From <code xmlns=
                   5608:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5609:           "filename">bsd.pkg.mk</code>, <code class=
                   5610:           "varname">FETCH_CMD</code> is assigned the first
                   5611:           available command from the following list:</p>
1.34      wiz      5612: 
                   5613:           <div class="itemizedlist">
                   5614:             <ul type="disc">
                   5615:               <li>
1.45      wiz      5616:                 <p><code xmlns=
                   5617:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.34      wiz      5618:                 "filename">${LOCALBASE}/bin/ftp</code></p>
                   5619:               </li>
                   5620: 
                   5621:               <li>
1.45      wiz      5622:                 <p><code xmlns=
                   5623:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   5624:                 "filename">/usr/bin/ftp</code></p>
1.34      wiz      5625:               </li>
                   5626:             </ul>
                   5627:           </div>
1.1       grant    5628: 
                   5629:           <p>On a default NetBSD installation, this will be
1.45      wiz      5630:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5631:           class="filename">/usr/bin/ftp</code>, which automatically
                   5632:           tries passive connections first, and falls back to active
                   5633:           connections if the server refuses to do passive. For the
                   5634:           other tools, add the following to your <code xmlns=
                   5635:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5636:           "filename">/etc/mk.conf</code> file: <code class=
                   5637:           "varname">PASSIVE_FETCH=1</code>.</p>
1.1       grant    5638: 
1.45      wiz      5639:           <p>Having that option present will prevent <code xmlns=
                   5640:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5641:           "filename">/usr/bin/ftp</code> from falling back to
                   5642:           active transfers.</p>
1.1       grant    5643:         </div>
                   5644: 
1.66    ! rillig   5645:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5646:           <div class="titlepage">
                   5647:             <div>
                   5648:               <div>
                   5649:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   5650:                 "fetching-all-distfiles" id=
1.38      dillo    5651:                 "fetching-all-distfiles"></a>7.10.&nbsp;How to
1.1       grant    5652:                 fetch all distfiles at once</h2>
                   5653:               </div>
                   5654:             </div>
                   5655:           </div>
                   5656: 
                   5657:           <p>You would like to download all the distfiles in a
                   5658:           single batch from work or university, where you can't run
1.14      xtraeme  5659:           a <span><strong class="command">make
                   5660:           fetch</strong></span>. There is an archive of distfiles
                   5661:           on <a href=
1.1       grant    5662:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
                   5663:           target="_top">ftp.NetBSD.org</a>, but downloading the
                   5664:           entire directory may not be appropriate.</p>
                   5665: 
1.14      xtraeme  5666:           <p>The answer here is to do a <span><strong class=
1.45      wiz      5667:           "command">make fetch-list</strong></span> in <code xmlns=
                   5668:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     5669:           "filename">/usr/pkgsrc</code> or one of its
1.1       grant    5670:           subdirectories, carry the resulting list to your machine
1.23      wiz      5671:           at work/school and use it there. If you don't have a
1.24      wiz      5672:           NetBSD-compatible <a href=
                   5673:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   5674:           <span class="citerefentry"><span class=
                   5675:           "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
                   5676:           at work, don't forget to set <code class=
                   5677:           "varname">FETCH_CMD</code> to something that fetches a
                   5678:           URL:</p>
1.1       grant    5679: 
                   5680:           <p>At home:</p>
                   5681:           <pre class="screen">
1.14      xtraeme  5682: <code class="prompt">%</code> <strong class=
                   5683: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   5684: <code class="prompt">%</code> <strong class=
                   5685: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles &gt;/tmp/fetch.sh</code></strong>
                   5686: <code class="prompt">%</code> <strong class=
                   5687: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1       grant    5688: </pre>
                   5689: 
                   5690:           <p>At work:</p>
                   5691:           <pre class="screen">
1.14      xtraeme  5692: <code class="prompt">%</code> <strong class=
                   5693: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1       grant    5694: </pre>
                   5695: 
1.45      wiz      5696:           <p>then tar up <code xmlns=
                   5697:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5698:           "filename">/tmp/distfiles</code> and take it home.</p>
1.1       grant    5699: 
                   5700:           <p>If you have a machine running NetBSD, and you want to
                   5701:           get <span class="emphasis"><em>all</em></span> distfiles
                   5702:           (even ones that aren't for your machine architecture),
                   5703:           you can do so by using the above-mentioned
1.14      xtraeme  5704:           <span><strong class="command">make
                   5705:           fetch-list</strong></span> approach, or fetch the
                   5706:           distfiles directly by running:</p>
1.1       grant    5707:           <pre class="screen">
1.14      xtraeme  5708: <code class="prompt">%</code> <strong class=
                   5709: "userinput"><code>make mirror-distfiles</code></strong>
1.1       grant    5710: </pre>
                   5711: 
1.14      xtraeme  5712:           <p>If you even decide to ignore <code class=
                   5713:           "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
                   5714:           can get everything by running:</p>
1.1       grant    5715:           <pre class="screen">
1.14      xtraeme  5716: <code class="prompt">%</code> <strong class=
                   5717: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1       grant    5718: </pre>
                   5719:         </div>
                   5720: 
1.66    ! rillig   5721:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5722:           <div class="titlepage">
                   5723:             <div>
                   5724:               <div>
                   5725:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   5726:                 "tmac.andoc-missing" id=
1.38      dillo    5727:                 "tmac.andoc-missing"></a>7.11.&nbsp;What does
1.1       grant    5728:                 &#8220;<span class="quote">Don't know how to make
                   5729:                 /usr/share/tmac/tmac.andoc</span>&#8221; mean?</h2>
                   5730:               </div>
                   5731:             </div>
                   5732:           </div>
                   5733: 
                   5734:           <p>When compiling the <a xmlns=
                   5735:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5736:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45      wiz      5737:           target="_top"><code xmlns="" class=
                   5738:           "filename">pkgtools/pkg_install</code></a> package, you
                   5739:           get the error from make that it doesn't know how to make
                   5740:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5741:           class="filename">/usr/share/tmac/tmac.andoc</code>? This
                   5742:           indicates that you don't have installed the
1.23      wiz      5743:           &#8220;<span class="quote">text</span>&#8221; set (nroff,
                   5744:           ...) from the NetBSD base distribution on your machine.
1.47      reed     5745:           It is recommended to do that to format man pages.</p>
1.1       grant    5746: 
                   5747:           <p>In the case of the <a xmlns=
                   5748:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5749:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45      wiz      5750:           target="_top"><code xmlns="" class=
                   5751:           "filename">pkgtools/pkg_install</code></a> package, you
                   5752:           can get away with setting <code class=
1.20      ben      5753:           "varname">NOMAN=YES</code> either in the environment or
1.45      wiz      5754:           in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5755:           class="filename">/etc/mk.conf</code>.</p>
1.1       grant    5756:         </div>
                   5757: 
1.66    ! rillig   5758:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5759:           <div class="titlepage">
                   5760:             <div>
                   5761:               <div>
                   5762:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   5763:                 "bsd.own.mk-missing" id=
1.38      dillo    5764:                 "bsd.own.mk-missing"></a>7.12.&nbsp;What does
1.1       grant    5765:                 &#8220;<span class="quote">Could not find
                   5766:                 bsd.own.mk</span>&#8221; mean?</h2>
                   5767:               </div>
                   5768:             </div>
                   5769:           </div>
                   5770: 
1.45      wiz      5771:           <p>You didn't install the compiler set, <code xmlns=
                   5772:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5773:           "filename">comp.tgz</code>, when you installed your
1.47      reed     5774:           NetBSD machine. Please get and install it, by extracting
                   5775:           it in <code xmlns=
1.45      wiz      5776:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5777:           "filename">/</code>:</p>
1.1       grant    5778:           <pre class="screen">
1.14      xtraeme  5779: <code class="prompt">#</code> <strong class=
                   5780: "userinput"><code>cd /</code></strong>
                   5781: <code class="prompt">#</code> <strong class=
                   5782: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1       grant    5783: </pre>
                   5784: 
1.45      wiz      5785:           <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5786:           class="filename">comp.tgz</code> is part of every NetBSD
                   5787:           release. Get the one that corresponds to your release
                   5788:           (determine via <span><strong class="command">uname
                   5789:           -r</strong></span>).</p>
1.1       grant    5790:         </div>
                   5791: 
1.66    ! rillig   5792:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5793:           <div class="titlepage">
                   5794:             <div>
                   5795:               <div>
                   5796:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   5797:                 "using-sudo-with-pkgsrc" id=
1.38      dillo    5798:                 "using-sudo-with-pkgsrc"></a>7.13.&nbsp;Using
1.1       grant    5799:                 'sudo' with pkgsrc</h2>
                   5800:               </div>
                   5801:             </div>
                   5802:           </div>
                   5803: 
                   5804:           <p>When installing packages as non-root user and using
1.24      wiz      5805:           the just-in-time <a href=
                   5806:           "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
                   5807:           <span class="citerefentry"><span class=
                   5808:           "refentrytitle">su</span>(1)</span></a> feature of
                   5809:           pkgsrc, it can become annoying to type in the root
                   5810:           password for each required package installed. To avoid
                   5811:           this, the sudo package can be used, which does password
                   5812:           caching over a limited time. To use it, install sudo
                   5813:           (either as binary package or from <a xmlns=
                   5814:           "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    5815:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.45      wiz      5816:           target="_top"><code xmlns="" class=
                   5817:           "filename">security/sudo</code></a>) and then put the
                   5818:           following into your <code xmlns=
                   5819:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      5820:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    5821:           <pre class="programlisting">
1.51      rillig   5822:     .if exists(${LOCALBASE}/bin/sudo)
                   5823:     SU_CMD=        ${LOCALBASE}/bin/sudo /bin/sh -c
                   5824:     .endif
1.1       grant    5825: </pre>
                   5826:         </div>
                   5827: 
1.66    ! rillig   5828:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5829:           <div class="titlepage">
                   5830:             <div>
                   5831:               <div>
                   5832:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   5833:                 "faq.conf" id="faq.conf"></a>7.14.&nbsp;How do I
        !          5834:                 change the location of configuration files?</h2>
1.1       grant    5835:               </div>
                   5836:             </div>
                   5837:           </div>
                   5838: 
1.35      jmmv     5839:           <p>As the system administrator, you can choose where
                   5840:           configuration files are installed. The default settings
1.45      wiz      5841:           make all these files go into <code xmlns=
                   5842:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     5843:           "filename">${PREFIX}/etc</code> or some of its
                   5844:           subdirectories; this may be suboptimal depending on your
                   5845:           expectations (e.g., a read-only, NFS-exported
                   5846:           <code class="varname">PREFIX</code> with a need of
                   5847:           per-machine configuration of the provided packages).</p>
                   5848: 
                   5849:           <p>In order to change the defaults, you can modify the
                   5850:           <code class="varname">PKG_SYSCONFBASE</code> variable (in
1.45      wiz      5851:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5852:           class="filename">/etc/mk.conf</code>) to point to your
                   5853:           preferred configuration directory; some common examples
                   5854:           include <code xmlns=
                   5855:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5856:           "filename">/etc</code> or <code xmlns=
                   5857:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5858:           "filename">/etc/pkg</code>.</p>
1.35      jmmv     5859: 
                   5860:           <p>Furthermore, you can change this value on a
                   5861:           per-package basis by setting the <code class=
                   5862:           "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   5863:           variable. <code class="varname">PKG_SYSCONFVAR</code>'s
                   5864:           value usually matches the name of the package you would
                   5865:           like to modify, that is, the contents of <code class=
                   5866:           "varname">PKGBASE</code>.</p>
1.1       grant    5867: 
1.47      reed     5868:           <p>Note that after changing these settings, you must
1.35      jmmv     5869:           rebuild and reinstall any affected packages.</p>
1.1       grant    5870:         </div>
                   5871: 
1.66    ! rillig   5872:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5873:           <div class="titlepage">
                   5874:             <div>
                   5875:               <div>
                   5876:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   5877:                 "audit-packages" id=
1.38      dillo    5878:                 "audit-packages"></a>7.15.&nbsp;Automated security
1.1       grant    5879:                 checks</h2>
                   5880:               </div>
                   5881:             </div>
                   5882:           </div>
                   5883: 
                   5884:           <p>Please be aware that there can often be bugs in
                   5885:           third-party software, and some of these bugs can leave a
                   5886:           machine vulnerable to exploitation by attackers. In an
                   5887:           effort to lessen the exposure, the NetBSD packages team
                   5888:           maintains a database of known-exploits to packages which
                   5889:           have at one time been included in pkgsrc. The database
                   5890:           can be downloaded automatically, and a security audit of
                   5891:           all packages installed on a system can take place. To do
                   5892:           this, install the <a xmlns=
                   5893:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5894:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45      wiz      5895:           target="_top"><code xmlns="" class=
                   5896:           "filename">security/audit-packages</code></a> package. It
1.20      ben      5897:           has two components:</p>
1.1       grant    5898: 
                   5899:           <div class="orderedlist">
                   5900:             <ol type="1">
                   5901:               <li>
1.34      wiz      5902:                 <p><span><strong class=
                   5903:                 "command">download-vulnerability-list</strong></span>,
1.1       grant    5904:                 an easy way to download a list of the security
                   5905:                 vulnerabilities information. This list is kept up
                   5906:                 to date by the NetBSD security officer and the
                   5907:                 NetBSD packages team, and is distributed from the
                   5908:                 NetBSD ftp server:</p>
                   5909: 
                   5910:                 <p><a href=
                   5911:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20      ben      5912:                 target=
                   5913:                 "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1       grant    5914:               </li>
                   5915: 
                   5916:               <li>
1.34      wiz      5917:                 <p><span><strong class=
                   5918:                 "command">audit-packages</strong></span>, an easy
                   5919:                 way to audit the current machine, checking each
1.1       grant    5920:                 vulnerability which is known. If a vulnerable
                   5921:                 package is installed, it will be shown by output to
                   5922:                 stdout, including a description of the type of
                   5923:                 vulnerability, and a URL containing more
                   5924:                 information.</p>
                   5925:               </li>
                   5926:             </ol>
                   5927:           </div>
                   5928: 
1.23      wiz      5929:           <p>Use of the <a xmlns=
                   5930:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5931:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45      wiz      5932:           target="_top"><code xmlns="" class=
                   5933:           "filename">security/audit-packages</code></a> package is
1.23      wiz      5934:           strongly recommended! After &#8220;<span class=
                   5935:           "quote">audit-packages</span>&#8221; is installed, please
                   5936:           read the package's message, which you can get by running
                   5937:           <strong class="userinput"><code>pkg_info -D
1.65      hubertf  5938:           audit-packages</code></strong>.</p>
1.58      erh      5939: 
                   5940:           <p>If this package is installed, pkgsrc builds will use
                   5941:           it to perform a security check before building any
                   5942:           package. See <a href="#variables-affecting-build" title=
                   5943:           "5.2.&nbsp;Variables affecting the build process">Section&nbsp;5.2,
                   5944:           &#8220;Variables affecting the build process&#8221;</a>
1.59      rillig   5945:           for ways to control this check.</p>
1.1       grant    5946:         </div>
                   5947:       </div>
                   5948:     </div>
                   5949: 
1.66    ! rillig   5950:     <div class="part" lang="en" xml:lang="en">
1.1       grant    5951:       <div class="titlepage">
                   5952:         <div>
                   5953:           <div>
1.66    ! rillig   5954:             <h1 class="title"><a name="developers-guide" id=
1.48      dillo    5955:             "developers-guide"></a>Part&nbsp;II.&nbsp;The pkgsrc
                   5956:             developer's guide</h1>
1.1       grant    5957:           </div>
                   5958:         </div>
                   5959:       </div>
                   5960: 
                   5961:       <div class="toc">
                   5962:         <p><b>Table of Contents</b></p>
                   5963: 
                   5964:         <dl>
1.38      dillo    5965:           <dt><span class="chapter"><a href="#components">8.
1.27      rillig   5966:           Package components - files, directories and
                   5967:           contents</a></span></dt>
                   5968: 
                   5969:           <dd>
                   5970:             <dl>
                   5971:               <dt><span class="sect1"><a href=
1.45      wiz      5972:               "#components.Makefile">8.1. <code xmlns=
                   5973:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   5974:               "filename">Makefile</code></a></span></dt>
                   5975: 
                   5976:               <dt><span class="sect1"><a href=
1.45      wiz      5977:               "#components.distinfo">8.2. <code xmlns=
                   5978:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   5979:               "filename">distinfo</code></a></span></dt>
                   5980: 
                   5981:               <dt><span class="sect1"><a href=
1.38      dillo    5982:               "#components.patches">8.3. patches/*</a></span></dt>
1.27      rillig   5983: 
1.30      wiz      5984:               <dt><span class="sect1"><a href=
1.38      dillo    5985:               "#other-mandatory-files">8.4. Other mandatory
1.30      wiz      5986:               files</a></span></dt>
1.27      rillig   5987: 
                   5988:               <dt><span class="sect1"><a href=
1.38      dillo    5989:               "#components.optional">8.5. Optional
1.27      rillig   5990:               files</a></span></dt>
                   5991: 
1.38      dillo    5992:               <dt><span class="sect1"><a href="#work-dir">8.6.
1.45      wiz      5993:               <code xmlns=
                   5994:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   5995:               "filename">work*</code></a></span></dt>
1.27      rillig   5996: 
1.38      dillo    5997:               <dt><span class="sect1"><a href="#files-dir">8.7.
1.45      wiz      5998:               <code xmlns=
                   5999:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   6000:               "filename">files/*</code></a></span></dt>
1.27      rillig   6001:             </dl>
                   6002:           </dd>
                   6003: 
1.38      dillo    6004:           <dt><span class="chapter"><a href="#makefile">9.
1.45      wiz      6005:           Programming in <code xmlns=
                   6006:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.25      rillig   6007:           "filename">Makefile</code>s</a></span></dt>
                   6008: 
                   6009:           <dd>
                   6010:             <dl>
                   6011:               <dt><span class="sect1"><a href=
1.45      wiz      6012:               "#makefile.variables">9.1. <code xmlns=
                   6013:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.25      rillig   6014:               "filename">Makefile</code> variables</a></span></dt>
                   6015: 
1.27      rillig   6016:               <dd>
                   6017:                 <dl>
                   6018:                   <dt><span class="sect2"><a href=
1.38      dillo    6019:                   "#makefile.variables.names">9.1.1. Naming
1.27      rillig   6020:                   conventions</a></span></dt>
                   6021:                 </dl>
                   6022:               </dd>
                   6023: 
1.38      dillo    6024:               <dt><span class="sect1"><a href="#makefile.code">9.2.
1.25      rillig   6025:               Code snippets</a></span></dt>
                   6026: 
                   6027:               <dd>
                   6028:                 <dl>
                   6029:                   <dt><span class="sect2"><a href=
1.38      dillo    6030:                   "#adding-to-list">9.2.1. Adding things to a
1.25      rillig   6031:                   list</a></span></dt>
                   6032: 
                   6033:                   <dt><span class="sect2"><a href=
1.38      dillo    6034:                   "#converting-internal-to-external">9.2.2.
1.30      wiz      6035:                   Converting an internal list into an external
                   6036:                   list</a></span></dt>
1.25      rillig   6037: 
                   6038:                   <dt><span class="sect2"><a href=
1.38      dillo    6039:                   "#passing-variable-to-shell">9.2.3. Passing
1.30      wiz      6040:                   variables to a shell command</a></span></dt>
1.27      rillig   6041: 
                   6042:                   <dt><span class="sect2"><a href=
1.38      dillo    6043:                   "#quoting-guideline">9.2.4. Quoting
1.27      rillig   6044:                   guideline</a></span></dt>
                   6045: 
                   6046:                   <dt><span class="sect2"><a href=
1.38      dillo    6047:                   "#bsd-make-bug-workaround">9.2.5. Workaround for
1.30      wiz      6048:                   a bug in BSD Make</a></span></dt>
1.25      rillig   6049:                 </dl>
                   6050:               </dd>
                   6051:             </dl>
                   6052:           </dd>
                   6053: 
1.38      dillo    6054:           <dt><span class="chapter"><a href="#plist">10. PLIST
1.1       grant    6055:           issues</a></span></dt>
                   6056: 
                   6057:           <dd>
                   6058:             <dl>
1.38      dillo    6059:               <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1       grant    6060:               ID</a></span></dt>
                   6061: 
1.30      wiz      6062:               <dt><span class="sect1"><a href=
1.38      dillo    6063:               "#automatic-plist-generation">10.2. Semi-automatic
1.45      wiz      6064:               <code xmlns=
                   6065:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   6066:               "filename">PLIST</code> generation</a></span></dt>
1.1       grant    6067: 
1.38      dillo    6068:               <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14      xtraeme  6069:               Tweaking output of <span><strong class="command">make
                   6070:               print-PLIST</strong></span></a></span></dt>
1.1       grant    6071: 
1.38      dillo    6072:               <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1       grant    6073:               Variable substitution in PLIST</a></span></dt>
                   6074: 
1.30      wiz      6075:               <dt><span class="sect1"><a href=
1.48      dillo    6076:               "#manpage-compression">10.5. Man page
                   6077:               compression</a></span></dt>
1.1       grant    6078: 
1.30      wiz      6079:               <dt><span class="sect1"><a href=
1.38      dillo    6080:               "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30      wiz      6081:               <code class=
1.14      xtraeme  6082:               "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    6083: 
1.30      wiz      6084:               <dt><span class="sect1"><a href=
1.47      reed     6085:               "#platform-specific-plist">10.7. Platform-specific
1.38      dillo    6086:               and differing PLISTs</a></span></dt>
1.1       grant    6087: 
                   6088:               <dt><span class="sect1"><a href=
1.38      dillo    6089:               "#faq.common-dirs">10.8. Sharing directories between
1.1       grant    6090:               packages</a></span></dt>
                   6091:             </dl>
                   6092:           </dd>
                   6093: 
1.38      dillo    6094:           <dt><span class="chapter"><a href="#buildlink">11.
1.1       grant    6095:           Buildlink methodology</a></span></dt>
                   6096: 
                   6097:           <dd>
                   6098:             <dl>
1.30      wiz      6099:               <dt><span class="sect1"><a href=
1.38      dillo    6100:               "#converting-to-buildlink3">11.1. Converting packages
1.30      wiz      6101:               to use buildlink3</a></span></dt>
1.1       grant    6102: 
1.30      wiz      6103:               <dt><span class="sect1"><a href=
1.45      wiz      6104:               "#creating-buildlink3.mk">11.2. Writing <code xmlns=
                   6105:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      6106:               "filename">buildlink3.mk</code> files</a></span></dt>
1.1       grant    6107: 
                   6108:               <dd>
                   6109:                 <dl>
                   6110:                   <dt><span class="sect2"><a href=
1.38      dillo    6111:                   "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30      wiz      6112:                   buildlink3.mk file</a></span></dt>
1.1       grant    6113: 
                   6114:                   <dt><span class="sect2"><a href=
1.38      dillo    6115:                   "#updating-buildlink-depends">11.2.2. Updating
1.30      wiz      6116:                   <code class=
1.66    ! rillig   6117:                   "varname">BUILDLINK_DEPENDS.<em class="replaceable">
        !          6118:                   <code>pkg</code></em></code> in <code xmlns=
1.45      wiz      6119:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      6120:                   "filename">buildlink3.mk</code>
1.1       grant    6121:                   files</a></span></dt>
                   6122:                 </dl>
                   6123:               </dd>
                   6124: 
1.30      wiz      6125:               <dt><span class="sect1"><a href=
1.45      wiz      6126:               "#writing-builtin.mk">11.3. Writing <code xmlns=
                   6127:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      6128:               "filename">builtin.mk</code> files</a></span></dt>
1.1       grant    6129: 
                   6130:               <dd>
                   6131:                 <dl>
                   6132:                   <dt><span class="sect2"><a href=
1.38      dillo    6133:                   "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45      wiz      6134:                   <code xmlns=
                   6135:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   6136:                   "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    6137: 
                   6138:                   <dt><span class="sect2"><a href=
1.38      dillo    6139:                   "#native-or-pkgsrc-preference">11.3.2. Global
1.30      wiz      6140:                   preferences for native or pkgsrc
                   6141:                   software</a></span></dt>
1.1       grant    6142:                 </dl>
                   6143:               </dd>
                   6144:             </dl>
                   6145:           </dd>
                   6146: 
1.38      dillo    6147:           <dt><span class="chapter"><a href="#pkginstall">12. The
1.35      jmmv     6148:           pkginstall framework</a></span></dt>
                   6149: 
                   6150:           <dd>
                   6151:             <dl>
                   6152:               <dt><span class="sect1"><a href=
1.38      dillo    6153:               "#files-and-dirs-outside-prefix">12.1. Files and
1.35      jmmv     6154:               directories outside the installation
                   6155:               prefix</a></span></dt>
                   6156: 
                   6157:               <dd>
                   6158:                 <dl>
                   6159:                   <dt><span class="sect2"><a href=
1.38      dillo    6160:                   "#dirs-outside-prefix">12.1.1. Directory
1.35      jmmv     6161:                   manipulation</a></span></dt>
                   6162: 
                   6163:                   <dt><span class="sect2"><a href=
1.38      dillo    6164:                   "#files-outside-prefix">12.1.2. File
1.35      jmmv     6165:                   manipulation</a></span></dt>
                   6166:                 </dl>
                   6167:               </dd>
                   6168: 
1.38      dillo    6169:               <dt><span class="sect1"><a href="#conf-files">12.2.
1.35      jmmv     6170:               Configuration files</a></span></dt>
                   6171: 
                   6172:               <dd>
                   6173:                 <dl>
                   6174:                   <dt><span class="sect2"><a href=
1.38      dillo    6175:                   "#conf-files-sysconfdir">12.2.1. How <code class=
1.35      jmmv     6176:                   "varname">PKG_SYSCONFDIR</code> is
                   6177:                   set</a></span></dt>
                   6178: 
                   6179:                   <dt><span class="sect2"><a href=
1.38      dillo    6180:                   "#conf-files-configure">12.2.2. Telling the
1.47      reed     6181:                   software where configuration files
1.35      jmmv     6182:                   are</a></span></dt>
                   6183: 
                   6184:                   <dt><span class="sect2"><a href=
1.38      dillo    6185:                   "#conf-files-patching">12.2.3. Patching
1.35      jmmv     6186:                   installations</a></span></dt>
                   6187: 
                   6188:                   <dt><span class="sect2"><a href=
1.38      dillo    6189:                   "#conf-files-disable">12.2.4. Disabling handling
1.35      jmmv     6190:                   of configuration files</a></span></dt>
                   6191:                 </dl>
                   6192:               </dd>
                   6193: 
1.38      dillo    6194:               <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35      jmmv     6195:               System startup scripts</a></span></dt>
                   6196: 
                   6197:               <dd>
                   6198:                 <dl>
                   6199:                   <dt><span class="sect2"><a href=
1.38      dillo    6200:                   "#rcd-scripts-disable">12.3.1. Disabling handling
1.35      jmmv     6201:                   of system startup scripts</a></span></dt>
                   6202:                 </dl>
                   6203:               </dd>
                   6204: 
                   6205:               <dt><span class="sect1"><a href=
1.38      dillo    6206:               "#users-and-groups">12.4. System users and
1.35      jmmv     6207:               groups</a></span></dt>
                   6208: 
1.38      dillo    6209:               <dt><span class="sect1"><a href="#shells">12.5.
1.35      jmmv     6210:               System shells</a></span></dt>
                   6211: 
                   6212:               <dd>
                   6213:                 <dl>
                   6214:                   <dt><span class="sect2"><a href=
1.65      hubertf  6215:                   "#shells-disable">12.5.1. Disabling shell
                   6216:                   registration</a></span></dt>
                   6217:                 </dl>
                   6218:               </dd>
                   6219: 
                   6220:               <dt><span class="sect1"><a href="#fonts">12.6.
                   6221:               Fonts</a></span></dt>
                   6222: 
                   6223:               <dd>
                   6224:                 <dl>
                   6225:                   <dt><span class="sect2"><a href=
                   6226:                   "#fonts-disable">12.6.1. Disabling automatic
                   6227:                   update of the fonts databases</a></span></dt>
1.35      jmmv     6228:                 </dl>
                   6229:               </dd>
                   6230:             </dl>
                   6231:           </dd>
                   6232: 
1.38      dillo    6233:           <dt><span class="chapter"><a href="#options">13. Options
1.1       grant    6234:           handling</a></span></dt>
                   6235: 
                   6236:           <dd>
                   6237:             <dl>
1.30      wiz      6238:               <dt><span class="sect1"><a href=
1.38      dillo    6239:               "#global-default-options">13.1. Global default
1.30      wiz      6240:               options</a></span></dt>
1.1       grant    6241: 
1.30      wiz      6242:               <dt><span class="sect1"><a href=
1.38      dillo    6243:               "#converting-to-options">13.2. Converting packages to
1.45      wiz      6244:               use <code xmlns=
                   6245:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6246:               "filename">bsd.options.mk</code></a></span></dt>
1.48      dillo    6247: 
                   6248:               <dt><span class="sect1"><a href="#option-names">13.3.
                   6249:               Option Names</a></span></dt>
1.1       grant    6250:             </dl>
                   6251:           </dd>
                   6252: 
1.38      dillo    6253:           <dt><span class="chapter"><a href="#build">14. The build
1.1       grant    6254:           process</a></span></dt>
                   6255: 
                   6256:           <dd>
                   6257:             <dl>
1.56      rillig   6258:               <dt><span class="sect1"><a href="#build.intro">14.1.
                   6259:               Introduction</a></span></dt>
                   6260: 
                   6261:               <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1       grant    6262:               Program location</a></span></dt>
                   6263: 
1.56      rillig   6264:               <dt><span class="sect1"><a href=
                   6265:               "#build.builddirs">14.3. Directories used during the
                   6266:               build process</a></span></dt>
1.1       grant    6267: 
                   6268:               <dt><span class="sect1"><a href=
1.56      rillig   6269:               "#build.running">14.4. Running a
                   6270:               phase</a></span></dt>
                   6271: 
                   6272:               <dt><span class="sect1"><a href="#build.fetch">14.5.
                   6273:               The <span class="emphasis"><em>fetch</em></span>
                   6274:               phase</a></span></dt>
                   6275: 
                   6276:               <dt><span class="sect1"><a href=
                   6277:               "#build.checksum">14.6. The <span class=
                   6278:               "emphasis"><em>checksum</em></span>
                   6279:               phase</a></span></dt>
                   6280: 
                   6281:               <dt><span class="sect1"><a href=
                   6282:               "#build.extract">14.7. The <span class=
                   6283:               "emphasis"><em>extract</em></span>
                   6284:               phase</a></span></dt>
                   6285: 
                   6286:               <dt><span class="sect1"><a href="#build.patch">14.8.
                   6287:               The <span class="emphasis"><em>patch</em></span>
                   6288:               phase</a></span></dt>
                   6289: 
                   6290:               <dt><span class="sect1"><a href="#build.tools">14.9.
                   6291:               The <span class="emphasis"><em>tools</em></span>
                   6292:               phase</a></span></dt>
                   6293: 
                   6294:               <dt><span class="sect1"><a href=
                   6295:               "#build.wrapper">14.10. The <span class=
                   6296:               "emphasis"><em>wrapper</em></span>
                   6297:               phase</a></span></dt>
                   6298: 
                   6299:               <dt><span class="sect1"><a href=
                   6300:               "#build.configure">14.11. The <span class=
                   6301:               "emphasis"><em>configure</em></span>
                   6302:               phase</a></span></dt>
                   6303: 
                   6304:               <dt><span class="sect1"><a href="#build.build">14.12.
                   6305:               The <span class="emphasis"><em>build</em></span>
                   6306:               phase</a></span></dt>
                   6307: 
                   6308:               <dt><span class="sect1"><a href="#build.test">14.13.
                   6309:               The <span class="emphasis"><em>test</em></span>
                   6310:               phase</a></span></dt>
                   6311: 
                   6312:               <dt><span class="sect1"><a href=
                   6313:               "#build.install">14.14. The <span class=
                   6314:               "emphasis"><em>install</em></span>
                   6315:               phase</a></span></dt>
                   6316: 
                   6317:               <dt><span class="sect1"><a href=
                   6318:               "#build.package">14.15. The <span class=
                   6319:               "emphasis"><em>package</em></span>
                   6320:               phase</a></span></dt>
                   6321: 
                   6322:               <dt><span class="sect1"><a href=
                   6323:               "#build.helpful-targets">14.16. Other helpful
1.1       grant    6324:               targets</a></span></dt>
                   6325:             </dl>
                   6326:           </dd>
                   6327: 
1.55      rillig   6328:           <dt><span class="chapter"><a href="#fixes">15. Making
                   6329:           your package work</a></span></dt>
1.1       grant    6330: 
                   6331:           <dd>
                   6332:             <dl>
1.30      wiz      6333:               <dt><span class="sect1"><a href=
1.38      dillo    6334:               "#general-operation">15.1. General
1.30      wiz      6335:               operation</a></span></dt>
1.1       grant    6336: 
                   6337:               <dd>
                   6338:                 <dl>
                   6339:                   <dt><span class="sect2"><a href=
1.38      dillo    6340:                   "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30      wiz      6341:                   pull in variables from
                   6342:                   /etc/mk.conf</a></span></dt>
1.1       grant    6343: 
                   6344:                   <dt><span class="sect2"><a href=
1.38      dillo    6345:                   "#where-to-install-documentation">15.1.2. Where
1.31      wiz      6346:                   to install documentation</a></span></dt>
                   6347: 
                   6348:                   <dt><span class="sect2"><a href=
1.38      dillo    6349:                   "#restricted-packages">15.1.3. Restricted
1.1       grant    6350:                   packages</a></span></dt>
                   6351: 
                   6352:                   <dt><span class="sect2"><a href=
1.38      dillo    6353:                   "#dependencies">15.1.4. Handling
1.1       grant    6354:                   dependencies</a></span></dt>
                   6355: 
                   6356:                   <dt><span class="sect2"><a href=
1.38      dillo    6357:                   "#conflicts">15.1.5. Handling conflicts with
1.1       grant    6358:                   other packages</a></span></dt>
                   6359: 
                   6360:                   <dt><span class="sect2"><a href=
1.38      dillo    6361:                   "#not-building-packages">15.1.6. Packages that
1.30      wiz      6362:                   cannot or should not be built</a></span></dt>
1.1       grant    6363: 
                   6364:                   <dt><span class="sect2"><a href=
1.38      dillo    6365:                   "#undeletable-packages">15.1.7. Packages which
1.30      wiz      6366:                   should not be deleted, once
                   6367:                   installed</a></span></dt>
1.1       grant    6368: 
                   6369:                   <dt><span class="sect2"><a href=
1.38      dillo    6370:                   "#security-handling">15.1.8. Handling packages
1.1       grant    6371:                   with security problems</a></span></dt>
                   6372: 
                   6373:                   <dt><span class="sect2"><a href=
1.38      dillo    6374:                   "#compiler-bugs">15.1.9. How to handle compiler
1.1       grant    6375:                   bugs</a></span></dt>
                   6376: 
                   6377:                   <dt><span class="sect2"><a href=
1.38      dillo    6378:                   "#bumping-pkgrevision">15.1.10. How to handle
1.30      wiz      6379:                   incrementing versions when fixing an existing
1.1       grant    6380:                   package</a></span></dt>
                   6381: 
                   6382:                   <dt><span class="sect2"><a href=
1.38      dillo    6383:                   "#portability-of-packages">15.1.11. Portability
1.30      wiz      6384:                   of packages</a></span></dt>
1.1       grant    6385:                 </dl>
                   6386:               </dd>
                   6387: 
1.30      wiz      6388:               <dt><span class="sect1"><a href=
1.38      dillo    6389:               "#downloading-issues">15.2. Possible downloading
1.30      wiz      6390:               issues</a></span></dt>
1.1       grant    6391: 
                   6392:               <dd>
                   6393:                 <dl>
                   6394:                   <dt><span class="sect2"><a href=
1.38      dillo    6395:                   "#no-plain-download">15.2.1. Packages whose
1.30      wiz      6396:                   distfiles aren't available for plain
1.1       grant    6397:                   downloading</a></span></dt>
                   6398: 
                   6399:                   <dt><span class="sect2"><a href=
1.38      dillo    6400:                   "#modified-distfiles-same-name">15.2.2. How to
1.30      wiz      6401:                   handle modified distfiles with the 'old'
                   6402:                   name</a></span></dt>
1.1       grant    6403:                 </dl>
                   6404:               </dd>
                   6405: 
1.30      wiz      6406:               <dt><span class="sect1"><a href=
1.38      dillo    6407:               "#configuration-gotchas">15.3. Configuration
1.30      wiz      6408:               gotchas</a></span></dt>
1.1       grant    6409: 
                   6410:               <dd>
                   6411:                 <dl>
                   6412:                   <dt><span class="sect2"><a href=
1.38      dillo    6413:                   "#fixes.libtool">15.3.1. Shared libraries -
1.1       grant    6414:                   libtool</a></span></dt>
                   6415: 
                   6416:                   <dt><span class="sect2"><a href=
1.38      dillo    6417:                   "#using-libtool">15.3.2. Using libtool on GNU
1.1       grant    6418:                   packages that already support
                   6419:                   libtool</a></span></dt>
                   6420: 
                   6421:                   <dt><span class="sect2"><a href=
1.38      dillo    6422:                   "#autoconf-automake">15.3.3. GNU
1.1       grant    6423:                   Autoconf/Automake</a></span></dt>
                   6424:                 </dl>
                   6425:               </dd>
                   6426: 
1.55      rillig   6427:               <dt><span class="sect1"><a href="#fixes-build">15.4.
                   6428:               Building the package</a></span></dt>
1.1       grant    6429: 
                   6430:               <dd>
                   6431:                 <dl>
                   6432:                   <dt><span class="sect2"><a href=
1.38      dillo    6433:                   "#cpp-defines">15.4.1. CPP
1.30      wiz      6434:                   defines</a></span></dt>
1.51      rillig   6435: 
                   6436:                   <dt><span class="sect2"><a href=
1.60      rillig   6437:                   "#cpp-list-examples">15.4.2. Examples of CPP
                   6438:                   defines for some platforms</a></span></dt>
                   6439: 
                   6440:                   <dt><span class="sect2"><a href=
                   6441:                   "#cpp-list">15.4.3. Getting a list of CPP
1.51      rillig   6442:                   defines</a></span></dt>
1.1       grant    6443:                 </dl>
                   6444:               </dd>
                   6445: 
1.30      wiz      6446:               <dt><span class="sect1"><a href=
1.38      dillo    6447:               "#package-specific-actions">15.5. Package specific
1.30      wiz      6448:               actions</a></span></dt>
1.1       grant    6449: 
                   6450:               <dd>
                   6451:                 <dl>
                   6452:                   <dt><span class="sect2"><a href=
1.38      dillo    6453:                   "#user-interaction">15.5.1. User
1.2       hubertf  6454:                   interaction</a></span></dt>
1.1       grant    6455: 
                   6456:                   <dt><span class="sect2"><a href=
1.38      dillo    6457:                   "#handling-licenses">15.5.2. Handling
1.1       grant    6458:                   licenses</a></span></dt>
                   6459: 
                   6460:                   <dt><span class="sect2"><a href=
1.38      dillo    6461:                   "#installing-score-files">15.5.3. Installing
1.30      wiz      6462:                   score files</a></span></dt>
1.1       grant    6463: 
                   6464:                   <dt><span class="sect2"><a href=
1.38      dillo    6465:                   "#perl-scripts">15.5.4. Packages containing perl
1.1       grant    6466:                   scripts</a></span></dt>
                   6467: 
                   6468:                   <dt><span class="sect2"><a href=
1.38      dillo    6469:                   "#hardcoded-paths">15.5.5. Packages with
1.30      wiz      6470:                   hardcoded paths to other
                   6471:                   interpreters</a></span></dt>
1.1       grant    6472: 
                   6473:                   <dt><span class="sect2"><a href=
1.38      dillo    6474:                   "#perl-modules">15.5.6. Packages installing perl
1.1       grant    6475:                   modules</a></span></dt>
                   6476: 
                   6477:                   <dt><span class="sect2"><a href=
1.38      dillo    6478:                   "#faq.info-files">15.5.7. Packages installing
1.1       grant    6479:                   info files</a></span></dt>
                   6480: 
                   6481:                   <dt><span class="sect2"><a href=
1.57      minskim  6482:                   "#manpages">15.5.8. Packages installing man
                   6483:                   pages</a></span></dt>
                   6484: 
                   6485:                   <dt><span class="sect2"><a href=
                   6486:                   "#gconf2-data-files">15.5.9. Packages installing
1.30      wiz      6487:                   GConf2 data files</a></span></dt>
1.1       grant    6488: 
                   6489:                   <dt><span class="sect2"><a href=
1.57      minskim  6490:                   "#scrollkeeper-data-files">15.5.10. Packages
1.30      wiz      6491:                   installing scrollkeeper data
                   6492:                   files</a></span></dt>
1.1       grant    6493: 
                   6494:                   <dt><span class="sect2"><a href=
1.57      minskim  6495:                   "#x11-fonts">15.5.11. Packages installing X11
1.1       grant    6496:                   fonts</a></span></dt>
                   6497: 
                   6498:                   <dt><span class="sect2"><a href=
1.57      minskim  6499:                   "#gtk2-modules">15.5.12. Packages installing GTK2
1.1       grant    6500:                   modules</a></span></dt>
                   6501: 
                   6502:                   <dt><span class="sect2"><a href=
1.57      minskim  6503:                   "#sgml-xml-data">15.5.13. Packages installing
1.30      wiz      6504:                   SGML or XML data</a></span></dt>
1.1       grant    6505: 
                   6506:                   <dt><span class="sect2"><a href=
1.57      minskim  6507:                   "#mime-database">15.5.14. Packages installing
1.1       grant    6508:                   extensions to the MIME database</a></span></dt>
                   6509: 
                   6510:                   <dt><span class="sect2"><a href=
1.57      minskim  6511:                   "#intltool">15.5.15. Packages using
1.1       grant    6512:                   intltool</a></span></dt>
1.18      xtraeme  6513: 
                   6514:                   <dt><span class="sect2"><a href=
1.57      minskim  6515:                   "#startup-scripts">15.5.16. Packages installing
1.30      wiz      6516:                   startup scripts</a></span></dt>
1.57      minskim  6517: 
                   6518:                   <dt><span class="sect2"><a href=
                   6519:                   "#tex-packages">15.5.17. Packages installing TeX
                   6520:                   modules</a></span></dt>
1.1       grant    6521:                 </dl>
                   6522:               </dd>
                   6523: 
1.30      wiz      6524:               <dt><span class="sect1"><a href=
1.38      dillo    6525:               "#feedback-to-author">15.6. Feedback to the
1.30      wiz      6526:               author</a></span></dt>
1.1       grant    6527:             </dl>
                   6528:           </dd>
                   6529: 
1.38      dillo    6530:           <dt><span class="chapter"><a href="#debug">16.
1.1       grant    6531:           Debugging</a></span></dt>
                   6532: 
1.38      dillo    6533:           <dt><span class="chapter"><a href="#submit">17.
1.1       grant    6534:           Submitting and Committing</a></span></dt>
                   6535: 
                   6536:           <dd>
                   6537:             <dl>
1.30      wiz      6538:               <dt><span class="sect1"><a href=
1.38      dillo    6539:               "#submitting-your-package">17.1. Submitting your
1.30      wiz      6540:               packages</a></span></dt>
1.1       grant    6541: 
1.30      wiz      6542:               <dt><span class="sect1"><a href=
1.41      wiz      6543:               "#general-notes-for-changes">17.2. General notes when
                   6544:               adding, updating, or removing
                   6545:               packages</a></span></dt>
                   6546: 
                   6547:               <dt><span class="sect1"><a href=
                   6548:               "#committing-importing">17.3. Committing: Importing a
1.30      wiz      6549:               package into CVS</a></span></dt>
1.1       grant    6550: 
1.30      wiz      6551:               <dt><span class="sect1"><a href=
1.41      wiz      6552:               "#updating-package">17.4. Updating a package to a
1.30      wiz      6553:               newer version</a></span></dt>
1.1       grant    6554: 
1.30      wiz      6555:               <dt><span class="sect1"><a href=
1.41      wiz      6556:               "#moving-package">17.5. Moving a package in
1.30      wiz      6557:               pkgsrc</a></span></dt>
1.1       grant    6558:             </dl>
                   6559:           </dd>
                   6560:         </dl>
                   6561:       </div>
                   6562: 
1.66    ! rillig   6563:       <div class="chapter" lang="en" xml:lang="en">
1.1       grant    6564:         <div class="titlepage">
                   6565:           <div>
                   6566:             <div>
1.66    ! rillig   6567:               <h2 class="title"><a name="components" id=
1.38      dillo    6568:               "components"></a>Chapter&nbsp;8.&nbsp;Package
1.27      rillig   6569:               components - files, directories and contents</h2>
1.25      rillig   6570:             </div>
                   6571:           </div>
                   6572:         </div>
                   6573: 
                   6574:         <div class="toc">
                   6575:           <p><b>Table of Contents</b></p>
                   6576: 
                   6577:           <dl>
                   6578:             <dt><span class="sect1"><a href=
1.45      wiz      6579:             "#components.Makefile">8.1. <code xmlns=
                   6580:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6581:             "filename">Makefile</code></a></span></dt>
                   6582: 
                   6583:             <dt><span class="sect1"><a href=
1.45      wiz      6584:             "#components.distinfo">8.2. <code xmlns=
                   6585:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6586:             "filename">distinfo</code></a></span></dt>
                   6587: 
                   6588:             <dt><span class="sect1"><a href=
1.38      dillo    6589:             "#components.patches">8.3. patches/*</a></span></dt>
1.25      rillig   6590: 
1.30      wiz      6591:             <dt><span class="sect1"><a href=
1.38      dillo    6592:             "#other-mandatory-files">8.4. Other mandatory
1.30      wiz      6593:             files</a></span></dt>
1.25      rillig   6594: 
1.27      rillig   6595:             <dt><span class="sect1"><a href=
1.38      dillo    6596:             "#components.optional">8.5. Optional
1.27      rillig   6597:             files</a></span></dt>
1.25      rillig   6598: 
1.38      dillo    6599:             <dt><span class="sect1"><a href="#work-dir">8.6.
1.45      wiz      6600:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6601:             class="filename">work*</code></a></span></dt>
1.25      rillig   6602: 
1.38      dillo    6603:             <dt><span class="sect1"><a href="#files-dir">8.7.
1.45      wiz      6604:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6605:             class="filename">files/*</code></a></span></dt>
1.25      rillig   6606:           </dl>
                   6607:         </div>
                   6608: 
1.27      rillig   6609:         <p>Whenever you're preparing a package, there are a number
                   6610:         of files involved which are described in the following
                   6611:         sections.</p>
1.25      rillig   6612: 
1.66    ! rillig   6613:         <div class="sect1" lang="en" xml:lang="en">
1.25      rillig   6614:           <div class="titlepage">
                   6615:             <div>
                   6616:               <div>
                   6617:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   6618:                 "components.Makefile" id=
1.45      wiz      6619:                 "components.Makefile"></a>8.1.&nbsp;<code xmlns=
                   6620:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6621:                 "filename">Makefile</code></h2>
1.25      rillig   6622:               </div>
                   6623:             </div>
                   6624:           </div>
                   6625: 
1.27      rillig   6626:           <p>Building, installation and creation of a binary
1.45      wiz      6627:           package are all controlled by the package's <code xmlns=
                   6628:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6629:           "filename">Makefile</code>. The <code xmlns=
                   6630:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6631:           "filename">Makefile</code> describes various things about
                   6632:           a package, for example from where to get it, how to
                   6633:           configure, build, and install it.</p>
                   6634: 
1.45      wiz      6635:           <p>A package <code xmlns=
                   6636:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6637:           "filename">Makefile</code> contains several sections that
                   6638:           describe the package.</p>
1.25      rillig   6639: 
1.27      rillig   6640:           <p>In the first section there are the following
                   6641:           variables, which should appear exactly in the order given
                   6642:           here.</p>
1.25      rillig   6643: 
                   6644:           <div class="itemizedlist">
                   6645:             <ul type="disc">
                   6646:               <li>
1.27      rillig   6647:                 <p><code class="varname">DISTNAME</code> is the
                   6648:                 basename of the distribution file to be downloaded
                   6649:                 from the package's website.</p>
                   6650:               </li>
                   6651: 
                   6652:               <li>
                   6653:                 <p><code class="varname">PKGNAME</code> is the name
                   6654:                 of the package, as used by pkgsrc. You only need to
1.50      rillig   6655:                 provide it if it differs from <code class=
                   6656:                 "varname">DISTNAME</code>. Usually it is the
                   6657:                 directory name together with the version number. It
                   6658:                 must match the regular expression <code class=
1.27      rillig   6659:                 "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
                   6660:                 that is, it starts with a letter or digit, and
                   6661:                 contains only letters, digits, dashes, underscores,
                   6662:                 dots and plus signs.</p>
1.25      rillig   6663:               </li>
                   6664: 
                   6665:               <li>
1.27      rillig   6666:                 <p><code class="varname">CATEGORIES</code> is a
                   6667:                 list of categories which the package fits in. You
                   6668:                 can choose any of the top-level directories of
                   6669:                 pkgsrc for it.</p>
1.45      wiz      6670: 
                   6671:                 <p>Currently the following values are available for
                   6672:                 <code class="varname">CATEGORIES</code>. If more
                   6673:                 than one is used, they need to be separated by
                   6674:                 spaces:</p>
                   6675:                 <pre class="programlisting">
1.51      rillig   6676:     archivers     cross         geography     meta-pkgs     security
                   6677:     audio         databases     graphics      misc          shells
                   6678:     benchmarks    devel         ham           multimedia    sysutils
                   6679:     biology       editors       inputmethod   net           textproc
                   6680:     cad           emulators     lang          news          time
                   6681:     chat          finance       mail          parallel      wm
                   6682:     comms         fonts         math          pkgtools      www
                   6683:     converters    games         mbone         print         x11
1.45      wiz      6684: </pre>
1.25      rillig   6685:               </li>
                   6686: 
                   6687:               <li>
1.27      rillig   6688:                 <p><code class="varname">MASTER_SITES</code> is a
                   6689:                 list of URLs where the distribution files can be
                   6690:                 downloaded. Each URL must end with a slash.</p>
1.45      wiz      6691: 
                   6692:                 <p>The <code class="varname">MASTER_SITES</code>
                   6693:                 may make use of the following predefined sites:</p>
                   6694:                 <pre class="programlisting">
1.51      rillig   6695:     ${MASTER_SITE_APACHE}
                   6696:     ${MASTER_SITE_BACKUP}
                   6697:     ${MASTER_SITE_CYGWIN}
                   6698:     ${MASTER_SITE_DEBIAN}
                   6699:     ${MASTER_SITE_FREEBSD}
                   6700:     ${MASTER_SITE_FREEBSD_LOCAL}
                   6701:     ${MASTER_SITE_GNOME}
                   6702:     ${MASTER_SITE_GNU}
                   6703:     ${MASTER_SITE_GNUSTEP}
                   6704:     ${MASTER_SITE_IFARCHIVE}
                   6705:     ${MASTER_SITE_MOZILLA}
                   6706:     ${MASTER_SITE_OPENOFFICE}
                   6707:     ${MASTER_SITE_PERL_CPAN}
                   6708:     ${MASTER_SITE_R_CRAN}
                   6709:     ${MASTER_SITE_SOURCEFORGE}
                   6710:     ${MASTER_SITE_SUNSITE}
                   6711:     ${MASTER_SITE_SUSE}
                   6712:     ${MASTER_SITE_TEX_CTAN}
                   6713:     ${MASTER_SITE_XCONTRIB}
                   6714:     ${MASTER_SITE_XEMACS}
1.45      wiz      6715: </pre>
                   6716: 
                   6717:                 <p>If one of these predefined sites is chosen, you
                   6718:                 may want to specify a subdirectory of that site.
                   6719:                 Since these macros may expand to more than one
                   6720:                 actual site, you <span class=
                   6721:                 "emphasis"><em>must</em></span> use the following
                   6722:                 construct to specify a subdirectory:</p>
                   6723:                 <pre class="programlisting">
1.51      rillig   6724:     ${MASTER_SITE_GNU:=subdirectory/name/}
                   6725:     ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.45      wiz      6726: </pre>
                   6727: 
                   6728:                 <p>Note the trailing slash after the subdirectory
                   6729:                 name.</p>
                   6730: 
                   6731:                 <p>If the package has multiple <code class=
                   6732:                 "varname">DISTFILES</code> or multiple <code class=
                   6733:                 "varname">PATCHFILES</code> from different sites,
                   6734:                 set <code class="varname">SITES_foo</code> to a
1.47      reed     6735:                 list of URIs where file &#8220;<span class=
1.45      wiz      6736:                 "quote">foo</span>&#8221; may be found.
                   6737:                 &#8220;<span class="quote">foo</span>&#8221;
1.47      reed     6738:                 includes the suffix, e.g.:</p>
1.45      wiz      6739:                 <pre class="programlisting">
1.51      rillig   6740:     DISTFILES=      ${DISTNAME}${EXTRACT_SUFX}
                   6741:     DISTFILES+=     foo-file.tar.gz
                   6742:     SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
                   6743:             http://www.somewhereelse.com/mirror/somehow/
1.45      wiz      6744: </pre>
                   6745:               </li>
                   6746: 
                   6747:               <li>
                   6748:                 <p><code class="varname">DISTFILES</code>: Name(s)
                   6749:                 of archive file(s) containing distribution. The
                   6750:                 default is <code xmlns=
                   6751:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6752:                 "filename">${DISTNAME}${EXTRACT_SUFX}</code>.
                   6753:                 Should only be set if you have more than one
                   6754:                 distfile.</p>
                   6755: 
                   6756:                 <p>Note that the normal default setting of
                   6757:                 <code class="varname">DISTFILES</code> must be made
                   6758:                 explicit if you want to add to it (rather than
                   6759:                 replace it), as you usually would.</p>
                   6760:               </li>
                   6761: 
                   6762:               <li>
                   6763:                 <p><code class="varname">EXTRACT_SUFX</code>:
                   6764:                 Suffix of the distribution file, will be appended
                   6765:                 to <code class="varname">DISTNAME</code>. Defaults
                   6766:                 to <code xmlns=
                   6767:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6768:                 "filename">.tar.gz</code>.</p>
                   6769:               </li>
                   6770:             </ul>
                   6771:           </div>
                   6772: 
                   6773:           <p>The second section contains information about
                   6774:           separately downloaded patches, if any.</p>
                   6775: 
                   6776:           <div class="itemizedlist">
                   6777:             <ul type="disc">
                   6778:               <li>
1.47      reed     6779:                 <p><code class="varname">PATCHFILES:</code> Name(s)
1.45      wiz      6780:                 of additional files that contain distribution
                   6781:                 patches. There is no default. pkgsrc will look for
                   6782:                 them at <code class="varname">PATCH_SITES</code>.
                   6783:                 They will automatically be uncompressed before
                   6784:                 patching if the names end with <code xmlns=
                   6785:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6786:                 "filename">.gz</code> or <code xmlns=
                   6787:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6788:                 "filename">.Z</code>.</p>
                   6789:               </li>
                   6790: 
                   6791:               <li>
                   6792:                 <p><code class="varname">PATCH_SITES</code>:
                   6793:                 Primary location(s) for distribution patch files
                   6794:                 (see <code class="varname">PATCHFILES</code> below)
                   6795:                 if not found locally.</p>
1.25      rillig   6796:               </li>
                   6797:             </ul>
                   6798:           </div>
                   6799: 
1.45      wiz      6800:           <p>The third section contains the following
1.27      rillig   6801:           variables.</p>
1.25      rillig   6802: 
1.27      rillig   6803:           <div class="itemizedlist">
                   6804:             <ul type="disc">
                   6805:               <li>
                   6806:                 <p><code class="varname">MAINTAINER</code> is the
1.50      rillig   6807:                 email address of the person who feels responsible
                   6808:                 for this package, and who is most likely to look at
                   6809:                 problems or questions regarding this package which
                   6810:                 have been reported with <a href=
1.45      wiz      6811:                 "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
                   6812:                 <span class="citerefentry"><span class=
1.50      rillig   6813:                 "refentrytitle">send-pr</span>(1)</span></a>. Other
                   6814:                 developers should contact the <code class=
                   6815:                 "varname">MAINTAINER</code> before making major
                   6816:                 changes to the package. When packaging a new
                   6817:                 program, set <code class=
                   6818:                 "varname">MAINTAINER</code> to yourself. If you
                   6819:                 really can't maintain the package for future
                   6820:                 updates, set it to <code class="email">&lt;<a href=
1.45      wiz      6821:                 "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>&gt;</code>.</p>
1.27      rillig   6822:               </li>
1.25      rillig   6823: 
1.27      rillig   6824:               <li>
                   6825:                 <p><code class="varname">HOMEPAGE</code> is a URL
                   6826:                 where users can find more information about the
1.23      wiz      6827:                 package.</p>
                   6828:               </li>
1.1       grant    6829: 
1.23      wiz      6830:               <li>
                   6831:                 <p><code class="varname">COMMENT</code> is a
1.45      wiz      6832:                 one-line description of the package (should not
                   6833:                 include the package name).</p>
1.23      wiz      6834:               </li>
                   6835:             </ul>
                   6836:           </div>
1.1       grant    6837: 
1.45      wiz      6838:           <p>Other variables that affect the build:</p>
1.1       grant    6839: 
1.45      wiz      6840:           <div class="itemizedlist">
                   6841:             <ul type="disc">
                   6842:               <li>
                   6843:                 <p><code class="varname">WRKSRC</code>: The
1.50      rillig   6844:                 directory where the interesting distribution files
                   6845:                 of the package are found. The default is
                   6846:                 <code xmlns=
                   6847:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6848:                 "filename">${WRKDIR}/${DISTNAME}</code>, which
                   6849:                 works for most packages.</p>
                   6850: 
                   6851:                 <p>If a package doesn't create a subdirectory for
                   6852:                 itself (most GNU software does, for instance), but
                   6853:                 extracts itself in the current directory, you
                   6854:                 should set <code class="varname">WRKSRC=
                   6855:                 ${WRKDIR}</code>.</p>
                   6856: 
                   6857:                 <p>If a package doesn't create a subdirectory with
                   6858:                 the name of <code class="varname">DISTNAME</code>
                   6859:                 but some different name, set <code class=
                   6860:                 "varname">WRKSRC</code> to point to the proper name
                   6861:                 in <code xmlns=
                   6862:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6863:                 "filename">${WRKDIR}</code>, for example
                   6864:                 <code class="varname">WRKSRC=
                   6865:                 ${WRKDIR}/${DISTNAME}/unix</code>. See <a xmlns=
                   6866:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6867:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
                   6868:                 target="_top"><code xmlns="" class=
                   6869:                 "filename">lang/tcl</code></a> and <a xmlns=
                   6870:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6871:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
                   6872:                 target="_top"><code xmlns="" class=
                   6873:                 "filename">x11/tk</code></a> for other
                   6874:                 examples.</p>
                   6875: 
                   6876:                 <p>The name of the working directory created by
                   6877:                 pkgsrc is taken from the <code class=
                   6878:                 "varname">WRKDIR_BASENAME</code> variable. By
                   6879:                 default, its value is <code xmlns=
                   6880:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6881:                 "filename">work</code>. If you want to use the same
                   6882:                 pkgsrc tree for building different kinds of binary
                   6883:                 packages, you can change the variable according to
                   6884:                 your needs. Two other variables handle common cases
                   6885:                 of setting <code class=
                   6886:                 "varname">WRKDIR_BASENAME</code> individually. If
                   6887:                 <code class="varname">OBJHOSTNAME</code> is defined
                   6888:                 in <code xmlns=
1.45      wiz      6889:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.50      rillig   6890:                 "filename">/etc/mk.conf</code>, the first component
                   6891:                 of the host's name is attached to the directory
                   6892:                 name. If <code class="varname">OBJMACHINE</code> is
                   6893:                 defined, the platform name is attached, which might
                   6894:                 look like <code xmlns=
                   6895:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6896:                 "filename">work.i386</code> or <code xmlns=
1.45      wiz      6897:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.50      rillig   6898:                 "filename">work.sparc</code>.</p>
1.45      wiz      6899:               </li>
                   6900:             </ul>
1.1       grant    6901:           </div>
                   6902: 
                   6903:           <p>Please pay attention to the following gotchas:</p>
                   6904: 
                   6905:           <div class="itemizedlist">
                   6906:             <ul type="disc">
                   6907:               <li>
1.14      xtraeme  6908:                 <p>Add <code class="varname">MANCOMPRESSED</code>
1.47      reed     6909:                 if man pages are installed in compressed form by
                   6910:                 the package; see comment in <code xmlns=
1.45      wiz      6911:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6912:                 "filename">bsd.pkg.mk</code>.</p>
1.1       grant    6913:               </li>
                   6914: 
                   6915:               <li>
1.45      wiz      6916:                 <p>Replace <code xmlns=
                   6917:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6918:                 "filename">/usr/local</code> with
                   6919:                 &#8220;<span class="quote">${PREFIX}</span>&#8221;
                   6920:                 in all files (see patches, below).</p>
1.1       grant    6921:               </li>
                   6922: 
                   6923:               <li>
                   6924:                 <p>If the package installs any info files, see
                   6925:                 <a href="#faq.info-files" title=
1.45      wiz      6926:                 "15.5.7.&nbsp;Packages installing info files">Section&nbsp;15.5.7,
                   6927:                 &#8220;Packages installing info
1.1       grant    6928:                 files&#8221;</a>.</p>
                   6929:               </li>
                   6930:             </ul>
                   6931:           </div>
                   6932:         </div>
                   6933: 
1.66    ! rillig   6934:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    6935:           <div class="titlepage">
                   6936:             <div>
                   6937:               <div>
                   6938:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   6939:                 "components.distinfo" id=
1.45      wiz      6940:                 "components.distinfo"></a>8.2.&nbsp;<code xmlns=
                   6941:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6942:                 "filename">distinfo</code></h2>
1.1       grant    6943:               </div>
                   6944:             </div>
                   6945:           </div>
                   6946: 
1.50      rillig   6947:           <p>The <code xmlns=
                   6948:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6949:           "filename">distinfo</code> file contains the message
                   6950:           digest, or checksum, of each distfile needed for the
                   6951:           package. This ensures that the distfiles retrieved from
                   6952:           the Internet have not been corrupted during transfer or
                   6953:           altered by a malign force to introduce a security hole.
                   6954:           Due to recent rumor about weaknesses of digest
                   6955:           algorithms, all distfiles are protected using both SHA1
                   6956:           and RMD160 message digests, as well as the file size.</p>
                   6957: 
                   6958:           <p>The <code xmlns=
                   6959:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6960:           "filename">distinfo</code> file also contains the
                   6961:           checksums for all the patches found in the <code xmlns=
                   6962:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6963:           "filename">patches</code> directory (see <a href=
                   6964:           "#components.patches" title=
                   6965:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
                   6966:           &#8220;patches/*&#8221;</a>).</p>
                   6967: 
                   6968:           <p>To regenerate the <code xmlns=
                   6969:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6970:           "filename">distinfo</code> file, use the
1.14      xtraeme  6971:           <span><strong class="command">make
1.50      rillig   6972:           makedistinfo</strong></span> or <span><strong class=
                   6973:           "command">make mdi</strong></span> command.</p>
1.1       grant    6974: 
1.50      rillig   6975:           <p>Some packages have different sets of distfiles
                   6976:           depending on the platform, for example <a xmlns=
1.1       grant    6977:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   6978:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.45      wiz      6979:           target="_top"><code xmlns="" class=
                   6980:           "filename">www/navigator</code></a>). These are kept in
1.50      rillig   6981:           the same <code xmlns=
1.45      wiz      6982:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.50      rillig   6983:           "filename">distinfo</code> file and care should be taken
                   6984:           when upgrading such a package to ensure distfile
                   6985:           information is not lost.</p>
1.1       grant    6986:         </div>
                   6987: 
1.66    ! rillig   6988:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    6989:           <div class="titlepage">
                   6990:             <div>
                   6991:               <div>
                   6992:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   6993:                 "components.patches" id=
1.38      dillo    6994:                 "components.patches"></a>8.3.&nbsp;patches/*</h2>
1.1       grant    6995:               </div>
                   6996:             </div>
                   6997:           </div>
                   6998: 
                   6999:           <p>This directory contains files that are used by the
                   7000:           <a href=
                   7001:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   7002:           <span class="citerefentry"><span class=
                   7003:           "refentrytitle">patch</span>(1)</span></a> command to
                   7004:           modify the sources as distributed in the distribution
                   7005:           file into a form that will compile and run perfectly on
                   7006:           NetBSD. The files are applied successively in alphabetic
                   7007:           order (as returned by a shell &#8220;<span class=
                   7008:           "quote">patches/patch-*</span>&#8221; glob expansion), so
1.45      wiz      7009:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7010:           class="filename">patch-aa</code> is applied before
                   7011:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7012:           class="filename">patch-ab</code>, etc.</p>
                   7013: 
                   7014:           <p>The <code xmlns=
                   7015:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   7016:           "filename">patch-*</code> files should be in
                   7017:           <span><strong class="command">diff -bu</strong></span>
                   7018:           format, and apply without a fuzz to avoid problems. (To
                   7019:           force patches to apply with fuzz you can set <code class=
1.14      xtraeme  7020:           "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1       grant    7021:           not put changes for more than one file into a single
1.47      reed     7022:           patch file, as this will make future modifications more
1.1       grant    7023:           difficult.</p>
                   7024: 
                   7025:           <p>Similar, a file should be patched at most once, not
                   7026:           several times by several different patches. If a file
                   7027:           needs several patches, they should be combined into one
                   7028:           file.</p>
                   7029: 
                   7030:           <p>One important thing to mention is to pay attention
                   7031:           that no RCS IDs get stored in the patch files, as these
                   7032:           will cause problems when later checked into the NetBSD
1.14      xtraeme  7033:           CVS tree. Use the <span><strong class=
                   7034:           "command">pkgdiff</strong></span> from the <a xmlns=
1.1       grant    7035:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   7036:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45      wiz      7037:           target="_top"><code xmlns="" class=
                   7038:           "filename">pkgtools/pkgdiff</code></a> package to avoid
1.20      ben      7039:           these problems.</p>
1.1       grant    7040: 
                   7041:           <p>For even more automation, we recommend using
1.14      xtraeme  7042:           <span><strong class="command">mkpatches</strong></span>
                   7043:           from the same package to make a whole set of patches. You
                   7044:           just have to backup files before you edit them to
1.45      wiz      7045:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7046:           class="filename">filename.orig</code>, e.g. with
1.14      xtraeme  7047:           <span><strong class="command">cp -p filename
                   7048:           filename.orig</strong></span> or, easier, by using
                   7049:           <span><strong class="command">pkgvi</strong></span> again
                   7050:           from the same package. If you upgrade a package this way,
                   7051:           you can easily compare the new set of patches with the
                   7052:           previously existing one with <span><strong class=
                   7053:           "command">patchdiff</strong></span>.</p>
1.1       grant    7054: 
                   7055:           <p>When you have finished a package, remember to generate
                   7056:           the checksums for the patch files by using the
1.14      xtraeme  7057:           <span><strong class="command">make
                   7058:           makepatchsum</strong></span> command, see <a href=
                   7059:           "#components.distinfo" title=
1.38      dillo    7060:           "8.2.&nbsp;distinfo">Section&nbsp;8.2,
1.45      wiz      7061:           &#8220;<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7062:           class="filename">distinfo</code>&#8221;</a>.</p>
1.1       grant    7063: 
1.46      gdt      7064:           <p>When adding a patch that corrects a problem in the
                   7065:           distfile (rather than e.g. enforcing pkgsrc's view of
                   7066:           where man pages should go), send the patch as a bug
                   7067:           report to the maintainer. This benefits non-pkgsrc users
                   7068:           of the package, and usually enables removing the patch in
                   7069:           future version.</p>
                   7070: 
1.1       grant    7071:           <p>Patch files that are distributed by the author or
1.14      xtraeme  7072:           other maintainers can be listed in <code class=
                   7073:           "varname">$PATCHFILES</code>.</p>
1.1       grant    7074: 
                   7075:           <p>If it is desired to store any patches that should not
                   7076:           be committed into pkgsrc, they can be kept outside the
1.45      wiz      7077:           pkgsrc tree in the <code xmlns=
                   7078:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7079:           "filename">$LOCALPATCHES</code> directory. The directory
1.1       grant    7080:           tree there is expected to have the same
                   7081:           &#8220;<span class="quote">category/package</span>&#8221;
                   7082:           structure as pkgsrc, and patches are expected to be
1.45      wiz      7083:           stored inside these dirs (also known as <code xmlns=
                   7084:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     7085:           "filename">$LOCALPATCHES/$PKGPATH</code>). For example,
                   7086:           if you want to keep a private patch for <code xmlns=
1.45      wiz      7087:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7088:           "filename">pkgsrc/graphics/png</code>, keep it in
1.45      wiz      7089:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7090:           class=
1.14      xtraeme  7091:           "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
                   7092:           files in the named directory are expected to be patch
1.1       grant    7093:           files, and <span class="emphasis"><em>they are applied
                   7094:           after pkgsrc patches are applied</em></span>.</p>
1.27      rillig   7095:         </div>
                   7096: 
1.66    ! rillig   7097:         <div class="sect1" lang="en" xml:lang="en">
1.27      rillig   7098:           <div class="titlepage">
                   7099:             <div>
                   7100:               <div>
                   7101:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   7102:                 "other-mandatory-files" id=
1.38      dillo    7103:                 "other-mandatory-files"></a>8.4.&nbsp;Other
1.27      rillig   7104:                 mandatory files</h2>
                   7105:               </div>
                   7106:             </div>
                   7107:           </div>
                   7108: 
                   7109:           <div class="variablelist">
                   7110:             <dl>
1.45      wiz      7111:               <dt><span class="term"><code xmlns=
                   7112:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7113:               "filename">DESCR</code></span></dt>
                   7114: 
                   7115:               <dd>
                   7116:                 <p>A multi-line description of the piece of
                   7117:                 software. This should include any credits where
                   7118:                 they are due. Please bear in mind that others do
                   7119:                 not share your sense of humour (or spelling
                   7120:                 idiosyncrasies), and that others will read
                   7121:                 everything that you write here.</p>
                   7122:               </dd>
                   7123: 
1.45      wiz      7124:               <dt><span class="term"><code xmlns=
                   7125:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7126:               "filename">PLIST</code></span></dt>
                   7127: 
                   7128:               <dd>
                   7129:                 <p>This file governs the files that are installed
                   7130:                 on your system: all the binaries, manual pages,
                   7131:                 etc. There are other directives which may be
                   7132:                 entered in this file, to control the creation and
                   7133:                 deletion of directories, and the location of
                   7134:                 inserted files. See <a href="#plist" title=
1.38      dillo    7135:                 "Chapter&nbsp;10.&nbsp;PLIST issues">Chapter&nbsp;10,
1.27      rillig   7136:                 <i>PLIST issues</i></a> for more information.</p>
                   7137:               </dd>
                   7138:             </dl>
                   7139:           </div>
                   7140:         </div>
                   7141: 
1.66    ! rillig   7142:         <div class="sect1" lang="en" xml:lang="en">
1.27      rillig   7143:           <div class="titlepage">
                   7144:             <div>
                   7145:               <div>
                   7146:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   7147:                 "components.optional" id=
1.38      dillo    7148:                 "components.optional"></a>8.5.&nbsp;Optional
1.27      rillig   7149:                 files</h2>
                   7150:               </div>
                   7151:             </div>
                   7152:           </div>
                   7153: 
                   7154:           <div class="variablelist">
                   7155:             <dl>
1.45      wiz      7156:               <dt><span class="term"><code xmlns=
                   7157:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7158:               "filename">INSTALL</code></span></dt>
                   7159: 
                   7160:               <dd>
                   7161:                 <p>This shell script is invoked twice by <a href=
                   7162:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7163:                 <span class="citerefentry"><span class=
                   7164:                 "refentrytitle">pkg_add</span>(1)</span></a>. First
                   7165:                 time after package extraction and before files are
                   7166:                 moved in place, the second time after the files to
                   7167:                 install are moved in place. This can be used to do
                   7168:                 any custom procedures not possible with @exec
1.45      wiz      7169:                 commands in <code xmlns=
                   7170:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7171:                 "filename">PLIST</code>. See <a href=
1.27      rillig   7172:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7173:                 <span class="citerefentry"><span class=
                   7174:                 "refentrytitle">pkg_add</span>(1)</span></a> and
                   7175:                 <a href=
                   7176:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   7177:                 <span class="citerefentry"><span class=
                   7178:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   7179:                 more information.</p>
                   7180:               </dd>
                   7181: 
1.45      wiz      7182:               <dt><span class="term"><code xmlns=
                   7183:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7184:               "filename">DEINSTALL</code></span></dt>
                   7185: 
                   7186:               <dd>
                   7187:                 <p>This script is executed before and after any
                   7188:                 files are removed. It is this script's
                   7189:                 responsibility to clean up any additional messy
                   7190:                 details around the package's installation, since
                   7191:                 all pkg_delete knows is how to delete the files
                   7192:                 created in the original distribution. See <a href=
                   7193:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   7194:                 <span class="citerefentry"><span class=
                   7195:                 "refentrytitle">pkg_delete</span>(1)</span></a> and
                   7196:                 <a href=
                   7197:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   7198:                 <span class="citerefentry"><span class=
                   7199:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   7200:                 more information.</p>
                   7201:               </dd>
                   7202: 
1.45      wiz      7203:               <dt><span class="term"><code xmlns=
                   7204:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7205:               "filename">MESSAGE</code></span></dt>
                   7206: 
                   7207:               <dd>
1.50      rillig   7208:                 <p>This file is displayed after installation of the
1.27      rillig   7209:                 package. Useful for things like legal notices on
                   7210:                 almost-free software and hints for updating config
                   7211:                 files after installing modules for apache, PHP etc.
                   7212:                 Please note that you can modify variables in it
                   7213:                 easily by using <code class=
                   7214:                 "varname">MESSAGE_SUBST</code> in the package's
1.45      wiz      7215:                 <code xmlns=
                   7216:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7217:                 "filename">Makefile</code>:</p>
1.27      rillig   7218:                 <pre class="programlisting">
1.51      rillig   7219:     MESSAGE_SUBST+=  SOMEVAR="somevalue"
1.27      rillig   7220: </pre>
                   7221: 
                   7222:                 <p>replaces "${SOMEVAR}" with &#8220;<span class=
1.45      wiz      7223:                 "quote">somevalue</span>&#8221; in <code xmlns=
                   7224:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7225:                 "filename">MESSAGE</code>.</p>
                   7226:               </dd>
                   7227:             </dl>
                   7228:           </div>
                   7229:         </div>
                   7230: 
1.66    ! rillig   7231:         <div class="sect1" lang="en" xml:lang="en">
1.27      rillig   7232:           <div class="titlepage">
                   7233:             <div>
                   7234:               <div>
                   7235:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   7236:                 "work-dir" id="work-dir"></a>8.6.&nbsp;<code xmlns=
1.45      wiz      7237:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7238:                 "filename">work*</code></h2>
                   7239:               </div>
                   7240:             </div>
                   7241:           </div>
                   7242: 
                   7243:           <p>When you type <span><strong class=
1.47      reed     7244:           "command">make</strong></span>, the distribution files
                   7245:           are unpacked into the directory denoted by <code class=
1.45      wiz      7246:           "varname">WRKDIR</code>. It can be removed by running
                   7247:           <span><strong class="command">make clean</strong></span>.
                   7248:           Besides the sources, this directory is also used to keep
                   7249:           various timestamp files. The directory gets <span class=
                   7250:           "emphasis"><em>removed completely</em></span> on clean.
                   7251:           The default is <code xmlns=
                   7252:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   7253:           "filename">${.CURDIR}/work</code> or <code xmlns=
                   7254:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   7255:           "filename">${.CURDIR}/work.${MACHINE_ARCH}</code> if
                   7256:           <code class="varname">OBJMACHINE</code> is set.</p>
1.27      rillig   7257:         </div>
                   7258: 
1.66    ! rillig   7259:         <div class="sect1" lang="en" xml:lang="en">
1.27      rillig   7260:           <div class="titlepage">
                   7261:             <div>
                   7262:               <div>
                   7263:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   7264:                 "files-dir" id=
1.45      wiz      7265:                 "files-dir"></a>8.7.&nbsp;<code xmlns=
                   7266:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7267:                 "filename">files/*</code></h2>
                   7268:               </div>
                   7269:             </div>
                   7270:           </div>
                   7271: 
                   7272:           <p>If you have any files that you wish to be placed in
                   7273:           the package prior to configuration or building, you could
                   7274:           place these files here and use a &#8220;<span class=
                   7275:           "quote">${CP}</span>&#8221; command in the
                   7276:           &#8220;<span class="quote">pre-configure</span>&#8221;
                   7277:           target to achieve this. Alternatively, you could simply
1.45      wiz      7278:           diff the file against <code xmlns=
                   7279:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7280:           "filename">/dev/null</code> and use the patch mechanism
                   7281:           to manage the creation of this file.</p>
                   7282:         </div>
                   7283:       </div>
                   7284: 
1.66    ! rillig   7285:       <div class="chapter" lang="en" xml:lang="en">
1.27      rillig   7286:         <div class="titlepage">
                   7287:           <div>
                   7288:             <div>
1.66    ! rillig   7289:               <h2 class="title"><a name="makefile" id=
1.38      dillo    7290:               "makefile"></a>Chapter&nbsp;9.&nbsp;Programming in
1.45      wiz      7291:               <code xmlns=
                   7292:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   7293:               "filename">Makefile</code>s</h2>
1.27      rillig   7294:             </div>
                   7295:           </div>
                   7296:         </div>
                   7297: 
                   7298:         <div class="toc">
                   7299:           <p><b>Table of Contents</b></p>
                   7300: 
                   7301:           <dl>
                   7302:             <dt><span class="sect1"><a href=
1.45      wiz      7303:             "#makefile.variables">9.1. <code xmlns=
                   7304:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7305:             "filename">Makefile</code> variables</a></span></dt>
                   7306: 
                   7307:             <dd>
                   7308:               <dl>
                   7309:                 <dt><span class="sect2"><a href=
1.38      dillo    7310:                 "#makefile.variables.names">9.1.1. Naming
1.27      rillig   7311:                 conventions</a></span></dt>
                   7312:               </dl>
                   7313:             </dd>
                   7314: 
1.38      dillo    7315:             <dt><span class="sect1"><a href="#makefile.code">9.2.
1.27      rillig   7316:             Code snippets</a></span></dt>
                   7317: 
                   7318:             <dd>
                   7319:               <dl>
1.30      wiz      7320:                 <dt><span class="sect2"><a href=
1.38      dillo    7321:                 "#adding-to-list">9.2.1. Adding things to a
1.30      wiz      7322:                 list</a></span></dt>
1.27      rillig   7323: 
1.30      wiz      7324:                 <dt><span class="sect2"><a href=
1.38      dillo    7325:                 "#converting-internal-to-external">9.2.2.
1.27      rillig   7326:                 Converting an internal list into an external
                   7327:                 list</a></span></dt>
                   7328: 
1.30      wiz      7329:                 <dt><span class="sect2"><a href=
1.38      dillo    7330:                 "#passing-variable-to-shell">9.2.3. Passing
1.30      wiz      7331:                 variables to a shell command</a></span></dt>
1.27      rillig   7332: 
1.30      wiz      7333:                 <dt><span class="sect2"><a href=
1.38      dillo    7334:                 "#quoting-guideline">9.2.4. Quoting
1.30      wiz      7335:                 guideline</a></span></dt>
1.27      rillig   7336: 
1.30      wiz      7337:                 <dt><span class="sect2"><a href=
1.38      dillo    7338:                 "#bsd-make-bug-workaround">9.2.5. Workaround for a
1.30      wiz      7339:                 bug in BSD Make</a></span></dt>
1.27      rillig   7340:               </dl>
                   7341:             </dd>
                   7342:           </dl>
                   7343:         </div>
                   7344: 
1.45      wiz      7345:         <p>Pkgsrc consists of many <code xmlns=
                   7346:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7347:         "filename">Makefile</code> fragments, each of which forms a
                   7348:         well-defined part of the pkgsrc system. Using the <a href=
                   7349:         "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7350:         <span class="citerefentry"><span class=
                   7351:         "refentrytitle">make</span>(1)</span></a> system as a
                   7352:         programming language for a big system like pkgsrc requires
                   7353:         some discipline to keep the code correct and
                   7354:         understandable.</p>
                   7355: 
1.45      wiz      7356:         <p>The basic ingredients for <code xmlns=
                   7357:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7358:         "filename">Makefile</code> programming are variables (which
                   7359:         are actually macros) and shell commands. Among these shell
                   7360:         commands may even be more complex ones like <a href=
                   7361:         "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
                   7362:         <span class="citerefentry"><span class=
                   7363:         "refentrytitle">awk</span>(1)</span></a> programs. To make
                   7364:         sure that every shell command runs as intended it is
                   7365:         necessary to quote all variables correctly when they are
                   7366:         used.</p>
                   7367: 
                   7368:         <p>This chapter describes some patterns, that appear quite
1.45      wiz      7369:         often in <code xmlns=
                   7370:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   7371:         "filename">Makefile</code>s, including the pitfalls that
                   7372:         come along with them.</p>
1.27      rillig   7373: 
1.66    ! rillig   7374:         <div class="sect1" lang="en" xml:lang="en">
1.27      rillig   7375:           <div class="titlepage">
                   7376:             <div>
                   7377:               <div>
                   7378:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   7379:                 "makefile.variables" id=
1.45      wiz      7380:                 "makefile.variables"></a>9.1.&nbsp;<code xmlns=
                   7381:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7382:                 "filename">Makefile</code> variables</h2>
                   7383:               </div>
                   7384:             </div>
                   7385:           </div>
                   7386: 
1.45      wiz      7387:           <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7388:           class="filename">Makefile</code> variables contain
                   7389:           strings that can be processed using the five operators
                   7390:           ``='', ``+='', ``?='', ``:='', and ``!='', which are
                   7391:           described in the <a href=
1.27      rillig   7392:           "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7393:           <span class="citerefentry"><span class=
                   7394:           "refentrytitle">make</span>(1)</span></a> man page.</p>
                   7395: 
1.45      wiz      7396:           <p>When a variable's value is parsed from a <code xmlns=
                   7397:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7398:           "filename">Makefile</code>, the hash character ``#'' and
                   7399:           the backslash character ``\'' are handled specially. If a
                   7400:           backslash is followed by a newline, any whitespace
                   7401:           immediately in front of the backslash, the backslash, the
                   7402:           newline, and any whitespace immediately behind the
                   7403:           newline are replaced with a single space. A backspace
                   7404:           character and an immediately following hash character are
1.47      reed     7405:           replaced with a single hash character. Otherwise, the
1.27      rillig   7406:           backslash is passed as is. In a variable assignment, any
                   7407:           hash character that is not preceded by a backslash starts
                   7408:           a comment that continues upto the end of the logical
                   7409:           line.</p>
                   7410: 
                   7411:           <p><span class="emphasis"><em>Note:</em></span> Because
                   7412:           of this parsing algorithm the only way to create a
                   7413:           variable consisting of a single backslash is using the
                   7414:           ``!='' operator, for example: <code class=
                   7415:           "varname">BACKSLASH!=echo "\\"</code>.</p>
                   7416: 
                   7417:           <p>So far for defining variables. The other thing you can
                   7418:           do with variables is evaluating them. A variable is
                   7419:           evaluated when it is part of the right side of the ``:=''
                   7420:           or the ``!='' operator, or directly before executing a
                   7421:           shell command which the variable is part of. In all other
1.47      reed     7422:           cases, <a href=
1.27      rillig   7423:           "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7424:           <span class="citerefentry"><span class=
                   7425:           "refentrytitle">make</span>(1)</span></a> performs lazy
                   7426:           evaluation, that is, variables are not evaluated until
                   7427:           there's no other way. The ``modifiers'' mentioned in the
                   7428:           man page also evaluate the variable.</p>
                   7429: 
                   7430:           <p>Some of the modifiers split the string into words and
                   7431:           then operate on the words, others operate on the string
1.47      reed     7432:           as a whole. When a string is split into words, it is
                   7433:           split as you would expect it from <a href=
1.27      rillig   7434:           "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
                   7435:           <span class="citerefentry"><span class=
                   7436:           "refentrytitle">sh</span>(1)</span></a>.</p>
                   7437: 
                   7438:           <p>No rule without exception&#8212;the
                   7439:           <span><strong class="command">.for</strong></span> loop
                   7440:           does not follow the shell quoting rules but splits at
                   7441:           sequences of whitespace.</p>
                   7442: 
                   7443:           <p>There are several types of variables that should be
                   7444:           handled differently. Strings and two types of lists.</p>
                   7445: 
                   7446:           <div class="itemizedlist">
                   7447:             <ul type="disc">
                   7448:               <li>
                   7449:                 <p><span class="emphasis"><em>Strings</em></span>
1.47      reed     7450:                 can contain arbitrary characters. Nevertheless, you
1.27      rillig   7451:                 should restrict yourself to only using printable
                   7452:                 characters. Examples are <code class=
                   7453:                 "varname">PREFIX</code> and <code class=
                   7454:                 "varname">COMMENT</code>.</p>
                   7455:               </li>
                   7456: 
                   7457:               <li>
                   7458:                 <p><span class="emphasis"><em>Internal
                   7459:                 lists</em></span> are lists that are never exported
                   7460:                 to any shell command. Their elements are separated
1.47      reed     7461:                 by whitespace. Therefore, the elements themselves
1.27      rillig   7462:                 cannot have embedded whitespace. Any other
                   7463:                 characters are allowed. Internal lists can be used
                   7464:                 in <span><strong class=
                   7465:                 "command">.for</strong></span> loops. Examples are
                   7466:                 <code class="varname">DEPENDS</code> and
                   7467:                 <code class="varname">BUILD_DEPENDS</code>.</p>
                   7468:               </li>
                   7469: 
                   7470:               <li>
                   7471:                 <p><span class="emphasis"><em>External
                   7472:                 lists</em></span> are lists that may be exported to
                   7473:                 a shell command. Their elements can contain any
                   7474:                 characters, including whitespace. That's why they
                   7475:                 cannot be used in <span><strong class=
                   7476:                 "command">.for</strong></span> loops. Examples are
                   7477:                 <code class="varname">DISTFILES</code> and
                   7478:                 <code class="varname">MASTER_SITES</code>.</p>
                   7479:               </li>
                   7480:             </ul>
                   7481:           </div>
                   7482: 
1.66    ! rillig   7483:           <div class="sect2" lang="en" xml:lang="en">
1.27      rillig   7484:             <div class="titlepage">
                   7485:               <div>
                   7486:                 <div>
                   7487:                   <h3 class="title"><a name=
1.66    ! rillig   7488:                   "makefile.variables.names" id=
1.38      dillo    7489:                   "makefile.variables.names"></a>9.1.1.&nbsp;Naming
1.27      rillig   7490:                   conventions</h3>
                   7491:                 </div>
                   7492:               </div>
                   7493:             </div>
                   7494: 
                   7495:             <div class="itemizedlist">
                   7496:               <ul type="disc">
                   7497:                 <li>
                   7498:                   <p>All variable names starting with an underscore
                   7499:                   are reserved for use by the pkgsrc
                   7500:                   infrastructure. They shall not be used by package
1.45      wiz      7501:                   <code xmlns=
                   7502:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   7503:                   "filename">Makefile</code>s.</p>
1.27      rillig   7504:                 </li>
                   7505: 
                   7506:                 <li>
                   7507:                   <p>In <span><strong class=
                   7508:                   "command">.for</strong></span> loops you should
                   7509:                   use lowercase variable names for the iteration
                   7510:                   variables.</p>
                   7511:                 </li>
                   7512: 
                   7513:                 <li>
                   7514:                   <p>All list variables should have a ``plural''
                   7515:                   name, e.g. <code class=
                   7516:                   "varname">PKG_OPTIONS</code> or <code class=
                   7517:                   "varname">DISTFILES</code>.</p>
                   7518:                 </li>
                   7519:               </ul>
                   7520:             </div>
                   7521:           </div>
                   7522:         </div>
                   7523: 
1.66    ! rillig   7524:         <div class="sect1" lang="en" xml:lang="en">
1.27      rillig   7525:           <div class="titlepage">
                   7526:             <div>
                   7527:               <div>
                   7528:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   7529:                 "makefile.code" id=
1.38      dillo    7530:                 "makefile.code"></a>9.2.&nbsp;Code snippets</h2>
1.27      rillig   7531:               </div>
                   7532:             </div>
                   7533:           </div>
                   7534: 
                   7535:           <p>This section presents you with some code snippets you
                   7536:           should use in your own code. If you don't find anything
                   7537:           appropriate here, you should test your code and add it
                   7538:           here.</p>
                   7539: 
1.66    ! rillig   7540:           <div class="sect2" lang="en" xml:lang="en">
1.27      rillig   7541:             <div class="titlepage">
                   7542:               <div>
                   7543:                 <div>
1.66    ! rillig   7544:                   <h3 class="title"><a name="adding-to-list" id=
1.38      dillo    7545:                   "adding-to-list"></a>9.2.1.&nbsp;Adding things to
1.30      wiz      7546:                   a list</h3>
1.27      rillig   7547:                 </div>
                   7548:               </div>
                   7549:             </div>
                   7550:             <pre class="programlisting">
1.51      rillig   7551:     STRING=                 foo * bar `date`
                   7552:     INT_LIST=               # empty
                   7553:     ANOTHER_INT_LIST=       apache-[0-9]*:../../www/apache
                   7554:     EXT_LIST=               # empty
                   7555:     ANOTHER_EXT_LIST=       a=b c=d
                   7556: 
                   7557:     INT_LIST+=              ${STRING}               # 1
                   7558:     INT_LIST+=              ${ANOTHER_INT_LIST}     # 2
                   7559:     EXT_LIST+=              ${STRING:Q}             # 3
                   7560:     EXT_LIST+=              ${ANOTHER_EXT_LIST}     # 4
1.27      rillig   7561: </pre>
                   7562: 
                   7563:             <p>When you add a string to an external list (example
                   7564:             3), it must be quoted. In all other cases, you must not
                   7565:             add a quoting level. You must not merge internal and
                   7566:             external lists, unless you are sure that all entries
                   7567:             are correctly interpreted in both lists.</p>
                   7568:           </div>
                   7569: 
1.66    ! rillig   7570:           <div class="sect2" lang="en" xml:lang="en">
1.27      rillig   7571:             <div class="titlepage">
                   7572:               <div>
                   7573:                 <div>
1.30      wiz      7574:                   <h3 class="title"><a name=
1.66    ! rillig   7575:                   "converting-internal-to-external" id=
1.38      dillo    7576:                   "converting-internal-to-external"></a>9.2.2.&nbsp;Converting
1.30      wiz      7577:                   an internal list into an external list</h3>
1.27      rillig   7578:                 </div>
                   7579:               </div>
                   7580:             </div>
                   7581:             <pre class="programlisting">
1.51      rillig   7582:     EXT_LIST=       # empty
                   7583:     .for i in ${INT_LIST}
                   7584:     EXT_LIST+=      ${i:Q}""
                   7585:     .endfor
1.27      rillig   7586: </pre>
                   7587: 
                   7588:             <p>This code converts the internal list <code class=
                   7589:             "varname">INT_LIST</code> into the external list
                   7590:             <code class="varname">EXT_LIST</code>. As the elements
                   7591:             of an internal list are unquoted they must be quoted
                   7592:             here. The reason for appending <code class=
                   7593:             "varname">""</code> is explained below.</p>
                   7594:           </div>
1.1       grant    7595: 
1.66    ! rillig   7596:           <div class="sect2" lang="en" xml:lang="en">
1.27      rillig   7597:             <div class="titlepage">
1.1       grant    7598:               <div>
1.27      rillig   7599:                 <div>
1.30      wiz      7600:                   <h3 class="title"><a name=
1.66    ! rillig   7601:                   "passing-variable-to-shell" id=
1.38      dillo    7602:                   "passing-variable-to-shell"></a>9.2.3.&nbsp;Passing
1.30      wiz      7603:                   variables to a shell command</h3>
1.27      rillig   7604:                 </div>
1.1       grant    7605:               </div>
                   7606:             </div>
1.27      rillig   7607:             <pre class="programlisting">
1.51      rillig   7608:     STRING=         foo bar &lt;    &gt; * `date` $$HOME ' "
                   7609:     EXT_LIST=       string=${STRING:Q} x=second\ item
1.27      rillig   7610: 
1.51      rillig   7611:     all:
                   7612:             echo ${STRING}                  # 1
                   7613:             echo "${STRING}"                # 2
                   7614:             echo "${STRING:Q}"              # 3
                   7615:             echo ${STRING:Q}                # 4
                   7616:             echo x${STRING:Q} | sed 1s,.,,  # 5
                   7617:             env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
1.27      rillig   7618: </pre>
                   7619: 
                   7620:             <p>Example 1 leads to a syntax error in the shell, as
                   7621:             the characters are just copied.</p>
                   7622: 
                   7623:             <p>Example 2 leads to a syntax error too, and if you
                   7624:             leave out the last " character from <code class=
                   7625:             "varname">${STRING}</code>, <a href=
                   7626:             "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
                   7627:             <span class="citerefentry"><span class=
                   7628:             "refentrytitle">date</span>(1)</span></a> will be
                   7629:             executed. The <code class="varname">$HOME</code> shell
                   7630:             variable would be evaluated, too.</p>
                   7631: 
                   7632:             <p>Example 3 outputs each space character preceded by a
                   7633:             backslash (or not), depending on the implementation of
                   7634:             the <a href=
                   7635:             "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   7636:             <span class="citerefentry"><span class=
                   7637:             "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1       grant    7638: 
1.27      rillig   7639:             <p>Example 4 handles correctly every string that does
                   7640:             not start with a dash. In that case, the result depends
                   7641:             on the implementation of the <a href=
                   7642:             "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   7643:             <span class="citerefentry"><span class=
                   7644:             "refentrytitle">echo</span>(1)</span></a> command. As
                   7645:             long as you can guarantee that your input does not
1.47      reed     7646:             start with a dash, this form is appropriate.</p>
1.1       grant    7647: 
1.27      rillig   7648:             <p>Example 5 handles even the case of a leading dash
                   7649:             correctly.</p>
1.1       grant    7650: 
1.27      rillig   7651:             <p>The <code class="varname">EXT_LIST</code> does not
1.47      reed     7652:             need to be quoted because the quoting has already been
1.27      rillig   7653:             done when adding elements to the list.</p>
1.1       grant    7654: 
1.27      rillig   7655:             <p>As internal lists shall not be passed to the shell,
                   7656:             there is no example for it.</p>
1.1       grant    7657:           </div>
                   7658: 
1.66    ! rillig   7659:           <div class="sect2" lang="en" xml:lang="en">
1.27      rillig   7660:             <div class="titlepage">
1.1       grant    7661:               <div>
1.27      rillig   7662:                 <div>
1.66    ! rillig   7663:                   <h3 class="title"><a name="quoting-guideline" id=
1.38      dillo    7664:                   "quoting-guideline"></a>9.2.4.&nbsp;Quoting
1.27      rillig   7665:                   guideline</h3>
                   7666:                 </div>
1.1       grant    7667:               </div>
                   7668:             </div>
                   7669: 
1.27      rillig   7670:             <p>There are many possible sources of wrongly quoted
                   7671:             variables. This section lists some of the commonly
                   7672:             known ones.</p>
1.1       grant    7673: 
1.27      rillig   7674:             <div class="itemizedlist">
                   7675:               <ul type="disc">
                   7676:                 <li>
                   7677:                   <p>Whenever you use the value of a list, think
                   7678:                   about what happens to leading or trailing
                   7679:                   whitespace. If the list is a well-formed shell
1.47      reed     7680:                   expression, you can apply the <code class=
1.27      rillig   7681:                   "varname">:M*</code> modifier to strip leading
                   7682:                   and trailing whitespace from each word. The
                   7683:                   <code class="varname">:M</code> operator first
                   7684:                   splits its argument according to the rules of the
                   7685:                   shell, and then creates a new list consisting of
                   7686:                   all words that match the shell glob expression
                   7687:                   <code class="varname">*</code>, that is: all. One
                   7688:                   class of situations where this is needed is when
                   7689:                   adding a variable like <code class=
                   7690:                   "varname">CPPFLAGS</code> to <code class=
                   7691:                   "varname">CONFIGURE_ARGS</code>. If the configure
1.47      reed     7692:                   script invokes other configure scripts, it strips
1.27      rillig   7693:                   the leading and trailing whitespace from the
                   7694:                   variable and then passes it to the other
                   7695:                   configure scripts. But these configure scripts
                   7696:                   expect the (child) <code class=
                   7697:                   "varname">CPPFLAGS</code> variable to be the same
                   7698:                   as the parent <code class=
                   7699:                   "varname">CPPFLAGS</code>. That's why we better
                   7700:                   pass the <code class="varname">CPPFLAGS</code>
                   7701:                   value properly trimmed. And here is how we do
                   7702:                   it:</p>
                   7703:                   <pre class="programlisting">
1.51      rillig   7704:     CPPFLAGS=               # empty
                   7705:     CPPFLAGS+=              -Wundef -DPREFIX=\"${PREFIX:Q}\"
                   7706:     CPPFLAGS+=              ${MY_CPPFLAGS}
                   7707: 
                   7708:     CONFIGURE_ARGS+=        CPPFLAGS=${CPPFLAGS:M*:Q}
                   7709: 
                   7710:     all:
                   7711:             echo x${CPPFLAGS:Q}x            # leading and trailing whitespace
                   7712:             echo x${CONFIGURE_ARGS}x        # properly trimmed
1.27      rillig   7713: </pre>
                   7714:                 </li>
1.1       grant    7715: 
1.27      rillig   7716:                 <li>
                   7717:                   <p>The example above contains one bug: The
                   7718:                   <code class="varname">${PREFIX}</code> is a
                   7719:                   properly quoted shell expression, but there is
                   7720:                   the C compiler after it, which also expects a
                   7721:                   properly quoted string (this time in C syntax).
                   7722:                   The version above is therefore only correct if
                   7723:                   <code class="varname">${PREFIX}</code> does not
                   7724:                   have embedded backslashes or double quotes. If
                   7725:                   you want to allow these, you have to add another
                   7726:                   layer of quoting to each variable that is used as
                   7727:                   a C string literal. You cannot use the
                   7728:                   <code class="varname">:Q</code> operator for it,
                   7729:                   as this operator only works for the shell.</p>
                   7730:                 </li>
1.1       grant    7731: 
1.27      rillig   7732:                 <li>
1.47      reed     7733:                   <p>Whenever a variable can be empty, the
1.27      rillig   7734:                   <code class="varname">:Q</code> operator can have
                   7735:                   surprising results. Here are two completely
                   7736:                   different cases which can be solved with the same
                   7737:                   trick.</p>
                   7738:                   <pre class="programlisting">
1.51      rillig   7739:     EMPTY=                  # empty
                   7740:     empty_test:
                   7741:             for i in a ${EMPTY:Q} c; do \
                   7742:                     echo "$$i"; \
                   7743:             done
                   7744: 
                   7745:     for_test:
                   7746:     .for i in a:\ a:\test.txt
                   7747:             echo ${i:Q}
                   7748:             echo "foo"
                   7749:     .endfor
1.1       grant    7750: </pre>
                   7751: 
1.27      rillig   7752:                   <p>The first example will only print two of the
                   7753:                   three lines we might have expected. This is
                   7754:                   because <code class="varname">${EMPTY:Q}</code>
                   7755:                   expands to the empty string, which the shell
                   7756:                   cannot see. The workaround is to write
                   7757:                   <code class="varname">${EMPTY:Q}""</code>. This
                   7758:                   pattern can be often found as <code class=
                   7759:                   "varname">${TEST} -z ${VAR:Q}</code> or as
                   7760:                   <code class="varname">${TEST} -f
                   7761:                   ${FNAME:Q}</code> (both of these are wrong).</p>
                   7762: 
                   7763:                   <p>The second example will only print three lines
                   7764:                   instead of four. The first line looks like
                   7765:                   <code class="varname">a:\ echo foo</code>. This
                   7766:                   is because the backslash of the value
                   7767:                   <code class="varname">a:\</code> is interpreted
                   7768:                   as a line-continuation by <a href=
                   7769:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7770:                   <span class="citerefentry"><span class=
                   7771:                   "refentrytitle">make</span>(1)</span></a>, which
                   7772:                   makes the second line the arguments of the
                   7773:                   <a href=
                   7774:                   "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   7775:                   <span class="citerefentry"><span class=
                   7776:                   "refentrytitle">echo</span>(1)</span></a> command
                   7777:                   from the first line. To avoid this, write
                   7778:                   <code class="varname">${i:Q}""</code>.</p>
                   7779:                 </li>
                   7780:               </ul>
                   7781:             </div>
1.1       grant    7782:           </div>
                   7783: 
1.66    ! rillig   7784:           <div class="sect2" lang="en" xml:lang="en">
1.27      rillig   7785:             <div class="titlepage">
1.1       grant    7786:               <div>
1.27      rillig   7787:                 <div>
1.30      wiz      7788:                   <h3 class="title"><a name=
1.66    ! rillig   7789:                   "bsd-make-bug-workaround" id=
1.38      dillo    7790:                   "bsd-make-bug-workaround"></a>9.2.5.&nbsp;Workaround
1.30      wiz      7791:                   for a bug in BSD Make</h3>
1.27      rillig   7792:                 </div>
1.1       grant    7793:               </div>
                   7794:             </div>
                   7795: 
1.27      rillig   7796:             <p>The pkgsrc bmake program does not handle the
                   7797:             following assignment correctly. In case <code class=
                   7798:             "varname">_othervar_</code> contains a ``-'' character,
                   7799:             one of the closing braces is included in <code class=
                   7800:             "varname">${VAR}</code> after this code executes.</p>
                   7801:             <pre class="programlisting">
1.51      rillig   7802:     VAR:=   ${VAR:N${_othervar_:C/-//}}
1.1       grant    7803: </pre>
                   7804: 
1.27      rillig   7805:             <p>For a more complex code snippet and a workaround,
                   7806:             see the package <a xmlns=
                   7807:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   7808:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
1.45      wiz      7809:             target="_top"><code xmlns="" class=
                   7810:             "filename">regress/make-quoting</code></a>, testcase
1.27      rillig   7811:             <code class="varname">bug1</code>.</p>
1.1       grant    7812:           </div>
                   7813:         </div>
                   7814:       </div>
                   7815: 
1.66    ! rillig   7816:       <div class="chapter" lang="en" xml:lang="en">
1.1       grant    7817:         <div class="titlepage">
                   7818:           <div>
                   7819:             <div>
1.66    ! rillig   7820:               <h2 class="title"><a name="plist" id=
1.38      dillo    7821:               "plist"></a>Chapter&nbsp;10.&nbsp;PLIST issues</h2>
1.1       grant    7822:             </div>
                   7823:           </div>
                   7824:         </div>
                   7825: 
                   7826:         <div class="toc">
                   7827:           <p><b>Table of Contents</b></p>
                   7828: 
                   7829:           <dl>
1.38      dillo    7830:             <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1       grant    7831:             ID</a></span></dt>
                   7832: 
1.30      wiz      7833:             <dt><span class="sect1"><a href=
1.38      dillo    7834:             "#automatic-plist-generation">10.2. Semi-automatic
1.45      wiz      7835:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7836:             class="filename">PLIST</code>
1.14      xtraeme  7837:             generation</a></span></dt>
1.1       grant    7838: 
1.38      dillo    7839:             <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14      xtraeme  7840:             Tweaking output of <span><strong class="command">make
                   7841:             print-PLIST</strong></span></a></span></dt>
1.1       grant    7842: 
1.38      dillo    7843:             <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1       grant    7844:             Variable substitution in PLIST</a></span></dt>
                   7845: 
1.30      wiz      7846:             <dt><span class="sect1"><a href=
1.48      dillo    7847:             "#manpage-compression">10.5. Man page
                   7848:             compression</a></span></dt>
1.1       grant    7849: 
1.38      dillo    7850:             <dt><span class="sect1"><a href=
                   7851:             "#using-PLIST_SRC">10.6. Changing PLIST source with
                   7852:             <code class="varname">PLIST_SRC</code></a></span></dt>
1.1       grant    7853: 
1.30      wiz      7854:             <dt><span class="sect1"><a href=
1.47      reed     7855:             "#platform-specific-plist">10.7. Platform-specific and
1.30      wiz      7856:             differing PLISTs</a></span></dt>
1.1       grant    7857: 
1.38      dillo    7858:             <dt><span class="sect1"><a href=
                   7859:             "#faq.common-dirs">10.8. Sharing directories between
                   7860:             packages</a></span></dt>
1.1       grant    7861:           </dl>
                   7862:         </div>
                   7863: 
1.45      wiz      7864:         <p>The <code xmlns=
                   7865:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   7866:         "filename">PLIST</code> file contains a package's
                   7867:         &#8220;<span class="quote">packing list</span>&#8221;, i.e.
                   7868:         a list of files that belong to the package (relative to the
                   7869:         <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7870:         class="filename">${PREFIX}</code> directory it's been
                   7871:         installed in) plus some additional statements - see the
                   7872:         <a href=
1.1       grant    7873:         "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   7874:         <span class="citerefentry"><span class=
1.47      reed     7875:         "refentrytitle">pkg_create</span>(1)</span></a> man page
                   7876:         for a full list. This chapter addresses some issues that
                   7877:         need attention when dealing with the <code xmlns=
1.45      wiz      7878:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7879:         "filename">PLIST</code> file (or files, see below!).</p>
1.1       grant    7880: 
1.66    ! rillig   7881:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    7882:           <div class="titlepage">
                   7883:             <div>
                   7884:               <div>
                   7885:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   7886:                 "rcs-id" id="rcs-id"></a>10.1.&nbsp;RCS ID</h2>
1.1       grant    7887:               </div>
                   7888:             </div>
                   7889:           </div>
                   7890: 
                   7891:           <p>Be sure to add a RCS ID line as the first thing in any
1.45      wiz      7892:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7893:           class="filename">PLIST</code> file you write:</p>
1.1       grant    7894:           <pre class="programlisting">
1.51      rillig   7895:     @comment $NetBSD$
1.1       grant    7896: </pre>
                   7897:         </div>
                   7898: 
1.66    ! rillig   7899:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    7900:           <div class="titlepage">
                   7901:             <div>
                   7902:               <div>
                   7903:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   7904:                 "automatic-plist-generation" id=
1.38      dillo    7905:                 "automatic-plist-generation"></a>10.2.&nbsp;Semi-automatic
1.45      wiz      7906:                 <code xmlns=
                   7907:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7908:                 "filename">PLIST</code> generation</h2>
1.1       grant    7909:               </div>
                   7910:             </div>
                   7911:           </div>
                   7912: 
1.14      xtraeme  7913:           <p>You can use the <span><strong class="command">make
                   7914:           print-PLIST</strong></span> command to output a PLIST
                   7915:           that matches any new files since the package was
                   7916:           extracted. See <a href="#build.helpful-targets" title=
1.56      rillig   7917:           "14.16.&nbsp;Other helpful targets">Section&nbsp;14.16,
1.1       grant    7918:           &#8220;Other helpful targets&#8221;</a> for more
                   7919:           information on this target.</p>
                   7920:         </div>
                   7921: 
1.66    ! rillig   7922:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    7923:           <div class="titlepage">
                   7924:             <div>
                   7925:               <div>
                   7926:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   7927:                 "print-PLIST" id=
1.38      dillo    7928:                 "print-PLIST"></a>10.3.&nbsp;Tweaking output of
1.14      xtraeme  7929:                 <span><strong class="command">make
                   7930:                 print-PLIST</strong></span></h2>
1.1       grant    7931:               </div>
                   7932:             </div>
                   7933:           </div>
                   7934: 
                   7935:           <p>If you have used any of the *-dirs packages, as
                   7936:           explained in <a href="#faq.common-dirs" title=
1.38      dillo    7937:           "10.8.&nbsp;Sharing directories between packages">Section&nbsp;10.8,
1.1       grant    7938:           &#8220;Sharing directories between packages&#8221;</a>,
1.14      xtraeme  7939:           you may have noticed that <span><strong class=
                   7940:           "command">make print-PLIST</strong></span> outputs a set
                   7941:           of <code class="varname">@comment</code>s instead of real
                   7942:           <code class="varname">@dirrm</code> lines. You can also
                   7943:           do this for specific directories and files, so that the
                   7944:           results of that command are very close to reality. This
                   7945:           helps <span class="emphasis"><em>a lot</em></span> during
                   7946:           the update of packages.</p>
                   7947: 
                   7948:           <p>The <code class="varname">PRINT_PLIST_AWK</code>
                   7949:           variable takes a set of AWK patterns and actions that are
                   7950:           used to filter the output of print-PLIST. You can
                   7951:           <span class="emphasis"><em>append</em></span> any chunk
                   7952:           of AWK scripting you like to it, but be careful with
1.1       grant    7953:           quoting.</p>
                   7954: 
1.45      wiz      7955:           <p>For example, to get all files inside the <code xmlns=
                   7956:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7957:           "filename">libdata/foo</code> directory removed from the
1.1       grant    7958:           resulting PLIST:</p>
                   7959:           <pre class="programlisting">
1.51      rillig   7960:     PRINT_PLIST_AWK+=       /^libdata\/foo/ { next; }
1.1       grant    7961: </pre>
                   7962: 
1.14      xtraeme  7963:           <p>And to get all the <code class="varname">@dirrm</code>
1.1       grant    7964:           lines referring to a specific (shared) directory
1.14      xtraeme  7965:           converted to <code class="varname">@comment</code>s:</p>
1.1       grant    7966:           <pre class="programlisting">
1.51      rillig   7967:     PRINT_PLIST_AWK+=       /^@dirrm share\/specific/ { print "@comment " $$0; next; }
1.1       grant    7968: </pre>
                   7969:         </div>
                   7970: 
1.66    ! rillig   7971:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    7972:           <div class="titlepage">
                   7973:             <div>
                   7974:               <div>
                   7975:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   7976:                 "plist.misc" id=
1.38      dillo    7977:                 "plist.misc"></a>10.4.&nbsp;Variable substitution
                   7978:                 in PLIST</h2>
1.1       grant    7979:               </div>
                   7980:             </div>
                   7981:           </div>
                   7982: 
                   7983:           <p>A number of variables are substituted automatically in
                   7984:           PLISTs when a package is installed on a system. This
                   7985:           includes the following variables:</p>
                   7986: 
                   7987:           <div class="variablelist">
                   7988:             <dl>
1.14      xtraeme  7989:               <dt><span class="term"><code class=
                   7990:               "varname">${MACHINE_ARCH}</code>, <code class=
                   7991:               "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1       grant    7992: 
                   7993:               <dd>
                   7994:                 <p>Some packages like emacs and perl embed
                   7995:                 information about which architecture they were
                   7996:                 built on into the pathnames where they install
1.47      reed     7997:                 their files. To handle this case, PLIST will be
1.1       grant    7998:                 preprocessed before actually used, and the symbol
1.14      xtraeme  7999:                 &#8220;<span class="quote"><code class=
                   8000:                 "varname">${MACHINE_ARCH}</code></span>&#8221; will
                   8001:                 be replaced by what <span><strong class=
                   8002:                 "command">uname -p</strong></span> gives. The same
                   8003:                 is done if the string <code class=
                   8004:                 "varname">${MACHINE_GNU_ARCH}</code> is embedded in
                   8005:                 PLIST somewhere - use this on packages that have
1.47      reed     8006:                 GNU autoconf-created configure scripts.</p>
1.1       grant    8007: 
                   8008:                 <div class="note" style=
                   8009:                 "margin-left: 0.5in; margin-right: 0.5in;">
                   8010:                   <h3 class="title">Legacy note</h3>
                   8011: 
                   8012:                   <p>There used to be a symbol &#8220;<span class=
1.14      xtraeme  8013:                   "quote"><code class=
                   8014:                   "varname">$ARCH</code></span>&#8221; that was
                   8015:                   replaced by the output of <span><strong class=
                   8016:                   "command">uname -m</strong></span>, but that's no
1.1       grant    8017:                   longer supported and has been removed.</p>
                   8018:                 </div>
                   8019:               </dd>
                   8020: 
1.14      xtraeme  8021:               <dt><span class="term"><code class=
                   8022:               "varname">${OPSYS}</code>, <code class=
                   8023:               "varname">${LOWER_OPSYS}</code>, <code class=
                   8024:               "varname">${OS_VERSION}</code></span></dt>
1.1       grant    8025: 
                   8026:               <dd>
                   8027:                 <p>Some packages want to embed the OS name and
                   8028:                 version into some paths. To do this, use these
1.45      wiz      8029:                 variables in the <code xmlns=
                   8030:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8031:                 "filename">PLIST</code>:</p>
1.1       grant    8032: 
                   8033:                 <div class="itemizedlist">
                   8034:                   <ul type="disc">
                   8035:                     <li>
1.14      xtraeme  8036:                       <p><code class="varname">${OPSYS}</code> -
                   8037:                       output of &#8220;<span class=
                   8038:                       "quote"><span><strong class="command">uname
                   8039:                       -s</strong></span></span>&#8221;</p>
1.1       grant    8040:                     </li>
                   8041: 
                   8042:                     <li>
1.14      xtraeme  8043:                       <p><code class=
                   8044:                       "varname">${LOWER_OPSYS}</code> - lowercase
                   8045:                       common name (eg. &#8220;<span class=
                   8046:                       "quote">solaris</span>&#8221;)</p>
1.1       grant    8047:                     </li>
                   8048: 
                   8049:                     <li>
1.14      xtraeme  8050:                       <p><code class="varname">${OS_VERSION}</code>
                   8051:                       - &#8220;<span class=
                   8052:                       "quote"><span><strong class="command">uname
                   8053:                       -r</strong></span></span>&#8221;</p>
1.1       grant    8054:                     </li>
                   8055:                   </ul>
                   8056:                 </div>
                   8057:               </dd>
                   8058: 
1.14      xtraeme  8059:               <dt><span class="term"><code class=
                   8060:               "varname">${PKGLOCALEDIR}</code></span></dt>
1.1       grant    8061: 
                   8062:               <dd>
                   8063:                 <p>Packages that install locale files should list
                   8064:                 them in the PLIST as &#8220;<span class=
                   8065:                 "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>&#8221;
                   8066:                 instead of &#8220;<span class=
                   8067:                 "quote">share/locale/de/LC_MESSAGES/...</span>&#8221;.
                   8068:                 This properly handles the fact that different
                   8069:                 operating systems expect locale files to be either
1.45      wiz      8070:                 in <code xmlns=
                   8071:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8072:                 "filename">share</code> or <code xmlns=
                   8073:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8074:                 "filename">lib</code> by default.</p>
1.1       grant    8075:               </dd>
                   8076:             </dl>
                   8077:           </div>
                   8078: 
                   8079:           <p>For a complete list of values which are replaced by
1.45      wiz      8080:           default, please look in <code xmlns=
                   8081:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8082:           "filename">bsd.pkg.mk</code> (and search for <span class=
1.1       grant    8083:           "emphasis"><em>PLIST_SUBST</em></span>).</p>
                   8084: 
                   8085:           <p>If you want to change other variables not listed
                   8086:           above, you can add variables and their expansions to this
1.14      xtraeme  8087:           variable in the following way, similar to <code class=
                   8088:           "varname">MESSAGE_SUBST</code> (see <a href=
1.1       grant    8089:           "#components.optional" title=
1.38      dillo    8090:           "8.5.&nbsp;Optional files">Section&nbsp;8.5,
1.1       grant    8091:           &#8220;Optional files&#8221;</a>):</p>
                   8092:           <pre class="programlisting">
1.51      rillig   8093:     PLIST_SUBST+=   SOMEVAR="somevalue"
1.1       grant    8094: </pre>
                   8095: 
                   8096:           <p>This replaces all occurrences of &#8220;<span class=
                   8097:           "quote">${SOMEVAR}</span>&#8221; in the PLIST with
                   8098:           &#8220;<span class="quote">somevalue</span>&#8221;.</p>
                   8099:         </div>
                   8100: 
1.66    ! rillig   8101:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    8102:           <div class="titlepage">
                   8103:             <div>
                   8104:               <div>
                   8105:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   8106:                 "manpage-compression" id=
1.48      dillo    8107:                 "manpage-compression"></a>10.5.&nbsp;Man page
                   8108:                 compression</h2>
1.1       grant    8109:               </div>
                   8110:             </div>
                   8111:           </div>
                   8112: 
1.47      reed     8113:           <p>Man pages should be installed in compressed form if
1.45      wiz      8114:           <code class="varname">MANZ</code> is set (in <code xmlns=
                   8115:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8116:           "filename">bsd.own.mk</code>), and uncompressed
1.45      wiz      8117:           otherwise. To handle this in the <code xmlns=
                   8118:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8119:           "filename">PLIST</code> file, the suffix
                   8120:           &#8220;<span class="quote">.gz</span>&#8221; is
1.47      reed     8121:           appended/removed automatically for man pages according to
1.14      xtraeme  8122:           <code class="varname">MANZ</code> and <code class=
                   8123:           "varname">MANCOMPRESSED</code> being set or not, see
1.45      wiz      8124:           above for details. This modification of the <code xmlns=
                   8125:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8126:           "filename">PLIST</code> file is done on a copy of it, not
1.45      wiz      8127:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8128:           class="filename">PLIST</code> itself.</p>
1.1       grant    8129:         </div>
                   8130: 
1.66    ! rillig   8131:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    8132:           <div class="titlepage">
                   8133:             <div>
                   8134:               <div>
                   8135:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   8136:                 "using-PLIST_SRC" id=
1.38      dillo    8137:                 "using-PLIST_SRC"></a>10.6.&nbsp;Changing PLIST
1.30      wiz      8138:                 source with <code class=
1.14      xtraeme  8139:                 "varname">PLIST_SRC</code></h2>
1.1       grant    8140:               </div>
                   8141:             </div>
                   8142:           </div>
                   8143: 
1.14      xtraeme  8144:           <p>To use one or more files as source for the
1.45      wiz      8145:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8146:           class="filename">PLIST</code> used in generating the
                   8147:           binary package, set the variable <code class=
1.14      xtraeme  8148:           "varname">PLIST_SRC</code> to the names of that file(s).
1.24      wiz      8149:           The files are later concatenated using <a href=
                   8150:           "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
                   8151:           <span class="citerefentry"><span class=
                   8152:           "refentrytitle">cat</span>(1)</span></a>, and order of
                   8153:           things is important.</p>
1.1       grant    8154:         </div>
                   8155: 
1.66    ! rillig   8156:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    8157:           <div class="titlepage">
                   8158:             <div>
                   8159:               <div>
                   8160:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   8161:                 "platform-specific-plist" id=
1.47      reed     8162:                 "platform-specific-plist"></a>10.7.&nbsp;Platform-specific
                   8163:                 and differing PLISTs</h2>
1.1       grant    8164:               </div>
                   8165:             </div>
                   8166:           </div>
                   8167: 
                   8168:           <p>Some packages decide to install a different set of
                   8169:           files based on the operating system being used. These
                   8170:           differences can be automatically handled by using the
                   8171:           following files:</p>
                   8172: 
                   8173:           <div class="itemizedlist">
                   8174:             <ul type="disc">
                   8175:               <li>
1.45      wiz      8176:                 <p><code xmlns=
                   8177:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8178:                 "filename">PLIST.common</code></p>
1.1       grant    8179:               </li>
                   8180: 
                   8181:               <li>
1.45      wiz      8182:                 <p><code xmlns=
                   8183:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8184:                 "filename">PLIST.${OPSYS}</code></p>
1.1       grant    8185:               </li>
                   8186: 
                   8187:               <li>
1.45      wiz      8188:                 <p><code xmlns=
                   8189:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.21      ben      8190:                 "filename">PLIST.${MACHINE_ARCH}</code></p>
                   8191:               </li>
                   8192: 
                   8193:               <li>
1.45      wiz      8194:                 <p><code xmlns=
                   8195:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.21      ben      8196:                 "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
                   8197:               </li>
                   8198: 
                   8199:               <li>
1.45      wiz      8200:                 <p><code xmlns=
                   8201:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8202:                 "filename">PLIST.common_end</code></p>
1.1       grant    8203:               </li>
                   8204:             </ul>
                   8205:           </div>
                   8206:         </div>
                   8207: 
1.66    ! rillig   8208:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    8209:           <div class="titlepage">
                   8210:             <div>
                   8211:               <div>
                   8212:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   8213:                 "faq.common-dirs" id=
1.38      dillo    8214:                 "faq.common-dirs"></a>10.8.&nbsp;Sharing
                   8215:                 directories between packages</h2>
1.1       grant    8216:               </div>
                   8217:             </div>
                   8218:           </div>
                   8219: 
                   8220:           <p>A &#8220;<span class="quote">shared
                   8221:           directory</span>&#8221; is a directory where multiple
                   8222:           (and unrelated) packages install files. These directories
                   8223:           are problematic because you have to add special tricks in
                   8224:           the PLIST to conditionally remove them, or have some
                   8225:           centralized package handle them.</p>
                   8226: 
                   8227:           <p>Within pkgsrc, you'll find both approaches. If a
                   8228:           directory is shared by a few unrelated packages, it's
                   8229:           often not worth to add an extra package to remove it.
                   8230:           Therefore, one simply does:</p>
                   8231:           <pre class="programlisting">
1.51      rillig   8232:     @unexec ${RMDIR} %D/path/to/shared/directory 2&gt;/dev/null || ${TRUE}
1.1       grant    8233: </pre>
                   8234: 
                   8235:           <p>in the PLISTs of all affected packages, instead of the
                   8236:           regular "@dirrm" line.</p>
                   8237: 
                   8238:           <p>However, if the directory is shared across many
                   8239:           packages, two different solutions are available:</p>
                   8240: 
                   8241:           <div class="orderedlist">
                   8242:             <ol type="1">
                   8243:               <li>
                   8244:                 <p>If the packages have a common dependency, the
                   8245:                 directory can be removed in that. For example, see
                   8246:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8247:                 href=
                   8248:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.45      wiz      8249:                 target="_top"><code xmlns="" class=
                   8250:                 "filename">textproc/scrollkeeper</code></a>, which
                   8251:                 removes the shared directory <code xmlns=
                   8252:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      8253:                 "filename">share/omf</code>.</p>
1.1       grant    8254:               </li>
                   8255: 
                   8256:               <li>
                   8257:                 <p>If the packages using the directory are not
                   8258:                 related at all (they have no common dependencies),
                   8259:                 a *-dirs package is used.</p>
                   8260:               </li>
                   8261:             </ol>
                   8262:           </div>
                   8263: 
                   8264:           <p>From now on, we'll discuss the second solution. To get
                   8265:           an idea of the *-dirs packages available, issue:</p>
                   8266:           <pre class="programlisting">
1.51      rillig   8267:     <code class="prompt">%</code> cd .../pkgsrc
                   8268:     <code class="prompt">%</code> ls -d */*-dirs
1.1       grant    8269: </pre>
                   8270: 
                   8271:           <p>Their use from other packages is very simple. The
1.14      xtraeme  8272:           <code class="varname">USE_DIRS</code> variable takes a
                   8273:           list of package names (without the &#8220;<span class=
1.1       grant    8274:           "quote">-dirs</span>&#8221; part) together with the
                   8275:           required version number (always pick the latest one when
1.34      wiz      8276:           writing new packages).</p>
1.1       grant    8277: 
                   8278:           <p>For example, if a package installs files under
1.45      wiz      8279:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8280:           class="filename">share/applications</code>, it should
                   8281:           have the following line in it:</p>
1.1       grant    8282:           <pre class="programlisting">
1.51      rillig   8283:     USE_DIRS+=      xdg-1.1
1.1       grant    8284: </pre>
                   8285: 
1.14      xtraeme  8286:           <p>After regenerating the PLIST using
                   8287:           <span><strong class="command">make
                   8288:           print-PLIST</strong></span>, you should get the right
                   8289:           (commented out) lines.</p>
1.1       grant    8290: 
1.47      reed     8291:           <p>Note that even if your package is using <code xmlns=
1.45      wiz      8292:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8293:           "filename">$X11BASE</code>, it must not depend on the
1.1       grant    8294:           *-x11-dirs packages. Just specify the name without that
1.45      wiz      8295:           part and pkgsrc (in particular, <code xmlns=
                   8296:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8297:           "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1       grant    8298:         </div>
                   8299:       </div>
                   8300: 
1.66    ! rillig   8301:       <div class="chapter" lang="en" xml:lang="en">
1.1       grant    8302:         <div class="titlepage">
                   8303:           <div>
                   8304:             <div>
1.66    ! rillig   8305:               <h2 class="title"><a name="buildlink" id=
1.38      dillo    8306:               "buildlink"></a>Chapter&nbsp;11.&nbsp;Buildlink
1.1       grant    8307:               methodology</h2>
                   8308:             </div>
                   8309:           </div>
                   8310:         </div>
                   8311: 
                   8312:         <div class="toc">
                   8313:           <p><b>Table of Contents</b></p>
                   8314: 
                   8315:           <dl>
1.30      wiz      8316:             <dt><span class="sect1"><a href=
1.38      dillo    8317:             "#converting-to-buildlink3">11.1. Converting packages
1.30      wiz      8318:             to use buildlink3</a></span></dt>
1.1       grant    8319: 
1.30      wiz      8320:             <dt><span class="sect1"><a href=
1.45      wiz      8321:             "#creating-buildlink3.mk">11.2. Writing <code xmlns=
                   8322:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      8323:             "filename">buildlink3.mk</code> files</a></span></dt>
1.1       grant    8324: 
                   8325:             <dd>
                   8326:               <dl>
1.25      rillig   8327:                 <dt><span class="sect2"><a href=
1.38      dillo    8328:                 "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30      wiz      8329:                 buildlink3.mk file</a></span></dt>
1.1       grant    8330: 
1.25      rillig   8331:                 <dt><span class="sect2"><a href=
1.38      dillo    8332:                 "#updating-buildlink-depends">11.2.2. Updating
1.30      wiz      8333:                 <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14      xtraeme  8334:                 "replaceable"><code>pkg</code></em></code> in
1.45      wiz      8335:                 <code xmlns=
                   8336:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8337:                 "filename">buildlink3.mk</code>
1.1       grant    8338:                 files</a></span></dt>
                   8339:               </dl>
                   8340:             </dd>
                   8341: 
1.30      wiz      8342:             <dt><span class="sect1"><a href=
1.45      wiz      8343:             "#writing-builtin.mk">11.3. Writing <code xmlns=
                   8344:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      8345:             "filename">builtin.mk</code> files</a></span></dt>
1.1       grant    8346: 
                   8347:             <dd>
                   8348:               <dl>
1.25      rillig   8349:                 <dt><span class="sect2"><a href=
1.38      dillo    8350:                 "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45      wiz      8351:                 <code xmlns=
                   8352:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8353:                 "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    8354: 
1.25      rillig   8355:                 <dt><span class="sect2"><a href=
1.38      dillo    8356:                 "#native-or-pkgsrc-preference">11.3.2. Global
1.30      wiz      8357:                 preferences for native or pkgsrc
                   8358:                 software</a></span></dt>
1.1       grant    8359:               </dl>
                   8360:             </dd>
                   8361:           </dl>
                   8362:         </div>
                   8363: 
                   8364:         <p>Buildlink is a framework in pkgsrc that controls what
                   8365:         headers and libraries are seen by a package's configure and
                   8366:         build processes. This is implemented in a two step
                   8367:         process:</p>
                   8368: 
                   8369:         <div class="orderedlist">
                   8370:           <ol type="1">
                   8371:             <li>
                   8372:               <p>Symlink headers and libraries for dependencies
1.14      xtraeme  8373:               into <code class="varname">BUILDLINK_DIR</code>,
                   8374:               which by default is a subdirectory of <code class=
                   8375:               "varname">WRKDIR</code>.</p>
1.1       grant    8376:             </li>
                   8377: 
                   8378:             <li>
                   8379:               <p>Create wrapper scripts that are used in place of
1.14      xtraeme  8380:               the normal compiler tools that translate <code class=
                   8381:               "option">-I${LOCALBASE}/include</code> and
                   8382:               <code class="option">-L${LOCALBASE}/lib</code> into
                   8383:               references to <code class=
                   8384:               "varname">BUILDLINK_DIR</code>. The wrapper scripts
                   8385:               also make native compiler on some operating systems
                   8386:               look like GCC, so that packages that expect GCC won't
                   8387:               require modifications to build with those native
                   8388:               compilers.</p>
1.1       grant    8389:             </li>
                   8390:           </ol>
                   8391:         </div>
                   8392: 
                   8393:         <p>This normalizes the environment in which a package is
                   8394:         built so that the package may be built consistently despite
                   8395:         what other software may be installed. Please note that the
1.45      wiz      8396:         normal system header and library paths, e.g. <code xmlns=
                   8397:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   8398:         "filename">/usr/include</code>, <code xmlns=
                   8399:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8400:         "filename">/usr/lib</code>, etc., are always searched --
1.1       grant    8401:         buildlink3 is designed to insulate the package build from
                   8402:         non-system-supplied software.</p>
                   8403: 
1.66    ! rillig   8404:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    8405:           <div class="titlepage">
                   8406:             <div>
                   8407:               <div>
                   8408:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   8409:                 "converting-to-buildlink3" id=
1.38      dillo    8410:                 "converting-to-buildlink3"></a>11.1.&nbsp;Converting
1.30      wiz      8411:                 packages to use buildlink3</h2>
1.1       grant    8412:               </div>
                   8413:             </div>
                   8414:           </div>
                   8415: 
                   8416:           <p>The process of converting packages to use the
                   8417:           buildlink3 framework (&#8220;<span class=
                   8418:           "quote">bl3ifying</span>&#8221;) is fairly
                   8419:           straightforward. The things to keep in mind are:</p>
                   8420: 
                   8421:           <div class="orderedlist">
                   8422:             <ol type="1">
                   8423:               <li>
                   8424:                 <p>Ensure that the build always calls the wrapper
                   8425:                 scripts instead of the actual toolchain. Some
                   8426:                 packages are tricky, and the only way to know for
1.45      wiz      8427:                 sure is the check <code xmlns=
                   8428:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8429:                 "filename">${WRKDIR}/.work.log</code> to see if the
1.1       grant    8430:                 wrappers are being invoked.</p>
                   8431:               </li>
                   8432: 
                   8433:               <li>
1.14      xtraeme  8434:                 <p>Don't override <code class=
                   8435:                 "varname">PREFIX</code> from within the package
                   8436:                 Makefile, e.g. Java VMs, standalone shells, etc.,
1.45      wiz      8437:                 because the code to symlink files into <code xmlns=
                   8438:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8439:                 "filename">${BUILDLINK_DIR}</code> looks for files
1.1       grant    8440:                 relative to &#8220;<span class="quote">pkg_info -qp
1.14      xtraeme  8441:                 <em class=
                   8442:                 "replaceable"><code>pkgname</code></em></span>&#8221;.</p>
1.1       grant    8443:               </li>
                   8444: 
                   8445:               <li>
                   8446:                 <p>Remember that <span class=
1.45      wiz      8447:                 "emphasis"><em>only</em></span> the <code xmlns=
                   8448:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8449:                 "filename">buildlink3.mk</code> files that you list
1.1       grant    8450:                 in a package's Makefile are added as dependencies
                   8451:                 for that package.</p>
                   8452:               </li>
                   8453:             </ol>
                   8454:           </div>
                   8455: 
                   8456:           <p>If a dependency on a particular package is required
                   8457:           for its libraries and headers, then we replace:</p>
                   8458:           <pre class="programlisting">
1.51      rillig   8459:     DEPENDS+=   foo&gt;=1.1.0:../../category/foo
1.1       grant    8460: </pre>
                   8461: 
                   8462:           <p>with</p>
                   8463:           <pre class="programlisting">
1.51      rillig   8464:     .include "../../category/foo/buildlink3.mk"
1.1       grant    8465: </pre>
                   8466: 
1.47      reed     8467:           <p>The buildlink3.mk files usually define the required
                   8468:           dependencies. If you need a newer version of the
                   8469:           dependency when using buildlink3.mk files, then you can
                   8470:           define it in your Makefile; for example:</p>
                   8471:           <pre class="programlisting">
1.51      rillig   8472:     BUILDLINK_DEPENDS.foo+=   foo&gt;=1.1.0
                   8473:     .include "../../category/foo/buildlink3.mk"
1.47      reed     8474: </pre>
                   8475: 
1.45      wiz      8476:           <p>There are several <code xmlns=
                   8477:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   8478:           "filename">buildlink3.mk</code> files in <code xmlns=
                   8479:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8480:           "filename">pkgsrc/mk</code> that handle special package
1.1       grant    8481:           issues:</p>
                   8482: 
                   8483:           <div class="itemizedlist">
                   8484:             <ul type="disc">
                   8485:               <li>
1.45      wiz      8486:                 <p><code xmlns=
                   8487:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8488:                 "filename">bdb.buildlink3.mk</code> chooses either
                   8489:                 the native or a pkgsrc Berkeley DB implementation
                   8490:                 based on the values of <code class=
1.14      xtraeme  8491:                 "varname">BDB_ACCEPTED</code> and <code class=
                   8492:                 "varname">BDB_DEFAULT</code>.</p>
1.1       grant    8493:               </li>
                   8494: 
                   8495:               <li>
1.45      wiz      8496:                 <p><code xmlns=
                   8497:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     8498:                 "filename">curses.buildlink3.mk</code>: If the
1.14      xtraeme  8499:                 system comes with neither Curses nor NCurses, this
                   8500:                 will take care to install the <a xmlns=
                   8501:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    8502:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.45      wiz      8503:                 target="_top"><code xmlns="" class=
                   8504:                 "filename">devel/ncurses</code></a> package.</p>
1.1       grant    8505:               </li>
                   8506: 
                   8507:               <li>
1.45      wiz      8508:                 <p><code xmlns=
                   8509:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8510:                 "filename">krb5.buildlink3.mk</code> uses the value
                   8511:                 of <code class="varname">KRB5_ACCEPTED</code> to
                   8512:                 choose between adding a dependency on Heimdal or
                   8513:                 MIT-krb5 for packages that require a Kerberos 5
1.1       grant    8514:                 implementation.</p>
                   8515:               </li>
                   8516: 
                   8517:               <li>
1.45      wiz      8518:                 <p><code xmlns=
                   8519:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8520:                 "filename">motif.buildlink3.mk</code> checks for a
                   8521:                 system-provided Motif installation or adds a
                   8522:                 dependency on <a xmlns=
1.1       grant    8523:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8524:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.45      wiz      8525:                 target="_top"><code xmlns="" class=
                   8526:                 "filename">x11/lesstif</code></a> or <a xmlns=
1.20      ben      8527:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8528:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
1.45      wiz      8529:                 target="_top"><code xmlns="" class=
1.47      reed     8530:                 "filename">x11/openmotif</code></a>.</p>
1.1       grant    8531:               </li>
                   8532: 
                   8533:               <li>
1.45      wiz      8534:                 <p><code xmlns=
                   8535:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8536:                 "filename">ossaudio.buildlink3.mk</code> defines
                   8537:                 several variables that may be used by packages that
1.47      reed     8538:                 use the Open Sound System (OSS) API.</p>
1.1       grant    8539:               </li>
                   8540: 
                   8541:               <li>
1.45      wiz      8542:                 <p><code xmlns=
                   8543:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8544:                 "filename">pgsql.buildlink3.mk</code> will accept
                   8545:                 either Postgres 7.3 or 7.4, whichever is found
                   8546:                 installed. See the file for more information.</p>
1.1       grant    8547:               </li>
                   8548: 
                   8549:               <li>
1.45      wiz      8550:                 <p><code xmlns=
                   8551:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8552:                 "filename">pthread.buildlink3.mk</code> uses the
                   8553:                 value of <code class="varname">PTHREAD_OPTS</code>
                   8554:                 and checks for native pthreads or adds a dependency
                   8555:                 on <a xmlns=
1.1       grant    8556:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8557:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.45      wiz      8558:                 target="_top"><code xmlns="" class=
1.47      reed     8559:                 "filename">devel/pth</code></a> as needed.</p>
1.1       grant    8560:               </li>
                   8561: 
                   8562:               <li>
1.45      wiz      8563:                 <p><code xmlns=
                   8564:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8565:                 "filename">xaw.buildlink3.mk</code> uses the value
                   8566:                 of <code class="varname">XAW_TYPE</code> to choose
                   8567:                 a particular Athena widgets library.</p>
1.1       grant    8568:               </li>
                   8569:             </ul>
                   8570:           </div>
                   8571: 
1.45      wiz      8572:           <p>The comments in those <code xmlns=
                   8573:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8574:           "filename">buildlink3.mk</code> files provide a more
1.1       grant    8575:           complete description of how to use them properly.</p>
                   8576:         </div>
                   8577: 
1.66    ! rillig   8578:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    8579:           <div class="titlepage">
                   8580:             <div>
                   8581:               <div>
                   8582:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   8583:                 "creating-buildlink3.mk" id=
1.38      dillo    8584:                 "creating-buildlink3.mk"></a>11.2.&nbsp;Writing
1.45      wiz      8585:                 <code xmlns=
                   8586:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8587:                 "filename">buildlink3.mk</code> files</h2>
1.1       grant    8588:               </div>
                   8589:             </div>
                   8590:           </div>
                   8591: 
1.45      wiz      8592:           <p>A package's <code xmlns=
                   8593:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8594:           "filename">buildlink3.mk</code> file is included by
                   8595:           Makefiles to indicate the need to compile and link
                   8596:           against header files and libraries provided by the
1.45      wiz      8597:           package. A <code xmlns=
                   8598:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   8599:           "filename">buildlink3.mk</code> file should always
                   8600:           provide enough information to add the correct type of
                   8601:           dependency relationship and include any other
                   8602:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8603:           class="filename">buildlink3.mk</code> files that it needs
                   8604:           to find headers and libraries that it needs in turn.</p>
1.1       grant    8605: 
1.45      wiz      8606:           <p>To generate an initial <code xmlns=
                   8607:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8608:           "filename">buildlink3.mk</code> file for further editing,
1.1       grant    8609:           Rene Hexel's <a xmlns=
                   8610:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   8611:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.45      wiz      8612:           target="_top"><code xmlns="" class=
                   8613:           "filename">pkgtools/createbuildlink</code></a> package is
1.20      ben      8614:           highly recommended. For most packages, the following
                   8615:           command will generate a good starting point for
1.45      wiz      8616:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8617:           class="filename">buildlink3.mk</code> files:</p>
1.1       grant    8618:           <pre class="screen">
1.14      xtraeme  8619: <code class="prompt">%</code> <strong class=
                   8620: "userinput"><code>cd pkgsrc/<em class=
                   8621: "replaceable"><code>category</code></em>/<em class=
                   8622: "replaceable"><code>pkgdir</code></em>
                   8623: <code class=
1.49      rillig   8624: "prompt">%</code> createbuildlink &gt;buildlink3.mk</code></strong>
1.1       grant    8625: </pre>
                   8626: 
1.66    ! rillig   8627:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    8628:             <div class="titlepage">
                   8629:               <div>
                   8630:                 <div>
1.66    ! rillig   8631:                   <h3 class="title"><a name="anatomy-of-bl3" id=
        !          8632:                   "anatomy-of-bl3"></a>11.2.1. Anatomy of a
1.25      rillig   8633:                   buildlink3.mk file</h3>
1.1       grant    8634:                 </div>
                   8635:               </div>
                   8636:             </div>
                   8637: 
1.45      wiz      8638:             <p>The following real-life example <code xmlns=
                   8639:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8640:             "filename">buildlink3.mk</code> is taken from
1.45      wiz      8641:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8642:             class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1       grant    8643:             <pre class="programlisting">
1.51      rillig   8644:     # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1       grant    8645: 
1.51      rillig   8646:     BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH}+
                   8647:     TIFF_BUILDLINK3_MK:=    ${TIFF_BUILDLINK3_MK}+
1.1       grant    8648: 
1.51      rillig   8649:     .if !empty(BUILDLINK_DEPTH:M+)
                   8650:     BUILDLINK_DEPENDS+=     tiff
                   8651:     .endif
1.1       grant    8652: 
1.51      rillig   8653:     BUILDLINK_PACKAGES:=    ${BUILDLINK_PACKAGES:Ntiff}
                   8654:     BUILDLINK_PACKAGES+=    tiff
1.1       grant    8655: 
1.51      rillig   8656:     .if !empty(TIFF_BUILDLINK3_MK:M+)
                   8657:     BUILDLINK_DEPENDS.tiff+=        tiff&gt;=3.6.1
                   8658:     BUILDLINK_PKGSRCDIR.tiff?=      ../../graphics/tiff
                   8659:     .endif  # TIFF_BUILDLINK3_MK
1.1       grant    8660: 
1.51      rillig   8661:     .include "../../devel/zlib/buildlink3.mk"
                   8662:     .include "../../graphics/jpeg/buildlink3.mk"
1.1       grant    8663: 
1.51      rillig   8664:     BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH:S/+$//}
1.1       grant    8665: </pre>
                   8666: 
1.14      xtraeme  8667:             <p>The header and footer manipulate <code class=
                   8668:             "varname">BUILDLINK_DEPTH</code>, which is common
1.45      wiz      8669:             across all <code xmlns=
                   8670:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8671:             "filename">buildlink3.mk</code> files and is used to
                   8672:             track at what depth we are including <code xmlns=
                   8673:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8674:             "filename">buildlink3.mk</code> files.</p>
1.1       grant    8675: 
                   8676:             <p>The first section controls if the dependency on
1.14      xtraeme  8677:             <em class="replaceable"><code>pkg</code></em> is added.
                   8678:             <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1       grant    8679:             global list of packages for which dependencies are
                   8680:             added by buildlink3.</p>
                   8681: 
                   8682:             <p>The second section advises pkgsrc that the
1.45      wiz      8683:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8684:             class="filename">buildlink3.mk</code> file for
1.14      xtraeme  8685:             <em class="replaceable"><code>pkg</code></em> has been
                   8686:             included at some point. <code class=
                   8687:             "varname">BUILDLINK_PACKAGES</code> is the global list
1.45      wiz      8688:             of packages for which <code xmlns=
                   8689:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8690:             "filename">buildlink3.mk</code> files have been
                   8691:             included. It must <span class=
                   8692:             "emphasis"><em>always</em></span> be appended to within
1.45      wiz      8693:             a <code xmlns=
                   8694:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8695:             "filename">buildlink3.mk</code> file.</p>
1.1       grant    8696: 
                   8697:             <p>The third section is protected from multiple
1.14      xtraeme  8698:             inclusion and controls how the dependency on <em class=
                   8699:             "replaceable"><code>pkg</code></em> is added. Several
1.1       grant    8700:             important variables are set in the section:</p>
                   8701: 
                   8702:             <div class="itemizedlist">
                   8703:               <ul type="disc">
                   8704:                 <li>
1.14      xtraeme  8705:                   <p><code class=
                   8706:                   "varname">BUILDLINK_DEPENDS.<em class=
                   8707:                   "replaceable"><code>pkg</code></em></code> is the
                   8708:                   actual dependency recorded in the installed
                   8709:                   package; this should always be set using
                   8710:                   <span><strong class="command">+=</strong></span>
                   8711:                   to ensure that we're appending to any
                   8712:                   pre-existing list of values. This variable should
                   8713:                   be set to the first version of the package that
                   8714:                   had the last change in the major number of a
                   8715:                   shared library or that had a major API
                   8716:                   change.</p>
1.1       grant    8717:                 </li>
                   8718: 
                   8719:                 <li>
1.14      xtraeme  8720:                   <p><code class=
                   8721:                   "varname">BUILDLINK_PKGSRCDIR.<em class=
                   8722:                   "replaceable"><code>pkg</code></em></code> is the
                   8723:                   location of the <em class=
                   8724:                   "replaceable"><code>pkg</code></em> pkgsrc
1.47      reed     8725:                   directory.</p>
1.1       grant    8726:                 </li>
                   8727: 
                   8728:                 <li>
1.14      xtraeme  8729:                   <p><code class=
                   8730:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   8731:                   "replaceable"><code>pkg</code></em></code> (not
                   8732:                   shown above) controls whether we use <code class=
                   8733:                   "varname">BUILD_DEPENDS</code> or <code class=
                   8734:                   "varname">DEPENDS</code> to add the dependency on
                   8735:                   <em class="replaceable"><code>pkg</code></em>.
                   8736:                   The build dependency is selected by setting
                   8737:                   <code class=
                   8738:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   8739:                   "replaceable"><code>pkg</code></em></code> to
1.1       grant    8740:                   &#8220;<span class="quote">build</span>&#8221;.
                   8741:                   By default, the full dependency is used.</p>
                   8742:                 </li>
                   8743: 
                   8744:                 <li>
1.14      xtraeme  8745:                   <p><code class=
                   8746:                   "varname">BUILDLINK_INCDIRS.<em class=
                   8747:                   "replaceable"><code>pkg</code></em></code> and
                   8748:                   <code class=
1.66    ! rillig   8749:                   "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
        !          8750:                   <code>pkg</code></em></code> (not shown above)
        !          8751:                   are lists of subdirectories of <code xmlns=
1.45      wiz      8752:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8753:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8754:                   "replaceable"><code>pkg</code></em>}</code> to
                   8755:                   add to the header and library search paths. These
1.1       grant    8756:                   default to &#8220;<span class=
                   8757:                   "quote">include</span>&#8221; and
                   8758:                   &#8220;<span class="quote">lib</span>&#8221;
                   8759:                   respectively.</p>
                   8760:                 </li>
                   8761: 
                   8762:                 <li>
1.14      xtraeme  8763:                   <p><code class=
                   8764:                   "varname">BUILDLINK_CPPFLAGS.<em class=
                   8765:                   "replaceable"><code>pkg</code></em></code> (not
                   8766:                   shown above) is the list of preprocessor flags to
                   8767:                   add to <code class="varname">CPPFLAGS</code>,
                   8768:                   which are passed on to the configure and build
                   8769:                   phases. The &#8220;<span class=
                   8770:                   "quote">-I</span>&#8221; option should be avoided
                   8771:                   and instead be handled using <code class=
                   8772:                   "varname">BUILDLINK_INCDIRS.<em class=
                   8773:                   "replaceable"><code>pkg</code></em></code> as
                   8774:                   above.</p>
1.1       grant    8775:                 </li>
                   8776:               </ul>
                   8777:             </div>
                   8778: 
                   8779:             <p>The following variables are all optionally defined
                   8780:             within this second section (protected against multiple
                   8781:             inclusion) and control which package files are
1.45      wiz      8782:             symlinked into <code xmlns=
                   8783:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8784:             "filename">${BUILDLINK_DIR}</code> and how their names
1.1       grant    8785:             are transformed during the symlinking:</p>
                   8786: 
                   8787:             <div class="itemizedlist">
                   8788:               <ul type="disc">
                   8789:                 <li>
1.14      xtraeme  8790:                   <p><code class=
                   8791:                   "varname">BUILDLINK_FILES.<em class=
                   8792:                   "replaceable"><code>pkg</code></em></code> (not
                   8793:                   shown above) is a shell glob pattern relative to
1.45      wiz      8794:                   <code xmlns=
                   8795:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8796:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8797:                   "replaceable"><code>pkg</code></em>}</code> to be
1.45      wiz      8798:                   symlinked into <code xmlns=
                   8799:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8800:                   "filename">${BUILDLINK_DIR}</code>, e.g.
1.45      wiz      8801:                   <code xmlns=
                   8802:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8803:                   "filename">include/*.h</code>.</p>
1.1       grant    8804:                 </li>
                   8805: 
                   8806:                 <li>
1.14      xtraeme  8807:                   <p><code class=
                   8808:                   "varname">BUILDLINK_FILES_CMD.<em class=
                   8809:                   "replaceable"><code>pkg</code></em></code> (not
                   8810:                   shown above) is a shell pipeline that outputs to
1.45      wiz      8811:                   stdout a list of files relative to <code xmlns=
                   8812:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8813:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8814:                   "replaceable"><code>pkg</code></em>}</code>. The
1.1       grant    8815:                   resulting files are to be symlinked into
1.45      wiz      8816:                   <code xmlns=
                   8817:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8818:                   "filename">${BUILDLINK_DIR}</code>. By default,
                   8819:                   this takes the <code xmlns=
                   8820:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8821:                   "filename">+CONTENTS</code> of a <em class=
                   8822:                   "replaceable"><code>pkg</code></em> and filters
                   8823:                   it through <code class=
                   8824:                   "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
                   8825:                   "replaceable"><code>pkg</code></em>}</code>.</p>
1.1       grant    8826:                 </li>
                   8827: 
                   8828:                 <li>
1.14      xtraeme  8829:                   <p><code class=
                   8830:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   8831:                   "replaceable"><code>pkg</code></em></code> (not
                   8832:                   shown above) is a filter command that filters
1.45      wiz      8833:                   <code xmlns=
                   8834:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8835:                   "filename">+CONTENTS</code> input into a list of
                   8836:                   files relative to <code xmlns=
                   8837:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8838:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8839:                   "replaceable"><code>pkg</code></em>}</code> on
                   8840:                   stdout. By default for overwrite packages,
                   8841:                   <code class=
                   8842:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   8843:                   "replaceable"><code>pkg</code></em></code>
1.45      wiz      8844:                   outputs the contents of the <code xmlns=
                   8845:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8846:                   "filename">include</code> and <code xmlns=
                   8847:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8848:                   "filename">lib</code> directories in the package
1.45      wiz      8849:                   <code xmlns=
                   8850:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8851:                   "filename">+CONTENTS</code>, and for pkgviews
                   8852:                   packages, it outputs any libtool archives in
                   8853:                   <code xmlns=
                   8854:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8855:                   "filename">lib</code> directories.</p>
1.1       grant    8856:                 </li>
                   8857: 
                   8858:                 <li>
1.14      xtraeme  8859:                   <p><code class=
                   8860:                   "varname">BUILDLINK_TRANSFORM.<em class=
                   8861:                   "replaceable"><code>pkg</code></em></code> (not
                   8862:                   shown above) is a list of sed arguments used to
1.1       grant    8863:                   transform the name of the source filename into a
1.14      xtraeme  8864:                   destination filename, e.g. <span><strong class=
1.1       grant    8865:                   "command">-e
1.14      xtraeme  8866:                   "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1       grant    8867:                 </li>
                   8868:               </ul>
                   8869:             </div>
                   8870: 
1.45      wiz      8871:             <p>The last section includes any <code xmlns=
                   8872:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8873:             "filename">buildlink3.mk</code> needed for <em class=
                   8874:             "replaceable"><code>pkg</code></em>'s library
1.45      wiz      8875:             dependencies. Including these <code xmlns=
                   8876:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8877:             "filename">buildlink3.mk</code> files means that the
                   8878:             headers and libraries for these dependencies are also
1.45      wiz      8879:             symlinked into <code xmlns=
                   8880:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8881:             "filename">${BUILDLINK_DIR}</code> whenever the
                   8882:             <em class="replaceable"><code>pkg</code></em>
1.45      wiz      8883:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8884:             class="filename">buildlink3.mk</code> file is
1.14      xtraeme  8885:             included.</p>
1.1       grant    8886:           </div>
                   8887: 
1.66    ! rillig   8888:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    8889:             <div class="titlepage">
                   8890:               <div>
                   8891:                 <div>
1.30      wiz      8892:                   <h3 class="title"><a name=
1.66    ! rillig   8893:                   "updating-buildlink-depends" id=
        !          8894:                   "updating-buildlink-depends"></a>11.2.2. Updating
1.30      wiz      8895:                   <code class=
1.66    ! rillig   8896:                   "varname">BUILDLINK_DEPENDS.<em class="replaceable">
        !          8897:                   <code>pkg</code></em></code> in <code xmlns=
1.45      wiz      8898:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      8899:                   "filename">buildlink3.mk</code> files</h3>
1.1       grant    8900:                 </div>
                   8901:               </div>
                   8902:             </div>
                   8903: 
                   8904:             <p>There are two situations that require increasing the
1.14      xtraeme  8905:             dependency listed in <code class=
                   8906:             "varname">BUILDLINK_DEPENDS.<em class=
                   8907:             "replaceable"><code>pkg</code></em></code> after a
                   8908:             package update:</p>
1.1       grant    8909: 
                   8910:             <div class="orderedlist">
                   8911:               <ol type="1">
                   8912:                 <li>
                   8913:                   <p>if the sonames (major number of the library
                   8914:                   version) of any installed shared libraries
1.47      reed     8915:                   change.</p>
1.1       grant    8916:                 </li>
                   8917: 
                   8918:                 <li>
                   8919:                   <p>if the API or interface to the header files
                   8920:                   change.</p>
                   8921:                 </li>
                   8922:               </ol>
                   8923:             </div>
                   8924: 
1.14      xtraeme  8925:             <p>In these cases, <code class=
                   8926:             "varname">BUILDLINK_DEPENDS.<em class=
                   8927:             "replaceable"><code>pkg</code></em></code> should be
                   8928:             adjusted to require at least the new package version.
                   8929:             In some cases, the packages that depend on this new
                   8930:             version may need their <code class=
                   8931:             "varname">PKGREVISION</code>s increased and, if they
1.45      wiz      8932:             have <code xmlns=
                   8933:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8934:             "filename">buildlink3.mk</code> files, their
                   8935:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   8936:             "replaceable"><code>pkg</code></em></code> adjusted,
                   8937:             too. This is needed so that binary packages made using
                   8938:             it will require the correct package dependency and not
                   8939:             settle for an older one which will not contain the
                   8940:             necessary shared libraries.</p>
1.1       grant    8941: 
                   8942:             <p>Please take careful consideration before adjusting
1.14      xtraeme  8943:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   8944:             "replaceable"><code>pkg</code></em></code> as we don't
                   8945:             want to cause unneeded package deletions and rebuilds.
                   8946:             In many cases, new versions of packages work just fine
                   8947:             with older dependencies. See <a href="#dependencies"
1.66    ! rillig   8948:             title="15.1.4.&nbsp;Handling dependencies">Section
        !          8949:             15.1.4, &#8220;Handling dependencies&#8221;</a> for
        !          8950:             more information about dependencies on other packages,
1.25      rillig   8951:             including the <code class=
                   8952:             "varname">BUILDLINK_RECOMMENDED</code> and <code class=
                   8953:             "varname">RECOMMENDED</code> definitions.</p>
1.1       grant    8954:           </div>
                   8955:         </div>
                   8956: 
1.66    ! rillig   8957:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    8958:           <div class="titlepage">
                   8959:             <div>
                   8960:               <div>
                   8961:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   8962:                 "writing-builtin.mk" id=
1.38      dillo    8963:                 "writing-builtin.mk"></a>11.3.&nbsp;Writing
1.45      wiz      8964:                 <code xmlns=
                   8965:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8966:                 "filename">builtin.mk</code> files</h2>
1.1       grant    8967:               </div>
                   8968:             </div>
                   8969:           </div>
                   8970: 
                   8971:           <p>Some packages in pkgsrc install headers and libraries
                   8972:           that coincide with headers and libraries present in the
1.45      wiz      8973:           base system. Aside from a <code xmlns=
                   8974:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8975:           "filename">buildlink3.mk</code> file, these packages
1.45      wiz      8976:           should also include a <code xmlns=
                   8977:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8978:           "filename">builtin.mk</code> file that includes the
                   8979:           necessary checks to decide whether using the built-in
                   8980:           software or the pkgsrc software is appropriate.</p>
1.1       grant    8981: 
                   8982:           <p>The only requirements of a builtin.mk file for
1.14      xtraeme  8983:           <em class="replaceable"><code>pkg</code></em> are:</p>
1.1       grant    8984: 
                   8985:           <div class="orderedlist">
                   8986:             <ol type="1">
                   8987:               <li>
1.14      xtraeme  8988:                 <p>It should set <code class=
                   8989:                 "varname">USE_BUILTIN.<em class=
                   8990:                 "replaceable"><code>pkg</code></em></code> to
                   8991:                 either &#8220;<span class="quote">yes</span>&#8221;
                   8992:                 or &#8220;<span class="quote">no</span>&#8221;
                   8993:                 after it is included.</p>
1.1       grant    8994:               </li>
                   8995: 
                   8996:               <li>
                   8997:                 <p>It should <span class=
                   8998:                 "emphasis"><em>not</em></span> override any
1.14      xtraeme  8999:                 <code class="varname">USE_BUILTIN.<em class=
                   9000:                 "replaceable"><code>pkg</code></em></code> which is
1.45      wiz      9001:                 already set before the <code xmlns=
                   9002:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9003:                 "filename">builtin.mk</code> file is included.</p>
1.1       grant    9004:               </li>
                   9005: 
                   9006:               <li>
                   9007:                 <p>It should be written to allow multiple
                   9008:                 inclusion. This is <span class=
                   9009:                 "emphasis"><em>very</em></span> important and takes
1.45      wiz      9010:                 careful attention to <code xmlns=
                   9011:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9012:                 "filename">Makefile</code> coding.</p>
1.1       grant    9013:               </li>
                   9014:             </ol>
                   9015:           </div>
                   9016: 
1.66    ! rillig   9017:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    9018:             <div class="titlepage">
                   9019:               <div>
                   9020:                 <div>
1.66    ! rillig   9021:                   <h3 class="title"><a name="anatomy-of-builtin.mk"
        !          9022:                   id=
1.38      dillo    9023:                   "anatomy-of-builtin.mk"></a>11.3.1.&nbsp;Anatomy
1.45      wiz      9024:                   of a <code xmlns=
                   9025:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9026:                   "filename">builtin.mk</code> file</h3>
1.1       grant    9027:                 </div>
                   9028:               </div>
                   9029:             </div>
                   9030: 
                   9031:             <p>The following is the recommended template for
                   9032:             builtin.mk files:</p>
                   9033:             <pre class="programlisting">
1.51      rillig   9034:     .if !defined(IS_BUILTIN.foo)
                   9035:     #
                   9036:     # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
                   9037:     # genuinely exists in the system or not.
                   9038:     #
                   9039:     IS_BUILTIN.foo?=        no
                   9040: 
                   9041:     # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
                   9042:     # version can be determined.
                   9043:     #
                   9044:     .  if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
                   9045:     BUILTIN_PKG.foo?=       foo-1.0
                   9046:     .  endif
                   9047:     .endif  # IS_BUILTIN.foo
                   9048: 
                   9049:     .if !defined(USE_BUILTIN.foo)
                   9050:     USE_BUILTIN.foo?=       ${IS_BUILTIN.foo}
                   9051:     .  if defined(BUILTIN_PKG.foo)
                   9052:     .    for _depend_ in ${BUILDLINK_DEPENDS.foo}
                   9053:     .      if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
                   9054:     USE_BUILTIN.foo!=                                                       \
                   9055:           if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then     \
                   9056:                   ${ECHO} "yes";                                            \
                   9057:           else                                                              \
                   9058:                   ${ECHO} "no";                                             \
                   9059:           fi
                   9060:     .      endif
                   9061:     .    endfor
                   9062:     .  endif
                   9063:     .endif  # USE_BUILTIN.foo
                   9064: 
                   9065:     CHECK_BUILTIN.foo?=     no
                   9066:     .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
                   9067:     #
                   9068:     # Here we place code that depends on whether USE_BUILTIN.foo is set to
                   9069:     # "yes" or "no".
                   9070:     #
                   9071:     .endif  # CHECK_BUILTIN.foo
1.1       grant    9072: </pre>
                   9073: 
1.14      xtraeme  9074:             <p>The first section sets <code class=
                   9075:             "varname">IS_BUILTIN.<em class=
                   9076:             "replaceable"><code>pkg</code></em></code> depending on
                   9077:             if <em class="replaceable"><code>pkg</code></em> really
                   9078:             exists in the base system. This should not be a base
                   9079:             system software with similar functionality to
                   9080:             <em class="replaceable"><code>pkg</code></em>; it
                   9081:             should only be &#8220;<span class=
                   9082:             "quote">yes</span>&#8221; if the actual package is
                   9083:             included as part of the base system. This variable is
1.45      wiz      9084:             only used internally within the <code xmlns=
                   9085:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9086:             "filename">builtin.mk</code> file.</p>
                   9087: 
                   9088:             <p>The second section sets <code class=
                   9089:             "varname">BUILTIN_PKG.<em class=
                   9090:             "replaceable"><code>pkg</code></em></code> to the
                   9091:             version of <em class=
                   9092:             "replaceable"><code>pkg</code></em> in the base system
                   9093:             if it exists (if <code class=
                   9094:             "varname">IS_BUILTIN.<em class=
                   9095:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    9096:             &#8220;<span class="quote">yes</span>&#8221;). This
1.14      xtraeme  9097:             variable is only used internally within the
1.45      wiz      9098:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9099:             class="filename">builtin.mk</code> file.</p>
1.1       grant    9100: 
1.14      xtraeme  9101:             <p>The third section sets <code class=
                   9102:             "varname">USE_BUILTIN.<em class=
                   9103:             "replaceable"><code>pkg</code></em></code> and is
                   9104:             <span class="emphasis"><em>required</em></span> in all
1.45      wiz      9105:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9106:             class="filename">builtin.mk</code> files. The code in
                   9107:             this section must make the determination whether the
                   9108:             built-in software is adequate to satisfy the
                   9109:             dependencies listed in <code class=
1.14      xtraeme  9110:             "varname">BUILDLINK_DEPENDS.<em class=
                   9111:             "replaceable"><code>pkg</code></em></code>. This is
                   9112:             typically done by comparing <code class=
                   9113:             "varname">BUILTIN_PKG.<em class=
                   9114:             "replaceable"><code>pkg</code></em></code> against each
                   9115:             of the dependencies in <code class=
                   9116:             "varname">BUILDLINK_DEPENDS.<em class=
                   9117:             "replaceable"><code>pkg</code></em></code>.
                   9118:             <code class="varname">USE_BUILTIN.<em class=
                   9119:             "replaceable"><code>pkg</code></em></code> <span class=
1.1       grant    9120:             "emphasis"><em>must</em></span> be set to the correct
1.45      wiz      9121:             value by the end of the <code xmlns=
                   9122:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9123:             "filename">builtin.mk</code> file. Note that
                   9124:             <code class="varname">USE_BUILTIN.<em class=
                   9125:             "replaceable"><code>pkg</code></em></code> may be
1.1       grant    9126:             &#8220;<span class="quote">yes</span>&#8221; even if
1.14      xtraeme  9127:             <code class="varname">IS_BUILTIN.<em class=
                   9128:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    9129:             &#8220;<span class="quote">no</span>&#8221; because we
                   9130:             may make the determination that the built-in version of
                   9131:             the software is similar enough to be used as a
                   9132:             replacement.</p>
                   9133: 
1.14      xtraeme  9134:             <p>The last section is guarded by <code class=
                   9135:             "varname">CHECK_BUILTIN.<em class=
                   9136:             "replaceable"><code>pkg</code></em></code>, and
                   9137:             includes code that uses the value of <code class=
                   9138:             "varname">USE_BUILTIN.<em class=
                   9139:             "replaceable"><code>pkg</code></em></code> set in the
                   9140:             previous section. This typically includes, e.g., adding
1.1       grant    9141:             additional dependency restrictions and listing
1.45      wiz      9142:             additional files to symlink into <code xmlns=
                   9143:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9144:             "filename">${BUILDLINK_DIR}</code> (via <code class=
                   9145:             "varname">BUILDLINK_FILES.<em class=
                   9146:             "replaceable"><code>pkg</code></em></code>).</p>
1.1       grant    9147:           </div>
                   9148: 
1.66    ! rillig   9149:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    9150:             <div class="titlepage">
                   9151:               <div>
                   9152:                 <div>
1.30      wiz      9153:                   <h3 class="title"><a name=
1.66    ! rillig   9154:                   "native-or-pkgsrc-preference" id=
1.38      dillo    9155:                   "native-or-pkgsrc-preference"></a>11.3.2.&nbsp;Global
1.30      wiz      9156:                   preferences for native or pkgsrc software</h3>
1.1       grant    9157:                 </div>
                   9158:               </div>
                   9159:             </div>
                   9160: 
                   9161:             <p>When building packages, it's possible to choose
                   9162:             whether to set a global preference for using either the
                   9163:             built-in (native) version or the pkgsrc version of
                   9164:             software to satisfy a dependency. This is controlled by
1.14      xtraeme  9165:             setting <code class="varname">PREFER_PKGSRC</code> and
                   9166:             <code class="varname">PREFER_NATIVE</code>. These
                   9167:             variables take values of either &#8220;<span class=
1.1       grant    9168:             "quote">yes</span>&#8221;, &#8220;<span class=
                   9169:             "quote">no</span>&#8221;, or a list of packages.
1.14      xtraeme  9170:             <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
                   9171:             to use the pkgsrc versions of software, while
                   9172:             <code class="varname">PREFER_NATIVE</code> tells pkgsrc
                   9173:             to use the built-in versions. Preferences are
                   9174:             determined by the most specific instance of the package
                   9175:             in either <code class="varname">PREFER_PKGSRC</code> or
                   9176:             <code class="varname">PREFER_NATIVE</code>. If a
                   9177:             package is specified in neither or in both variables,
                   9178:             then <code class="varname">PREFER_PKGSRC</code> has
                   9179:             precedence over <code class=
                   9180:             "varname">PREFER_NATIVE</code>. For example, to require
                   9181:             using pkgsrc versions of software for all but the most
                   9182:             basic bits on a NetBSD system, you can set:</p>
1.1       grant    9183:             <pre class="programlisting">
1.51      rillig   9184:     PREFER_PKGSRC=  yes
                   9185:     PREFER_NATIVE=  getopt skey tcp_wrappers
1.1       grant    9186: </pre>
                   9187: 
                   9188:             <p>A package <span class=
1.45      wiz      9189:             "emphasis"><em>must</em></span> have a <code xmlns=
                   9190:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9191:             "filename">builtin.mk</code> file to be listed in
                   9192:             <code class="varname">PREFER_NATIVE</code>, otherwise
                   9193:             it is simply ignored in that list.</p>
1.1       grant    9194:           </div>
                   9195:         </div>
                   9196:       </div>
                   9197: 
1.66    ! rillig   9198:       <div class="chapter" lang="en" xml:lang="en">
1.1       grant    9199:         <div class="titlepage">
                   9200:           <div>
                   9201:             <div>
1.66    ! rillig   9202:               <h2 class="title"><a name="pkginstall" id=
1.38      dillo    9203:               "pkginstall"></a>Chapter&nbsp;12.&nbsp;The pkginstall
1.35      jmmv     9204:               framework</h2>
1.1       grant    9205:             </div>
                   9206:           </div>
                   9207:         </div>
                   9208: 
                   9209:         <div class="toc">
                   9210:           <p><b>Table of Contents</b></p>
                   9211: 
                   9212:           <dl>
1.30      wiz      9213:             <dt><span class="sect1"><a href=
1.38      dillo    9214:             "#files-and-dirs-outside-prefix">12.1. Files and
1.35      jmmv     9215:             directories outside the installation
                   9216:             prefix</a></span></dt>
                   9217: 
                   9218:             <dd>
                   9219:               <dl>
                   9220:                 <dt><span class="sect2"><a href=
1.38      dillo    9221:                 "#dirs-outside-prefix">12.1.1. Directory
1.35      jmmv     9222:                 manipulation</a></span></dt>
                   9223: 
                   9224:                 <dt><span class="sect2"><a href=
1.38      dillo    9225:                 "#files-outside-prefix">12.1.2. File
1.35      jmmv     9226:                 manipulation</a></span></dt>
                   9227:               </dl>
                   9228:             </dd>
                   9229: 
1.38      dillo    9230:             <dt><span class="sect1"><a href="#conf-files">12.2.
1.35      jmmv     9231:             Configuration files</a></span></dt>
                   9232: 
                   9233:             <dd>
                   9234:               <dl>
                   9235:                 <dt><span class="sect2"><a href=
1.38      dillo    9236:                 "#conf-files-sysconfdir">12.2.1. How <code class=
1.35      jmmv     9237:                 "varname">PKG_SYSCONFDIR</code> is
                   9238:                 set</a></span></dt>
                   9239: 
                   9240:                 <dt><span class="sect2"><a href=
1.38      dillo    9241:                 "#conf-files-configure">12.2.2. Telling the
1.47      reed     9242:                 software where configuration files
1.35      jmmv     9243:                 are</a></span></dt>
                   9244: 
                   9245:                 <dt><span class="sect2"><a href=
1.38      dillo    9246:                 "#conf-files-patching">12.2.3. Patching
1.35      jmmv     9247:                 installations</a></span></dt>
                   9248: 
                   9249:                 <dt><span class="sect2"><a href=
1.38      dillo    9250:                 "#conf-files-disable">12.2.4. Disabling handling of
1.35      jmmv     9251:                 configuration files</a></span></dt>
                   9252:               </dl>
                   9253:             </dd>
                   9254: 
1.38      dillo    9255:             <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35      jmmv     9256:             System startup scripts</a></span></dt>
                   9257: 
                   9258:             <dd>
                   9259:               <dl>
                   9260:                 <dt><span class="sect2"><a href=
1.38      dillo    9261:                 "#rcd-scripts-disable">12.3.1. Disabling handling
1.35      jmmv     9262:                 of system startup scripts</a></span></dt>
                   9263:               </dl>
                   9264:             </dd>
1.1       grant    9265: 
1.30      wiz      9266:             <dt><span class="sect1"><a href=
1.38      dillo    9267:             "#users-and-groups">12.4. System users and
1.35      jmmv     9268:             groups</a></span></dt>
                   9269: 
1.38      dillo    9270:             <dt><span class="sect1"><a href="#shells">12.5. System
1.35      jmmv     9271:             shells</a></span></dt>
                   9272: 
                   9273:             <dd>
                   9274:               <dl>
                   9275:                 <dt><span class="sect2"><a href=
1.65      hubertf  9276:                 "#shells-disable">12.5.1. Disabling shell
                   9277:                 registration</a></span></dt>
                   9278:               </dl>
                   9279:             </dd>
                   9280: 
                   9281:             <dt><span class="sect1"><a href="#fonts">12.6.
                   9282:             Fonts</a></span></dt>
                   9283: 
                   9284:             <dd>
                   9285:               <dl>
                   9286:                 <dt><span class="sect2"><a href=
                   9287:                 "#fonts-disable">12.6.1. Disabling automatic update
                   9288:                 of the fonts databases</a></span></dt>
1.35      jmmv     9289:               </dl>
                   9290:             </dd>
1.1       grant    9291:           </dl>
                   9292:         </div>
                   9293: 
1.35      jmmv     9294:         <p>This chapter describes the framework known as
                   9295:         <code class="literal">pkginstall</code>, whose key features
                   9296:         are:</p>
                   9297: 
                   9298:         <div class="itemizedlist">
                   9299:           <ul type="disc">
                   9300:             <li>
                   9301:               <p>Generic installation and manipulation of
                   9302:               directories and files outside the pkgsrc-handled
                   9303:               tree, <code class="varname">LOCALBASE</code>.</p>
                   9304:             </li>
                   9305: 
                   9306:             <li>
                   9307:               <p>Automatic handling of configuration files during
                   9308:               installation, provided that packages are correctly
                   9309:               designed.</p>
                   9310:             </li>
                   9311: 
                   9312:             <li>
                   9313:               <p>Generation and installation of system startup
                   9314:               scripts.</p>
                   9315:             </li>
                   9316: 
                   9317:             <li>
                   9318:               <p>Registration of system users and groups.</p>
                   9319:             </li>
                   9320: 
                   9321:             <li>
                   9322:               <p>Registration of system shells.</p>
                   9323:             </li>
1.65      hubertf  9324: 
                   9325:             <li>
                   9326:               <p>Automatic updating of fonts databases.</p>
                   9327:             </li>
1.35      jmmv     9328:           </ul>
                   9329:         </div>
                   9330: 
                   9331:         <p>The following sections inspect each of the above points
1.65      hubertf  9332:         in detail.</p>
1.35      jmmv     9333: 
                   9334:         <p>You may be thinking that many of the things described
                   9335:         here could be easily done with simple code in the package's
                   9336:         post-installation target (<code class=
                   9337:         "literal">post-install</code>). <span class=
                   9338:         "emphasis"><em>This is incorrect</em></span>, as the code
                   9339:         in them is only executed when building from source.
                   9340:         Machines using binary packages could not benefit from it at
                   9341:         all (as the code itself could be unavailable). Therefore,
                   9342:         the only way to achieve any of the items described above is
                   9343:         by means of the installation scripts, which are
                   9344:         automatically generated by pkginstall.</p>
1.1       grant    9345: 
1.66    ! rillig   9346:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    9347:           <div class="titlepage">
                   9348:             <div>
                   9349:               <div>
                   9350:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   9351:                 "files-and-dirs-outside-prefix" id=
1.63      dillo    9352:                 "files-and-dirs-outside-prefix"></a>12.1.&nbsp;Files
                   9353:                 and directories outside the installation
                   9354:                 prefix</h2>
1.1       grant    9355:               </div>
                   9356:             </div>
                   9357:           </div>
                   9358: 
1.45      wiz      9359:           <p>As you already know, the <code xmlns=
                   9360:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9361:           "filename">PLIST</code> file holds a list of files and
                   9362:           directories that belong to a package. The names used in
1.45      wiz      9363:           it are relative to the installation prefix (<code xmlns=
                   9364:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9365:           "filename">${PREFIX}</code>), which means that it cannot
                   9366:           register files outside this directory (absolute path
                   9367:           names are not allowed). Despite this restriction, some
                   9368:           packages need to install files outside this location;
1.45      wiz      9369:           e.g., under <code xmlns=
                   9370:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   9371:           "filename">${VARBASE}</code> or <code xmlns=
                   9372:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   9373:           "filename">${PKG_SYSCONFDIR}</code>.</p>
1.35      jmmv     9374: 
                   9375:           <p>The only way to achieve this is to create such files
                   9376:           during installation time by using the installation
                   9377:           scripts. These scripts can run arbitrary commands, so
                   9378:           they have the potential to create and manage files
1.47      reed     9379:           anywhere in the file system. Here is where pkginstall
1.35      jmmv     9380:           comes into play: it provides generic scripts to abstract
                   9381:           the manipulation of such files and directories based on
1.45      wiz      9382:           variables set in the package's <code xmlns=
                   9383:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9384:           "filename">Makefile</code>. The rest of this section
1.47      reed     9385:           describes these variables.</p>
1.1       grant    9386: 
1.66    ! rillig   9387:           <div class="sect2" lang="en" xml:lang="en">
1.35      jmmv     9388:             <div class="titlepage">
1.1       grant    9389:               <div>
1.35      jmmv     9390:                 <div>
1.66    ! rillig   9391:                   <h3 class="title"><a name="dirs-outside-prefix"
        !          9392:                   id=
1.63      dillo    9393:                   "dirs-outside-prefix"></a>12.1.1.&nbsp;Directory
1.35      jmmv     9394:                   manipulation</h3>
                   9395:                 </div>
1.1       grant    9396:               </div>
                   9397:             </div>
                   9398: 
1.35      jmmv     9399:             <p>The following variables can be set to request the
1.47      reed     9400:             creation of directories anywhere in the file
                   9401:             system:</p>
1.27      rillig   9402: 
1.35      jmmv     9403:             <div class="itemizedlist">
                   9404:               <ul type="disc">
                   9405:                 <li>
                   9406:                   <p><code class="varname">MAKE_DIRS</code> and
                   9407:                   <code class="varname">OWN_DIRS</code> contain a
                   9408:                   list of directories that should be created and
                   9409:                   should attempt to be destroyed by the
                   9410:                   installation scripts. The difference between the
                   9411:                   two is that the latter prompts the administrator
                   9412:                   to remove any directories that may be left after
                   9413:                   deinstallation (because they were not empty),
                   9414:                   while the former does not.</p>
                   9415:                 </li>
1.1       grant    9416: 
1.35      jmmv     9417:                 <li>
                   9418:                   <p><code class="varname">MAKE_DIRS_PERMS</code>
                   9419:                   and <code class="varname">OWN_DIRS_PERMS</code>
                   9420:                   contain a list of tuples describing which
                   9421:                   directories should be created and should attempt
                   9422:                   to be destroyed by the installation scripts. Each
                   9423:                   tuple holds the following values, separated by
                   9424:                   spaces: the directory name, its owner, its group
                   9425:                   and its numerical mode. For example:</p>
                   9426:                   <pre class="programlisting">
1.51      rillig   9427:     MAKE_DIRS_PERMS+=         ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
1.35      jmmv     9428: </pre>
1.1       grant    9429: 
1.35      jmmv     9430:                   <p>The difference between the two is exactly the
                   9431:                   same as their non-<code class=
                   9432:                   "varname">PERMS</code> counterparts.</p>
                   9433:                 </li>
                   9434:               </ul>
                   9435:             </div>
                   9436:           </div>
                   9437: 
1.66    ! rillig   9438:           <div class="sect2" lang="en" xml:lang="en">
1.35      jmmv     9439:             <div class="titlepage">
                   9440:               <div>
                   9441:                 <div>
1.66    ! rillig   9442:                   <h3 class="title"><a name="files-outside-prefix"
        !          9443:                   id="files-outside-prefix"></a>12.1.2.&nbsp;File
1.35      jmmv     9444:                   manipulation</h3>
                   9445:                 </div>
                   9446:               </div>
                   9447:             </div>
                   9448: 
                   9449:             <p>Creating non-empty files outside the installation
1.45      wiz      9450:             prefix is tricky because the <code xmlns=
                   9451:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9452:             "filename">PLIST</code> forces all files to be inside
                   9453:             it. To overcome this problem, the only solution is to
                   9454:             extract the file in the known place (i.e., inside the
                   9455:             installation prefix) and copy it to the appropriate
                   9456:             location during installation (done by the installation
                   9457:             scripts generated by pkginstall). We will call the
                   9458:             former the <span class="emphasis"><em>master
                   9459:             file</em></span> in the following paragraphs, which
                   9460:             describe the variables that can be used to
                   9461:             automatically and consistently handle files outside the
                   9462:             installation prefix:</p>
                   9463: 
                   9464:             <div class="itemizedlist">
                   9465:               <ul type="disc">
                   9466:                 <li>
                   9467:                   <p><code class="varname">CONF_FILES</code> and
                   9468:                   <code class="varname">SUPPORT_FILES</code> are
                   9469:                   pairs of master and target files. During
                   9470:                   installation time, the master file is copied to
                   9471:                   the target one if and only if the latter does not
                   9472:                   exist. Upon deinstallation, the target file is
                   9473:                   removed provided that it was not modified by the
                   9474:                   installation.</p>
                   9475: 
                   9476:                   <p>The difference between the two is that the
                   9477:                   latter prompts the administrator to remove any
                   9478:                   files that may be left after deinstallation
                   9479:                   (because they were not empty), while the former
                   9480:                   does not.</p>
                   9481:                 </li>
                   9482: 
                   9483:                 <li>
                   9484:                   <p><code class="varname">CONF_FILES_PERMS</code>
                   9485:                   and <code class=
                   9486:                   "varname">SUPPORT_FILES_PERMS</code> contain
                   9487:                   tuples describing master files as well as their
                   9488:                   target locations. For each of them, it also
                   9489:                   specifies their owner, their group and their
                   9490:                   numeric permissions, in this order. For
                   9491:                   example:</p>
                   9492:                   <pre class="programlisting">
1.51      rillig   9493:     SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
1.35      jmmv     9494: </pre>
                   9495: 
                   9496:                   <p>The difference between the two is exactly the
                   9497:                   same as their non-<code class=
                   9498:                   "varname">PERMS</code> counterparts.</p>
                   9499:                 </li>
                   9500:               </ul>
                   9501:             </div>
                   9502:           </div>
                   9503:         </div>
                   9504: 
1.66    ! rillig   9505:         <div class="sect1" lang="en" xml:lang="en">
1.35      jmmv     9506:           <div class="titlepage">
                   9507:             <div>
                   9508:               <div>
                   9509:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   9510:                 "conf-files" id=
1.63      dillo    9511:                 "conf-files"></a>12.2.&nbsp;Configuration
                   9512:                 files</h2>
1.35      jmmv     9513:               </div>
                   9514:             </div>
                   9515:           </div>
                   9516: 
                   9517:           <p>Configuration files are special in the sense that they
                   9518:           are installed in their own specific directory,
                   9519:           <code class="varname">PKG_SYSCONFDIR</code>, and need
                   9520:           special treatment during installation (most of which is
                   9521:           automated by pkginstall). The main concept you must bear
1.36      wiz      9522:           in mind is that files marked as configuration files are
1.35      jmmv     9523:           automatically copied to the right place (somewhere inside
                   9524:           <code class="varname">PKG_SYSCONFDIR</code>) during
                   9525:           installation <span class="emphasis"><em>if and only
                   9526:           if</em></span> they didn't exist before. Similarly, they
                   9527:           will not be removed if they have local modifications.
1.36      wiz      9528:           This ensures that administrators never lose any custom
1.35      jmmv     9529:           changes they may have made.</p>
                   9530: 
1.66    ! rillig   9531:           <div class="sect2" lang="en" xml:lang="en">
1.35      jmmv     9532:             <div class="titlepage">
                   9533:               <div>
                   9534:                 <div>
1.66    ! rillig   9535:                   <h3 class="title"><a name="conf-files-sysconfdir"
        !          9536:                   id="conf-files-sysconfdir"></a>12.2.1.&nbsp;How
1.35      jmmv     9537:                   <code class="varname">PKG_SYSCONFDIR</code> is
                   9538:                   set</h3>
                   9539:                 </div>
                   9540:               </div>
                   9541:             </div>
                   9542: 
                   9543:             <p>As said before, the <code class=
                   9544:             "varname">PKG_SYSCONFDIR</code> variable specifies
                   9545:             where configuration files shall be installed. Its
                   9546:             contents are set based upon the following
                   9547:             variables:</p>
                   9548: 
                   9549:             <div class="itemizedlist">
                   9550:               <ul type="disc">
                   9551:                 <li>
                   9552:                   <p><code class="varname">PKG_SYSCONFBASE</code>:
                   9553:                   The configuration's root directory. Defaults to
1.45      wiz      9554:                   <code xmlns=
                   9555:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9556:                   "filename">${PREFIX}/etc</code> although it may
                   9557:                   be overridden by the user to point to his
                   9558:                   preferred location (e.g., <code xmlns=
                   9559:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9560:                   "filename">/etc</code>, <code xmlns=
                   9561:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9562:                   "filename">/etc/pkg</code>, etc.). Packages must
                   9563:                   not use it directly.</p>
                   9564:                 </li>
                   9565: 
                   9566:                 <li>
                   9567:                   <p><code class=
                   9568:                   "varname">PKG_SYSCONFSUBDIR</code>: A
                   9569:                   subdirectory of <code class=
                   9570:                   "varname">PKG_SYSCONFBASE</code> under which the
                   9571:                   configuration files for the package being built
                   9572:                   shall be installed. The definition of this
                   9573:                   variable only makes sense in the package's
1.45      wiz      9574:                   <code xmlns=
                   9575:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     9576:                   "filename">Makefile</code> (i.e., it is not
                   9577:                   user-customizable).</p>
1.35      jmmv     9578: 
                   9579:                   <p>As an example, consider the Apache package,
                   9580:                   <a xmlns=
                   9581:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   9582:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
1.45      wiz      9583:                   target="_top"><code xmlns="" class=
                   9584:                   "filename">www/apache2</code></a>, which places
                   9585:                   its configuration files under the <code xmlns=
                   9586:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9587:                   "filename">httpd/</code> subdirectory of
                   9588:                   <code class="varname">PKG_SYSCONFBASE</code>.
                   9589:                   This should be set in the package Makefile.</p>
                   9590:                 </li>
                   9591: 
                   9592:                 <li>
                   9593:                   <p><code class="varname">PKG_SYSCONFVAR</code>:
                   9594:                   Specifies the name of the variable that holds
                   9595:                   this package's configuration directory (if
                   9596:                   different from <code class=
                   9597:                   "varname">PKG_SYSCONFBASE</code>). It defaults to
                   9598:                   <code class="varname">PKGBASE</code>'s value, and
                   9599:                   is always prefixed with <code class=
                   9600:                   "literal">PKG_SYSCONFDIR</code>.</p>
                   9601:                 </li>
                   9602: 
                   9603:                 <li>
                   9604:                   <p><code class=
                   9605:                   "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
                   9606:                   Holds the directory where the configuration files
                   9607:                   for the package identified by <code class=
                   9608:                   "varname">PKG_SYSCONFVAR</code>'s shall be
                   9609:                   placed.</p>
                   9610:                 </li>
                   9611:               </ul>
                   9612:             </div>
                   9613: 
                   9614:             <p>Based on the above variables, pkginstall determines
                   9615:             the value of <code class=
                   9616:             "varname">PKG_SYSCONFDIR</code>, which is the
                   9617:             <span class="emphasis"><em>only</em></span> variable
                   9618:             that can be used within a package to refer to its
                   9619:             configuration directory. The algorithm used to set its
                   9620:             value is basically the following:</p>
                   9621: 
                   9622:             <div class="orderedlist">
                   9623:               <ol type="1">
                   9624:                 <li>
                   9625:                   <p>If <code class=
                   9626:                   "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   9627:                   is set, its value is used.</p>
                   9628:                 </li>
                   9629: 
                   9630:                 <li>
                   9631:                   <p>If the previous variable is not defined but
                   9632:                   <code class="varname">PKG_SYSCONFSUBDIR</code> is
1.45      wiz      9633:                   set in the package's <code xmlns=
                   9634:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9635:                   "filename">Makefile</code>, the resulting value
1.45      wiz      9636:                   is <code xmlns=
                   9637:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9638:                   "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
                   9639:                 </li>
                   9640: 
                   9641:                 <li>
1.45      wiz      9642:                   <p>Otherwise, it is set to <code xmlns=
                   9643:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9644:                   "filename">${PKG_SYSCONFBASE}</code>.</p>
                   9645:                 </li>
                   9646:               </ol>
                   9647:             </div>
                   9648: 
1.45      wiz      9649:             <p>It is worth mentioning that <code xmlns=
                   9650:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9651:             "filename">${PKG_SYSCONFDIR}</code> is automatically
1.45      wiz      9652:             added to <code xmlns=
                   9653:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   9654:             "filename">OWN_DIRS</code>. See <a href=
                   9655:             "#dirs-outside-prefix" title=
1.63      dillo    9656:             "12.1.1.&nbsp;Directory manipulation">Section&nbsp;12.1.1,
1.35      jmmv     9657:             &#8220;Directory manipulation&#8221;</a> what this
                   9658:             means.</p>
                   9659:           </div>
                   9660: 
1.66    ! rillig   9661:           <div class="sect2" lang="en" xml:lang="en">
1.35      jmmv     9662:             <div class="titlepage">
                   9663:               <div>
                   9664:                 <div>
1.66    ! rillig   9665:                   <h3 class="title"><a name="conf-files-configure"
        !          9666:                   id=
1.63      dillo    9667:                   "conf-files-configure"></a>12.2.2.&nbsp;Telling
                   9668:                   the software where configuration files are</h3>
1.35      jmmv     9669:                 </div>
                   9670:               </div>
                   9671:             </div>
                   9672: 
                   9673:             <p>Given that pkgsrc (and users!) expect configuration
                   9674:             files to be in a known place, you need to teach each
1.36      wiz      9675:             package where it shall install its files. In some cases
1.35      jmmv     9676:             you will have to patch the package Makefiles to achieve
                   9677:             it. If you are lucky, though, it may be as easy as
                   9678:             passing an extra flag to the configuration script; this
1.47      reed     9679:             is the case of GNU Autoconf- generated files:</p>
1.35      jmmv     9680:             <pre class="programlisting">
1.51      rillig   9681:     CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.35      jmmv     9682: </pre>
                   9683: 
                   9684:             <p>Note that this specifies where the package has to
                   9685:             <span class="emphasis"><em>look for</em></span> its
                   9686:             configuration files, not where they will be originally
                   9687:             installed (although the difference is never explicit,
                   9688:             unfortunately).</p>
                   9689:           </div>
                   9690: 
1.66    ! rillig   9691:           <div class="sect2" lang="en" xml:lang="en">
1.35      jmmv     9692:             <div class="titlepage">
                   9693:               <div>
                   9694:                 <div>
1.66    ! rillig   9695:                   <h3 class="title"><a name="conf-files-patching"
        !          9696:                   id=
1.63      dillo    9697:                   "conf-files-patching"></a>12.2.3.&nbsp;Patching
1.35      jmmv     9698:                   installations</h3>
                   9699:                 </div>
                   9700:               </div>
                   9701:             </div>
                   9702: 
                   9703:             <p>As said before, pkginstall automatically handles
                   9704:             configuration files. This means that <span class=
                   9705:             "strong"><strong>the packages themselves must not touch
1.45      wiz      9706:             the contents of <code xmlns=
                   9707:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9708:             "filename">${PKG_SYSCONFDIR}</code>
1.36      wiz      9709:             directly</strong></span>. Bad news is that many
                   9710:             software installation scripts will, out of the box,
                   9711:             mess with the contents of that directory. So what is
                   9712:             the correct procedure to fix this issue?</p>
1.35      jmmv     9713: 
                   9714:             <p>You must teach the package (usually by manually
                   9715:             patching it) to install any configuration files under
1.45      wiz      9716:             the examples hierarchy, <code xmlns=
                   9717:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9718:             "filename">share/examples/${PKGBASE}/</code>. This way,
1.45      wiz      9719:             the <code xmlns=
                   9720:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   9721:             "filename">PLIST</code> registers them and the
                   9722:             administrator always has the original copies
1.35      jmmv     9723:             available.</p>
                   9724: 
                   9725:             <p>Once the required configuration files are in place
                   9726:             (i.e., under the examples hierarchy), the pkginstall
                   9727:             framework can use them as master copies during the
1.45      wiz      9728:             package installation to update what is in <code xmlns=
                   9729:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9730:             "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
                   9731:             the variables <code class="varname">CONF_FILES</code>
                   9732:             and <code class="varname">CONF_FILES_PERMS</code> are
                   9733:             used. Check out <a href="#files-outside-prefix" title=
1.63      dillo    9734:             "12.1.2.&nbsp;File manipulation">Section&nbsp;12.1.2,
1.35      jmmv     9735:             &#8220;File manipulation&#8221;</a> for information
                   9736:             about their syntax and their purpose. Here is an
                   9737:             example, taken from the <a xmlns=
                   9738:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9739:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
1.45      wiz      9740:             target="_top"><code xmlns="" class=
                   9741:             "filename">mail/mutt</code></a> package:</p>
1.35      jmmv     9742:             <pre class="programlisting">
1.51      rillig   9743:     EGDIR=        ${PREFIX}/share/doc/mutt/samples
                   9744:     CONF_FILES=   ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
1.35      jmmv     9745: </pre>
                   9746: 
                   9747:             <p>Note that the <code class="varname">EGDIR</code>
                   9748:             variable is specific to that package and has no meaning
                   9749:             outside it.</p>
                   9750:           </div>
                   9751: 
1.66    ! rillig   9752:           <div class="sect2" lang="en" xml:lang="en">
1.35      jmmv     9753:             <div class="titlepage">
                   9754:               <div>
                   9755:                 <div>
1.66    ! rillig   9756:                   <h3 class="title"><a name="conf-files-disable"
        !          9757:                   id="conf-files-disable"></a>12.2.4.&nbsp;Disabling
1.35      jmmv     9758:                   handling of configuration files</h3>
                   9759:                 </div>
                   9760:               </div>
                   9761:             </div>
                   9762: 
                   9763:             <p>The automatic copying of config files can be toggled
                   9764:             by setting the environment variable <code class=
                   9765:             "varname">PKG_CONFIG</code> prior to package
                   9766:             installation.</p>
                   9767:           </div>
                   9768:         </div>
                   9769: 
1.66    ! rillig   9770:         <div class="sect1" lang="en" xml:lang="en">
1.35      jmmv     9771:           <div class="titlepage">
                   9772:             <div>
                   9773:               <div>
                   9774:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   9775:                 "rcd-scripts" id=
1.63      dillo    9776:                 "rcd-scripts"></a>12.3.&nbsp;System startup
                   9777:                 scripts</h2>
1.35      jmmv     9778:               </div>
                   9779:             </div>
                   9780:           </div>
                   9781: 
                   9782:           <p>System startup scripts are special files because they
                   9783:           must be installed in a place known by the underlying OS,
                   9784:           usually outside the installation prefix. Therefore, the
                   9785:           same rules described in <a href=
                   9786:           "#files-and-dirs-outside-prefix" title=
1.38      dillo    9787:           "12.1.&nbsp;Files and directories outside the installation prefix">
1.63      dillo    9788:           Section&nbsp;12.1, &#8220;Files and directories outside
                   9789:           the installation prefix&#8221;</a> apply, and the same
1.35      jmmv     9790:           solutions can be used. However, pkginstall provides a
1.36      wiz      9791:           special mechanism to handle these files.</p>
1.35      jmmv     9792: 
                   9793:           <p>In order to provide system startup scripts, the
                   9794:           package has to:</p>
                   9795: 
                   9796:           <div class="orderedlist">
                   9797:             <ol type="1">
                   9798:               <li>
1.45      wiz      9799:                 <p>Store the script inside <code xmlns=
                   9800:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9801:                 "filename">${FILESDIR}</code>, with the
                   9802:                 <code class="literal">.sh</code> suffix appended.
                   9803:                 Considering the <a xmlns=
                   9804:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   9805:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
1.45      wiz      9806:                 target="_top"><code xmlns="" class=
                   9807:                 "filename">print/cups</code></a> package as an
                   9808:                 example, it has a <code xmlns=
                   9809:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9810:                 "filename">cupsd.sh</code> in its files
                   9811:                 directory.</p>
                   9812:               </li>
                   9813: 
                   9814:               <li>
                   9815:                 <p>Tell pkginstall to handle it, appending the name
                   9816:                 of the script, without its extension, to the
                   9817:                 <code class="varname">RCD_SCRIPTS</code> variable.
                   9818:                 Continuing the previous example:</p>
                   9819:                 <pre class="programlisting">
1.51      rillig   9820:     RCD_SCRIPTS+=   cupsd
1.35      jmmv     9821: </pre>
                   9822:               </li>
                   9823:             </ol>
                   9824:           </div>
                   9825: 
                   9826:           <p>Once this is done, pkginstall will do the following
                   9827:           steps for each script in an automated fashion:</p>
                   9828: 
                   9829:           <div class="orderedlist">
                   9830:             <ol type="1">
                   9831:               <li>
                   9832:                 <p>Process the file found in the files directory
                   9833:                 applying all the substitutions described in the
1.45      wiz      9834:                 <code xmlns=
                   9835:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   9836:                 "filename">FILES_SUBST</code> variable.</p>
1.35      jmmv     9837:               </li>
                   9838: 
                   9839:               <li>
                   9840:                 <p>Copy the script from the files directory to the
1.45      wiz      9841:                 examples hierarchy, <code xmlns=
                   9842:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9843:                 "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36      wiz      9844:                 Note that this master file must be explicitly
1.45      wiz      9845:                 registered in the <code xmlns=
                   9846:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9847:                 "filename">PLIST</code>.</p>
                   9848:               </li>
                   9849: 
                   9850:               <li>
                   9851:                 <p>Add code to the installation scripts to copy the
                   9852:                 startup script from the examples hierarchy into the
                   9853:                 system-wide startup scripts directory.</p>
                   9854:               </li>
                   9855:             </ol>
                   9856:           </div>
                   9857: 
1.66    ! rillig   9858:           <div class="sect2" lang="en" xml:lang="en">
1.35      jmmv     9859:             <div class="titlepage">
                   9860:               <div>
                   9861:                 <div>
1.66    ! rillig   9862:                   <h3 class="title"><a name="rcd-scripts-disable"
        !          9863:                   id=
1.63      dillo    9864:                   "rcd-scripts-disable"></a>12.3.1.&nbsp;Disabling
1.35      jmmv     9865:                   handling of system startup scripts</h3>
                   9866:                 </div>
                   9867:               </div>
                   9868:             </div>
                   9869: 
                   9870:             <p>The automatic copying of config files can be toggled
                   9871:             by setting the environment variable <code class=
                   9872:             "varname">PKG_RCD_SCRIPTS</code> prior to package
                   9873:             installation. Note that the scripts will be always
1.45      wiz      9874:             copied inside the examples hierarchy, <code xmlns=
                   9875:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9876:             "filename">${PREFIX}/share/examples/rc.d/</code>, no
                   9877:             matter what the value of this variable is.</p>
                   9878:           </div>
                   9879:         </div>
                   9880: 
1.66    ! rillig   9881:         <div class="sect1" lang="en" xml:lang="en">
1.35      jmmv     9882:           <div class="titlepage">
                   9883:             <div>
                   9884:               <div>
                   9885:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   9886:                 "users-and-groups" id=
1.63      dillo    9887:                 "users-and-groups"></a>12.4.&nbsp;System users and
                   9888:                 groups</h2>
1.35      jmmv     9889:               </div>
                   9890:             </div>
                   9891:           </div>
                   9892: 
                   9893:           <p>If a package needs to create special users and/or
                   9894:           groups during installation, it can do so by using the
                   9895:           pkginstall framework.</p>
                   9896: 
                   9897:           <p>Users can be created by adding entries to the
                   9898:           <code class="varname">PKG_USERS</code> variable. Each
1.45      wiz      9899:           entry has the following syntax, which mimics <code xmlns=
                   9900:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9901:           "filename">/etc/passwd</code>:</p>
                   9902:           <pre class="programlisting">
1.51      rillig   9903:     user:group[:[userid][:[descr][:[home][:shell]]]]
1.35      jmmv     9904: </pre>
                   9905: 
                   9906:           <p>Only the user and group are required; everything else
                   9907:           is optional, but the colons must be in the right places
                   9908:           when specifying optional bits. By default, a new user
1.45      wiz      9909:           will have home directory <code xmlns=
                   9910:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9911:           "filename">/nonexistent</code>, and login shell
1.45      wiz      9912:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9913:           class="filename">/sbin/nologin</code> unless they are
                   9914:           specified as part of the user element. Note that if the
1.51      rillig   9915:           description contains spaces, then spaces should be
1.45      wiz      9916:           backslash-escaped, as in:</p>
1.35      jmmv     9917:           <pre class="programlisting">
1.51      rillig   9918:     foo:foogrp::The\ Foomister
1.35      jmmv     9919: </pre>
                   9920: 
                   9921:           <p>Similarly, groups can be created using the
                   9922:           <code class="varname">PKG_GROUPS</code> variable, whose
                   9923:           syntax is:</p>
                   9924:           <pre class="programlisting">
1.51      rillig   9925:     group[:groupid]
1.35      jmmv     9926: </pre>
                   9927: 
                   9928:           <p>As before, only the group name is required; the
                   9929:           numeric identifier is optional.</p>
                   9930:         </div>
                   9931: 
1.66    ! rillig   9932:         <div class="sect1" lang="en" xml:lang="en">
1.35      jmmv     9933:           <div class="titlepage">
                   9934:             <div>
                   9935:               <div>
                   9936:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   9937:                 "shells" id="shells"></a>12.5.&nbsp;System
        !          9938:                 shells</h2>
1.35      jmmv     9939:               </div>
                   9940:             </div>
                   9941:           </div>
                   9942: 
                   9943:           <p>Packages that install system shells should register
1.45      wiz      9944:           them in the shell database, <code xmlns=
                   9945:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9946:           "filename">/etc/shells</code>, to make things easier to
                   9947:           the administrator. This must be done from the
                   9948:           installation scripts to keep binary packages working on
                   9949:           any system. pkginstall provides an easy way to accomplish
                   9950:           this task.</p>
                   9951: 
                   9952:           <p>When a package provides a shell interpreter, it has to
                   9953:           set the <code class="varname">PKG_SHELL</code> variable
                   9954:           to its absolute file name. This will add some hooks to
                   9955:           the installation scripts to handle it. Consider the
                   9956:           following example, taken from <a xmlns=
                   9957:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   9958:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
1.45      wiz      9959:           target="_top"><code xmlns="" class=
                   9960:           "filename">shells/zsh</code></a>:</p>
1.35      jmmv     9961:           <pre class="programlisting">
1.51      rillig   9962:     PKG_SHELL=      ${PREFIX}/bin/zsh
1.35      jmmv     9963: </pre>
                   9964: 
1.66    ! rillig   9965:           <div class="sect2" lang="en" xml:lang="en">
1.35      jmmv     9966:             <div class="titlepage">
                   9967:               <div>
                   9968:                 <div>
1.66    ! rillig   9969:                   <h3 class="title"><a name="shells-disable" id=
        !          9970:                   "shells-disable"></a>12.5.1. Disabling shell
1.65      hubertf  9971:                   registration</h3>
1.35      jmmv     9972:                 </div>
                   9973:               </div>
                   9974:             </div>
                   9975: 
                   9976:             <p>The automatic registration of shell interpreters can
                   9977:             be disabled by the administrator by setting the
1.45      wiz      9978:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9979:             class="filename">PKG_REGISTER_SHELLS</code> environment
                   9980:             variable to <code class="literal">NO</code>.</p>
1.35      jmmv     9981:           </div>
                   9982:         </div>
1.65      hubertf  9983: 
1.66    ! rillig   9984:         <div class="sect1" lang="en" xml:lang="en">
1.65      hubertf  9985:           <div class="titlepage">
                   9986:             <div>
                   9987:               <div>
                   9988:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   9989:                 "fonts" id="fonts"></a>12.6.&nbsp;Fonts</h2>
1.65      hubertf  9990:               </div>
                   9991:             </div>
                   9992:           </div>
                   9993: 
                   9994:           <p>Packages that install X11 fonts should update the
                   9995:           database files that index the fonts within each fonts
                   9996:           directory. This can easily be accomplished within the
                   9997:           pkginstall framework.</p>
                   9998: 
                   9999:           <p>When a package installs X11 fonts, it must list the
                   10000:           directories in which fonts are installed in the
                   10001:           <code class="varname">FONTS_DIRS.<em class=
                   10002:           "replaceable"><code>type</code></em></code> variables,
                   10003:           where <em class="replaceable"><code>type</code></em> can
                   10004:           be one of &#8220;<span class="quote">ttf</span>&#8221;,
                   10005:           &#8220;<span class="quote">type1</span>&#8221; or
                   10006:           &#8220;<span class="quote">x11</span>&#8221;. This will
                   10007:           add hooks to the installation scripts to run the
                   10008:           appropriate commands to update the fonts database files
                   10009:           within each of those directories. For convenience, if the
                   10010:           directory path is relative, it is taken to be relative to
                   10011:           the package's installation prefix. Consider the following
                   10012:           example, taken from <a xmlns=
                   10013:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   10014:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/dbz-ttf/README.html"
                   10015:           target="_top"><code xmlns="" class=
                   10016:           "filename">fonts/dbz-ttf</code></a>:</p>
                   10017:           <pre class="programlisting">
                   10018:     FONTS_DIRS.ttf= ${PREFIX}/lib/X11/fonts/TTF
                   10019: </pre>
                   10020: 
1.66    ! rillig   10021:           <div class="sect2" lang="en" xml:lang="en">
1.65      hubertf  10022:             <div class="titlepage">
                   10023:               <div>
                   10024:                 <div>
1.66    ! rillig   10025:                   <h3 class="title"><a name="fonts-disable" id=
        !          10026:                   "fonts-disable"></a>12.6.1. Disabling automatic
        !          10027:                   update of the fonts databases</h3>
1.65      hubertf  10028:                 </div>
                   10029:               </div>
                   10030:             </div>
                   10031: 
                   10032:             <p>The automatic update of fonts databases can be
                   10033:             disabled by the administrator by setting the
                   10034:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10035:             class="filename">PKG_UPDATE_FONTS_DB</code> environment
                   10036:             variable to <code class="literal">NO</code>.</p>
                   10037:           </div>
                   10038:         </div>
1.35      jmmv     10039:       </div>
                   10040: 
1.66    ! rillig   10041:       <div class="chapter" lang="en" xml:lang="en">
1.35      jmmv     10042:         <div class="titlepage">
                   10043:           <div>
                   10044:             <div>
1.66    ! rillig   10045:               <h2 class="title"><a name="options" id=
1.38      dillo    10046:               "options"></a>Chapter&nbsp;13.&nbsp;Options
1.35      jmmv     10047:               handling</h2>
                   10048:             </div>
                   10049:           </div>
                   10050:         </div>
                   10051: 
                   10052:         <div class="toc">
                   10053:           <p><b>Table of Contents</b></p>
                   10054: 
                   10055:           <dl>
                   10056:             <dt><span class="sect1"><a href=
1.38      dillo    10057:             "#global-default-options">13.1. Global default
1.35      jmmv     10058:             options</a></span></dt>
                   10059: 
                   10060:             <dt><span class="sect1"><a href=
1.38      dillo    10061:             "#converting-to-options">13.2. Converting packages to
1.45      wiz      10062:             use <code xmlns=
                   10063:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     10064:             "filename">bsd.options.mk</code></a></span></dt>
1.48      dillo    10065: 
                   10066:             <dt><span class="sect1"><a href="#option-names">13.3.
                   10067:             Option Names</a></span></dt>
1.35      jmmv     10068:           </dl>
                   10069:         </div>
                   10070: 
                   10071:         <p>Many packages have the ability to be built to support
1.45      wiz      10072:         different sets of features. <code xmlns=
                   10073:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     10074:         "filename">bsd.options.mk</code> is a framework in pkgsrc
                   10075:         that provides generic handling of those options that
                   10076:         determine different ways in which the packages can be
                   10077:         built. It's possible for the user to specify exactly which
                   10078:         sets of options will be built into a package or to allow a
                   10079:         set of global default options apply.</p>
                   10080: 
1.66    ! rillig   10081:         <div class="sect1" lang="en" xml:lang="en">
1.35      jmmv     10082:           <div class="titlepage">
                   10083:             <div>
                   10084:               <div>
                   10085:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   10086:                 "global-default-options" id=
1.38      dillo    10087:                 "global-default-options"></a>13.1.&nbsp;Global
1.35      jmmv     10088:                 default options</h2>
                   10089:               </div>
                   10090:             </div>
                   10091:           </div>
                   10092: 
                   10093:           <p>Global default options are listed in <code class=
                   10094:           "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
                   10095:           the options that should be built into every package if
                   10096:           that option is supported. This variable should be set in
1.45      wiz      10097:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10098:           class="filename">/etc/mk.conf</code>.</p>
1.35      jmmv     10099:         </div>
                   10100: 
1.66    ! rillig   10101:         <div class="sect1" lang="en" xml:lang="en">
1.35      jmmv     10102:           <div class="titlepage">
                   10103:             <div>
                   10104:               <div>
                   10105:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   10106:                 "converting-to-options" id=
1.38      dillo    10107:                 "converting-to-options"></a>13.2.&nbsp;Converting
1.45      wiz      10108:                 packages to use <code xmlns=
                   10109:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     10110:                 "filename">bsd.options.mk</code></h2>
                   10111:               </div>
                   10112:             </div>
                   10113:           </div>
                   10114: 
1.45      wiz      10115:           <p>The following example shows how <code xmlns=
                   10116:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     10117:           "filename">bsd.options.mk</code> should be used by the
                   10118:           hypothetical ``wibble'' package, either in the package
1.45      wiz      10119:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10120:           class="filename">Makefile</code>, or in a file, e.g.
                   10121:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10122:           class="filename">options.mk</code>, that is included by
                   10123:           the main package <code xmlns=
                   10124:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     10125:           "filename">Makefile</code>.</p>
                   10126:           <pre class="programlisting">
1.51      rillig   10127:     PKG_OPTIONS_VAR=            PKG_OPTIONS.wibble
                   10128:     PKG_SUPPORTED_OPTIONS=              wibble-foo ldap
                   10129:     PKG_OPTIONS_OPTIONAL_GROUPS=        database
                   10130:     PKG_OPTIONS_GROUP.database= mysql pgsql
                   10131:     PKG_SUGGESTED_OPTIONS=              wibble-foo
                   10132:     PKG_OPTIONS_LEGACY_VARS+=   WIBBLE_USE_OPENLDAP:ldap
                   10133:     PKG_OPTIONS_LEGACY_OPTS+=   foo:wibble-foo
                   10134: 
                   10135:     .include "../../mk/bsd.prefs.mk"
                   10136: 
                   10137:     # this package was previously named wibble2
                   10138:     .if defined(PKG_OPTIONS.wibble2)
                   10139:     PKG_LEGACY_OPTIONS+=  ${PKG_OPTIONS.wibble2}
                   10140:     PKG_OPTIONS_DEPRECATED_WARNINGS+= \
                   10141:             "Deprecated variable PKG_OPTIONS.wibble2 used, use "${PKG_OPTIONS_VAR:Q}" instead."
                   10142:     .endif
                   10143: 
                   10144:     .include "../../mk/bsd.options.mk"
                   10145: 
                   10146:     # Package-specific option-handling
                   10147: 
                   10148:     ###
                   10149:     ### FOO support
                   10150:     ###
                   10151:     .if !empty(PKG_OPTIONS:Mwibble-foo)
                   10152:     CONFIGURE_ARGS+=    --enable-foo
                   10153:     .endif
                   10154: 
                   10155:     ###
                   10156:     ### LDAP support
                   10157:     ###
                   10158:     .if !empty(PKG_OPTIONS:Mldap)
                   10159:     .  include "../../databases/openldap/buildlink3.mk"
                   10160:     CONFIGURE_ARGS+=    --enable-ldap=${BUILDLINK_PREFIX.openldap}
                   10161:     .endif
                   10162: 
                   10163:     ###
                   10164:     ### database support
                   10165:     ###
                   10166:     .if !empty(PKG_OPTIONS:Mmysql)
                   10167:     .  include "../../mk/mysql.buildlink3.mk"
                   10168:     .endif
                   10169:     .if !empty(PKG_OPTIONS:Mpgsql)
                   10170:     .  include "../../mk/pgsql.buildlink3.mk"
                   10171:     .endif
1.1       grant    10172: </pre>
                   10173: 
1.28      rillig   10174:           <p>The first section contains the information about which
                   10175:           build options are supported by the package, and any
1.1       grant    10176:           default options settings if needed.</p>
                   10177: 
                   10178:           <div class="orderedlist">
                   10179:             <ol type="1">
                   10180:               <li>
1.14      xtraeme  10181:                 <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27      rillig   10182:                 the name of the <a href=
1.1       grant    10183:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   10184:                 <span class="citerefentry"><span class=
1.27      rillig   10185:                 "refentrytitle">make</span>(1)</span></a> variable
1.37      dillo    10186:                 that the user can set to override the default
1.57      minskim  10187:                 options. It should be set to PKG_OPTIONS.<em class=
1.63      dillo    10188:                 "replaceable"><code>pkgbase</code></em>. Do not set
                   10189:                 it to PKG_OPTIONS.${PKGBASE}, since <code class=
                   10190:                 "varname">PKGBASE</code> is set after <code class=
                   10191:                 "varname">PKG_OPTIONS_VAR</code> is used.</p>
1.1       grant    10192:               </li>
                   10193: 
                   10194:               <li>
1.14      xtraeme  10195:                 <p><code class=
                   10196:                 "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37      dillo    10197:                 build options supported by the package.</p>
                   10198:               </li>
                   10199: 
                   10200:               <li>
                   10201:                 <p><code class=
                   10202:                 "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
                   10203:                 list of names of groups of mutually exclusive
                   10204:                 options. The options in each group are listed in
                   10205:                 <code class="varname">PKG_OPTIONS_GROUP.<em class=
                   10206:                 "replaceable"><code>groupname</code></em></code>.
                   10207:                 The most specific setting of any option from the
                   10208:                 group takes precedence over all other options in
                   10209:                 the group. Options from the groups will be
                   10210:                 automatically added to <code class=
                   10211:                 "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
                   10212:               </li>
                   10213: 
                   10214:               <li>
                   10215:                 <p><code class=
                   10216:                 "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
                   10217:                 like <code class=
                   10218:                 "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
                   10219:                 building the packages will fail if no option from
                   10220:                 the group is selected.</p>
1.1       grant    10221:               </li>
                   10222: 
                   10223:               <li>
1.27      rillig   10224:                 <p><code class=
1.44      gdt      10225:                 "varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a
                   10226:                 list of names of sets of options. At least one
                   10227:                 option from each set must be selected. The options
                   10228:                 in each set are listed in <code class=
                   10229:                 "varname">PKG_OPTIONS_SET.<em class=
                   10230:                 "replaceable"><code>setname</code></em></code>.
                   10231:                 Options from the sets will be automatically added
                   10232:                 to <code class=
                   10233:                 "varname">PKG_SUPPORTED_OPTIONS</code>. Building
                   10234:                 the package will fail if no option from the set is
                   10235:                 selected.</p>
                   10236:               </li>
                   10237: 
                   10238:               <li>
                   10239:                 <p><code class=
1.27      rillig   10240:                 "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
                   10241:                 build options which are enabled by default.</p>
                   10242:               </li>
                   10243: 
                   10244:               <li>
1.37      dillo    10245:                 <p><code class=
                   10246:                 "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
                   10247:                 of &#8220;<span class="quote"><em class=
1.66    ! rillig   10248:                 "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable">
        !          10249:                 <code>option</code></em></span>&#8221; pairs that
        !          10250:                 map legacy <code xmlns=
1.45      wiz      10251:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.37      dillo    10252:                 "filename">/etc/mk.conf</code> variables to their
                   10253:                 option counterparts. Pairs should be added with
                   10254:                 &#8220;<span class="quote">+=</span>&#8221; to keep
                   10255:                 the listing of global legacy variables. A warning
                   10256:                 will be issued if the user uses a legacy
                   10257:                 variable.</p>
                   10258:               </li>
1.1       grant    10259: 
1.37      dillo    10260:               <li>
                   10261:                 <p><code class=
                   10262:                 "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
                   10263:                 of &#8220;<span class="quote"><em class=
1.66    ! rillig   10264:                 "replaceable"><code>old-option</code></em>:<em class="replaceable">
        !          10265:                 <code>new-option</code></em></span>&#8221; pairs
        !          10266:                 that map options that have been renamed to their
        !          10267:                 new counterparts. Pairs should be added with
1.37      dillo    10268:                 &#8220;<span class="quote">+=</span>&#8221; to keep
                   10269:                 the listing of global legacy options. A warning
                   10270:                 will be issued if the user uses a legacy
                   10271:                 option.</p>
                   10272:               </li>
1.1       grant    10273: 
1.37      dillo    10274:               <li>
                   10275:                 <p><code class="varname">PKG_LEGACY_OPTIONS</code>
                   10276:                 is a list of options implied by deprecated
                   10277:                 variables used. This can be used for cases that
                   10278:                 neither <code class=
                   10279:                 "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
                   10280:                 <code class=
                   10281:                 "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
                   10282:                 handle, e. g. when <code class=
                   10283:                 "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1       grant    10284:               </li>
                   10285: 
                   10286:               <li>
1.37      dillo    10287:                 <p><code class=
                   10288:                 "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
                   10289:                 a list of warnings about deprecated variables or
                   10290:                 options used, and what to use instead.</p>
1.1       grant    10291:               </li>
1.28      rillig   10292:             </ol>
1.1       grant    10293:           </div>
                   10294: 
1.37      dillo    10295:           <p>A package should never modify <code class=
                   10296:           "varname">PKG_DEFAULT_OPTIONS</code> or the variable
                   10297:           named in <code class="varname">PKG_OPTIONS_VAR</code>.
                   10298:           These are strictly user-settable. To suggest a default
                   10299:           set of options, use <code class=
                   10300:           "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
                   10301: 
1.42      dillo    10302:           <p><code class="varname">PKG_OPTIONS_VAR</code> must be
1.45      wiz      10303:           defined before including <code xmlns=
                   10304:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.42      dillo    10305:           "filename">bsd.options.mk</code>. If none of <code class=
1.37      dillo    10306:           "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
                   10307:           "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
                   10308:           <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
1.47      reed     10309:           are defined (as can happen with platform-specific options
1.42      dillo    10310:           if none of them is supported on the current platform),
                   10311:           <code class="varname">PKG_OPTIONS</code> is set to the
                   10312:           empty list and the package is otherwise treated as not
                   10313:           using the options framework.</p>
1.37      dillo    10314: 
1.45      wiz      10315:           <p>After the inclusion of <code xmlns=
                   10316:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.37      dillo    10317:           "filename">bsd.options.mk</code>, the variable
1.28      rillig   10318:           <code class="varname">PKG_OPTIONS</code> contains the
1.37      dillo    10319:           list of selected build options, properly filtered to
1.28      rillig   10320:           remove unsupported and duplicate options.</p>
                   10321: 
1.1       grant    10322:           <p>The remaining sections contain the logic that is
1.37      dillo    10323:           specific to each option. The correct way to check for an
                   10324:           option is to check whether it is listed in <code class=
                   10325:           "varname">PKG_OPTIONS</code>:</p>
                   10326:           <pre class="programlisting">
1.51      rillig   10327:     .if !empty(PKG_OPTIONS:M<em class=
1.37      dillo    10328: "replaceable"><code>option</code></em>)
                   10329: </pre>
1.48      dillo    10330:         </div>
1.37      dillo    10331: 
1.66    ! rillig   10332:         <div class="sect1" lang="en" xml:lang="en">
1.48      dillo    10333:           <div class="titlepage">
                   10334:             <div>
                   10335:               <div>
                   10336:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   10337:                 "option-names" id=
1.48      dillo    10338:                 "option-names"></a>13.3.&nbsp;Option Names</h2>
                   10339:               </div>
                   10340:             </div>
                   10341:           </div>
                   10342: 
                   10343:           <p>Options that enable similar features in different
                   10344:           packages (like optional support for a library) should use
                   10345:           a common name in all packages that support it (like the
                   10346:           name of the library). If another package already has an
                   10347:           option with the same meaning, use the same name.</p>
                   10348: 
                   10349:           <p>Options that enable features specific to one package,
                   10350:           where it's unlikely that another (unrelated) package has
                   10351:           the same (or a similar) optional feature, should use a
                   10352:           name prefixed with <code class="varname"><em class=
                   10353:           "replaceable"><code>pkgname</code></em>-</code>.</p>
                   10354: 
                   10355:           <p>If a group of related packages share an optional
                   10356:           feature specific to that group, prefix it with the name
                   10357:           of the &#8220;<span class="quote">main</span>&#8221;
                   10358:           package (e. g. <code class=
                   10359:           "varname">djbware-errno-hack</code>).</p>
                   10360: 
                   10361:           <p>For new options, add a line to <code xmlns=
                   10362:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10363:           "filename">mk/defaults/options.description</code>. Lines
                   10364:           have two fields, separated by tab. The first field is the
                   10365:           option name, the second its description. The description
                   10366:           should be a whole sentence (starting with an uppercase
                   10367:           letter and ending with a period) that describes what
                   10368:           enabling the option does. E. g. &#8220;<span class=
                   10369:           "quote">Enable ispell support.</span>&#8221; The file is
                   10370:           sorted by option names.</p>
1.1       grant    10371:         </div>
                   10372:       </div>
                   10373: 
1.66    ! rillig   10374:       <div class="chapter" lang="en" xml:lang="en">
1.1       grant    10375:         <div class="titlepage">
                   10376:           <div>
                   10377:             <div>
1.66    ! rillig   10378:               <h2 class="title"><a name="build" id=
1.38      dillo    10379:               "build"></a>Chapter&nbsp;14.&nbsp;The build
1.1       grant    10380:               process</h2>
                   10381:             </div>
                   10382:           </div>
                   10383:         </div>
                   10384: 
                   10385:         <div class="toc">
                   10386:           <p><b>Table of Contents</b></p>
                   10387: 
                   10388:           <dl>
1.56      rillig   10389:             <dt><span class="sect1"><a href="#build.intro">14.1.
                   10390:             Introduction</a></span></dt>
                   10391: 
                   10392:             <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1       grant    10393:             Program location</a></span></dt>
                   10394: 
1.56      rillig   10395:             <dt><span class="sect1"><a href=
                   10396:             "#build.builddirs">14.3. Directories used during the
                   10397:             build process</a></span></dt>
                   10398: 
                   10399:             <dt><span class="sect1"><a href="#build.running">14.4.
                   10400:             Running a phase</a></span></dt>
                   10401: 
                   10402:             <dt><span class="sect1"><a href="#build.fetch">14.5.
                   10403:             The <span class="emphasis"><em>fetch</em></span>
                   10404:             phase</a></span></dt>
                   10405: 
                   10406:             <dt><span class="sect1"><a href="#build.checksum">14.6.
                   10407:             The <span class="emphasis"><em>checksum</em></span>
                   10408:             phase</a></span></dt>
                   10409: 
                   10410:             <dt><span class="sect1"><a href="#build.extract">14.7.
                   10411:             The <span class="emphasis"><em>extract</em></span>
                   10412:             phase</a></span></dt>
                   10413: 
                   10414:             <dt><span class="sect1"><a href="#build.patch">14.8.
                   10415:             The <span class="emphasis"><em>patch</em></span>
                   10416:             phase</a></span></dt>
                   10417: 
                   10418:             <dt><span class="sect1"><a href="#build.tools">14.9.
                   10419:             The <span class="emphasis"><em>tools</em></span>
                   10420:             phase</a></span></dt>
                   10421: 
                   10422:             <dt><span class="sect1"><a href="#build.wrapper">14.10.
                   10423:             The <span class="emphasis"><em>wrapper</em></span>
                   10424:             phase</a></span></dt>
1.1       grant    10425: 
                   10426:             <dt><span class="sect1"><a href=
1.56      rillig   10427:             "#build.configure">14.11. The <span class=
                   10428:             "emphasis"><em>configure</em></span>
                   10429:             phase</a></span></dt>
                   10430: 
                   10431:             <dt><span class="sect1"><a href="#build.build">14.12.
                   10432:             The <span class="emphasis"><em>build</em></span>
                   10433:             phase</a></span></dt>
                   10434: 
                   10435:             <dt><span class="sect1"><a href="#build.test">14.13.
                   10436:             The <span class="emphasis"><em>test</em></span>
                   10437:             phase</a></span></dt>
                   10438: 
                   10439:             <dt><span class="sect1"><a href="#build.install">14.14.
                   10440:             The <span class="emphasis"><em>install</em></span>
                   10441:             phase</a></span></dt>
                   10442: 
                   10443:             <dt><span class="sect1"><a href="#build.package">14.15.
                   10444:             The <span class="emphasis"><em>package</em></span>
                   10445:             phase</a></span></dt>
                   10446: 
                   10447:             <dt><span class="sect1"><a href=
                   10448:             "#build.helpful-targets">14.16. Other helpful
1.1       grant    10449:             targets</a></span></dt>
                   10450:           </dl>
                   10451:         </div>
                   10452: 
1.66    ! rillig   10453:         <div class="sect1" lang="en" xml:lang="en">
1.56      rillig   10454:           <div class="titlepage">
                   10455:             <div>
                   10456:               <div>
                   10457:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   10458:                 "build.intro" id=
1.56      rillig   10459:                 "build.intro"></a>14.1.&nbsp;Introduction</h2>
                   10460:               </div>
                   10461:             </div>
                   10462:           </div>
                   10463: 
                   10464:           <p>This chapter gives a detailed description on how a
                   10465:           package is built. Building a package is separated into
                   10466:           different <span class="emphasis"><em>phases</em></span>
                   10467:           (for example <code class="varname">fetch</code>,
                   10468:           <code class="varname">build</code>, <code class=
                   10469:           "varname">install</code>), all of which are described in
                   10470:           the following sections. Each phase is splitted into
                   10471:           so-called <span class="emphasis"><em>stages</em></span>,
1.66    ! rillig   10472:           which take the name of the containing phase, prefixed by
1.56      rillig   10473:           one of <code class="varname">pre-</code>, <code class=
                   10474:           "varname">do-</code> or <code class=
                   10475:           "varname">post-</code>. (Examples are <code class=
                   10476:           "varname">pre-configure</code>, <code class=
                   10477:           "varname">post-build</code>.) Most of the actual work is
                   10478:           done in the <code class="varname">do-*</code> stages.</p>
                   10479: 
                   10480:           <p>The basic steps for building a program are always the
                   10481:           same. First the program's source (<span class=
                   10482:           "emphasis"><em>distfile</em></span>) must be brought to
1.66    ! rillig   10483:           the local system and then extracted. After any
        !          10484:           pkgsrc-specific patches to compile properly are applied,
        !          10485:           the software can be configured, then built (usually by
        !          10486:           compiling), and finally the generated binaries, etc. can
        !          10487:           be put into place on the system.</p>
1.56      rillig   10488:         </div>
1.1       grant    10489: 
1.66    ! rillig   10490:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    10491:           <div class="titlepage">
                   10492:             <div>
                   10493:               <div>
                   10494:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   10495:                 "build.prefix" id=
1.56      rillig   10496:                 "build.prefix"></a>14.2.&nbsp;Program location</h2>
1.1       grant    10497:               </div>
                   10498:             </div>
                   10499:           </div>
                   10500: 
                   10501:           <p>Before outlining the process performed by the NetBSD
                   10502:           package system in the next section, here's a brief
                   10503:           discussion on where programs are installed, and which
                   10504:           variables influence this.</p>
                   10505: 
1.14      xtraeme  10506:           <p>The automatic variable <code class=
                   10507:           "varname">PREFIX</code> indicates where all files of the
                   10508:           final program shall be installed. It is usually set to
1.45      wiz      10509:           <code class="varname">LOCALBASE</code> (<code xmlns=
                   10510:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10511:           "filename">/usr/pkg</code>), or <code class=
                   10512:           "varname">CROSSBASE</code> for pkgs in the
1.1       grant    10513:           &#8220;<span class="quote">cross</span>&#8221; category.
1.14      xtraeme  10514:           The value of <code class="varname">PREFIX</code> needs to
                   10515:           be put into the various places in the program's source
                   10516:           where paths to these files are encoded. See <a href=
1.1       grant    10517:           "#components.patches" title=
1.38      dillo    10518:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
1.1       grant    10519:           &#8220;patches/*&#8221;</a> and <a href="#fixes.libtool"
                   10520:           title=
1.38      dillo    10521:           "15.3.1.&nbsp;Shared libraries - libtool">Section&nbsp;15.3.1,
1.1       grant    10522:           &#8220;Shared libraries - libtool&#8221;</a> for more
                   10523:           details.</p>
                   10524: 
                   10525:           <p>When choosing which of these variables to use, follow
                   10526:           the following rules:</p>
                   10527: 
                   10528:           <div class="itemizedlist">
                   10529:             <ul type="disc">
                   10530:               <li>
1.14      xtraeme  10531:                 <p><code class="varname">PREFIX</code> always
                   10532:                 points to the location where the current pkg will
                   10533:                 be installed. When referring to a pkg's own
1.1       grant    10534:                 installation path, use &#8220;<span class=
                   10535:                 "quote">${PREFIX}</span>&#8221;.</p>
                   10536:               </li>
                   10537: 
                   10538:               <li>
1.14      xtraeme  10539:                 <p><code class="varname">LOCALBASE</code> is where
                   10540:                 all non-X11 pkgs are installed. If you need to
1.1       grant    10541:                 construct a -I or -L argument to the compiler to
                   10542:                 find includes and libraries installed by another
                   10543:                 non-X11 pkg, use &#8220;<span class=
                   10544:                 "quote">${LOCALBASE}</span>&#8221;.</p>
                   10545:               </li>
                   10546: 
                   10547:               <li>
1.14      xtraeme  10548:                 <p><code class="varname">X11BASE</code> is where
                   10549:                 the actual X11 distribution (from xsrc, etc.) is
1.1       grant    10550:                 installed. When looking for <span class=
                   10551:                 "emphasis"><em>standard</em></span> X11 includes
                   10552:                 (not those installed by a pkg), use
                   10553:                 &#8220;<span class=
                   10554:                 "quote">${X11BASE}</span>&#8221;.</p>
                   10555:               </li>
                   10556: 
                   10557:               <li>
1.47      reed     10558:                 <p>X11-based packages are special in that they may
                   10559:                 be installed in either <code class=
1.14      xtraeme  10560:                 "varname">X11BASE</code> or <code class=
                   10561:                 "varname">LOCALBASE</code>.</p>
1.1       grant    10562: 
                   10563:                 <p>Usually, X11 packages should be installed under
1.14      xtraeme  10564:                 <code class="varname">LOCALBASE</code> whenever
1.34      wiz      10565:                 possible. Note that you will need to include
1.45      wiz      10566:                 <code xmlns=
                   10567:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.34      wiz      10568:                 "filename">../../mk/x11.buildlink3.mk</code> in
                   10569:                 them to request the presence of X11 and to get the
                   10570:                 right compilation flags.</p>
1.1       grant    10571: 
                   10572:                 <p>Even though, there are some packages that cannot
1.14      xtraeme  10573:                 be installed under <code class=
                   10574:                 "varname">LOCALBASE</code>: those that come with
1.1       grant    10575:                 app-defaults files. These packages are special and
1.14      xtraeme  10576:                 they must be placed under <code class=
                   10577:                 "varname">X11BASE</code>. To accomplish this, set
                   10578:                 either <code class="varname">USE_X11BASE</code> or
                   10579:                 <code class="varname">USE_IMAKE</code> in your
1.1       grant    10580:                 package.</p>
                   10581: 
1.34      wiz      10582:                 <p>Some notes: If you need to find includes or
1.14      xtraeme  10583:                 libraries installed by a pkg that has <code class=
                   10584:                 "varname">USE_IMAKE</code> or <code class=
                   10585:                 "varname">USE_X11BASE</code> in its pkg
1.45      wiz      10586:                 <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10587:                 class="filename">Makefile</code>, you need to look
                   10588:                 in <span class="emphasis"><em>both</em></span>
                   10589:                 <code xmlns=
                   10590:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10591:                 "filename">${X11BASE}</code> and <code xmlns=
                   10592:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10593:                 "filename">${LOCALBASE}</code>. To force
                   10594:                 installation of all X11 packages in <code class=
                   10595:                 "varname">LOCALBASE</code>, the <a xmlns=
                   10596:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    10597:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45      wiz      10598:                 target="_top"><code xmlns="" class=
                   10599:                 "filename">pkgtools/xpkgwedge</code></a> package is
1.34      wiz      10600:                 enabled by default.</p>
1.1       grant    10601:               </li>
                   10602: 
                   10603:               <li>
1.14      xtraeme  10604:                 <p><code class="varname">X11PREFIX</code> should be
1.1       grant    10605:                 used to refer to the installed location of an X11
1.14      xtraeme  10606:                 package. <code class="varname">X11PREFIX</code>
                   10607:                 will be set to <code class="varname">X11BASE</code>
                   10608:                 if xpkgwedge is not installed, and to <code class=
                   10609:                 "varname">LOCALBASE</code> if xpkgwedge is
1.1       grant    10610:                 installed.</p>
                   10611:               </li>
                   10612: 
                   10613:               <li>
                   10614:                 <p>If xpkgwedge is installed, it is possible to
1.14      xtraeme  10615:                 have some packages installed in <code class=
                   10616:                 "varname">X11BASE</code> and some in <code class=
                   10617:                 "varname">LOCALBASE</code>. To determine the prefix
                   10618:                 of an installed package, the <code class=
                   10619:                 "varname">EVAL_PREFIX</code> definition can be
                   10620:                 used. It takes pairs in the format
                   10621:                 &#8220;<span class=
1.1       grant    10622:                 "quote">DIRNAME=&lt;package&gt;</span>&#8221;, and
1.24      wiz      10623:                 the <a href=
                   10624:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   10625:                 <span class="citerefentry"><span class=
                   10626:                 "refentrytitle">make</span>(1)</span></a> variable
                   10627:                 <code class="varname">DIRNAME</code> will be set to
                   10628:                 the prefix of the installed package
                   10629:                 &lt;package&gt;, or &#8220;<span class=
1.1       grant    10630:                 "quote">${X11PREFIX}</span>&#8221; if the package
                   10631:                 is not installed.</p>
                   10632: 
                   10633:                 <p>This is best illustrated by example.</p>
                   10634: 
1.45      wiz      10635:                 <p>The following lines are taken from <code xmlns=
                   10636:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10637:                 "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1       grant    10638:                 <pre class="programlisting">
1.51      rillig   10639:     EVAL_PREFIX+=           GTKDIR=gtk+
                   10640:     CONFIGURE_ARGS+=        --with-guile-prefix=${LOCALBASE}        \
                   10641:                             --with-gtk-prefix="${GTKDIR}"           \
                   10642:                             --enable-multibyte
1.1       grant    10643: </pre>
                   10644: 
                   10645:                 <p>Specific defaults can be defined for the
1.14      xtraeme  10646:                 packages evaluated using <code class=
                   10647:                 "varname">EVAL_PREFIX</code>, by using a definition
1.1       grant    10648:                 of the form:</p>
                   10649:                 <pre class="programlisting">
1.51      rillig   10650:     GTKDIR_DEFAULT= ${LOCALBASE}
1.1       grant    10651: </pre>
                   10652: 
1.14      xtraeme  10653:                 <p>where <code class="varname">GTKDIR</code>
1.1       grant    10654:                 corresponds to the first definition in the
1.14      xtraeme  10655:                 <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1       grant    10656:               </li>
                   10657: 
                   10658:               <li>
1.45      wiz      10659:                 <p>Within <code xmlns=
                   10660:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10661:                 "filename">${PREFIX}</code>, packages should
                   10662:                 install files according to <a href=
1.24      wiz      10663:                 "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
                   10664:                 <span class="citerefentry"><span class=
                   10665:                 "refentrytitle">hier</span>(7)</span></a>, with the
1.45      wiz      10666:                 exception that manual pages go into <code xmlns=
                   10667:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10668:                 "filename">${PREFIX}/man</code>, not <code xmlns=
                   10669:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10670:                 "filename">${PREFIX}/share/man</code>.</p>
1.1       grant    10671:               </li>
                   10672:             </ul>
                   10673:           </div>
                   10674:         </div>
                   10675: 
1.66    ! rillig   10676:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    10677:           <div class="titlepage">
                   10678:             <div>
                   10679:               <div>
                   10680:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   10681:                 "build.builddirs" id=
1.56      rillig   10682:                 "build.builddirs"></a>14.3.&nbsp;Directories used
                   10683:                 during the build process</h2>
1.1       grant    10684:               </div>
                   10685:             </div>
                   10686:           </div>
                   10687: 
1.56      rillig   10688:           <p>When building a package, a number of directories is
                   10689:           used to store source files, temporary files,
                   10690:           pkgsrc-internal files, and so on. These directories are
                   10691:           explained here.</p>
                   10692: 
                   10693:           <p>Some of the directory variables contain relative
                   10694:           pathnames. There are two common base directories for
                   10695:           these relative directories: <code class=
                   10696:           "varname">PKGSRCDIR/PKGPATH</code> is used for
                   10697:           directories that are pkgsrc-specific. <code class=
                   10698:           "varname">WRKSRC</code> is used for directories inside
1.66    ! rillig   10699:           the package itself.</p>
1.1       grant    10700: 
                   10701:           <div class="variablelist">
                   10702:             <dl>
1.56      rillig   10703:               <dt><span class="term"><code class=
1.66    ! rillig   10704:               "varname">PKGSRCDIR</code></span></dt>
1.56      rillig   10705: 
                   10706:               <dd>
                   10707:                 <p>This is an absolute pathname that points to the
                   10708:                 pkgsrc root directory. Generally, you don't need
                   10709:                 it.</p>
                   10710:               </dd>
                   10711: 
                   10712:               <dt><span class="term"><code class=
1.66    ! rillig   10713:               "varname">PKGPATH</code></span></dt>
1.1       grant    10714: 
                   10715:               <dd>
1.56      rillig   10716:                 <p>This is a pathname relative to <code class=
                   10717:                 "varname">PKGSRCDIR</code> that points to the
                   10718:                 current package.</p>
                   10719:               </dd>
                   10720: 
                   10721:               <dt><span class="term"><code class=
1.66    ! rillig   10722:               "varname">WRKDIR</code></span></dt>
1.56      rillig   10723: 
                   10724:               <dd>
                   10725:                 <p>This is an absolute pathname pointing to the
1.57      minskim  10726:                 directory where all work takes place. The distfiles
                   10727:                 are extraced to this directory. It also contains
                   10728:                 temporary directories and log files used by the
                   10729:                 various pkgsrc frameworks, like <span class=
                   10730:                 "emphasis"><em>buildlink</em></span> or the
                   10731:                 <span class=
1.56      rillig   10732:                 "emphasis"><em>wrappers</em></span>.</p>
                   10733:               </dd>
                   10734: 
                   10735:               <dt><span class="term"><code class=
1.66    ! rillig   10736:               "varname">WRKSRC</code></span></dt>
1.56      rillig   10737: 
                   10738:               <dd>
                   10739:                 <p>This is an absolute pathname pointing to the
                   10740:                 directory where the distfiles are extracted. It is
                   10741:                 usually a direct subdirectory of <code class=
                   10742:                 "varname">WRKDIR</code>, and often it's the only
1.66    ! rillig   10743:                 directory entry that isn't hidden. This variable
        !          10744:                 may be changed by a package <code xmlns=
        !          10745:                 "http://www.w3.org/TR/xhtml1/transitional" class=
        !          10746:                 "filename">Makefile</code>.</p>
1.56      rillig   10747:               </dd>
                   10748:             </dl>
                   10749:           </div>
                   10750:         </div>
                   10751: 
1.66    ! rillig   10752:         <div class="sect1" lang="en" xml:lang="en">
1.56      rillig   10753:           <div class="titlepage">
                   10754:             <div>
                   10755:               <div>
                   10756:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   10757:                 "build.running" id=
1.56      rillig   10758:                 "build.running"></a>14.4.&nbsp;Running a phase</h2>
                   10759:               </div>
                   10760:             </div>
                   10761:           </div>
                   10762: 
                   10763:           <p>You can run a particular phase by typing
                   10764:           <span><strong class="command">make phase</strong></span>,
                   10765:           where <span class="emphasis"><em>phase</em></span> is the
                   10766:           name of the phase. This will automatically run all phases
                   10767:           that are required for this phase. The default phase is
                   10768:           <code class="varname">build</code>, that is, when you run
                   10769:           <span><strong class="command">make</strong></span>
                   10770:           without parameters in a package directory, the package
                   10771:           will be built, but not installed.</p>
                   10772:         </div>
                   10773: 
1.66    ! rillig   10774:         <div class="sect1" lang="en" xml:lang="en">
1.56      rillig   10775:           <div class="titlepage">
                   10776:             <div>
                   10777:               <div>
                   10778:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   10779:                 "build.fetch" id="build.fetch"></a>14.5.&nbsp;The
        !          10780:                 <span class="emphasis"><em>fetch</em></span>
        !          10781:                 phase</h2>
1.56      rillig   10782:               </div>
                   10783:             </div>
                   10784:           </div>
                   10785: 
                   10786:           <p>This will check if the file(s) given in the variables
                   10787:           <code class="varname">DISTFILES</code> and <code class=
                   10788:           "varname">PATCHFILES</code> (as defined in the package's
                   10789:           Makefile) are present on the local system in <code xmlns=
                   10790:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10791:           "filename">/usr/pkgsrc/distfiles</code>. If they are not
                   10792:           present, an attempt will be made to fetch them using
                   10793:           commands of the form:</p>
                   10794:           <pre class="programlisting">
1.51      rillig   10795:     ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
1.1       grant    10796: </pre>
                   10797: 
1.56      rillig   10798:           <p>where ${site} varies through several possibilities in
                   10799:           turn: first, <code class=
                   10800:           "varname">MASTER_SITE_OVERRIDE</code> is tried, then the
                   10801:           sites specified in either <code class=
                   10802:           "varname">SITES_file</code> if defined, else <code class=
                   10803:           "varname">MASTER_SITES</code> or <code class=
                   10804:           "varname">PATCH_SITES</code>, as applies, then finally
                   10805:           the value of <code class=
                   10806:           "varname">MASTER_SITE_BACKUP</code>. The order of all
                   10807:           except the first can be optionally sorted by the user,
                   10808:           via setting either <code class=
                   10809:           "varname">MASTER_SORT_AWK</code> or <code class=
                   10810:           "varname">MASTER_SORT_REGEX</code>.</p>
                   10811:         </div>
                   10812: 
1.66    ! rillig   10813:         <div class="sect1" lang="en" xml:lang="en">
1.56      rillig   10814:           <div class="titlepage">
                   10815:             <div>
                   10816:               <div>
                   10817:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   10818:                 "build.checksum" id=
1.56      rillig   10819:                 "build.checksum"></a>14.6.&nbsp;The <span class=
                   10820:                 "emphasis"><em>checksum</em></span> phase</h2>
                   10821:               </div>
                   10822:             </div>
                   10823:           </div>
                   10824: 
                   10825:           <p>After the distfile(s) are fetched, their checksum is
                   10826:           generated and compared with the checksums stored in the
                   10827:           distinfo file. If the checksums don't match, the build is
                   10828:           aborted. This is to ensure the same distfile is used for
                   10829:           building, and that the distfile wasn't changed, e.g. by
                   10830:           some malign force, deliberately changed distfiles on the
                   10831:           master distribution site or network lossage.</p>
                   10832:         </div>
                   10833: 
1.66    ! rillig   10834:         <div class="sect1" lang="en" xml:lang="en">
1.56      rillig   10835:           <div class="titlepage">
                   10836:             <div>
                   10837:               <div>
                   10838:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   10839:                 "build.extract" id=
1.56      rillig   10840:                 "build.extract"></a>14.7.&nbsp;The <span class=
                   10841:                 "emphasis"><em>extract</em></span> phase</h2>
                   10842:               </div>
                   10843:             </div>
                   10844:           </div>
                   10845: 
                   10846:           <p>When the distfiles are present on the local system,
                   10847:           they need to be extracted, as they are usually in the
                   10848:           form of some compressed archive format, most commonly
                   10849:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10850:           class="filename">.tar.gz</code>.</p>
1.1       grant    10851: 
1.56      rillig   10852:           <p>If only some of the distfiles need to be uncompressed,
                   10853:           the files to be uncompressed should be put into
                   10854:           <code class="varname">EXTRACT_ONLY</code>.</p>
1.1       grant    10855: 
1.56      rillig   10856:           <p>If the distfiles are not in <code xmlns=
                   10857:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10858:           "filename">.tar.gz</code> format, they can be extracted
                   10859:           by setting either <code class=
                   10860:           "varname">EXTRACT_SUFX</code>, or <code class=
                   10861:           "varname">EXTRACT_CMD</code>, <code class=
                   10862:           "varname">EXTRACT_BEFORE_ARGS</code> and <code class=
                   10863:           "varname">EXTRACT_AFTER_ARGS</code>. In the former case,
                   10864:           pkgsrc knows how to extract a number of suffixes
                   10865:           (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10866:           class="filename">.tar.gz</code>, <code xmlns=
                   10867:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10868:           "filename">.tgz</code>, <code xmlns=
                   10869:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10870:           "filename">.tar.gz2</code>, <code xmlns=
                   10871:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10872:           "filename">.tbz</code>, <code xmlns=
                   10873:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10874:           "filename">.tar.Z</code>, <code xmlns=
                   10875:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10876:           "filename">.tar</code>, <code xmlns=
                   10877:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10878:           "filename">.shar.gz</code>, <code xmlns=
                   10879:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10880:           "filename">.shar.bz2</code>, <code xmlns=
                   10881:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10882:           "filename">.shar.Z</code>, <code xmlns=
                   10883:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10884:           "filename">.shar</code>, <code xmlns=
                   10885:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10886:           "filename">.Z</code>, <code xmlns=
                   10887:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10888:           "filename">.bz2</code> and <code xmlns=
                   10889:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10890:           "filename">.gz</code>; see the definition of the various
                   10891:           <code class="varname">DECOMPRESS_CMD</code> variables in
                   10892:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10893:           class="filename">bsd.pkg.extract.mk</code> for a complete
                   10894:           list). Here's an example on how to use the other
                   10895:           variables for a program that comes with a compressed
                   10896:           shell archive whose name ends in <code xmlns=
                   10897:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10898:           "filename">.msg.gz</code>:</p>
                   10899:           <pre class="programlisting">
1.51      rillig   10900:     EXTRACT_SUFX=           .msg.gz
                   10901:     EXTRACT_CMD=            zcat
                   10902:     EXTRACT_BEFORE_ARGS=
                   10903:     EXTRACT_AFTER_ARGS=     |sh
1.1       grant    10904: </pre>
1.56      rillig   10905:         </div>
                   10906: 
1.66    ! rillig   10907:         <div class="sect1" lang="en" xml:lang="en">
1.56      rillig   10908:           <div class="titlepage">
                   10909:             <div>
                   10910:               <div>
                   10911:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   10912:                 "build.patch" id="build.patch"></a>14.8.&nbsp;The
        !          10913:                 <span class="emphasis"><em>patch</em></span>
        !          10914:                 phase</h2>
1.56      rillig   10915:               </div>
                   10916:             </div>
                   10917:           </div>
                   10918: 
                   10919:           <p>After extraction, all the patches named by the
                   10920:           <code class="varname">PATCHFILES</code>, those present in
                   10921:           the patches subdirectory of the package as well as in
                   10922:           $LOCALPATCHES/$PKGPATH (e.g. <code xmlns=
                   10923:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10924:           "filename">/usr/local/patches/graphics/png</code>) are
                   10925:           applied. Patchfiles ending in <code xmlns=
                   10926:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10927:           "filename">.Z</code> or <code xmlns=
                   10928:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10929:           "filename">.gz</code> are uncompressed before they are
                   10930:           applied, files ending in <code xmlns=
                   10931:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10932:           "filename">.orig</code> or <code xmlns=
                   10933:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10934:           "filename">.rej</code> are ignored. Any special options
                   10935:           to <a href=
                   10936:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   10937:           <span class="citerefentry"><span class=
                   10938:           "refentrytitle">patch</span>(1)</span></a> can be handed
                   10939:           in <code class="varname">PATCH_DIST_ARGS</code>. See
                   10940:           <a href="#components.patches" title=
                   10941:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
                   10942:           &#8220;patches/*&#8221;</a> for more details.</p>
                   10943: 
                   10944:           <p>By default <a href=
                   10945:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   10946:           <span class="citerefentry"><span class=
                   10947:           "refentrytitle">patch</span>(1)</span></a> is given
                   10948:           special args to make it fail if the patches apply with
                   10949:           some lines of fuzz. Please fix (regen) the patches so
                   10950:           that they apply cleanly. The rationale behind this is
                   10951:           that patches that don't apply cleanly may end up being
                   10952:           applied in the wrong place, and cause severe harm
                   10953:           there.</p>
                   10954:         </div>
                   10955: 
1.66    ! rillig   10956:         <div class="sect1" lang="en" xml:lang="en">
1.56      rillig   10957:           <div class="titlepage">
                   10958:             <div>
                   10959:               <div>
                   10960:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   10961:                 "build.tools" id="build.tools"></a>14.9.&nbsp;The
        !          10962:                 <span class="emphasis"><em>tools</em></span>
        !          10963:                 phase</h2>
1.56      rillig   10964:               </div>
                   10965:             </div>
                   10966:           </div>
                   10967: 
                   10968:           <p>[TODO]</p>
                   10969:         </div>
                   10970: 
1.66    ! rillig   10971:         <div class="sect1" lang="en" xml:lang="en">
1.56      rillig   10972:           <div class="titlepage">
                   10973:             <div>
                   10974:               <div>
                   10975:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   10976:                 "build.wrapper" id=
1.56      rillig   10977:                 "build.wrapper"></a>14.10.&nbsp;The <span class=
                   10978:                 "emphasis"><em>wrapper</em></span> phase</h2>
                   10979:               </div>
                   10980:             </div>
                   10981:           </div>
                   10982: 
                   10983:           <p>[TODO]</p>
                   10984:         </div>
                   10985: 
1.66    ! rillig   10986:         <div class="sect1" lang="en" xml:lang="en">
1.56      rillig   10987:           <div class="titlepage">
                   10988:             <div>
                   10989:               <div>
                   10990:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   10991:                 "build.configure" id=
1.56      rillig   10992:                 "build.configure"></a>14.11.&nbsp;The <span class=
                   10993:                 "emphasis"><em>configure</em></span> phase</h2>
                   10994:               </div>
                   10995:             </div>
                   10996:           </div>
                   10997: 
                   10998:           <p>Most pieces of software need information on the header
                   10999:           files, system calls, and library routines which are
                   11000:           available on the platform they run on. The process of
                   11001:           determining this information is known as configuration,
                   11002:           and is usually automated. In most cases, a script is
                   11003:           supplied with the distfiles, and its invocation results
                   11004:           in generation of header files, Makefiles, etc.</p>
                   11005: 
                   11006:           <p>If the package contains a configure script, this can
                   11007:           be invoked by setting <code class=
                   11008:           "varname">HAS_CONFIGURE</code> to &#8220;<span class=
                   11009:           "quote">yes</span>&#8221;. If the configure script is a
                   11010:           GNU autoconf script, you should set <code class=
                   11011:           "varname">GNU_CONFIGURE</code> to &#8220;<span class=
                   11012:           "quote">yes</span>&#8221; instead. What happens in the
                   11013:           <span class="emphasis"><em>configure</em></span> phase is
                   11014:           roughly:</p>
                   11015:           <pre class="programlisting">
                   11016:     .for d in ${CONFIGURE_DIRS}
                   11017:             cd ${WRKSRC} &amp;&amp; cd ${d} &amp;&amp; env ${CONFIGURE_ENV} \
                   11018:                 ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
                   11019:     .endfor
                   11020: </pre>
1.1       grant    11021: 
1.56      rillig   11022:           <p><code class="varname">CONFIGURE_DIRS</code> (default:
                   11023:           &#8220;<span class="quote">.</span>&#8221;) is a list of
                   11024:           pathnames relative to <code class=
                   11025:           "varname">WRKSRC</code>. In each of these directories,
                   11026:           the configure script is run with the environment
                   11027:           <code class="varname">CONFIGURE_ENV</code> and arguments
                   11028:           <code class="varname">CONFIGURE_ARGS</code>. The
                   11029:           variables <code class="varname">CONFIGURE_ENV</code>,
                   11030:           <code class="varname">CONFIGURE_SCRIPT</code> (default:
                   11031:           &#8220;<span class="quote">./configure</span>&#8221;) and
                   11032:           <code class="varname">CONFIGURE_ARGS</code> may all be
                   11033:           changed by the package.</p>
1.1       grant    11034: 
1.56      rillig   11035:           <p>If the program uses an <code xmlns=
                   11036:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   11037:           "filename">Imakefile</code> for configuration, the
                   11038:           appropriate steps can be invoked by setting <code class=
                   11039:           "varname">USE_IMAKE</code> to &#8220;<span class=
                   11040:           "quote">yes</span>&#8221;. (If you only want the package
                   11041:           installed in <code class="varname">${X11PREFIX}</code>
                   11042:           but xmkmf not being run, set <code class=
                   11043:           "varname">USE_X11BASE</code> instead.)</p>
                   11044:         </div>
1.1       grant    11045: 
1.66    ! rillig   11046:         <div class="sect1" lang="en" xml:lang="en">
1.56      rillig   11047:           <div class="titlepage">
                   11048:             <div>
                   11049:               <div>
                   11050:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   11051:                 "build.build" id="build.build"></a>14.12.&nbsp;The
        !          11052:                 <span class="emphasis"><em>build</em></span>
        !          11053:                 phase</h2>
1.56      rillig   11054:               </div>
                   11055:             </div>
1.1       grant    11056:           </div>
                   11057: 
1.56      rillig   11058:           <p>For building a package, a rough equivalent of the
                   11059:           following code is executed.</p>
1.1       grant    11060:           <pre class="programlisting">
1.56      rillig   11061:     .for d in ${BUILD_DIRS}
                   11062:             cd ${WRKSRC} &amp;&amp; cd ${d} &amp;&amp; env ${MAKE_ENV} \
                   11063:                 ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} \
                   11064:                     -f ${MAKEFILE} ${BUILD_TARGET}
                   11065:     .endfor
1.1       grant    11066: </pre>
1.56      rillig   11067: 
                   11068:           <p><code class="varname">BUILD_DIRS</code> (default:
                   11069:           &#8220;<span class="quote">.</span>&#8221;) is a list of
                   11070:           pathnames relative to <code class=
                   11071:           "varname">WRKSRC</code>. In each of these directories,
                   11072:           <code class="varname">MAKE_PROGRAM</code> is run with the
                   11073:           environment <code class="varname">MAKE_ENV</code> and
                   11074:           arguments <code class="varname">BUILD_MAKE_FLAGS</code>.
                   11075:           The variables <code class="varname">MAKE_ENV</code>,
                   11076:           <code class="varname">BUILD_MAKE_FLAGS</code>,
                   11077:           <code class="varname">MAKEFILE</code> and <code class=
                   11078:           "varname">BUILD_TARGET</code> may all be changed by the
                   11079:           package.</p>
                   11080: 
                   11081:           <p>The default value of <code class=
                   11082:           "varname">MAKE_PROGRAM</code> is &#8220;<span class=
                   11083:           "quote">gmake</span>&#8221; if <code class=
                   11084:           "varname">USE_TOOLS</code> contains &#8220;<span class=
                   11085:           "quote">gmake</span>&#8221;, &#8220;<span class=
                   11086:           "quote">make</span>&#8221; otherwise. The default value
                   11087:           of <code class="varname">MAKEFILE</code> is
                   11088:           &#8220;<span class="quote">Makefile</span>&#8221;, and
                   11089:           <code class="varname">BUILD_TARGET</code> defaults to
                   11090:           &#8220;<span class="quote">all</span>&#8221;.</p>
                   11091:         </div>
                   11092: 
1.66    ! rillig   11093:         <div class="sect1" lang="en" xml:lang="en">
1.56      rillig   11094:           <div class="titlepage">
                   11095:             <div>
                   11096:               <div>
                   11097:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   11098:                 "build.test" id="build.test"></a>14.13.&nbsp;The
        !          11099:                 <span class="emphasis"><em>test</em></span>
        !          11100:                 phase</h2>
1.56      rillig   11101:               </div>
                   11102:             </div>
                   11103:           </div>
                   11104: 
                   11105:           <p>[TODO]</p>
                   11106:         </div>
                   11107: 
1.66    ! rillig   11108:         <div class="sect1" lang="en" xml:lang="en">
1.56      rillig   11109:           <div class="titlepage">
                   11110:             <div>
                   11111:               <div>
                   11112:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   11113:                 "build.install" id=
1.56      rillig   11114:                 "build.install"></a>14.14.&nbsp;The <span class=
                   11115:                 "emphasis"><em>install</em></span> phase</h2>
                   11116:               </div>
                   11117:             </div>
                   11118:           </div>
                   11119: 
                   11120:           <p>Once the build stage has completed, the final step is
                   11121:           to install the software in public directories, so users
                   11122:           can access the programs and files. As in the
1.66    ! rillig   11123:           build-target, <code class="varname">MAKE_PROGRAM</code>
        !          11124:           is invoked on <code class="varname">MAKEFILE</code> here,
        !          11125:           but with the <code class="varname">INSTALL_TARGET</code>
        !          11126:           instead, the latter defaulting to &#8220;<span class=
1.56      rillig   11127:           "quote">install</span>&#8221; (plus &#8220;<span class=
                   11128:           "quote">install.man</span>&#8221;, if <code class=
                   11129:           "varname">USE_IMAKE</code> is set).</p>
1.66    ! rillig   11130: 
        !          11131:           <p>In the <span class="emphasis"><em>install</em></span>
        !          11132:           phase, the following variables are useful. They are all
        !          11133:           variations of the <a href=
        !          11134:           "http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
        !          11135:           <span class="citerefentry"><span class=
        !          11136:           "refentrytitle">install</span>(1)</span></a> command that
        !          11137:           have the owner, group and permissions preset.
        !          11138:           <code class="varname">INSTALL</code> is the plain install
        !          11139:           command. The specialized variants, together with their
        !          11140:           intended use, are:</p>
        !          11141: 
        !          11142:           <div class="variablelist">
        !          11143:             <dl>
        !          11144:               <dt><span class="term"><code class=
        !          11145:               "varname">INSTALL_PROGRAM_DIR</code></span></dt>
        !          11146: 
        !          11147:               <dd>
        !          11148:                 <p>directories that contain binaries</p>
        !          11149:               </dd>
        !          11150: 
        !          11151:               <dt><span class="term"><code class=
        !          11152:               "varname">INSTALL_SCRIPT_DIR</code></span></dt>
        !          11153: 
        !          11154:               <dd>
        !          11155:                 <p>directories that contain scripts</p>
        !          11156:               </dd>
        !          11157: 
        !          11158:               <dt><span class="term"><code class=
        !          11159:               "varname">INSTALL_LIB_DIR</code></span></dt>
        !          11160: 
        !          11161:               <dd>
        !          11162:                 <p>directories that contain shared and static
        !          11163:                 libraries</p>
        !          11164:               </dd>
        !          11165: 
        !          11166:               <dt><span class="term"><code class=
        !          11167:               "varname">INSTALL_DATA_DIR</code></span></dt>
        !          11168: 
        !          11169:               <dd>
        !          11170:                 <p>directories that contain data files</p>
        !          11171:               </dd>
        !          11172: 
        !          11173:               <dt><span class="term"><code class=
        !          11174:               "varname">INSTALL_MAN_DIR</code></span></dt>
        !          11175: 
        !          11176:               <dd>
        !          11177:                 <p>directories that contain man pages</p>
        !          11178:               </dd>
        !          11179: 
        !          11180:               <dt><span class="term"><code class=
        !          11181:               "varname">INSTALL_PROGRAM</code></span></dt>
        !          11182: 
        !          11183:               <dd>
        !          11184:                 <p>binaries that can be stripped from debugging
        !          11185:                 symbols</p>
        !          11186:               </dd>
        !          11187: 
        !          11188:               <dt><span class="term"><code class=
        !          11189:               "varname">INSTALL_SCRIPT</code></span></dt>
        !          11190: 
        !          11191:               <dd>
        !          11192:                 <p>binaries that cannot be unstripped</p>
        !          11193:               </dd>
        !          11194: 
        !          11195:               <dt><span class="term"><code class=
        !          11196:               "varname">INSTALL_GAME</code></span></dt>
        !          11197: 
        !          11198:               <dd>
        !          11199:                 <p>game binaries</p>
        !          11200:               </dd>
        !          11201: 
        !          11202:               <dt><span class="term"><code class=
        !          11203:               "varname">INSTALL_LIB</code></span></dt>
        !          11204: 
        !          11205:               <dd>
        !          11206:                 <p>shared and static libraries</p>
        !          11207:               </dd>
        !          11208: 
        !          11209:               <dt><span class="term"><code class=
        !          11210:               "varname">INSTALL_DATA</code></span></dt>
        !          11211: 
        !          11212:               <dd>
        !          11213:                 <p>data files</p>
        !          11214:               </dd>
        !          11215: 
        !          11216:               <dt><span class="term"><code class=
        !          11217:               "varname">INSTALL_GAME_DATA</code></span></dt>
        !          11218: 
        !          11219:               <dd>
        !          11220:                 <p>data files for games</p>
        !          11221:               </dd>
        !          11222: 
        !          11223:               <dt><span class="term"><code class=
        !          11224:               "varname">INSTALL_MAN</code></span></dt>
        !          11225: 
        !          11226:               <dd>
        !          11227:                 <p>man pages</p>
        !          11228:               </dd>
        !          11229:             </dl>
        !          11230:           </div>
1.56      rillig   11231:         </div>
                   11232: 
1.66    ! rillig   11233:         <div class="sect1" lang="en" xml:lang="en">
1.56      rillig   11234:           <div class="titlepage">
                   11235:             <div>
                   11236:               <div>
                   11237:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   11238:                 "build.package" id=
1.56      rillig   11239:                 "build.package"></a>14.15.&nbsp;The <span class=
                   11240:                 "emphasis"><em>package</em></span> phase</h2>
                   11241:               </div>
                   11242:             </div>
                   11243:           </div>
                   11244: 
                   11245:           <p>[TODO]</p>
1.1       grant    11246:         </div>
                   11247: 
1.66    ! rillig   11248:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    11249:           <div class="titlepage">
                   11250:             <div>
                   11251:               <div>
                   11252:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   11253:                 "build.helpful-targets" id=
1.56      rillig   11254:                 "build.helpful-targets"></a>14.16.&nbsp;Other
1.1       grant    11255:                 helpful targets</h2>
                   11256:               </div>
                   11257:             </div>
                   11258:           </div>
                   11259: 
                   11260:           <div class="variablelist">
                   11261:             <dl>
                   11262:               <dt><span class="term">pre/post-*</span></dt>
                   11263: 
                   11264:               <dd>
                   11265:                 <p>For any of the main targets described in the
                   11266:                 previous section, two auxiliary targets exist with
                   11267:                 &#8220;<span class="quote">pre-</span>&#8221; and
                   11268:                 &#8220;<span class="quote">post-</span>&#8221; used
                   11269:                 as a prefix for the main target's name. These
                   11270:                 targets are invoked before and after the main
                   11271:                 target is called, allowing extra configuration or
                   11272:                 installation steps be performed from a package's
                   11273:                 Makefile, for example, which a program's configure
                   11274:                 script or install target omitted.</p>
                   11275:               </dd>
                   11276: 
                   11277:               <dt><span class="term">do-*</span></dt>
                   11278: 
                   11279:               <dd>
                   11280:                 <p>Should one of the main targets do the wrong
                   11281:                 thing, and should there be no variable to fix this,
                   11282:                 you can redefine it with the do-* target. (Note
                   11283:                 that redefining the target itself instead of the
                   11284:                 do-* target is a bad idea, as the pre-* and post-*
                   11285:                 targets won't be called anymore, etc.) You will not
                   11286:                 usually need to do this.</p>
                   11287:               </dd>
                   11288: 
                   11289:               <dt><span class="term">reinstall</span></dt>
                   11290: 
                   11291:               <dd>
1.14      xtraeme  11292:                 <p>If you did a <span><strong class="command">make
                   11293:                 install</strong></span> and you noticed some file
                   11294:                 was not installed properly, you can repeat the
1.1       grant    11295:                 installation with this target, which will ignore
                   11296:                 the &#8220;<span class="quote">already
                   11297:                 installed</span>&#8221; flag.</p>
                   11298:               </dd>
                   11299: 
                   11300:               <dt><span class="term">deinstall</span></dt>
                   11301: 
                   11302:               <dd>
1.24      wiz      11303:                 <p>This target does a <a href=
                   11304:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   11305:                 <span class="citerefentry"><span class=
                   11306:                 "refentrytitle">pkg_delete</span>(1)</span></a> in
                   11307:                 the current directory, effectively de-installing
                   11308:                 the package. The following variables can be used to
                   11309:                 tune the behaviour:</p>
1.1       grant    11310: 
                   11311:                 <div class="variablelist">
                   11312:                   <dl>
1.14      xtraeme  11313:                     <dt><span class="term"><code class=
                   11314:                     "varname">PKG_VERBOSE</code></span></dt>
1.1       grant    11315: 
                   11316:                     <dd>
                   11317:                       <p>Add a "-v" to the <a href=
                   11318:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   11319:                       <span class="citerefentry"><span class=
                   11320:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   11321:                       command.</p>
                   11322:                     </dd>
                   11323: 
1.14      xtraeme  11324:                     <dt><span class="term"><code class=
                   11325:                     "varname">DEINSTALLDEPENDS</code></span></dt>
1.1       grant    11326: 
                   11327:                     <dd>
                   11328:                       <p>Remove all packages that require (depend
                   11329:                       on) the given package. This can be used to
                   11330:                       remove any packages that may have been pulled
                   11331:                       in by a given package, e.g. if
1.14      xtraeme  11332:                       <span><strong class="command">make deinstall
                   11333:                       DEINSTALLDEPENDS=1</strong></span> is done in
1.45      wiz      11334:                       <code xmlns=
                   11335:                       "http://www.w3.org/TR/xhtml1/transitional"
                   11336:                       class="filename">pkgsrc/x11/kde</code>, this
                   11337:                       is likely to remove whole KDE. Works by
1.1       grant    11338:                       adding &#8220;<span class=
                   11339:                       "quote">-R</span>&#8221; to the <a href=
                   11340:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   11341:                       <span class="citerefentry"><span class=
                   11342:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   11343:                       command line.</p>
                   11344:                     </dd>
                   11345:                   </dl>
                   11346:                 </div>
                   11347:               </dd>
                   11348: 
                   11349:               <dt><span class="term">update</span></dt>
                   11350: 
                   11351:               <dd>
                   11352:                 <p>This target causes the current package to be
                   11353:                 updated to the latest version. The package and all
                   11354:                 depending packages first get de-installed, then
                   11355:                 current versions of the corresponding packages get
                   11356:                 compiled and installed. This is similar to manually
                   11357:                 noting which packages are currently installed, then
1.14      xtraeme  11358:                 performing a series of <span><strong class=
                   11359:                 "command">make deinstall</strong></span> and
                   11360:                 <span><strong class="command">make
                   11361:                 install</strong></span> (or whatever <code class=
                   11362:                 "varname">UPDATE_TARGET</code> is set to) for these
                   11363:                 packages.</p>
1.1       grant    11364: 
                   11365:                 <p>You can use the &#8220;<span class=
                   11366:                 "quote">update</span>&#8221; target to resume
1.14      xtraeme  11367:                 package updating in case a previous
                   11368:                 <span><strong class="command">make
                   11369:                 update</strong></span> was interrupted for some
                   11370:                 reason. However, in this case, make sure you don't
                   11371:                 call <span><strong class="command">make
                   11372:                 clean</strong></span> or otherwise remove the list
                   11373:                 of dependent packages in <code class=
1.47      reed     11374:                 "varname">WRKDIR</code>. Otherwise, you lose the
1.1       grant    11375:                 ability to automatically update the current package
                   11376:                 along with the dependent packages you have
                   11377:                 installed.</p>
                   11378: 
1.14      xtraeme  11379:                 <p>Resuming an interrupted <span><strong class=
                   11380:                 "command">make update</strong></span> will only
                   11381:                 work as long as the package tree remains unchanged.
                   11382:                 If the source code for one of the packages to be
                   11383:                 updated has been changed, resuming
                   11384:                 <span><strong class="command">make
                   11385:                 update</strong></span> will most certainly
                   11386:                 fail!</p>
1.1       grant    11387: 
                   11388:                 <p>The following variables can be used either on
1.45      wiz      11389:                 the command line or in <code xmlns=
                   11390:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11391:                 "filename">/etc/mk.conf</code> to alter the
                   11392:                 behaviour of <span><strong class="command">make
                   11393:                 update</strong></span>:</p>
1.1       grant    11394: 
                   11395:                 <div class="variablelist">
                   11396:                   <dl>
1.14      xtraeme  11397:                     <dt><span class="term"><code class=
                   11398:                     "varname">UPDATE_TARGET</code></span></dt>
1.1       grant    11399: 
                   11400:                     <dd>
                   11401:                       <p>Install target to recursively use for the
                   11402:                       updated package and the dependent packages.
1.14      xtraeme  11403:                       Defaults to <code class=
                   11404:                       "varname">DEPENDS_TARGET</code> if set,
1.1       grant    11405:                       &#8220;<span class=
                   11406:                       "quote">install</span>&#8221; otherwise for
1.14      xtraeme  11407:                       <span><strong class="command">make
                   11408:                       update</strong></span>. e.g.
                   11409:                       <span><strong class="command">make update
                   11410:                       UPDATE_TARGET=package</strong></span></p>
1.1       grant    11411:                     </dd>
                   11412: 
1.14      xtraeme  11413:                     <dt><span class="term"><code class=
                   11414:                     "varname">NOCLEAN</code></span></dt>
1.1       grant    11415: 
                   11416:                     <dd>
                   11417:                       <p>Don't clean up after updating. Useful if
                   11418:                       you want to leave the work sources of the
                   11419:                       updated packages around for inspection or
                   11420:                       other purposes. Be sure you eventually clean
                   11421:                       up the source tree (see the
                   11422:                       &#8220;<span class=
                   11423:                       "quote">clean-update</span>&#8221; target
                   11424:                       below) or you may run into troubles with old
                   11425:                       source code still lying around on your next
1.14      xtraeme  11426:                       <span><strong class=
                   11427:                       "command">make</strong></span> or
                   11428:                       <span><strong class="command">make
                   11429:                       update</strong></span>.</p>
1.1       grant    11430:                     </dd>
                   11431: 
1.14      xtraeme  11432:                     <dt><span class="term"><code class=
                   11433:                     "varname">REINSTALL</code></span></dt>
1.1       grant    11434: 
                   11435:                     <dd>
                   11436:                       <p>Deinstall each package before installing
1.14      xtraeme  11437:                       (making <code class=
                   11438:                       "varname">DEPENDS_TARGET</code>). This may be
1.1       grant    11439:                       necessary if the &#8220;<span class=
                   11440:                       "quote">clean-update</span>&#8221; target
                   11441:                       (see below) was called after interrupting a
1.14      xtraeme  11442:                       running <span><strong class="command">make
                   11443:                       update</strong></span>.</p>
1.1       grant    11444:                     </dd>
                   11445: 
1.14      xtraeme  11446:                     <dt><span class="term"><code class=
                   11447:                     "varname">DEPENDS_TARGET</code></span></dt>
1.1       grant    11448: 
                   11449:                     <dd>
                   11450:                       <p>Allows you to disable recursion and
                   11451:                       hardcode the target for packages. The default
                   11452:                       is &#8220;<span class=
                   11453:                       "quote">update</span>&#8221; for the update
                   11454:                       target, facilitating a recursive update of
1.14      xtraeme  11455:                       prerequisite packages. Only set <code class=
                   11456:                       "varname">DEPENDS_TARGET</code> if you want
                   11457:                       to disable recursive updates. Use
                   11458:                       <code class="varname">UPDATE_TARGET</code>
                   11459:                       instead to just set a specific target for
                   11460:                       each package to be installed during
                   11461:                       <span><strong class="command">make
                   11462:                       update</strong></span> (see above).</p>
1.1       grant    11463:                     </dd>
                   11464:                   </dl>
                   11465:                 </div>
                   11466:               </dd>
                   11467: 
                   11468:               <dt><span class="term">clean-update</span></dt>
                   11469: 
                   11470:               <dd>
                   11471:                 <p>Clean the source tree for all packages that
1.14      xtraeme  11472:                 would get updated if <span><strong class=
                   11473:                 "command">make update</strong></span> was called
                   11474:                 from the current directory. This target should not
                   11475:                 be used if the current package (or any of its
                   11476:                 depending packages) have already been de-installed
                   11477:                 (e.g., after calling <span><strong class=
                   11478:                 "command">make update</strong></span>) or you may
                   11479:                 lose some packages you intended to update. As a
                   11480:                 rule of thumb: only use this target <span class=
                   11481:                 "emphasis"><em>before</em></span> the first time
                   11482:                 you run <span><strong class="command">make
                   11483:                 update</strong></span> and only if you have a dirty
                   11484:                 package tree (e.g., if you used <code class=
                   11485:                 "varname">NOCLEAN</code>).</p>
1.1       grant    11486: 
1.47      reed     11487:                 <p>If you are unsure about whether your tree is
                   11488:                 clean, you can either perform a
1.14      xtraeme  11489:                 <span><strong class="command">make
1.47      reed     11490:                 clean</strong></span> at the top of the tree, or
                   11491:                 use the following sequence of commands from the
                   11492:                 directory of the package you want to update
                   11493:                 (<span class="emphasis"><em>before</em></span>
                   11494:                 running <span><strong class="command">make
1.14      xtraeme  11495:                 update</strong></span> for the first time,
                   11496:                 otherwise you lose all the packages you wanted to
                   11497:                 update!):</p>
1.1       grant    11498:                 <pre class="screen">
1.14      xtraeme  11499: <code class="prompt">#</code> <strong class=
                   11500: "userinput"><code>make clean-update</code></strong>
                   11501: <code class="prompt">#</code> <strong class=
                   11502: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
                   11503: <code class="prompt">#</code> <strong class=
                   11504: "userinput"><code>make update</code></strong>
1.1       grant    11505: </pre>
                   11506: 
                   11507:                 <p>The following variables can be used either on
1.45      wiz      11508:                 the command line or in <code xmlns=
                   11509:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11510:                 "filename">/etc/mk.conf</code> to alter the
                   11511:                 behaviour of <span><strong class="command">make
                   11512:                 clean-update</strong></span>:</p>
1.1       grant    11513: 
                   11514:                 <div class="variablelist">
                   11515:                   <dl>
1.14      xtraeme  11516:                     <dt><span class="term"><code class=
                   11517:                     "varname">CLEAR_DIRLIST</code></span></dt>
1.1       grant    11518: 
                   11519:                     <dd>
1.14      xtraeme  11520:                       <p>After <span><strong class="command">make
                   11521:                       clean</strong></span>, do not reconstruct the
                   11522:                       list of directories to update for this
                   11523:                       package. Only use this if
                   11524:                       <span><strong class="command">make
                   11525:                       update</strong></span> successfully installed
                   11526:                       all packages you wanted to update. Normally,
                   11527:                       this is done automatically on
                   11528:                       <span><strong class="command">make
                   11529:                       update</strong></span>, but may have been
                   11530:                       suppressed by the <code class=
                   11531:                       "varname">NOCLEAN</code> variable (see
1.1       grant    11532:                       above).</p>
                   11533:                     </dd>
                   11534:                   </dl>
                   11535:                 </div>
                   11536:               </dd>
                   11537: 
                   11538:               <dt><span class="term">info</span></dt>
                   11539: 
                   11540:               <dd>
                   11541:                 <p>This target invokes <a href=
                   11542:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   11543:                 <span class="citerefentry"><span class=
                   11544:                 "refentrytitle">pkg_info</span>(1)</span></a> for
                   11545:                 the current package. You can use this to check
                   11546:                 which version of a package is installed.</p>
                   11547:               </dd>
                   11548: 
                   11549:               <dt><span class="term">readme</span></dt>
                   11550: 
                   11551:               <dd>
1.45      wiz      11552:                 <p>This target generates a <code xmlns=
                   11553:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11554:                 "filename">README.html</code> file, which can be
1.1       grant    11555:                 viewed using a browser such as <a xmlns=
                   11556:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   11557:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45      wiz      11558:                 target="_top"><code xmlns="" class=
                   11559:                 "filename">www/mozilla</code></a> or <a xmlns=
1.20      ben      11560:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   11561:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
1.45      wiz      11562:                 target="_top"><code xmlns="" class=
                   11563:                 "filename">www/links</code></a>. The generated
                   11564:                 files contain references to any packages which are
                   11565:                 in the <code class="varname">PACKAGES</code>
                   11566:                 directory on the local host. The generated files
                   11567:                 can be made to refer to URLs based on <code class=
1.20      ben      11568:                 "varname">FTP_PKG_URL_HOST</code> and <code class=
                   11569:                 "varname">FTP_PKG_URL_DIR</code>. For example, if I
1.45      wiz      11570:                 wanted to generate <code xmlns=
                   11571:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      11572:                 "filename">README.html</code> files which pointed
                   11573:                 to binary packages on the local machine, in the
1.45      wiz      11574:                 directory <code xmlns=
                   11575:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      11576:                 "filename">/usr/packages</code>, set <code class=
                   11577:                 "varname">FTP_PKG_URL_HOST=file://localhost</code>
                   11578:                 and <code class=
                   11579:                 "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
                   11580:                 <code class="varname">${PACKAGES}</code> directory
                   11581:                 and its subdirectories will be searched for all the
                   11582:                 binary packages.</p>
1.1       grant    11583:               </dd>
                   11584: 
                   11585:               <dt><span class="term">readme-all</span></dt>
                   11586: 
                   11587:               <dd>
1.45      wiz      11588:                 <p>Use this target to create a file <code xmlns=
                   11589:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11590:                 "filename">README-all.html</code> which contains a
1.1       grant    11591:                 list of all packages currently available in the
                   11592:                 NetBSD Packages Collection, together with the
                   11593:                 category they belong to and a short description.
1.45      wiz      11594:                 This file is compiled from the <code xmlns=
                   11595:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11596:                 "filename">pkgsrc/*/README.html</code> files, so be
1.1       grant    11597:                 sure to run this <span class=
1.14      xtraeme  11598:                 "emphasis"><em>after</em></span> a
                   11599:                 <span><strong class="command">make
                   11600:                 readme</strong></span>.</p>
1.1       grant    11601:               </dd>
                   11602: 
                   11603:               <dt><span class="term">cdrom-readme</span></dt>
                   11604: 
                   11605:               <dd>
                   11606:                 <p>This is very much the same as the
                   11607:                 &#8220;<span class="quote">readme</span>&#8221;
                   11608:                 target (see above), but is to be used when
                   11609:                 generating a pkgsrc tree to be written to a CD-ROM.
1.45      wiz      11610:                 This target also produces <code xmlns=
                   11611:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11612:                 "filename">README.html</code> files, and can be
                   11613:                 made to refer to URLs based on <code class=
                   11614:                 "varname">CDROM_PKG_URL_HOST</code> and
                   11615:                 <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1       grant    11616:               </dd>
                   11617: 
                   11618:               <dt><span class="term">show-distfiles</span></dt>
                   11619: 
                   11620:               <dd>
                   11621:                 <p>This target shows which distfiles and patchfiles
1.14      xtraeme  11622:                 are needed to build the package. (<code class=
                   11623:                 "varname">DISTFILES</code> and <code class=
1.45      wiz      11624:                 "varname">PATCHFILES</code>, but not <code xmlns=
                   11625:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11626:                 "filename">patches/*</code>)</p>
1.1       grant    11627:               </dd>
                   11628: 
                   11629:               <dt><span class="term">show-downlevel</span></dt>
                   11630: 
                   11631:               <dd>
                   11632:                 <p>This target shows nothing if the package is not
                   11633:                 installed. If a version of this package is
                   11634:                 installed, but is not the version provided in this
                   11635:                 version of pkgsrc, then a warning message is
                   11636:                 displayed. This target can be used to show which of
                   11637:                 your installed packages are downlevel, and so the
                   11638:                 old versions can be deleted, and the current ones
                   11639:                 added.</p>
                   11640:               </dd>
                   11641: 
                   11642:               <dt><span class="term">show-pkgsrc-dir</span></dt>
                   11643: 
                   11644:               <dd>
                   11645:                 <p>This target shows the directory in the pkgsrc
                   11646:                 hierarchy from which the package can be built and
                   11647:                 installed. This may not be the same directory as
                   11648:                 the one from which the package was installed. This
                   11649:                 target is intended to be used by people who may
                   11650:                 wish to upgrade many packages on a single host, and
                   11651:                 can be invoked from the top-level pkgsrc Makefile
                   11652:                 by using the &#8220;<span class=
                   11653:                 "quote">show-host-specific-pkgs</span>&#8221;
                   11654:                 target.</p>
                   11655:               </dd>
                   11656: 
                   11657:               <dt><span class=
                   11658:               "term">show-installed-depends</span></dt>
                   11659: 
                   11660:               <dd>
                   11661:                 <p>This target shows which installed packages match
1.14      xtraeme  11662:                 the current package's <code class=
                   11663:                 "varname">DEPENDS</code>. Useful if out of date
1.1       grant    11664:                 dependencies are causing build problems.</p>
                   11665:               </dd>
                   11666: 
                   11667:               <dt><span class="term">check-shlibs</span></dt>
                   11668: 
                   11669:               <dd>
                   11670:                 <p>After a package is installed, check all its
                   11671:                 binaries and (on ELF platforms) shared libraries to
                   11672:                 see if they find the shared libs they need. Run by
1.14      xtraeme  11673:                 default if <code class=
                   11674:                 "varname">PKG_DEVELOPER</code> is set in
1.45      wiz      11675:                 <code xmlns=
                   11676:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11677:                 "filename">/etc/mk.conf</code>.</p>
1.1       grant    11678:               </dd>
                   11679: 
                   11680:               <dt><span class="term">print-PLIST</span></dt>
                   11681: 
                   11682:               <dd>
                   11683:                 <p>After a &#8220;<span class="quote">make
                   11684:                 install</span>&#8221; from a new or upgraded pkg,
                   11685:                 this prints out an attempt to generate a new
1.45      wiz      11686:                 <code xmlns=
                   11687:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11688:                 "filename">PLIST</code> from a <span><strong class=
                   11689:                 "command">find -newer
1.14      xtraeme  11690:                 work/.extract_done</strong></span>. An attempt is
                   11691:                 made to care for shared libs etc., but it is
1.1       grant    11692:                 <span class="emphasis"><em>strongly</em></span>
                   11693:                 recommended to review the result before putting it
1.45      wiz      11694:                 into <code xmlns=
                   11695:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11696:                 "filename">PLIST</code>. On upgrades, it's useful
                   11697:                 to diff the output of this command against an
                   11698:                 already existing <code xmlns=
                   11699:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11700:                 "filename">PLIST</code> file.</p>
1.1       grant    11701: 
1.24      wiz      11702:                 <p>If the package installs files via <a href=
                   11703:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   11704:                 <span class="citerefentry"><span class=
                   11705:                 "refentrytitle">tar</span>(1)</span></a> or other
                   11706:                 methods that don't update file access times, be
                   11707:                 sure to add these files manually to your
1.45      wiz      11708:                 <code xmlns=
                   11709:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11710:                 "filename">PLIST</code>, as the &#8220;<span class=
                   11711:                 "quote">find -newer</span>&#8221; command used by
                   11712:                 this target won't catch them!</p>
1.1       grant    11713: 
                   11714:                 <p>See <a href="#print-PLIST" title=
1.38      dillo    11715:                 "10.3.&nbsp;Tweaking output of make print-PLIST">Section&nbsp;10.3,
1.14      xtraeme  11716:                 &#8220;Tweaking output of <span><strong class=
                   11717:                 "command">make
                   11718:                 print-PLIST</strong></span>&#8221;</a> for more
                   11719:                 information on this target.</p>
1.1       grant    11720:               </dd>
                   11721: 
                   11722:               <dt><span class="term">bulk-package</span></dt>
                   11723: 
                   11724:               <dd>
                   11725:                 <p>Used to do bulk builds. If an appropriate binary
                   11726:                 package already exists, no action is taken. If not,
                   11727:                 this target will compile, install and package it
1.47      reed     11728:                 (and its depends, if <code class=
1.14      xtraeme  11729:                 "varname">PKG_DEPENDS</code> is set properly. See
1.1       grant    11730:                 <a href="#binary.configuration" title=
1.38      dillo    11731:                 "6.3.1.&nbsp;Configuration">Section&nbsp;6.3.1,
1.47      reed     11732:                 &#8220;Configuration&#8221;</a>). After creating
                   11733:                 the binary package, the sources, the just-installed
                   11734:                 package and its required packages are removed,
1.1       grant    11735:                 preserving free disk space.</p>
                   11736: 
                   11737:                 <p><span class="emphasis"><em>Beware that this
                   11738:                 target may deinstall all packages installed on a
                   11739:                 system!</em></span></p>
                   11740:               </dd>
                   11741: 
                   11742:               <dt><span class="term">bulk-install</span></dt>
                   11743: 
                   11744:               <dd>
                   11745:                 <p>Used during bulk-installs to install required
1.47      reed     11746:                 packages. If an up-to-date binary package is
1.1       grant    11747:                 available, it will be installed via <a href=
                   11748:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   11749:                 <span class="citerefentry"><span class=
                   11750:                 "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14      xtraeme  11751:                 not, <span><strong class="command">make
                   11752:                 bulk-package</strong></span> will be executed, but
1.47      reed     11753:                 the installed binary won't be removed.</p>
1.1       grant    11754: 
                   11755:                 <p>A binary package is considered
1.47      reed     11756:                 &#8220;<span class="quote">up-to-date</span>&#8221;
1.1       grant    11757:                 to be installed via <a href=
                   11758:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   11759:                 <span class="citerefentry"><span class=
                   11760:                 "refentrytitle">pkg_add</span>(1)</span></a>
                   11761:                 if:</p>
                   11762: 
                   11763:                 <div class="itemizedlist">
                   11764:                   <ul type="disc">
                   11765:                     <li>
1.45      wiz      11766:                       <p>None of the package's files (<code xmlns=
                   11767:                       "http://www.w3.org/TR/xhtml1/transitional"
                   11768:                       class="filename">Makefile</code>, ...) were
1.14      xtraeme  11769:                       modified since it was built.</p>
1.1       grant    11770:                     </li>
                   11771: 
                   11772:                     <li>
                   11773:                       <p>None of the package's required (binary)
                   11774:                       packages were modified since it was
                   11775:                       built.</p>
                   11776:                     </li>
                   11777:                   </ul>
                   11778:                 </div>
                   11779: 
                   11780:                 <p><span class="emphasis"><em>Beware that this
                   11781:                 target may deinstall all packages installed on a
                   11782:                 system!</em></span></p>
                   11783:               </dd>
                   11784:             </dl>
                   11785:           </div>
                   11786:         </div>
                   11787:       </div>
                   11788: 
1.66    ! rillig   11789:       <div class="chapter" lang="en" xml:lang="en">
1.1       grant    11790:         <div class="titlepage">
                   11791:           <div>
                   11792:             <div>
1.66    ! rillig   11793:               <h2 class="title"><a name="fixes" id=
1.55      rillig   11794:               "fixes"></a>Chapter&nbsp;15.&nbsp;Making your package
                   11795:               work</h2>
1.1       grant    11796:             </div>
                   11797:           </div>
                   11798:         </div>
                   11799: 
                   11800:         <div class="toc">
                   11801:           <p><b>Table of Contents</b></p>
                   11802: 
                   11803:           <dl>
1.30      wiz      11804:             <dt><span class="sect1"><a href=
1.38      dillo    11805:             "#general-operation">15.1. General
1.30      wiz      11806:             operation</a></span></dt>
1.1       grant    11807: 
                   11808:             <dd>
                   11809:               <dl>
                   11810:                 <dt><span class="sect2"><a href=
1.38      dillo    11811:                 "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30      wiz      11812:                 pull in variables from /etc/mk.conf</a></span></dt>
1.1       grant    11813: 
                   11814:                 <dt><span class="sect2"><a href=
1.38      dillo    11815:                 "#where-to-install-documentation">15.1.2. Where to
1.31      wiz      11816:                 install documentation</a></span></dt>
                   11817: 
                   11818:                 <dt><span class="sect2"><a href=
1.38      dillo    11819:                 "#restricted-packages">15.1.3. Restricted
1.1       grant    11820:                 packages</a></span></dt>
                   11821: 
                   11822:                 <dt><span class="sect2"><a href=
1.38      dillo    11823:                 "#dependencies">15.1.4. Handling
1.1       grant    11824:                 dependencies</a></span></dt>
                   11825: 
                   11826:                 <dt><span class="sect2"><a href=
1.38      dillo    11827:                 "#conflicts">15.1.5. Handling conflicts with other
1.1       grant    11828:                 packages</a></span></dt>
                   11829: 
                   11830:                 <dt><span class="sect2"><a href=
1.38      dillo    11831:                 "#not-building-packages">15.1.6. Packages that
1.30      wiz      11832:                 cannot or should not be built</a></span></dt>
1.1       grant    11833: 
                   11834:                 <dt><span class="sect2"><a href=
1.38      dillo    11835:                 "#undeletable-packages">15.1.7. Packages which
1.30      wiz      11836:                 should not be deleted, once
                   11837:                 installed</a></span></dt>
1.1       grant    11838: 
                   11839:                 <dt><span class="sect2"><a href=
1.38      dillo    11840:                 "#security-handling">15.1.8. Handling packages with
1.1       grant    11841:                 security problems</a></span></dt>
                   11842: 
                   11843:                 <dt><span class="sect2"><a href=
1.38      dillo    11844:                 "#compiler-bugs">15.1.9. How to handle compiler
1.1       grant    11845:                 bugs</a></span></dt>
                   11846: 
                   11847:                 <dt><span class="sect2"><a href=
1.38      dillo    11848:                 "#bumping-pkgrevision">15.1.10. How to handle
1.30      wiz      11849:                 incrementing versions when fixing an existing
1.1       grant    11850:                 package</a></span></dt>
                   11851: 
                   11852:                 <dt><span class="sect2"><a href=
1.38      dillo    11853:                 "#portability-of-packages">15.1.11. Portability of
1.1       grant    11854:                 packages</a></span></dt>
                   11855:               </dl>
                   11856:             </dd>
                   11857: 
1.30      wiz      11858:             <dt><span class="sect1"><a href=
1.38      dillo    11859:             "#downloading-issues">15.2. Possible downloading
1.30      wiz      11860:             issues</a></span></dt>
1.1       grant    11861: 
                   11862:             <dd>
                   11863:               <dl>
                   11864:                 <dt><span class="sect2"><a href=
1.38      dillo    11865:                 "#no-plain-download">15.2.1. Packages whose
1.30      wiz      11866:                 distfiles aren't available for plain
1.1       grant    11867:                 downloading</a></span></dt>
                   11868: 
                   11869:                 <dt><span class="sect2"><a href=
1.38      dillo    11870:                 "#modified-distfiles-same-name">15.2.2. How to
1.30      wiz      11871:                 handle modified distfiles with the 'old'
                   11872:                 name</a></span></dt>
1.1       grant    11873:               </dl>
                   11874:             </dd>
                   11875: 
1.30      wiz      11876:             <dt><span class="sect1"><a href=
1.38      dillo    11877:             "#configuration-gotchas">15.3. Configuration
1.30      wiz      11878:             gotchas</a></span></dt>
1.1       grant    11879: 
                   11880:             <dd>
                   11881:               <dl>
                   11882:                 <dt><span class="sect2"><a href=
1.38      dillo    11883:                 "#fixes.libtool">15.3.1. Shared libraries -
1.1       grant    11884:                 libtool</a></span></dt>
                   11885: 
                   11886:                 <dt><span class="sect2"><a href=
1.38      dillo    11887:                 "#using-libtool">15.3.2. Using libtool on GNU
1.30      wiz      11888:                 packages that already support
                   11889:                 libtool</a></span></dt>
1.1       grant    11890: 
                   11891:                 <dt><span class="sect2"><a href=
1.38      dillo    11892:                 "#autoconf-automake">15.3.3. GNU
1.1       grant    11893:                 Autoconf/Automake</a></span></dt>
                   11894:               </dl>
                   11895:             </dd>
                   11896: 
1.55      rillig   11897:             <dt><span class="sect1"><a href="#fixes-build">15.4.
                   11898:             Building the package</a></span></dt>
1.1       grant    11899: 
                   11900:             <dd>
                   11901:               <dl>
                   11902:                 <dt><span class="sect2"><a href=
1.38      dillo    11903:                 "#cpp-defines">15.4.1. CPP defines</a></span></dt>
1.51      rillig   11904: 
1.60      rillig   11905:                 <dt><span class="sect2"><a href=
                   11906:                 "#cpp-list-examples">15.4.2. Examples of CPP
                   11907:                 defines for some platforms</a></span></dt>
                   11908: 
                   11909:                 <dt><span class="sect2"><a href="#cpp-list">15.4.3.
1.51      rillig   11910:                 Getting a list of CPP defines</a></span></dt>
1.1       grant    11911:               </dl>
                   11912:             </dd>
                   11913: 
1.30      wiz      11914:             <dt><span class="sect1"><a href=
1.38      dillo    11915:             "#package-specific-actions">15.5. Package specific
1.30      wiz      11916:             actions</a></span></dt>
1.1       grant    11917: 
                   11918:             <dd>
                   11919:               <dl>
                   11920:                 <dt><span class="sect2"><a href=
1.38      dillo    11921:                 "#user-interaction">15.5.1. User
1.2       hubertf  11922:                 interaction</a></span></dt>
1.1       grant    11923: 
                   11924:                 <dt><span class="sect2"><a href=
1.38      dillo    11925:                 "#handling-licenses">15.5.2. Handling
1.1       grant    11926:                 licenses</a></span></dt>
                   11927: 
                   11928:                 <dt><span class="sect2"><a href=
1.38      dillo    11929:                 "#installing-score-files">15.5.3. Installing score
1.1       grant    11930:                 files</a></span></dt>
                   11931: 
                   11932:                 <dt><span class="sect2"><a href=
1.38      dillo    11933:                 "#perl-scripts">15.5.4. Packages containing perl
1.1       grant    11934:                 scripts</a></span></dt>
                   11935: 
                   11936:                 <dt><span class="sect2"><a href=
1.38      dillo    11937:                 "#hardcoded-paths">15.5.5. Packages with hardcoded
1.30      wiz      11938:                 paths to other interpreters</a></span></dt>
1.1       grant    11939: 
                   11940:                 <dt><span class="sect2"><a href=
1.38      dillo    11941:                 "#perl-modules">15.5.6. Packages installing perl
1.1       grant    11942:                 modules</a></span></dt>
                   11943: 
                   11944:                 <dt><span class="sect2"><a href=
1.38      dillo    11945:                 "#faq.info-files">15.5.7. Packages installing info
1.1       grant    11946:                 files</a></span></dt>
                   11947: 
1.57      minskim  11948:                 <dt><span class="sect2"><a href="#manpages">15.5.8.
                   11949:                 Packages installing man pages</a></span></dt>
                   11950: 
1.1       grant    11951:                 <dt><span class="sect2"><a href=
1.57      minskim  11952:                 "#gconf2-data-files">15.5.9. Packages installing
1.30      wiz      11953:                 GConf2 data files</a></span></dt>
1.1       grant    11954: 
                   11955:                 <dt><span class="sect2"><a href=
1.57      minskim  11956:                 "#scrollkeeper-data-files">15.5.10. Packages
1.30      wiz      11957:                 installing scrollkeeper data files</a></span></dt>
1.1       grant    11958: 
                   11959:                 <dt><span class="sect2"><a href=
1.57      minskim  11960:                 "#x11-fonts">15.5.11. Packages installing X11
1.1       grant    11961:                 fonts</a></span></dt>
                   11962: 
                   11963:                 <dt><span class="sect2"><a href=
1.57      minskim  11964:                 "#gtk2-modules">15.5.12. Packages installing GTK2
1.1       grant    11965:                 modules</a></span></dt>
                   11966: 
                   11967:                 <dt><span class="sect2"><a href=
1.57      minskim  11968:                 "#sgml-xml-data">15.5.13. Packages installing SGML
1.30      wiz      11969:                 or XML data</a></span></dt>
1.1       grant    11970: 
                   11971:                 <dt><span class="sect2"><a href=
1.57      minskim  11972:                 "#mime-database">15.5.14. Packages installing
1.1       grant    11973:                 extensions to the MIME database</a></span></dt>
                   11974: 
                   11975:                 <dt><span class="sect2"><a href=
1.57      minskim  11976:                 "#intltool">15.5.15. Packages using
1.1       grant    11977:                 intltool</a></span></dt>
1.18      xtraeme  11978: 
                   11979:                 <dt><span class="sect2"><a href=
1.57      minskim  11980:                 "#startup-scripts">15.5.16. Packages installing
1.30      wiz      11981:                 startup scripts</a></span></dt>
1.57      minskim  11982: 
                   11983:                 <dt><span class="sect2"><a href=
                   11984:                 "#tex-packages">15.5.17. Packages installing TeX
                   11985:                 modules</a></span></dt>
1.1       grant    11986:               </dl>
                   11987:             </dd>
                   11988: 
1.30      wiz      11989:             <dt><span class="sect1"><a href=
1.38      dillo    11990:             "#feedback-to-author">15.6. Feedback to the
1.30      wiz      11991:             author</a></span></dt>
1.1       grant    11992:           </dl>
                   11993:         </div>
                   11994: 
1.66    ! rillig   11995:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    11996:           <div class="titlepage">
                   11997:             <div>
                   11998:               <div>
                   11999:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   12000:                 "general-operation" id=
1.38      dillo    12001:                 "general-operation"></a>15.1.&nbsp;General
1.1       grant    12002:                 operation</h2>
                   12003:               </div>
                   12004:             </div>
                   12005:           </div>
                   12006: 
1.66    ! rillig   12007:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    12008:             <div class="titlepage">
                   12009:               <div>
                   12010:                 <div>
1.30      wiz      12011:                   <h3 class="title"><a name=
1.66    ! rillig   12012:                   "pulling-vars-from-etc-mk.conf" id=
1.38      dillo    12013:                   "pulling-vars-from-etc-mk.conf"></a>15.1.1.&nbsp;How
1.30      wiz      12014:                   to pull in variables from /etc/mk.conf</h3>
1.1       grant    12015:                 </div>
                   12016:               </div>
                   12017:             </div>
                   12018: 
                   12019:             <p>The problem with package-defined variables that can
1.14      xtraeme  12020:             be overridden via <code class="varname">MAKECONF</code>
1.45      wiz      12021:             or <code xmlns=
                   12022:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12023:             "filename">/etc/mk.conf</code> is that <a href=
1.1       grant    12024:             "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   12025:             <span class="citerefentry"><span class=
                   12026:             "refentrytitle">make</span>(1)</span></a> expands a
1.47      reed     12027:             variable as it is used, but evaluates preprocessor-like
1.1       grant    12028:             statements (.if, .ifdef and .ifndef) as they are read.
1.14      xtraeme  12029:             So, to use any variable (which may be set in
1.45      wiz      12030:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12031:             class="filename">/etc/mk.conf</code>) in one of the
                   12032:             .if* statements, the file <code xmlns=
                   12033:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12034:             "filename">/etc/mk.conf</code> must be included before
1.1       grant    12035:             that .if* statement.</p>
                   12036: 
1.47      reed     12037:             <p>Rather than having a number of ad-hoc ways of
1.45      wiz      12038:             including <code xmlns=
                   12039:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12040:             "filename">/etc/mk.conf</code>, should it exist, or
                   12041:             <code class="varname">MAKECONF</code>, should it exist,
                   12042:             include the <code xmlns=
                   12043:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12044:             "filename">pkgsrc/mk/bsd.prefs.mk</code> file in the
                   12045:             package Makefile before any preprocessor-like .if,
                   12046:             .ifdef, or .ifndef statements:</p>
1.1       grant    12047:             <pre class="programlisting">
1.51      rillig   12048:     .include "../../mk/bsd.prefs.mk"
                   12049: 
1.1       grant    12050:     .if defined(USE_MENUS)
1.51      rillig   12051:     # ...
1.1       grant    12052:     .endif
                   12053: </pre>
                   12054: 
1.14      xtraeme  12055:             <p>If you wish to set the <code class=
1.45      wiz      12056:             "varname">CFLAGS</code> variable in <code xmlns=
                   12057:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     12058:             "filename">/etc/mk.conf</code>, please make sure to
1.1       grant    12059:             use:</p>
                   12060:             <pre class="programlisting">
1.51      rillig   12061:     CFLAGS+=  -your -flags
1.1       grant    12062: </pre>
                   12063: 
1.14      xtraeme  12064:             <p>Using <code class="varname">CFLAGS=</code> (i.e.
                   12065:             without the &#8220;<span class="quote">+</span>&#8221;)
                   12066:             may lead to problems with packages that need to add
                   12067:             their own flags. Also, you may want to take a look at
                   12068:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1       grant    12069:             href=
                   12070:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45      wiz      12071:             target="_top"><code xmlns="" class=
                   12072:             "filename">devel/cpuflags</code></a> package if you're
1.20      ben      12073:             interested in optimization for the current CPU.</p>
1.1       grant    12074:           </div>
                   12075: 
1.66    ! rillig   12076:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    12077:             <div class="titlepage">
                   12078:               <div>
                   12079:                 <div>
1.31      wiz      12080:                   <h3 class="title"><a name=
1.66    ! rillig   12081:                   "where-to-install-documentation" id=
1.38      dillo    12082:                   "where-to-install-documentation"></a>15.1.2.&nbsp;Where
1.31      wiz      12083:                   to install documentation</h3>
                   12084:                 </div>
                   12085:               </div>
                   12086:             </div>
                   12087: 
1.45      wiz      12088:             <p>Documentation should be installed into <code xmlns=
                   12089:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.31      wiz      12090:             "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
1.45      wiz      12091:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12092:             class="filename">${PREFIX}/share/doc/${PKGNAME}</code>
                   12093:             (the latter includes the version number of the
                   12094:             package).</p>
1.31      wiz      12095:           </div>
                   12096: 
1.66    ! rillig   12097:           <div class="sect2" lang="en" xml:lang="en">
1.31      wiz      12098:             <div class="titlepage">
                   12099:               <div>
                   12100:                 <div>
1.66    ! rillig   12101:                   <h3 class="title"><a name="restricted-packages"
        !          12102:                   id=
1.38      dillo    12103:                   "restricted-packages"></a>15.1.3.&nbsp;Restricted
1.1       grant    12104:                   packages</h3>
                   12105:                 </div>
                   12106:               </div>
                   12107:             </div>
                   12108: 
                   12109:             <p>Some licenses restrict how software may be
                   12110:             re-distributed. In order to satisfy these restrictions,
                   12111:             the package system defines five make variables that can
                   12112:             be set to note these restrictions:</p>
                   12113: 
                   12114:             <div class="itemizedlist">
                   12115:               <ul type="disc">
                   12116:                 <li>
1.14      xtraeme  12117:                   <p><code class="varname">RESTRICTED</code></p>
1.1       grant    12118: 
                   12119:                   <p>This variable should be set whenever a
                   12120:                   restriction exists (regardless of its kind). Set
                   12121:                   this variable to a string containing the reason
                   12122:                   for the restriction.</p>
                   12123:                 </li>
                   12124: 
                   12125:                 <li>
1.14      xtraeme  12126:                   <p><code class=
                   12127:                   "varname">NO_BIN_ON_CDROM</code></p>
1.1       grant    12128: 
                   12129:                   <p>Binaries may not be placed on CD-ROM. Set this
1.14      xtraeme  12130:                   variable to <code class=
                   12131:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    12132:                   package may not be included on a CD-ROM.</p>
                   12133:                 </li>
                   12134: 
                   12135:                 <li>
1.14      xtraeme  12136:                   <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1       grant    12137: 
                   12138:                   <p>Binaries may not be placed on an FTP server.
1.14      xtraeme  12139:                   Set this variable to <code class=
                   12140:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    12141:                   package may not not be made available on the
                   12142:                   Internet.</p>
                   12143:                 </li>
                   12144: 
                   12145:                 <li>
1.14      xtraeme  12146:                   <p><code class=
                   12147:                   "varname">NO_SRC_ON_CDROM</code></p>
1.1       grant    12148: 
                   12149:                   <p>Distfiles may not be placed on CD-ROM. Set
1.14      xtraeme  12150:                   this variable to <code class=
                   12151:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    12152:                   of the source code or other distfile(s) is not
                   12153:                   allowed on CD-ROMs.</p>
                   12154:                 </li>
                   12155: 
                   12156:                 <li>
1.14      xtraeme  12157:                   <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1       grant    12158: 
                   12159:                   <p>Distfiles may not be placed on FTP. Set this
1.14      xtraeme  12160:                   variable to <code class=
                   12161:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    12162:                   of the source code or other distfile(s) via the
                   12163:                   Internet is not allowed.</p>
                   12164:                 </li>
                   12165:               </ul>
                   12166:             </div>
                   12167: 
1.14      xtraeme  12168:             <p>Please note that the use of <code class=
                   12169:             "varname">NO_PACKAGE</code>, <code class=
                   12170:             "varname">IGNORE</code>, <code class=
                   12171:             "varname">NO_CDROM</code>, or other generic make
1.1       grant    12172:             variables to denote restrictions is deprecated, because
                   12173:             they unconditionally prevent users from generating
                   12174:             binary packages!</p>
                   12175:           </div>
                   12176: 
1.66    ! rillig   12177:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    12178:             <div class="titlepage">
                   12179:               <div>
                   12180:                 <div>
1.66    ! rillig   12181:                   <h3 class="title"><a name="dependencies" id=
1.38      dillo    12182:                   "dependencies"></a>15.1.4.&nbsp;Handling
1.1       grant    12183:                   dependencies</h3>
                   12184:                 </div>
                   12185:               </div>
                   12186:             </div>
                   12187: 
                   12188:             <p>Your package may depend on some other package being
                   12189:             present - and there are various ways of expressing this
1.14      xtraeme  12190:             dependency. pkgsrc supports the <code class=
                   12191:             "varname">BUILD_DEPENDS</code> and <code class=
1.47      reed     12192:             "varname">DEPENDS</code> definitions, the <code class=
                   12193:             "varname">USE_TOOLS</code> definition, as well as
1.45      wiz      12194:             dependencies via <code xmlns=
                   12195:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12196:             "filename">buildlink3.mk</code>, which is the preferred
1.1       grant    12197:             way to handle dependencies, and which uses the
                   12198:             variables named above. See <a href="#buildlink" title=
1.38      dillo    12199:             "Chapter&nbsp;11.&nbsp;Buildlink methodology">Chapter&nbsp;11,
1.1       grant    12200:             <i>Buildlink methodology</i></a> for more
                   12201:             information.</p>
                   12202: 
                   12203:             <p>The basic difference between the two variables is as
1.14      xtraeme  12204:             follows: The <code class="varname">DEPENDS</code>
1.1       grant    12205:             definition registers that pre-requisite in the binary
                   12206:             package so it will be pulled in when the binary package
1.14      xtraeme  12207:             is later installed, whilst the <code class=
                   12208:             "varname">BUILD_DEPENDS</code> definition does not,
1.1       grant    12209:             marking a dependency that is only needed for building
                   12210:             the package.</p>
                   12211: 
                   12212:             <p>This means that if you only need a package present
                   12213:             whilst you are building, it should be noted as a
1.14      xtraeme  12214:             <code class="varname">BUILD_DEPENDS</code>.</p>
1.1       grant    12215: 
1.14      xtraeme  12216:             <p>The format for a <code class=
                   12217:             "varname">BUILD_DEPENDS</code> and a <code class=
                   12218:             "varname">DEPENDS</code> definition is:</p>
1.1       grant    12219:             <pre class="programlisting">
1.51      rillig   12220:     &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
1.1       grant    12221: </pre>
                   12222: 
                   12223:             <p>Please note that the &#8220;<span class=
                   12224:             "quote">pre-req-package-name</span>&#8221; may include
1.18      xtraeme  12225:             any of the wildcard version numbers recognized by
1.1       grant    12226:             <a href=
                   12227:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   12228:             <span class="citerefentry"><span class=
                   12229:             "refentrytitle">pkg_info</span>(1)</span></a>.</p>
                   12230: 
                   12231:             <div class="orderedlist">
                   12232:               <ol type="1">
                   12233:                 <li>
                   12234:                   <p>If your package needs another package's
                   12235:                   binaries or libraries to build or run, and if
1.45      wiz      12236:                   that package has a <code xmlns=
                   12237:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12238:                   "filename">buildlink3.mk</code> file available,
                   12239:                   use it:</p>
1.1       grant    12240:                   <pre class="programlisting">
                   12241:     .include "../../graphics/jpeg/buildlink3.mk"
                   12242: </pre>
                   12243:                 </li>
                   12244: 
                   12245:                 <li>
                   12246:                   <p>If your package needs to use another package
1.45      wiz      12247:                   to build itself and there is no <code xmlns=
                   12248:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12249:                   "filename">buildlink3.mk</code> file available,
                   12250:                   use the <code class=
                   12251:                   "varname">BUILD_DEPENDS</code> definition:</p>
1.1       grant    12252:                   <pre class="programlisting">
1.51      rillig   12253:     BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
1.1       grant    12254: </pre>
                   12255:                 </li>
                   12256: 
                   12257:                 <li>
                   12258:                   <p>If your package needs a library with which to
1.45      wiz      12259:                   link and again there is no <code xmlns=
                   12260:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12261:                   "filename">buildlink3.mk</code> file available,
                   12262:                   this is specified using the <code class=
                   12263:                   "varname">DEPENDS</code> definition. An example
                   12264:                   of this is the <a xmlns=
1.1       grant    12265:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   12266:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45      wiz      12267:                   target="_top"><code xmlns="" class=
                   12268:                   "filename">print/lyx</code></a> package, which
                   12269:                   uses the xpm library, version 3.4j to build:</p>
1.1       grant    12270:                   <pre class="programlisting">
1.51      rillig   12271:     DEPENDS+=       xpm-3.4j:../../graphics/xpm
1.1       grant    12272: </pre>
                   12273: 
                   12274:                   <p>You can also use wildcards in package
                   12275:                   dependences:</p>
                   12276:                   <pre class="programlisting">
1.51      rillig   12277:     DEPENDS+=       xpm-[0-9]*:../../graphics/xpm
1.1       grant    12278: </pre>
                   12279: 
                   12280:                   <p>Note that such wildcard dependencies are
                   12281:                   retained when creating binary packages. The
                   12282:                   dependency is checked when installing the binary
                   12283:                   package and any package which matches the pattern
                   12284:                   will be used. Wildcard dependencies should be
                   12285:                   used with care.</p>
                   12286: 
                   12287:                   <p>The &#8220;<span class=
                   12288:                   "quote">-[0-9]*</span>&#8221; should be used
                   12289:                   instead of &#8220;<span class=
                   12290:                   "quote">-*</span>&#8221; to avoid potentially
                   12291:                   ambiguous matches such as &#8220;<span class=
                   12292:                   "quote">tk-postgresql</span>&#8221; matching a
                   12293:                   &#8220;<span class="quote">tk-*</span>&#8221;
1.14      xtraeme  12294:                   <code class="varname">DEPENDS</code>.</p>
1.1       grant    12295: 
                   12296:                   <p>Wildcards can also be used to specify that a
                   12297:                   package will only build against a certain minimum
                   12298:                   version of a pre-requisite:</p>
                   12299:                   <pre class="programlisting">
1.51      rillig   12300:     DEPENDS+=       tiff&gt;=3.5.4:../../graphics/tiff
1.1       grant    12301: </pre>
                   12302: 
                   12303:                   <p>This means that the package will build against
                   12304:                   version 3.5.4 of the tiff library or newer. Such
                   12305:                   a dependency may be warranted if, for example,
                   12306:                   the API of the library has changed with version
                   12307:                   3.5.4 and a package would not compile against an
                   12308:                   earlier version of tiff.</p>
                   12309: 
                   12310:                   <p>Please note that such dependencies should only
                   12311:                   be updated if a package requires a newer
                   12312:                   pre-requisite, but not to denote recommendations
                   12313:                   such as security updates or ABI changes that do
                   12314:                   not prevent a package from building correctly.
                   12315:                   Such recommendations can be expressed using
1.14      xtraeme  12316:                   <code class="varname">RECOMMENDED</code>:</p>
1.1       grant    12317:                   <pre class="programlisting">
1.51      rillig   12318:     RECOMMENDED+=   tiff&gt;=3.6.1:../../graphics/tiff
1.1       grant    12319: </pre>
                   12320: 
1.14      xtraeme  12321:                   <p>In addition to the above <code class=
                   12322:                   "varname">DEPENDS</code> line, this denotes that
1.1       grant    12323:                   while a package will build against
                   12324:                   tiff&gt;=3.5.4, at least version 3.6.1 is
1.14      xtraeme  12325:                   recommended. <code class=
                   12326:                   "varname">RECOMMENDED</code> entries will be
                   12327:                   turned into dependencies unless explicitly
                   12328:                   ignored (in which case a warning will be
1.36      wiz      12329:                   printed).</p>
                   12330: 
                   12331:                   <p>To ignore these dependency recommendations and
                   12332:                   just use the required <code class=
                   12333:                   "varname">DEPENDS</code>, set <code class=
                   12334:                   "varname">IGNORE_RECOMMENDED=YES</code>. This may
                   12335:                   make it easier and faster to update packages
                   12336:                   built using pkgsrc, since older compatible
                   12337:                   dependencies can continue to be used. This is
                   12338:                   useful for people who watch their rebuilds very
                   12339:                   carefully; it is not very good as a
                   12340:                   general-purpose hammer. If you use it, you need
                   12341:                   to be mindful of possible ABI changes, including
                   12342:                   those from the underlying OS.</p>
                   12343: 
                   12344:                   <p>Packages that are built with recommendations
                   12345:                   ignored may not be uploaded to ftp.NetBSD.org by
                   12346:                   developers and should not be used across
                   12347:                   different systems that may have different
                   12348:                   versions of binary packages installed.</p>
1.1       grant    12349: 
                   12350:                   <p>For security fixes, please update the package
                   12351:                   vulnerabilities file as well as setting
1.14      xtraeme  12352:                   <code class="varname">RECOMMENDED</code>, see
1.1       grant    12353:                   <a href="#security-handling" title=
1.38      dillo    12354:                   "15.1.8.&nbsp;Handling packages with security problems">
1.66    ! rillig   12355:                   Section 15.1.8, &#8220;Handling packages with
        !          12356:                   security problems&#8221;</a> for more
1.1       grant    12357:                   information.</p>
                   12358:                 </li>
                   12359: 
                   12360:                 <li>
                   12361:                   <p>If your package needs some executable to be
1.17      sketch   12362:                   able to run correctly and if there's no
1.45      wiz      12363:                   <code xmlns=
                   12364:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12365:                   "filename">buildlink3.mk</code> file, this is
                   12366:                   specified using the <code class=
1.14      xtraeme  12367:                   "varname">DEPENDS</code> variable. The <a xmlns=
1.1       grant    12368:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   12369:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45      wiz      12370:                   target="_top"><code xmlns="" class=
                   12371:                   "filename">print/lyx</code></a> package needs to
                   12372:                   be able to execute the latex binary from the
                   12373:                   teTeX package when it runs, and that is
                   12374:                   specified:</p>
1.1       grant    12375:                   <pre class="programlisting">
1.51      rillig   12376:     DEPENDS+=        teTeX-[0-9]*:../../print/teTeX
1.1       grant    12377: </pre>
                   12378: 
                   12379:                   <p>The comment about wildcard dependencies from
                   12380:                   previous paragraph applies here, too.</p>
                   12381:                 </li>
                   12382:               </ol>
                   12383:             </div>
                   12384: 
                   12385:             <p>If your package needs files from another package to
                   12386:             build, see the first part of the &#8220;<span class=
                   12387:             "quote">do-configure</span>&#8221; target <a xmlns=
                   12388:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12389:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.45      wiz      12390:             target="_top"><code xmlns="" class=
                   12391:             "filename">print/ghostscript5</code></a> package (it
1.20      ben      12392:             relies on the jpeg sources being present in source form
                   12393:             during the build):</p>
1.1       grant    12394:             <pre class="programlisting">
1.51      rillig   12395:     if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then    \
                   12396:         cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} extract; \
1.1       grant    12397:     fi
                   12398: </pre>
                   12399: 
                   12400:             <p>If you build any other packages that way, please
                   12401:             make sure the working files are deleted too when this
                   12402:             package's working files are cleaned up. The easiest way
                   12403:             to do so is by adding a pre-clean target:</p>
                   12404:             <pre class="programlisting">
1.51      rillig   12405:     pre-clean:
                   12406:             cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} clean
1.1       grant    12407: </pre>
                   12408: 
1.14      xtraeme  12409:             <p>Please also note the <code class=
                   12410:             "varname">BUILD_USES_MSGFMT</code> and <code class=
                   12411:             "varname">BUILD_USES_GETTEXT_M4</code> definitions,
                   12412:             which are provided as convenience definitions. The
1.24      wiz      12413:             former works out whether <a href=
                   12414:             "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
                   12415:             <span class="citerefentry"><span class=
                   12416:             "refentrytitle">msgfmt</span>(1)</span></a> is part of
                   12417:             the base system, and, if it isn't, installs the
                   12418:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12419:             href=
1.1       grant    12420:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.45      wiz      12421:             target="_top"><code xmlns="" class=
                   12422:             "filename">devel/gettext</code></a> package. The latter
1.20      ben      12423:             adds a build dependency on either an installed version
                   12424:             of an older gettext package, or if it isn't, installs
                   12425:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12426:             href=
                   12427:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
1.45      wiz      12428:             target="_top"><code xmlns="" class=
                   12429:             "filename">devel/gettext-m4</code></a> package.</p>
1.1       grant    12430:           </div>
                   12431: 
1.66    ! rillig   12432:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    12433:             <div class="titlepage">
                   12434:               <div>
                   12435:                 <div>
1.66    ! rillig   12436:                   <h3 class="title"><a name="conflicts" id=
1.38      dillo    12437:                   "conflicts"></a>15.1.5.&nbsp;Handling conflicts
1.1       grant    12438:                   with other packages</h3>
                   12439:                 </div>
                   12440:               </div>
                   12441:             </div>
                   12442: 
                   12443:             <p>Your package may conflict with other packages a user
                   12444:             might already have installed on his system, e.g. if
                   12445:             your package installs the same set of files like
                   12446:             another package in our pkgsrc tree.</p>
                   12447: 
1.14      xtraeme  12448:             <p>In this case you can set <code class=
1.47      reed     12449:             "varname">CONFLICTS</code> to a space-separated list of
1.1       grant    12450:             packages (including version string) your package
                   12451:             conflicts with.</p>
                   12452: 
1.47      reed     12453:             <p>For example, <a xmlns=
1.1       grant    12454:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12455:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.45      wiz      12456:             target="_top"><code xmlns="" class=
                   12457:             "filename">x11/Xaw3d</code></a> and <a xmlns=
1.20      ben      12458:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12459:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
1.45      wiz      12460:             target="_top"><code xmlns="" class=
1.47      reed     12461:             "filename">x11/Xaw-Xpm</code></a> install the same
                   12462:             shared library, thus you set in <code xmlns=
1.45      wiz      12463:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      12464:             "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1       grant    12465:             <pre class="programlisting">
1.51      rillig   12466:     CONFLICTS=      Xaw-Xpm-[0-9]*
1.1       grant    12467: </pre>
                   12468: 
1.45      wiz      12469:             <p>and in <code xmlns=
                   12470:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12471:             "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1       grant    12472:             <pre class="programlisting">
1.51      rillig   12473:     CONFLICTS=      Xaw3d-[0-9]*
1.1       grant    12474: </pre>
                   12475: 
                   12476:             <p>Packages will automatically conflict with other
                   12477:             packages with the name prefix and a different version
                   12478:             string. &#8220;<span class=
                   12479:             "quote">Xaw3d-1.5</span>&#8221; e.g. will automatically
                   12480:             conflict with the older version &#8220;<span class=
                   12481:             "quote">Xaw3d-1.3</span>&#8221;.</p>
                   12482:           </div>
                   12483: 
1.66    ! rillig   12484:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    12485:             <div class="titlepage">
                   12486:               <div>
                   12487:                 <div>
1.66    ! rillig   12488:                   <h3 class="title"><a name="not-building-packages"
        !          12489:                   id=
1.38      dillo    12490:                   "not-building-packages"></a>15.1.6.&nbsp;Packages
1.30      wiz      12491:                   that cannot or should not be built</h3>
1.1       grant    12492:                 </div>
                   12493:               </div>
                   12494:             </div>
                   12495: 
                   12496:             <p>There are several reasons why a package might be
                   12497:             instructed to not build under certain circumstances. If
                   12498:             the package builds and runs on most platforms, the
1.14      xtraeme  12499:             exceptions should be noted with <code class=
                   12500:             "varname">NOT_FOR_PLATFORM</code>. If the package
                   12501:             builds and runs on a small handful of platforms, set
                   12502:             <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.45      wiz      12503:             Both <code class="varname">ONLY_FOR_PLATFORM</code> and
                   12504:             <code class="varname">NOT_FOR_PLATFORM</code> are OS
                   12505:             triples (OS-version-platform) that can use glob-style
                   12506:             wildcards.</p>
                   12507: 
                   12508:             <p>If the package should be skipped (for example,
                   12509:             because it provides functionality already provided by
                   12510:             the system), set <code class=
1.14      xtraeme  12511:             "varname">PKG_SKIP_REASON</code> to a descriptive
                   12512:             message. If the package should fail because some
                   12513:             preconditions are not met, set <code class=
                   12514:             "varname">PKG_FAIL_REASON</code> to a descriptive
1.1       grant    12515:             message.</p>
                   12516:           </div>
                   12517: 
1.66    ! rillig   12518:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    12519:             <div class="titlepage">
                   12520:               <div>
                   12521:                 <div>
1.66    ! rillig   12522:                   <h3 class="title"><a name="undeletable-packages"
        !          12523:                   id=
1.38      dillo    12524:                   "undeletable-packages"></a>15.1.7.&nbsp;Packages
1.30      wiz      12525:                   which should not be deleted, once installed</h3>
1.1       grant    12526:                 </div>
                   12527:               </div>
                   12528:             </div>
                   12529: 
                   12530:             <p>To ensure that a package may not be deleted, once it
1.14      xtraeme  12531:             has been installed, the <code class=
                   12532:             "varname">PKG_PRESERVE</code> definition should be set
                   12533:             in the package Makefile. This will be carried into any
1.1       grant    12534:             binary package that is made from this pkgsrc entry. A
                   12535:             &#8220;<span class="quote">preserved</span>&#8221;
                   12536:             package will not be deleted using <a href=
                   12537:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   12538:             <span class="citerefentry"><span class=
                   12539:             "refentrytitle">pkg_delete</span>(1)</span></a> unless
                   12540:             the &#8220;<span class="quote">-f</span>&#8221; option
                   12541:             is used.</p>
                   12542:           </div>
                   12543: 
1.66    ! rillig   12544:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    12545:             <div class="titlepage">
                   12546:               <div>
                   12547:                 <div>
1.66    ! rillig   12548:                   <h3 class="title"><a name="security-handling" id=
1.38      dillo    12549:                   "security-handling"></a>15.1.8.&nbsp;Handling
1.1       grant    12550:                   packages with security problems</h3>
                   12551:                 </div>
                   12552:               </div>
                   12553:             </div>
                   12554: 
                   12555:             <p>When a vulnerability is found, this should be noted
1.45      wiz      12556:             in <code xmlns=
                   12557:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12558:             "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.43      wiz      12559:             and after committing that file, use
                   12560:             <span><strong class="command">make
                   12561:             upload</strong></span> in the same directory to update
                   12562:             the file on ftp.NetBSD.org.</p>
                   12563: 
                   12564:             <p>After fixing the vulnerability by a patch, its
                   12565:             <code class="varname">PKGREVISION</code> should be
                   12566:             increased (this is of course not necessary if the
                   12567:             problem is fixed by using a newer release of the
1.45      wiz      12568:             software). In addition, if a <code xmlns=
                   12569:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12570:             "filename">buildlink3.mk</code> file exists for an
1.43      wiz      12571:             affected package, a corresponding <code class=
1.14      xtraeme  12572:             "varname">BUILDLINK_RECOMMENDED.<em class=
                   12573:             "replaceable"><code>pkg</code></em></code> entry should
1.43      wiz      12574:             be added or updated in it.</p>
1.1       grant    12575: 
                   12576:             <p>Also, if the fix should be applied to the stable
                   12577:             pkgsrc branch, be sure to submit a pullup request!</p>
1.43      wiz      12578: 
                   12579:             <p>Binary packages already on ftp.NetBSD.org will be
                   12580:             handled semi-automatically by a weekly cron job.</p>
1.1       grant    12581:           </div>
                   12582: 
1.66    ! rillig   12583:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    12584:             <div class="titlepage">
                   12585:               <div>
                   12586:                 <div>
1.66    ! rillig   12587:                   <h3 class="title"><a name="compiler-bugs" id=
1.38      dillo    12588:                   "compiler-bugs"></a>15.1.9.&nbsp;How to handle
1.1       grant    12589:                   compiler bugs</h3>
                   12590:                 </div>
                   12591:               </div>
                   12592:             </div>
                   12593: 
                   12594:             <p>Some source files trigger bugs in the compiler,
                   12595:             based on combinations of compiler version and
                   12596:             architecture and almost always relation to optimisation
                   12597:             being enabled. Common symptoms are gcc internal errors
                   12598:             or never finishing compiling a file.</p>
                   12599: 
1.47      reed     12600:             <p>Typically, a workaround involves testing the
1.14      xtraeme  12601:             <code class="varname">MACHINE_ARCH</code> and compiler
1.1       grant    12602:             version, disabling optimisation for that
1.14      xtraeme  12603:             file/<code class="varname">MACHINE_ARCH</code>/compiler
1.45      wiz      12604:             combination, and documenting it in <code xmlns=
                   12605:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12606:             "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1       grant    12607:             number of examples!</p>
                   12608:           </div>
                   12609: 
1.66    ! rillig   12610:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    12611:             <div class="titlepage">
                   12612:               <div>
                   12613:                 <div>
1.66    ! rillig   12614:                   <h3 class="title"><a name="bumping-pkgrevision"
        !          12615:                   id="bumping-pkgrevision"></a>15.1.10.&nbsp;How to
1.30      wiz      12616:                   handle incrementing versions when fixing an
                   12617:                   existing package</h3>
1.1       grant    12618:                 </div>
                   12619:               </div>
                   12620:             </div>
                   12621: 
                   12622:             <p>When making fixes to an existing package it can be
1.14      xtraeme  12623:             useful to change the version number in <code class=
                   12624:             "varname">PKGNAME</code>. To avoid conflicting with
1.1       grant    12625:             future versions by the original author, a
                   12626:             &#8220;<span class="quote">nb1</span>&#8221;,
                   12627:             &#8220;<span class="quote">nb2</span>&#8221;, ...
                   12628:             suffix can be used on package versions by setting
1.14      xtraeme  12629:             <code class="varname">PKGREVISION=1</code> (2, ...).
                   12630:             The &#8220;<span class="quote">nb</span>&#8221; is
                   12631:             treated like a &#8220;<span class=
                   12632:             "quote">.</span>&#8221; by the pkg tools. e.g.</p>
1.1       grant    12633:             <pre class="programlisting">
1.51      rillig   12634:     DISTNAME=       foo-17.42
                   12635:     PKGREVISION=    9
1.1       grant    12636: </pre>
                   12637: 
1.14      xtraeme  12638:             <p>will result in a <code class=
                   12639:             "varname">PKGNAME</code> of &#8220;<span class=
1.1       grant    12640:             "quote">foo-17.42nb9</span>&#8221;.</p>
                   12641: 
                   12642:             <p>When a new release of the package is released, the
1.14      xtraeme  12643:             <code class="varname">PKGREVISION</code> should be
1.47      reed     12644:             removed, e.g. on a new minor release of the above
1.14      xtraeme  12645:             package, things should be like:</p>
1.1       grant    12646:             <pre class="programlisting">
1.51      rillig   12647:     DISTNAME=       foo-17.43
1.1       grant    12648: </pre>
                   12649:           </div>
                   12650: 
1.66    ! rillig   12651:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    12652:             <div class="titlepage">
                   12653:               <div>
                   12654:                 <div>
1.30      wiz      12655:                   <h3 class="title"><a name=
1.66    ! rillig   12656:                   "portability-of-packages" id=
1.38      dillo    12657:                   "portability-of-packages"></a>15.1.11.&nbsp;Portability
1.30      wiz      12658:                   of packages</h3>
1.1       grant    12659:                 </div>
                   12660:               </div>
                   12661:             </div>
                   12662: 
                   12663:             <p>One appealing feature of pkgsrc is that it runs on
                   12664:             many different platforms. As a result, it is important
                   12665:             to ensure, where possible, that packages in pkgsrc are
                   12666:             portable. There are some particular details you should
                   12667:             pay attention to while working on pkgsrc.</p>
                   12668: 
1.66    ! rillig   12669:             <div class="sect3" lang="en" xml:lang="en">
1.1       grant    12670:               <div class="titlepage">
                   12671:                 <div>
                   12672:                   <div>
1.66    ! rillig   12673:                     <h4 class="title"><a name="install-scripts" id=
1.38      dillo    12674:                     "install-scripts"></a>15.1.11.1.&nbsp;${INSTALL},
1.1       grant    12675:                     ${INSTALL_DATA_DIR}, ...</h4>
                   12676:                   </div>
                   12677:                 </div>
                   12678:               </div>
                   12679: 
1.14      xtraeme  12680:               <p>The BSD-compatible <span><strong class=
                   12681:               "command">install</strong></span> supplied with some
1.1       grant    12682:               operating systems will not perform more than one
                   12683:               operation at a time. As such, you should call
                   12684:               &#8220;<span class="quote">${INSTALL}</span>&#8221;,
                   12685:               etc. like this:</p>
                   12686:               <pre class="programlisting">
1.51      rillig   12687:     ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   12688:     ${INSTALL_DATA_DIR} ${PREFIX}/dir2
1.1       grant    12689: </pre>
                   12690:             </div>
                   12691:           </div>
                   12692:         </div>
                   12693: 
1.66    ! rillig   12694:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    12695:           <div class="titlepage">
                   12696:             <div>
                   12697:               <div>
                   12698:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   12699:                 "downloading-issues" id=
1.38      dillo    12700:                 "downloading-issues"></a>15.2.&nbsp;Possible
1.1       grant    12701:                 downloading issues</h2>
                   12702:               </div>
                   12703:             </div>
                   12704:           </div>
                   12705: 
1.66    ! rillig   12706:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    12707:             <div class="titlepage">
                   12708:               <div>
                   12709:                 <div>
1.66    ! rillig   12710:                   <h3 class="title"><a name="no-plain-download" id=
1.38      dillo    12711:                   "no-plain-download"></a>15.2.1.&nbsp;Packages
1.30      wiz      12712:                   whose distfiles aren't available for plain
1.1       grant    12713:                   downloading</h3>
                   12714:                 </div>
                   12715:               </div>
                   12716:             </div>
                   12717: 
                   12718:             <p>If you need to download from a dynamic URL you can
1.14      xtraeme  12719:             set <code class="varname">DYNAMIC_MASTER_SITES</code>
                   12720:             and a <span><strong class="command">make
1.45      wiz      12721:             fetch</strong></span> will call <code xmlns=
                   12722:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12723:             "filename">files/getsite.sh</code> with the name of
                   12724:             each file to download as an argument, expecting it to
                   12725:             output the URL of the directory from which to download
                   12726:             it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12727:             href=
1.1       grant    12728:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.45      wiz      12729:             target="_top"><code xmlns="" class=
                   12730:             "filename">graphics/ns-cult3d</code></a> is an example
                   12731:             of this usage.</p>
1.1       grant    12732: 
                   12733:             <p>If the download can't be automated, because the user
                   12734:             must submit personal information to apply for a
                   12735:             password, or must pay for the source, or whatever, you
1.14      xtraeme  12736:             can set <code class="varname">_FETCH_MESSAGE</code> to
                   12737:             a macro which displays a message explaining the
                   12738:             situation. <code class="varname">_FETCH_MESSAGE</code>
                   12739:             must be executable shell commands, not just a message.
                   12740:             (Generally, it executes <code class=
                   12741:             "varname">${ECHO}</code>). As of this writing, the
1.1       grant    12742:             following packages use this: <a xmlns=
                   12743:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.20      ben      12744:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
1.45      wiz      12745:             target="_top"><code xmlns="" class=
                   12746:             "filename">cad/simian</code></a>, <a xmlns=
1.20      ben      12747:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12748:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
1.45      wiz      12749:             target="_top"><code xmlns="" class=
                   12750:             "filename">devel/ipv6socket</code></a>, <a xmlns=
1.20      ben      12751:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12752:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
1.45      wiz      12753:             target="_top"><code xmlns="" class=
                   12754:             "filename">emulators/vmware-module</code></a>,
                   12755:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12756:             href=
1.20      ben      12757:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
1.45      wiz      12758:             target="_top"><code xmlns="" class=
                   12759:             "filename">fonts/acroread-jpnfont</code></a>, <a xmlns=
1.20      ben      12760:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.43      wiz      12761:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/multimedia/realplayer/README.html"
1.45      wiz      12762:             target="_top"><code xmlns="" class=
                   12763:             "filename">multimedia/realplayer</code></a>, <a xmlns=
1.43      wiz      12764:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.20      ben      12765:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
1.45      wiz      12766:             target="_top"><code xmlns="" class=
                   12767:             "filename">sysutils/storage-manager</code></a>,
                   12768:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12769:             href=
1.20      ben      12770:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
1.45      wiz      12771:             target="_top"><code xmlns="" class=
                   12772:             "filename">www/ap-aolserver</code></a>, <a xmlns=
1.20      ben      12773:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12774:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
1.45      wiz      12775:             target="_top"><code xmlns="" class=
                   12776:             "filename">www/openacs</code></a>. Try to be consistent
1.20      ben      12777:             with them.</p>
1.1       grant    12778:           </div>
                   12779: 
1.66    ! rillig   12780:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    12781:             <div class="titlepage">
                   12782:               <div>
                   12783:                 <div>
1.30      wiz      12784:                   <h3 class="title"><a name=
1.66    ! rillig   12785:                   "modified-distfiles-same-name" id=
1.38      dillo    12786:                   "modified-distfiles-same-name"></a>15.2.2.&nbsp;How
1.30      wiz      12787:                   to handle modified distfiles with the 'old'
                   12788:                   name</h3>
1.1       grant    12789:                 </div>
                   12790:               </div>
                   12791:             </div>
                   12792: 
                   12793:             <p>Sometimes authors of a software package make some
                   12794:             modifications after the software was released, and they
                   12795:             put up a new distfile without changing the package's
                   12796:             version number. If a package is already in pkgsrc at
1.32      wiz      12797:             that time, the checksum will no longer match. The
                   12798:             contents of the new distfile should be compared against
                   12799:             the old one before changing anything, to make sure the
                   12800:             distfile was really updated on purpose, and that no
                   12801:             trojan horse or so crept in. Then, the correct way to
                   12802:             work around this is to set <code class=
                   12803:             "varname">DIST_SUBDIR</code> to a unique directory
                   12804:             name, usually based on <code class=
                   12805:             "varname">PKGNAME_NOREV</code>. In case this happens
                   12806:             more often, <code class="varname">PKGNAME</code> can be
1.45      wiz      12807:             used (thus including the <code xmlns=
                   12808:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.32      wiz      12809:             "filename">nbX</code> suffix) or a date stamp can be
                   12810:             appended, like <code class=
                   12811:             "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
1.45      wiz      12812:             forget regenerating the <code xmlns=
                   12813:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.32      wiz      12814:             "filename">distinfo</code> file after that, since it
                   12815:             contains the <code class="varname">DIST_SUBDIR</code>
                   12816:             path in the filenames. Furthermore, a mail to the
                   12817:             package's authors seems appropriate telling them that
                   12818:             changing distfiles after releases without changing the
                   12819:             file names is not good practice.</p>
1.1       grant    12820:           </div>
                   12821:         </div>
                   12822: 
1.66    ! rillig   12823:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    12824:           <div class="titlepage">
                   12825:             <div>
                   12826:               <div>
                   12827:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   12828:                 "configuration-gotchas" id=
1.38      dillo    12829:                 "configuration-gotchas"></a>15.3.&nbsp;Configuration
1.1       grant    12830:                 gotchas</h2>
                   12831:               </div>
                   12832:             </div>
                   12833:           </div>
                   12834: 
1.66    ! rillig   12835:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    12836:             <div class="titlepage">
                   12837:               <div>
                   12838:                 <div>
1.66    ! rillig   12839:                   <h3 class="title"><a name="fixes.libtool" id=
1.38      dillo    12840:                   "fixes.libtool"></a>15.3.1.&nbsp;Shared libraries
1.1       grant    12841:                   - libtool</h3>
                   12842:                 </div>
                   12843:               </div>
                   12844:             </div>
                   12845: 
                   12846:             <p>pkgsrc supports many different machines, with
                   12847:             different object formats like a.out and ELF, and
                   12848:             varying abilities to do shared library and dynamic
                   12849:             loading at all. To accompany this, varying commands and
                   12850:             options have to be passed to the compiler, linker, etc.
                   12851:             to get the Right Thing, which can be pretty annoying
                   12852:             especially if you don't have all the machines at your
                   12853:             hand to test things. The <a xmlns=
                   12854:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12855:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.45      wiz      12856:             target="_top"><code xmlns="" class=
                   12857:             "filename">devel/libtool</code></a> pkg can help here,
                   12858:             as it just &#8220;<span class=
                   12859:             "quote">knows</span>&#8221; how to build both static
                   12860:             and dynamic libraries from a set of source files, thus
1.47      reed     12861:             being platform-independent.</p>
1.1       grant    12862: 
                   12863:             <p>Here's how to use libtool in a pkg in seven simple
                   12864:             steps:</p>
                   12865: 
                   12866:             <div class="orderedlist">
                   12867:               <ol type="1">
                   12868:                 <li>
1.14      xtraeme  12869:                   <p>Add <code class=
                   12870:                   "varname">USE_LIBTOOL=yes</code> to the package
                   12871:                   Makefile.</p>
1.1       grant    12872:                 </li>
                   12873: 
                   12874:                 <li>
                   12875:                   <p>For library objects, use &#8220;<span class=
                   12876:                   "quote">${LIBTOOL} --mode=compile
                   12877:                   ${CC}</span>&#8221; in place of
                   12878:                   &#8220;<span class="quote">${CC}</span>&#8221;.
                   12879:                   You could even add it to the definition of
1.14      xtraeme  12880:                   <code class="varname">CC</code>, if only
                   12881:                   libraries are being built in a given Makefile.
                   12882:                   This one command will build both PIC and non-PIC
                   12883:                   library objects, so you need not have separate
                   12884:                   shared and non-shared library rules.</p>
1.1       grant    12885:                 </li>
                   12886: 
                   12887:                 <li>
                   12888:                   <p>For the linking of the library, remove any
                   12889:                   &#8220;<span class="quote">ar</span>&#8221;,
                   12890:                   &#8220;<span class="quote">ranlib</span>&#8221;,
                   12891:                   and &#8220;<span class="quote">ld
                   12892:                   -Bshareable</span>&#8221; commands, and instead
                   12893:                   use:</p>
                   12894:                   <pre class="programlisting">
1.51      rillig   12895:     ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} \
                   12896:         -rpath ${PREFIX}/lib -version-info major:minor
1.1       grant    12897: </pre>
                   12898: 
                   12899:                   <p>Note that the library is changed to have a
1.45      wiz      12900:                   <code xmlns=
                   12901:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12902:                   "filename">.la</code> extension, and the objects
                   12903:                   are changed to have a <code xmlns=
                   12904:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12905:                   "filename">.lo</code> extension. Change
                   12906:                   <code class="varname">OBJS</code> as necessary.
                   12907:                   This automatically creates all of the
1.45      wiz      12908:                   <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12909:                   class="filename">.a</code>, <code xmlns=
                   12910:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12911:                   "filename">.so.major.minor</code>, and ELF
                   12912:                   symlinks (if necessary) in the build directory.
                   12913:                   Be sure to include &#8220;<span class=
1.1       grant    12914:                   "quote">-version-info</span>&#8221;, especially
                   12915:                   when major and minor are zero, as libtool will
                   12916:                   otherwise strip off the shared library
                   12917:                   version.</p>
                   12918: 
                   12919:                   <p>From the libtool manual:</p>
                   12920:                   <pre class="programlisting">
1.51      rillig   12921:     So, libtool library versions are described by three integers:
1.1       grant    12922: 
1.51      rillig   12923:     CURRENT
                   12924:         The most recent interface number that this library implements.
1.1       grant    12925: 
1.51      rillig   12926:     REVISION
                   12927:         The implementation number of the CURRENT interface.
1.1       grant    12928: 
1.51      rillig   12929:     AGE
                   12930:         The difference between the newest and oldest interfaces that
                   12931:         this library implements.  In other words, the library implements
                   12932:         all the interface numbers in the range from number `CURRENT -
                   12933:         AGE' to `CURRENT'.
1.1       grant    12934:        
1.51      rillig   12935:     If two libraries have identical CURRENT and AGE numbers, then the
                   12936:     dynamic linker chooses the library with the greater REVISION number.
1.1       grant    12937: </pre>
                   12938: 
                   12939:                   <p>The &#8220;<span class=
                   12940:                   "quote">-release</span>&#8221; option will
                   12941:                   produce different results for a.out and ELF
                   12942:                   (excluding symlinks) in only one case. An ELF
                   12943:                   library of the form &#8220;<span class=
                   12944:                   "quote">libfoo-release.so.<span class=
                   12945:                   "emphasis"><em>x</em></span>.<span class=
                   12946:                   "emphasis"><em>y</em></span></span>&#8221; will
                   12947:                   have a symlink of &#8220;<span class=
                   12948:                   "quote">libfoo.so.<span class=
                   12949:                   "emphasis"><em>x</em></span>.<span class=
                   12950:                   "emphasis"><em>y</em></span></span>&#8221; on an
                   12951:                   a.out platform. This is handled
                   12952:                   automatically.</p>
                   12953: 
                   12954:                   <p>The &#8220;<span class="quote">-rpath
                   12955:                   argument</span>&#8221; is the install directory
                   12956:                   of the library being built.</p>
                   12957: 
1.45      wiz      12958:                   <p>In the <code xmlns=
                   12959:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12960:                   "filename">PLIST</code>, include only the
                   12961:                   <code xmlns=
                   12962:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.19      hubertf  12963:                   "filename">.la</code> file, the other files will
                   12964:                   be added automatically.</p>
1.1       grant    12965:                 </li>
                   12966: 
                   12967:                 <li>
1.45      wiz      12968:                   <p>When linking shared object (<code xmlns=
                   12969:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12970:                   "filename">.so</code>) files, i.e. files that are
1.24      wiz      12971:                   loaded via <a href=
                   12972:                   "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
                   12973:                   <span class="citerefentry"><span class=
                   12974:                   "refentrytitle">dlopen</span>(3)</span></a>, NOT
                   12975:                   shared libraries, use &#8220;<span class=
                   12976:                   "quote">-module -avoid-version</span>&#8221; to
                   12977:                   prevent them getting version tacked on.</p>
1.1       grant    12978: 
1.45      wiz      12979:                   <p>The <code xmlns=
                   12980:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12981:                   "filename">PLIST</code> file gets the
                   12982:                   <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12983:                   class="filename">foo.so</code> entry.</p>
1.1       grant    12984:                 </li>
                   12985: 
                   12986:                 <li>
                   12987:                   <p>When linking programs that depend on these
                   12988:                   libraries <span class=
                   12989:                   "emphasis"><em>before</em></span> they are
                   12990:                   installed, preface the <a href=
                   12991:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
                   12992:                   <span class="citerefentry"><span class=
                   12993:                   "refentrytitle">cc</span>(1)</span></a> or
                   12994:                   <a href=
                   12995:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   12996:                   <span class="citerefentry"><span class=
                   12997:                   "refentrytitle">ld</span>(1)</span></a> line with
                   12998:                   &#8220;<span class="quote">${LIBTOOL}
                   12999:                   --mode=link</span>&#8221;, and it will find the
                   13000:                   correct libraries (static or shared), but please
                   13001:                   be aware that libtool will not allow you to
                   13002:                   specify a relative path in -L (such as
                   13003:                   &#8220;<span class=
                   13004:                   "quote">-L../somelib</span>&#8221;), because it
                   13005:                   expects you to change that argument to be the
1.45      wiz      13006:                   <code xmlns=
                   13007:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13008:                   "filename">.la</code> file. e.g.</p>
1.1       grant    13009:                   <pre class="programlisting">
1.51      rillig   13010:     ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
1.1       grant    13011: </pre>
                   13012: 
                   13013:                   <p>should be changed to:</p>
                   13014:                   <pre class="programlisting">
1.51      rillig   13015:     ${LIBTOOL} --mode=link ${CC} -o <em class=
1.14      xtraeme  13016: "replaceable"><code>someprog</code></em> <em class=
                   13017: "replaceable"><code>../somelib/somelib.la</code></em>
1.1       grant    13018: </pre>
                   13019: 
                   13020:                   <p>and it will do the right thing with the
                   13021:                   libraries.</p>
                   13022:                 </li>
                   13023: 
                   13024:                 <li>
                   13025:                   <p>When installing libraries, preface the
                   13026:                   <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   13027:                   <span class="citerefentry"><span class=
                   13028:                   "refentrytitle">install</span>(1)</span></a> or
                   13029:                   <a href=
                   13030:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
                   13031:                   <span class="citerefentry"><span class=
                   13032:                   "refentrytitle">cp</span>(1)</span></a> command
                   13033:                   with &#8220;<span class="quote">${LIBTOOL}
                   13034:                   --mode=install</span>&#8221;, and change the
1.45      wiz      13035:                   library name to <code xmlns=
                   13036:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13037:                   "filename">.la</code>. e.g.</p>
1.1       grant    13038:                   <pre class="programlisting">
1.51      rillig   13039:     ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1       grant    13040: </pre>
                   13041: 
1.45      wiz      13042:                   <p>This will install the static <code xmlns=
                   13043:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13044:                   "filename">.a</code>, shared library, any needed
1.1       grant    13045:                   symlinks, and run <a href=
                   13046:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
                   13047:                   <span class="citerefentry"><span class=
                   13048:                   "refentrytitle">ldconfig</span>(8)</span></a>.</p>
                   13049:                 </li>
                   13050: 
                   13051:                 <li>
1.45      wiz      13052:                   <p>In your <code xmlns=
                   13053:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13054:                   "filename">PLIST</code>, include only the
                   13055:                   <code xmlns=
                   13056:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.23      wiz      13057:                   "filename">.la</code> file (this is a change from
                   13058:                   previous behaviour).</p>
1.1       grant    13059:                 </li>
                   13060:               </ol>
                   13061:             </div>
                   13062:           </div>
                   13063: 
1.66    ! rillig   13064:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    13065:             <div class="titlepage">
                   13066:               <div>
                   13067:                 <div>
1.66    ! rillig   13068:                   <h3 class="title"><a name="using-libtool" id=
1.38      dillo    13069:                   "using-libtool"></a>15.3.2.&nbsp;Using libtool on
1.30      wiz      13070:                   GNU packages that already support libtool</h3>
1.1       grant    13071:                 </div>
                   13072:               </div>
                   13073:             </div>
                   13074: 
1.14      xtraeme  13075:             <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
                   13076:             the package Makefile. This will override the package's
                   13077:             own libtool in most cases. For older libtool using
1.1       grant    13078:             packages, libtool is made by ltconfig script during the
                   13079:             do-configure step; you can check the libtool script
1.14      xtraeme  13080:             location by doing <span><strong class="command">make
                   13081:             configure; find work*/ -name
                   13082:             libtool</strong></span>.</p>
                   13083: 
                   13084:             <p><code class="varname">LIBTOOL_OVERRIDE</code>
                   13085:             specifies which libtool scripts, relative to
                   13086:             <code class="varname">WRKSRC</code>, to override. By
                   13087:             default, it is set to &#8220;<span class=
                   13088:             "quote">libtool */libtool */*/libtool</span>&#8221;. If
                   13089:             this does not match the location of the package's
                   13090:             libtool script(s), set it as appropriate.</p>
1.13      hubertf  13091: 
1.45      wiz      13092:             <p>If you do not need <code xmlns=
                   13093:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13094:             "filename">*.a</code> static libraries built and
                   13095:             installed, then use <code class=
                   13096:             "varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.1       grant    13097: 
1.47      reed     13098:             <p>If your package makes use of the
                   13099:             platform-independent library for loading dynamic shared
                   13100:             objects, that comes with libtool (libltdl), you should
                   13101:             include devel/libltdl/buildlink3.mk.</p>
1.1       grant    13102: 
                   13103:             <p>Some packages use libtool incorrectly so that the
                   13104:             package may not work or build in some circumstances.
                   13105:             Some of the more common errors are:</p>
                   13106: 
                   13107:             <div class="itemizedlist">
                   13108:               <ul type="disc">
                   13109:                 <li>
                   13110:                   <p>The inclusion of a shared object (-module) as
                   13111:                   a dependent library in an executable or library.
                   13112:                   This in itself isn't a problem if one of two
                   13113:                   things has been done:</p>
                   13114: 
                   13115:                   <div class="orderedlist">
                   13116:                     <ol type="1">
                   13117:                       <li>
                   13118:                         <p>The shared object is named correctly,
1.45      wiz      13119:                         i.e. <code xmlns=
                   13120:                         "http://www.w3.org/TR/xhtml1/transitional"
                   13121:                         class="filename">libfoo.la</code>, not
                   13122:                         <code xmlns=
                   13123:                         "http://www.w3.org/TR/xhtml1/transitional"
                   13124:                         class="filename">foo.la</code></p>
1.1       grant    13125:                       </li>
                   13126: 
                   13127:                       <li>
                   13128:                         <p>The -dlopen option is used when linking
                   13129:                         an executable.</p>
                   13130:                       </li>
                   13131:                     </ol>
                   13132:                   </div>
                   13133:                 </li>
                   13134: 
                   13135:                 <li>
                   13136:                   <p>The use of libltdl without the correct calls
                   13137:                   to initialisation routines. The function
                   13138:                   lt_dlinit() should be called and the macro
1.14      xtraeme  13139:                   <code class=
                   13140:                   "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1       grant    13141:                   included in executables.</p>
                   13142:                 </li>
                   13143:               </ul>
                   13144:             </div>
                   13145:           </div>
                   13146: 
1.66    ! rillig   13147:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    13148:             <div class="titlepage">
                   13149:               <div>
                   13150:                 <div>
1.66    ! rillig   13151:                   <h3 class="title"><a name="autoconf-automake" id=
1.38      dillo    13152:                   "autoconf-automake"></a>15.3.3.&nbsp;GNU
1.1       grant    13153:                   Autoconf/Automake</h3>
                   13154:                 </div>
                   13155:               </div>
                   13156:             </div>
                   13157: 
                   13158:             <p>If a package needs GNU autoconf or automake to be
                   13159:             executed to regenerate the configure script and
                   13160:             Makefile.in makefile templates, then they should be
1.35      jmmv     13161:             executed in a pre-configure target.</p>
1.1       grant    13162: 
                   13163:             <p>For packages that need only autoconf:</p>
                   13164:             <pre class="programlisting">
1.51      rillig   13165:     AUTOCONF_REQD=  2.50            # if default version is not good enough
                   13166:     USE_TOOLS+=     autoconf        # use "autoconf213" for autoconf-2.13
                   13167:     ...
1.1       grant    13168: 
1.51      rillig   13169:     pre-configure:
                   13170:             cd ${WRKSRC}; autoconf
1.1       grant    13171: 
1.51      rillig   13172:     ...
1.1       grant    13173: </pre>
                   13174: 
                   13175:             <p>and for packages that need automake and
                   13176:             autoconf:</p>
                   13177:             <pre class="programlisting">
1.51      rillig   13178:     AUTOMAKE_REQD=  1.7.1           # if default version is not good enough
                   13179:     USE_TOOLS+=     automake        # use "automake14" for automake-1.4
                   13180:     ...
1.1       grant    13181: 
1.51      rillig   13182:     pre-configure:
                   13183:             cd ${WRKSRC};                          \
                   13184:             aclocal; autoheader;                   \
                   13185:             automake -a --foreign -i; autoconf
                   13186: 
                   13187:     ...
1.1       grant    13188: </pre>
                   13189: 
                   13190:             <p>Packages which use GNU Automake will almost
1.35      jmmv     13191:             certainly require GNU Make.</p>
1.1       grant    13192: 
                   13193:             <p>There are times when the configure process makes
                   13194:             additional changes to the generated files, which then
                   13195:             causes the build process to try to re-execute the
                   13196:             automake sequence. This is prevented by touching
                   13197:             various files in the configure stage. If this causes
1.14      xtraeme  13198:             problems with your package you can set <code class=
                   13199:             "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1       grant    13200:             Makefile.</p>
                   13201:           </div>
                   13202:         </div>
                   13203: 
1.66    ! rillig   13204:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    13205:           <div class="titlepage">
                   13206:             <div>
                   13207:               <div>
                   13208:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   13209:                 "fixes-build" id=
1.55      rillig   13210:                 "fixes-build"></a>15.4.&nbsp;Building the
                   13211:                 package</h2>
1.1       grant    13212:               </div>
                   13213:             </div>
                   13214:           </div>
                   13215: 
1.66    ! rillig   13216:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    13217:             <div class="titlepage">
                   13218:               <div>
                   13219:                 <div>
1.66    ! rillig   13220:                   <h3 class="title"><a name="cpp-defines" id=
1.38      dillo    13221:                   "cpp-defines"></a>15.4.1.&nbsp;CPP defines</h3>
1.1       grant    13222:                 </div>
                   13223:               </div>
                   13224:             </div>
                   13225: 
1.55      rillig   13226:             <p>Sometimes you need to compile different code
                   13227:             depending on the target platform. The C preprocessor
                   13228:             has a set of predefined macros that can be queried by
                   13229:             using <code class="varname">#ifdef FOO</code> or
                   13230:             <code class="varname">#if defined(FOO)</code>. Among
                   13231:             these macros are usually ones that describe the target
                   13232:             CPU and operating system. Depending of which of the
                   13233:             macros are defined, you can write code that uses
1.61      rillig   13234:             features unique to a specific platform. Generally you
                   13235:             should rather use the GNU autotools (automake,
                   13236:             autoconf, etc.) to check for specific features (like
                   13237:             the existence of a header file, a function or a
                   13238:             library), but sometimes this is not possible or
                   13239:             desired.</p>
                   13240: 
                   13241:             <p>In that case you can use the predefined macros below
                   13242:             to configure your code to the platform it runs on.
                   13243:             Almost every operating system, hardware architecture
                   13244:             and compiler has its own macro. For example, if the
                   13245:             macros <code class="varname">__GNUC__</code>,
                   13246:             <code class="varname">__i386__</code> and <code class=
1.55      rillig   13247:             "varname">__NetBSD__</code> are all defined, you know
1.61      rillig   13248:             that you are using NetBSD on an i386 compatible CPU,
                   13249:             and your compiler is GCC.</p>
1.55      rillig   13250: 
1.66    ! rillig   13251:             <div class="sect3" lang="en" xml:lang="en">
1.55      rillig   13252:               <div class="titlepage">
                   13253:                 <div>
                   13254:                   <div>
                   13255:                     <h4 class="title"><a name=
1.66    ! rillig   13256:                     "fixes-build-cpp-opsys" id=
1.55      rillig   13257:                     "fixes-build-cpp-opsys"></a>15.4.1.1.&nbsp;CPP
                   13258:                     defines for operating systems</h4>
                   13259:                   </div>
                   13260:                 </div>
                   13261:               </div>
                   13262: 
                   13263:               <p>To distinguish between 4.4 BSD-derived systems and
                   13264:               the rest of the world, you should use the following
                   13265:               code.</p>
                   13266:               <pre class="programlisting">
1.51      rillig   13267:     #include &lt;sys/param.h&gt;
1.55      rillig   13268:     #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
1.60      rillig   13269:       /* BSD-specific code goes here */
1.55      rillig   13270:     #else
1.60      rillig   13271:       /* non-BSD-specific code goes here */
1.55      rillig   13272:     #endif
1.1       grant    13273: </pre>
                   13274: 
1.55      rillig   13275:               <p>If this distinction is not fine enough, you can
                   13276:               also use the following defines.</p>
                   13277:               <pre class="programlisting">
                   13278:     FreeBSD     __FreeBSD__
1.56      rillig   13279:     DragonFly   __DragonFly__
1.57      minskim  13280:     Interix     __INTERIX
1.55      rillig   13281:     Linux       linux, __linux, __linux__
                   13282:     NetBSD      __NetBSD__
                   13283:     OpenBSD     __OpenBSD__
1.60      rillig   13284:     Solaris     sun, __sun
1.1       grant    13285: </pre>
1.55      rillig   13286:             </div>
1.1       grant    13287: 
1.66    ! rillig   13288:             <div class="sect3" lang="en" xml:lang="en">
1.55      rillig   13289:               <div class="titlepage">
                   13290:                 <div>
                   13291:                   <div>
1.66    ! rillig   13292:                     <h4 class="title"><a name="fixes-build-cpp-cpu"
        !          13293:                     id="fixes-build-cpp-cpu"></a>15.4.1.2.&nbsp;CPP
1.55      rillig   13294:                     defines for CPUs</h4>
                   13295:                   </div>
                   13296:                 </div>
                   13297:               </div>
                   13298:               <pre class="programlisting">
                   13299:     i386        i386, __i386, __i386__
                   13300:     MIPS        __mips
                   13301:     SPARC       sparc, __sparc
                   13302: </pre>
                   13303:             </div>
                   13304: 
1.66    ! rillig   13305:             <div class="sect3" lang="en" xml:lang="en">
1.55      rillig   13306:               <div class="titlepage">
                   13307:                 <div>
                   13308:                   <div>
                   13309:                     <h4 class="title"><a name=
1.66    ! rillig   13310:                     "fixes-build-cpp-compiler" id=
1.55      rillig   13311:                     "fixes-build-cpp-compiler"></a>15.4.1.3.&nbsp;CPP
                   13312:                     defines for compilers</h4>
                   13313:                   </div>
                   13314:                 </div>
                   13315:               </div>
                   13316:               <pre class="programlisting">
                   13317:     GCC         __GNUC__ (major version), __GNUC_MINOR__
1.60      rillig   13318:     SunPro      __SUNPRO_C (0x570 for version 5.7)
1.55      rillig   13319: </pre>
                   13320:             </div>
1.1       grant    13321:           </div>
1.51      rillig   13322: 
1.66    ! rillig   13323:           <div class="sect2" lang="en" xml:lang="en">
1.51      rillig   13324:             <div class="titlepage">
                   13325:               <div>
                   13326:                 <div>
1.66    ! rillig   13327:                   <h3 class="title"><a name="cpp-list-examples" id=
1.60      rillig   13328:                   "cpp-list-examples"></a>15.4.2.&nbsp;Examples of
                   13329:                   CPP defines for some platforms</h3>
                   13330:                 </div>
                   13331:               </div>
                   13332:             </div>
                   13333: 
                   13334:             <p>The list of the CPP identification macros for
                   13335:             hardware and operating system may depend on the
                   13336:             compiler that is used. The following list contains some
                   13337:             examples that may help you to choose the right ones.
                   13338:             For example, if you want to conditionally compile code
                   13339:             on Solaris, don't use <code class=
                   13340:             "varname">__sun__</code>, as the SunPro compiler does
                   13341:             not define it. Use <code class="varname">__sun</code>
                   13342:             instead.</p>
                   13343: 
                   13344:             <div class="variablelist">
                   13345:               <dl>
1.61      rillig   13346:                 <dt><span class="term">GCC 3.3.3 + SuSE Linux 9.1 +
                   13347:                 i386</span></dt>
                   13348: 
                   13349:                 <dd>
1.62      rillig   13350:                   <p>__ELF__, __gnu_linux__, __i386, __i386__,
1.61      rillig   13351:                   __linux, __linux__, __unix, __unix__, i386,
                   13352:                   linux, unix.</p>
                   13353:                 </dd>
                   13354: 
                   13355:                 <dt><span class="term">GCC 2.95 + NetBSD 1.6.2 +
                   13356:                 i386</span></dt>
                   13357: 
                   13358:                 <dd>
1.62      rillig   13359:                   <p>__ELF__, __NetBSD__, __i386, __i386__,
1.61      rillig   13360:                   i386.</p>
                   13361:                 </dd>
                   13362: 
                   13363:                 <dt><span class="term">GCC 3.3.3 + NetBSD 2.0 +
                   13364:                 i386</span></dt>
1.60      rillig   13365: 
                   13366:                 <dd>
1.62      rillig   13367:                   <p>__ELF__, __NetBSD__, __i386, __i386__,
1.61      rillig   13368:                   i386.</p>
1.60      rillig   13369:                 </dd>
                   13370: 
                   13371:                 <dt><span class="term">GCC 4 + Solaris 8 +
                   13372:                 SPARC</span></dt>
                   13373: 
                   13374:                 <dd>
                   13375:                   <p>__ELF__, __sparc, __sparc__, __sun, __sun__,
                   13376:                   __SVR4, __svr4__, __unix, __unix__, sparc, sun,
                   13377:                   unix.</p>
                   13378:                 </dd>
1.61      rillig   13379: 
                   13380:                 <dt><span class="term">SunPro 5.7 + Solaris 8 +
                   13381:                 SPARC</span></dt>
                   13382: 
                   13383:                 <dd>
                   13384:                   <p>__SVR4, __sparc, __sun, __unix, sparc, sun,
                   13385:                   unix.</p>
                   13386:                 </dd>
1.60      rillig   13387:               </dl>
                   13388:             </div>
                   13389:           </div>
                   13390: 
1.66    ! rillig   13391:           <div class="sect2" lang="en" xml:lang="en">
1.60      rillig   13392:             <div class="titlepage">
                   13393:               <div>
                   13394:                 <div>
1.66    ! rillig   13395:                   <h3 class="title"><a name="cpp-list" id=
1.60      rillig   13396:                   "cpp-list"></a>15.4.3.&nbsp;Getting a list of CPP
1.51      rillig   13397:                   defines</h3>
                   13398:                 </div>
                   13399:               </div>
                   13400:             </div>
                   13401: 
1.60      rillig   13402:             <p>If your system uses the GNU C Compiler, you can get
                   13403:             a list of symbols that are defined by default, e.g. to
                   13404:             identify the platform, with the following command:</p>
1.51      rillig   13405:             <pre class="programlisting">
                   13406:     gcc -E -dM - &lt; /dev/null 
                   13407: </pre>
1.60      rillig   13408: 
                   13409:             <p>On other systems you may get the list by using the
                   13410:             system's syscall trace utility (ktrace, truss, strace)
                   13411:             to have a look which arguments are passed to the actual
                   13412:             compiler.</p>
1.51      rillig   13413:           </div>
1.1       grant    13414:         </div>
                   13415: 
1.66    ! rillig   13416:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    13417:           <div class="titlepage">
                   13418:             <div>
                   13419:               <div>
                   13420:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   13421:                 "package-specific-actions" id=
1.38      dillo    13422:                 "package-specific-actions"></a>15.5.&nbsp;Package
1.1       grant    13423:                 specific actions</h2>
                   13424:               </div>
                   13425:             </div>
                   13426:           </div>
                   13427: 
1.66    ! rillig   13428:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    13429:             <div class="titlepage">
                   13430:               <div>
                   13431:                 <div>
1.66    ! rillig   13432:                   <h3 class="title"><a name="user-interaction" id=
1.38      dillo    13433:                   "user-interaction"></a>15.5.1.&nbsp;User
1.2       hubertf  13434:                   interaction</h3>
1.1       grant    13435:                 </div>
                   13436:               </div>
                   13437:             </div>
                   13438: 
                   13439:             <p>Occasionally, packages require interaction from the
                   13440:             user, and this can be in a number of ways:</p>
                   13441: 
                   13442:             <div class="itemizedlist">
                   13443:               <ul type="disc">
                   13444:                 <li>
                   13445:                   <p>help in fetching the distfiles</p>
                   13446:                 </li>
                   13447: 
                   13448:                 <li>
                   13449:                   <p>help to configure the package before it is
                   13450:                   built</p>
                   13451:                 </li>
                   13452: 
                   13453:                 <li>
                   13454:                   <p>help during the build process</p>
                   13455:                 </li>
                   13456: 
                   13457:                 <li>
                   13458:                   <p>help during the installation of a package</p>
                   13459:                 </li>
                   13460:               </ul>
                   13461:             </div>
                   13462: 
1.14      xtraeme  13463:             <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1       grant    13464:             definition is provided to notify the pkgsrc mechanism
                   13465:             of an interactive stage which will be needed, and this
1.45      wiz      13466:             should be set in the package's <code xmlns=
                   13467:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     13468:             "filename">Makefile</code>, e.g.:</p>
1.1       grant    13469:             <pre class="programlisting">
1.51      rillig   13470:     INTERACTIVE_STAGE=      build
1.1       grant    13471: </pre>
                   13472: 
                   13473:             <p>Multiple interactive stages can be specified:</p>
                   13474:             <pre class="programlisting">
1.51      rillig   13475:     INTERACTIVE_STAGE=      configure install
1.1       grant    13476: </pre>
                   13477:           </div>
                   13478: 
1.66    ! rillig   13479:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    13480:             <div class="titlepage">
                   13481:               <div>
                   13482:                 <div>
1.66    ! rillig   13483:                   <h3 class="title"><a name="handling-licenses" id=
1.38      dillo    13484:                   "handling-licenses"></a>15.5.2.&nbsp;Handling
1.1       grant    13485:                   licenses</h3>
                   13486:                 </div>
                   13487:               </div>
                   13488:             </div>
                   13489: 
1.44      gdt      13490:             <p>A package may be covered by a license which the user
                   13491:             has or has not agreed to accept. For these cases,
                   13492:             pkgsrc contains a mechanism to note that a package is
                   13493:             covered by a particular license, and the package cannot
                   13494:             be built unless the user has accepted the license.
                   13495:             (Installation of binary packages are not currently
                   13496:             subject to this mechanism.) Packages with licenses that
                   13497:             are either Open Source according to the Open Source
                   13498:             Initiative or Free according to the Free Software
                   13499:             Foundation will not be marked with a license tag.
                   13500:             Packages with licenses that have not been determined to
                   13501:             meet either definition will be marked with a license
                   13502:             tag referring to the license. This will prevent
                   13503:             building unless pkgsrc is informed that the license is
                   13504:             acceptable, and enables displaying the license.</p>
                   13505: 
                   13506:             <p>The license tag mechanism is intended to address
                   13507:             copyright-related issues surrounding building,
                   13508:             installing and using a package, and not to address
                   13509:             redistribution issues (see <code class=
                   13510:             "varname">RESTRICTED</code> and <code class=
                   13511:             "varname">NO_SRC_ON_FTP</code>, etc.). However, the
                   13512:             above definition of licenses for which tags are not
                   13513:             needed implies that packages with redistribution
                   13514:             restrictions should have tags.</p>
                   13515: 
                   13516:             <p>Denoting that a package is covered by a particular
1.45      wiz      13517:             license is done by placing the license in <code xmlns=
                   13518:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.44      gdt      13519:             "filename">pkgsrc/licenses</code> and setting the
                   13520:             <code class="varname">LICENSE</code> variable to a
                   13521:             string identifying the license, e.g. in <a xmlns=
1.14      xtraeme  13522:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.44      gdt      13523:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/xv/README.html"
1.45      wiz      13524:             target="_top"><code xmlns="" class=
                   13525:             "filename">graphics/xv</code></a>:</p>
1.1       grant    13526:             <pre class="programlisting">
1.51      rillig   13527:     LICENSE=        xv-license
1.1       grant    13528: </pre>
                   13529: 
                   13530:             <p>When trying to build, the user will get a notice
1.44      gdt      13531:             that the package is covered by a license which has not
                   13532:             been accepted:</p>
1.1       grant    13533:             <pre class="programlisting">
1.51      rillig   13534:     <code class="prompt">%</code> <strong class=
1.14      xtraeme  13535: "userinput"><code>make</code></strong>
1.51      rillig   13536:     ===&gt; xv-3.10anb9 has an unacceptable license: xv-license.
                   13537:     ===&gt;     To view the license, enter "/usr/bin/make show-license".
                   13538:     ===&gt;     To indicate acceptance, add this line to your /etc/mk.conf:
                   13539:     ===&gt;     ACCEPTABLE_LICENSES+=xv-license
                   13540:     *** Error code 1
1.1       grant    13541: </pre>
                   13542: 
1.14      xtraeme  13543:             <p>The license can be viewed with <span><strong class=
                   13544:             "command">make show-license</strong></span>, and if it
                   13545:             is considered appropriate, the line printed above can
1.45      wiz      13546:             be added to <code xmlns=
                   13547:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13548:             "filename">/etc/mk.conf</code> to indicate acceptance
                   13549:             of the particular license:</p>
1.1       grant    13550:             <pre class="programlisting">
1.51      rillig   13551:     ACCEPTABLE_LICENSES+=xv-license
1.1       grant    13552: </pre>
                   13553: 
                   13554:             <p>When adding a package with a new license, the
1.45      wiz      13555:             license text should be added to <code xmlns=
                   13556:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13557:             "filename">pkgsrc/licenses</code> for displaying. A
                   13558:             list of known licenses can be seen in this directory as
                   13559:             well as by looking at the list of (commented out)
                   13560:             <code class="varname">ACCEPTABLE_LICENSES</code>
1.45      wiz      13561:             variable settings in <code xmlns=
                   13562:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13563:             "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1       grant    13564: 
1.44      gdt      13565:             <p>The use of <code class=
                   13566:             "varname">LICENSE=shareware</code>, <code class=
                   13567:             "varname">LICENSE=no-commercial-use</code>, and similar
                   13568:             language is deprecated because it does not crisply
                   13569:             refer to a particular license text. Another problem
                   13570:             with such usage is that it does not enable a user to
                   13571:             denote acceptance of the license for a single package
                   13572:             without accepting the same license text for another
                   13573:             package. In particular, this can be inappropriate when
                   13574:             e.g. one accepts a particular license to indicate to
                   13575:             pkgsrc that a fee has been paid.</p>
1.1       grant    13576:           </div>
                   13577: 
1.66    ! rillig   13578:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    13579:             <div class="titlepage">
                   13580:               <div>
                   13581:                 <div>
1.30      wiz      13582:                   <h3 class="title"><a name=
1.66    ! rillig   13583:                   "installing-score-files" id=
1.38      dillo    13584:                   "installing-score-files"></a>15.5.3.&nbsp;Installing
1.30      wiz      13585:                   score files</h3>
1.1       grant    13586:                 </div>
                   13587:               </div>
                   13588:             </div>
                   13589: 
                   13590:             <p>Certain packages, most of them in the games
                   13591:             category, install a score file that allows all users on
                   13592:             the system to record their highscores. In order for
                   13593:             this to work, the binaries need to be installed setgid
                   13594:             and the score files owned by the appropriate group
                   13595:             and/or owner (traditionally the "games" user/group).
                   13596:             The following variables, documented in more detail in
1.45      wiz      13597:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13598:             class="filename">mk/defaults/mk.conf</code>, control
                   13599:             this behaviour: <code class=
1.14      xtraeme  13600:             "varname">SETGIDGAME</code>, <code class=
                   13601:             "varname">GAMEDATAMODE</code>, <code class=
                   13602:             "varname">GAMEGRP</code>, <code class=
                   13603:             "varname">GAMEMODE</code>, <code class=
                   13604:             "varname">GAMEOWN</code>.</p>
1.1       grant    13605: 
                   13606:             <p>Note that per default, setgid installation of games
1.14      xtraeme  13607:             is disabled; setting <code class=
                   13608:             "varname">SETGIDGAME=YES</code> will set all the other
1.1       grant    13609:             variables accordingly.</p>
                   13610: 
                   13611:             <p>A package should therefor never hard code file
1.14      xtraeme  13612:             ownership or access permissions but rely on
                   13613:             <code class="varname">INSTALL_GAME</code> and
                   13614:             <code class="varname">INSTALL_GAME_DATA</code> to set
                   13615:             these correctly.</p>
1.1       grant    13616:           </div>
                   13617: 
1.66    ! rillig   13618:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    13619:             <div class="titlepage">
                   13620:               <div>
                   13621:                 <div>
1.66    ! rillig   13622:                   <h3 class="title"><a name="perl-scripts" id=
1.38      dillo    13623:                   "perl-scripts"></a>15.5.4.&nbsp;Packages
1.30      wiz      13624:                   containing perl scripts</h3>
1.1       grant    13625:                 </div>
                   13626:               </div>
                   13627:             </div>
                   13628: 
                   13629:             <p>If your package contains interpreted perl scripts,
1.14      xtraeme  13630:             set <code class="varname">REPLACE_PERL</code> to ensure
                   13631:             that the proper interpreter path is set. <code class=
                   13632:             "varname">REPLACE_PERL</code> should contain a list of
                   13633:             scripts, relative to <code class=
                   13634:             "varname">WRKSRC</code>, that you want adjusted.</p>
1.1       grant    13635:           </div>
                   13636: 
1.66    ! rillig   13637:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    13638:             <div class="titlepage">
                   13639:               <div>
                   13640:                 <div>
1.66    ! rillig   13641:                   <h3 class="title"><a name="hardcoded-paths" id=
1.38      dillo    13642:                   "hardcoded-paths"></a>15.5.5.&nbsp;Packages with
1.1       grant    13643:                   hardcoded paths to other interpreters</h3>
                   13644:                 </div>
                   13645:               </div>
                   13646:             </div>
                   13647: 
                   13648:             <p>Your package may also contain scripts with hardcoded
                   13649:             paths to other interpreters besides (or as well as)
                   13650:             perl. To correct the full pathname to the script
                   13651:             interpreter, you need to set the following definitions
1.45      wiz      13652:             in your <code xmlns=
                   13653:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13654:             "filename">Makefile</code> (we shall use
                   13655:             <span><strong class="command">tclsh</strong></span> in
                   13656:             this example):</p>
1.1       grant    13657:             <pre class="programlisting">
1.51      rillig   13658:     REPLACE_INTERPRETER+=   tcl
                   13659:     _REPLACE.tcl.old=       .*/bin/tclsh
                   13660:     _REPLACE.tcl.new=       ${PREFIX}/bin/tclsh
                   13661:     _REPLACE_FILES.tcl=     # list of tcl scripts which need to be fixed,
                   13662:                             # relative to ${WRKSRC}, just as in REPLACE_PERL
1.1       grant    13663: </pre>
                   13664:           </div>
                   13665: 
1.66    ! rillig   13666:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    13667:             <div class="titlepage">
                   13668:               <div>
                   13669:                 <div>
1.66    ! rillig   13670:                   <h3 class="title"><a name="perl-modules" id=
1.38      dillo    13671:                   "perl-modules"></a>15.5.6.&nbsp;Packages
1.30      wiz      13672:                   installing perl modules</h3>
1.1       grant    13673:                 </div>
                   13674:               </div>
                   13675:             </div>
                   13676: 
                   13677:             <p>Makefiles of packages providing perl5 modules should
1.45      wiz      13678:             include the Makefile fragment <code xmlns=
                   13679:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13680:             "filename">../../lang/perl5/module.mk</code>. It
                   13681:             provides a <span><strong class=
                   13682:             "command">do-configure</strong></span> target for the
                   13683:             standard perl configuration for such modules as well as
                   13684:             various hooks to tune this configuration. See comments
                   13685:             in this file for details.</p>
1.1       grant    13686: 
                   13687:             <p>Perl5 modules will install into different places
                   13688:             depending on the version of perl used during the build
                   13689:             process. To address this, pkgsrc will append lines to
1.45      wiz      13690:             the <code xmlns=
                   13691:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13692:             "filename">PLIST</code> corresponding to the files
                   13693:             listed in the installed <code xmlns=
                   13694:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13695:             "filename">.packlist</code> file generated by most
                   13696:             perl5 modules. This is invoked by defining <code class=
                   13697:             "varname">PERL5_PACKLIST</code> to a space-separated
                   13698:             list of paths to packlist files, e.g.:</p>
1.1       grant    13699:             <pre class="programlisting">
1.51      rillig   13700:     PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
1.1       grant    13701: </pre>
                   13702: 
1.14      xtraeme  13703:             <p>The variables <code class=
                   13704:             "varname">PERL5_SITELIB</code>, <code class=
                   13705:             "varname">PERL5_SITEARCH</code>, and <code class=
                   13706:             "varname">PERL5_ARCHLIB</code> represent the three
1.1       grant    13707:             locations in which perl5 modules may be installed, and
                   13708:             may be used by perl5 packages that don't have a
                   13709:             packlist. These three variables are also substituted
1.45      wiz      13710:             for in the <code xmlns=
                   13711:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13712:             "filename">PLIST</code>.</p>
1.1       grant    13713:           </div>
                   13714: 
1.66    ! rillig   13715:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    13716:             <div class="titlepage">
                   13717:               <div>
                   13718:                 <div>
1.66    ! rillig   13719:                   <h3 class="title"><a name="faq.info-files" id=
1.38      dillo    13720:                   "faq.info-files"></a>15.5.7.&nbsp;Packages
1.1       grant    13721:                   installing info files</h3>
                   13722:                 </div>
                   13723:               </div>
                   13724:             </div>
                   13725: 
                   13726:             <p>Some packages install info files or use the
                   13727:             &#8220;<span class="quote">makeinfo</span>&#8221; or
                   13728:             &#8220;<span class="quote">install-info</span>&#8221;
                   13729:             commands. Each of the info files:</p>
                   13730: 
                   13731:             <div class="itemizedlist">
                   13732:               <ul type="disc">
                   13733:                 <li>
                   13734:                   <p>is considered to be installed in the directory
1.45      wiz      13735:                   <code xmlns=
                   13736:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13737:                   "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1       grant    13738:                 </li>
                   13739: 
                   13740:                 <li>
                   13741:                   <p>is registered in the Info directory file
1.45      wiz      13742:                   <code xmlns=
                   13743:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13744:                   "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1       grant    13745:                 </li>
                   13746: 
                   13747:                 <li>
                   13748:                   <p>and must be listed as a filename in the
1.14      xtraeme  13749:                   <code class="varname">INFO_FILES</code> variable
                   13750:                   in the package Makefile.</p>
1.1       grant    13751:                 </li>
                   13752:               </ul>
                   13753:             </div>
                   13754: 
1.14      xtraeme  13755:             <p><code class="varname">INFO_DIR</code> defaults to
1.1       grant    13756:             &#8220;<span class="quote">info</span>&#8221; and can
1.45      wiz      13757:             be overridden in the package Makefile. <code xmlns=
                   13758:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13759:             "filename">INSTALL</code> and <code xmlns=
                   13760:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13761:             "filename">DEINSTALL</code> scripts will be generated
                   13762:             to handle registration of the info files in the Info
1.1       grant    13763:             directory file. The &#8220;<span class=
                   13764:             "quote">install-info</span>&#8221; command used for the
                   13765:             info files registration is either provided by the
                   13766:             system, or by a special purpose package automatically
                   13767:             added as dependency if needed.</p>
                   13768: 
                   13769:             <p>A package which needs the &#8220;<span class=
                   13770:             "quote">makeinfo</span>&#8221; command at build time
1.14      xtraeme  13771:             must define the variable <code class=
                   13772:             "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1       grant    13773:             minimum version of the &#8220;<span class=
                   13774:             "quote">makeinfo</span>&#8221; command is needed it
1.14      xtraeme  13775:             should be noted with the <code class=
                   13776:             "varname">TEXINFO_REQD</code> variable in the package
1.45      wiz      13777:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13778:             class="filename">Makefile</code>. By default, a minimum
                   13779:             version of 3.12 is required. If the system does not
                   13780:             provide a <span><strong class=
1.14      xtraeme  13781:             "command">makeinfo</strong></span> command or if it
                   13782:             does not match the required minimum, a build dependency
                   13783:             on the <a xmlns=
                   13784:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    13785:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.45      wiz      13786:             target="_top"><code xmlns="" class=
                   13787:             "filename">devel/gtexinfo</code></a> package will be
1.20      ben      13788:             added automatically.</p>
1.1       grant    13789: 
                   13790:             <p>The build and installation process of the software
                   13791:             provided by the package should not use the
1.14      xtraeme  13792:             <span><strong class=
                   13793:             "command">install-info</strong></span> command as the
                   13794:             registration of info files is the task of the package
1.45      wiz      13795:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13796:             class="filename">INSTALL</code> script, and it must use
                   13797:             the appropriate <span><strong class=
1.14      xtraeme  13798:             "command">makeinfo</strong></span> command.</p>
1.1       grant    13799: 
1.47      reed     13800:             <p>To achieve this goal, the pkgsrc infrastructure
1.14      xtraeme  13801:             creates overriding scripts for the <span><strong class=
                   13802:             "command">install-info</strong></span> and
                   13803:             <span><strong class="command">makeinfo</strong></span>
                   13804:             commands in a directory listed early in <code class=
                   13805:             "varname">PATH</code>.</p>
1.1       grant    13806: 
1.14      xtraeme  13807:             <p>The script overriding <span><strong class=
                   13808:             "command">install-info</strong></span> has no effect
                   13809:             except the logging of a message. The script overriding
                   13810:             <span><strong class="command">makeinfo</strong></span>
                   13811:             logs a message and according to the value of
                   13812:             <code class="varname">USE_MAKEINFO</code> and
                   13813:             <code class="varname">TEXINFO_REQD</code> either run
                   13814:             the appropriate <span><strong class=
                   13815:             "command">makeinfo</strong></span> command or exit on
                   13816:             error.</p>
1.1       grant    13817:           </div>
                   13818: 
1.66    ! rillig   13819:           <div class="sect2" lang="en" xml:lang="en">
1.57      minskim  13820:             <div class="titlepage">
                   13821:               <div>
                   13822:                 <div>
1.66    ! rillig   13823:                   <h3 class="title"><a name="manpages" id=
1.57      minskim  13824:                   "manpages"></a>15.5.8.&nbsp;Packages installing
                   13825:                   man pages</h3>
                   13826:                 </div>
                   13827:               </div>
                   13828:             </div>
                   13829: 
                   13830:             <p>Many packages install manual pages. The man pages
                   13831:             are installed under <code class=
                   13832:             "varname">${PREFIX}/${PKGMANDIR}</code> which is
                   13833:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13834:             class="filename">/usr/pkg/man</code> by default.
                   13835:             <code class="varname">PKGMANDIR</code> defaults to
                   13836:             &#8220;<span class="quote">man</span>&#8221;. For
                   13837:             example, you can set <code class=
                   13838:             "varname">PKGMANDIR</code> to &#8220;<span class=
                   13839:             "quote">share/man</span>&#8221; to have man pages
                   13840:             install under <code xmlns=
                   13841:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13842:             "filename">/usr/pkg/share/man/</code> by default.</p>
                   13843: 
                   13844:             <div class="note" style=
                   13845:             "margin-left: 0.5in; margin-right: 0.5in;">
                   13846:               <h3 class="title">Note</h3>
                   13847: 
                   13848:               <p>The support for a custom <code class=
                   13849:               "varname">PKGMANDIR</code> is not complete.</p>
                   13850:             </div>
                   13851: 
                   13852:             <p>The <code xmlns=
                   13853:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13854:             "filename">PLIST</code> files can just use <code xmlns=
                   13855:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13856:             "filename">man/</code> as the top level directory for
                   13857:             the man page file entries and the pkgsrc framework will
                   13858:             convert as needed.</p>
                   13859: 
                   13860:             <p>Packages that are configured with <code class=
                   13861:             "varname">GNU_CONFIGURE</code> set as
                   13862:             &#8220;<span class="quote">yes</span>&#8221;, by
                   13863:             default will use the <code xmlns=
                   13864:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13865:             "filename">./configure</code> --mandir switch to set
                   13866:             where the man pages should be installed. The path is
                   13867:             <code class="varname">GNU_CONFIGURE_MANDIR</code> which
                   13868:             defaults to <code class=
                   13869:             "varname">${PREFIX}/${PKGMANDIR}</code>.</p>
                   13870: 
                   13871:             <p>Packages that use <code class=
                   13872:             "varname">GNU_CONFIGURE</code> but do not use --mandir,
                   13873:             can set <code class=
                   13874:             "varname">CONFIGURE_HAS_MANDIR</code> to
                   13875:             &#8220;<span class="quote">no</span>&#8221;. Or if the
                   13876:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13877:             class="filename">./configure</code> script uses a
                   13878:             non-standard use of --mandir, you can set <code class=
                   13879:             "varname">GNU_CONFIGURE_MANDIR</code> as needed.</p>
                   13880: 
                   13881:             <p>See <a href="#manpage-compression" title=
                   13882:             "10.5.&nbsp;Man page compression">Section&nbsp;10.5,
                   13883:             &#8220;Man page compression&#8221;</a> for information
                   13884:             on installation of compressed manual pages.</p>
                   13885:           </div>
                   13886: 
1.66    ! rillig   13887:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    13888:             <div class="titlepage">
                   13889:               <div>
                   13890:                 <div>
1.66    ! rillig   13891:                   <h3 class="title"><a name="gconf2-data-files" id=
1.57      minskim  13892:                   "gconf2-data-files"></a>15.5.9.&nbsp;Packages
1.30      wiz      13893:                   installing GConf2 data files</h3>
1.1       grant    13894:                 </div>
                   13895:               </div>
                   13896:             </div>
                   13897: 
1.45      wiz      13898:             <p>If a package installs <code xmlns=
                   13899:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13900:             "filename">.schemas</code> or <code xmlns=
                   13901:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13902:             "filename">.entries</code> files, used by GConf2, you
1.1       grant    13903:             need to take some extra steps to make sure they get
                   13904:             registered in the database:</p>
                   13905: 
                   13906:             <div class="orderedlist">
                   13907:               <ol type="1">
                   13908:                 <li>
1.45      wiz      13909:                   <p>Include <code xmlns=
                   13910:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13911:                   "filename">../../devel/GConf2/schemas.mk</code>
1.45      wiz      13912:                   instead of its <code xmlns=
                   13913:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13914:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    13915:                   care of rebuilding the GConf2 database at
                   13916:                   installation and deinstallation time, and tells
                   13917:                   the package where to install GConf2 data files
                   13918:                   using some standard configure arguments. It also
                   13919:                   disallows any access to the database directly
                   13920:                   from the package.</p>
                   13921:                 </li>
                   13922: 
                   13923:                 <li>
                   13924:                   <p>Ensure that the package installs its
1.45      wiz      13925:                   <code xmlns=
                   13926:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13927:                   "filename">.schemas</code> files under
                   13928:                   <code xmlns=
                   13929:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13930:                   "filename">${PREFIX}/share/gconf/schemas</code>.
1.45      wiz      13931:                   If they get installed under <code xmlns=
                   13932:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13933:                   "filename">${PREFIX}/etc</code>, you will need to
1.1       grant    13934:                   manually patch the package.</p>
                   13935:                 </li>
                   13936: 
                   13937:                 <li>
                   13938:                   <p>Check the PLIST and remove any entries under
                   13939:                   the etc/gconf directory, as they will be handled
                   13940:                   automatically. See <a href="#faq.conf" title=
1.38      dillo    13941:                   "7.14.&nbsp;How do I change the location of configuration files?">
                   13942:                   Section&nbsp;7.14, &#8220;How do I change the
1.35      jmmv     13943:                   location of configuration files?&#8221;</a> for
                   13944:                   more information.</p>
1.1       grant    13945:                 </li>
                   13946: 
                   13947:                 <li>
1.14      xtraeme  13948:                   <p>Define the <code class=
                   13949:                   "varname">GCONF2_SCHEMAS</code> variable in your
1.45      wiz      13950:                   <code xmlns=
                   13951:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13952:                   "filename">Makefile</code> with a list of all
                   13953:                   <code xmlns=
                   13954:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13955:                   "filename">.schemas</code> files installed by the
                   13956:                   package, if any. Names must not contain any
                   13957:                   directories in them.</p>
1.1       grant    13958:                 </li>
                   13959: 
                   13960:                 <li>
1.14      xtraeme  13961:                   <p>Define the <code class=
                   13962:                   "varname">GCONF2_ENTRIES</code> variable in your
1.45      wiz      13963:                   <code xmlns=
                   13964:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13965:                   "filename">Makefile</code> with a list of all
                   13966:                   <code xmlns=
                   13967:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13968:                   "filename">.entries</code> files installed by the
                   13969:                   package, if any. Names must not contain any
                   13970:                   directories in them.</p>
1.1       grant    13971:                 </li>
                   13972:               </ol>
                   13973:             </div>
                   13974:           </div>
                   13975: 
1.66    ! rillig   13976:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    13977:             <div class="titlepage">
                   13978:               <div>
                   13979:                 <div>
1.30      wiz      13980:                   <h3 class="title"><a name=
1.66    ! rillig   13981:                   "scrollkeeper-data-files" id=
1.57      minskim  13982:                   "scrollkeeper-data-files"></a>15.5.10.&nbsp;Packages
1.30      wiz      13983:                   installing scrollkeeper data files</h3>
1.1       grant    13984:                 </div>
                   13985:               </div>
                   13986:             </div>
                   13987: 
1.45      wiz      13988:             <p>If a package installs <code xmlns=
                   13989:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13990:             "filename">.omf</code> files, used by scrollkeeper, you
                   13991:             need to take some extra steps to make sure they get
                   13992:             registered in the database:</p>
1.1       grant    13993: 
                   13994:             <div class="orderedlist">
                   13995:               <ol type="1">
                   13996:                 <li>
1.45      wiz      13997:                   <p>Include <code xmlns=
                   13998:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13999:                   "filename">../../textproc/scrollkeeper/omf.mk</code>
1.45      wiz      14000:                   instead of its <code xmlns=
                   14001:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14002:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    14003:                   care of rebuilding the scrollkeeper database at
                   14004:                   installation and deinstallation time, and
                   14005:                   disallows any access to it directly from the
                   14006:                   package.</p>
                   14007:                 </li>
                   14008: 
                   14009:                 <li>
                   14010:                   <p>Check the PLIST and remove any entries under
1.45      wiz      14011:                   the <code xmlns=
                   14012:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14013:                   "filename">libdata/scrollkeeper</code> directory,
1.1       grant    14014:                   as they will be handled automatically.</p>
                   14015:                 </li>
                   14016: 
                   14017:                 <li>
1.45      wiz      14018:                   <p>Remove the <code xmlns=
                   14019:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14020:                   "filename">share/omf</code> directory from the
                   14021:                   PLIST. It will be handled by scrollkeeper.</p>
1.1       grant    14022:                 </li>
                   14023:               </ol>
                   14024:             </div>
                   14025:           </div>
                   14026: 
1.66    ! rillig   14027:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    14028:             <div class="titlepage">
                   14029:               <div>
                   14030:                 <div>
1.66    ! rillig   14031:                   <h3 class="title"><a name="x11-fonts" id=
1.57      minskim  14032:                   "x11-fonts"></a>15.5.11.&nbsp;Packages installing
1.1       grant    14033:                   X11 fonts</h3>
                   14034:                 </div>
                   14035:               </div>
                   14036:             </div>
                   14037: 
                   14038:             <p>If a package installs font files, you will need to
                   14039:             rebuild the fonts database in the directory where they
                   14040:             get installed at installation and deinstallation time.
1.65      hubertf  14041:             This can be automatically done by using the pkginstall
                   14042:             framework.</p>
1.1       grant    14043: 
1.65      hubertf  14044:             <p>You can list the directories where fonts are
                   14045:             installed in the <code class=
                   14046:             "varname">FONTS_DIRS.<em class=
                   14047:             "replaceable"><code>type</code></em></code> variables,
                   14048:             where <em class="replaceable"><code>type</code></em>
                   14049:             can be one of &#8220;<span class=
                   14050:             "quote">ttf</span>&#8221;, &#8220;<span class=
                   14051:             "quote">type1</span>&#8221; or &#8220;<span class=
                   14052:             "quote">x11</span>&#8221;. Also make sure that the
                   14053:             database file <code xmlns=
1.45      wiz      14054:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14055:             "filename">fonts.dir</code> is not listed in the
1.1       grant    14056:             PLIST.</p>
                   14057: 
                   14058:             <p>Note that you should not create new directories for
                   14059:             fonts; instead use the standard ones to avoid that the
                   14060:             user needs to manually configure his X server to find
                   14061:             them.</p>
                   14062:           </div>
                   14063: 
1.66    ! rillig   14064:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    14065:             <div class="titlepage">
                   14066:               <div>
                   14067:                 <div>
1.66    ! rillig   14068:                   <h3 class="title"><a name="gtk2-modules" id=
1.57      minskim  14069:                   "gtk2-modules"></a>15.5.12.&nbsp;Packages
1.30      wiz      14070:                   installing GTK2 modules</h3>
1.1       grant    14071:                 </div>
                   14072:               </div>
                   14073:             </div>
                   14074: 
1.47      reed     14075:             <p>If a package installs GTK2 immodules or loaders, you
1.1       grant    14076:             need to take some extra steps to get them registered in
                   14077:             the GTK2 database properly:</p>
                   14078: 
                   14079:             <div class="orderedlist">
                   14080:               <ol type="1">
                   14081:                 <li>
1.45      wiz      14082:                   <p>Include <code xmlns=
                   14083:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14084:                   "filename">../../x11/gtk2/modules.mk</code>
1.45      wiz      14085:                   instead of its <code xmlns=
                   14086:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14087:                   "filename">buildlink3.mk</code> file. This takes
                   14088:                   care of rebuilding the database at installation
                   14089:                   and deinstallation time.</p>
1.1       grant    14090:                 </li>
                   14091: 
                   14092:                 <li>
1.14      xtraeme  14093:                   <p>Set <code class=
                   14094:                   "varname">GTK2_IMMODULES=YES</code> if your
                   14095:                   package installs GTK2 immodules.</p>
1.1       grant    14096:                 </li>
                   14097: 
                   14098:                 <li>
1.14      xtraeme  14099:                   <p>Set <code class=
                   14100:                   "varname">GTK2_LOADERS=YES</code> if your package
                   14101:                   installs GTK2 loaders.</p>
1.1       grant    14102:                 </li>
                   14103: 
                   14104:                 <li>
1.47      reed     14105:                   <p>Patch the package to not touch any of the GTK2
1.1       grant    14106:                   databases directly. These are:</p>
                   14107: 
                   14108:                   <div class="itemizedlist">
                   14109:                     <ul type="disc">
                   14110:                       <li>
1.45      wiz      14111:                         <p><code xmlns=
                   14112:                         "http://www.w3.org/TR/xhtml1/transitional"
                   14113:                         class=
1.14      xtraeme  14114:                         "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1       grant    14115:                       </li>
                   14116: 
                   14117:                       <li>
1.45      wiz      14118:                         <p><code xmlns=
                   14119:                         "http://www.w3.org/TR/xhtml1/transitional"
                   14120:                         class=
1.14      xtraeme  14121:                         "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1       grant    14122:                       </li>
                   14123:                     </ul>
                   14124:                   </div>
                   14125:                 </li>
                   14126: 
                   14127:                 <li>
                   14128:                   <p>Check the PLIST and remove any entries under
1.45      wiz      14129:                   the <code xmlns=
                   14130:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14131:                   "filename">libdata/gtk-2.0</code> directory, as
                   14132:                   they will be handled automatically.</p>
1.1       grant    14133:                 </li>
                   14134:               </ol>
                   14135:             </div>
                   14136:           </div>
                   14137: 
1.66    ! rillig   14138:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    14139:             <div class="titlepage">
                   14140:               <div>
                   14141:                 <div>
1.66    ! rillig   14142:                   <h3 class="title"><a name="sgml-xml-data" id=
1.57      minskim  14143:                   "sgml-xml-data"></a>15.5.13.&nbsp;Packages
1.30      wiz      14144:                   installing SGML or XML data</h3>
1.1       grant    14145:                 </div>
                   14146:               </div>
                   14147:             </div>
                   14148: 
                   14149:             <p>If a package installs SGML or XML data files that
                   14150:             need to be registered in system-wide catalogs (like
                   14151:             DTDs, sub-catalogs, etc.), you need to take some extra
                   14152:             steps:</p>
                   14153: 
                   14154:             <div class="orderedlist">
                   14155:               <ol type="1">
                   14156:                 <li>
1.45      wiz      14157:                   <p>Include <code xmlns=
                   14158:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14159:                   "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
1.45      wiz      14160:                   in your <code xmlns=
                   14161:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14162:                   "filename">Makefile</code>, which takes care of
                   14163:                   registering those files in system-wide catalogs
                   14164:                   at installation and deinstallation time.</p>
1.1       grant    14165:                 </li>
                   14166: 
                   14167:                 <li>
1.14      xtraeme  14168:                   <p>Set <code class="varname">SGML_CATALOGS</code>
                   14169:                   to the full path of any SGML catalogs installed
                   14170:                   by the package.</p>
1.1       grant    14171:                 </li>
                   14172: 
                   14173:                 <li>
1.14      xtraeme  14174:                   <p>Set <code class="varname">XML_CATALOGS</code>
                   14175:                   to the full path of any XML catalogs installed by
1.1       grant    14176:                   the package.</p>
                   14177:                 </li>
                   14178: 
                   14179:                 <li>
1.14      xtraeme  14180:                   <p>Set <code class="varname">SGML_ENTRIES</code>
                   14181:                   to individual entries to be added to the SGML
1.1       grant    14182:                   catalog. These come in groups of three strings;
                   14183:                   see xmlcatmgr(1) for more information
                   14184:                   (specifically, arguments recognized by the 'add'
                   14185:                   action). Note that you will normally not use this
                   14186:                   variable.</p>
                   14187:                 </li>
                   14188: 
                   14189:                 <li>
1.14      xtraeme  14190:                   <p>Set <code class="varname">XML_ENTRIES</code>
                   14191:                   to individual entries to be added to the XML
1.1       grant    14192:                   catalog. These come in groups of three strings;
                   14193:                   see xmlcatmgr(1) for more information
                   14194:                   (specifically, arguments recognized by the 'add'
                   14195:                   action). Note that you will normally not use this
                   14196:                   variable.</p>
                   14197:                 </li>
                   14198:               </ol>
                   14199:             </div>
                   14200:           </div>
                   14201: 
1.66    ! rillig   14202:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    14203:             <div class="titlepage">
                   14204:               <div>
                   14205:                 <div>
1.66    ! rillig   14206:                   <h3 class="title"><a name="mime-database" id=
1.57      minskim  14207:                   "mime-database"></a>15.5.14.&nbsp;Packages
1.30      wiz      14208:                   installing extensions to the MIME database</h3>
1.1       grant    14209:                 </div>
                   14210:               </div>
                   14211:             </div>
                   14212: 
                   14213:             <p>If a package provides extensions to the MIME
1.45      wiz      14214:             database by installing <code xmlns=
                   14215:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   14216:             "filename">.xml</code> files inside <code xmlns=
                   14217:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14218:             "filename">${PREFIX}/share/mime/packages</code>, you
                   14219:             need to take some extra steps to ensure that the
                   14220:             database is kept consistent with respect to these new
                   14221:             files:</p>
1.1       grant    14222: 
                   14223:             <div class="orderedlist">
                   14224:               <ol type="1">
                   14225:                 <li>
1.45      wiz      14226:                   <p>Include <code xmlns=
                   14227:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14228:                   "filename">../../databases/shared-mime-info/mimedb.mk</code>
1.45      wiz      14229:                   (avoid using the <code xmlns=
                   14230:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14231:                   "filename">buildlink3.mk</code> file from this
                   14232:                   same directory, which is reserved for inclusion
1.45      wiz      14233:                   from other <code xmlns=
                   14234:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14235:                   "filename">buildlink3.mk</code> files). It takes
                   14236:                   care of rebuilding the MIME database at
                   14237:                   installation and deinstallation time, and
                   14238:                   disallows any access to it directly from the
1.1       grant    14239:                   package.</p>
                   14240:                 </li>
                   14241: 
                   14242:                 <li>
                   14243:                   <p>Check the PLIST and remove any entries under
1.45      wiz      14244:                   the <code xmlns=
                   14245:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14246:                   "filename">share/mime</code> directory,
                   14247:                   <span class="emphasis"><em>except</em></span> for
                   14248:                   files saved under <code xmlns=
                   14249:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14250:                   "filename">share/mime/packages</code>. The former
1.1       grant    14251:                   are handled automatically by the
1.47      reed     14252:                   update-mime-database program, but the latter are
1.1       grant    14253:                   package-dependent and must be removed by the
                   14254:                   package that installed them in the first
                   14255:                   place.</p>
                   14256:                 </li>
                   14257: 
                   14258:                 <li>
1.45      wiz      14259:                   <p>Remove any <code xmlns=
                   14260:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14261:                   "filename">share/mime/*</code> directories from
                   14262:                   the PLIST. They will be handled by the
1.1       grant    14263:                   shared-mime-info package.</p>
                   14264:                 </li>
                   14265:               </ol>
                   14266:             </div>
                   14267:           </div>
                   14268: 
1.66    ! rillig   14269:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    14270:             <div class="titlepage">
                   14271:               <div>
                   14272:                 <div>
1.66    ! rillig   14273:                   <h3 class="title"><a name="intltool" id=
1.57      minskim  14274:                   "intltool"></a>15.5.15.&nbsp;Packages using
1.1       grant    14275:                   intltool</h3>
                   14276:                 </div>
                   14277:               </div>
                   14278:             </div>
                   14279: 
                   14280:             <p>If a package uses intltool during its build, include
1.45      wiz      14281:             the <code xmlns=
                   14282:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14283:             "filename">../../textproc/intltool/buildlink3.mk</code>
1.1       grant    14284:             file, which forces it to use the intltool package
                   14285:             provided by pkgsrc, instead of the one bundled with the
                   14286:             distribution file.</p>
                   14287: 
                   14288:             <p>This tracks intltool's build-time dependencies and
                   14289:             uses the latest available version; this way, the
                   14290:             package benefits of any bug fixes that may have
                   14291:             appeared since it was released.</p>
                   14292:           </div>
1.18      xtraeme  14293: 
1.66    ! rillig   14294:           <div class="sect2" lang="en" xml:lang="en">
1.18      xtraeme  14295:             <div class="titlepage">
                   14296:               <div>
                   14297:                 <div>
1.66    ! rillig   14298:                   <h3 class="title"><a name="startup-scripts" id=
1.57      minskim  14299:                   "startup-scripts"></a>15.5.16.&nbsp;Packages
1.30      wiz      14300:                   installing startup scripts</h3>
1.18      xtraeme  14301:                 </div>
                   14302:               </div>
                   14303:             </div>
                   14304: 
                   14305:             <p>If a package contains a rc.d script, it won't be
                   14306:             copied into the startup directory by default, but you
                   14307:             can enable it, by adding the option <code class=
1.45      wiz      14308:             "varname">PKG_RCD_SCRIPTS=YES</code> in <code xmlns=
                   14309:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.18      xtraeme  14310:             "filename">/etc/mk.conf</code>. This option will copy
1.45      wiz      14311:             the scripts into <code xmlns=
                   14312:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.18      xtraeme  14313:             "filename">/etc/rc.d</code> when a package is
                   14314:             installed, and it will automatically remove the scripts
                   14315:             when the package is deinstalled.</p>
                   14316:           </div>
1.57      minskim  14317: 
1.66    ! rillig   14318:           <div class="sect2" lang="en" xml:lang="en">
1.57      minskim  14319:             <div class="titlepage">
                   14320:               <div>
                   14321:                 <div>
1.66    ! rillig   14322:                   <h3 class="title"><a name="tex-packages" id=
1.57      minskim  14323:                   "tex-packages"></a>15.5.17.&nbsp;Packages
                   14324:                   installing TeX modules</h3>
                   14325:                 </div>
                   14326:               </div>
                   14327:             </div>
                   14328: 
                   14329:             <p>If a package installs TeX packages into the texmf
                   14330:             tree, the <code xmlns=
                   14331:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   14332:             "filename">ls-R</code> database of the tree needs to be
                   14333:             updated.</p>
                   14334: 
                   14335:             <div class="note" style=
                   14336:             "margin-left: 0.5in; margin-right: 0.5in;">
                   14337:               <h3 class="title">Note</h3>
                   14338: 
                   14339:               <p>Except the main TeX packages such as teTeX-texmf,
                   14340:               packages should install files into <code class=
                   14341:               "varname">PKG_LOCALTEXMFPREFIX</code>, not
                   14342:               <code class="varname">PKG_TEXMFPREFIX</code>.</p>
                   14343:             </div>
                   14344: 
                   14345:             <div class="orderedlist">
                   14346:               <ol type="1">
                   14347:                 <li>
                   14348:                   <p>Include <code xmlns=
                   14349:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14350:                   "filename">../../print/teTeX/module.mk</code>
                   14351:                   instead of <code xmlns=
                   14352:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14353:                   "filename">../../mk/tex.buildlink3.mk</code>.
                   14354:                   This takes care of rebuilding the <code xmlns=
                   14355:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14356:                   "filename">ls-R</code> database at installation
                   14357:                   and deinstallation time.</p>
                   14358:                 </li>
                   14359: 
                   14360:                 <li>
                   14361:                   <p>If your package installs files into a texmf
                   14362:                   tree other than the one at <code class=
                   14363:                   "varname">PKG_LOCALTEXMFPREFIX</code>, set
                   14364:                   <code class="varname">TEXMFDIRS</code> to the
                   14365:                   list of all texmf trees that need database
                   14366:                   update.</p>
1.64      kim      14367: 
                   14368:                   <p>If your package also installs font map files
                   14369:                   that need to be registered using
                   14370:                   <span><strong class=
                   14371:                   "command">updmap</strong></span>, set
                   14372:                   <code class="varname">TEX_FONTMAPS</code> to the
                   14373:                   list of all such font map files. Then
                   14374:                   <span><strong class=
                   14375:                   "command">updmap</strong></span> will be run
                   14376:                   automatically at installation/deinstallation to
                   14377:                   enable/disable font map files for TeX output
                   14378:                   drivers.</p>
1.57      minskim  14379:                 </li>
                   14380: 
                   14381:                 <li>
                   14382:                   <p>Make sure that none of <code xmlns=
                   14383:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14384:                   "filename">ls-R</code> databases are included in
                   14385:                   <code xmlns=
                   14386:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14387:                   "filename">PLIST</code>, as they will be removed
                   14388:                   only by the teTeX-bin package.</p>
                   14389:                 </li>
                   14390:               </ol>
                   14391:             </div>
                   14392:           </div>
1.1       grant    14393:         </div>
                   14394: 
1.66    ! rillig   14395:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    14396:           <div class="titlepage">
                   14397:             <div>
                   14398:               <div>
                   14399:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   14400:                 "feedback-to-author" id=
1.38      dillo    14401:                 "feedback-to-author"></a>15.6.&nbsp;Feedback to the
1.30      wiz      14402:                 author</h2>
1.1       grant    14403:               </div>
                   14404:             </div>
                   14405:           </div>
                   14406: 
                   14407:           <p>If you have found any bugs in the package you make
                   14408:           available, if you had to do special steps to make it run
                   14409:           under NetBSD or if you enhanced the software in various
                   14410:           other ways, be sure to report these changes back to the
                   14411:           original author of the program! With that kind of
                   14412:           support, the next release of the program can incorporate
                   14413:           these fixes, and people not using the NetBSD packages
                   14414:           system can win from your efforts.</p>
                   14415: 
                   14416:           <p>Support the idea of free software!</p>
                   14417:         </div>
                   14418:       </div>
                   14419: 
1.66    ! rillig   14420:       <div class="chapter" lang="en" xml:lang="en">
1.1       grant    14421:         <div class="titlepage">
                   14422:           <div>
                   14423:             <div>
1.66    ! rillig   14424:               <h2 class="title"><a name="debug" id=
1.38      dillo    14425:               "debug"></a>Chapter&nbsp;16.&nbsp;Debugging</h2>
1.1       grant    14426:             </div>
                   14427:           </div>
                   14428:         </div>
                   14429: 
                   14430:         <p>To check out all the gotchas when building a package,
                   14431:         here are the steps that I do in order to get a package
                   14432:         working. Please note this is basically the same as what was
                   14433:         explained in the previous sections, only with some
                   14434:         debugging aids.</p>
                   14435: 
                   14436:         <div class="itemizedlist">
                   14437:           <ul type="disc">
                   14438:             <li>
1.14      xtraeme  14439:               <p>Be sure to set <code class=
1.45      wiz      14440:               "varname">PKG_DEVELOPER=1</code> in <code xmlns=
                   14441:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14442:               "filename">/etc/mk.conf</code></p>
1.1       grant    14443:             </li>
                   14444: 
                   14445:             <li>
                   14446:               <p>Install <a xmlns=
                   14447:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   14448:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45      wiz      14449:               target="_top"><code xmlns="" class=
                   14450:               "filename">pkgtools/url2pkg</code></a>, create a
1.20      ben      14451:               directory for a new package, change into it, then run
                   14452:               <span><strong class=
                   14453:               "command">url2pkg</strong></span>:</p>
1.1       grant    14454:               <pre class="screen">
1.14      xtraeme  14455: <code class="prompt">%</code> <strong class=
                   14456: "userinput"><code>mkdir /usr/pkgsrc/<em class=
                   14457: "replaceable"><code>category</code></em>/<em class=
                   14458: "replaceable"><code>examplepkg</code></em></code></strong>
                   14459: <code class="prompt">%</code> <strong class=
                   14460: "userinput"><code>cd /usr/pkgsrc/<em class=
                   14461: "replaceable"><code>category</code></em>/<em class=
                   14462: "replaceable"><code>examplepkg</code></em></code></strong>
                   14463: <code class="prompt">%</code> <strong class=
                   14464: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1       grant    14465: </pre>
                   14466:             </li>
                   14467: 
                   14468:             <li>
1.45      wiz      14469:               <p>Edit the <code xmlns=
                   14470:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14471:               "filename">Makefile</code> as requested.</p>
1.1       grant    14472:             </li>
                   14473: 
                   14474:             <li>
1.45      wiz      14475:               <p>Fill in the <code xmlns=
                   14476:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14477:               "filename">DESCR</code> file</p>
1.1       grant    14478:             </li>
                   14479: 
                   14480:             <li>
1.14      xtraeme  14481:               <p>Run <span><strong class="command">make
                   14482:               configure</strong></span></p>
1.1       grant    14483:             </li>
                   14484: 
                   14485:             <li>
                   14486:               <p>Add any dependencies glimpsed from documentation
1.45      wiz      14487:               and the configure step to the package's <code xmlns=
                   14488:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14489:               "filename">Makefile</code>.</p>
1.1       grant    14490:             </li>
                   14491: 
                   14492:             <li>
                   14493:               <p>Make the package compile, doing multiple rounds
                   14494:               of</p>
                   14495:               <pre class="screen">
1.14      xtraeme  14496: <code class="prompt">%</code> <strong class=
                   14497: "userinput"><code>make</code></strong>
                   14498: <code class="prompt">%</code> <strong class=
                   14499: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
                   14500: <code class="prompt">%</code> <strong class=
                   14501: "userinput"><code>mkpatches</code></strong>
                   14502: <code class="prompt">%</code> <strong class=
                   14503: "userinput"><code>patchdiff</code></strong>
                   14504: <code class="prompt">%</code> <strong class=
                   14505: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
                   14506: <code class="prompt">%</code> <strong class=
                   14507: "userinput"><code>make mps</code></strong>
                   14508: <code class="prompt">%</code> <strong class=
                   14509: "userinput"><code>make clean</code></strong>
1.1       grant    14510: </pre>
                   14511: 
                   14512:               <p>Doing as non-root user will ensure that no files
                   14513:               are modified that shouldn't be, especially during the
1.14      xtraeme  14514:               build phase. <span><strong class=
                   14515:               "command">mkpatches</strong></span>,
                   14516:               <span><strong class=
                   14517:               "command">patchdiff</strong></span> and
                   14518:               <span><strong class="command">pkgvi</strong></span>
                   14519:               are from the <a xmlns=
1.1       grant    14520:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   14521:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45      wiz      14522:               target="_top"><code xmlns="" class=
                   14523:               "filename">pkgtools/pkgdiff</code></a> package.</p>
1.1       grant    14524:             </li>
                   14525: 
                   14526:             <li>
1.45      wiz      14527:               <p>Look at the <code xmlns=
                   14528:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14529:               "filename">Makefile</code>, fix if necessary; see
                   14530:               <a href="#components.Makefile" title=
1.38      dillo    14531:               "8.1.&nbsp;Makefile">Section&nbsp;8.1,
1.45      wiz      14532:               &#8220;<code xmlns=
                   14533:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14534:               "filename">Makefile</code>&#8221;</a>.</p>
1.1       grant    14535:             </li>
                   14536: 
                   14537:             <li>
1.45      wiz      14538:               <p>Generate a <code xmlns=
                   14539:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14540:               "filename">PLIST</code>:</p>
1.1       grant    14541:               <pre class="screen">
1.14      xtraeme  14542: <code class="prompt">#</code> <strong class=
                   14543: "userinput"><code>make install</code></strong>
                   14544: <code class="prompt">#</code> <strong class=
                   14545: "userinput"><code>make print-PLIST &gt;PLIST</code></strong>
                   14546: <code class="prompt">#</code> <strong class=
                   14547: "userinput"><code>make deinstall</code></strong>
                   14548: <code class="prompt">#</code> <strong class=
                   14549: "userinput"><code>make install</code></strong>
                   14550: <code class="prompt">#</code> <strong class=
                   14551: "userinput"><code>make deinstall</code></strong>
1.1       grant    14552: </pre>
                   14553: 
1.45      wiz      14554:               <p>You usually need to be <code xmlns=
                   14555:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14556:               "username">root</code> to do this. Look if there are
1.1       grant    14557:               any files left:</p>
                   14558:               <pre class="screen">
1.14      xtraeme  14559: <code class="prompt">#</code> <strong class=
                   14560: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    14561: </pre>
                   14562: 
                   14563:               <p>If this reveals any files that are missing in
1.45      wiz      14564:               <code xmlns=
                   14565:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14566:               "filename">PLIST</code>, add them.</p>
1.1       grant    14567:             </li>
                   14568: 
                   14569:             <li>
1.45      wiz      14570:               <p>Now that the <code xmlns=
                   14571:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14572:               "filename">PLIST</code> is OK, install the package
                   14573:               again and make a binary package:</p>
1.1       grant    14574:               <pre class="screen">
1.14      xtraeme  14575: <code class="prompt">#</code> <strong class=
                   14576: "userinput"><code>make reinstall</code></strong>
                   14577: <code class="prompt">#</code> <strong class=
                   14578: "userinput"><code>make package</code></strong>
1.1       grant    14579: </pre>
                   14580:             </li>
                   14581: 
                   14582:             <li>
                   14583:               <p>Delete the installed package:</p>
                   14584:               <pre class="screen">
1.14      xtraeme  14585: <code class="prompt">#</code> <strong class=
                   14586: "userinput"><code>pkg_delete blub</code></strong>
1.1       grant    14587: </pre>
                   14588:             </li>
                   14589: 
                   14590:             <li>
1.14      xtraeme  14591:               <p>Repeat the above <span><strong class=
                   14592:               "command">make print-PLIST</strong></span> command,
                   14593:               which shouldn't find anything now:</p>
1.1       grant    14594:               <pre class="screen">
1.14      xtraeme  14595: <code class="prompt">#</code> <strong class=
                   14596: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    14597: </pre>
                   14598:             </li>
                   14599: 
                   14600:             <li>
                   14601:               <p>Reinstall the binary package:</p>
                   14602:               <pre class="screen">
1.14      xtraeme  14603: <code class="prompt">#</code> <strong class=
                   14604: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1       grant    14605: </pre>
                   14606:             </li>
                   14607: 
                   14608:             <li>
                   14609:               <p>Play with it. Make sure everything works.</p>
                   14610:             </li>
                   14611: 
                   14612:             <li>
1.14      xtraeme  14613:               <p>Run <span><strong class=
                   14614:               "command">pkglint</strong></span> from <a xmlns=
1.1       grant    14615:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   14616:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45      wiz      14617:               target="_top"><code xmlns="" class=
                   14618:               "filename">pkgtools/pkglint</code></a>, and fix the
1.20      ben      14619:               problems it reports:</p>
1.1       grant    14620:               <pre class="screen">
1.14      xtraeme  14621: <code class="prompt">#</code> <strong class=
                   14622: "userinput"><code>pkglint</code></strong>
1.1       grant    14623: </pre>
                   14624:             </li>
                   14625: 
                   14626:             <li>
                   14627:               <p>Submit (or commit, if you have cvs access); see
                   14628:               <a href="#submit" title=
1.38      dillo    14629:               "Chapter&nbsp;17.&nbsp;Submitting and Committing">Chapter&nbsp;17,
1.1       grant    14630:               <i>Submitting and Committing</i></a>.</p>
                   14631:             </li>
                   14632:           </ul>
                   14633:         </div>
                   14634:       </div>
                   14635: 
1.66    ! rillig   14636:       <div class="chapter" lang="en" xml:lang="en">
1.1       grant    14637:         <div class="titlepage">
                   14638:           <div>
                   14639:             <div>
1.66    ! rillig   14640:               <h2 class="title"><a name="submit" id=
1.38      dillo    14641:               "submit"></a>Chapter&nbsp;17.&nbsp;Submitting and
1.1       grant    14642:               Committing</h2>
                   14643:             </div>
                   14644:           </div>
                   14645:         </div>
                   14646: 
                   14647:         <div class="toc">
                   14648:           <p><b>Table of Contents</b></p>
                   14649: 
                   14650:           <dl>
1.30      wiz      14651:             <dt><span class="sect1"><a href=
1.38      dillo    14652:             "#submitting-your-package">17.1. Submitting your
1.30      wiz      14653:             packages</a></span></dt>
1.1       grant    14654: 
1.30      wiz      14655:             <dt><span class="sect1"><a href=
1.41      wiz      14656:             "#general-notes-for-changes">17.2. General notes when
                   14657:             adding, updating, or removing packages</a></span></dt>
                   14658: 
                   14659:             <dt><span class="sect1"><a href=
                   14660:             "#committing-importing">17.3. Committing: Importing a
1.30      wiz      14661:             package into CVS</a></span></dt>
1.1       grant    14662: 
1.30      wiz      14663:             <dt><span class="sect1"><a href=
1.41      wiz      14664:             "#updating-package">17.4. Updating a package to a newer
1.30      wiz      14665:             version</a></span></dt>
1.1       grant    14666: 
1.41      wiz      14667:             <dt><span class="sect1"><a href="#moving-package">17.5.
1.2       hubertf  14668:             Moving a package in pkgsrc</a></span></dt>
1.1       grant    14669:           </dl>
                   14670:         </div>
                   14671: 
1.66    ! rillig   14672:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    14673:           <div class="titlepage">
                   14674:             <div>
                   14675:               <div>
                   14676:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   14677:                 "submitting-your-package" id=
1.38      dillo    14678:                 "submitting-your-package"></a>17.1.&nbsp;Submitting
1.30      wiz      14679:                 your packages</h2>
1.1       grant    14680:               </div>
                   14681:             </div>
                   14682:           </div>
                   14683: 
                   14684:           <p>You have to separate between binary and
                   14685:           &#8220;<span class="quote">normal</span>&#8221; (source)
                   14686:           packages here:</p>
                   14687: 
                   14688:           <div class="itemizedlist">
                   14689:             <ul type="disc">
                   14690:               <li>
                   14691:                 <p>precompiled binary packages</p>
                   14692: 
                   14693:                 <p>Our policy is that we accept binaries only from
                   14694:                 pkgsrc developers to guarantee that the packages
                   14695:                 don't contain any trojan horses etc. This is not to
1.13      hubertf  14696:                 annoy anyone but rather to protect our users!
1.1       grant    14697:                 You're still free to put up your home-made binary
1.13      hubertf  14698:                 packages and tell the world where to get them.
                   14699:                 NetBSD developers doing bulk builds and wanting to
                   14700:                 upload them please see <a href="#bulk-upload"
1.38      dillo    14701:                 title="6.3.8.&nbsp;Uploading results of a bulk build">
                   14702:                 Section&nbsp;6.3.8, &#8220;Uploading results of a
1.13      hubertf  14703:                 bulk build&#8221;</a>.</p>
1.1       grant    14704:               </li>
                   14705: 
                   14706:               <li>
                   14707:                 <p>packages</p>
                   14708: 
                   14709:                 <p>First, check that your package is complete,
                   14710:                 compiles and runs well; see <a href="#debug" title=
1.38      dillo    14711:                 "Chapter&nbsp;16.&nbsp;Debugging">Chapter&nbsp;16,
1.1       grant    14712:                 <i>Debugging</i></a> and the rest of this document.
1.24      wiz      14713:                 Next, generate an uuencoded gzipped <a href=
                   14714:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   14715:                 <span class="citerefentry"><span class=
                   14716:                 "refentrytitle">tar</span>(1)</span></a> archive,
1.1       grant    14717:                 preferably with all files in a single directory.
1.14      xtraeme  14718:                 Finally, <span><strong class=
                   14719:                 "command">send-pr</strong></span> with category
1.1       grant    14720:                 &#8220;<span class="quote">pkg</span>&#8221;, a
                   14721:                 synopsis which includes the package name and
                   14722:                 version number, a short description of your package
                   14723:                 (contents of the COMMENT variable or DESCR file are
                   14724:                 OK) and attach the archive to your PR.</p>
                   14725: 
                   14726:                 <p>If you want to submit several packages, please
                   14727:                 send a separate PR for each one, it's easier for us
                   14728:                 to track things that way.</p>
                   14729: 
                   14730:                 <p>Alternatively, you can also import new packages
                   14731:                 into pkgsrc-wip (&#8220;<span class="quote">pkgsrc
                   14732:                 work-in-progress</span>&#8221;); see the homepage
                   14733:                 at <a href="http://pkgsrc-wip.sourceforge.net/"
                   14734:                 target=
                   14735:                 "_top">http://pkgsrc-wip.sourceforge.net/</a> for
                   14736:                 details.</p>
                   14737:               </li>
                   14738:             </ul>
                   14739:           </div>
                   14740:         </div>
                   14741: 
1.66    ! rillig   14742:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    14743:           <div class="titlepage">
                   14744:             <div>
                   14745:               <div>
                   14746:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   14747:                 "general-notes-for-changes" id=
1.41      wiz      14748:                 "general-notes-for-changes"></a>17.2.&nbsp;General
                   14749:                 notes when adding, updating, or removing
                   14750:                 packages</h2>
                   14751:               </div>
                   14752:             </div>
                   14753:           </div>
                   14754: 
                   14755:           <p>Please note all package additions, updates, moves, and
1.45      wiz      14756:           removals in <code xmlns=
                   14757:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      14758:           "filename">pkgsrc/doc/CHANGES</code>. It's very important
                   14759:           to keep this file up to date and conforming to the
                   14760:           existing format, because it will be used by scripts to
                   14761:           automatically update pages on <a href=
                   14762:           "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
1.45      wiz      14763:           and other sites. Additionally, check the <code xmlns=
                   14764:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      14765:           "filename">pkgsrc/doc/TODO</code> file and remove the
                   14766:           entry for the package you updated or removed, in case it
                   14767:           was mentioned there.</p>
                   14768: 
                   14769:           <p>There is a make target that helps in creating proper
1.45      wiz      14770:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   14771:           class="filename">CHANGES</code> entries:
1.41      wiz      14772:           <span><strong class="command">make
                   14773:           changes-entry</strong></span>. It uses the optional
                   14774:           <code class="varname">CTYPE</code> and <code class=
                   14775:           "varname">NETBSD_LOGIN_NAME</code> variables. The general
1.45      wiz      14776:           usage is to first make sure that your <code xmlns=
                   14777:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      14778:           "filename">CHANGES</code> file is up-to-date (to avoid
                   14779:           having to resolve conflicts later-on) and then to
                   14780:           <span><strong class="command">cd</strong></span> to the
                   14781:           package directory. For package updates,
                   14782:           <span><strong class="command">make
                   14783:           changes-entry</strong></span> is enough. For new
                   14784:           packages, or package moves or removals, set the
                   14785:           <code class="varname">CTYPE</code> variable on the
                   14786:           command line to "Added", "Moved", or "Removed". You can
                   14787:           set <code class="varname">NETBSD_LOGIN_NAME</code> in
1.45      wiz      14788:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   14789:           class="filename">/etc/mk.conf</code> if your local login
                   14790:           name is not the same as your NetBSD login name. Don't
                   14791:           forget to commit the changes to <code xmlns=
                   14792:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      14793:           "filename">pkgsrc/doc/CHANGES</code>!</p>
                   14794:         </div>
                   14795: 
1.66    ! rillig   14796:         <div class="sect1" lang="en" xml:lang="en">
1.41      wiz      14797:           <div class="titlepage">
                   14798:             <div>
                   14799:               <div>
                   14800:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   14801:                 "committing-importing" id=
1.41      wiz      14802:                 "committing-importing"></a>17.3.&nbsp;Committing:
1.30      wiz      14803:                 Importing a package into CVS</h2>
1.1       grant    14804:               </div>
                   14805:             </div>
                   14806:           </div>
                   14807: 
                   14808:           <p>This section is only of interest for pkgsrc developers
                   14809:           with write access to the pkgsrc repository. Please
                   14810:           remember that cvs imports files relative to the current
                   14811:           working directory, and that the pathname that you give
1.14      xtraeme  14812:           the <span><strong class="command">cvs
                   14813:           import</strong></span> command is so that it knows where
                   14814:           to place the files in the repository. Newly created
                   14815:           packages should be imported with a vendor tag of
                   14816:           &#8220;<span class="quote">TNF</span>&#8221; and a
                   14817:           release tag of &#8220;<span class=
                   14818:           "quote">pkgsrc-base</span>&#8221;, e.g:</p>
1.1       grant    14819:           <pre class="programlisting">
1.51      rillig   14820:     <code class="prompt">$</code> cd .../pkgsrc/category/pkgname
                   14821:     <code class=
                   14822: "prompt">$</code> cvs import pkgsrc/category/pkgname TNF pkgsrc-base
1.1       grant    14823: </pre>
                   14824: 
                   14825:           <p>Remember to move the directory from which you imported
                   14826:           out of the way, or cvs will complain the next time you
                   14827:           &#8220;<span class="quote">cvs update</span>&#8221; your
                   14828:           source tree. Also don't forget to add the new package to
1.45      wiz      14829:           the category's <code xmlns=
                   14830:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14831:           "filename">Makefile</code>.</p>
1.1       grant    14832: 
                   14833:           <p>The commit message of the initial import should
1.45      wiz      14834:           include part of the <code xmlns=
                   14835:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   14836:           "filename">DESCR</code> file, so people reading the
                   14837:           mailing lists know what the package is/does.</p>
1.1       grant    14838: 
                   14839:           <p>For new packages, &#8220;<span class="quote">cvs
                   14840:           import</span>&#8221; is preferred to &#8220;<span class=
                   14841:           "quote">cvs add</span>&#8221; because the former gets
                   14842:           everything with a single command, and provides a
                   14843:           consistent tag.</p>
                   14844:         </div>
                   14845: 
1.66    ! rillig   14846:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    14847:           <div class="titlepage">
                   14848:             <div>
                   14849:               <div>
                   14850:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   14851:                 "updating-package" id=
1.41      wiz      14852:                 "updating-package"></a>17.4.&nbsp;Updating a
1.30      wiz      14853:                 package to a newer version</h2>
1.1       grant    14854:               </div>
                   14855:             </div>
                   14856:           </div>
                   14857: 
                   14858:           <p>Please always put a concise, appropriate and relevant
                   14859:           summary of the changes between old and new versions into
                   14860:           the commit log when updating a package. There are various
                   14861:           reasons for this:</p>
                   14862: 
                   14863:           <div class="itemizedlist">
                   14864:             <ul type="disc">
                   14865:               <li>
                   14866:                 <p>A URL is volatile, and can change over time. It
                   14867:                 may go away completely or its information may be
                   14868:                 overwritten by newer information.</p>
                   14869:               </li>
                   14870: 
                   14871:               <li>
                   14872:                 <p>Having the change information between old and
                   14873:                 new versions in our CVS repository is very useful
                   14874:                 for people who use either cvs or anoncvs.</p>
                   14875:               </li>
                   14876: 
                   14877:               <li>
                   14878:                 <p>Having the change information between old and
                   14879:                 new versions in our CVS repository is very useful
                   14880:                 for people who read the pkgsrc-changes mailing
                   14881:                 list, so that they can make tactical decisions
                   14882:                 about when to upgrade the package.</p>
                   14883:               </li>
                   14884:             </ul>
                   14885:           </div>
                   14886: 
1.18      xtraeme  14887:           <p>Please also recognize that, just because a new version
1.1       grant    14888:           of a package has been released, it should not
                   14889:           automatically be upgraded in the CVS repository. We
                   14890:           prefer to be conservative in the packages that are
                   14891:           included in pkgsrc - development or beta packages are not
                   14892:           really the best thing for most places in which pkgsrc is
                   14893:           used. Please use your judgement about what should go into
                   14894:           pkgsrc, and bear in mind that stability is to be
                   14895:           preferred above new and possibly untested features.</p>
                   14896:         </div>
                   14897: 
1.66    ! rillig   14898:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    14899:           <div class="titlepage">
                   14900:             <div>
                   14901:               <div>
                   14902:                 <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   14903:                 "moving-package" id=
1.41      wiz      14904:                 "moving-package"></a>17.5.&nbsp;Moving a package in
1.30      wiz      14905:                 pkgsrc</h2>
1.1       grant    14906:               </div>
                   14907:             </div>
                   14908:           </div>
                   14909: 
                   14910:           <div class="orderedlist">
                   14911:             <ol type="1">
                   14912:               <li>
                   14913:                 <p>Make a copy of the directory somewhere else.</p>
                   14914:               </li>
                   14915: 
                   14916:               <li>
                   14917:                 <p>Remove all CVS dirs.</p>
                   14918: 
                   14919:                 <p>Alternatively to the first two steps you can
                   14920:                 also do:</p>
                   14921:                 <pre class="screen">
1.14      xtraeme  14922: <code class="prompt">%</code> <strong class=
                   14923: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1       grant    14924: </pre>
                   14925: 
                   14926:                 <p>and use that for further work.</p>
                   14927:               </li>
                   14928: 
                   14929:               <li>
1.14      xtraeme  14930:                 <p>Fix <code class="varname">CATEGORIES</code> and
                   14931:                 any <code class="varname">DEPENDS</code> paths that
                   14932:                 just did &#8220;<span class=
1.1       grant    14933:                 "quote">../package</span>&#8221; instead of
                   14934:                 &#8220;<span class=
                   14935:                 "quote">../../category/package</span>&#8221;.</p>
                   14936:               </li>
                   14937: 
                   14938:               <li>
1.14      xtraeme  14939:                 <p><span><strong class="command">cvs
                   14940:                 import</strong></span> the modified package in the
                   14941:                 new place.</p>
1.1       grant    14942:               </li>
                   14943: 
                   14944:               <li>
                   14945:                 <p>Check if any package depends on it:</p>
                   14946:                 <pre class="screen">
1.14      xtraeme  14947: <code class="prompt">%</code> <strong class=
                   14948: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   14949: <code class="prompt">%</code> <strong class=
                   14950: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1       grant    14951: </pre>
                   14952:               </li>
                   14953: 
                   14954:               <li>
                   14955:                 <p>Fix paths in packages from step 5 to point to
                   14956:                 new location.</p>
                   14957:               </li>
                   14958: 
                   14959:               <li>
1.14      xtraeme  14960:                 <p><span><strong class="command">cvs rm
                   14961:                 (-f)</strong></span> the package at the old
                   14962:                 location.</p>
1.1       grant    14963:               </li>
                   14964: 
                   14965:               <li>
1.45      wiz      14966:                 <p>Remove from <code xmlns=
                   14967:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14968:                 "filename">oldcategory/Makefile</code>.</p>
1.1       grant    14969:               </li>
                   14970: 
                   14971:               <li>
1.45      wiz      14972:                 <p>Add to <code xmlns=
                   14973:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14974:                 "filename">newcategory/Makefile</code>.</p>
1.1       grant    14975:               </li>
                   14976: 
                   14977:               <li>
                   14978:                 <p>Commit the changed and removed files:</p>
                   14979:                 <pre class="screen">
1.14      xtraeme  14980: <code class="prompt">%</code> <strong class=
                   14981: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1       grant    14982: </pre>
                   14983: 
                   14984:                 <p>(and any packages from step 5, of course).</p>
                   14985:               </li>
                   14986:             </ol>
                   14987:           </div>
                   14988:         </div>
                   14989:       </div>
                   14990:     </div>
                   14991: 
1.66    ! rillig   14992:     <div class="appendix" lang="en" xml:lang="en">
1.1       grant    14993:       <div class="titlepage">
                   14994:         <div>
                   14995:           <div>
1.66    ! rillig   14996:             <h2 class="title"><a name="examples" id=
1.46      gdt      14997:             "examples"></a>Appendix&nbsp;A.&nbsp;A simple example
1.1       grant    14998:             package: bison</h2>
                   14999:           </div>
                   15000:         </div>
                   15001:       </div>
                   15002: 
                   15003:       <div class="toc">
                   15004:         <p><b>Table of Contents</b></p>
                   15005: 
                   15006:         <dl>
1.46      gdt      15007:           <dt><span class="sect1"><a href="#example-files">A.1.
1.1       grant    15008:           files</a></span></dt>
                   15009: 
                   15010:           <dd>
                   15011:             <dl>
1.30      wiz      15012:               <dt><span class="sect2"><a href=
1.46      gdt      15013:               "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1       grant    15014: 
1.30      wiz      15015:               <dt><span class="sect2"><a href=
1.46      gdt      15016:               "#example-descr">A.1.2. DESCR</a></span></dt>
1.1       grant    15017: 
1.30      wiz      15018:               <dt><span class="sect2"><a href=
1.46      gdt      15019:               "#example-plist">A.1.3. PLIST</a></span></dt>
1.1       grant    15020: 
1.30      wiz      15021:               <dt><span class="sect2"><a href=
1.46      gdt      15022:               "#checking-package-with-pkglint">A.1.4. Checking a
1.30      wiz      15023:               package with <span><strong class=
1.14      xtraeme  15024:               "command">pkglint</strong></span></a></span></dt>
1.1       grant    15025:             </dl>
                   15026:           </dd>
                   15027: 
1.46      gdt      15028:           <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30      wiz      15029:           Steps for building, installing, packaging</a></span></dt>
1.1       grant    15030:         </dl>
                   15031:       </div>
                   15032: 
                   15033:       <p>We checked to find a piece of software that wasn't in the
                   15034:       packages collection, and picked GNU bison. Quite why someone
1.14      xtraeme  15035:       would want to have <span><strong class=
                   15036:       "command">bison</strong></span> when Berkeley
                   15037:       <span><strong class="command">yacc</strong></span> is already
                   15038:       present in the tree is beyond us, but it's useful for the
                   15039:       purposes of this exercise.</p>
1.1       grant    15040: 
1.66    ! rillig   15041:       <div class="sect1" lang="en" xml:lang="en">
1.1       grant    15042:         <div class="titlepage">
                   15043:           <div>
                   15044:             <div>
                   15045:               <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   15046:               "example-files" id=
1.46      gdt      15047:               "example-files"></a>A.1.&nbsp;files</h2>
1.1       grant    15048:             </div>
                   15049:           </div>
                   15050:         </div>
                   15051: 
1.66    ! rillig   15052:         <div class="sect2" lang="en" xml:lang="en">
1.1       grant    15053:           <div class="titlepage">
                   15054:             <div>
                   15055:               <div>
1.66    ! rillig   15056:                 <h3 class="title"><a name="example-Makefile" id=
1.46      gdt      15057:                 "example-Makefile"></a>A.1.1.&nbsp;Makefile</h3>
1.1       grant    15058:               </div>
                   15059:             </div>
                   15060:           </div>
                   15061:           <pre class="programlisting">
1.51      rillig   15062:     # $NetBSD$
                   15063:     #
1.1       grant    15064: 
1.51      rillig   15065:     DISTNAME=       bison-1.25
                   15066:     CATEGORIES=     devel
                   15067:     MASTER_SITES=   ${MASTER_SITE_GNU}
1.1       grant    15068: 
1.51      rillig   15069:     MAINTAINER=     thorpej@NetBSD.org
                   15070:     HOMEPAGE=       http://www.gnu.org/software/bison/bison.html
                   15071:     COMMENT=        GNU yacc clone
1.1       grant    15072: 
1.51      rillig   15073:     GNU_CONFIGURE=  yes
                   15074:     INFO_FILES=     bison.info
1.1       grant    15075: 
1.51      rillig   15076:     .include "../../mk/bsd.pkg.mk"
1.1       grant    15077: </pre>
                   15078:         </div>
                   15079: 
1.66    ! rillig   15080:         <div class="sect2" lang="en" xml:lang="en">
1.1       grant    15081:           <div class="titlepage">
                   15082:             <div>
                   15083:               <div>
1.66    ! rillig   15084:                 <h3 class="title"><a name="example-descr" id=
1.46      gdt      15085:                 "example-descr"></a>A.1.2.&nbsp;DESCR</h3>
1.1       grant    15086:               </div>
                   15087:             </div>
                   15088:           </div>
                   15089:           <pre class="programlisting">
1.51      rillig   15090:     GNU version of yacc.  Can make re-entrant parsers, and numerous other
                   15091:     improvements.  Why you would want this when Berkeley <a href=
1.1       grant    15092: "http://netbsd.gw.com/cgi-bin/man-cgi?yacc+1+NetBSD-current"><span class="citerefentry"><span class="refentrytitle">yacc</span>(1)</span></a> is part
1.51      rillig   15093:     of the NetBSD source tree is beyond me.
1.1       grant    15094: </pre>
                   15095:         </div>
                   15096: 
1.66    ! rillig   15097:         <div class="sect2" lang="en" xml:lang="en">
1.1       grant    15098:           <div class="titlepage">
                   15099:             <div>
                   15100:               <div>
1.66    ! rillig   15101:                 <h3 class="title"><a name="example-plist" id=
1.46      gdt      15102:                 "example-plist"></a>A.1.3.&nbsp;PLIST</h3>
1.1       grant    15103:               </div>
                   15104:             </div>
                   15105:           </div>
                   15106:           <pre class="programlisting">
1.51      rillig   15107:     @comment $NetBSD$
                   15108:     bin/bison
                   15109:     man/man1/bison.1.gz
                   15110:     share/bison.simple
                   15111:     share/bison.hairy
1.1       grant    15112: </pre>
                   15113:         </div>
                   15114: 
1.66    ! rillig   15115:         <div class="sect2" lang="en" xml:lang="en">
1.1       grant    15116:           <div class="titlepage">
                   15117:             <div>
                   15118:               <div>
1.30      wiz      15119:                 <h3 class="title"><a name=
1.66    ! rillig   15120:                 "checking-package-with-pkglint" id=
1.46      gdt      15121:                 "checking-package-with-pkglint"></a>A.1.4.&nbsp;Checking
1.30      wiz      15122:                 a package with <span><strong class=
1.14      xtraeme  15123:                 "command">pkglint</strong></span></h3>
1.1       grant    15124:               </div>
                   15125:             </div>
                   15126:           </div>
                   15127: 
                   15128:           <p>The NetBSD package system comes with <a xmlns=
                   15129:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   15130:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45      wiz      15131:           target="_top"><code xmlns="" class=
                   15132:           "filename">pkgtools/pkglint</code></a> which helps to
                   15133:           check the contents of these files. After installation it
                   15134:           is quite easy to use, just change to the directory of the
1.20      ben      15135:           package you wish to examine and execute
                   15136:           <span><strong class=
                   15137:           "command">pkglint</strong></span>:</p>
1.1       grant    15138:           <pre class="screen">
1.14      xtraeme  15139: <code class="prompt">$</code> <strong class=
                   15140: "userinput"><code>pkglint</code></strong>
1.1       grant    15141: looks fine.
                   15142: </pre>
                   15143: 
                   15144:           <p>Depending on the supplied command line arguments (see
1.60      rillig   15145:           pkglint(1)), more checks will be performed. Use e.g.
                   15146:           <span><strong class="command">pkglint -Call
                   15147:           -Wall</strong></span> for a very thorough check.</p>
1.1       grant    15148:         </div>
                   15149:       </div>
                   15150: 
1.66    ! rillig   15151:       <div class="sect1" lang="en" xml:lang="en">
1.1       grant    15152:         <div class="titlepage">
                   15153:           <div>
                   15154:             <div>
                   15155:               <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   15156:               "steps-for-b-i-p" id=
1.46      gdt      15157:               "steps-for-b-i-p"></a>A.2.&nbsp;Steps for building,
1.30      wiz      15158:               installing, packaging</h2>
1.1       grant    15159:             </div>
                   15160:           </div>
                   15161:         </div>
                   15162: 
                   15163:         <p>Create the directory where the package lives, plus any
                   15164:         auxiliary directories:</p>
                   15165:         <pre class="screen">
1.14      xtraeme  15166: <code class="prompt">#</code> <strong class=
                   15167: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
                   15168: <code class="prompt">#</code> <strong class=
                   15169: "userinput"><code>mkdir bison</code></strong>
                   15170: <code class="prompt">#</code> <strong class=
                   15171: "userinput"><code>cd bison</code></strong>
                   15172: <code class="prompt">#</code> <strong class=
                   15173: "userinput"><code>mkdir patches</code></strong>
1.1       grant    15174: </pre>
                   15175: 
1.45      wiz      15176:         <p>Create <code xmlns=
                   15177:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   15178:         "filename">Makefile</code>, <code xmlns=
                   15179:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   15180:         "filename">DESCR</code> and <code xmlns=
                   15181:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15182:         "filename">PLIST</code> (see <a href="#components" title=
1.38      dillo    15183:         "Chapter&nbsp;8.&nbsp;Package components - files, directories and contents">
1.66    ! rillig   15184:         Chapter 8, <i>Package components - files, directories and
        !          15185:         contents</i></a>) then continue with fetching the
1.1       grant    15186:         distfile:</p>
                   15187:         <pre class="screen">
1.14      xtraeme  15188: <code class="prompt">#</code> <strong class=
                   15189: "userinput"><code>make fetch</code></strong>
1.1       grant    15190: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   15191: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   15192: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   15193: ftp: Error retrieving file: 500 Internal error
                   15194: 
                   15195: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   15196: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   15197: ftp: Error retrieving file: 500 Internal error
                   15198: 
                   15199: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   15200: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   15201: Successfully retrieved file.
                   15202: </pre>
                   15203: 
1.45      wiz      15204:         <p>Generate the checksum of the distfile into <code xmlns=
                   15205:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15206:         "filename">distinfo</code>:</p>
1.1       grant    15207:         <pre class="screen">
1.14      xtraeme  15208: <code class="prompt">#</code> <strong class=
                   15209: "userinput"><code>make makesum</code></strong>
1.1       grant    15210: </pre>
                   15211: 
                   15212:         <p>Now compile:</p>
                   15213:         <pre class="screen">
1.14      xtraeme  15214: <code class="prompt">#</code> <strong class=
                   15215: "userinput"><code>make</code></strong>
1.1       grant    15216: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   15217: ===&gt;  Extracting for bison-1.25
                   15218: ===&gt;  Patching for bison-1.25
                   15219: ===&gt;   Ignoring empty patch directory
                   15220: ===&gt;  Configuring for bison-1.25
                   15221: creating cache ./config.cache
                   15222: checking for gcc... cc
                   15223: checking whether we are using GNU C... yes
                   15224: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   15225: checking how to run the C preprocessor... cc -E
                   15226: checking for minix/config.h... no
                   15227: checking for POSIXized ISC... no
                   15228: checking whether cross-compiling... no
                   15229: checking for ANSI C header files... yes
                   15230: checking for string.h... yes
                   15231: checking for stdlib.h... yes
                   15232: checking for memory.h... yes
                   15233: checking for working const... yes
                   15234: checking for working alloca.h... no
                   15235: checking for alloca... yes
                   15236: checking for strerror... yes
                   15237: updating cache ./config.cache
                   15238: creating ./config.status
                   15239: creating Makefile
                   15240: ===&gt;  Building for bison-1.25
                   15241: 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
                   15242: 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
                   15243: 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
                   15244: 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
                   15245: 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
                   15246: 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 
                   15247: 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
                   15248: 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
                   15249: 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
                   15250: 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
                   15251: 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
                   15252: 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
                   15253: 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
                   15254: 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
                   15255: 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
                   15256: 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
                   15257: 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
                   15258: 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
                   15259: 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
                   15260: 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
                   15261: 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
                   15262: 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
                   15263: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   15264: rm -f bison.s1
                   15265: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1
                   15266: </pre>
                   15267: 
                   15268:         <p>Everything seems OK, so install the files:</p>
                   15269:         <pre class="screen">
1.14      xtraeme  15270: <code class="prompt">#</code> <strong class=
                   15271: "userinput"><code>make install</code></strong>
1.1       grant    15272: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   15273: ===&gt;  Installing for bison-1.25
                   15274: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   15275: rm -f /usr/pkg/bin/bison
                   15276: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   15277: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   15278: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   15279: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   15280: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   15281: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   15282: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
                   15283: ===&gt;  Registering installation for bison-1.25
                   15284: </pre>
                   15285: 
                   15286:         <p>You can now use bison, and also - if you decide so -
1.14      xtraeme  15287:         remove it with <span><strong class="command">pkg_delete
                   15288:         bison</strong></span>. Should you decide that you want a
                   15289:         binary package, do this now:</p>
1.1       grant    15290:         <pre class="screen">
1.14      xtraeme  15291: <code class="prompt">#</code> <strong class=
                   15292: "userinput"><code>make package</code></strong>
1.1       grant    15293: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   15294: ===&gt;  Building package for bison-1.25
                   15295: Creating package bison-1.25.tgz
                   15296: Registering depends:.
                   15297: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
                   15298: </pre>
                   15299: 
                   15300:         <p>Now that you don't need the source and object files any
                   15301:         more, clean up:</p>
                   15302:         <pre class="screen">
1.14      xtraeme  15303: <code class="prompt">#</code> <strong class=
                   15304: "userinput"><code>make clean</code></strong>
1.1       grant    15305: ===&gt;  Cleaning for bison-1.25
                   15306: </pre>
                   15307:       </div>
                   15308:     </div>
                   15309: 
1.66    ! rillig   15310:     <div class="appendix" lang="en" xml:lang="en">
1.1       grant    15311:       <div class="titlepage">
                   15312:         <div>
                   15313:           <div>
1.66    ! rillig   15314:             <h2 class="title"><a name="logs" id=
1.46      gdt      15315:             "logs"></a>Appendix&nbsp;B.&nbsp;Build logs</h2>
1.1       grant    15316:           </div>
                   15317:         </div>
                   15318:       </div>
                   15319: 
                   15320:       <div class="toc">
                   15321:         <p><b>Table of Contents</b></p>
                   15322: 
                   15323:         <dl>
1.46      gdt      15324:           <dt><span class="sect1"><a href="#logs.building">B.1.
1.1       grant    15325:           Building figlet</a></span></dt>
                   15326: 
1.46      gdt      15327:           <dt><span class="sect1"><a href="#logs.package">B.2.
1.1       grant    15328:           Packaging figlet</a></span></dt>
                   15329:         </dl>
                   15330:       </div>
                   15331: 
1.66    ! rillig   15332:       <div class="sect1" lang="en" xml:lang="en">
1.1       grant    15333:         <div class="titlepage">
                   15334:           <div>
                   15335:             <div>
                   15336:               <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   15337:               "logs.building" id=
1.46      gdt      15338:               "logs.building"></a>B.1.&nbsp;Building figlet</h2>
1.1       grant    15339:             </div>
                   15340:           </div>
                   15341:         </div>
                   15342:         <pre class="screen">
1.14      xtraeme  15343: <code class="prompt">#</code> <strong class=
                   15344: "userinput"><code>make</code></strong>
1.1       grant    15345: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   15346: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   15347: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   15348: =&gt; [172219 bytes]
                   15349: Connected to ftp.plig.net.
                   15350: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   15351: 331 Guest login ok, send your complete e-mail address as password.
                   15352: 230-You are user #5 of 500 simultaneous users allowed.
                   15353: 230-
                   15354: 230-  ___ _             _ _                   
                   15355: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___ 
                   15356: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   15357: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   15358: 230-         |_|   |_|     |___|         |___|
                   15359: 230-
                   15360: 230-** Welcome to ftp.plig.org **
                   15361: 230-
                   15362: 230-Please note that all transfers from this FTP site are logged. If you
                   15363: 230-do not like this, please disconnect now.
                   15364: 230-
                   15365: 230-This arhive is available via
                   15366: 230-
                   15367: 230-HTTP:  http://ftp.plig.org/
                   15368: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   15369: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   15370: 230-
                   15371: 230-Please email comments, bug reports and requests for packages to be
                   15372: 230-mirrored to ftp-admin@plig.org.   
                   15373: 230-
                   15374: 230-
                   15375: 230 Logged in anonymously.
                   15376: Remote system type is UNIX.
                   15377: Using binary mode to transfer files.
                   15378: 200 Type okay.
                   15379: 250 "/pub" is new cwd.
                   15380: 250-"/pub/figlet" is new cwd.
                   15381: 250-
                   15382: 250-Welcome to the figlet archive at ftp.figlet.org
                   15383: 250-    
                   15384: 250-    ftp://ftp.figlet.org/pub/figlet/
                   15385: 250-
                   15386: 250-The official FIGlet web page is:
                   15387: 250-    http://www.figlet.org/
                   15388: 250-
                   15389: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   15390: 250-contribute a font or something else, you can email us.
                   15391: 250 
                   15392: 250 "/pub/figlet/program" is new cwd.
                   15393: 250 "/pub/figlet/program/unix" is new cwd.
                   15394: local: figlet221.tar.gz remote: figlet221.tar.gz
                   15395: 502 Unimplemented command.
                   15396: 227 Entering Passive Mode (195,40,6,41,246,104)
                   15397: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   15398: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   15399: 226 Transfer completed.
                   15400: 172219 bytes received in 00:02 (75.99 KB/s)
                   15401: 221 Goodbye.
                   15402: =&gt; Checksum OK for figlet221.tar.gz.
                   15403: ===&gt; Extracting for figlet-2.2.1nb2
                   15404: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   15405: ===&gt; Patching for figlet-2.2.1nb2
                   15406: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   15407: ===&gt; Overriding tools for figlet-2.2.1nb2
                   15408: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   15409: ===&gt; Configuring for figlet-2.2.1nb2
                   15410: ===&gt; Building for figlet-2.2.1nb2
                   15411: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   15412: chmod a+x figlet
                   15413: gcc -O2 -o chkfont chkfont.c
                   15414: =&gt; Unwrapping files-to-be-installed.
1.14      xtraeme  15415: <code class="prompt">#</code>
                   15416: <code class="prompt">#</code> <strong class=
                   15417: "userinput"><code>make install</code></strong>
1.1       grant    15418: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   15419: ===&gt; Installing for figlet-2.2.1nb2
                   15420: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   15421: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   15422: mkdir -p /usr/pkg/share/figlet
                   15423: cp figlet /usr/pkg/bin
                   15424: cp chkfont /usr/pkg/bin
                   15425: chmod 555 figlist showfigfonts
                   15426: cp figlist /usr/pkg/bin
                   15427: cp showfigfonts /usr/pkg/bin
                   15428: cp fonts/*.flf /usr/pkg/share/figlet
                   15429: cp fonts/*.flc /usr/pkg/share/figlet
                   15430: cp figlet.6 /usr/pkg/man/man6
                   15431: ===&gt; Registering installation for figlet-2.2.1nb2
1.14      xtraeme  15432: <code class="prompt">#</code>
1.1       grant    15433: </pre>
                   15434:       </div>
                   15435: 
1.66    ! rillig   15436:       <div class="sect1" lang="en" xml:lang="en">
1.1       grant    15437:         <div class="titlepage">
                   15438:           <div>
                   15439:             <div>
                   15440:               <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   15441:               "logs.package" id=
1.46      gdt      15442:               "logs.package"></a>B.2.&nbsp;Packaging figlet</h2>
1.1       grant    15443:             </div>
                   15444:           </div>
                   15445:         </div>
                   15446:         <pre class="screen">
1.14      xtraeme  15447: <code class="prompt">#</code> <strong class=
                   15448: "userinput"><code>make package</code></strong>
1.1       grant    15449: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   15450: ===&gt; Packaging figlet-2.2.1nb2
                   15451: ===&gt; Building binary package for figlet-2.2.1nb2
                   15452: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   15453: Using SrcDir value of /usr/pkg
                   15454: Registering depends:.  
1.14      xtraeme  15455: <code class="prompt">#</code>
1.1       grant    15456: </pre>
                   15457:       </div>
                   15458:     </div>
                   15459: 
1.66    ! rillig   15460:     <div class="appendix" lang="en" xml:lang="en">
1.1       grant    15461:       <div class="titlepage">
                   15462:         <div>
                   15463:           <div>
1.66    ! rillig   15464:             <h2 class="title"><a name="ftp-layout" id=
1.46      gdt      15465:             "ftp-layout"></a>Appendix&nbsp;C.&nbsp;Layout of the
1.1       grant    15466:             FTP server's package archive</h2>
                   15467:           </div>
                   15468:         </div>
                   15469:       </div>
                   15470: 
                   15471:       <p>Layout for precompiled binary packages on
                   15472:       ftp.NetBSD.org:</p>
                   15473:       <pre class="programlisting">
1.51      rillig   15474:     /pub/NetBSD/packages/
                   15475:         distfiles/
1.1       grant    15476: 
1.51      rillig   15477:         # Unpacked pkgsrc trees
                   15478:         pkgsrc-current -&gt; /pub/NetBSD/NetBSD-current/pkgsrc
                   15479:         pkgsrc-2003Q4 -&gt; N/A
                   15480:         pkgsrc-2004Q1/pkgsrc
                   15481: 
                   15482:         # pkgsrc archives
                   15483:         pkgsrc-current.tar.gz -&gt; ../NetBSD-current/tar_files/pkgsrc.tar.gz
                   15484:         pkgsrc-2003Q4.tar.gz -&gt; N/A
                   15485:         pkgsrc-2004Q1.tar.gz -&gt; N/A
                   15486: 
                   15487:         # Per pkgsrc-release/OS-release/arch package archives
                   15488:         pkgsrc-2003Q4/
                   15489:             NetBSD-1.6.2/
                   15490:                 i386/
                   15491:                     All/
                   15492:                     archivers/
                   15493:                         foo -&gt; ../All/foo
                   15494:                     ...
                   15495:         pkgsrc-2004Q1/
                   15496:             NetBSD-1.6.2/
                   15497:                 i386/
                   15498:                     All/
                   15499:                     ...
                   15500:             NetBSD-2.0/
                   15501:                 i386/
                   15502:                     All/
                   15503:                     ...
                   15504:             SunOS-5.9/
                   15505:                 sparc/
                   15506:                     All/
                   15507:                     ...
                   15508:                 x86/
                   15509:                     All/
                   15510:                     ...
                   15511: 
                   15512:         # Per os-release package archive convenience links
                   15513:         NetBSD-1.6.2 -&gt; 1.6.2
                   15514:         1.6.2/
                   15515:             i386 -&gt; ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
                   15516:             m68k/
                   15517:                 All/
                   15518:                 archivers/
                   15519:                     foo -&gt; ../All/foo
                   15520:                 ...
                   15521:             amiga -&gt; m68k
                   15522:             atari -&gt; m68k
                   15523:             ...
                   15524: 
                   15525:         2.0 -&gt; NetBSD-2.0       # backward compat, historic
                   15526:         NetBSD-2.0/
                   15527:             i386 -&gt; ../pkgsrc-2004Q1/NetBSD-2.0/i386
                   15528:         SunOS-5.9/
                   15529:             sparc -&gt; ../pkgsrc-2004Q1/SunOS-5.9/sparc
                   15530:             x86 -&gt; ../pkgsrc-2004Q1/SunOS-5.9/x86
1.1       grant    15531: </pre>
                   15532: 
                   15533:       <p>To create:</p>
                   15534: 
                   15535:       <div class="orderedlist">
                   15536:         <ol type="1">
                   15537:           <li>
                   15538:             <p>Run bulk build, see <a href="#bulkbuild" title=
1.66    ! rillig   15539:             "6.3.&nbsp;Doing a bulk build of all packages">Section
        !          15540:             6.3, &#8220;Doing a bulk build of all
1.1       grant    15541:             packages&#8221;</a></p>
                   15542:           </li>
                   15543: 
                   15544:           <li>
                   15545:             <p>Upload /usr/pkgsrc/packages to</p>
                   15546:             <pre class="programlisting">
                   15547:     ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.51      rillig   15548:         pkgsrc-2004Q4/\             # pkgsrc-branch
                   15549:         `uname -s`-`uname -r`/\     # OS &amp; version
                   15550:         `uname -p`                  # architecture
1.1       grant    15551: </pre>
                   15552:           </li>
                   15553: 
                   15554:           <li>
1.14      xtraeme  15555:             <p>If necessary, create a symlink <span><strong class=
                   15556:             "command">ln -s `uname -m` `uname -p`</strong></span>
                   15557:             (amiga -&gt; m68k, ...)</p>
1.1       grant    15558:           </li>
                   15559:         </ol>
                   15560:       </div>
                   15561:     </div>
1.2       hubertf  15562: 
1.66    ! rillig   15563:     <div class="appendix" lang="en" xml:lang="en">
1.2       hubertf  15564:       <div class="titlepage">
                   15565:         <div>
                   15566:           <div>
1.66    ! rillig   15567:             <h2 class="title"><a name="editing" id=
1.46      gdt      15568:             "editing"></a>Appendix&nbsp;D.&nbsp;Editing guidelines
1.2       hubertf  15569:             for the pkgsrc guide</h2>
                   15570:           </div>
                   15571:         </div>
                   15572:       </div>
                   15573: 
                   15574:       <div class="toc">
                   15575:         <p><b>Table of Contents</b></p>
                   15576: 
                   15577:         <dl>
1.46      gdt      15578:           <dt><span class="sect1"><a href="#targets">D.1.
1.2       hubertf  15579:           Targets</a></span></dt>
                   15580: 
1.46      gdt      15581:           <dt><span class="sect1"><a href="#procedure">D.2.
1.2       hubertf  15582:           Procedure</a></span></dt>
                   15583:         </dl>
                   15584:       </div>
                   15585: 
                   15586:       <p>This section contains information on editing the pkgsrc
                   15587:       guide itself.</p>
                   15588: 
1.66    ! rillig   15589:       <div class="sect1" lang="en" xml:lang="en">
1.2       hubertf  15590:         <div class="titlepage">
                   15591:           <div>
                   15592:             <div>
                   15593:               <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   15594:               "targets" id="targets"></a>D.1.&nbsp;Targets</h2>
1.2       hubertf  15595:             </div>
                   15596:           </div>
                   15597:         </div>
                   15598: 
1.45      wiz      15599:         <p>The pkgsrc guide's source code is stored in <code xmlns=
                   15600:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15601:         "filename">pkgsrc/doc/guide/files</code>, and several files
1.2       hubertf  15602:         are created from it:</p>
                   15603: 
                   15604:         <div class="itemizedlist">
                   15605:           <ul type="disc">
                   15606:             <li>
1.45      wiz      15607:               <p><code xmlns=
                   15608:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.23      wiz      15609:               "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2       hubertf  15610:             </li>
                   15611: 
                   15612:             <li>
1.45      wiz      15613:               <p><code xmlns=
                   15614:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15615:               "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2       hubertf  15616:             </li>
                   15617: 
                   15618:             <li>
1.45      wiz      15619:               <p><code xmlns=
                   15620:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15621:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2       hubertf  15622:               the documentation on the NetBSD website will be built
                   15623:               from pkgsrc and kept up to date on the web server
                   15624:               itself. This means you <span class=
                   15625:               "emphasis"><em>must</em></span> make sure that your
                   15626:               changes haven't broken the build!</p>
                   15627:             </li>
1.6       hubertf  15628: 
                   15629:             <li>
1.45      wiz      15630:               <p><code xmlns=
                   15631:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15632:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6       hubertf  15633:               PDF version of the pkgsrc guide.</p>
                   15634:             </li>
                   15635: 
                   15636:             <li>
1.45      wiz      15637:               <p><code xmlns=
                   15638:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15639:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6       hubertf  15640:               PostScript version of the pkgsrc guide.</p>
                   15641:             </li>
1.2       hubertf  15642:           </ul>
                   15643:         </div>
                   15644:       </div>
                   15645: 
1.66    ! rillig   15646:       <div class="sect1" lang="en" xml:lang="en">
1.2       hubertf  15647:         <div class="titlepage">
                   15648:           <div>
                   15649:             <div>
                   15650:               <h2 class="title" style="clear: both"><a name=
1.66    ! rillig   15651:               "procedure" id=
1.46      gdt      15652:               "procedure"></a>D.2.&nbsp;Procedure</h2>
1.2       hubertf  15653:             </div>
                   15654:           </div>
                   15655:         </div>
                   15656: 
                   15657:         <p>The procedure to edit the pkgsrc guide is:</p>
                   15658: 
                   15659:         <div class="itemizedlist">
                   15660:           <ul type="disc">
                   15661:             <li>
1.6       hubertf  15662:               <p>Make sure you have the packages needed to
                   15663:               re-generate the pkgsrc guide (and other XML-based
                   15664:               NetBSD documentation) installed. These are
1.11      ben      15665:               &#8220;<span class="quote">netbsd-doc</span>&#8221;
1.47      reed     15666:               for creating the ASCII and HTML versions, and
1.6       hubertf  15667:               &#8220;<span class=
1.47      reed     15668:               "quote">netbsd-doc-print</span>&#8221; for the
                   15669:               PostScript and PDF versions. You will need both
1.6       hubertf  15670:               packages installed, to make sure documentation is
                   15671:               consistent across all formats. The packages can be
1.45      wiz      15672:               found in <code xmlns=
                   15673:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15674:               "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
1.45      wiz      15675:               <code xmlns=
                   15676:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15677:               "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6       hubertf  15678:             </li>
                   15679: 
                   15680:             <li>
1.45      wiz      15681:               <p>Edit the XML file(s) in <code xmlns=
                   15682:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15683:               "filename">pkgsrc/doc/guide/files</code>.</p>
1.2       hubertf  15684:             </li>
                   15685: 
                   15686:             <li>
1.14      xtraeme  15687:               <p>Run <span><strong class="command">make extract
                   15688:               &amp;&amp; make do-lint</strong></span> in
1.45      wiz      15689:               <code xmlns=
                   15690:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   15691:               "filename">pkgsrc/doc/guide</code> to check the XML
                   15692:               syntax, and fix it if needed.</p>
1.4       hubertf  15693:             </li>
                   15694: 
                   15695:             <li>
1.14      xtraeme  15696:               <p>Run <span><strong class=
1.45      wiz      15697:               "command">make</strong></span> in <code xmlns=
                   15698:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15699:               "filename">pkgsrc/doc/guide</code> to build the HTML
                   15700:               and ASCII version.</p>
1.2       hubertf  15701:             </li>
                   15702: 
                   15703:             <li>
1.14      xtraeme  15704:               <p>If all is well, run <span><strong class=
                   15705:               "command">make install-doc</strong></span> to put the
1.45      wiz      15706:               generated files into <code xmlns=
                   15707:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15708:               "filename">pkgsrc/doc</code>.</p>
1.2       hubertf  15709:             </li>
                   15710: 
                   15711:             <li>
1.14      xtraeme  15712:               <p><span><strong class="command">cvs commit
                   15713:               pkgsrc/doc/guide/files</strong></span></p>
1.2       hubertf  15714:             </li>
                   15715: 
                   15716:             <li>
1.14      xtraeme  15717:               <p><span><strong class="command">cvs commit -m
                   15718:               re-generate
                   15719:               pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2       hubertf  15720:             </li>
1.4       hubertf  15721: 
                   15722:             <li>
                   15723:               <p>Until the webserver on www.NetBSD.org is really
                   15724:               updated automatically to pick up changes to the
1.14      xtraeme  15725:               pkgsrc guide automatically, also run
1.18      xtraeme  15726:               <span><strong class="command">make install-htdocs
1.14      xtraeme  15727:               HTDOCSDIR=../../../htdocs</strong></span> (or
                   15728:               similar, adjust <code class=
                   15729:               "varname">HTDOCSDIR</code>!).</p>
1.4       hubertf  15730:             </li>
                   15731: 
                   15732:             <li>
1.14      xtraeme  15733:               <p><span><strong class="command">cvs commit
                   15734:               htdocs/Documentation/pkgsrc</strong></span></p>
1.4       hubertf  15735:             </li>
1.2       hubertf  15736:           </ul>
                   15737:         </div>
                   15738:       </div>
                   15739:     </div>
1.1       grant    15740:   </div>
                   15741: </body>
                   15742: </html>

CVSweb <webmaster@jp.NetBSD.org>