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

1.1       grant       1: <html xmlns="http://www.w3.org/1999/xhtml">
                      2: <head>
                      3:   <meta name="generator" content=
1.59    ! rillig      4:   "HTML Tidy for NetBSD (vers 1st August 2004), see www.w3.org" />
1.1       grant       5:   <meta http-equiv="Content-Type" content=
                      6:   "text/html; charset=us-ascii" />
                      7: 
                      8:   <title>The pkgsrc guide</title>
                      9:   <link rel="stylesheet" href="/NetBSD.css" type="text/css" />
                     10:   <meta name="generator" content=
1.23      wiz        11:   "DocBook XSL Stylesheets VX.X.X" />
1.1       grant      12:   <meta name="description" content=
                     13:   "Information about using the NetBSD package system (pkgsrc) from both a user view for installing packages as well as from a pkgsrc developers' view for creating new packages." />
                     14:   </head>
                     15: 
                     16: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084"
                     17: alink="#0000FF">
1.59    ! rillig     18:   <div class="book" lang="en" xml:lang="en">
1.1       grant      19:     <div class="titlepage">
                     20:       <div>
                     21:         <div>
1.59    ! rillig     22:           <h1 class="title"><a name="the-pkgsrc-guide" id=
        !            23:           "the-pkgsrc-guide"></a>The pkgsrc guide</h1>
1.1       grant      24:         </div>
                     25: 
                     26:         <div>
1.2       hubertf    27:           <h2 class="subtitle">Documentation on the NetBSD packages
1.1       grant      28:           system</h2>
                     29:         </div>
                     30: 
                     31:         <div>
                     32:           <div class="authorgroup">
                     33:             <div class="author">
                     34:               <h3 class="author"><span class=
                     35:               "firstname">Alistair</span> <span class=
                     36:               "surname">Crooks</span></h3>
                     37: 
                     38:               <div class="affiliation">
                     39:                 <div class="address">
1.14      xtraeme    40:                   <p><code class="email">&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.38      dillo     655:                     "#shells-disable">12.5.1. Disabling handling of
1.35      jmmv      656:                     configuration files</a></span></dt>
                    657:                   </dl>
                    658:                 </dd>
                    659:               </dl>
                    660:             </dd>
                    661: 
1.38      dillo     662:             <dt><span class="chapter"><a href="#options">13.
1.1       grant     663:             Options handling</a></span></dt>
                    664: 
                    665:             <dd>
                    666:               <dl>
1.30      wiz       667:                 <dt><span class="sect1"><a href=
1.38      dillo     668:                 "#global-default-options">13.1. Global default
1.30      wiz       669:                 options</a></span></dt>
1.1       grant     670: 
1.30      wiz       671:                 <dt><span class="sect1"><a href=
1.38      dillo     672:                 "#converting-to-options">13.2. Converting packages
1.45      wiz       673:                 to use <code xmlns=
                    674:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme   675:                 "filename">bsd.options.mk</code></a></span></dt>
1.48      dillo     676: 
                    677:                 <dt><span class="sect1"><a href=
                    678:                 "#option-names">13.3. Option Names</a></span></dt>
1.1       grant     679:               </dl>
                    680:             </dd>
                    681: 
1.38      dillo     682:             <dt><span class="chapter"><a href="#build">14. The
1.1       grant     683:             build process</a></span></dt>
                    684: 
                    685:             <dd>
                    686:               <dl>
                    687:                 <dt><span class="sect1"><a href=
1.56      rillig    688:                 "#build.intro">14.1. Introduction</a></span></dt>
                    689: 
                    690:                 <dt><span class="sect1"><a href=
                    691:                 "#build.prefix">14.2. Program
1.1       grant     692:                 location</a></span></dt>
                    693: 
1.30      wiz       694:                 <dt><span class="sect1"><a href=
1.56      rillig    695:                 "#build.builddirs">14.3. Directories used during
                    696:                 the build process</a></span></dt>
                    697: 
                    698:                 <dt><span class="sect1"><a href=
                    699:                 "#build.running">14.4. Running a
                    700:                 phase</a></span></dt>
                    701: 
                    702:                 <dt><span class="sect1"><a href=
                    703:                 "#build.fetch">14.5. The <span class=
                    704:                 "emphasis"><em>fetch</em></span>
                    705:                 phase</a></span></dt>
                    706: 
                    707:                 <dt><span class="sect1"><a href=
                    708:                 "#build.checksum">14.6. The <span class=
                    709:                 "emphasis"><em>checksum</em></span>
                    710:                 phase</a></span></dt>
                    711: 
                    712:                 <dt><span class="sect1"><a href=
                    713:                 "#build.extract">14.7. The <span class=
                    714:                 "emphasis"><em>extract</em></span>
                    715:                 phase</a></span></dt>
                    716: 
                    717:                 <dt><span class="sect1"><a href=
                    718:                 "#build.patch">14.8. The <span class=
                    719:                 "emphasis"><em>patch</em></span>
                    720:                 phase</a></span></dt>
                    721: 
                    722:                 <dt><span class="sect1"><a href=
                    723:                 "#build.tools">14.9. The <span class=
                    724:                 "emphasis"><em>tools</em></span>
                    725:                 phase</a></span></dt>
                    726: 
                    727:                 <dt><span class="sect1"><a href=
                    728:                 "#build.wrapper">14.10. The <span class=
                    729:                 "emphasis"><em>wrapper</em></span>
                    730:                 phase</a></span></dt>
                    731: 
                    732:                 <dt><span class="sect1"><a href=
                    733:                 "#build.configure">14.11. The <span class=
                    734:                 "emphasis"><em>configure</em></span>
                    735:                 phase</a></span></dt>
                    736: 
                    737:                 <dt><span class="sect1"><a href=
                    738:                 "#build.build">14.12. The <span class=
                    739:                 "emphasis"><em>build</em></span>
                    740:                 phase</a></span></dt>
                    741: 
                    742:                 <dt><span class="sect1"><a href=
                    743:                 "#build.test">14.13. The <span class=
                    744:                 "emphasis"><em>test</em></span>
                    745:                 phase</a></span></dt>
                    746: 
                    747:                 <dt><span class="sect1"><a href=
                    748:                 "#build.install">14.14. The <span class=
                    749:                 "emphasis"><em>install</em></span>
                    750:                 phase</a></span></dt>
1.1       grant     751: 
                    752:                 <dt><span class="sect1"><a href=
1.56      rillig    753:                 "#build.package">14.15. The <span class=
                    754:                 "emphasis"><em>package</em></span>
                    755:                 phase</a></span></dt>
                    756: 
                    757:                 <dt><span class="sect1"><a href=
                    758:                 "#build.helpful-targets">14.16. Other helpful
1.1       grant     759:                 targets</a></span></dt>
                    760:               </dl>
                    761:             </dd>
                    762: 
1.55      rillig    763:             <dt><span class="chapter"><a href="#fixes">15. Making
                    764:             your package work</a></span></dt>
1.1       grant     765: 
                    766:             <dd>
                    767:               <dl>
1.30      wiz       768:                 <dt><span class="sect1"><a href=
1.38      dillo     769:                 "#general-operation">15.1. General
1.30      wiz       770:                 operation</a></span></dt>
1.1       grant     771: 
                    772:                 <dd>
                    773:                   <dl>
                    774:                     <dt><span class="sect2"><a href=
1.38      dillo     775:                     "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30      wiz       776:                     pull in variables from
                    777:                     /etc/mk.conf</a></span></dt>
1.1       grant     778: 
                    779:                     <dt><span class="sect2"><a href=
1.38      dillo     780:                     "#where-to-install-documentation">15.1.2. Where
1.31      wiz       781:                     to install documentation</a></span></dt>
                    782: 
                    783:                     <dt><span class="sect2"><a href=
1.38      dillo     784:                     "#restricted-packages">15.1.3. Restricted
1.1       grant     785:                     packages</a></span></dt>
                    786: 
                    787:                     <dt><span class="sect2"><a href=
1.38      dillo     788:                     "#dependencies">15.1.4. Handling
1.1       grant     789:                     dependencies</a></span></dt>
                    790: 
                    791:                     <dt><span class="sect2"><a href=
1.38      dillo     792:                     "#conflicts">15.1.5. Handling conflicts with
1.1       grant     793:                     other packages</a></span></dt>
                    794: 
                    795:                     <dt><span class="sect2"><a href=
1.38      dillo     796:                     "#not-building-packages">15.1.6. Packages that
1.30      wiz       797:                     cannot or should not be built</a></span></dt>
1.1       grant     798: 
                    799:                     <dt><span class="sect2"><a href=
1.38      dillo     800:                     "#undeletable-packages">15.1.7. Packages which
1.30      wiz       801:                     should not be deleted, once
                    802:                     installed</a></span></dt>
1.1       grant     803: 
                    804:                     <dt><span class="sect2"><a href=
1.38      dillo     805:                     "#security-handling">15.1.8. Handling packages
1.1       grant     806:                     with security problems</a></span></dt>
                    807: 
                    808:                     <dt><span class="sect2"><a href=
1.38      dillo     809:                     "#compiler-bugs">15.1.9. How to handle compiler
1.1       grant     810:                     bugs</a></span></dt>
                    811: 
                    812:                     <dt><span class="sect2"><a href=
1.38      dillo     813:                     "#bumping-pkgrevision">15.1.10. How to handle
1.30      wiz       814:                     incrementing versions when fixing an existing
1.1       grant     815:                     package</a></span></dt>
                    816: 
                    817:                     <dt><span class="sect2"><a href=
1.38      dillo     818:                     "#portability-of-packages">15.1.11. Portability
1.30      wiz       819:                     of packages</a></span></dt>
1.1       grant     820:                   </dl>
                    821:                 </dd>
                    822: 
1.30      wiz       823:                 <dt><span class="sect1"><a href=
1.38      dillo     824:                 "#downloading-issues">15.2. Possible downloading
1.30      wiz       825:                 issues</a></span></dt>
1.1       grant     826: 
                    827:                 <dd>
                    828:                   <dl>
                    829:                     <dt><span class="sect2"><a href=
1.38      dillo     830:                     "#no-plain-download">15.2.1. Packages whose
1.30      wiz       831:                     distfiles aren't available for plain
1.1       grant     832:                     downloading</a></span></dt>
                    833: 
                    834:                     <dt><span class="sect2"><a href=
1.38      dillo     835:                     "#modified-distfiles-same-name">15.2.2. How to
1.30      wiz       836:                     handle modified distfiles with the 'old'
                    837:                     name</a></span></dt>
1.1       grant     838:                   </dl>
                    839:                 </dd>
                    840: 
1.30      wiz       841:                 <dt><span class="sect1"><a href=
1.38      dillo     842:                 "#configuration-gotchas">15.3. Configuration
1.30      wiz       843:                 gotchas</a></span></dt>
1.1       grant     844: 
                    845:                 <dd>
                    846:                   <dl>
                    847:                     <dt><span class="sect2"><a href=
1.38      dillo     848:                     "#fixes.libtool">15.3.1. Shared libraries -
1.1       grant     849:                     libtool</a></span></dt>
                    850: 
                    851:                     <dt><span class="sect2"><a href=
1.38      dillo     852:                     "#using-libtool">15.3.2. Using libtool on GNU
1.1       grant     853:                     packages that already support
                    854:                     libtool</a></span></dt>
                    855: 
                    856:                     <dt><span class="sect2"><a href=
1.38      dillo     857:                     "#autoconf-automake">15.3.3. GNU
1.1       grant     858:                     Autoconf/Automake</a></span></dt>
                    859:                   </dl>
                    860:                 </dd>
                    861: 
1.30      wiz       862:                 <dt><span class="sect1"><a href=
1.55      rillig    863:                 "#fixes-build">15.4. Building the
                    864:                 package</a></span></dt>
1.1       grant     865: 
                    866:                 <dd>
                    867:                   <dl>
                    868:                     <dt><span class="sect2"><a href=
1.38      dillo     869:                     "#cpp-defines">15.4.1. CPP
1.1       grant     870:                     defines</a></span></dt>
1.51      rillig    871: 
                    872:                     <dt><span class="sect2"><a href=
                    873:                     "#cpp-list">15.4.2. Getting a list of CPP
                    874:                     defines</a></span></dt>
1.1       grant     875:                   </dl>
                    876:                 </dd>
                    877: 
1.30      wiz       878:                 <dt><span class="sect1"><a href=
1.38      dillo     879:                 "#package-specific-actions">15.5. Package specific
1.30      wiz       880:                 actions</a></span></dt>
1.1       grant     881: 
                    882:                 <dd>
                    883:                   <dl>
                    884:                     <dt><span class="sect2"><a href=
1.38      dillo     885:                     "#user-interaction">15.5.1. User
1.2       hubertf   886:                     interaction</a></span></dt>
1.1       grant     887: 
                    888:                     <dt><span class="sect2"><a href=
1.38      dillo     889:                     "#handling-licenses">15.5.2. Handling
1.1       grant     890:                     licenses</a></span></dt>
                    891: 
                    892:                     <dt><span class="sect2"><a href=
1.38      dillo     893:                     "#installing-score-files">15.5.3. Installing
1.30      wiz       894:                     score files</a></span></dt>
1.1       grant     895: 
                    896:                     <dt><span class="sect2"><a href=
1.38      dillo     897:                     "#perl-scripts">15.5.4. Packages containing
1.30      wiz       898:                     perl scripts</a></span></dt>
1.1       grant     899: 
                    900:                     <dt><span class="sect2"><a href=
1.38      dillo     901:                     "#hardcoded-paths">15.5.5. Packages with
1.30      wiz       902:                     hardcoded paths to other
                    903:                     interpreters</a></span></dt>
1.1       grant     904: 
                    905:                     <dt><span class="sect2"><a href=
1.38      dillo     906:                     "#perl-modules">15.5.6. Packages installing
1.30      wiz       907:                     perl modules</a></span></dt>
1.1       grant     908: 
                    909:                     <dt><span class="sect2"><a href=
1.38      dillo     910:                     "#faq.info-files">15.5.7. Packages installing
1.1       grant     911:                     info files</a></span></dt>
                    912: 
                    913:                     <dt><span class="sect2"><a href=
1.57      minskim   914:                     "#manpages">15.5.8. Packages installing man
                    915:                     pages</a></span></dt>
                    916: 
                    917:                     <dt><span class="sect2"><a href=
                    918:                     "#gconf2-data-files">15.5.9. Packages
1.30      wiz       919:                     installing GConf2 data files</a></span></dt>
1.1       grant     920: 
                    921:                     <dt><span class="sect2"><a href=
1.57      minskim   922:                     "#scrollkeeper-data-files">15.5.10. Packages
1.30      wiz       923:                     installing scrollkeeper data
                    924:                     files</a></span></dt>
1.1       grant     925: 
                    926:                     <dt><span class="sect2"><a href=
1.57      minskim   927:                     "#x11-fonts">15.5.11. Packages installing X11
1.1       grant     928:                     fonts</a></span></dt>
                    929: 
                    930:                     <dt><span class="sect2"><a href=
1.57      minskim   931:                     "#gtk2-modules">15.5.12. Packages installing
1.30      wiz       932:                     GTK2 modules</a></span></dt>
1.1       grant     933: 
                    934:                     <dt><span class="sect2"><a href=
1.57      minskim   935:                     "#sgml-xml-data">15.5.13. Packages installing
1.30      wiz       936:                     SGML or XML data</a></span></dt>
1.1       grant     937: 
                    938:                     <dt><span class="sect2"><a href=
1.57      minskim   939:                     "#mime-database">15.5.14. Packages installing
1.1       grant     940:                     extensions to the MIME database</a></span></dt>
                    941: 
                    942:                     <dt><span class="sect2"><a href=
1.57      minskim   943:                     "#intltool">15.5.15. Packages using
1.1       grant     944:                     intltool</a></span></dt>
1.18      xtraeme   945: 
                    946:                     <dt><span class="sect2"><a href=
1.57      minskim   947:                     "#startup-scripts">15.5.16. Packages installing
1.18      xtraeme   948:                     startup scripts</a></span></dt>
1.57      minskim   949: 
                    950:                     <dt><span class="sect2"><a href=
                    951:                     "#tex-packages">15.5.17. Packages installing
                    952:                     TeX modules</a></span></dt>
1.1       grant     953:                   </dl>
                    954:                 </dd>
                    955: 
1.30      wiz       956:                 <dt><span class="sect1"><a href=
1.38      dillo     957:                 "#feedback-to-author">15.6. Feedback to the
1.30      wiz       958:                 author</a></span></dt>
1.1       grant     959:               </dl>
                    960:             </dd>
                    961: 
1.38      dillo     962:             <dt><span class="chapter"><a href="#debug">16.
1.1       grant     963:             Debugging</a></span></dt>
                    964: 
1.38      dillo     965:             <dt><span class="chapter"><a href="#submit">17.
1.1       grant     966:             Submitting and Committing</a></span></dt>
                    967: 
                    968:             <dd>
                    969:               <dl>
1.30      wiz       970:                 <dt><span class="sect1"><a href=
1.38      dillo     971:                 "#submitting-your-package">17.1. Submitting your
1.30      wiz       972:                 packages</a></span></dt>
1.1       grant     973: 
1.30      wiz       974:                 <dt><span class="sect1"><a href=
1.41      wiz       975:                 "#general-notes-for-changes">17.2. General notes
                    976:                 when adding, updating, or removing
                    977:                 packages</a></span></dt>
                    978: 
                    979:                 <dt><span class="sect1"><a href=
                    980:                 "#committing-importing">17.3. Committing: Importing
1.30      wiz       981:                 a package into CVS</a></span></dt>
1.1       grant     982: 
1.30      wiz       983:                 <dt><span class="sect1"><a href=
1.41      wiz       984:                 "#updating-package">17.4. Updating a package to a
1.30      wiz       985:                 newer version</a></span></dt>
1.1       grant     986: 
1.30      wiz       987:                 <dt><span class="sect1"><a href=
1.41      wiz       988:                 "#moving-package">17.5. Moving a package in
1.30      wiz       989:                 pkgsrc</a></span></dt>
1.1       grant     990:               </dl>
                    991:             </dd>
                    992:           </dl>
                    993:         </dd>
                    994: 
1.46      gdt       995:         <dt><span class="appendix"><a href="#examples">A. A simple
1.1       grant     996:         example package: bison</a></span></dt>
                    997: 
                    998:         <dd>
                    999:           <dl>
1.46      gdt      1000:             <dt><span class="sect1"><a href="#example-files">A.1.
1.1       grant    1001:             files</a></span></dt>
                   1002: 
                   1003:             <dd>
                   1004:               <dl>
1.30      wiz      1005:                 <dt><span class="sect2"><a href=
1.46      gdt      1006:                 "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1       grant    1007: 
1.30      wiz      1008:                 <dt><span class="sect2"><a href=
1.46      gdt      1009:                 "#example-descr">A.1.2. DESCR</a></span></dt>
1.1       grant    1010: 
1.30      wiz      1011:                 <dt><span class="sect2"><a href=
1.46      gdt      1012:                 "#example-plist">A.1.3. PLIST</a></span></dt>
1.1       grant    1013: 
1.30      wiz      1014:                 <dt><span class="sect2"><a href=
1.46      gdt      1015:                 "#checking-package-with-pkglint">A.1.4. Checking a
1.30      wiz      1016:                 package with <span><strong class=
1.14      xtraeme  1017:                 "command">pkglint</strong></span></a></span></dt>
1.1       grant    1018:               </dl>
                   1019:             </dd>
                   1020: 
1.46      gdt      1021:             <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30      wiz      1022:             Steps for building, installing,
                   1023:             packaging</a></span></dt>
1.1       grant    1024:           </dl>
                   1025:         </dd>
                   1026: 
1.46      gdt      1027:         <dt><span class="appendix"><a href="#logs">B. Build
1.1       grant    1028:         logs</a></span></dt>
                   1029: 
                   1030:         <dd>
                   1031:           <dl>
1.46      gdt      1032:             <dt><span class="sect1"><a href="#logs.building">B.1.
1.1       grant    1033:             Building figlet</a></span></dt>
                   1034: 
1.46      gdt      1035:             <dt><span class="sect1"><a href="#logs.package">B.2.
1.1       grant    1036:             Packaging figlet</a></span></dt>
                   1037:           </dl>
                   1038:         </dd>
                   1039: 
1.46      gdt      1040:         <dt><span class="appendix"><a href="#ftp-layout">C. Layout
1.1       grant    1041:         of the FTP server's package archive</a></span></dt>
1.2       hubertf  1042: 
1.46      gdt      1043:         <dt><span class="appendix"><a href="#editing">D. Editing
1.2       hubertf  1044:         guidelines for the pkgsrc guide</a></span></dt>
                   1045: 
                   1046:         <dd>
                   1047:           <dl>
1.46      gdt      1048:             <dt><span class="sect1"><a href="#targets">D.1.
1.2       hubertf  1049:             Targets</a></span></dt>
                   1050: 
1.46      gdt      1051:             <dt><span class="sect1"><a href="#procedure">D.2.
1.2       hubertf  1052:             Procedure</a></span></dt>
                   1053:           </dl>
                   1054:         </dd>
1.1       grant    1055:       </dl>
                   1056:     </div>
                   1057: 
1.59    ! rillig   1058:     <div class="chapter" lang="en" xml:lang="en">
1.1       grant    1059:       <div class="titlepage">
                   1060:         <div>
                   1061:           <div>
1.59    ! rillig   1062:             <h2 class="title"><a name="introduction" id=
1.51      rillig   1063:             "introduction"></a>Chapter&nbsp;1.&nbsp;What is
                   1064:             pkgsrc?</h2>
1.1       grant    1065:           </div>
                   1066:         </div>
                   1067:       </div>
                   1068: 
                   1069:       <div class="toc">
                   1070:         <p><b>Table of Contents</b></p>
                   1071: 
                   1072:         <dl>
1.30      wiz      1073:           <dt><span class="sect1"><a href=
                   1074:           "#introduction-section">1.1. Introduction</a></span></dt>
1.1       grant    1075: 
                   1076:           <dt><span class="sect1"><a href="#overview">1.2.
                   1077:           Overview</a></span></dt>
                   1078: 
                   1079:           <dt><span class="sect1"><a href="#terminology">1.3.
                   1080:           Terminology</a></span></dt>
                   1081: 
                   1082:           <dt><span class="sect1"><a href="#typography">1.4.
                   1083:           Typography</a></span></dt>
                   1084:         </dl>
                   1085:       </div>
                   1086: 
1.59    ! rillig   1087:       <div class="sect1" lang="en" xml:lang="en">
1.1       grant    1088:         <div class="titlepage">
                   1089:           <div>
                   1090:             <div>
                   1091:               <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   1092:               "introduction-section" id=
1.30      wiz      1093:               "introduction-section"></a>1.1.&nbsp;Introduction</h2>
1.1       grant    1094:             </div>
                   1095:           </div>
                   1096:         </div>
                   1097: 
1.47      reed     1098:         <p>There is a lot of software freely available for
                   1099:         Unix-based systems, which usually runs on NetBSD and other
1.1       grant    1100:         Unix-flavoured systems, too, sometimes with some
                   1101:         modifications. The NetBSD Packages Collection (pkgsrc)
                   1102:         incorporates any such changes necessary to make that
                   1103:         software run, and makes the installation (and
                   1104:         de-installation) of the software package easy by means of a
                   1105:         single command.</p>
                   1106: 
                   1107:         <p>Once the software has been built, it is manipulated with
1.14      xtraeme  1108:         the <span><strong class="command">pkg_*</strong></span>
                   1109:         tools so that installation and de-installation, printing of
                   1110:         an inventory of all installed packages and retrieval of
                   1111:         one-line comments or more verbose descriptions are all
                   1112:         simple.</p>
1.1       grant    1113: 
                   1114:         <p>pkgsrc currently contains several thousand packages,
                   1115:         including:</p>
                   1116: 
                   1117:         <div class="itemizedlist">
                   1118:           <ul type="disc">
                   1119:             <li>
                   1120:               <p><a xmlns=
                   1121:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1122:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.45      wiz      1123:               target="_top"><code xmlns="" class=
                   1124:               "filename">www/apache</code></a> - The Apache web
1.20      ben      1125:               server</p>
1.1       grant    1126:             </li>
                   1127: 
                   1128:             <li>
                   1129:               <p><a xmlns=
                   1130:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1131:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45      wiz      1132:               target="_top"><code xmlns="" class=
                   1133:               "filename">www/mozilla</code></a> - The Mozilla web
1.20      ben      1134:               browser</p>
1.1       grant    1135:             </li>
                   1136: 
                   1137:             <li>
                   1138:               <p><a xmlns=
                   1139:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1140:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.45      wiz      1141:               target="_top"><code xmlns="" class=
                   1142:               "filename">meta-pkgs/gnome</code></a> - The GNOME
1.20      ben      1143:               Desktop Environment</p>
1.1       grant    1144:             </li>
                   1145: 
                   1146:             <li>
                   1147:               <p><a xmlns=
                   1148:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1149:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.45      wiz      1150:               target="_top"><code xmlns="" class=
                   1151:               "filename">meta-pkgs/kde3</code></a> - The K Desktop
1.20      ben      1152:               Environment</p>
1.1       grant    1153:             </li>
                   1154:           </ul>
                   1155:         </div>
                   1156: 
                   1157:         <p>...just to name a few.</p>
                   1158: 
                   1159:         <p>pkgsrc has built-in support for handling varying
                   1160:         dependencies, such as pthreads and X11, and extended
                   1161:         features such as IPv6 support on a range of platforms.</p>
                   1162: 
                   1163:         <p>pkgsrc was derived from FreeBSD's ports system, and
                   1164:         initially developed for NetBSD only. Since then, pkgsrc has
                   1165:         grown a lot, and now supports the following platforms:</p>
                   1166: 
                   1167:         <div class="itemizedlist">
                   1168:           <ul type="disc">
                   1169:             <li>
                   1170:               <p><a href="http://developer.apple.com/darwin/"
                   1171:               target="_top">Darwin</a> (<a href=
                   1172:               "http://www.apple.com/macosx/" target="_top">Mac OS
                   1173:               X</a>)</p>
                   1174:             </li>
                   1175: 
                   1176:             <li>
1.3       hubertf  1177:               <p><a href="http://www.DragonFlyBSD.org/" target=
                   1178:               "_top">DragonFlyBSD</a></p>
                   1179:             </li>
                   1180: 
                   1181:             <li>
1.1       grant    1182:               <p><a href="http://www.FreeBSD.org/" target=
                   1183:               "_top">FreeBSD</a></p>
                   1184:             </li>
                   1185: 
                   1186:             <li>
1.3       hubertf  1187:               <p>Microsoft Windows, via <a href=
                   1188:               "http://www.microsoft.com/windows/sfu/" target=
                   1189:               "_top">Interix</a></p>
1.1       grant    1190:             </li>
                   1191: 
                   1192:             <li>
                   1193:               <p><a href="http://www.sgi.com/software/irix6.5/"
                   1194:               target="_top">IRIX</a></p>
                   1195:             </li>
                   1196: 
                   1197:             <li>
                   1198:               <p><a href="http://www.linux.org/" target=
                   1199:               "_top">Linux</a></p>
                   1200:             </li>
                   1201: 
                   1202:             <li>
                   1203:               <p><a href="http://www.NetBSD.org/" target=
                   1204:               "_top">NetBSD</a> (of course)</p>
                   1205:             </li>
                   1206: 
                   1207:             <li>
1.17      sketch   1208:               <p><a href="http://h30097.www3.hp.com/" target=
                   1209:               "_top">Tru64</a> (Digital UNIX, OSF1)</p>
                   1210:             </li>
                   1211: 
                   1212:             <li>
1.1       grant    1213:               <p><a href="http://www.openbsd.org/" target=
                   1214:               "_top">OpenBSD</a></p>
                   1215:             </li>
                   1216: 
                   1217:             <li>
                   1218:               <p><a href="http://www.sun.com/solaris/" target=
                   1219:               "_top">Solaris</a></p>
                   1220:             </li>
                   1221:           </ul>
                   1222:         </div>
                   1223:       </div>
                   1224: 
1.59    ! rillig   1225:       <div class="sect1" lang="en" xml:lang="en">
1.1       grant    1226:         <div class="titlepage">
                   1227:           <div>
                   1228:             <div>
                   1229:               <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   1230:               "overview" id="overview"></a>1.2.&nbsp;Overview</h2>
1.1       grant    1231:             </div>
                   1232:           </div>
                   1233:         </div>
                   1234: 
                   1235:         <p>This document is divided into two parts. The first,
                   1236:         <a href="#users-guide" title=
1.46      gdt      1237:         "Part&nbsp;I.&nbsp;The pkgsrc user's guide">The pkgsrc
1.2       hubertf  1238:         user's guide</a>, describes how one can use one of the
                   1239:         packages in the Package Collection, either by installing a
                   1240:         precompiled binary package, or by building one's own copy
                   1241:         using the NetBSD package system. The second part, <a href=
1.1       grant    1242:         "#developers-guide" title=
1.46      gdt      1243:         "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">The
                   1244:         pkgsrc developer's guide</a>, explains how to prepare a
                   1245:         package so it can be easily built by other NetBSD users
                   1246:         without knowing about the package's building details.</p>
1.1       grant    1247: 
                   1248:         <p>This document is available in various formats:</p>
                   1249: 
                   1250:         <div class="itemizedlist">
                   1251:           <ul type="disc">
                   1252:             <li>
                   1253:               <p><a href="index.html" target="_top">HTML</a></p>
                   1254:             </li>
                   1255: 
                   1256:             <li>
                   1257:               <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
                   1258:             </li>
                   1259: 
                   1260:             <li>
                   1261:               <p><a href="pkgsrc.ps" target="_top">PS</a></p>
                   1262:             </li>
                   1263: 
                   1264:             <li>
                   1265:               <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
                   1266:             </li>
                   1267:           </ul>
                   1268:         </div>
                   1269:       </div>
                   1270: 
1.59    ! rillig   1271:       <div class="sect1" lang="en" xml:lang="en">
1.1       grant    1272:         <div class="titlepage">
                   1273:           <div>
                   1274:             <div>
                   1275:               <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   1276:               "terminology" id=
1.1       grant    1277:               "terminology"></a>1.3.&nbsp;Terminology</h2>
                   1278:             </div>
                   1279:           </div>
                   1280:         </div>
                   1281: 
                   1282:         <p>There has been a lot of talk about &#8220;<span class=
                   1283:         "quote">ports</span>&#8221;, &#8220;<span class=
                   1284:         "quote">packages</span>&#8221;, etc. so far. Here is a
                   1285:         description of all the terminology used within this
                   1286:         document.</p>
                   1287: 
                   1288:         <div class="variablelist">
                   1289:           <dl>
                   1290:             <dt><span class="term">Package</span></dt>
                   1291: 
                   1292:             <dd>
                   1293:               <p>A set of files and building instructions that
                   1294:               describe what's necessary to build a certain piece of
                   1295:               software using pkgsrc. Packages are traditionally
1.45      wiz      1296:               stored under <code xmlns=
                   1297:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1298:               "filename">/usr/pkgsrc</code>.</p>
1.1       grant    1299:             </dd>
                   1300: 
                   1301:             <dt><span class="term">The NetBSD package
                   1302:             system</span></dt>
                   1303: 
                   1304:             <dd>
                   1305:               <p>This is the former name of &#8220;<span class=
                   1306:               "quote">pkgsrc</span>&#8221;. It is part of the
1.27      rillig   1307:               NetBSD operating system and can be bootstrapped to
                   1308:               run on non-NetBSD operating systems as well. It
                   1309:               handles building (compiling), installing, and
                   1310:               removing of packages.</p>
1.1       grant    1311:             </dd>
                   1312: 
                   1313:             <dt><span class="term">Distfile</span></dt>
                   1314: 
                   1315:             <dd>
                   1316:               <p>This term describes the file or files that are
                   1317:               provided by the author of the piece of software to
                   1318:               distribute his work. All the changes necessary to
                   1319:               build on NetBSD are reflected in the corresponding
                   1320:               package. Usually the distfile is in the form of a
                   1321:               compressed tar-archive, but other types are possible,
1.45      wiz      1322:               too. Distfiles are usually stored below <code xmlns=
                   1323:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1324:               "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    1325:             </dd>
                   1326: 
                   1327:             <dt><span class="term">Port</span></dt>
                   1328: 
                   1329:             <dd>
                   1330:               <p>This is the term used by FreeBSD and OpenBSD
                   1331:               people for what we call a package. In NetBSD
                   1332:               terminology, &#8220;<span class=
                   1333:               "quote">port</span>&#8221; refers to a different
                   1334:               architecture.</p>
                   1335:             </dd>
                   1336: 
                   1337:             <dt><span class="term">Precompiled/binary
                   1338:             package</span></dt>
                   1339: 
                   1340:             <dd>
                   1341:               <p>A set of binaries built with pkgsrc from a
1.14      xtraeme  1342:               distfile and stuffed together in a single
1.45      wiz      1343:               <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   1344:               class="filename">.tgz</code> file so it can be
1.14      xtraeme  1345:               installed on machines of the same machine
                   1346:               architecture without the need to recompile. Packages
1.45      wiz      1347:               are usually generated in <code xmlns=
                   1348:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1349:               "filename">/usr/pkgsrc/packages</code>; there is also
                   1350:               an archive on <a href=
1.1       grant    1351:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
                   1352:               "_top">ftp.NetBSD.org</a>.</p>
                   1353: 
                   1354:               <p>Sometimes, this is referred to by the term
                   1355:               &#8220;<span class="quote">package</span>&#8221; too,
                   1356:               especially in the context of precompiled
                   1357:               packages.</p>
                   1358:             </dd>
                   1359: 
                   1360:             <dt><span class="term">Program</span></dt>
                   1361: 
                   1362:             <dd>
                   1363:               <p>The piece of software to be installed which will
1.47      reed     1364:               be constructed from all the files in the distfile by
1.1       grant    1365:               the actions defined in the corresponding package.</p>
                   1366:             </dd>
                   1367:           </dl>
                   1368:         </div>
                   1369:       </div>
                   1370: 
1.59    ! rillig   1371:       <div class="sect1" lang="en" xml:lang="en">
1.1       grant    1372:         <div class="titlepage">
                   1373:           <div>
                   1374:             <div>
                   1375:               <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   1376:               "typography" id=
1.1       grant    1377:               "typography"></a>1.4.&nbsp;Typography</h2>
                   1378:             </div>
                   1379:           </div>
                   1380:         </div>
                   1381: 
                   1382:         <p>When giving examples for commands, shell prompts are
                   1383:         used to show if the command should/can be issued as root,
                   1384:         or if &#8220;<span class="quote">normal</span>&#8221; user
1.14      xtraeme  1385:         privileges are sufficient. We use a <code class=
                   1386:         "prompt">#</code> for root's shell prompt, and a
1.27      rillig   1387:         <code class="prompt">%</code> for users' shell prompt,
1.14      xtraeme  1388:         assuming they use the C-shell or tcsh.</p>
1.1       grant    1389:       </div>
                   1390:     </div>
                   1391: 
1.59    ! rillig   1392:     <div class="part" lang="en" xml:lang="en">
1.1       grant    1393:       <div class="titlepage">
                   1394:         <div>
                   1395:           <div>
1.59    ! rillig   1396:             <h1 class="title"><a name="users-guide" id=
1.48      dillo    1397:             "users-guide"></a>Part&nbsp;I.&nbsp;The pkgsrc user's
                   1398:             guide</h1>
1.1       grant    1399:           </div>
                   1400:         </div>
                   1401:       </div>
                   1402: 
                   1403:       <div class="toc">
                   1404:         <p><b>Table of Contents</b></p>
                   1405: 
                   1406:         <dl>
                   1407:           <dt><span class="chapter"><a href="#getting">2. Where to
1.59    ! rillig   1408:           get pkgsrc and how to keep it up-to-date</a></span></dt>
1.1       grant    1409: 
                   1410:           <dd>
                   1411:             <dl>
1.30      wiz      1412:               <dt><span class="sect1"><a href="#as-tar-file">2.1.
                   1413:               As tar file</a></span></dt>
1.1       grant    1414: 
1.30      wiz      1415:               <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1       grant    1416:               SUP</a></span></dt>
                   1417: 
1.30      wiz      1418:               <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1       grant    1419:               CVS</a></span></dt>
1.59    ! rillig   1420: 
        !          1421:               <dt><span class="sect1"><a href="#uptodate-cvs">2.4.
        !          1422:               Keeping pkgsrc up-to-date via CVS</a></span></dt>
1.1       grant    1423:             </dl>
                   1424:           </dd>
                   1425: 
                   1426:           <dt><span class="chapter"><a href="#platforms">3. Using
                   1427:           pkgsrc on systems other than NetBSD</a></span></dt>
                   1428: 
                   1429:           <dd>
                   1430:             <dl>
1.30      wiz      1431:               <dt><span class="sect1"><a href=
                   1432:               "#bootstrapping-pkgsrc">3.1. Bootstrapping
                   1433:               pkgsrc</a></span></dt>
1.1       grant    1434: 
1.30      wiz      1435:               <dt><span class="sect1"><a href=
1.47      reed     1436:               "#platform-specific-notes">3.2. Platform-specific
1.30      wiz      1437:               notes</a></span></dt>
1.1       grant    1438: 
                   1439:               <dd>
                   1440:                 <dl>
1.30      wiz      1441:                   <dt><span class="sect2"><a href="#darwin">3.2.1.
                   1442:                   Darwin (Mac OS X)</a></span></dt>
1.1       grant    1443: 
1.30      wiz      1444:                   <dt><span class="sect2"><a href="#freebsd">3.2.2.
                   1445:                   FreeBSD</a></span></dt>
1.22      tv       1446: 
1.30      wiz      1447:                   <dt><span class="sect2"><a href="#interix">3.2.3.
                   1448:                   Interix</a></span></dt>
1.1       grant    1449: 
1.30      wiz      1450:                   <dt><span class="sect2"><a href="#irix">3.2.4.
                   1451:                   IRIX</a></span></dt>
1.1       grant    1452: 
1.30      wiz      1453:                   <dt><span class="sect2"><a href="#linux">3.2.5.
                   1454:                   Linux</a></span></dt>
1.1       grant    1455: 
1.30      wiz      1456:                   <dt><span class="sect2"><a href="#openbsd">3.2.6.
                   1457:                   OpenBSD</a></span></dt>
1.1       grant    1458: 
1.30      wiz      1459:                   <dt><span class="sect2"><a href="#solaris">3.2.7.
                   1460:                   Solaris</a></span></dt>
1.1       grant    1461:                 </dl>
                   1462:               </dd>
                   1463:             </dl>
                   1464:           </dd>
                   1465: 
                   1466:           <dt><span class="chapter"><a href="#using">4. Using
                   1467:           pkgsrc</a></span></dt>
                   1468: 
                   1469:           <dd>
                   1470:             <dl>
                   1471:               <dt><span class="sect1"><a href=
                   1472:               "#getting-started">4.1. Working with binary
                   1473:               packages</a></span></dt>
                   1474: 
                   1475:               <dd>
                   1476:                 <dl>
                   1477:                   <dt><span class="sect2"><a href=
1.30      wiz      1478:                   "#where-to-get-binary-packages">4.1.1. Where to
                   1479:                   get binary packages</a></span></dt>
1.1       grant    1480: 
                   1481:                   <dt><span class="sect2"><a href=
1.30      wiz      1482:                   "#how-to-use-binary-packages">4.1.2. How to use
                   1483:                   binary packages</a></span></dt>
1.1       grant    1484: 
                   1485:                   <dt><span class="sect2"><a href=
1.30      wiz      1486:                   "#a-word-of-warning">4.1.3. A word of
1.1       grant    1487:                   warning</a></span></dt>
                   1488:                 </dl>
                   1489:               </dd>
                   1490: 
1.30      wiz      1491:               <dt><span class="sect1"><a href=
                   1492:               "#building-packages-from-source">4.2. Building
                   1493:               packages from source</a></span></dt>
1.1       grant    1494: 
                   1495:               <dd>
                   1496:                 <dl>
                   1497:                   <dt><span class="sect2"><a href=
1.30      wiz      1498:                   "#requirements">4.2.1.
                   1499:                   Requirements</a></span></dt>
1.1       grant    1500: 
                   1501:                   <dt><span class="sect2"><a href=
1.30      wiz      1502:                   "#fetching-distfiles">4.2.2. Fetching
1.1       grant    1503:                   distfiles</a></span></dt>
                   1504: 
                   1505:                   <dt><span class="sect2"><a href=
1.30      wiz      1506:                   "#how-to-build-and-install">4.2.3. How to build
                   1507:                   and install</a></span></dt>
1.1       grant    1508: 
                   1509:                   <dt><span class="sect2"><a href=
1.30      wiz      1510:                   "#selecting-the-compiler">4.2.4. Selecting the
1.1       grant    1511:                   compiler</a></span></dt>
                   1512:                 </dl>
                   1513:               </dd>
                   1514:             </dl>
                   1515:           </dd>
                   1516: 
1.38      dillo    1517:           <dt><span class="chapter"><a href="#configuring">5.
                   1518:           Configuring pkgsrc</a></span></dt>
                   1519: 
                   1520:           <dd>
                   1521:             <dl>
                   1522:               <dt><span class="sect1"><a href=
1.45      wiz      1523:               "#general-configuration">5.1. General
                   1524:               configuration</a></span></dt>
                   1525: 
                   1526:               <dt><span class="sect1"><a href=
                   1527:               "#variables-affecting-build">5.2. Variables affecting
                   1528:               the build process</a></span></dt>
                   1529: 
                   1530:               <dt><span class="sect1"><a href=
                   1531:               "#developer-advanced-settings">5.3.
                   1532:               Developer/advanced settings</a></span></dt>
                   1533: 
                   1534:               <dt><span class="sect1"><a href=
                   1535:               "#selecting-build-options">5.4. Selecting Build
1.42      dillo    1536:               Options</a></span></dt>
1.38      dillo    1537:             </dl>
                   1538:           </dd>
                   1539: 
                   1540:           <dt><span class="chapter"><a href="#binary">6. Creating
1.1       grant    1541:           binary packages</a></span></dt>
                   1542: 
                   1543:           <dd>
                   1544:             <dl>
1.30      wiz      1545:               <dt><span class="sect1"><a href=
1.38      dillo    1546:               "#building-a-single-binary-package">6.1. Building a
1.30      wiz      1547:               single binary package</a></span></dt>
1.1       grant    1548: 
1.30      wiz      1549:               <dt><span class="sect1"><a href=
1.38      dillo    1550:               "#settings-for-creationg-of-binary-packages">6.2.
1.1       grant    1551:               Settings for creation of binary
                   1552:               packages</a></span></dt>
                   1553: 
1.38      dillo    1554:               <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1       grant    1555:               Doing a bulk build of all packages</a></span></dt>
                   1556: 
                   1557:               <dd>
                   1558:                 <dl>
                   1559:                   <dt><span class="sect2"><a href=
1.38      dillo    1560:                   "#binary.configuration">6.3.1.
1.1       grant    1561:                   Configuration</a></span></dt>
                   1562: 
                   1563:                   <dt><span class="sect2"><a href=
1.38      dillo    1564:                   "#other-environmental-considerations">6.3.2.
1.30      wiz      1565:                   Other environmental
1.1       grant    1566:                   considerations</a></span></dt>
                   1567: 
                   1568:                   <dt><span class="sect2"><a href=
1.38      dillo    1569:                   "#operation">6.3.3. Operation</a></span></dt>
1.1       grant    1570: 
                   1571:                   <dt><span class="sect2"><a href=
1.38      dillo    1572:                   "#what-it-does">6.3.4. What it
1.30      wiz      1573:                   does</a></span></dt>
1.1       grant    1574: 
                   1575:                   <dt><span class="sect2"><a href=
1.38      dillo    1576:                   "#disk-space-requirements">6.3.5. Disk space
1.1       grant    1577:                   requirements</a></span></dt>
                   1578: 
                   1579:                   <dt><span class="sect2"><a href=
1.38      dillo    1580:                   "#setting-up-a-sandbox">6.3.6. Setting up a
1.47      reed     1581:                   sandbox for chrooted builds</a></span></dt>
1.1       grant    1582: 
                   1583:                   <dt><span class="sect2"><a href=
1.38      dillo    1584:                   "#building-a-partial-set">6.3.7. Building a
1.30      wiz      1585:                   partial set of packages</a></span></dt>
1.13      hubertf  1586: 
                   1587:                   <dt><span class="sect2"><a href=
1.38      dillo    1588:                   "#bulk-upload">6.3.8. Uploading results of a bulk
1.13      hubertf  1589:                   build</a></span></dt>
1.1       grant    1590:                 </dl>
                   1591:               </dd>
                   1592: 
1.30      wiz      1593:               <dt><span class="sect1"><a href=
1.38      dillo    1594:               "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30      wiz      1595:               packages collection</a></span></dt>
1.1       grant    1596: 
                   1597:               <dd>
                   1598:                 <dl>
                   1599:                   <dt><span class="sect2"><a href=
1.38      dillo    1600:                   "#cdpack-example">6.4.1. Example of
1.1       grant    1601:                   cdpack</a></span></dt>
                   1602:                 </dl>
                   1603:               </dd>
                   1604:             </dl>
                   1605:           </dd>
                   1606: 
1.38      dillo    1607:           <dt><span class="chapter"><a href="#faq">7. Frequently
1.1       grant    1608:           Asked Questions</a></span></dt>
                   1609: 
                   1610:           <dd>
                   1611:             <dl>
1.30      wiz      1612:               <dt><span class="sect1"><a href=
1.38      dillo    1613:               "#mailing-list-pointers">7.1. Are there any mailing
1.30      wiz      1614:               lists for pkg-related discussion?</a></span></dt>
1.1       grant    1615: 
1.38      dillo    1616:               <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1       grant    1617:               Where's the pkgviews documentation?</a></span></dt>
                   1618: 
1.38      dillo    1619:               <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1       grant    1620:               Utilities for package management
                   1621:               (pkgtools)</a></span></dt>
                   1622: 
1.30      wiz      1623:               <dt><span class="sect1"><a href=
1.38      dillo    1624:               "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30      wiz      1625:               non-root</a></span></dt>
1.1       grant    1626: 
1.30      wiz      1627:               <dt><span class="sect1"><a href=
1.38      dillo    1628:               "#resume-transfers">7.5. How to resume transfers when
1.30      wiz      1629:               fetching distfiles?</a></span></dt>
1.14      xtraeme  1630: 
1.30      wiz      1631:               <dt><span class="sect1"><a href=
1.38      dillo    1632:               "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30      wiz      1633:               XFree86 from pkgsrc?</a></span></dt>
1.1       grant    1634: 
1.30      wiz      1635:               <dt><span class="sect1"><a href=
1.38      dillo    1636:               "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30      wiz      1637:               from pkgsrc?</a></span></dt>
1.1       grant    1638: 
1.30      wiz      1639:               <dt><span class="sect1"><a href=
1.38      dillo    1640:               "#fetch-behind-firewall">7.8. How to fetch files from
1.30      wiz      1641:               behind a firewall</a></span></dt>
1.1       grant    1642: 
1.38      dillo    1643:               <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.30      wiz      1644:               How do I tell <span><strong class="command">make
1.14      xtraeme  1645:               fetch</strong></span> to do passive
1.1       grant    1646:               FTP?</a></span></dt>
                   1647: 
1.30      wiz      1648:               <dt><span class="sect1"><a href=
1.38      dillo    1649:               "#fetching-all-distfiles">7.10. How to fetch all
1.30      wiz      1650:               distfiles at once</a></span></dt>
1.1       grant    1651: 
1.30      wiz      1652:               <dt><span class="sect1"><a href=
1.38      dillo    1653:               "#tmac.andoc-missing">7.11. What does
1.30      wiz      1654:               &#8220;<span class="quote">Don't know how to make
                   1655:               /usr/share/tmac/tmac.andoc</span>&#8221;
1.14      xtraeme  1656:               mean?</a></span></dt>
1.13      hubertf  1657: 
1.30      wiz      1658:               <dt><span class="sect1"><a href=
1.38      dillo    1659:               "#bsd.own.mk-missing">7.12. What does
1.30      wiz      1660:               &#8220;<span class="quote">Could not find
1.14      xtraeme  1661:               bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    1662: 
1.30      wiz      1663:               <dt><span class="sect1"><a href=
1.38      dillo    1664:               "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30      wiz      1665:               pkgsrc</a></span></dt>
1.1       grant    1666: 
1.38      dillo    1667:               <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35      jmmv     1668:               do I change the location of configuration
                   1669:               files?</a></span></dt>
1.1       grant    1670: 
                   1671:               <dt><span class="sect1"><a href=
1.38      dillo    1672:               "#audit-packages">7.15. Automated security
1.1       grant    1673:               checks</a></span></dt>
                   1674:             </dl>
                   1675:           </dd>
                   1676:         </dl>
                   1677:       </div>
                   1678: 
1.59    ! rillig   1679:       <div class="chapter" lang="en" xml:lang="en">
1.1       grant    1680:         <div class="titlepage">
                   1681:           <div>
                   1682:             <div>
1.59    ! rillig   1683:               <h2 class="title"><a name="getting" id=
1.1       grant    1684:               "getting"></a>Chapter&nbsp;2.&nbsp;Where to get
1.59    ! rillig   1685:               pkgsrc and how to keep it up-to-date</h2>
1.1       grant    1686:             </div>
                   1687:           </div>
                   1688:         </div>
                   1689: 
                   1690:         <div class="toc">
                   1691:           <p><b>Table of Contents</b></p>
                   1692: 
                   1693:           <dl>
1.30      wiz      1694:             <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1       grant    1695:             tar file</a></span></dt>
                   1696: 
1.30      wiz      1697:             <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1       grant    1698:             SUP</a></span></dt>
                   1699: 
1.30      wiz      1700:             <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1       grant    1701:             CVS</a></span></dt>
1.59    ! rillig   1702: 
        !          1703:             <dt><span class="sect1"><a href="#uptodate-cvs">2.4.
        !          1704:             Keeping pkgsrc up-to-date via CVS</a></span></dt>
1.1       grant    1705:           </dl>
                   1706:         </div>
                   1707: 
                   1708:         <p>There are three ways to get pkgsrc. Either as a tar
                   1709:         file, via SUP, or via CVS. All three ways are described
                   1710:         here.</p>
                   1711: 
1.59    ! rillig   1712:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    1713:           <div class="titlepage">
                   1714:             <div>
                   1715:               <div>
                   1716:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   1717:                 "as-tar-file" id="as-tar-file"></a>2.1.&nbsp;As tar
        !          1718:                 file</h2>
1.1       grant    1719:               </div>
                   1720:             </div>
                   1721:           </div>
                   1722: 
                   1723:           <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
                   1724:           file from <a href=
1.11      ben      1725:           "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20      ben      1726:           target="_top">ftp.NetBSD.org</a> and unpack it into
1.45      wiz      1727:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   1728:           class="filename">/usr/pkgsrc</code>.</p>
1.1       grant    1729:         </div>
                   1730: 
1.59    ! rillig   1731:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    1732:           <div class="titlepage">
                   1733:             <div>
                   1734:               <div>
                   1735:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   1736:                 "via-sup" id="via-sup"></a>2.2.&nbsp;Via SUP</h2>
1.1       grant    1737:               </div>
                   1738:             </div>
                   1739:           </div>
                   1740: 
                   1741:           <p>As an alternative to the tar file, you can get pkgsrc
                   1742:           via the Software Update Protocol, SUP. To do so, make
                   1743:           sure your supfile has a line</p>
                   1744:           <pre class="programlisting">
1.51      rillig   1745:     release=pkgsrc
1.1       grant    1746: </pre>
                   1747: 
1.45      wiz      1748:           <p>in it, see the examples in <code xmlns=
                   1749:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1750:           "filename">/usr/share/examples/supfiles</code>, and that
1.45      wiz      1751:           the <code xmlns=
                   1752:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1753:           "filename">/usr/pkgsrc</code> directory exists. Then,
                   1754:           simply run <span><strong class="command">sup -v
                   1755:           <em class="replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1       grant    1756:         </div>
                   1757: 
1.59    ! rillig   1758:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    1759:           <div class="titlepage">
                   1760:             <div>
                   1761:               <div>
                   1762:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   1763:                 "via-cvs" id="via-cvs"></a>2.3.&nbsp;Via CVS</h2>
1.1       grant    1764:               </div>
                   1765:             </div>
                   1766:           </div>
                   1767: 
                   1768:           <p>To get pkgsrc via CVS, make sure you have
                   1769:           &#8220;<span class="quote">cvs</span>&#8221; installed.
1.27      rillig   1770:           To do an initial (full) checkout of pkgsrc, do the
                   1771:           following steps:</p>
1.1       grant    1772:           <pre class="screen">
1.14      xtraeme  1773: <code class="prompt">%</code> <strong class=
                   1774: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
                   1775: <code class="prompt">%</code> <strong class=
                   1776: "userinput"><code>setenv CVS_RSH ssh</code></strong>
                   1777: <code class="prompt">%</code> <strong class=
                   1778: "userinput"><code>cd /usr</code></strong>
                   1779: <code class="prompt">%</code> <strong class=
                   1780: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
                   1781: </pre>
                   1782: 
1.45      wiz      1783:           <p>This will create the <code xmlns=
                   1784:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1785:           "filename">pkgsrc</code> directory in your <code xmlns=
                   1786:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1787:           "filename">/usr</code>, and all the package source will
1.45      wiz      1788:           be stored under <code xmlns=
                   1789:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1790:           "filename">/usr/pkgsrc</code>. To update pkgsrc after the
                   1791:           initial checkout, make sure you have <code class=
                   1792:           "varname">CVS_RSH</code> set as above, then do:</p>
1.1       grant    1793:           <pre class="screen">
1.14      xtraeme  1794: <code class="prompt">%</code> <strong class=
                   1795: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   1796: <code class="prompt">%</code> <strong class=
                   1797: "userinput"><code>cvs -q update -dP</code></strong>
1.1       grant    1798: </pre>
                   1799: 
                   1800:           <p>Please also note that it is possible to have multiple
                   1801:           copies of the pkgsrc hierarchy in use at any one time -
                   1802:           all work is done relatively within the pkgsrc tree.</p>
                   1803:         </div>
1.59    ! rillig   1804: 
        !          1805:         <div class="sect1" lang="en" xml:lang="en">
        !          1806:           <div class="titlepage">
        !          1807:             <div>
        !          1808:               <div>
        !          1809:                 <h2 class="title" style="clear: both"><a name=
        !          1810:                 "uptodate-cvs" id=
        !          1811:                 "uptodate-cvs"></a>2.4.&nbsp;Keeping pkgsrc
        !          1812:                 up-to-date via CVS</h2>
        !          1813:               </div>
        !          1814:             </div>
        !          1815:           </div>
        !          1816: 
        !          1817:           <p>If your copy of pkgsrc contains a lot of <code xmlns=
        !          1818:           "http://www.w3.org/TR/xhtml1/transitional" class=
        !          1819:           "filename">CVS</code> directories, you can update it
        !          1820:           using the <a href=
        !          1821:           "http://netbsd.gw.com/cgi-bin/man-cgi?cvs+1+NetBSD-current">
        !          1822:           <span class="citerefentry"><span class=
        !          1823:           "refentrytitle">cvs</span>(1)</span></a> program. First,
        !          1824:           <span><strong class="command">cd</strong></span> to the
        !          1825:           top level directory of pkgsrc. Then run
        !          1826:           <span><strong class="command">cvs -q update
        !          1827:           -dP</strong></span>, and you're done.</p>
        !          1828: 
        !          1829:           <p>If that doesn't work and the file <code xmlns=
        !          1830:           "http://www.w3.org/TR/xhtml1/transitional" class=
        !          1831:           "filename">CVS/Root</code> contains the string
        !          1832:           &#8220;<span class="quote">:pserver:</span>&#8221;, you
        !          1833:           have to run <span><strong class="command">cvs
        !          1834:           login</strong></span> once to get known to the NetBSD CVS
        !          1835:           server. The <span><strong class=
        !          1836:           "command">cvs</strong></span> utility will then ask you
        !          1837:           for a password. Just enter &#8220;<span class=
        !          1838:           "quote">anoncvs</span>&#8221;. Then try again to
        !          1839:           update.</p>
        !          1840:         </div>
1.1       grant    1841:       </div>
                   1842: 
1.59    ! rillig   1843:       <div class="chapter" lang="en" xml:lang="en">
1.1       grant    1844:         <div class="titlepage">
                   1845:           <div>
                   1846:             <div>
1.59    ! rillig   1847:               <h2 class="title"><a name="platforms" id=
1.1       grant    1848:               "platforms"></a>Chapter&nbsp;3.&nbsp;Using pkgsrc on
                   1849:               systems other than NetBSD</h2>
                   1850:             </div>
                   1851:           </div>
                   1852:         </div>
                   1853: 
                   1854:         <div class="toc">
                   1855:           <p><b>Table of Contents</b></p>
                   1856: 
                   1857:           <dl>
1.30      wiz      1858:             <dt><span class="sect1"><a href=
                   1859:             "#bootstrapping-pkgsrc">3.1. Bootstrapping
                   1860:             pkgsrc</a></span></dt>
1.1       grant    1861: 
1.30      wiz      1862:             <dt><span class="sect1"><a href=
1.47      reed     1863:             "#platform-specific-notes">3.2. Platform-specific
1.30      wiz      1864:             notes</a></span></dt>
1.1       grant    1865: 
                   1866:             <dd>
                   1867:               <dl>
1.30      wiz      1868:                 <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1       grant    1869:                 Darwin (Mac OS X)</a></span></dt>
                   1870: 
1.30      wiz      1871:                 <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1       grant    1872:                 FreeBSD</a></span></dt>
                   1873: 
1.30      wiz      1874:                 <dt><span class="sect2"><a href="#interix">3.2.3.
1.1       grant    1875:                 Interix</a></span></dt>
                   1876: 
1.30      wiz      1877:                 <dt><span class="sect2"><a href="#irix">3.2.4.
1.1       grant    1878:                 IRIX</a></span></dt>
                   1879: 
1.30      wiz      1880:                 <dt><span class="sect2"><a href="#linux">3.2.5.
1.22      tv       1881:                 Linux</a></span></dt>
                   1882: 
1.30      wiz      1883:                 <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1       grant    1884:                 OpenBSD</a></span></dt>
                   1885: 
1.30      wiz      1886:                 <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1       grant    1887:                 Solaris</a></span></dt>
                   1888:               </dl>
                   1889:             </dd>
                   1890:           </dl>
                   1891:         </div>
                   1892: 
1.59    ! rillig   1893:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    1894:           <div class="titlepage">
                   1895:             <div>
                   1896:               <div>
                   1897:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   1898:                 "bootstrapping-pkgsrc" id=
1.30      wiz      1899:                 "bootstrapping-pkgsrc"></a>3.1.&nbsp;Bootstrapping
                   1900:                 pkgsrc</h2>
1.1       grant    1901:               </div>
                   1902:             </div>
                   1903:           </div>
                   1904: 
1.27      rillig   1905:           <p>For operating systems other than NetBSD, we provide a
1.1       grant    1906:           bootstrap kit to build the required tools to use pkgsrc
                   1907:           on your platform. Besides support for native NetBSD,
                   1908:           pkgsrc and the bootstrap kit have support for the
                   1909:           following operating systems:</p>
                   1910: 
                   1911:           <div class="itemizedlist">
                   1912:             <ul type="disc">
                   1913:               <li>
                   1914:                 <p>Darwin (Mac OS X)</p>
                   1915:               </li>
                   1916: 
                   1917:               <li>
1.16      grant    1918:                 <p>DragonFlyBSD</p>
                   1919:               </li>
                   1920: 
                   1921:               <li>
1.1       grant    1922:                 <p>FreeBSD</p>
                   1923:               </li>
                   1924: 
                   1925:               <li>
                   1926:                 <p>Interix (Windows 2000, XP, 2003)</p>
                   1927:               </li>
                   1928: 
                   1929:               <li>
                   1930:                 <p>IRIX</p>
                   1931:               </li>
                   1932: 
                   1933:               <li>
                   1934:                 <p>Linux</p>
                   1935:               </li>
                   1936: 
                   1937:               <li>
                   1938:                 <p>OpenBSD</p>
                   1939:               </li>
                   1940: 
                   1941:               <li>
                   1942:                 <p>Solaris</p>
                   1943:               </li>
1.16      grant    1944: 
                   1945:               <li>
                   1946:                 <p>Tru64 (Digital UNIX/OSF1)</p>
                   1947:               </li>
1.1       grant    1948:             </ul>
                   1949:           </div>
                   1950: 
                   1951:           <p>Support for other platforms is under development.</p>
                   1952: 
                   1953:           <p>Installing the bootstrap kit should be as simple
                   1954:           as:</p>
                   1955:           <pre class="screen">
1.14      xtraeme  1956: <code class="prompt">#</code> <strong class=
                   1957: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
                   1958: <code class="prompt">#</code> <strong class=
                   1959: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1960: <code class="prompt">#</code> <strong class=
                   1961: "userinput"><code>./bootstrap</code></strong>
1.1       grant    1962: </pre>
                   1963: 
                   1964:           <p>See <a href="#getting" title=
1.59    ! rillig   1965:           "Chapter&nbsp;2.&nbsp;Where to get pkgsrc and how to keep it up-to-date">
        !          1966:           Chapter 2, <i>Where to get pkgsrc and how to keep it
        !          1967:           up-to-date</i></a> for other ways to get pkgsrc before
        !          1968:           bootstrapping. The given <span><strong class=
        !          1969:           "command">bootstrap</strong></span> command will use the
        !          1970:           defaults of <code xmlns=
1.45      wiz      1971:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1972:           "filename">/usr/pkg</code> for the <span class=
                   1973:           "emphasis"><em>prefix</em></span> where programs will be
1.45      wiz      1974:           installed in, and <code xmlns=
                   1975:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1976:           "filename">/var/db/pkg</code> for the package database
1.27      rillig   1977:           directory where pkgsrc will do its internal bookkeeping.
1.1       grant    1978:           However, these can also be set using command-line
1.27      rillig   1979:           arguments.</p>
1.1       grant    1980: 
                   1981:           <p>Binary packages for the pkgsrc tools and an initial
                   1982:           set of packages is available for supported platforms. An
                   1983:           up-to-date list of these can be found on <a href=
                   1984:           "http://www.pkgsrc.org/" target=
                   1985:           "_top">www.pkgsrc.org</a>.</p>
1.47      reed     1986: 
                   1987:           <div class="note" style=
                   1988:           "margin-left: 0.5in; margin-right: 0.5in;">
                   1989:             <h3 class="title">Note</h3>
                   1990: 
                   1991:             <p>The bootstrap installs a <span><strong class=
                   1992:             "command">bmake</strong></span> tool. Use this
                   1993:             <span><strong class="command">bmake</strong></span>
                   1994:             when building via pkgsrc. For examples in this guide,
                   1995:             use <span><strong class="command">bmake</strong></span>
                   1996:             instead of &#8220;<span class=
                   1997:             "quote">make</span>&#8221;.</p>
                   1998:           </div>
1.1       grant    1999:         </div>
                   2000: 
1.59    ! rillig   2001:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    2002:           <div class="titlepage">
                   2003:             <div>
                   2004:               <div>
                   2005:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   2006:                 "platform-specific-notes" id=
1.47      reed     2007:                 "platform-specific-notes"></a>3.2.&nbsp;Platform-specific
                   2008:                 notes</h2>
1.1       grant    2009:               </div>
                   2010:             </div>
                   2011:           </div>
                   2012: 
                   2013:           <p>Here are some platform-specific notes you should be
                   2014:           aware of.</p>
                   2015: 
1.59    ! rillig   2016:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    2017:             <div class="titlepage">
                   2018:               <div>
                   2019:                 <div>
1.59    ! rillig   2020:                   <h3 class="title"><a name="darwin" id=
1.30      wiz      2021:                   "darwin"></a>3.2.1.&nbsp;Darwin (Mac OS X)</h3>
1.1       grant    2022:                 </div>
                   2023:               </div>
                   2024:             </div>
                   2025: 
                   2026:             <p>Darwin 5.x and 6.x are supported. There are two
                   2027:             methods of using pkgsrc on Mac OS X, by using a
                   2028:             <a href="#platform.osx-image" title=
                   2029:             "3.2.1.1.&nbsp;Using a disk image">disk image</a>, or a
                   2030:             <a href="#platform.osx-ufs" title=
                   2031:             "3.2.1.2.&nbsp;Using a UFS partition">UFS
                   2032:             partition</a>.</p>
                   2033: 
                   2034:             <p>Before you start, you will need to download and
                   2035:             install the Mac OS X Developer Tools from Apple's
                   2036:             Developer Connection. See <a href=
                   2037:             "http://developer.apple.com/macosx/" target=
                   2038:             "_top">http://developer.apple.com/macosx/</a> for
                   2039:             details. Also, make sure you install X11 for Mac OS X
                   2040:             and the X11 SDK from <a href=
                   2041:             "http://www.apple.com/macosx/x11/download/" target=
                   2042:             "_top">http://www.apple.com/macosx/x11/download/</a> if
                   2043:             you intend to build packages that use the X11 Window
                   2044:             System.</p>
                   2045: 
                   2046:             <p>If you already have a UFS partition, or have a spare
                   2047:             partition that you can format as UFS, it is recommended
                   2048:             to use that instead of the disk image. It'll be
                   2049:             somewhat faster and will mount automatically at boot
                   2050:             time, where you must manually mount a disk image.</p>
                   2051: 
                   2052:             <div class="note" style=
                   2053:             "margin-left: 0.5in; margin-right: 0.5in;">
                   2054:               <h3 class="title">Note</h3>
                   2055: 
                   2056:               <p>You cannot use a HFS+ file system for pkgsrc,
1.47      reed     2057:               because pkgsrc currently requires the file system to
1.1       grant    2058:               be case-sensitive, and HFS+ is not.</p>
                   2059:             </div>
                   2060: 
1.59    ! rillig   2061:             <div class="sect3" lang="en" xml:lang="en">
1.1       grant    2062:               <div class="titlepage">
                   2063:                 <div>
                   2064:                   <div>
1.59    ! rillig   2065:                     <h4 class="title"><a name="platform.osx-image"
        !          2066:                     id="platform.osx-image"></a>3.2.1.1.&nbsp;Using
        !          2067:                     a disk image</h4>
1.1       grant    2068:                   </div>
                   2069:                 </div>
                   2070:               </div>
                   2071: 
                   2072:               <p>Create the disk image:</p>
                   2073:               <pre class="screen">
1.14      xtraeme  2074: <code class="prompt">#</code> <strong class=
                   2075: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   2076: <code class="prompt">#</code> <strong class=
                   2077: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
                   2078: <code class="prompt">#</code> <strong class=
                   2079: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
                   2080: <code class="prompt">#</code> <strong class=
                   2081: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1       grant    2082: </pre>
                   2083: 
                   2084:               <p>That's it!</p>
                   2085:             </div>
                   2086: 
1.59    ! rillig   2087:             <div class="sect3" lang="en" xml:lang="en">
1.1       grant    2088:               <div class="titlepage">
                   2089:                 <div>
                   2090:                   <div>
1.59    ! rillig   2091:                     <h4 class="title"><a name="platform.osx-ufs"
        !          2092:                     id="platform.osx-ufs"></a>3.2.1.2.&nbsp;Using a
1.1       grant    2093:                     UFS partition</h4>
                   2094:                   </div>
                   2095:                 </div>
                   2096:               </div>
                   2097: 
1.45      wiz      2098:               <p>By default, <code xmlns=
                   2099:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   2100:               "filename">/usr</code> will be on your root file
                   2101:               system, normally HFS+. It is possible to use the
                   2102:               default <span class="emphasis"><em>prefix</em></span>
                   2103:               of <code xmlns=
                   2104:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   2105:               "filename">/usr/pkg</code> by symlinking <code xmlns=
                   2106:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2107:               "filename">/usr/pkg</code> to a directory on a UFS
                   2108:               file system. Obviously, another symlink is required
                   2109:               if you want to place the package database directory
                   2110:               outside the <span class=
                   2111:               "emphasis"><em>prefix</em></span>. e.g.</p>
1.1       grant    2112:               <pre class="screen">
1.14      xtraeme  2113: <code class="prompt">#</code> <strong class=
1.59    ! rillig   2114: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb</code></strong>
1.1       grant    2115: </pre>
                   2116: 
                   2117:               <p>If you created your partitions at the time of
                   2118:               installing Mac OS X and formatted the target
                   2119:               partition as UFS, it should automatically mount on
1.45      wiz      2120:               <code xmlns=
                   2121:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   2122:               "filename">/Volumes/&lt;volume name&gt;</code> when
                   2123:               the machine boots. If you are (re)formatting a
                   2124:               partition as UFS, you need to ensure that the
                   2125:               partition map correctly reflects &#8220;<span class=
                   2126:               "quote">Apple_UFS</span>&#8221; and not
                   2127:               &#8220;<span class=
1.1       grant    2128:               "quote">Apple_HFS</span>&#8221;.</p>
                   2129: 
                   2130:               <p>The problem is that none of the disk tools will
                   2131:               let you touch a disk that is booted from. You can
                   2132:               unmount the partition, but even if you newfs it, the
                   2133:               partition type will be incorrect and the automounter
                   2134:               won't mount it. It can be mounted manually, but it
                   2135:               won't appear in Finder.</p>
                   2136: 
                   2137:               <p>You'll need to boot off of the OS X Installation
                   2138:               (User) CD. When the Installation program starts, go
                   2139:               up to the menu and select Disk Utility. Now, you will
                   2140:               be able to select the partition you want to be UFS,
                   2141:               and Format it Apple UFS. Quit the Disk Utility, quit
                   2142:               the installer which will reboot your machine. The new
                   2143:               UFS file system will appear in Finder.</p>
                   2144: 
                   2145:               <p>Be aware that the permissions on the new file
                   2146:               system will be writable by root only.</p>
                   2147: 
                   2148:               <p>This note is as of 10.2 (Jaguar) and applies to
                   2149:               earlier versions. Hopefully Apple will fix Disk
                   2150:               Utility in 10.3 (Panther).</p>
                   2151:             </div>
                   2152:           </div>
                   2153: 
1.59    ! rillig   2154:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    2155:             <div class="titlepage">
                   2156:               <div>
                   2157:                 <div>
1.59    ! rillig   2158:                   <h3 class="title"><a name="freebsd" id=
1.30      wiz      2159:                   "freebsd"></a>3.2.2.&nbsp;FreeBSD</h3>
1.1       grant    2160:                 </div>
                   2161:               </div>
                   2162:             </div>
                   2163: 
                   2164:             <p>FreeBSD 4.7 and 5.0 have been tested and are
                   2165:             supported, other versions may work.</p>
                   2166: 
                   2167:             <p>Care should be taken so that the tools that this kit
                   2168:             installs do not conflict with the FreeBSD userland
                   2169:             tools. There are several steps:</p>
                   2170: 
                   2171:             <div class="orderedlist">
                   2172:               <ol type="1">
                   2173:                 <li>
                   2174:                   <p>FreeBSD stores its ports pkg database in
1.45      wiz      2175:                   <code xmlns=
                   2176:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   2177:                   "filename">/var/db/pkg</code>. It is therefore
                   2178:                   recommended that you choose a different location
                   2179:                   (e.g. <code xmlns=
                   2180:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2181:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2182:                   --pkgdbdir option to the bootstrap script.</p>
                   2183:                 </li>
                   2184: 
                   2185:                 <li>
                   2186:                   <p>If you do not intend to use the FreeBSD ports
                   2187:                   tools, it's probably a good idea to move them out
                   2188:                   of the way to avoid confusion, e.g.</p>
                   2189:                   <pre class="screen">
1.14      xtraeme  2190: <code class="prompt">#</code> <strong class=
                   2191: "userinput"><code>cd /usr/sbin</code></strong>
                   2192: <code class="prompt">#</code> <strong class=
                   2193: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2194: <code class="prompt">#</code> <strong class=
                   2195: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2196: <code class="prompt">#</code> <strong class=
                   2197: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2198: <code class="prompt">#</code> <strong class=
                   2199: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2200: </pre>
                   2201:                 </li>
                   2202: 
                   2203:                 <li>
1.45      wiz      2204:                   <p>An example <code xmlns=
                   2205:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2206:                   "filename">/etc/mk.conf</code> file will be
1.45      wiz      2207:                   placed in <code xmlns=
                   2208:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2209:                   "filename">/etc/mk.conf.example</code> file when
                   2210:                   you use the bootstrap script.</p>
1.1       grant    2211:                 </li>
                   2212:               </ol>
                   2213:             </div>
                   2214:           </div>
                   2215: 
1.59    ! rillig   2216:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    2217:             <div class="titlepage">
                   2218:               <div>
                   2219:                 <div>
1.59    ! rillig   2220:                   <h3 class="title"><a name="interix" id=
1.30      wiz      2221:                   "interix"></a>3.2.3.&nbsp;Interix</h3>
1.1       grant    2222:                 </div>
                   2223:               </div>
                   2224:             </div>
                   2225: 
1.47      reed     2226:             <p>Interix is a POSIX-compatible subsystem for the
1.1       grant    2227:             Windows NT kernel, providing a Unix-like environment
                   2228:             with a tighter kernel integration than available with
                   2229:             Cygwin. It is part of the Windows Services for Unix
                   2230:             package, available for free for any licensed copy of
1.22      tv       2231:             Windows 2000, XP (not including XP Home), or 2003. SFU
                   2232:             can be downloaded from <a href=
                   2233:             "http://www.microsoft.com/windows/sfu/" target=
1.1       grant    2234:             "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
                   2235: 
                   2236:             <p>Services for Unix 3.5, current as of this writing,
                   2237:             has been tested. 3.0 or 3.1 may work, but are not
                   2238:             officially supported. (The main difference in 3.0/3.1
                   2239:             is lack of pthreads.)</p>
                   2240: 
1.59    ! rillig   2241:             <div class="sect3" lang="en" xml:lang="en">
1.1       grant    2242:               <div class="titlepage">
                   2243:                 <div>
                   2244:                   <div>
                   2245:                     <h4 class="title"><a name=
1.59    ! rillig   2246:                     "platform.interix-sfu-install" id=
1.1       grant    2247:                     "platform.interix-sfu-install"></a>3.2.3.1.&nbsp;When
1.2       hubertf  2248:                     installing Interix/SFU</h4>
1.1       grant    2249:                   </div>
                   2250:                 </div>
                   2251:               </div>
                   2252: 
                   2253:               <p>At an absolute minimum, the following packages
                   2254:               must be installed from the Windows Services for Unix
                   2255:               3.5 distribution in order to use pkgsrc:</p>
                   2256: 
                   2257:               <div class="itemizedlist">
                   2258:                 <ul type="disc">
                   2259:                   <li>
                   2260:                     <p>Utilities -&gt; Base Utilities</p>
                   2261:                   </li>
                   2262: 
                   2263:                   <li>
                   2264:                     <p>Interix GNU Components -&gt; (all)</p>
                   2265:                   </li>
                   2266: 
                   2267:                   <li>
                   2268:                     <p>Remote Connectivity</p>
                   2269:                   </li>
                   2270: 
                   2271:                   <li>
                   2272:                     <p>Interix SDK</p>
                   2273:                   </li>
                   2274:                 </ul>
                   2275:               </div>
                   2276: 
                   2277:               <p>When using pkgsrc on Interix, DO NOT install the
                   2278:               Utilities subcomponent "UNIX Perl". That is Perl 5.6
                   2279:               without shared module support, installed to
                   2280:               /usr/local, and will only cause confusion. Instead,
                   2281:               install Perl 5.8 from pkgsrc (or from a binary
                   2282:               package).</p>
                   2283: 
                   2284:               <p>The Remote Connectivity subcomponent "Windows
                   2285:               Remote Shell Service" does not need to be installed,
                   2286:               but Remote Connectivity itself should be installed in
                   2287:               order to have a working inetd.</p>
                   2288: 
1.52      tv       2289:               <p>During installation you may be asked whether to
                   2290:               enable setuid behavior for Interix programs, and
                   2291:               whether to make pathnames default to case-sensitive.
                   2292:               Setuid should be enabled, and case-sensitivity MUST
                   2293:               be enabled. (Without case-sensitivity, a large number
                   2294:               of packages including perl will not build.)</p>
                   2295: 
                   2296:               <p>NOTE: Newer Windows service packs change the way
                   2297:               binary execution works (via the Data Execution
                   2298:               Prevention feature). In order to use pkgsrc and other
                   2299:               gcc-compiled binaries reliably, a hotfix containing
                   2300:               POSIX.EXE, PSXDLL.DLL, PSXRUN.EXE, and PSXSS.EXE
                   2301:               (899522 or newer) must be installed. Hotfixes are
                   2302:               available from Microsoft through a support contract;
                   2303:               however, a NetBSD developer has made most Interix
                   2304:               hotfixes available for personal use from <a href=
                   2305:               "http://www.duh.org/interix/hotfixes.php" target=
                   2306:               "_top">http://www.duh.org/interix/hotfixes.php</a>.</p>
1.1       grant    2307:             </div>
                   2308: 
1.59    ! rillig   2309:             <div class="sect3" lang="en" xml:lang="en">
1.1       grant    2310:               <div class="titlepage">
                   2311:                 <div>
                   2312:                   <div>
                   2313:                     <h4 class="title"><a name=
1.59    ! rillig   2314:                     "platform.interix-sfu-postinstall" id=
1.1       grant    2315:                     "platform.interix-sfu-postinstall"></a>3.2.3.2.&nbsp;What
                   2316:                     to do if Interix/SFU is already installed</h4>
                   2317:                   </div>
                   2318:                 </div>
                   2319:               </div>
                   2320: 
                   2321:               <p>If SFU is already installed and you wish to alter
                   2322:               these settings to work with pkgsrc, note the
                   2323:               following things.</p>
                   2324: 
                   2325:               <div class="itemizedlist">
                   2326:                 <ul type="disc">
                   2327:                   <li>
                   2328:                     <p>To uninstall UNIX Perl, use Add/Remove
                   2329:                     Programs, select Microsoft Windows Services for
                   2330:                     UNIX, then click Change. In the installer,
                   2331:                     choose Add or Remove, then uncheck
                   2332:                     Utilities-&gt;UNIX Perl.</p>
                   2333:                   </li>
                   2334: 
                   2335:                   <li>
1.47      reed     2336:                     <p>To enable case-sensitivity for the file
                   2337:                     system, run REGEDIT.EXE, and change the
1.1       grant    2338:                     following registry key:</p>
                   2339: 
                   2340:                     <p>
                   2341:                     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
                   2342:                     Manager\kernel</p>
                   2343: 
                   2344:                     <p>Set the DWORD value "obcaseinsensitive" to
                   2345:                     0; then reboot.</p>
                   2346:                   </li>
                   2347: 
                   2348:                   <li>
                   2349:                     <p>To enable setuid binaries (optional), run
                   2350:                     REGEDIT.EXE, and change the following registry
                   2351:                     key:</p>
                   2352: 
                   2353:                     <p>
                   2354:                     HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
                   2355:                     for UNIX</p>
                   2356: 
                   2357:                     <p>Set the DWORD value "EnableSetuidBinaries"
                   2358:                     to 1; then reboot.</p>
                   2359:                   </li>
                   2360:                 </ul>
                   2361:               </div>
                   2362:             </div>
                   2363: 
1.59    ! rillig   2364:             <div class="sect3" lang="en" xml:lang="en">
1.1       grant    2365:               <div class="titlepage">
                   2366:                 <div>
                   2367:                   <div>
                   2368:                     <h4 class="title"><a name=
1.59    ! rillig   2369:                     "platform.interix-notes" id=
1.1       grant    2370:                     "platform.interix-notes"></a>3.2.3.3.&nbsp;Important
                   2371:                     notes for using pkgsrc</h4>
                   2372:                   </div>
                   2373:                 </div>
                   2374:               </div>
                   2375: 
1.52      tv       2376:               <p>The package manager (either the pkgsrc "su" user,
1.1       grant    2377:               or the user running "pkg_add") must be a member of
                   2378:               the local Administrators group. Such a user must also
                   2379:               be used to run the bootstrap. This is slightly
                   2380:               relaxed from the normal pkgsrc requirement of
                   2381:               "root".</p>
                   2382: 
                   2383:               <p>The package manager should use a umask of 002.
                   2384:               "make install" will automatically complain if this is
                   2385:               not the case. This ensures that directories written
                   2386:               in /var/db/pkg are Administrators-group
                   2387:               writeable.</p>
                   2388: 
                   2389:               <p>The popular Interix binary packages from
                   2390:               http://www.interopsystems.com/ use an older version
                   2391:               of pkgsrc's pkg_* tools. Ideally, these should NOT be
                   2392:               used in conjunction with pkgsrc. If you choose to use
                   2393:               them at the same time as the pkgsrc packages, ensure
                   2394:               that you use the proper pkg_* tools for each type of
                   2395:               binary package.</p>
1.22      tv       2396: 
                   2397:               <p>The TERM setting used for DOS-type console windows
                   2398:               (including those invoked by the csh and ksh startup
                   2399:               shortcuts) is "interix". Most systems don't have a
                   2400:               termcap/terminfo entry for it, but the following
                   2401:               .termcap entry provides adequate emulation in most
                   2402:               cases:</p>
                   2403:               <pre class="programlisting">
1.51      rillig   2404:     interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
1.22      tv       2405: </pre>
1.1       grant    2406:             </div>
1.52      tv       2407: 
1.59    ! rillig   2408:             <div class="sect3" lang="en" xml:lang="en">
1.52      tv       2409:               <div class="titlepage">
                   2410:                 <div>
                   2411:                   <div>
                   2412:                     <h4 class="title"><a name=
1.59    ! rillig   2413:                     "platform.interix-limits" id=
1.52      tv       2414:                     "platform.interix-limits"></a>3.2.3.4.&nbsp;Limitations
                   2415:                     of the Interix platform</h4>
                   2416:                   </div>
                   2417:                 </div>
                   2418:               </div>
                   2419: 
                   2420:               <p>Though Interix suffices as a familiar and flexible
                   2421:               substitute for a full Unix-like platform, it has some
                   2422:               drawbacks that should be noted for those desiring to
                   2423:               make the most of Interix.</p>
                   2424: 
                   2425:               <div class="itemizedlist">
                   2426:                 <ul type="disc">
                   2427:                   <li>
1.54      tv       2428:                     <p><span class=
1.57      minskim  2429:                     "strong"><strong>X11:</strong></span></p>
1.52      tv       2430: 
                   2431:                     <p>Interix comes with the standard set of X11R6
1.57      minskim  2432:                     client libraries, and can run X11 based
1.52      tv       2433:                     applications, but it does <span class=
                   2434:                     "emphasis"><em>not</em></span> come with an X
                   2435:                     server. Some options are <a href=
                   2436:                     "http://www.starnet.com/products/xwin32/"
                   2437:                     target="_top">StarNet X-Win32</a>, <a href=
                   2438:                     "http://connectivity.hummingbird.com/products/nc/exceed/"
1.57      minskim  2439:                     target="_top">Hummingbird Exceed</a> (available
                   2440:                     in a trimmed version for Interix from Interop
                   2441:                     Systems as the <a href=
                   2442:                     "http://www.interopsystems.com/InteropXserver.htm"
                   2443:                     target="_top">Interop X Server</a>), and the
                   2444:                     free X11 server included with <a href=
1.52      tv       2445:                     "http://x.cygwin.com/" target=
                   2446:                     "_top">Cygwin</a>.</p>
                   2447: 
                   2448:                     <p>Also, StarNet Communications has graciously
                   2449:                     provided a free version of their X-Win32
                   2450:                     product that accepts connections only from
                   2451:                     localhost: <a href=
                   2452:                     "http://www.starnet.com/xwin32LX/get_xwin32LX.htm"
                   2453:                     target="_top">X-Win32 LX</a>, recommended by
                   2454:                     the maintainer of Interix pkgsrc support.</p>
                   2455:                   </li>
                   2456: 
                   2457:                   <li>
1.57      minskim  2458:                     <p><span class="strong"><strong>X11
1.54      tv       2459:                     acceleration:</strong></span></p>
1.52      tv       2460: 
                   2461:                     <p>Because Interix runs in a completely
                   2462:                     different NT subsystem from Win32 applications,
                   2463:                     it does not currently support various X11
                   2464:                     protocol extensions for acceleration (such as
                   2465:                     MIT-SHM or DGA). Most interactive applications
                   2466:                     to a local X server will run reasonably fast,
                   2467:                     but full motion video and other graphics
                   2468:                     intensive applications may require a
                   2469:                     faster-than-expected CPU.</p>
                   2470:                   </li>
                   2471: 
                   2472:                   <li>
1.54      tv       2473:                     <p><span class=
                   2474:                     "strong"><strong>Audio:</strong></span></p>
1.52      tv       2475: 
                   2476:                     <p>Interix has no native support for audio
1.53      tv       2477:                     output. For audio support, pkgsrc uses the
                   2478:                     <span><strong class=
1.52      tv       2479:                     "command">esound</strong></span> client/server
                   2480:                     audio system on Interix. Unlike on most
                   2481:                     platforms, the <a xmlns=
                   2482:                     "http://www.w3.org/TR/xhtml1/transitional"
                   2483:                     href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/esound/README.html"
                   2484:                     target="_top"><code xmlns="" class=
                   2485:                     "filename">audio/esound</code></a> package does
                   2486:                     <span class="emphasis"><em>not</em></span>
                   2487:                     contain the <span><strong class=
1.53      tv       2488:                     "command">esd</strong></span> server component.
                   2489:                     To output audio via an Interix host, the
                   2490:                     <a xmlns=
1.52      tv       2491:                     "http://www.w3.org/TR/xhtml1/transitional"
                   2492:                     href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/cygwin_esound/README.html"
                   2493:                     target="_top"><code xmlns="" class=
                   2494:                     "filename">emulators/cygwin_esound</code></a>
                   2495:                     package must also be installed.</p>
                   2496:                   </li>
                   2497: 
                   2498:                   <li>
1.54      tv       2499:                     <p><span class="strong"><strong>CD/DVDs, USB,
                   2500:                     and SCSI:</strong></span></p>
1.52      tv       2501: 
                   2502:                     <p>Direct device access is not currently
                   2503:                     supported in Interix, so it is not currently
                   2504:                     possible to access CD/DVD drives, USB devices,
                   2505:                     or SCSI devices through non-filesystem means.
                   2506:                     Among other things, this makes it impossible to
                   2507:                     use Interix directly for CD/DVD burning.</p>
                   2508:                   </li>
                   2509: 
                   2510:                   <li>
1.54      tv       2511:                     <p><span class="strong"><strong>Tape
                   2512:                     drives:</strong></span></p>
1.52      tv       2513: 
                   2514:                     <p>Due to the same limitations as for CD-ROMs
                   2515:                     and SCSI devices, tape drives are also not
                   2516:                     directly accessible in Interix. However,
                   2517:                     support is in work to make tape drive access
                   2518:                     possible by using Cygwin as a bridge (similarly
                   2519:                     to audio bridged via Cygwin's esound
                   2520:                     server).</p>
                   2521:                   </li>
                   2522:                 </ul>
                   2523:               </div>
                   2524:             </div>
                   2525: 
1.59    ! rillig   2526:             <div class="sect3" lang="en" xml:lang="en">
1.52      tv       2527:               <div class="titlepage">
                   2528:                 <div>
                   2529:                   <div>
                   2530:                     <h4 class="title"><a name=
1.59    ! rillig   2531:                     "platform.interix-knownissues" id=
1.52      tv       2532:                     "platform.interix-knownissues"></a>3.2.3.5.&nbsp;Known
                   2533:                     issues for pkgsrc on Interix</h4>
                   2534:                   </div>
                   2535:                 </div>
                   2536:               </div>
                   2537: 
                   2538:               <p>It is not necessary, in general, to have a "root"
                   2539:               user on the Windows system; any member of the local
                   2540:               Administrators group will suffice. However, some
                   2541:               packages currently assume that the user named "root"
                   2542:               is the privileged user. To accommodate these, you may
                   2543:               create such a user; make sure it is in the local
                   2544:               group Administrators (or your language
                   2545:               equivalent).</p>
                   2546: 
                   2547:               <p>"pkg_add" creates directories of mode 0755, not
                   2548:               0775, in $PKG_DBDIR. For the time being, install
                   2549:               packages as the local Administrator (or your language
                   2550:               equivalent), or run the following command after
                   2551:               installing a package to work around the issue:</p>
                   2552:               <pre class="screen">
                   2553: <code class="prompt">#</code> <strong class=
                   2554: "userinput"><code>chmod -R g+w $PKG_DBDIR</code></strong>
                   2555: </pre>
                   2556:             </div>
1.1       grant    2557:           </div>
                   2558: 
1.59    ! rillig   2559:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    2560:             <div class="titlepage">
                   2561:               <div>
                   2562:                 <div>
1.59    ! rillig   2563:                   <h3 class="title"><a name="irix" id=
1.30      wiz      2564:                   "irix"></a>3.2.4.&nbsp;IRIX</h3>
1.1       grant    2565:                 </div>
                   2566:               </div>
                   2567:             </div>
                   2568: 
                   2569:             <p>You will need a working C compiler, either gcc or
                   2570:             SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14      xtraeme  2571:             the <code class="varname">CC</code> environment
                   2572:             variable according to your preference. If you do not
                   2573:             have a license for the MIPSpro compiler suite, you can
1.1       grant    2574:             download a gcc tardist file from <a href=
                   2575:             "http://freeware.sgi.com/" target=
                   2576:             "_top">http://freeware.sgi.com/</a>.</p>
                   2577: 
                   2578:             <p>Please note that you will need IRIX 6.5.17 or
                   2579:             higher, as this is the earliest version of IRIX
1.24      wiz      2580:             providing support for <a href=
                   2581:             "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
                   2582:             <span class="citerefentry"><span class=
                   2583:             "refentrytitle">if_indextoname</span>(3)</span></a>,
                   2584:             <a href=
                   2585:             "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
                   2586:             <span class="citerefentry"><span class=
                   2587:             "refentrytitle">if_nametoindex</span>(3)</span></a>,
                   2588:             etc.</p>
1.1       grant    2589: 
1.27      rillig   2590:             <p>At this point in time, pkgsrc only supports one ABI
                   2591:             at a time. That is, you can not switch between the old
                   2592:             32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
                   2593:             you start out using "abi=n32", that's what all your
                   2594:             packages will be built with.</p>
1.1       grant    2595: 
                   2596:             <p>Therefore, please make sure that you have no
1.14      xtraeme  2597:             conflicting <code class="varname">CFLAGS</code> in your
1.45      wiz      2598:             environment or the <code xmlns=
                   2599:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2600:             "filename">/etc/mk.conf</code>. Particularly, make sure
1.1       grant    2601:             that you do not try to link n32 object files with lib64
1.45      wiz      2602:             or vice versa. Check your <code xmlns=
                   2603:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2604:             "filename">/etc/compiler.defaults</code>!</p>
1.1       grant    2605: 
                   2606:             <p>If you have the actual pkgsrc tree mounted via NFS
                   2607:             from a different host, please make sure to set
1.14      xtraeme  2608:             <code class="varname">WRKOBJDIR</code> to a local
1.1       grant    2609:             directory, as it appears that IRIX linker occasionally
1.47      reed     2610:             runs into issues when trying to link over a
                   2611:             network-mounted file system.</p>
1.1       grant    2612: 
                   2613:             <p>The bootstrapping process should set all the right
                   2614:             options for programs such as imake(1), but you may want
                   2615:             to set some options depending on your local setup.
1.45      wiz      2616:             Please see <code xmlns=
                   2617:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2618:             "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27      rillig   2619:             course, your compiler's man pages for details.</p>
1.22      tv       2620: 
                   2621:             <p>If you are using SGI's MIPSPro compiler, please
                   2622:             set</p>
                   2623:             <pre class="programlisting">
1.51      rillig   2624:     PKGSRC_COMPILER=        mipspro
1.22      tv       2625: </pre>
                   2626: 
1.45      wiz      2627:             <p>in <code xmlns=
                   2628:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   2629:             "filename">/etc/mk.conf</code>. Otherwise, pkgsrc will
                   2630:             assume you are using gcc and may end up passing invalid
                   2631:             flags to the compiler. Note that bootstrap should
                   2632:             create an appropriate <code xmlns=
                   2633:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2634:             "filename">mk.conf.example</code> by default.</p>
                   2635: 
                   2636:             <p>If you have both the MIPSPro compiler chain
                   2637:             installed as well as gcc, but want to make sure that
                   2638:             MIPRPro is used, please set your <code class=
                   2639:             "varname">PATH</code> to <span class=
                   2640:             "emphasis"><em>not</em></span> include the location of
1.45      wiz      2641:             gcc (often <code xmlns=
                   2642:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2643:             "filename">/usr/freeware/bin</code>), and (important)
                   2644:             pass the '--preserve-path' flag.</p>
1.1       grant    2645:           </div>
                   2646: 
1.59    ! rillig   2647:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    2648:             <div class="titlepage">
                   2649:               <div>
                   2650:                 <div>
1.59    ! rillig   2651:                   <h3 class="title"><a name="linux" id=
1.30      wiz      2652:                   "linux"></a>3.2.5.&nbsp;Linux</h3>
1.22      tv       2653:                 </div>
                   2654:               </div>
                   2655:             </div>
                   2656: 
                   2657:             <p>Some versions of Linux (for example Debian
                   2658:             GNU/Linux) need either libtermcap or libcurses
                   2659:             (libncurses). Installing the distributions
                   2660:             libncurses-dev package (or equivalent) should fix the
                   2661:             problem.</p>
                   2662: 
                   2663:             <p>pkgsrc supports both gcc (GNU Compiler Collection)
                   2664:             and icc (Intel C++ Compiler). gcc is the default. icc
                   2665:             8.0 and 8.1 on i386 have been tested.</p>
                   2666: 
                   2667:             <p>To bootstrap using icc, assuming the default icc
                   2668:             installation directory:</p>
                   2669:             <pre class="programlisting">
1.51      rillig   2670:     env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
                   2671:             ac_cv___attribute__=yes ./bootstrap
1.22      tv       2672: </pre>
                   2673: 
                   2674:             <div class="note" style=
                   2675:             "margin-left: 0.5in; margin-right: 0.5in;">
                   2676:               <h3 class="title">Note</h3>
                   2677: 
                   2678:               <p>icc 8.1 needs the `-i-static' argument instead of
                   2679:               -static-libcxa.</p>
                   2680:             </div>
                   2681: 
                   2682:             <p>icc supports __attribute__, but the GNU configure
                   2683:             test uses a nested function, which icc does not
                   2684:             support. #undef'ing __attribute__ has the unfortunate
                   2685:             side-effect of breaking many of the Linux header files,
                   2686:             which cannot be compiled properly without
                   2687:             __attribute__. The test must be overridden so that
                   2688:             __attribute__ is assumed supported by the compiler.</p>
                   2689: 
                   2690:             <p>After bootstrapping, you should set <code class=
1.45      wiz      2691:             "varname">PKGSRC_COMPILER</code> in <code xmlns=
                   2692:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2693:             "filename">/etc/mk.conf</code>:</p>
                   2694:             <pre class="programlisting">
1.51      rillig   2695:     PKGSRC_COMPILER=        icc
1.22      tv       2696: </pre>
                   2697: 
                   2698:             <p>The default installation directory for icc is
1.45      wiz      2699:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2700:             class="filename">/opt/intel_cc_80</code>, which is also
                   2701:             the pkgsrc default. If you have installed it into a
                   2702:             different directory, set <code class=
                   2703:             "varname">ICCBASE</code> in <code xmlns=
                   2704:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2705:             "filename">/etc/mk.conf</code>:</p>
                   2706:             <pre class="programlisting">
1.51      rillig   2707:     ICCBASE=                /opt/icc
1.22      tv       2708: </pre>
                   2709: 
                   2710:             <p>pkgsrc uses the static linking method of the runtime
                   2711:             libraries provided by icc, so binaries can be run on
                   2712:             other systems which do not have the shared libraries
                   2713:             installed.</p>
                   2714: 
                   2715:             <p>Libtool, however, extracts a list of libraries from
1.24      wiz      2716:             the <a href=
                   2717:             "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   2718:             <span class="citerefentry"><span class=
                   2719:             "refentrytitle">ld</span>(1)</span></a> command run
                   2720:             when linking a C++ shared library and records it,
                   2721:             throwing away the -Bstatic and -Bdynamic options
                   2722:             interspersed between the libraries. This means that
                   2723:             libtool-linked C++ shared libraries will have a runtime
                   2724:             dependency on the icc libraries until this is fixed in
                   2725:             libtool.</p>
1.22      tv       2726:           </div>
                   2727: 
1.59    ! rillig   2728:           <div class="sect2" lang="en" xml:lang="en">
1.22      tv       2729:             <div class="titlepage">
                   2730:               <div>
                   2731:                 <div>
1.59    ! rillig   2732:                   <h3 class="title"><a name="openbsd" id=
1.30      wiz      2733:                   "openbsd"></a>3.2.6.&nbsp;OpenBSD</h3>
1.1       grant    2734:                 </div>
                   2735:               </div>
                   2736:             </div>
                   2737: 
                   2738:             <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
                   2739: 
                   2740:             <p>Care should be taken so that the tools that this kit
                   2741:             installs do not conflict with the OpenBSD userland
                   2742:             tools. There are several steps:</p>
                   2743: 
                   2744:             <div class="orderedlist">
                   2745:               <ol type="1">
                   2746:                 <li>
                   2747:                   <p>OpenBSD stores its ports pkg database in
1.45      wiz      2748:                   <code xmlns=
                   2749:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   2750:                   "filename">/var/db/pkg</code>. It is therefore
                   2751:                   recommended that you choose a different location
                   2752:                   (e.g. <code xmlns=
                   2753:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2754:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2755:                   --pkgdbdir option to the bootstrap script.</p>
                   2756:                 </li>
                   2757: 
                   2758:                 <li>
                   2759:                   <p>If you do not intend to use the OpenBSD ports
                   2760:                   tools, it's probably a good idea to move them out
                   2761:                   of the way to avoid confusion, e.g.</p>
                   2762:                   <pre class="screen">
1.14      xtraeme  2763: <code class="prompt">#</code> <strong class=
                   2764: "userinput"><code>cd /usr/sbin</code></strong>
                   2765: <code class="prompt">#</code> <strong class=
                   2766: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2767: <code class="prompt">#</code> <strong class=
                   2768: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2769: <code class="prompt">#</code> <strong class=
                   2770: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2771: <code class="prompt">#</code> <strong class=
                   2772: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2773: </pre>
                   2774:                 </li>
                   2775: 
                   2776:                 <li>
1.45      wiz      2777:                   <p>An example <code xmlns=
                   2778:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2779:                   "filename">/etc/mk.conf</code> file will be
1.45      wiz      2780:                   placed in <code xmlns=
                   2781:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2782:                   "filename">/etc/mk.conf.example</code> file when
                   2783:                   you use the bootstrap script. OpenBSD's make
1.45      wiz      2784:                   program uses <code xmlns=
                   2785:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2786:                   "filename">/etc/mk.conf</code> as well. You can
1.47      reed     2787:                   work around this by enclosing all the
                   2788:                   pkgsrc-specific parts of the file with:</p>
1.1       grant    2789:                   <pre class="programlisting">
1.51      rillig   2790:     .ifdef BSD_PKG_MK
                   2791:     # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
                   2792:     .else
                   2793:     # OpenBSD stuff
                   2794:     .endif
1.1       grant    2795: </pre>
                   2796:                 </li>
                   2797:               </ol>
                   2798:             </div>
                   2799:           </div>
                   2800: 
1.59    ! rillig   2801:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    2802:             <div class="titlepage">
                   2803:               <div>
                   2804:                 <div>
1.59    ! rillig   2805:                   <h3 class="title"><a name="solaris" id=
1.30      wiz      2806:                   "solaris"></a>3.2.7.&nbsp;Solaris</h3>
1.1       grant    2807:                 </div>
                   2808:               </div>
                   2809:             </div>
                   2810: 
                   2811:             <p>Solaris 2.6 through 9 are supported on both x86 and
                   2812:             sparc. You will need a working C compiler. Both gcc
                   2813:             2.95.3 and Sun WorkShop 5 have been tested.</p>
                   2814: 
                   2815:             <p>The following packages are required on Solaris 8 for
                   2816:             the bootstrap process and to build packages.</p>
                   2817: 
                   2818:             <div class="itemizedlist">
                   2819:               <ul type="disc">
                   2820:                 <li>
                   2821:                   <p>SUNWsprot</p>
                   2822:                 </li>
                   2823: 
                   2824:                 <li>
                   2825:                   <p>SUNWarc</p>
                   2826:                 </li>
                   2827: 
                   2828:                 <li>
                   2829:                   <p>SUNWbtool</p>
                   2830:                 </li>
                   2831: 
                   2832:                 <li>
                   2833:                   <p>SUNWtoo</p>
                   2834:                 </li>
                   2835: 
                   2836:                 <li>
                   2837:                   <p>SUNWlibm</p>
                   2838:                 </li>
                   2839:               </ul>
                   2840:             </div>
                   2841: 
                   2842:             <p>Please note the use of GNU binutils on Solaris is
                   2843:             <span class="emphasis"><em>not</em></span>
                   2844:             supported.</p>
                   2845: 
1.59    ! rillig   2846:             <div class="sect3" lang="en" xml:lang="en">
1.1       grant    2847:               <div class="titlepage">
                   2848:                 <div>
                   2849:                   <div>
1.59    ! rillig   2850:                     <h4 class="title"><a name="solaris-gcc-note"
        !          2851:                     id="solaris-gcc-note"></a>3.2.7.1.&nbsp;If you
        !          2852:                     are using gcc</h4>
1.1       grant    2853:                   </div>
                   2854:                 </div>
                   2855:               </div>
                   2856: 
                   2857:               <p>It makes life much simpler if you only use the
                   2858:               same gcc consistently for building all packages.</p>
                   2859: 
                   2860:               <p>It is recommended that an external gcc be used
                   2861:               only for bootstrapping, then either build gcc from
                   2862:               <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2863:               href=
                   2864:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.45      wiz      2865:               target="_top"><code xmlns="" class=
                   2866:               "filename">lang/gcc</code></a> or install a binary
                   2867:               gcc package, then remove gcc used during
1.20      ben      2868:               bootstrapping.</p>
1.1       grant    2869: 
                   2870:               <p>Binary packages of gcc can be found through
                   2871:               <a href=
                   2872:               "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20      ben      2873:               target=
                   2874:               "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1       grant    2875:             </div>
                   2876: 
1.59    ! rillig   2877:             <div class="sect3" lang="en" xml:lang="en">
1.1       grant    2878:               <div class="titlepage">
                   2879:                 <div>
                   2880:                   <div>
1.30      wiz      2881:                     <h4 class="title"><a name=
1.59    ! rillig   2882:                     "solaris-sun-workshop-note" id=
1.30      wiz      2883:                     "solaris-sun-workshop-note"></a>3.2.7.2.&nbsp;If
                   2884:                     you are using Sun WorkShop</h4>
1.1       grant    2885:                   </div>
                   2886:                 </div>
                   2887:               </div>
                   2888: 
                   2889:               <p>You will need at least the following packages
                   2890:               installed (from WorkShop 5.0)</p>
                   2891: 
                   2892:               <div class="itemizedlist">
                   2893:                 <ul type="disc">
                   2894:                   <li>
                   2895:                     <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
                   2896:                   </li>
                   2897: 
                   2898:                   <li>
                   2899:                     <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
                   2900:                   </li>
                   2901: 
                   2902:                   <li>
                   2903:                     <p>SPROild - Sun WorkShop Incremental
                   2904:                     Linker</p>
                   2905:                   </li>
                   2906: 
                   2907:                   <li>
                   2908:                     <p>SPROlang - Sun WorkShop Compilers common
                   2909:                     components</p>
                   2910:                   </li>
                   2911:                 </ul>
                   2912:               </div>
                   2913: 
1.14      xtraeme  2914:               <p>You should set <code class="varname">CC</code>,
                   2915:               <code class="varname">CXX</code> and optionally,
1.45      wiz      2916:               <code class="varname">CPP</code> in <code xmlns=
                   2917:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     2918:               "filename">/etc/mk.conf</code>, e.g.:</p>
1.1       grant    2919:               <pre class="programlisting">
1.51      rillig   2920:     CC=     cc
                   2921:     CXX=    CC
                   2922:     CPP=    /usr/ccs/lib/cpp
1.1       grant    2923: </pre>
                   2924: 
                   2925:               <p>You may also want to build 64-bit binaries,
1.47      reed     2926:               e.g.:</p>
1.1       grant    2927:               <pre class="programlisting">
1.51      rillig   2928:     CFLAGS= -xtarget=ultra -xarch=v9
1.1       grant    2929: </pre>
                   2930: 
                   2931:               <p>Whichever compiler you use, please ensure the
                   2932:               compiler tools and your $prefix are in your
1.14      xtraeme  2933:               <code class="varname">PATH</code>. This includes
1.45      wiz      2934:               <code xmlns=
                   2935:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     2936:               "filename">/usr/ccs/{bin,lib}</code> and e.g.
1.45      wiz      2937:               <code xmlns=
                   2938:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2939:               "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1       grant    2940:             </div>
                   2941:           </div>
                   2942:         </div>
                   2943:       </div>
                   2944: 
1.59    ! rillig   2945:       <div class="chapter" lang="en" xml:lang="en">
1.1       grant    2946:         <div class="titlepage">
                   2947:           <div>
                   2948:             <div>
1.59    ! rillig   2949:               <h2 class="title"><a name="using" id=
1.1       grant    2950:               "using"></a>Chapter&nbsp;4.&nbsp;Using pkgsrc</h2>
                   2951:             </div>
                   2952:           </div>
                   2953:         </div>
                   2954: 
                   2955:         <div class="toc">
                   2956:           <p><b>Table of Contents</b></p>
                   2957: 
                   2958:           <dl>
                   2959:             <dt><span class="sect1"><a href="#getting-started">4.1.
                   2960:             Working with binary packages</a></span></dt>
                   2961: 
                   2962:             <dd>
                   2963:               <dl>
1.30      wiz      2964:                 <dt><span class="sect2"><a href=
                   2965:                 "#where-to-get-binary-packages">4.1.1. Where to get
                   2966:                 binary packages</a></span></dt>
1.1       grant    2967: 
1.30      wiz      2968:                 <dt><span class="sect2"><a href=
                   2969:                 "#how-to-use-binary-packages">4.1.2. How to use
                   2970:                 binary packages</a></span></dt>
1.1       grant    2971: 
1.30      wiz      2972:                 <dt><span class="sect2"><a href=
                   2973:                 "#a-word-of-warning">4.1.3. A word of
                   2974:                 warning</a></span></dt>
1.1       grant    2975:               </dl>
                   2976:             </dd>
                   2977: 
1.30      wiz      2978:             <dt><span class="sect1"><a href=
                   2979:             "#building-packages-from-source">4.2. Building packages
                   2980:             from source</a></span></dt>
1.1       grant    2981: 
                   2982:             <dd>
                   2983:               <dl>
1.30      wiz      2984:                 <dt><span class="sect2"><a href=
                   2985:                 "#requirements">4.2.1. Requirements</a></span></dt>
1.1       grant    2986: 
1.30      wiz      2987:                 <dt><span class="sect2"><a href=
                   2988:                 "#fetching-distfiles">4.2.2. Fetching
                   2989:                 distfiles</a></span></dt>
1.1       grant    2990: 
1.30      wiz      2991:                 <dt><span class="sect2"><a href=
                   2992:                 "#how-to-build-and-install">4.2.3. How to build and
                   2993:                 install</a></span></dt>
1.1       grant    2994: 
1.30      wiz      2995:                 <dt><span class="sect2"><a href=
                   2996:                 "#selecting-the-compiler">4.2.4. Selecting the
                   2997:                 compiler</a></span></dt>
1.1       grant    2998:               </dl>
                   2999:             </dd>
                   3000:           </dl>
                   3001:         </div>
                   3002: 
1.59    ! rillig   3003:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    3004:           <div class="titlepage">
                   3005:             <div>
                   3006:               <div>
                   3007:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   3008:                 "getting-started" id=
1.1       grant    3009:                 "getting-started"></a>4.1.&nbsp;Working with binary
                   3010:                 packages</h2>
                   3011:               </div>
                   3012:             </div>
                   3013:           </div>
                   3014: 
                   3015:           <p>This section describes how to find, retrieve and
                   3016:           install a precompiled binary package that someone else
                   3017:           already prepared for your type of machine.</p>
                   3018: 
1.59    ! rillig   3019:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    3020:             <div class="titlepage">
                   3021:               <div>
                   3022:                 <div>
1.30      wiz      3023:                   <h3 class="title"><a name=
1.59    ! rillig   3024:                   "where-to-get-binary-packages" id=
1.30      wiz      3025:                   "where-to-get-binary-packages"></a>4.1.1.&nbsp;Where
                   3026:                   to get binary packages</h3>
1.1       grant    3027:                 </div>
                   3028:               </div>
                   3029:             </div>
                   3030: 
                   3031:             <p>Precompiled packages are stored on ftp.NetBSD.org
1.45      wiz      3032:             and its mirrors in the directory <code xmlns=
                   3033:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   3034:             "filename">/pub/NetBSD/packages/&lt;OSVERSION&gt;/&lt;ARCH&gt;/</code>
                   3035:             for anonymous FTP access. <code class=
                   3036:             "varname">OSVERSION</code> is the NetBSD version
                   3037:             (<span><strong class="command">uname
                   3038:             -r</strong></span>), <code class="varname">ARCH</code>
                   3039:             is the architecture (<span><strong class=
                   3040:             "command">uname -p</strong></span>). In that directory,
                   3041:             there is a subdirectory for each category plus a
1.45      wiz      3042:             subdirectory <code xmlns=
                   3043:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3044:             "filename">All</code> which includes the actual
                   3045:             binaries in <code xmlns=
                   3046:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   3047:             "filename">.tgz</code> files. The category
                   3048:             subdirectories use symbolic links to those files (this
1.45      wiz      3049:             is the same directory layout as in <code xmlns=
                   3050:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3051:             "filename">/usr/pkgsrc/packages</code>).</p>
1.1       grant    3052: 
1.47      reed     3053:             <p>This same directory layout applies for CD-ROM
1.1       grant    3054:             distributions, only that the directory may be rooted
1.45      wiz      3055:             somewhere else, probably somewhere below <code xmlns=
                   3056:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     3057:             "filename">/cdrom</code>. Please consult your CD-ROMs
1.1       grant    3058:             documentation for the exact location.</p>
                   3059:           </div>
                   3060: 
1.59    ! rillig   3061:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    3062:             <div class="titlepage">
                   3063:               <div>
                   3064:                 <div>
1.30      wiz      3065:                   <h3 class="title"><a name=
1.59    ! rillig   3066:                   "how-to-use-binary-packages" id=
1.30      wiz      3067:                   "how-to-use-binary-packages"></a>4.1.2.&nbsp;How
                   3068:                   to use binary packages</h3>
1.1       grant    3069:                 </div>
                   3070:               </div>
                   3071:             </div>
                   3072: 
1.47      reed     3073:             <p>If you have the files on a CD-ROM or downloaded them
1.23      wiz      3074:             to your hard disk, you can install them with the
1.27      rillig   3075:             following command (be sure to <span><strong class=
1.14      xtraeme  3076:             "command">su</strong></span> to root first):</p>
1.1       grant    3077:             <pre class="screen">
1.14      xtraeme  3078: <code class="prompt">#</code> <strong class=
                   3079: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1       grant    3080: </pre>
                   3081: 
                   3082:             <p>If you have FTP access and you don't want to
                   3083:             download the packages via FTP prior to installation,
1.14      xtraeme  3084:             you can do this automatically by giving
                   3085:             <span><strong class="command">pkg_add</strong></span>
                   3086:             an FTP URL:</p>
1.1       grant    3087:             <pre class="screen">
1.14      xtraeme  3088: <code class="prompt">#</code> <strong class=
1.27      rillig   3089: "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    3090: </pre>
                   3091: 
1.27      rillig   3092:             <p>Note that any prerequisite packages needed to run
                   3093:             the package in question will be installed, too,
1.1       grant    3094:             assuming they are present where you install from.</p>
                   3095: 
1.23      wiz      3096:             <p>To save some typing, you can set the <code class=
                   3097:             "varname">PKG_PATH</code> environment variable to a
1.47      reed     3098:             semicolon-separated list of paths (including remote
1.23      wiz      3099:             URLs); trailing slashes are not allowed.</p>
                   3100: 
1.45      wiz      3101:             <p>Additionally to the <code xmlns=
                   3102:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.23      wiz      3103:             "filename">All</code> directory there exists a
1.45      wiz      3104:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3105:             class="filename">vulnerable</code> directory to which
                   3106:             binary packages with known vulnerabilities are moved,
                   3107:             since removing them could cause missing dependencies.
                   3108:             To use these packages, add the <code xmlns=
                   3109:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3110:             "filename">vulnerable</code> directory to your
                   3111:             <code class="varname">PKG_PATH</code>. However, you
                   3112:             should run <a xmlns=
1.23      wiz      3113:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   3114:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45      wiz      3115:             target="_top"><code xmlns="" class=
                   3116:             "filename">security/audit-packages</code></a>
1.47      reed     3117:             regularly, especially after installing new packages,
                   3118:             and verify that the vulnerabilities are acceptable for
                   3119:             your configuration. An example <code class=
                   3120:             "varname">PKG_PATH</code> would be: <code xmlns=
                   3121:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   3122:             "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      3123:             Please note that semicolon (';') is a shell
                   3124:             meta-character, so you'll probably have to quote
                   3125:             it.</p>
                   3126: 
1.1       grant    3127:             <p>After you've installed packages, be sure to have
1.45      wiz      3128:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3129:             class="filename">/usr/pkg/bin</code> and <code xmlns=
                   3130:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3131:             "filename">/usr/pkg/sbin</code> in your <code class=
                   3132:             "varname">PATH</code> so you can actually start the
                   3133:             just installed program.</p>
1.1       grant    3134:           </div>
                   3135: 
1.59    ! rillig   3136:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    3137:             <div class="titlepage">
                   3138:               <div>
                   3139:                 <div>
1.59    ! rillig   3140:                   <h3 class="title"><a name="a-word-of-warning" id=
1.30      wiz      3141:                   "a-word-of-warning"></a>4.1.3.&nbsp;A word of
1.1       grant    3142:                   warning</h3>
                   3143:                 </div>
                   3144:               </div>
                   3145:             </div>
                   3146: 
                   3147:             <p>Please pay very careful attention to the warnings
                   3148:             expressed in the <a href=
                   3149:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3150:             <span class="citerefentry"><span class=
                   3151:             "refentrytitle">pkg_add</span>(1)</span></a> manual
                   3152:             page about the inherent dangers of installing binary
                   3153:             packages which you did not create yourself, and the
                   3154:             security holes that can be introduced onto your system
                   3155:             by indiscriminate adding of such files.</p>
                   3156:           </div>
                   3157:         </div>
                   3158: 
1.59    ! rillig   3159:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    3160:           <div class="titlepage">
                   3161:             <div>
                   3162:               <div>
                   3163:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   3164:                 "building-packages-from-source" id=
1.30      wiz      3165:                 "building-packages-from-source"></a>4.2.&nbsp;Building
1.1       grant    3166:                 packages from source</h2>
                   3167:               </div>
                   3168:             </div>
                   3169:           </div>
                   3170: 
                   3171:           <p>This assumes that the package is already in pkgsrc. If
                   3172:           it is not, see <a href="#developers-guide" title=
1.46      gdt      3173:           "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">Part&nbsp;II,
1.27      rillig   3174:           &#8220;The pkgsrc developer's guide&#8221;</a> for
                   3175:           instructions how to create your own packages.</p>
1.1       grant    3176: 
1.59    ! rillig   3177:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    3178:             <div class="titlepage">
                   3179:               <div>
                   3180:                 <div>
1.59    ! rillig   3181:                   <h3 class="title"><a name="requirements" id=
1.30      wiz      3182:                   "requirements"></a>4.2.1.&nbsp;Requirements</h3>
1.1       grant    3183:                 </div>
                   3184:               </div>
                   3185:             </div>
                   3186: 
                   3187:             <p>To build packages from source on a NetBSD system the
                   3188:             &#8220;<span class="quote">comp</span>&#8221; and the
                   3189:             &#8220;<span class="quote">text</span>&#8221;
                   3190:             distribution sets must be installed. If you want to
1.47      reed     3191:             build X11-related packages the &#8220;<span class=
1.1       grant    3192:             "quote">xbase</span>&#8221; and &#8220;<span class=
                   3193:             "quote">xcomp</span>&#8221; distribution sets are
                   3194:             required, too.</p>
                   3195:           </div>
                   3196: 
1.59    ! rillig   3197:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    3198:             <div class="titlepage">
                   3199:               <div>
                   3200:                 <div>
1.59    ! rillig   3201:                   <h3 class="title"><a name="fetching-distfiles"
        !          3202:                   id="fetching-distfiles"></a>4.2.2.&nbsp;Fetching
1.1       grant    3203:                   distfiles</h3>
                   3204:                 </div>
                   3205:               </div>
                   3206:             </div>
                   3207: 
1.27      rillig   3208:             <p>The first step for building a package is downloading
                   3209:             the distfiles (i.e. the unmodified source). If they
                   3210:             have not yet been downloaded, pkgsrc will fetch them
1.1       grant    3211:             automatically.</p>
                   3212: 
                   3213:             <p>You can overwrite some of the major distribution
                   3214:             sites to fit to sites that are close to your own. Have
1.45      wiz      3215:             a look at <code xmlns=
                   3216:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3217:             "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27      rillig   3218:             some examples &#8212; in particular, look for the
1.14      xtraeme  3219:             <code class="varname">MASTER_SORT</code>, <code class=
                   3220:             "varname">MASTER_SORT_REGEX</code> and <code class=
                   3221:             "varname">INET_COUNTRY</code> definitions. This may
                   3222:             save some of your bandwidth and time.</p>
1.1       grant    3223: 
                   3224:             <p>You can change these settings either in your shell's
                   3225:             environment, or, if you want to keep the settings, by
1.45      wiz      3226:             editing the <code xmlns=
                   3227:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3228:             "filename">/etc/mk.conf</code> file, and adding the
                   3229:             definitions there.</p>
1.1       grant    3230: 
                   3231:             <p>If you don't have a permanent Internet connection
                   3232:             and you want to know which files to download,
1.14      xtraeme  3233:             <span><strong class="command">make
                   3234:             fetch-list</strong></span> will tell you what you'll
1.45      wiz      3235:             need. Put these distfiles into <code xmlns=
                   3236:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3237:             "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    3238:           </div>
                   3239: 
1.59    ! rillig   3240:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    3241:             <div class="titlepage">
                   3242:               <div>
                   3243:                 <div>
1.30      wiz      3244:                   <h3 class="title"><a name=
1.59    ! rillig   3245:                   "how-to-build-and-install" id=
1.30      wiz      3246:                   "how-to-build-and-install"></a>4.2.3.&nbsp;How to
                   3247:                   build and install</h3>
1.1       grant    3248:                 </div>
                   3249:               </div>
                   3250:             </div>
                   3251: 
                   3252:             <p>Assuming that the distfile has been fetched (see
                   3253:             previous section), become root and change into the
1.47      reed     3254:             relevant directory and run <span><strong class=
                   3255:             "command">make</strong></span>.</p>
                   3256: 
                   3257:             <div class="note" style=
                   3258:             "margin-left: 0.5in; margin-right: 0.5in;">
                   3259:               <h3 class="title">Note</h3>
                   3260: 
                   3261:               <p>If using bootstrap or pkgsrc on a non-NetBSD
                   3262:               system, use the pkgsrc <span><strong class=
                   3263:               "command">bmake</strong></span> command instead of
                   3264:               &#8220;<span class="quote">make</span>&#8221; in the
                   3265:               examples in this guide.</p>
                   3266:             </div>
                   3267: 
                   3268:             <p>For example, type</p>
1.1       grant    3269:             <pre class="screen">
1.14      xtraeme  3270: <code class="prompt">%</code> <strong class=
                   3271: "userinput"><code>cd misc/figlet</code></strong>
                   3272: <code class="prompt">%</code> <strong class=
                   3273: "userinput"><code>make</code></strong>
1.1       grant    3274: </pre>
                   3275: 
                   3276:             <p>at the shell prompt to build the various components
                   3277:             of the package, and</p>
                   3278:             <pre class="screen">
1.14      xtraeme  3279: <code class="prompt">#</code> <strong class=
                   3280: "userinput"><code>make install</code></strong>
1.1       grant    3281: </pre>
                   3282: 
                   3283:             <p>to install the various components into the correct
                   3284:             places on your system. Installing the package on your
                   3285:             system requires you to be root. However, pkgsrc has a
                   3286:             <span class="emphasis"><em>just-in-time-su</em></span>
                   3287:             feature, which allows you to only become root for the
                   3288:             actual installation step</p>
                   3289: 
                   3290:             <p>Taking the figlet utility as an example, we can
                   3291:             install it on our system by building as shown in
                   3292:             <a href="#logs" title=
1.59    ! rillig   3293:             "Appendix&nbsp;B.&nbsp;Build logs">Appendix B, <i>Build
        !          3294:             logs</i></a>.</p>
1.1       grant    3295: 
                   3296:             <p>The program is installed under the default root of
1.45      wiz      3297:             the packages tree - <code xmlns=
                   3298:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3299:             "filename">/usr/pkg</code>. Should this not conform to
                   3300:             your tastes, set the <code class=
                   3301:             "varname">LOCALBASE</code> variable in your
1.1       grant    3302:             environment, and it will use that value as the root of
1.45      wiz      3303:             your packages tree. So, to use <code xmlns=
                   3304:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3305:             "filename">/usr/local</code>, set <code class=
                   3306:             "varname">LOCALBASE=/usr/local</code> in your
1.1       grant    3307:             environment. Please note that you should use a
                   3308:             directory which is dedicated to packages and not shared
1.47      reed     3309:             with other programs (i.e., do not try and use
1.14      xtraeme  3310:             <code class="varname">LOCALBASE=/usr</code>). Also, you
                   3311:             should not try to add any of your own files or
1.45      wiz      3312:             directories (such as <code xmlns=
                   3313:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3314:             "filename">src/</code>, <code xmlns=
                   3315:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3316:             "filename">obj/</code>, or <code xmlns=
                   3317:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3318:             "filename">pkgsrc/</code>) below the <code class=
                   3319:             "varname">LOCALBASE</code> tree. This is to prevent
1.1       grant    3320:             possible conflicts between programs and other files
                   3321:             installed by the package system and whatever else may
                   3322:             have been installed there.</p>
                   3323: 
1.45      wiz      3324:             <p>Some packages look in <code xmlns=
                   3325:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3326:             "filename">/etc/mk.conf</code> to alter some
1.1       grant    3327:             configuration options at build time. Have a look at
1.45      wiz      3328:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3329:             class="filename">pkgsrc/mk/defaults/mk.conf</code> to
                   3330:             get an overview of what will be set there by default.
1.14      xtraeme  3331:             Environment variables such as <code class=
1.45      wiz      3332:             "varname">LOCALBASE</code> can be set in <code xmlns=
                   3333:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3334:             "filename">/etc/mk.conf</code> to save having to
                   3335:             remember to set them each time you want to use
                   3336:             pkgsrc.</p>
1.1       grant    3337: 
                   3338:             <p>Occasionally, people want to &#8220;<span class=
                   3339:             "quote">look under the covers</span>&#8221; to see what
                   3340:             is going on when a package is building or being
                   3341:             installed. This may be for debugging purposes, or out
                   3342:             of simple curiosity. A number of utility values have
                   3343:             been added to help with this.</p>
                   3344: 
                   3345:             <div class="orderedlist">
                   3346:               <ol type="1">
                   3347:                 <li>
                   3348:                   <p>If you invoke the <a href=
                   3349:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   3350:                   <span class="citerefentry"><span class=
                   3351:                   "refentrytitle">make</span>(1)</span></a> command
1.14      xtraeme  3352:                   with <code class=
                   3353:                   "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
                   3354:                   amount of information will be displayed. For
                   3355:                   example,</p>
1.1       grant    3356:                   <pre class="screen">
1.14      xtraeme  3357: <strong class=
                   3358: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1       grant    3359: </pre>
                   3360: 
                   3361:                   <p>will show all the commands that are invoked,
                   3362:                   up to and including the &#8220;<span class=
                   3363:                   "quote">patch</span>&#8221; stage.</p>
                   3364:                 </li>
                   3365: 
                   3366:                 <li>
                   3367:                   <p>If you want to know the value of a certain
1.22      tv       3368:                   <a href=
                   3369:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   3370:                   <span class="citerefentry"><span class=
                   3371:                   "refentrytitle">make</span>(1)</span></a>
                   3372:                   definition, then the <code class=
1.14      xtraeme  3373:                   "varname">VARNAME</code> definition should be
                   3374:                   used, in conjunction with the show-var target.
                   3375:                   e.g. to show the expansion of the <a href=
1.1       grant    3376:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   3377:                   <span class="citerefentry"><span class=
                   3378:                   "refentrytitle">make</span>(1)</span></a>
1.14      xtraeme  3379:                   variable <code class=
1.22      tv       3380:                   "varname">LOCALBASE</code>:</p>
1.1       grant    3381:                   <pre class="screen">
1.14      xtraeme  3382: <code class="prompt">%</code> <strong class=
                   3383: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1       grant    3384: /usr/pkg
1.14      xtraeme  3385: <code class="prompt">%</code>
1.1       grant    3386:           
                   3387: </pre>
                   3388:                 </li>
                   3389:               </ol>
                   3390:             </div>
                   3391: 
                   3392:             <p>If you want to install a binary package that you've
                   3393:             either created yourself (see next section), that you
                   3394:             put into pkgsrc/packages manually or that is located on
1.8       wiz      3395:             a remote FTP server, you can use the "bin-install"
1.1       grant    3396:             target. This target will install a binary package - if
                   3397:             available - via <a href=
                   3398:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3399:             <span class="citerefentry"><span class=
                   3400:             "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14      xtraeme  3401:             <span><strong class="command">make
                   3402:             package</strong></span>. The list of remote FTP sites
                   3403:             searched is kept in the variable <code class=
                   3404:             "varname">BINPKG_SITES</code>, which defaults to
                   3405:             ftp.NetBSD.org. Any flags that should be added to
                   3406:             <a href=
1.1       grant    3407:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3408:             <span class="citerefentry"><span class=
                   3409:             "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14      xtraeme  3410:             into <code class="varname">BIN_INSTALL_FLAGS</code>.
1.45      wiz      3411:             See <code xmlns=
                   3412:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3413:             "filename">pkgsrc/mk/defaults/mk.conf</code> for more
                   3414:             details.</p>
1.1       grant    3415: 
1.47      reed     3416:             <p>A final word of warning: If you set up a system that
1.14      xtraeme  3417:             has a non-standard setting for <code class=
                   3418:             "varname">LOCALBASE</code>, be sure to set that before
1.1       grant    3419:             any packages are installed, as you can not use several
                   3420:             directories for the same purpose. Doing so will result
                   3421:             in pkgsrc not being able to properly detect your
                   3422:             installed packages, and fail miserably. Note also that
                   3423:             precompiled binary packages are usually built with the
1.14      xtraeme  3424:             default <code class="varname">LOCALBASE</code> of
1.45      wiz      3425:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3426:             class="filename">/usr/pkg</code>, and that you should
                   3427:             <span class="emphasis"><em>not</em></span> install any
                   3428:             if you use a non-standard <code class=
1.14      xtraeme  3429:             "varname">LOCALBASE</code>.</p>
1.1       grant    3430:           </div>
                   3431: 
1.59    ! rillig   3432:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    3433:             <div class="titlepage">
                   3434:               <div>
                   3435:                 <div>
1.30      wiz      3436:                   <h3 class="title"><a name=
1.59    ! rillig   3437:                   "selecting-the-compiler" id=
1.30      wiz      3438:                   "selecting-the-compiler"></a>4.2.4.&nbsp;Selecting
                   3439:                   the compiler</h3>
1.1       grant    3440:                 </div>
                   3441:               </div>
                   3442:             </div>
                   3443: 
                   3444:             <p>By default, pkgsrc will use GCC to build packages.
                   3445:             This may be overridden by setting the following
                   3446:             variables in /etc/mk.conf:</p>
                   3447: 
                   3448:             <div class="variablelist">
                   3449:               <dl>
1.14      xtraeme  3450:                 <dt><span class="term"><code class=
                   3451:                 "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1       grant    3452: 
                   3453:                 <dd>
                   3454:                   <p>This is a list of values specifying the chain
                   3455:                   of compilers to invoke when building packages.
                   3456:                   Valid values are:</p>
                   3457: 
                   3458:                   <div class="itemizedlist">
                   3459:                     <ul type="disc">
                   3460:                       <li>
1.14      xtraeme  3461:                         <p><code class="varname">distcc</code>:
1.1       grant    3462:                         distributed C/C++ (chainable)</p>
                   3463:                       </li>
                   3464: 
                   3465:                       <li>
1.14      xtraeme  3466:                         <p><code class="varname">ccache</code>:
1.1       grant    3467:                         compiler cache (chainable)</p>
                   3468:                       </li>
                   3469: 
                   3470:                       <li>
1.14      xtraeme  3471:                         <p><code class="varname">gcc</code>: GNU
                   3472:                         C/C++ Compiler</p>
1.1       grant    3473:                       </li>
                   3474: 
                   3475:                       <li>
1.14      xtraeme  3476:                         <p><code class="varname">mipspro</code>:
1.1       grant    3477:                         Silicon Graphics, Inc. MIPSpro
                   3478:                         (n32/n64)</p>
                   3479:                       </li>
                   3480: 
                   3481:                       <li>
1.14      xtraeme  3482:                         <p><code class="varname">mipspro</code>:
1.1       grant    3483:                         Silicon Graphics, Inc. MIPSpro (o32)</p>
                   3484:                       </li>
                   3485: 
                   3486:                       <li>
1.14      xtraeme  3487:                         <p><code class="varname">sunpro</code>:
1.1       grant    3488:                         Microsystems, Inc. WorkShip/Forte/Sun ONE
                   3489:                         Studio</p>
                   3490:                       </li>
                   3491:                     </ul>
                   3492:                   </div>
                   3493: 
                   3494:                   <p>The default is &#8220;<span class=
1.14      xtraeme  3495:                   "quote"><code class=
                   3496:                   "varname">gcc</code></span>&#8221;. You can use
                   3497:                   <code class="varname">ccache</code> and/or
                   3498:                   <code class="varname">distcc</code> with an
                   3499:                   appropriate <code class=
                   3500:                   "varname">PKGSRC_COMPILER</code> setting, e.g.
                   3501:                   &#8220;<span class="quote"><code class=
                   3502:                   "varname">ccache gcc</code></span>&#8221;. This
1.1       grant    3503:                   variable should always be terminated with a value
                   3504:                   for a real compiler.</p>
                   3505:                 </dd>
                   3506: 
1.14      xtraeme  3507:                 <dt><span class="term"><code class=
                   3508:                 "varname">GCC_REQD</code>:</span></dt>
1.1       grant    3509: 
                   3510:                 <dd>
                   3511:                   <p>This specifies the minimum version of GCC to
                   3512:                   use when building packages. If the system GCC
                   3513:                   doesn't satisfy this requirement, then pkgsrc
                   3514:                   will build and install one of the GCC packages to
                   3515:                   use instead.</p>
                   3516:                 </dd>
                   3517:               </dl>
                   3518:             </div>
                   3519:           </div>
                   3520:         </div>
                   3521:       </div>
                   3522: 
1.59    ! rillig   3523:       <div class="chapter" lang="en" xml:lang="en">
1.1       grant    3524:         <div class="titlepage">
                   3525:           <div>
                   3526:             <div>
1.59    ! rillig   3527:               <h2 class="title"><a name="configuring" id=
1.38      dillo    3528:               "configuring"></a>Chapter&nbsp;5.&nbsp;Configuring
                   3529:               pkgsrc</h2>
                   3530:             </div>
                   3531:           </div>
                   3532:         </div>
                   3533: 
                   3534:         <div class="toc">
                   3535:           <p><b>Table of Contents</b></p>
                   3536: 
                   3537:           <dl>
                   3538:             <dt><span class="sect1"><a href=
1.45      wiz      3539:             "#general-configuration">5.1. General
                   3540:             configuration</a></span></dt>
                   3541: 
                   3542:             <dt><span class="sect1"><a href=
                   3543:             "#variables-affecting-build">5.2. Variables affecting
                   3544:             the build process</a></span></dt>
                   3545: 
                   3546:             <dt><span class="sect1"><a href=
                   3547:             "#developer-advanced-settings">5.3. Developer/advanced
                   3548:             settings</a></span></dt>
                   3549: 
                   3550:             <dt><span class="sect1"><a href=
                   3551:             "#selecting-build-options">5.4. Selecting Build
1.42      dillo    3552:             Options</a></span></dt>
1.38      dillo    3553:           </dl>
                   3554:         </div>
                   3555: 
1.59    ! rillig   3556:         <div class="sect1" lang="en" xml:lang="en">
1.38      dillo    3557:           <div class="titlepage">
                   3558:             <div>
                   3559:               <div>
                   3560:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   3561:                 "general-configuration" id=
1.45      wiz      3562:                 "general-configuration"></a>5.1.&nbsp;General
                   3563:                 configuration</h2>
                   3564:               </div>
                   3565:             </div>
                   3566:           </div>
                   3567: 
1.47      reed     3568:           <p>In this section, you can find some variables that
                   3569:           apply to all pkgsrc packages. The preferred method of
                   3570:           setting these variables is by setting them in
                   3571:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3572:           class="filename">/etc/mk.conf</code>.</p>
1.45      wiz      3573: 
                   3574:           <div class="itemizedlist">
                   3575:             <ul type="disc">
                   3576:               <li>
                   3577:                 <p><code class="varname">LOCALBASE</code>: Where
                   3578:                 packages will be installed. The default is
                   3579:                 <code xmlns=
                   3580:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3581:                 "filename">/usr/pkg</code>. Do not mix binary
                   3582:                 packages with different <code class=
                   3583:                 "varname">LOCALBASE</code>s!</p>
                   3584:               </li>
                   3585: 
                   3586:               <li>
                   3587:                 <p><code class="varname">CROSSBASE</code>: Where
                   3588:                 &#8220;<span class="quote">cross</span>&#8221;
                   3589:                 category packages will be installed. The default is
                   3590:                 <code xmlns=
                   3591:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3592:                 "filename">${LOCALBASE}/cross</code>.</p>
                   3593:               </li>
                   3594: 
                   3595:               <li>
                   3596:                 <p><code class="varname">X11BASE</code>: Where X11
                   3597:                 is installed on the system. The default is
                   3598:                 <code xmlns=
                   3599:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3600:                 "filename">/usr/X11R6</code>.</p>
                   3601:               </li>
                   3602: 
                   3603:               <li>
                   3604:                 <p><code class="varname">DISTDIR</code>: Where to
                   3605:                 store the downloaded copies of the original source
                   3606:                 distributions used for building pkgsrc packages.
                   3607:                 The default is <code xmlns=
                   3608:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3609:                 "filename">${PKGSRCDIR}/distfiles</code>.</p>
                   3610:               </li>
                   3611: 
                   3612:               <li>
                   3613:                 <p><code class=
                   3614:                 "varname">MASTER_SITE_OVERRIDE</code>: If set,
                   3615:                 override the packages' <code class=
                   3616:                 "varname">MASTER_SITES</code> with this value.</p>
                   3617:               </li>
                   3618: 
                   3619:               <li>
                   3620:                 <p><code class="varname">MASTER_SITE_BACKUP</code>:
                   3621:                 Backup location(s) for distribution files and patch
                   3622:                 files if not found locally or in <code xmlns=
                   3623:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3624:                 "filename">${MASTER_SITES}</code> or <code xmlns=
                   3625:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3626:                 "filename">${PATCH_SITES}</code> respectively. The
                   3627:                 defaults are <code xmlns=
                   3628:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3629:                 "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/${DIST_SUBDIR}/</code>
                   3630:                 and <code xmlns=
                   3631:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3632:                 "filename">ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/</code>.</p>
                   3633:               </li>
                   3634: 
                   3635:               <li>
                   3636:                 <p><code class="varname">BINPKG_SITES</code>: List
                   3637:                 of sites carrying binary pkgs.</p>
                   3638:               </li>
                   3639:             </ul>
                   3640:           </div>
                   3641:         </div>
                   3642: 
1.59    ! rillig   3643:         <div class="sect1" lang="en" xml:lang="en">
1.45      wiz      3644:           <div class="titlepage">
                   3645:             <div>
                   3646:               <div>
                   3647:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   3648:                 "variables-affecting-build" id=
1.45      wiz      3649:                 "variables-affecting-build"></a>5.2.&nbsp;Variables
                   3650:                 affecting the build process</h2>
                   3651:               </div>
                   3652:             </div>
                   3653:           </div>
                   3654: 
                   3655:           <p>XXX</p>
                   3656: 
                   3657:           <div class="itemizedlist">
                   3658:             <ul type="disc">
                   3659:               <li>
                   3660:                 <p><code class="varname">PACKAGES</code>: The top
                   3661:                 level directory for the binary packages. The
                   3662:                 default is <code xmlns=
                   3663:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3664:                 "filename">${PKGSRCDIR}/packages</code>.</p>
                   3665:               </li>
                   3666: 
                   3667:               <li>
                   3668:                 <p><code class="varname">WRKOBJDIR</code>: The top
                   3669:                 level directory where, if defined, the separate
                   3670:                 working directories will get created, and
                   3671:                 symbolically linked to from <code xmlns=
                   3672:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3673:                 "filename">${WRKDIR}</code> (see below). This is
                   3674:                 useful for building packages on several
                   3675:                 architectures, then <code xmlns=
                   3676:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3677:                 "filename">${PKGSRCDIR}</code> can be NFS-mounted
                   3678:                 while <code xmlns=
                   3679:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3680:                 "filename">${WRKOBJDIR}</code> is local to every
                   3681:                 architecture. (It should be noted that <code class=
                   3682:                 "varname">PKGSRCDIR</code> should not be set by the
                   3683:                 user &#8212; it is an internal definition which
                   3684:                 refers to the root of the pkgsrc tree. It is
                   3685:                 possible to have many pkgsrc tree instances.)</p>
                   3686:               </li>
                   3687: 
                   3688:               <li>
                   3689:                 <p><code class="varname">LOCALPATCHES</code>:
                   3690:                 Directory for local patches that aren't part of
                   3691:                 pkgsrc. See <a href="#components.patches" title=
                   3692:                 "8.3.&nbsp;patches/*">Section&nbsp;8.3,
                   3693:                 &#8220;patches/*&#8221;</a> for more information.
                   3694:                 <em class="replaceable"><code>rel</code></em> and
                   3695:                 <em class="replaceable"><code>arch</code></em> are
                   3696:                 replaced with OS release (&#8220;<span class=
                   3697:                 "quote">2.0</span>&#8221;, etc.) and architecture
                   3698:                 (&#8220;<span class="quote">mipsel</span>&#8221;,
                   3699:                 etc.).</p>
                   3700:               </li>
                   3701: 
                   3702:               <li>
                   3703:                 <p><code class="varname">PKGMAKECONF</code>:
                   3704:                 Location of the <code xmlns=
                   3705:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3706:                 "filename">mk.conf</code> file used by a package's
                   3707:                 BSD-style Makefile. If this is not set,
                   3708:                 <code class="varname">MAKECONF</code> is set to
                   3709:                 <code xmlns=
                   3710:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3711:                 "filename">/dev/null</code> to avoid picking up
                   3712:                 settings used by builds in <code xmlns=
                   3713:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3714:                 "filename">/usr/src</code>.</p>
                   3715:               </li>
                   3716:             </ul>
                   3717:           </div>
                   3718:         </div>
                   3719: 
1.59    ! rillig   3720:         <div class="sect1" lang="en" xml:lang="en">
1.45      wiz      3721:           <div class="titlepage">
                   3722:             <div>
                   3723:               <div>
                   3724:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   3725:                 "developer-advanced-settings" id=
1.45      wiz      3726:                 "developer-advanced-settings"></a>5.3.&nbsp;Developer/advanced
                   3727:                 settings</h2>
                   3728:               </div>
                   3729:             </div>
                   3730:           </div>
                   3731: 
                   3732:           <p>XXX</p>
                   3733: 
                   3734:           <div class="itemizedlist">
                   3735:             <ul type="disc">
                   3736:               <li>
                   3737:                 <p><code class="varname">PKG_DEVELOPER</code>: Run
                   3738:                 some sanity checks that package developers
                   3739:                 want:</p>
                   3740: 
                   3741:                 <div class="itemizedlist">
                   3742:                   <ul type="circle">
                   3743:                     <li>
                   3744:                       <p>make sure patches apply with zero fuzz</p>
                   3745:                     </li>
                   3746: 
                   3747:                     <li>
                   3748:                       <p>run check-shlibs to see that all binaries
                   3749:                       will find their shared libs.</p>
                   3750:                     </li>
                   3751:                   </ul>
                   3752:                 </div>
                   3753:               </li>
                   3754: 
                   3755:               <li>
                   3756:                 <p><code class="varname">PKG_DEBUG_LEVEL</code>:
                   3757:                 The level of debugging output which is displayed
                   3758:                 whilst making and installing the package. The
                   3759:                 default value for this is 0, which will not display
                   3760:                 the commands as they are executed (normal, default,
                   3761:                 quiet operation); the value 1 will display all
                   3762:                 shell commands before their invocation, and the
                   3763:                 value 2 will display both the shell commands before
                   3764:                 their invocation, and their actual execution
                   3765:                 progress with <span><strong class="command">set
                   3766:                 -x</strong></span> will be displayed.</p>
                   3767:               </li>
1.58      erh      3768: 
                   3769:               <li>
                   3770:                 <p><code class=
                   3771:                 "varname">ALLOW_VULNERABILITIES.<em class=
                   3772:                 "replaceable"><code>pkgbase</code></em></code>: A
                   3773:                 space separated list of vulnerability IDs that may
                   3774:                 be ignored when performing the automated security
                   3775:                 checks. These IDs are listed in the
                   3776:                 pkg-vulnerabilities file and are displayed by
                   3777:                 <span><strong class=
                   3778:                 "command">audit-packages</strong></span> when it
                   3779:                 finds a vulnerable package.</p>
                   3780:               </li>
                   3781: 
                   3782:               <li>
                   3783:                 <p><code class=
                   3784:                 "varname">SKIP_AUDIT_PACKAGES</code>: If this is
                   3785:                 set to &#8220;<span class=
                   3786:                 "quote">yes</span>&#8221;, the automated security
                   3787:                 checks (which use the <a xmlns=
                   3788:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3789:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
                   3790:                 target="_top"><code xmlns="" class=
                   3791:                 "filename">security/audit-packages</code></a>
                   3792:                 package) will be <span class=
                   3793:                 "strong"><strong>entirely</strong></span> skipped
                   3794:                 for <span class=
                   3795:                 "strong"><strong>all</strong></span> packages
                   3796:                 built. Normally you'll want to use
                   3797:                 ALLOW_VULNERABILITIES instead of this.</p>
                   3798:               </li>
1.45      wiz      3799:             </ul>
                   3800:           </div>
                   3801:         </div>
                   3802: 
1.59    ! rillig   3803:         <div class="sect1" lang="en" xml:lang="en">
1.45      wiz      3804:           <div class="titlepage">
                   3805:             <div>
                   3806:               <div>
                   3807:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   3808:                 "selecting-build-options" id=
1.45      wiz      3809:                 "selecting-build-options"></a>5.4.&nbsp;Selecting
                   3810:                 Build Options</h2>
1.38      dillo    3811:               </div>
                   3812:             </div>
                   3813:           </div>
                   3814: 
                   3815:           <p>Some packages have build time options, usually to
                   3816:           select between different dependencies, enable optional
                   3817:           support for big dependencies or enable experimental
                   3818:           features.</p>
                   3819: 
                   3820:           <p>To see which options, if any, a package supports, and
                   3821:           which options are mutually exclusive, run
                   3822:           <span><strong class="command">make
                   3823:           show-options</strong></span>, for example:</p>
                   3824:           <pre class="programlisting">
1.51      rillig   3825:     The following options are supported by this package:
                   3826:     ssl      Enable SSL support.
                   3827:     Exactly one of the following gecko options is required:
                   3828:     firefox  Use firefox as gecko rendering engine.
                   3829:     mozilla  Use mozilla as gecko rendering engine.
                   3830:     At most one of the following database options may be selected:
                   3831:     mysql    Enable support for MySQL database.
                   3832:     pgsql    Enable support for PostgreSQL database.
                   3833: 
                   3834:     These options are enabled by default: firefox
                   3835:     These options are currently enabled: mozilla ssl
1.38      dillo    3836: </pre>
                   3837: 
1.45      wiz      3838:           <p>The following variables can be defined in <code xmlns=
                   3839:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.38      dillo    3840:           "filename">/etc/mk.conf</code> to select which options to
                   3841:           enable for a package: <code class=
                   3842:           "varname">PKG_DEFAULT_OPTIONS</code>, which can be used
                   3843:           to select or disable options for all packages that
                   3844:           support them, and <code class=
                   3845:           "varname">PKG_OPTIONS.<em class=
                   3846:           "replaceable"><code>pkgbase</code></em></code>, which can
                   3847:           be used to select or disable options specifically for
                   3848:           package <em class=
                   3849:           "replaceable"><code>pkgbase</code></em>. Options listed
                   3850:           in these variables are selected, options preceded by
                   3851:           &#8220;<span class="quote">-</span>&#8221; are
                   3852:           disabled.</p>
                   3853: 
1.39      dillo    3854:           <p>The following settings are consulted in the order
                   3855:           given, and the last setting that selects or disables an
                   3856:           option is used:</p>
1.38      dillo    3857: 
                   3858:           <div class="orderedlist">
                   3859:             <ol type="1">
                   3860:               <li>
                   3861:                 <p>the default options as suggested by the package
                   3862:                 maintainer</p>
                   3863:               </li>
                   3864: 
                   3865:               <li>
                   3866:                 <p>the options implied by the settings of legacy
                   3867:                 variables (see below)</p>
                   3868:               </li>
                   3869: 
                   3870:               <li>
                   3871:                 <p><code class=
                   3872:                 "varname">PKG_DEFAULT_OPTIONS</code></p>
                   3873:               </li>
                   3874: 
                   3875:               <li>
                   3876:                 <p><code class="varname">PKG_OPTIONS.<em class=
                   3877:                 "replaceable"><code>pkgbase</code></em></code></p>
                   3878:               </li>
                   3879:             </ol>
                   3880:           </div>
                   3881: 
                   3882:           <p>For groups of mutually exclusive options, the last
                   3883:           option selected is used, all others are automatically
                   3884:           disabled. If an option of the group is explicitly
                   3885:           disabled, the previously selected option, if any, is
                   3886:           used. It is an error if no option from a required group
                   3887:           of options is selected, and building the package will
                   3888:           fail.</p>
                   3889: 
                   3890:           <p>Before the options framework was introduced, build
                   3891:           options were selected by setting a variable in
1.45      wiz      3892:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3893:           class="filename">/etc/mk.conf</code> for each option. To
                   3894:           ease transition to the options framework for the user,
                   3895:           these legacy variables are converted to the appropriate
                   3896:           options setting automatically. A warning is issued to
                   3897:           prompt the user to update <code xmlns=
                   3898:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.38      dillo    3899:           "filename">/etc/mk.conf</code> to use the options
                   3900:           framework directly. Support for these legacy variables
                   3901:           will be removed eventually.</p>
                   3902:         </div>
                   3903:       </div>
                   3904: 
1.59    ! rillig   3905:       <div class="chapter" lang="en" xml:lang="en">
1.38      dillo    3906:         <div class="titlepage">
                   3907:           <div>
                   3908:             <div>
1.59    ! rillig   3909:               <h2 class="title"><a name="binary" id=
1.38      dillo    3910:               "binary"></a>Chapter&nbsp;6.&nbsp;Creating binary
1.1       grant    3911:               packages</h2>
                   3912:             </div>
                   3913:           </div>
                   3914:         </div>
                   3915: 
                   3916:         <div class="toc">
                   3917:           <p><b>Table of Contents</b></p>
                   3918: 
                   3919:           <dl>
1.30      wiz      3920:             <dt><span class="sect1"><a href=
1.38      dillo    3921:             "#building-a-single-binary-package">6.1. Building a
1.30      wiz      3922:             single binary package</a></span></dt>
1.1       grant    3923: 
1.30      wiz      3924:             <dt><span class="sect1"><a href=
1.38      dillo    3925:             "#settings-for-creationg-of-binary-packages">6.2.
1.1       grant    3926:             Settings for creation of binary
                   3927:             packages</a></span></dt>
                   3928: 
1.38      dillo    3929:             <dt><span class="sect1"><a href="#bulkbuild">6.3. Doing
1.1       grant    3930:             a bulk build of all packages</a></span></dt>
                   3931: 
                   3932:             <dd>
                   3933:               <dl>
                   3934:                 <dt><span class="sect2"><a href=
1.38      dillo    3935:                 "#binary.configuration">6.3.1.
1.1       grant    3936:                 Configuration</a></span></dt>
                   3937: 
1.30      wiz      3938:                 <dt><span class="sect2"><a href=
1.38      dillo    3939:                 "#other-environmental-considerations">6.3.2. Other
1.30      wiz      3940:                 environmental considerations</a></span></dt>
1.1       grant    3941: 
1.38      dillo    3942:                 <dt><span class="sect2"><a href="#operation">6.3.3.
1.1       grant    3943:                 Operation</a></span></dt>
                   3944: 
1.30      wiz      3945:                 <dt><span class="sect2"><a href=
1.38      dillo    3946:                 "#what-it-does">6.3.4. What it does</a></span></dt>
1.1       grant    3947: 
1.30      wiz      3948:                 <dt><span class="sect2"><a href=
1.38      dillo    3949:                 "#disk-space-requirements">6.3.5. Disk space
1.30      wiz      3950:                 requirements</a></span></dt>
1.1       grant    3951: 
1.30      wiz      3952:                 <dt><span class="sect2"><a href=
1.38      dillo    3953:                 "#setting-up-a-sandbox">6.3.6. Setting up a sandbox
1.47      reed     3954:                 for chrooted builds</a></span></dt>
1.1       grant    3955: 
1.30      wiz      3956:                 <dt><span class="sect2"><a href=
1.38      dillo    3957:                 "#building-a-partial-set">6.3.7. Building a partial
1.30      wiz      3958:                 set of packages</a></span></dt>
1.13      hubertf  3959: 
                   3960:                 <dt><span class="sect2"><a href=
1.38      dillo    3961:                 "#bulk-upload">6.3.8. Uploading results of a bulk
1.13      hubertf  3962:                 build</a></span></dt>
1.1       grant    3963:               </dl>
                   3964:             </dd>
                   3965: 
1.38      dillo    3966:             <dt><span class="sect1"><a href="#creating-cdroms">6.4.
1.1       grant    3967:             Creating a multiple CD-ROM packages
                   3968:             collection</a></span></dt>
                   3969: 
                   3970:             <dd>
                   3971:               <dl>
1.30      wiz      3972:                 <dt><span class="sect2"><a href=
1.38      dillo    3973:                 "#cdpack-example">6.4.1. Example of
1.30      wiz      3974:                 cdpack</a></span></dt>
1.1       grant    3975:               </dl>
                   3976:             </dd>
                   3977:           </dl>
                   3978:         </div>
                   3979: 
1.59    ! rillig   3980:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    3981:           <div class="titlepage">
                   3982:             <div>
                   3983:               <div>
                   3984:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   3985:                 "building-a-single-binary-package" id=
1.38      dillo    3986:                 "building-a-single-binary-package"></a>6.1.&nbsp;Building
1.30      wiz      3987:                 a single binary package</h2>
1.1       grant    3988:               </div>
                   3989:             </div>
                   3990:           </div>
                   3991: 
                   3992:           <p>Once you have built and installed a package, you can
                   3993:           create a <span class="emphasis"><em>binary
                   3994:           package</em></span> which can be installed on another
                   3995:           system with <a href=
                   3996:           "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3997:           <span class="citerefentry"><span class=
1.47      reed     3998:           "refentrytitle">pkg_add</span>(1)</span></a>. This saves
1.1       grant    3999:           having to build the same package on a group of hosts and
                   4000:           wasting CPU time. It also provides a simple means for
                   4001:           others to install your package, should you distribute
                   4002:           it.</p>
                   4003: 
                   4004:           <p>To create a binary package, change into the
1.14      xtraeme  4005:           appropriate directory in pkgsrc, and run
                   4006:           <span><strong class="command">make
                   4007:           package</strong></span>:</p>
1.1       grant    4008:           <pre class="screen">
1.14      xtraeme  4009: <code class="prompt">#</code> <strong class=
                   4010: "userinput"><code>cd misc/figlet</code></strong>
                   4011: <code class="prompt">#</code> <strong class=
                   4012: "userinput"><code>make package</code></strong>
1.1       grant    4013: </pre>
                   4014: 
                   4015:           <p>This will build and install your package (if not
                   4016:           already done), and then build a binary package from what
1.14      xtraeme  4017:           was installed. You can then use the <span><strong class=
                   4018:           "command">pkg_*</strong></span> tools to manipulate it.
1.45      wiz      4019:           Binary packages are created by default in <code xmlns=
                   4020:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4021:           "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1       grant    4022:           gzipped tar file. See <a href="#logs.package" title=
1.59    ! rillig   4023:           "B.2.&nbsp;Packaging figlet">Section B.2,
1.1       grant    4024:           &#8220;Packaging figlet&#8221;</a> for a continuation of
                   4025:           the above <a xmlns=
                   4026:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4027:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.45      wiz      4028:           target="_top"><code xmlns="" class=
                   4029:           "filename">misc/figlet</code></a> example.</p>
1.1       grant    4030: 
                   4031:           <p>See <a href="#submit" title=
1.59    ! rillig   4032:           "Chapter&nbsp;17.&nbsp;Submitting and Committing">Chapter
        !          4033:           17, <i>Submitting and Committing</i></a> for information
        !          4034:           on how to submit such a binary package.</p>
1.1       grant    4035:         </div>
                   4036: 
1.59    ! rillig   4037:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    4038:           <div class="titlepage">
                   4039:             <div>
                   4040:               <div>
                   4041:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   4042:                 "settings-for-creationg-of-binary-packages" id=
1.38      dillo    4043:                 "settings-for-creationg-of-binary-packages"></a>6.2.&nbsp;Settings
1.1       grant    4044:                 for creation of binary packages</h2>
                   4045:               </div>
                   4046:             </div>
                   4047:           </div>
                   4048: 
                   4049:           <p>See <a href="#build.helpful-targets" title=
1.56      rillig   4050:           "14.16.&nbsp;Other helpful targets">Section&nbsp;14.16,
1.1       grant    4051:           &#8220;Other helpful targets&#8221;</a>.</p>
                   4052:         </div>
                   4053: 
1.59    ! rillig   4054:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    4055:           <div class="titlepage">
                   4056:             <div>
                   4057:               <div>
                   4058:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   4059:                 "bulkbuild" id="bulkbuild"></a>6.3.&nbsp;Doing a
        !          4060:                 bulk build of all packages</h2>
1.1       grant    4061:               </div>
                   4062:             </div>
                   4063:           </div>
                   4064: 
                   4065:           <p>If you want to get a full set of precompiled binary
                   4066:           packages, this section describes how to get them. Beware
                   4067:           that the bulk build will remove all currently installed
1.23      wiz      4068:           packages from your system! Having an FTP server
                   4069:           configured either on the machine doing the bulk builds or
                   4070:           on a nearby NFS server can help to make the packages
                   4071:           available to everyone. See <a href=
1.1       grant    4072:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
                   4073:           <span class="citerefentry"><span class=
                   4074:           "refentrytitle">ftpd</span>(8)</span></a> for more
                   4075:           information. If you use a remote NFS server's storage, be
                   4076:           sure to not actually compile on NFS storage, as this
                   4077:           slows things down a lot.</p>
                   4078: 
1.59    ! rillig   4079:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    4080:             <div class="titlepage">
                   4081:               <div>
                   4082:                 <div>
1.59    ! rillig   4083:                   <h3 class="title"><a name="binary.configuration"
        !          4084:                   id=
1.38      dillo    4085:                   "binary.configuration"></a>6.3.1.&nbsp;Configuration</h3>
1.1       grant    4086:                 </div>
                   4087:               </div>
                   4088:             </div>
                   4089: 
1.59    ! rillig   4090:             <div class="sect3" lang="en" xml:lang="en">
1.1       grant    4091:               <div class="titlepage">
                   4092:                 <div>
                   4093:                   <div>
1.59    ! rillig   4094:                     <h4 class="title"><a name="binary.mk.conf" id=
1.38      dillo    4095:                     "binary.mk.conf"></a>6.3.1.1.&nbsp;/etc/mk.conf</h4>
1.1       grant    4096:                   </div>
                   4097:                 </div>
                   4098:               </div>
                   4099: 
1.45      wiz      4100:               <p>You may want to set variables in <code xmlns=
                   4101:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4102:               "filename">/etc/mk.conf</code>. Look at <code xmlns=
                   4103:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4104:               "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1       grant    4105:               details of the default settings. You will want to
1.14      xtraeme  4106:               ensure that <code class=
                   4107:               "varname">ACCEPTABLE_LICENSES</code> meet your local
                   4108:               policy. As used in this example, <code class=
                   4109:               "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1       grant    4110:               "emphasis"><em>all</em></span> licenses.</p>
                   4111:               <pre class="programlisting">
1.51      rillig   4112:     PACKAGES?=      ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
                   4113:     WRKOBJDIR?=     /usr/tmp/pkgsrc   # build here instead of in pkgsrc
                   4114:     BSDSRCDIR=      /usr/src
                   4115:     BSDXSRCDIR=     /usr/xsrc         # for x11/xservers
                   4116:     OBJHOSTNAME?=   yes               # use work.`hostname`
                   4117:     FAILOVER_FETCH= yes               # insist on the correct checksum
                   4118:     PKG_DEVELOPER?= yes
                   4119:     _ACCEPTABLE=    yes
1.1       grant    4120: </pre>
                   4121:             </div>
                   4122: 
1.59    ! rillig   4123:             <div class="sect3" lang="en" xml:lang="en">
1.1       grant    4124:               <div class="titlepage">
                   4125:                 <div>
                   4126:                   <div>
1.59    ! rillig   4127:                     <h4 class="title"><a name="build.conf" id=
1.45      wiz      4128:                     "build.conf"></a>6.3.1.2.&nbsp;<code xmlns=
                   4129:                     "http://www.w3.org/TR/xhtml1/transitional"
                   4130:                     class="filename">build.conf</code></h4>
1.1       grant    4131:                   </div>
                   4132:                 </div>
                   4133:               </div>
                   4134: 
1.45      wiz      4135:               <p>In <code xmlns=
                   4136:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4137:               "filename">pkgsrc/mk/bulk</code>, copy <code xmlns=
                   4138:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4139:               "filename">build.conf-example</code> to <code xmlns=
                   4140:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4141:               "filename">build.conf</code> and edit it, following
                   4142:               the comments in that file. This is the config file
                   4143:               that determines where log files are generated after
                   4144:               the build, where to mail the build report to, where
                   4145:               your pkgsrc tree is located and the user to which
                   4146:               user to <a href=
1.1       grant    4147:               "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
                   4148:               <span class="citerefentry"><span class=
1.23      wiz      4149:               "refentrytitle">su</span>(8)</span></a> to do a
1.14      xtraeme  4150:               <span><strong class="command">cvs
                   4151:               update</strong></span>.</p>
1.1       grant    4152:             </div>
                   4153: 
1.59    ! rillig   4154:             <div class="sect3" lang="en" xml:lang="en">
1.1       grant    4155:               <div class="titlepage">
                   4156:                 <div>
                   4157:                   <div>
1.59    ! rillig   4158:                     <h4 class="title"><a name="pre-build.local" id=
1.45      wiz      4159:                     "pre-build.local"></a>6.3.1.3.&nbsp;<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4160:                     class="filename">pre-build.local</code></h4>
1.1       grant    4161:                   </div>
                   4162:                 </div>
                   4163:               </div>
                   4164: 
                   4165:               <p>It is possible to configure the bulk build to
1.47      reed     4166:               perform certain site-specific tasks at the end of the
1.45      wiz      4167:               pre-build stage. If the file <code xmlns=
                   4168:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4169:               "filename">pre-build.local</code> exists in
1.45      wiz      4170:               <code xmlns=
                   4171:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4172:               "filename">/usr/pkgsrc/mk/bulk</code>, it will be
                   4173:               executed (as a <a href=
1.24      wiz      4174:               "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
                   4175:               <span class="citerefentry"><span class=
                   4176:               "refentrytitle">sh</span>(1)</span></a> script) at
                   4177:               the end of the usual pre-build stage. An example use
1.45      wiz      4178:               of <code xmlns=
                   4179:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4180:               "filename">pre-build.local</code> is to have the
                   4181:               line:</p>
1.1       grant    4182:               <pre class="screen">
1.14      xtraeme  4183: <code class="prompt">#</code> <strong class=
                   4184: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23      wiz      4185:     &gt; pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1       grant    4186: </pre>
                   4187: 
                   4188:               <p>to prevent the system from trying to build a
                   4189:               particular package which requires nearly 3 GB of disk
                   4190:               space.</p>
                   4191:             </div>
                   4192:           </div>
                   4193: 
1.59    ! rillig   4194:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    4195:             <div class="titlepage">
                   4196:               <div>
                   4197:                 <div>
1.30      wiz      4198:                   <h3 class="title"><a name=
1.59    ! rillig   4199:                   "other-environmental-considerations" id=
1.38      dillo    4200:                   "other-environmental-considerations"></a>6.3.2.&nbsp;Other
1.30      wiz      4201:                   environmental considerations</h3>
1.1       grant    4202:                 </div>
                   4203:               </div>
                   4204:             </div>
                   4205: 
1.45      wiz      4206:             <p>As <code xmlns=
                   4207:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4208:             "filename">/usr/pkg</code> will be completely deleted
                   4209:             at the start of bulk builds, make sure your login shell
                   4210:             is placed somewhere else. Either drop it into
                   4211:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4212:             class="filename">/usr/local/bin</code> (and adjust your
                   4213:             login shell in the passwd file), or (re-)install it via
1.14      xtraeme  4214:             <a href=
1.1       grant    4215:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   4216:             <span class="citerefentry"><span class=
                   4217:             "refentrytitle">pkg_add</span>(1)</span></a> from
1.45      wiz      4218:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4219:             class="filename">/etc/rc.local</code>, so you can login
                   4220:             after a reboot (remember that your current process
                   4221:             won't die if the package is removed, you just can't
                   4222:             start any new instances of the shell any more). Also,
                   4223:             if you use NetBSD earlier than 1.5, or you still want
                   4224:             to use the pkgsrc version of ssh for some reason, be
                   4225:             sure to install ssh before starting it from
                   4226:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4227:             class="filename">rc.local</code>:</p>
1.1       grant    4228:             <pre class="programlisting">
1.51      rillig   4229:     ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
                   4230:     if [ -f /usr/pkg/etc/rc.d/sshd ]; then
                   4231:         /usr/pkg/etc/rc.d/sshd
                   4232:     fi
1.1       grant    4233: </pre>
                   4234: 
                   4235:             <p>Not doing so will result in you being not able to
                   4236:             log in via ssh after the bulk build is finished or if
                   4237:             the machine gets rebooted or crashes. You have been
                   4238:             warned! :)</p>
                   4239:           </div>
                   4240: 
1.59    ! rillig   4241:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    4242:             <div class="titlepage">
                   4243:               <div>
                   4244:                 <div>
1.59    ! rillig   4245:                   <h3 class="title"><a name="operation" id=
1.38      dillo    4246:                   "operation"></a>6.3.3.&nbsp;Operation</h3>
1.1       grant    4247:                 </div>
                   4248:               </div>
                   4249:             </div>
                   4250: 
                   4251:             <p>Make sure you don't need any of the packages still
                   4252:             installed.</p>
                   4253: 
                   4254:             <div class="warning" style=
                   4255:             "margin-left: 0.5in; margin-right: 0.5in;">
                   4256:               <h3 class="title">Warning</h3>
                   4257: 
                   4258:               <p>During the bulk build, <span class=
                   4259:               "emphasis"><em>all packages will be
                   4260:               removed!</em></span></p>
                   4261:             </div>
                   4262: 
                   4263:             <p>Be sure to remove all other things that might
                   4264:             interfere with builds, like some libs installed in
1.45      wiz      4265:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4266:             class="filename">/usr/local</code>, etc. then become
                   4267:             root and type:</p>
1.1       grant    4268:             <pre class="screen">
1.14      xtraeme  4269: <code class="prompt">#</code> <strong class=
                   4270: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   4271: <code class="prompt">#</code> <strong class=
                   4272: "userinput"><code>sh mk/bulk/build</code></strong>
1.1       grant    4273: </pre>
                   4274: 
                   4275:             <p>If for some reason your last build didn't complete
                   4276:             (power failure, system panic, ...), you can continue it
                   4277:             by running:</p>
                   4278:             <pre class="screen">
1.14      xtraeme  4279: <code class="prompt">#</code> <strong class=
                   4280: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1       grant    4281: </pre>
                   4282: 
                   4283:             <p>At the end of the bulk build, you will get a summary
                   4284:             via mail, and find build logs in the directory
1.14      xtraeme  4285:             specified by <code class="varname">FTP</code> in the
1.45      wiz      4286:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4287:             class="filename">build.conf</code> file.</p>
1.1       grant    4288:           </div>
                   4289: 
1.59    ! rillig   4290:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    4291:             <div class="titlepage">
                   4292:               <div>
                   4293:                 <div>
1.59    ! rillig   4294:                   <h3 class="title"><a name="what-it-does" id=
1.38      dillo    4295:                   "what-it-does"></a>6.3.4.&nbsp;What it does</h3>
1.1       grant    4296:                 </div>
                   4297:               </div>
                   4298:             </div>
                   4299: 
                   4300:             <p>The bulk builds consist of three steps:</p>
                   4301: 
                   4302:             <div class="variablelist">
                   4303:               <dl>
                   4304:                 <dt><span class="term">1. pre-build</span></dt>
                   4305: 
                   4306:                 <dd>
                   4307:                   <p>The script updates your pkgsrc tree via
                   4308:                   (anon)cvs, then cleans out any broken distfiles,
                   4309:                   and removes all packages installed.</p>
                   4310:                 </dd>
                   4311: 
                   4312:                 <dt><span class="term">2. the bulk
                   4313:                 build</span></dt>
                   4314: 
                   4315:                 <dd>
                   4316:                   <p>This is basically &#8220;<span class=
                   4317:                   "quote">make bulk-package</span>&#8221; with an
                   4318:                   optimised order in which packages will be built.
                   4319:                   Packages that don't require other packages will
                   4320:                   be built first, and packages with many
                   4321:                   dependencies will be built later.</p>
                   4322:                 </dd>
                   4323: 
                   4324:                 <dt><span class="term">3. post-build</span></dt>
                   4325: 
                   4326:                 <dd>
                   4327:                   <p>Generates a report that's placed in the
1.45      wiz      4328:                   directory specified in the <code xmlns=
                   4329:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4330:                   "filename">build.conf</code> file named
1.45      wiz      4331:                   <code xmlns=
                   4332:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4333:                   "filename">broken.html</code>, a short version of
                   4334:                   that report will also be mailed to the build's
                   4335:                   admin.</p>
1.1       grant    4336:                 </dd>
                   4337:               </dl>
                   4338:             </div>
                   4339: 
                   4340:             <p>During the build, a list of broken packages will be
1.45      wiz      4341:             compiled in <code xmlns=
                   4342:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4343:             "filename">/usr/pkgsrc/.broken</code> (or <code xmlns=
                   4344:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4345:             "filename">.../.broken.${MACHINE}</code> if
                   4346:             <code class="varname">OBJMACHINE</code> is set),
                   4347:             individual build logs of broken builds can be found in
                   4348:             the package's directory. These files are used by the
                   4349:             bulk-targets to mark broken builds to not waste time
                   4350:             trying to rebuild them, and they can be used to debug
                   4351:             these broken package builds later.</p>
1.1       grant    4352:           </div>
                   4353: 
1.59    ! rillig   4354:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    4355:             <div class="titlepage">
                   4356:               <div>
                   4357:                 <div>
1.30      wiz      4358:                   <h3 class="title"><a name=
1.59    ! rillig   4359:                   "disk-space-requirements" id=
1.38      dillo    4360:                   "disk-space-requirements"></a>6.3.5.&nbsp;Disk
1.30      wiz      4361:                   space requirements</h3>
1.1       grant    4362:                 </div>
                   4363:               </div>
                   4364:             </div>
                   4365: 
                   4366:             <p>Currently, roughly the following requirements are
                   4367:             valid for NetBSD 2.0/i386:</p>
                   4368: 
                   4369:             <div class="itemizedlist">
                   4370:               <ul type="disc">
                   4371:                 <li>
                   4372:                   <p>10 GB - distfiles (NFS ok)</p>
                   4373:                 </li>
                   4374: 
                   4375:                 <li>
                   4376:                   <p>8 GB - full set of all binaries (NFS ok)</p>
                   4377:                 </li>
                   4378: 
                   4379:                 <li>
                   4380:                   <p>5 GB - temp space for compiling (local disk
                   4381:                   recommended)</p>
                   4382:                 </li>
                   4383:               </ul>
                   4384:             </div>
                   4385: 
                   4386:             <p>Note that all pkgs will be de-installed as soon as
                   4387:             they are turned into a binary package, and that sources
                   4388:             are removed, so there is no excessively huge demand to
                   4389:             disk space. Afterwards, if the package is needed again,
                   4390:             it will be installed via <a href=
                   4391:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   4392:             <span class="citerefentry"><span class=
                   4393:             "refentrytitle">pkg_add</span>(1)</span></a> instead of
                   4394:             building again, so there are no cycles wasted by
                   4395:             recompiling.</p>
                   4396:           </div>
                   4397: 
1.59    ! rillig   4398:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    4399:             <div class="titlepage">
                   4400:               <div>
                   4401:                 <div>
1.59    ! rillig   4402:                   <h3 class="title"><a name="setting-up-a-sandbox"
        !          4403:                   id="setting-up-a-sandbox"></a>6.3.6.&nbsp;Setting
        !          4404:                   up a sandbox for chrooted builds</h3>
1.1       grant    4405:                 </div>
                   4406:               </div>
                   4407:             </div>
                   4408: 
1.12      agc      4409:             <p>If you don't want all the packages nuked from a
                   4410:             machine (rendering it useless for anything but pkg
1.23      wiz      4411:             compiling), there is the possibility of doing the
                   4412:             package bulk build inside a chroot environment.</p>
1.12      agc      4413: 
                   4414:             <p>The first step is to set up a chroot sandbox, e.g.
1.45      wiz      4415:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4416:             class="filename">/usr/sandbox</code>. This can be done
                   4417:             by using null mounts, or manually.</p>
1.12      agc      4418: 
1.45      wiz      4419:             <p>There is a shell script called <code xmlns=
                   4420:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4421:             "filename">pkgsrc/mk/bulk/mksandbox</code> which will
                   4422:             set up the sandbox environment using null mounts. It
1.45      wiz      4423:             will also create a script called <code xmlns=
                   4424:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4425:             "filename">sandbox</code> in the root of the sandbox
1.12      agc      4426:             environment, which will allow the null mounts to be
1.14      xtraeme  4427:             activated using the <span><strong class=
                   4428:             "command">sandbox mount</strong></span> command and
                   4429:             deactivated using the <span><strong class=
                   4430:             "command">sandbox umount</strong></span> command.</p>
1.12      agc      4431: 
                   4432:             <p>To set up a sandbox environment by hand, after
                   4433:             extracting all the sets from a NetBSD installation or
1.14      xtraeme  4434:             doing a <span><strong class="command">make distribution
1.45      wiz      4435:             DESTDIR=/usr/sandbox</strong></span> in <code xmlns=
                   4436:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4437:             "filename">/usr/src/etc</code>, be sure the following
1.7       wiz      4438:             items are present and properly configured:</p>
1.1       grant    4439: 
                   4440:             <div class="procedure">
                   4441:               <ol type="1">
                   4442:                 <li>
                   4443:                   <p>Kernel</p>
                   4444:                   <pre class="screen">
1.14      xtraeme  4445: <code class="prompt">#</code> <strong class=
                   4446: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1       grant    4447: </pre>
                   4448:                 </li>
                   4449: 
                   4450:                 <li>
1.45      wiz      4451:                   <p><code xmlns=
                   4452:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4453:                   "filename">/dev/*</code></p>
1.1       grant    4454:                   <pre class="screen">
1.14      xtraeme  4455: <code class="prompt">#</code> <strong class=
                   4456: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1       grant    4457: </pre>
                   4458:                 </li>
                   4459: 
                   4460:                 <li>
1.45      wiz      4461:                   <p><code xmlns=
                   4462:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4463:                   "filename">/etc/resolv.conf</code> (for <a xmlns=
1.1       grant    4464:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   4465:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45      wiz      4466:                   target="_top"><code xmlns="" class=
                   4467:                   "filename">security/smtpd</code></a> and
                   4468:                   mail):</p>
1.1       grant    4469:                   <pre class="screen">
1.14      xtraeme  4470: <code class="prompt">#</code> <strong class=
                   4471: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1       grant    4472: </pre>
                   4473:                 </li>
                   4474: 
                   4475:                 <li>
                   4476:                   <p>Working(!) mail config (hostname,
                   4477:                   sendmail.cf):</p>
                   4478:                   <pre class="screen">
1.14      xtraeme  4479: <code class="prompt">#</code> <strong class=
                   4480: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1       grant    4481: </pre>
                   4482:                 </li>
                   4483: 
                   4484:                 <li>
1.45      wiz      4485:                   <p><code xmlns=
                   4486:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4487:                   "filename">/etc/localtime</code> (for <a xmlns=
1.1       grant    4488:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   4489:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45      wiz      4490:                   target="_top"><code xmlns="" class=
                   4491:                   "filename">security/smtpd</code></a>):</p>
1.1       grant    4492:                   <pre class="screen">
1.14      xtraeme  4493: <code class="prompt">#</code> <strong class=
                   4494: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1       grant    4495: </pre>
                   4496:                 </li>
                   4497: 
                   4498:                 <li>
1.45      wiz      4499:                   <p><code xmlns=
                   4500:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4501:                   "filename">/usr/src</code> (system sources, for
                   4502:                   <a xmlns=
1.1       grant    4503:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   4504:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.45      wiz      4505:                   target="_top"><code xmlns="" class=
                   4506:                   "filename">sysutils/aperture</code></a>,
                   4507:                   <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4508:                   href=
1.20      ben      4509:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
1.45      wiz      4510:                   target="_top"><code xmlns="" class=
                   4511:                   "filename">net/ppp-mppe</code></a>):</p>
1.1       grant    4512:                   <pre class="screen">
1.14      xtraeme  4513: <code class="prompt">#</code> <strong class=
                   4514: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
                   4515: <code class="prompt">#</code> <strong class=
1.23      wiz      4516: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1       grant    4517: </pre>
                   4518:                 </li>
                   4519: 
                   4520:                 <li>
1.45      wiz      4521:                   <p>Create <code xmlns=
                   4522:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4523:                   "filename">/var/db/pkg</code> (not part of
                   4524:                   default install):</p>
1.1       grant    4525:                   <pre class="screen">
1.14      xtraeme  4526: <code class="prompt">#</code> <strong class=
                   4527: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1       grant    4528: </pre>
                   4529:                 </li>
                   4530: 
                   4531:                 <li>
1.45      wiz      4532:                   <p>Create <code xmlns=
                   4533:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4534:                   "filename">/usr/pkg</code> (not part of default
                   4535:                   install):</p>
1.1       grant    4536:                   <pre class="screen">
1.14      xtraeme  4537: <code class="prompt">#</code> <strong class=
                   4538: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1       grant    4539: </pre>
                   4540:                 </li>
                   4541: 
                   4542:                 <li>
1.45      wiz      4543:                   <p>Checkout pkgsrc via cvs into <code xmlns=
                   4544:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4545:                   "filename">/usr/sandbox/usr/pkgsrc</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/usr</code></strong>
                   4549: <code class="prompt">#</code> <strong class=
                   4550: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1       grant    4551: </pre>
                   4552: 
                   4553:                   <p>Do not mount/link this to the copy of your
                   4554:                   pkgsrc tree you do development in, as this will
                   4555:                   likely cause problems!</p>
                   4556:                 </li>
                   4557: 
                   4558:                 <li>
1.45      wiz      4559:                   <p>Make <code xmlns=
                   4560:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4561:                   "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.45      wiz      4562:                   and <code xmlns=
                   4563:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4564:                   "filename">.../distfiles</code> point somewhere
                   4565:                   appropriate. NFS- and/or nullfs-mounts may come
                   4566:                   in handy!</p>
1.1       grant    4567:                 </li>
                   4568: 
                   4569:                 <li>
1.45      wiz      4570:                   <p>Edit <code xmlns=
                   4571:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4572:                   "filename">/etc/mk.conf</code>, see <a href=
                   4573:                   "#binary.mk.conf" title=
1.38      dillo    4574:                   "6.3.1.1.&nbsp;/etc/mk.conf">Section&nbsp;6.3.1.1,
1.1       grant    4575:                   &#8220;/etc/mk.conf&#8221;</a>.</p>
                   4576:                 </li>
                   4577: 
                   4578:                 <li>
1.45      wiz      4579:                   <p>Adjust <code xmlns=
                   4580:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4581:                   "filename">mk/bulk/build.conf</code> to suit your
1.1       grant    4582:                   needs.</p>
                   4583:                 </li>
                   4584: 
                   4585:                 <li>
1.14      xtraeme  4586:                   <p>If you have set <code class=
1.45      wiz      4587:                   "varname">CVS_USER</code> in <code xmlns=
                   4588:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4589:                   "filename">build.conf</code>, make sure that
                   4590:                   account exists and can do a <span><strong class=
                   4591:                   "command">cvs ${CVS_FLAGS} update</strong></span>
1.1       grant    4592:                   properly!</p>
                   4593:                 </li>
                   4594:               </ol>
                   4595:             </div>
                   4596: 
1.47      reed     4597:             <p>When the chroot sandbox is set up, you can start the
1.1       grant    4598:             build with the following steps:</p>
                   4599:             <pre class="screen">
1.14      xtraeme  4600: <code class="prompt">#</code> <strong class=
                   4601: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
                   4602: <code class="prompt">#</code> <strong class=
                   4603: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1       grant    4604: </pre>
                   4605: 
                   4606:             <p>This will just jump inside the sandbox and start
                   4607:             building. At the end of the build, mail will be sent
                   4608:             with the results of the build. Created binary pkgs will
1.45      wiz      4609:             be in <code xmlns=
                   4610:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4611:             "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1       grant    4612:             (wherever that points/mounts to/from).</p>
                   4613:           </div>
                   4614: 
1.59    ! rillig   4615:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    4616:             <div class="titlepage">
                   4617:               <div>
                   4618:                 <div>
1.30      wiz      4619:                   <h3 class="title"><a name=
1.59    ! rillig   4620:                   "building-a-partial-set" id=
1.38      dillo    4621:                   "building-a-partial-set"></a>6.3.7.&nbsp;Building
1.30      wiz      4622:                   a partial set of packages</h3>
1.1       grant    4623:                 </div>
                   4624:               </div>
                   4625:             </div>
                   4626: 
                   4627:             <p>In addition to building a complete set of all
1.45      wiz      4628:             packages in pkgsrc, the <code xmlns=
                   4629:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4630:             "filename">pkgsrc/mk/bulk/build</code> script may be
                   4631:             used to build a subset of the packages contained in
1.47      reed     4632:             pkgsrc. By setting <code class=
1.45      wiz      4633:             "varname">SPECIFIC_PKGS</code> in <code xmlns=
                   4634:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4635:             "filename">/etc/mk.conf</code>, the variables</p>
1.1       grant    4636: 
                   4637:             <div class="itemizedlist">
                   4638:               <ul type="disc">
                   4639:                 <li>
                   4640:                   <p>SITE_SPECIFIC_PKGS</p>
                   4641:                 </li>
                   4642: 
                   4643:                 <li>
                   4644:                   <p>HOST_SPECIFIC_PKGS</p>
                   4645:                 </li>
                   4646: 
                   4647:                 <li>
                   4648:                   <p>GROUP_SPECIFIC_PKGS</p>
                   4649:                 </li>
                   4650: 
                   4651:                 <li>
                   4652:                   <p>USER_SPECIFIC_PKGS</p>
                   4653:                 </li>
                   4654:               </ul>
                   4655:             </div>
                   4656: 
                   4657:             <p>will define the set of packages which should be
                   4658:             built. The bulk build code will also include any
                   4659:             packages which are needed as dependencies for the
                   4660:             explicitly listed packages.</p>
                   4661: 
                   4662:             <p>One use of this is to do a bulk build with
1.14      xtraeme  4663:             <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1       grant    4664:             sandbox periodically to have a complete set of the
                   4665:             binary packages needed for your site available without
                   4666:             the overhead of building extra packages that are not
                   4667:             needed.</p>
                   4668:           </div>
1.13      hubertf  4669: 
1.59    ! rillig   4670:           <div class="sect2" lang="en" xml:lang="en">
1.13      hubertf  4671:             <div class="titlepage">
                   4672:               <div>
                   4673:                 <div>
1.59    ! rillig   4674:                   <h3 class="title"><a name="bulk-upload" id=
1.38      dillo    4675:                   "bulk-upload"></a>6.3.8.&nbsp;Uploading results
1.13      hubertf  4676:                   of a bulk build</h3>
                   4677:                 </div>
                   4678:               </div>
                   4679:             </div>
                   4680: 
                   4681:             <p>This section describes how pkgsrc developers can
                   4682:             upload binary pkgs built by bulk builds to
                   4683:             ftp.NetBSD.org.</p>
                   4684: 
1.17      sketch   4685:             <p>If you would like to automatically create checksum
                   4686:             files for the binary packages you intend to upload,
                   4687:             remember to set <code class="varname">MKSUMS=yes</code>
1.45      wiz      4688:             in your <code xmlns=
                   4689:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.17      sketch   4690:             "filename">mk/bulk/build.conf</code>.</p>
                   4691: 
                   4692:             <p>If you would like to PGP sign the checksum files
                   4693:             (highly recommended!), remember to set <code class=
                   4694:             "varname">SIGN_AS=username@NetBSD.org</code> in your
1.45      wiz      4695:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4696:             class="filename">mk/bulk/build.conf</code>. This will
                   4697:             prompt you for your GPG password to sign the files
1.17      sketch   4698:             before uploading everything.</p>
                   4699: 
                   4700:             <p>Then, make sure that you have <code class=
1.14      xtraeme  4701:             "varname">RSYNC_DST</code> set properly in your
1.45      wiz      4702:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4703:             class="filename">mk/bulk/build.conf</code> file, i.e.
                   4704:             adjust it to something like one of the following:</p>
1.13      hubertf  4705:             <pre class="screen">
                   4706: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   4707: </pre>
                   4708: 
1.47      reed     4709:             <p>Please use appropriate values for "pkgsrc-200xQy",
1.13      hubertf  4710:             "NetBSD-a.b.c" and "arch" here. If your login on
1.14      xtraeme  4711:             ftp.NetBSD.org is different from <code class=
                   4712:             "varname">CVS_USER</code>, write your login directly
                   4713:             into the variable, e.g. my local account is "feyrer",
                   4714:             but for my login "hubertf", I use:</p>
1.13      hubertf  4715:             <pre class="screen">
                   4716: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   4717: </pre>
                   4718: 
1.45      wiz      4719:             <p>A separate <code xmlns=
                   4720:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4721:             "filename">upload</code> directory is used here to
                   4722:             allow "closing" the directory during upload. To do so,
                   4723:             run the following command on ftp.NetBSD.org next:</p>
1.13      hubertf  4724:             <pre class="screen">
1.14      xtraeme  4725: nbftp% <strong class=
                   4726: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13      hubertf  4727: </pre>
                   4728: 
1.45      wiz      4729:             <p>Please note that <code xmlns=
                   4730:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4731:             "filename">/pub/NetBSD/packages</code> is only
1.13      hubertf  4732:             appropriate for packages for the NetBSD operating
                   4733:             system. Binary packages for other operating systems
1.45      wiz      4734:             should go into <code xmlns=
                   4735:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4736:             "filename">/pub/pkgsrc</code>.</p>
1.13      hubertf  4737: 
                   4738:             <p>Before uploading the binary pkgs, ssh authentication
1.47      reed     4739:             needs to be set up. This example shows how to set up
1.13      hubertf  4740:             temporary keys for the root account <span class=
                   4741:             "emphasis"><em>inside the sandbox</em></span> (assuming
                   4742:             that no keys should be present there usually):</p>
                   4743:             <pre class="screen">
1.14      xtraeme  4744: <code class="prompt">#</code> <strong class=
                   4745: "userinput"><code>chroot /usr/sandbox</code></strong>        
                   4746: chroot-<code class="prompt">#</code> <strong class=
                   4747: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>        
                   4748: chroot-<code class="prompt">#</code> <strong class=
                   4749: "userinput"><code>ssh-keygen -t dsa</code></strong>        
                   4750: chroot-<code class="prompt">#</code> <strong class=
                   4751: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong> 
1.13      hubertf  4752: </pre>
                   4753: 
1.45      wiz      4754:             <p>Now take the output of <code xmlns=
                   4755:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4756:             "filename">id-dsa.pub</code> and append it to your
1.45      wiz      4757:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4758:             class="filename">~/.ssh/authorized_keys</code> file on
                   4759:             ftp.NetBSD.org. You can remove the key after the upload
                   4760:             is done!</p>
1.13      hubertf  4761: 
                   4762:             <p>Next, test if your ssh connection really works:</p>
                   4763:             <pre class="screen">
1.14      xtraeme  4764: chroot-<code class="prompt">#</code> <strong class=
                   4765: "userinput"><code>ssh ftp.NetBSD.org date</code></strong> 
1.13      hubertf  4766: </pre>
                   4767: 
                   4768:             <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
                   4769: 
                   4770:             <p>Now after all this works, you can exit the sandbox
                   4771:             and start the upload:</p>
                   4772:             <pre class="screen">
1.14      xtraeme  4773: chroot-<code class="prompt">#</code> <strong class=
                   4774: "userinput"><code>exit</code></strong>        
                   4775: <code class="prompt">#</code> <strong class=
                   4776: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>        
                   4777: <code class="prompt">#</code> <strong class=
                   4778: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong> 
1.13      hubertf  4779: </pre>
                   4780: 
                   4781:             <p>The upload process may take quite some time. Use
1.24      wiz      4782:             <a href=
                   4783:             "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
                   4784:             <span class="citerefentry"><span class=
                   4785:             "refentrytitle">ls</span>(1)</span></a> or <a href=
                   4786:             "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
                   4787:             <span class="citerefentry"><span class=
                   4788:             "refentrytitle">du</span>(1)</span></a> on the FTP
                   4789:             server to monitor progress of the upload. The upload
                   4790:             script will take care of not uploading restricted
                   4791:             packages and putting vulnerable packages into the
1.45      wiz      4792:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4793:             class="filename">vulnerable</code> subdirectory.</p>
1.13      hubertf  4794: 
                   4795:             <p>After the upload has ended, first thing is to revoke
                   4796:             ssh access:</p>
                   4797:             <pre class="screen">
1.14      xtraeme  4798: nbftp% <strong class=
                   4799: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13      hubertf  4800: Gdd:x! 
                   4801: </pre>
                   4802: 
                   4803:             <p>Use whatever is needed to remove the key you've
                   4804:             entered before! Last, move the uploaded packages out of
1.45      wiz      4805:             the <code xmlns=
                   4806:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4807:             "filename">upload</code> directory to have them
                   4808:             accessible to everyone:</p>
1.13      hubertf  4809:             <pre class="screen">
1.14      xtraeme  4810: nbftp% <strong class=
                   4811: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
                   4812: nbftp% <strong class=
                   4813: "userinput"><code>mv upload/* .</code></strong>
                   4814: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
                   4815: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong> 
1.13      hubertf  4816: </pre>
                   4817:           </div>
1.1       grant    4818:         </div>
                   4819: 
1.59    ! rillig   4820:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    4821:           <div class="titlepage">
                   4822:             <div>
                   4823:               <div>
                   4824:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   4825:                 "creating-cdroms" id=
1.38      dillo    4826:                 "creating-cdroms"></a>6.4.&nbsp;Creating a multiple
1.30      wiz      4827:                 CD-ROM packages collection</h2>
1.1       grant    4828:               </div>
                   4829:             </div>
                   4830:           </div>
                   4831: 
                   4832:           <p>After your pkgsrc bulk-build has completed, you may
                   4833:           wish to create a CD-ROM set of the resulting binary
                   4834:           packages to assist in installing packages on other
                   4835:           machines. The <a xmlns=
                   4836:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4837:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.45      wiz      4838:           target="_top"><code xmlns="" class=
                   4839:           "filename">pkgtools/cdpack</code></a> package provides a
1.20      ben      4840:           simple tool for creating the ISO 9660 images.
                   4841:           <span><strong class="command">cdpack</strong></span>
                   4842:           arranges the packages on the CD-ROMs in a way that keeps
1.47      reed     4843:           all the dependencies for a given package on the same CD
                   4844:           as that package.</p>
1.1       grant    4845: 
1.59    ! rillig   4846:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    4847:             <div class="titlepage">
                   4848:               <div>
                   4849:                 <div>
1.59    ! rillig   4850:                   <h3 class="title"><a name="cdpack-example" id=
1.38      dillo    4851:                   "cdpack-example"></a>6.4.1.&nbsp;Example of
1.1       grant    4852:                   cdpack</h3>
                   4853:                 </div>
                   4854:               </div>
                   4855:             </div>
                   4856: 
                   4857:             <p>Complete documentation for cdpack is found in the
1.47      reed     4858:             cdpack(1) man page. The following short example assumes
1.45      wiz      4859:             that the binary packages are left in <code xmlns=
                   4860:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4861:             "filename">/usr/pkgsrc/packages/All</code> and that
1.45      wiz      4862:             sufficient disk space exists in <code xmlns=
                   4863:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4864:             "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1       grant    4865:             <pre class="screen">
1.14      xtraeme  4866: <code class="prompt">#</code> <strong class=
                   4867: "userinput"><code>mkdir /u2/images</code></strong>
                   4868: <code class="prompt">#</code> <strong class=
                   4869: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
                   4870: <code class="prompt">#</code> <strong class=
                   4871: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    4872: </pre>
                   4873: 
                   4874:             <p>If you wish to include a common set of files
1.45      wiz      4875:             (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4876:             class="filename">COPYRIGHT</code>, <code xmlns=
                   4877:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4878:             "filename">README</code>, etc.) on each CD in the
1.1       grant    4879:             collection, then you need to create a directory which
                   4880:             contains these files. e.g.</p>
                   4881:             <pre class="screen">
1.14      xtraeme  4882: <code class="prompt">#</code> <strong class=
                   4883: "userinput"><code>mkdir /tmp/common</code></strong>
                   4884: <code class="prompt">#</code> <strong class=
                   4885: "userinput"><code>echo "This is a README" &gt; /tmp/common/README</code></strong>
                   4886: <code class="prompt">#</code> <strong class=
                   4887: "userinput"><code>echo "Another file" &gt; /tmp/common/COPYING</code></strong>
                   4888: <code class="prompt">#</code> <strong class=
                   4889: "userinput"><code>mkdir /tmp/common/bin</code></strong>
                   4890: <code class="prompt">#</code> <strong class=
                   4891: "userinput"><code>echo "#!/bin/sh" &gt; /tmp/common/bin/myscript</code></strong>
                   4892: <code class="prompt">#</code> <strong class=
                   4893: "userinput"><code>echo "echo Hello world" &gt;&gt; /tmp/common/bin/myscript</code></strong>
                   4894: <code class="prompt">#</code> <strong class=
                   4895: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1       grant    4896: </pre>
                   4897: 
                   4898:             <p>Now create the images:</p>
                   4899:             <pre class="screen">
1.14      xtraeme  4900: <code class="prompt">#</code> <strong class=
                   4901: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    4902: </pre>
                   4903: 
1.45      wiz      4904:             <p>Each image will contain <code xmlns=
                   4905:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4906:             "filename">README</code>, <code xmlns=
                   4907:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4908:             "filename">COPYING</code>, and <code xmlns=
                   4909:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4910:             "filename">bin/myscript</code> in their root
1.1       grant    4911:             directories.</p>
                   4912:           </div>
                   4913:         </div>
                   4914:       </div>
                   4915: 
1.59    ! rillig   4916:       <div class="chapter" lang="en" xml:lang="en">
1.1       grant    4917:         <div class="titlepage">
                   4918:           <div>
                   4919:             <div>
1.59    ! rillig   4920:               <h2 class="title"><a name="faq" id=
1.38      dillo    4921:               "faq"></a>Chapter&nbsp;7.&nbsp;Frequently Asked
1.1       grant    4922:               Questions</h2>
                   4923:             </div>
                   4924:           </div>
                   4925:         </div>
                   4926: 
                   4927:         <div class="toc">
                   4928:           <p><b>Table of Contents</b></p>
                   4929: 
                   4930:           <dl>
1.30      wiz      4931:             <dt><span class="sect1"><a href=
1.38      dillo    4932:             "#mailing-list-pointers">7.1. Are there any mailing
1.30      wiz      4933:             lists for pkg-related discussion?</a></span></dt>
1.1       grant    4934: 
1.38      dillo    4935:             <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1       grant    4936:             Where's the pkgviews documentation?</a></span></dt>
                   4937: 
1.38      dillo    4938:             <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1       grant    4939:             Utilities for package management
                   4940:             (pkgtools)</a></span></dt>
                   4941: 
1.38      dillo    4942:             <dt><span class="sect1"><a href="#non-root-pkgsrc">7.4.
1.30      wiz      4943:             How to use pkgsrc as non-root</a></span></dt>
1.1       grant    4944: 
1.30      wiz      4945:             <dt><span class="sect1"><a href=
1.38      dillo    4946:             "#resume-transfers">7.5. How to resume transfers when
1.30      wiz      4947:             fetching distfiles?</a></span></dt>
1.14      xtraeme  4948: 
1.30      wiz      4949:             <dt><span class="sect1"><a href=
1.38      dillo    4950:             "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30      wiz      4951:             XFree86 from pkgsrc?</a></span></dt>
1.1       grant    4952: 
1.30      wiz      4953:             <dt><span class="sect1"><a href=
1.38      dillo    4954:             "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30      wiz      4955:             from pkgsrc?</a></span></dt>
1.1       grant    4956: 
1.30      wiz      4957:             <dt><span class="sect1"><a href=
1.38      dillo    4958:             "#fetch-behind-firewall">7.8. How to fetch files from
1.30      wiz      4959:             behind a firewall</a></span></dt>
1.1       grant    4960: 
1.38      dillo    4961:             <dt><span class="sect1"><a href="#passive-ftp">7.9. How
1.14      xtraeme  4962:             do I tell <span><strong class="command">make
                   4963:             fetch</strong></span> to do passive
                   4964:             FTP?</a></span></dt>
1.1       grant    4965: 
1.30      wiz      4966:             <dt><span class="sect1"><a href=
1.38      dillo    4967:             "#fetching-all-distfiles">7.10. How to fetch all
1.30      wiz      4968:             distfiles at once</a></span></dt>
1.1       grant    4969: 
1.30      wiz      4970:             <dt><span class="sect1"><a href=
1.38      dillo    4971:             "#tmac.andoc-missing">7.11. What does
1.30      wiz      4972:             &#8220;<span class="quote">Don't know how to make
1.14      xtraeme  4973:             /usr/share/tmac/tmac.andoc</span>&#8221;
1.1       grant    4974:             mean?</a></span></dt>
                   4975: 
1.30      wiz      4976:             <dt><span class="sect1"><a href=
1.38      dillo    4977:             "#bsd.own.mk-missing">7.12. What does
1.30      wiz      4978:             &#8220;<span class="quote">Could not find
1.14      xtraeme  4979:             bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    4980: 
1.30      wiz      4981:             <dt><span class="sect1"><a href=
1.38      dillo    4982:             "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30      wiz      4983:             pkgsrc</a></span></dt>
1.1       grant    4984: 
1.38      dillo    4985:             <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35      jmmv     4986:             do I change the location of configuration
                   4987:             files?</a></span></dt>
1.1       grant    4988: 
1.38      dillo    4989:             <dt><span class="sect1"><a href="#audit-packages">7.15.
1.1       grant    4990:             Automated security checks</a></span></dt>
                   4991:           </dl>
                   4992:         </div>
                   4993: 
                   4994:         <p>This section contains hints, tips &amp; tricks on
                   4995:         special things in pkgsrc that we didn't find a better place
                   4996:         for in the previous chapters, and it contains items for
                   4997:         both pkgsrc users and developers.</p>
                   4998: 
1.59    ! rillig   4999:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5000:           <div class="titlepage">
                   5001:             <div>
                   5002:               <div>
                   5003:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   5004:                 "mailing-list-pointers" id=
1.38      dillo    5005:                 "mailing-list-pointers"></a>7.1.&nbsp;Are there any
1.30      wiz      5006:                 mailing lists for pkg-related discussion?</h2>
1.1       grant    5007:               </div>
                   5008:             </div>
                   5009:           </div>
                   5010: 
1.18      xtraeme  5011:           <p>The following mailing lists may be of interest to
                   5012:           pkgsrc users:</p>
                   5013: 
                   5014:           <div class="itemizedlist">
                   5015:             <ul type="disc">
                   5016:               <li>
                   5017:                 <p><a href=
                   5018:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.34      wiz      5019:                 target="_top">pkgsrc-bugs</a>: A list where problem
                   5020:                 reports related to pkgsrc are sent and
                   5021:                 discussed.</p>
1.18      xtraeme  5022:               </li>
                   5023: 
                   5024:               <li>
                   5025:                 <p><a href=
                   5026:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34      wiz      5027:                 target="_top">pkgsrc-bulk</a>: A list where the
1.20      ben      5028:                 results of pkgsrc bulk builds are sent and
1.34      wiz      5029:                 discussed.</p>
1.18      xtraeme  5030:               </li>
                   5031: 
                   5032:               <li>
                   5033:                 <p><a href=
                   5034:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.34      wiz      5035:                 target="_top">pkgsrc-changes</a>: A list where all
                   5036:                 commit messages to pkgsrc are sent.</p>
1.18      xtraeme  5037:               </li>
                   5038: 
                   5039:               <li>
                   5040:                 <p><a href=
                   5041:                 "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.34      wiz      5042:                 target="_top">tech-pkg</a>: A general discussion
                   5043:                 list for all things related to pkgsrc.</p>
1.18      xtraeme  5044:               </li>
                   5045:             </ul>
                   5046:           </div>
                   5047: 
                   5048:           <p>To subscribe, do:</p>
1.1       grant    5049:           <pre class="programlisting">
1.51      rillig   5050:     <code class="prompt">%</code> echo subscribe <em class=
1.18      xtraeme  5051: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1       grant    5052: </pre>
                   5053: 
1.18      xtraeme  5054:           <p>Archives for all these mailing lists are available
                   5055:           from <a href="http://mail-index.NetBSD.org/" target=
                   5056:           "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1       grant    5057:         </div>
                   5058: 
1.59    ! rillig   5059:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5060:           <div class="titlepage">
                   5061:             <div>
                   5062:               <div>
                   5063:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   5064:                 "pkgviews-docs" id=
1.38      dillo    5065:                 "pkgviews-docs"></a>7.2.&nbsp;Where's the pkgviews
1.30      wiz      5066:                 documentation?</h2>
1.1       grant    5067:               </div>
                   5068:             </div>
                   5069:           </div>
                   5070: 
                   5071:           <p>Pkgviews is tightly integrated with buildlink. You can
1.45      wiz      5072:           find a pkgviews User's guide in <code xmlns=
                   5073:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5074:           "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1       grant    5075:         </div>
                   5076: 
1.59    ! rillig   5077:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5078:           <div class="titlepage">
                   5079:             <div>
                   5080:               <div>
                   5081:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   5082:                 "faq-pkgtools" id=
1.38      dillo    5083:                 "faq-pkgtools"></a>7.3.&nbsp;Utilities for package
1.5       hubertf  5084:                 management (pkgtools)</h2>
1.1       grant    5085:               </div>
                   5086:             </div>
                   5087:           </div>
                   5088: 
1.45      wiz      5089:           <p>The <code xmlns=
                   5090:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5091:           "filename">pkgsrc/pkgtools</code> directory pkgtools
                   5092:           contains a number of useful utilities for both users and
                   5093:           developers of pkgsrc. This section attempts only to make
                   5094:           the reader aware of the utilities and when they might be
                   5095:           useful, and not to duplicate the documentation that comes
                   5096:           with each package.</p>
1.1       grant    5097: 
                   5098:           <p>Utilities used by pkgsrc (automatically installed when
                   5099:           needed):</p>
                   5100: 
                   5101:           <div class="itemizedlist">
                   5102:             <ul type="disc">
                   5103:               <li>
                   5104:                 <p><a xmlns=
                   5105:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5106:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.45      wiz      5107:                 target="_top"><code xmlns="" class=
                   5108:                 "filename">pkgtools/x11-links</code></a>: Symlinks
1.34      wiz      5109:                 for use by buildlink.</p>
1.1       grant    5110:               </li>
                   5111:             </ul>
                   5112:           </div>
                   5113: 
                   5114:           <p>OS tool augmentation (automatically installed when
                   5115:           needed):</p>
                   5116: 
                   5117:           <div class="itemizedlist">
                   5118:             <ul type="disc">
                   5119:               <li>
                   5120:                 <p><a xmlns=
                   5121:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5122:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.45      wiz      5123:                 target="_top"><code xmlns="" class=
                   5124:                 "filename">pkgtools/digest</code></a>: Calculates
1.34      wiz      5125:                 various kinds of checksums (including SHA1).</p>
1.1       grant    5126:               </li>
                   5127: 
                   5128:               <li>
                   5129:                 <p><a xmlns=
                   5130:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5131:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.45      wiz      5132:                 target="_top"><code xmlns="" class=
                   5133:                 "filename">pkgtools/libnbcompat</code></a>:
1.34      wiz      5134:                 Compatibility library for pkgsrc tools.</p>
1.1       grant    5135:               </li>
                   5136: 
                   5137:               <li>
                   5138:                 <p><a xmlns=
                   5139:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5140:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.45      wiz      5141:                 target="_top"><code xmlns="" class=
                   5142:                 "filename">pkgtools/mtree</code></a>: Installed on
1.34      wiz      5143:                 non-BSD systems due to lack of native mtree.</p>
1.1       grant    5144:               </li>
                   5145: 
                   5146:               <li>
                   5147:                 <p><a xmlns=
                   5148:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5149:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45      wiz      5150:                 target="_top"><code xmlns="" class=
                   5151:                 "filename">pkgtools/pkg_install</code></a>:
                   5152:                 Up-to-date replacement for <code xmlns=
                   5153:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.34      wiz      5154:                 "filename">/usr/sbin/pkg_install</code>, or for use
                   5155:                 on operating systems where pkg_install is not
                   5156:                 present.</p>
1.1       grant    5157:               </li>
                   5158:             </ul>
                   5159:           </div>
                   5160: 
                   5161:           <p>Utilities used by pkgsrc (not automatically
                   5162:           installed):</p>
                   5163: 
                   5164:           <div class="itemizedlist">
                   5165:             <ul type="disc">
                   5166:               <li>
                   5167:                 <p><a xmlns=
                   5168:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5169:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.45      wiz      5170:                 target="_top"><code xmlns="" class=
                   5171:                 "filename">pkgtools/pkg_tarup</code></a>: Create a
1.20      ben      5172:                 binary package from an already-installed package.
1.34      wiz      5173:                 Used by <span><strong class="command">make
                   5174:                 replace</strong></span> to save the old
                   5175:                 package.</p>
1.1       grant    5176:               </li>
                   5177: 
                   5178:               <li>
                   5179:                 <p><a xmlns=
                   5180:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.5       hubertf  5181:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.45      wiz      5182:                 target="_top"><code xmlns="" class=
                   5183:                 "filename">pkgtools/dfdisk</code></a>: Adds extra
1.20      ben      5184:                 functionality to pkgsrc, allowing it to fetch
                   5185:                 distfiles from multiple locations. It currently
                   5186:                 supports the following methods: multiple CD-ROMs
                   5187:                 and network FTP/HTTP connections.</p>
1.5       hubertf  5188:               </li>
                   5189: 
                   5190:               <li>
                   5191:                 <p><a xmlns=
                   5192:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    5193:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45      wiz      5194:                 target="_top"><code xmlns="" class=
                   5195:                 "filename">pkgtools/xpkgwedge</code></a>: Put X11
1.34      wiz      5196:                 packages someplace else (enabled by default).</p>
1.1       grant    5197:               </li>
1.5       hubertf  5198: 
                   5199:               <li>
                   5200:                 <p><a xmlns=
                   5201:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5202:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45      wiz      5203:                 target="_top"><code xmlns="" class=
                   5204:                 "filename">devel/cpuflags</code></a>: Determine the
1.34      wiz      5205:                 best compiler flags to optimise code for your
1.20      ben      5206:                 current CPU and compiler.</p>
1.5       hubertf  5207:               </li>
1.1       grant    5208:             </ul>
                   5209:           </div>
                   5210: 
                   5211:           <p>Utilities for keeping track of installed packages,
                   5212:           being up to date, etc:</p>
                   5213: 
                   5214:           <div class="itemizedlist">
                   5215:             <ul type="disc">
                   5216:               <li>
                   5217:                 <p><a xmlns=
                   5218:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5219:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.45      wiz      5220:                 target="_top"><code xmlns="" class=
                   5221:                 "filename">pkgtools/pkg_chk</code></a>: Reports on
1.27      rillig   5222:                 packages whose installed versions do not match the
1.34      wiz      5223:                 latest pkgsrc entries.</p>
1.1       grant    5224:               </li>
                   5225: 
                   5226:               <li>
                   5227:                 <p><a xmlns=
                   5228:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5229:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45      wiz      5230:                 target="_top"><code xmlns="" class=
                   5231:                 "filename">pkgtools/pkgdep</code></a>: Makes
1.20      ben      5232:                 dependency graphs of packages, to aid in choosing a
1.34      wiz      5233:                 strategy for updating.</p>
1.1       grant    5234:               </li>
                   5235: 
                   5236:               <li>
                   5237:                 <p><a xmlns=
                   5238:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5239:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.45      wiz      5240:                 target="_top"><code xmlns="" class=
                   5241:                 "filename">pkgtools/pkgdepgraph</code></a>: Makes
1.27      rillig   5242:                 graphs from the output of <a xmlns=
                   5243:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5244:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45      wiz      5245:                 target="_top"><code xmlns="" class=
                   5246:                 "filename">pkgtools/pkgdep</code></a> (uses
1.34      wiz      5247:                 graphviz).</p>
1.1       grant    5248:               </li>
                   5249: 
                   5250:               <li>
                   5251:                 <p><a xmlns=
                   5252:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5253:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45      wiz      5254:                 target="_top"><code xmlns="" class=
                   5255:                 "filename">pkgtools/pkglint</code></a>: The
1.27      rillig   5256:                 pkglint(1) program checks a pkgsrc entry for
                   5257:                 errors, lintpkgsrc(1) does various checks on the
                   5258:                 complete pkgsrc system.</p>
1.1       grant    5259:               </li>
                   5260: 
                   5261:               <li>
                   5262:                 <p><a xmlns=
                   5263:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5264:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.45      wiz      5265:                 target="_top"><code xmlns="" class=
                   5266:                 "filename">pkgtools/pkgsurvey</code></a>: Report
                   5267:                 what packages you have installed.</p>
1.1       grant    5268:               </li>
                   5269:             </ul>
                   5270:           </div>
                   5271: 
                   5272:           <p>Utilities for people maintaining or creating
                   5273:           individual packages:</p>
                   5274: 
                   5275:           <div class="itemizedlist">
                   5276:             <ul type="disc">
                   5277:               <li>
                   5278:                 <p><a xmlns=
                   5279:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5280:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45      wiz      5281:                 target="_top"><code xmlns="" class=
                   5282:                 "filename">pkgtools/pkgdiff</code></a>: Automate
1.20      ben      5283:                 making and maintaining patches for a package
1.34      wiz      5284:                 (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1       grant    5285:               </li>
                   5286: 
                   5287:               <li>
                   5288:                 <p><a xmlns=
                   5289:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5290:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.45      wiz      5291:                 target="_top"><code xmlns="" class=
                   5292:                 "filename">pkgtools/rpm2pkg</code></a>, <a xmlns=
1.20      ben      5293:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5294:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45      wiz      5295:                 target="_top"><code xmlns="" class=
                   5296:                 "filename">pkgtools/url2pkg</code></a>: Aids in
1.34      wiz      5297:                 converting to pkgsrc.</p>
1.1       grant    5298:               </li>
                   5299: 
                   5300:               <li>
                   5301:                 <p><a xmlns=
                   5302:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5303:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.45      wiz      5304:                 target="_top"><code xmlns="" class=
                   5305:                 "filename">pkgtools/gensolpkg</code></a>: Convert
1.34      wiz      5306:                 pkgsrc to a Solaris package.</p>
1.1       grant    5307:               </li>
                   5308:             </ul>
                   5309:           </div>
                   5310: 
1.47      reed     5311:           <p>Utilities for people maintaining pkgsrc (or: more
1.1       grant    5312:           obscure pkg utilities)</p>
                   5313: 
                   5314:           <div class="itemizedlist">
                   5315:             <ul type="disc">
                   5316:               <li>
                   5317:                 <p><a xmlns=
                   5318:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5319:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.45      wiz      5320:                 target="_top"><code xmlns="" class=
                   5321:                 "filename">pkgtools/pkg_comp</code></a>: Build
1.34      wiz      5322:                 packages in a chrooted area.</p>
1.1       grant    5323:               </li>
                   5324: 
                   5325:               <li>
                   5326:                 <p><a xmlns=
                   5327:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5328:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.45      wiz      5329:                 target="_top"><code xmlns="" class=
                   5330:                 "filename">pkgtools/libkver</code></a>: Spoof
                   5331:                 kernel version for chrooted cross builds.</p>
1.1       grant    5332:               </li>
                   5333:             </ul>
                   5334:           </div>
                   5335:         </div>
                   5336: 
1.59    ! rillig   5337:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5338:           <div class="titlepage">
                   5339:             <div>
                   5340:               <div>
                   5341:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   5342:                 "non-root-pkgsrc" id=
1.38      dillo    5343:                 "non-root-pkgsrc"></a>7.4.&nbsp;How to use pkgsrc
1.30      wiz      5344:                 as non-root</h2>
1.1       grant    5345:               </div>
                   5346:             </div>
                   5347:           </div>
                   5348: 
                   5349:           <p>If you want to use pkgsrc as non-root user, you can
                   5350:           set some variables to make pkgsrc work under these
1.33      jmmv     5351:           conditions. At the very least, you need to set
                   5352:           <code class="varname">UNPRIVILEGED</code> to
                   5353:           &#8220;<span class="quote">yes</span>&#8221;; this will
                   5354:           turn on unprivileged mode and set multiple related
                   5355:           variables to allow installation of packages as
                   5356:           non-root.</p>
                   5357: 
                   5358:           <p>In case the defaults are not enough, you may want to
                   5359:           tune some other variables used. For example, if the
                   5360:           automatic user/group detection leads to incorrect values
                   5361:           (or not the ones you would like to use), you can change
                   5362:           them by setting <code class=
                   5363:           "varname">UNPRIVILEGED_USER</code> and <code class=
                   5364:           "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
                   5365: 
                   5366:           <p>As regards bootstrapping, please note that the
                   5367:           <span><strong class="command">bootstrap</strong></span>
                   5368:           script will ease non-root configuration when given the
                   5369:           &#8220;<span class=
                   5370:           "quote">--ignore-user-check</span>&#8221; flag, as it
                   5371:           will choose and use multiple default directories under
1.45      wiz      5372:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5373:           class="filename">~/pkg</code> as the installation
1.33      jmmv     5374:           targets. These directories can be overriden by the
                   5375:           &#8220;<span class="quote">--prefix</span>&#8221; flag
                   5376:           provided by the script, as well as some others that allow
                   5377:           finer tuning of the tree layout.</p>
1.14      xtraeme  5378:         </div>
                   5379: 
1.59    ! rillig   5380:         <div class="sect1" lang="en" xml:lang="en">
1.14      xtraeme  5381:           <div class="titlepage">
                   5382:             <div>
                   5383:               <div>
                   5384:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   5385:                 "resume-transfers" id=
1.38      dillo    5386:                 "resume-transfers"></a>7.5.&nbsp;How to resume
1.30      wiz      5387:                 transfers when fetching distfiles?</h2>
1.14      xtraeme  5388:               </div>
                   5389:             </div>
                   5390:           </div>
                   5391: 
1.47      reed     5392:           <p>By default, resuming transfers in pkgsrc is disabled,
1.15      xtraeme  5393:           but you can enable this feature by adding the option
                   5394:           <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
1.45      wiz      5395:           into <code xmlns=
                   5396:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5397:           "filename">/etc/mk.conf</code>. If, during a fetch step,
                   5398:           an incomplete distfile is found, pkgsrc will try to
                   5399:           resume it.</p>
1.15      xtraeme  5400: 
                   5401:           <p>You can also use a different program than the default
1.24      wiz      5402:           <a href=
                   5403:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   5404:           <span class="citerefentry"><span class=
                   5405:           "refentrytitle">ftp</span>(1)</span></a> by changing the
                   5406:           <code class="varname">FETCH_CMD</code> variable. Don't
                   5407:           forget to set <code class=
                   5408:           "varname">FETCH_RESUME_ARGS</code> and <code class=
                   5409:           "varname">FETCH_OUTPUT_ARGS</code> if you are not using
                   5410:           default values.</p>
1.14      xtraeme  5411: 
1.45      wiz      5412:           <p>For example, if you want to use <code xmlns=
                   5413:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5414:           "filename">wget</code> to resume downloads, you'll have
                   5415:           to use something like:</p>
                   5416:           <pre class="programlisting">
1.51      rillig   5417:     FETCH_CMD=             wget
                   5418:     FETCH_BEFORE_ARGS=     --passive-ftp
                   5419:     FETCH_RESUME_ARGS=     -c
                   5420:     FETCH_OUTPUT_ARGS=     -O
1.14      xtraeme  5421: </pre>
1.1       grant    5422:         </div>
                   5423: 
1.59    ! rillig   5424:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5425:           <div class="titlepage">
                   5426:             <div>
                   5427:               <div>
                   5428:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   5429:                 "XFree86-from-pkgsrc" id=
1.38      dillo    5430:                 "XFree86-from-pkgsrc"></a>7.6.&nbsp;How can I
1.1       grant    5431:                 install/use XFree86 from pkgsrc?</h2>
                   5432:               </div>
                   5433:             </div>
                   5434:           </div>
                   5435: 
                   5436:           <p>If you want to use XFree86 from pkgsrc instead of your
1.45      wiz      5437:           system's own X11 (<code xmlns=
                   5438:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5439:           "filename">/usr/X11R6</code>, <code xmlns=
                   5440:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5441:           "filename">/usr/openwin</code>, ...), you will have to
1.45      wiz      5442:           add the following line into <code xmlns=
                   5443:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.15      xtraeme  5444:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    5445:           <pre class="programlisting">
1.51      rillig   5446:     X11_TYPE=XFree86
1.1       grant    5447: </pre>
                   5448:         </div>
                   5449: 
1.59    ! rillig   5450:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5451:           <div class="titlepage">
                   5452:             <div>
                   5453:               <div>
                   5454:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   5455:                 "x.org-from-pkgsrc" id=
1.38      dillo    5456:                 "x.org-from-pkgsrc"></a>7.7.&nbsp;How can I
1.1       grant    5457:                 install/use X.org from pkgsrc?</h2>
                   5458:               </div>
                   5459:             </div>
                   5460:           </div>
                   5461: 
                   5462:           <p>If you want to use X.org from pkgsrc instead of your
1.45      wiz      5463:           system's own X11 (<code xmlns=
                   5464:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5465:           "filename">/usr/X11R6</code>, <code xmlns=
                   5466:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5467:           "filename">/usr/openwin</code>, ...) you will have to add
1.45      wiz      5468:           the following line into <code xmlns=
                   5469:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.15      xtraeme  5470:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    5471:           <pre class="programlisting">
1.51      rillig   5472:     X11_TYPE=xorg
1.1       grant    5473: </pre>
                   5474:         </div>
                   5475: 
1.59    ! rillig   5476:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5477:           <div class="titlepage">
                   5478:             <div>
                   5479:               <div>
                   5480:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   5481:                 "fetch-behind-firewall" id=
1.38      dillo    5482:                 "fetch-behind-firewall"></a>7.8.&nbsp;How to fetch
1.30      wiz      5483:                 files from behind a firewall</h2>
1.1       grant    5484:               </div>
                   5485:             </div>
                   5486:           </div>
                   5487: 
                   5488:           <p>If you are sitting behind a firewall which does not
                   5489:           allow direct connections to Internet hosts (i.e.
                   5490:           non-NAT), you may specify the relevant proxy hosts. This
                   5491:           is done using an environment variable in the form of a
1.47      reed     5492:           URL, e.g. in Amdahl, the machine &#8220;<span class=
1.1       grant    5493:           "quote">orpheus.amdahl.com</span>&#8221; is one of the
                   5494:           firewalls, and it uses port 80 as the proxy port number.
                   5495:           So the proxy environment variables are:</p>
                   5496:           <pre class="programlisting">
1.51      rillig   5497:     ftp_proxy=ftp://orpheus.amdahl.com:80/
                   5498:     http_proxy=http://orpheus.amdahl.com:80/
1.1       grant    5499: </pre>
                   5500:         </div>
                   5501: 
1.59    ! rillig   5502:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5503:           <div class="titlepage">
                   5504:             <div>
                   5505:               <div>
                   5506:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   5507:                 "passive-ftp" id="passive-ftp"></a>7.9.&nbsp;How do
        !          5508:                 I tell <span><strong class="command">make
1.14      xtraeme  5509:                 fetch</strong></span> to do passive FTP?</h2>
1.1       grant    5510:               </div>
                   5511:             </div>
                   5512:           </div>
                   5513: 
                   5514:           <p>This depends on which utility is used to retrieve
1.45      wiz      5515:           distfiles. From <code xmlns=
                   5516:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5517:           "filename">bsd.pkg.mk</code>, <code class=
                   5518:           "varname">FETCH_CMD</code> is assigned the first
                   5519:           available command from the following list:</p>
1.34      wiz      5520: 
                   5521:           <div class="itemizedlist">
                   5522:             <ul type="disc">
                   5523:               <li>
1.45      wiz      5524:                 <p><code xmlns=
                   5525:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.34      wiz      5526:                 "filename">${LOCALBASE}/bin/ftp</code></p>
                   5527:               </li>
                   5528: 
                   5529:               <li>
1.45      wiz      5530:                 <p><code xmlns=
                   5531:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   5532:                 "filename">/usr/bin/ftp</code></p>
1.34      wiz      5533:               </li>
                   5534:             </ul>
                   5535:           </div>
1.1       grant    5536: 
                   5537:           <p>On a default NetBSD installation, this will be
1.45      wiz      5538:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5539:           class="filename">/usr/bin/ftp</code>, which automatically
                   5540:           tries passive connections first, and falls back to active
                   5541:           connections if the server refuses to do passive. For the
                   5542:           other tools, add the following to your <code xmlns=
                   5543:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5544:           "filename">/etc/mk.conf</code> file: <code class=
                   5545:           "varname">PASSIVE_FETCH=1</code>.</p>
1.1       grant    5546: 
1.45      wiz      5547:           <p>Having that option present will prevent <code xmlns=
                   5548:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5549:           "filename">/usr/bin/ftp</code> from falling back to
                   5550:           active transfers.</p>
1.1       grant    5551:         </div>
                   5552: 
1.59    ! rillig   5553:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5554:           <div class="titlepage">
                   5555:             <div>
                   5556:               <div>
                   5557:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   5558:                 "fetching-all-distfiles" id=
1.38      dillo    5559:                 "fetching-all-distfiles"></a>7.10.&nbsp;How to
1.1       grant    5560:                 fetch all distfiles at once</h2>
                   5561:               </div>
                   5562:             </div>
                   5563:           </div>
                   5564: 
                   5565:           <p>You would like to download all the distfiles in a
                   5566:           single batch from work or university, where you can't run
1.14      xtraeme  5567:           a <span><strong class="command">make
                   5568:           fetch</strong></span>. There is an archive of distfiles
                   5569:           on <a href=
1.1       grant    5570:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
                   5571:           target="_top">ftp.NetBSD.org</a>, but downloading the
                   5572:           entire directory may not be appropriate.</p>
                   5573: 
1.14      xtraeme  5574:           <p>The answer here is to do a <span><strong class=
1.45      wiz      5575:           "command">make fetch-list</strong></span> in <code xmlns=
                   5576:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     5577:           "filename">/usr/pkgsrc</code> or one of its
1.1       grant    5578:           subdirectories, carry the resulting list to your machine
1.23      wiz      5579:           at work/school and use it there. If you don't have a
1.24      wiz      5580:           NetBSD-compatible <a href=
                   5581:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   5582:           <span class="citerefentry"><span class=
                   5583:           "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
                   5584:           at work, don't forget to set <code class=
                   5585:           "varname">FETCH_CMD</code> to something that fetches a
                   5586:           URL:</p>
1.1       grant    5587: 
                   5588:           <p>At home:</p>
                   5589:           <pre class="screen">
1.14      xtraeme  5590: <code class="prompt">%</code> <strong class=
                   5591: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   5592: <code class="prompt">%</code> <strong class=
                   5593: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles &gt;/tmp/fetch.sh</code></strong>
                   5594: <code class="prompt">%</code> <strong class=
                   5595: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1       grant    5596: </pre>
                   5597: 
                   5598:           <p>At work:</p>
                   5599:           <pre class="screen">
1.14      xtraeme  5600: <code class="prompt">%</code> <strong class=
                   5601: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1       grant    5602: </pre>
                   5603: 
1.45      wiz      5604:           <p>then tar up <code xmlns=
                   5605:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5606:           "filename">/tmp/distfiles</code> and take it home.</p>
1.1       grant    5607: 
                   5608:           <p>If you have a machine running NetBSD, and you want to
                   5609:           get <span class="emphasis"><em>all</em></span> distfiles
                   5610:           (even ones that aren't for your machine architecture),
                   5611:           you can do so by using the above-mentioned
1.14      xtraeme  5612:           <span><strong class="command">make
                   5613:           fetch-list</strong></span> approach, or fetch the
                   5614:           distfiles directly by running:</p>
1.1       grant    5615:           <pre class="screen">
1.14      xtraeme  5616: <code class="prompt">%</code> <strong class=
                   5617: "userinput"><code>make mirror-distfiles</code></strong>
1.1       grant    5618: </pre>
                   5619: 
1.14      xtraeme  5620:           <p>If you even decide to ignore <code class=
                   5621:           "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
                   5622:           can get everything by running:</p>
1.1       grant    5623:           <pre class="screen">
1.14      xtraeme  5624: <code class="prompt">%</code> <strong class=
                   5625: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1       grant    5626: </pre>
                   5627:         </div>
                   5628: 
1.59    ! rillig   5629:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5630:           <div class="titlepage">
                   5631:             <div>
                   5632:               <div>
                   5633:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   5634:                 "tmac.andoc-missing" id=
1.38      dillo    5635:                 "tmac.andoc-missing"></a>7.11.&nbsp;What does
1.1       grant    5636:                 &#8220;<span class="quote">Don't know how to make
                   5637:                 /usr/share/tmac/tmac.andoc</span>&#8221; mean?</h2>
                   5638:               </div>
                   5639:             </div>
                   5640:           </div>
                   5641: 
                   5642:           <p>When compiling the <a xmlns=
                   5643:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5644:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45      wiz      5645:           target="_top"><code xmlns="" class=
                   5646:           "filename">pkgtools/pkg_install</code></a> package, you
                   5647:           get the error from make that it doesn't know how to make
                   5648:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5649:           class="filename">/usr/share/tmac/tmac.andoc</code>? This
                   5650:           indicates that you don't have installed the
1.23      wiz      5651:           &#8220;<span class="quote">text</span>&#8221; set (nroff,
                   5652:           ...) from the NetBSD base distribution on your machine.
1.47      reed     5653:           It is recommended to do that to format man pages.</p>
1.1       grant    5654: 
                   5655:           <p>In the case of the <a xmlns=
                   5656:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5657:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45      wiz      5658:           target="_top"><code xmlns="" class=
                   5659:           "filename">pkgtools/pkg_install</code></a> package, you
                   5660:           can get away with setting <code class=
1.20      ben      5661:           "varname">NOMAN=YES</code> either in the environment or
1.45      wiz      5662:           in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5663:           class="filename">/etc/mk.conf</code>.</p>
1.1       grant    5664:         </div>
                   5665: 
1.59    ! rillig   5666:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5667:           <div class="titlepage">
                   5668:             <div>
                   5669:               <div>
                   5670:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   5671:                 "bsd.own.mk-missing" id=
1.38      dillo    5672:                 "bsd.own.mk-missing"></a>7.12.&nbsp;What does
1.1       grant    5673:                 &#8220;<span class="quote">Could not find
                   5674:                 bsd.own.mk</span>&#8221; mean?</h2>
                   5675:               </div>
                   5676:             </div>
                   5677:           </div>
                   5678: 
1.45      wiz      5679:           <p>You didn't install the compiler set, <code xmlns=
                   5680:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5681:           "filename">comp.tgz</code>, when you installed your
1.47      reed     5682:           NetBSD machine. Please get and install it, by extracting
                   5683:           it in <code xmlns=
1.45      wiz      5684:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5685:           "filename">/</code>:</p>
1.1       grant    5686:           <pre class="screen">
1.14      xtraeme  5687: <code class="prompt">#</code> <strong class=
                   5688: "userinput"><code>cd /</code></strong>
                   5689: <code class="prompt">#</code> <strong class=
                   5690: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1       grant    5691: </pre>
                   5692: 
1.45      wiz      5693:           <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5694:           class="filename">comp.tgz</code> is part of every NetBSD
                   5695:           release. Get the one that corresponds to your release
                   5696:           (determine via <span><strong class="command">uname
                   5697:           -r</strong></span>).</p>
1.1       grant    5698:         </div>
                   5699: 
1.59    ! rillig   5700:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5701:           <div class="titlepage">
                   5702:             <div>
                   5703:               <div>
                   5704:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   5705:                 "using-sudo-with-pkgsrc" id=
1.38      dillo    5706:                 "using-sudo-with-pkgsrc"></a>7.13.&nbsp;Using
1.1       grant    5707:                 'sudo' with pkgsrc</h2>
                   5708:               </div>
                   5709:             </div>
                   5710:           </div>
                   5711: 
                   5712:           <p>When installing packages as non-root user and using
1.24      wiz      5713:           the just-in-time <a href=
                   5714:           "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
                   5715:           <span class="citerefentry"><span class=
                   5716:           "refentrytitle">su</span>(1)</span></a> feature of
                   5717:           pkgsrc, it can become annoying to type in the root
                   5718:           password for each required package installed. To avoid
                   5719:           this, the sudo package can be used, which does password
                   5720:           caching over a limited time. To use it, install sudo
                   5721:           (either as binary package or from <a xmlns=
                   5722:           "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    5723:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.45      wiz      5724:           target="_top"><code xmlns="" class=
                   5725:           "filename">security/sudo</code></a>) and then put the
                   5726:           following into your <code xmlns=
                   5727:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      5728:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    5729:           <pre class="programlisting">
1.51      rillig   5730:     .if exists(${LOCALBASE}/bin/sudo)
                   5731:     SU_CMD=        ${LOCALBASE}/bin/sudo /bin/sh -c
                   5732:     .endif
1.1       grant    5733: </pre>
                   5734:         </div>
                   5735: 
1.59    ! rillig   5736:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5737:           <div class="titlepage">
                   5738:             <div>
                   5739:               <div>
                   5740:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   5741:                 "faq.conf" id="faq.conf"></a>7.14.&nbsp;How do I
        !          5742:                 change the location of configuration files?</h2>
1.1       grant    5743:               </div>
                   5744:             </div>
                   5745:           </div>
                   5746: 
1.35      jmmv     5747:           <p>As the system administrator, you can choose where
                   5748:           configuration files are installed. The default settings
1.45      wiz      5749:           make all these files go into <code xmlns=
                   5750:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     5751:           "filename">${PREFIX}/etc</code> or some of its
                   5752:           subdirectories; this may be suboptimal depending on your
                   5753:           expectations (e.g., a read-only, NFS-exported
                   5754:           <code class="varname">PREFIX</code> with a need of
                   5755:           per-machine configuration of the provided packages).</p>
                   5756: 
                   5757:           <p>In order to change the defaults, you can modify the
                   5758:           <code class="varname">PKG_SYSCONFBASE</code> variable (in
1.45      wiz      5759:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5760:           class="filename">/etc/mk.conf</code>) to point to your
                   5761:           preferred configuration directory; some common examples
                   5762:           include <code xmlns=
                   5763:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5764:           "filename">/etc</code> or <code xmlns=
                   5765:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5766:           "filename">/etc/pkg</code>.</p>
1.35      jmmv     5767: 
                   5768:           <p>Furthermore, you can change this value on a
                   5769:           per-package basis by setting the <code class=
                   5770:           "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   5771:           variable. <code class="varname">PKG_SYSCONFVAR</code>'s
                   5772:           value usually matches the name of the package you would
                   5773:           like to modify, that is, the contents of <code class=
                   5774:           "varname">PKGBASE</code>.</p>
1.1       grant    5775: 
1.47      reed     5776:           <p>Note that after changing these settings, you must
1.35      jmmv     5777:           rebuild and reinstall any affected packages.</p>
1.1       grant    5778:         </div>
                   5779: 
1.59    ! rillig   5780:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    5781:           <div class="titlepage">
                   5782:             <div>
                   5783:               <div>
                   5784:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   5785:                 "audit-packages" id=
1.38      dillo    5786:                 "audit-packages"></a>7.15.&nbsp;Automated security
1.1       grant    5787:                 checks</h2>
                   5788:               </div>
                   5789:             </div>
                   5790:           </div>
                   5791: 
                   5792:           <p>Please be aware that there can often be bugs in
                   5793:           third-party software, and some of these bugs can leave a
                   5794:           machine vulnerable to exploitation by attackers. In an
                   5795:           effort to lessen the exposure, the NetBSD packages team
                   5796:           maintains a database of known-exploits to packages which
                   5797:           have at one time been included in pkgsrc. The database
                   5798:           can be downloaded automatically, and a security audit of
                   5799:           all packages installed on a system can take place. To do
                   5800:           this, install the <a xmlns=
                   5801:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5802:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45      wiz      5803:           target="_top"><code xmlns="" class=
                   5804:           "filename">security/audit-packages</code></a> package. It
1.20      ben      5805:           has two components:</p>
1.1       grant    5806: 
                   5807:           <div class="orderedlist">
                   5808:             <ol type="1">
                   5809:               <li>
1.34      wiz      5810:                 <p><span><strong class=
                   5811:                 "command">download-vulnerability-list</strong></span>,
1.1       grant    5812:                 an easy way to download a list of the security
                   5813:                 vulnerabilities information. This list is kept up
                   5814:                 to date by the NetBSD security officer and the
                   5815:                 NetBSD packages team, and is distributed from the
                   5816:                 NetBSD ftp server:</p>
                   5817: 
                   5818:                 <p><a href=
                   5819:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20      ben      5820:                 target=
                   5821:                 "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1       grant    5822:               </li>
                   5823: 
                   5824:               <li>
1.34      wiz      5825:                 <p><span><strong class=
                   5826:                 "command">audit-packages</strong></span>, an easy
                   5827:                 way to audit the current machine, checking each
1.1       grant    5828:                 vulnerability which is known. If a vulnerable
                   5829:                 package is installed, it will be shown by output to
                   5830:                 stdout, including a description of the type of
                   5831:                 vulnerability, and a URL containing more
                   5832:                 information.</p>
                   5833:               </li>
                   5834:             </ol>
                   5835:           </div>
                   5836: 
1.23      wiz      5837:           <p>Use of the <a xmlns=
                   5838:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5839:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45      wiz      5840:           target="_top"><code xmlns="" class=
                   5841:           "filename">security/audit-packages</code></a> package is
1.23      wiz      5842:           strongly recommended! After &#8220;<span class=
                   5843:           "quote">audit-packages</span>&#8221; is installed, please
                   5844:           read the package's message, which you can get by running
                   5845:           <strong class="userinput"><code>pkg_info -D
                   5846:           audit-package</code></strong>.</p>
1.58      erh      5847: 
                   5848:           <p>If this package is installed, pkgsrc builds will use
                   5849:           it to perform a security check before building any
                   5850:           package. See <a href="#variables-affecting-build" title=
                   5851:           "5.2.&nbsp;Variables affecting the build process">Section&nbsp;5.2,
                   5852:           &#8220;Variables affecting the build process&#8221;</a>
1.59    ! rillig   5853:           for ways to control this check.</p>
1.1       grant    5854:         </div>
                   5855:       </div>
                   5856:     </div>
                   5857: 
1.59    ! rillig   5858:     <div class="part" lang="en" xml:lang="en">
1.1       grant    5859:       <div class="titlepage">
                   5860:         <div>
                   5861:           <div>
1.59    ! rillig   5862:             <h1 class="title"><a name="developers-guide" id=
1.48      dillo    5863:             "developers-guide"></a>Part&nbsp;II.&nbsp;The pkgsrc
                   5864:             developer's guide</h1>
1.1       grant    5865:           </div>
                   5866:         </div>
                   5867:       </div>
                   5868: 
                   5869:       <div class="toc">
                   5870:         <p><b>Table of Contents</b></p>
                   5871: 
                   5872:         <dl>
1.38      dillo    5873:           <dt><span class="chapter"><a href="#components">8.
1.27      rillig   5874:           Package components - files, directories and
                   5875:           contents</a></span></dt>
                   5876: 
                   5877:           <dd>
                   5878:             <dl>
                   5879:               <dt><span class="sect1"><a href=
1.45      wiz      5880:               "#components.Makefile">8.1. <code xmlns=
                   5881:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   5882:               "filename">Makefile</code></a></span></dt>
                   5883: 
                   5884:               <dt><span class="sect1"><a href=
1.45      wiz      5885:               "#components.distinfo">8.2. <code xmlns=
                   5886:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   5887:               "filename">distinfo</code></a></span></dt>
                   5888: 
                   5889:               <dt><span class="sect1"><a href=
1.38      dillo    5890:               "#components.patches">8.3. patches/*</a></span></dt>
1.27      rillig   5891: 
1.30      wiz      5892:               <dt><span class="sect1"><a href=
1.38      dillo    5893:               "#other-mandatory-files">8.4. Other mandatory
1.30      wiz      5894:               files</a></span></dt>
1.27      rillig   5895: 
                   5896:               <dt><span class="sect1"><a href=
1.38      dillo    5897:               "#components.optional">8.5. Optional
1.27      rillig   5898:               files</a></span></dt>
                   5899: 
1.38      dillo    5900:               <dt><span class="sect1"><a href="#work-dir">8.6.
1.45      wiz      5901:               <code xmlns=
                   5902:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   5903:               "filename">work*</code></a></span></dt>
1.27      rillig   5904: 
1.38      dillo    5905:               <dt><span class="sect1"><a href="#files-dir">8.7.
1.45      wiz      5906:               <code xmlns=
                   5907:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   5908:               "filename">files/*</code></a></span></dt>
1.27      rillig   5909:             </dl>
                   5910:           </dd>
                   5911: 
1.38      dillo    5912:           <dt><span class="chapter"><a href="#makefile">9.
1.45      wiz      5913:           Programming in <code xmlns=
                   5914:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.25      rillig   5915:           "filename">Makefile</code>s</a></span></dt>
                   5916: 
                   5917:           <dd>
                   5918:             <dl>
                   5919:               <dt><span class="sect1"><a href=
1.45      wiz      5920:               "#makefile.variables">9.1. <code xmlns=
                   5921:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.25      rillig   5922:               "filename">Makefile</code> variables</a></span></dt>
                   5923: 
1.27      rillig   5924:               <dd>
                   5925:                 <dl>
                   5926:                   <dt><span class="sect2"><a href=
1.38      dillo    5927:                   "#makefile.variables.names">9.1.1. Naming
1.27      rillig   5928:                   conventions</a></span></dt>
                   5929:                 </dl>
                   5930:               </dd>
                   5931: 
1.38      dillo    5932:               <dt><span class="sect1"><a href="#makefile.code">9.2.
1.25      rillig   5933:               Code snippets</a></span></dt>
                   5934: 
                   5935:               <dd>
                   5936:                 <dl>
                   5937:                   <dt><span class="sect2"><a href=
1.38      dillo    5938:                   "#adding-to-list">9.2.1. Adding things to a
1.25      rillig   5939:                   list</a></span></dt>
                   5940: 
                   5941:                   <dt><span class="sect2"><a href=
1.38      dillo    5942:                   "#converting-internal-to-external">9.2.2.
1.30      wiz      5943:                   Converting an internal list into an external
                   5944:                   list</a></span></dt>
1.25      rillig   5945: 
                   5946:                   <dt><span class="sect2"><a href=
1.38      dillo    5947:                   "#passing-variable-to-shell">9.2.3. Passing
1.30      wiz      5948:                   variables to a shell command</a></span></dt>
1.27      rillig   5949: 
                   5950:                   <dt><span class="sect2"><a href=
1.38      dillo    5951:                   "#quoting-guideline">9.2.4. Quoting
1.27      rillig   5952:                   guideline</a></span></dt>
                   5953: 
                   5954:                   <dt><span class="sect2"><a href=
1.38      dillo    5955:                   "#bsd-make-bug-workaround">9.2.5. Workaround for
1.30      wiz      5956:                   a bug in BSD Make</a></span></dt>
1.25      rillig   5957:                 </dl>
                   5958:               </dd>
                   5959:             </dl>
                   5960:           </dd>
                   5961: 
1.38      dillo    5962:           <dt><span class="chapter"><a href="#plist">10. PLIST
1.1       grant    5963:           issues</a></span></dt>
                   5964: 
                   5965:           <dd>
                   5966:             <dl>
1.38      dillo    5967:               <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1       grant    5968:               ID</a></span></dt>
                   5969: 
1.30      wiz      5970:               <dt><span class="sect1"><a href=
1.38      dillo    5971:               "#automatic-plist-generation">10.2. Semi-automatic
1.45      wiz      5972:               <code xmlns=
                   5973:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   5974:               "filename">PLIST</code> generation</a></span></dt>
1.1       grant    5975: 
1.38      dillo    5976:               <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14      xtraeme  5977:               Tweaking output of <span><strong class="command">make
                   5978:               print-PLIST</strong></span></a></span></dt>
1.1       grant    5979: 
1.38      dillo    5980:               <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1       grant    5981:               Variable substitution in PLIST</a></span></dt>
                   5982: 
1.30      wiz      5983:               <dt><span class="sect1"><a href=
1.48      dillo    5984:               "#manpage-compression">10.5. Man page
                   5985:               compression</a></span></dt>
1.1       grant    5986: 
1.30      wiz      5987:               <dt><span class="sect1"><a href=
1.38      dillo    5988:               "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30      wiz      5989:               <code class=
1.14      xtraeme  5990:               "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    5991: 
1.30      wiz      5992:               <dt><span class="sect1"><a href=
1.47      reed     5993:               "#platform-specific-plist">10.7. Platform-specific
1.38      dillo    5994:               and differing PLISTs</a></span></dt>
1.1       grant    5995: 
                   5996:               <dt><span class="sect1"><a href=
1.38      dillo    5997:               "#faq.common-dirs">10.8. Sharing directories between
1.1       grant    5998:               packages</a></span></dt>
                   5999:             </dl>
                   6000:           </dd>
                   6001: 
1.38      dillo    6002:           <dt><span class="chapter"><a href="#buildlink">11.
1.1       grant    6003:           Buildlink methodology</a></span></dt>
                   6004: 
                   6005:           <dd>
                   6006:             <dl>
1.30      wiz      6007:               <dt><span class="sect1"><a href=
1.38      dillo    6008:               "#converting-to-buildlink3">11.1. Converting packages
1.30      wiz      6009:               to use buildlink3</a></span></dt>
1.1       grant    6010: 
1.30      wiz      6011:               <dt><span class="sect1"><a href=
1.45      wiz      6012:               "#creating-buildlink3.mk">11.2. Writing <code xmlns=
                   6013:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      6014:               "filename">buildlink3.mk</code> files</a></span></dt>
1.1       grant    6015: 
                   6016:               <dd>
                   6017:                 <dl>
                   6018:                   <dt><span class="sect2"><a href=
1.38      dillo    6019:                   "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30      wiz      6020:                   buildlink3.mk file</a></span></dt>
1.1       grant    6021: 
                   6022:                   <dt><span class="sect2"><a href=
1.38      dillo    6023:                   "#updating-buildlink-depends">11.2.2. Updating
1.30      wiz      6024:                   <code class=
1.59    ! rillig   6025:                   "varname">BUILDLINK_DEPENDS.<em class="replaceable">
        !          6026:                   <code>pkg</code></em></code> in <code xmlns=
1.45      wiz      6027:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      6028:                   "filename">buildlink3.mk</code>
1.1       grant    6029:                   files</a></span></dt>
                   6030:                 </dl>
                   6031:               </dd>
                   6032: 
1.30      wiz      6033:               <dt><span class="sect1"><a href=
1.45      wiz      6034:               "#writing-builtin.mk">11.3. Writing <code xmlns=
                   6035:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      6036:               "filename">builtin.mk</code> files</a></span></dt>
1.1       grant    6037: 
                   6038:               <dd>
                   6039:                 <dl>
                   6040:                   <dt><span class="sect2"><a href=
1.38      dillo    6041:                   "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45      wiz      6042:                   <code xmlns=
                   6043:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   6044:                   "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    6045: 
                   6046:                   <dt><span class="sect2"><a href=
1.38      dillo    6047:                   "#native-or-pkgsrc-preference">11.3.2. Global
1.30      wiz      6048:                   preferences for native or pkgsrc
                   6049:                   software</a></span></dt>
1.1       grant    6050:                 </dl>
                   6051:               </dd>
                   6052:             </dl>
                   6053:           </dd>
                   6054: 
1.38      dillo    6055:           <dt><span class="chapter"><a href="#pkginstall">12. The
1.35      jmmv     6056:           pkginstall framework</a></span></dt>
                   6057: 
                   6058:           <dd>
                   6059:             <dl>
                   6060:               <dt><span class="sect1"><a href=
1.38      dillo    6061:               "#files-and-dirs-outside-prefix">12.1. Files and
1.35      jmmv     6062:               directories outside the installation
                   6063:               prefix</a></span></dt>
                   6064: 
                   6065:               <dd>
                   6066:                 <dl>
                   6067:                   <dt><span class="sect2"><a href=
1.38      dillo    6068:                   "#dirs-outside-prefix">12.1.1. Directory
1.35      jmmv     6069:                   manipulation</a></span></dt>
                   6070: 
                   6071:                   <dt><span class="sect2"><a href=
1.38      dillo    6072:                   "#files-outside-prefix">12.1.2. File
1.35      jmmv     6073:                   manipulation</a></span></dt>
                   6074:                 </dl>
                   6075:               </dd>
                   6076: 
1.38      dillo    6077:               <dt><span class="sect1"><a href="#conf-files">12.2.
1.35      jmmv     6078:               Configuration files</a></span></dt>
                   6079: 
                   6080:               <dd>
                   6081:                 <dl>
                   6082:                   <dt><span class="sect2"><a href=
1.38      dillo    6083:                   "#conf-files-sysconfdir">12.2.1. How <code class=
1.35      jmmv     6084:                   "varname">PKG_SYSCONFDIR</code> is
                   6085:                   set</a></span></dt>
                   6086: 
                   6087:                   <dt><span class="sect2"><a href=
1.38      dillo    6088:                   "#conf-files-configure">12.2.2. Telling the
1.47      reed     6089:                   software where configuration files
1.35      jmmv     6090:                   are</a></span></dt>
                   6091: 
                   6092:                   <dt><span class="sect2"><a href=
1.38      dillo    6093:                   "#conf-files-patching">12.2.3. Patching
1.35      jmmv     6094:                   installations</a></span></dt>
                   6095: 
                   6096:                   <dt><span class="sect2"><a href=
1.38      dillo    6097:                   "#conf-files-disable">12.2.4. Disabling handling
1.35      jmmv     6098:                   of configuration files</a></span></dt>
                   6099:                 </dl>
                   6100:               </dd>
                   6101: 
1.38      dillo    6102:               <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35      jmmv     6103:               System startup scripts</a></span></dt>
                   6104: 
                   6105:               <dd>
                   6106:                 <dl>
                   6107:                   <dt><span class="sect2"><a href=
1.38      dillo    6108:                   "#rcd-scripts-disable">12.3.1. Disabling handling
1.35      jmmv     6109:                   of system startup scripts</a></span></dt>
                   6110:                 </dl>
                   6111:               </dd>
                   6112: 
                   6113:               <dt><span class="sect1"><a href=
1.38      dillo    6114:               "#users-and-groups">12.4. System users and
1.35      jmmv     6115:               groups</a></span></dt>
                   6116: 
1.38      dillo    6117:               <dt><span class="sect1"><a href="#shells">12.5.
1.35      jmmv     6118:               System shells</a></span></dt>
                   6119: 
                   6120:               <dd>
                   6121:                 <dl>
                   6122:                   <dt><span class="sect2"><a href=
1.38      dillo    6123:                   "#shells-disable">12.5.1. Disabling handling of
1.35      jmmv     6124:                   configuration files</a></span></dt>
                   6125:                 </dl>
                   6126:               </dd>
                   6127:             </dl>
                   6128:           </dd>
                   6129: 
1.38      dillo    6130:           <dt><span class="chapter"><a href="#options">13. Options
1.1       grant    6131:           handling</a></span></dt>
                   6132: 
                   6133:           <dd>
                   6134:             <dl>
1.30      wiz      6135:               <dt><span class="sect1"><a href=
1.38      dillo    6136:               "#global-default-options">13.1. Global default
1.30      wiz      6137:               options</a></span></dt>
1.1       grant    6138: 
1.30      wiz      6139:               <dt><span class="sect1"><a href=
1.38      dillo    6140:               "#converting-to-options">13.2. Converting packages to
1.45      wiz      6141:               use <code xmlns=
                   6142:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6143:               "filename">bsd.options.mk</code></a></span></dt>
1.48      dillo    6144: 
                   6145:               <dt><span class="sect1"><a href="#option-names">13.3.
                   6146:               Option Names</a></span></dt>
1.1       grant    6147:             </dl>
                   6148:           </dd>
                   6149: 
1.38      dillo    6150:           <dt><span class="chapter"><a href="#build">14. The build
1.1       grant    6151:           process</a></span></dt>
                   6152: 
                   6153:           <dd>
                   6154:             <dl>
1.56      rillig   6155:               <dt><span class="sect1"><a href="#build.intro">14.1.
                   6156:               Introduction</a></span></dt>
                   6157: 
                   6158:               <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1       grant    6159:               Program location</a></span></dt>
                   6160: 
1.56      rillig   6161:               <dt><span class="sect1"><a href=
                   6162:               "#build.builddirs">14.3. Directories used during the
                   6163:               build process</a></span></dt>
1.1       grant    6164: 
                   6165:               <dt><span class="sect1"><a href=
1.56      rillig   6166:               "#build.running">14.4. Running a
                   6167:               phase</a></span></dt>
                   6168: 
                   6169:               <dt><span class="sect1"><a href="#build.fetch">14.5.
                   6170:               The <span class="emphasis"><em>fetch</em></span>
                   6171:               phase</a></span></dt>
                   6172: 
                   6173:               <dt><span class="sect1"><a href=
                   6174:               "#build.checksum">14.6. The <span class=
                   6175:               "emphasis"><em>checksum</em></span>
                   6176:               phase</a></span></dt>
                   6177: 
                   6178:               <dt><span class="sect1"><a href=
                   6179:               "#build.extract">14.7. The <span class=
                   6180:               "emphasis"><em>extract</em></span>
                   6181:               phase</a></span></dt>
                   6182: 
                   6183:               <dt><span class="sect1"><a href="#build.patch">14.8.
                   6184:               The <span class="emphasis"><em>patch</em></span>
                   6185:               phase</a></span></dt>
                   6186: 
                   6187:               <dt><span class="sect1"><a href="#build.tools">14.9.
                   6188:               The <span class="emphasis"><em>tools</em></span>
                   6189:               phase</a></span></dt>
                   6190: 
                   6191:               <dt><span class="sect1"><a href=
                   6192:               "#build.wrapper">14.10. The <span class=
                   6193:               "emphasis"><em>wrapper</em></span>
                   6194:               phase</a></span></dt>
                   6195: 
                   6196:               <dt><span class="sect1"><a href=
                   6197:               "#build.configure">14.11. The <span class=
                   6198:               "emphasis"><em>configure</em></span>
                   6199:               phase</a></span></dt>
                   6200: 
                   6201:               <dt><span class="sect1"><a href="#build.build">14.12.
                   6202:               The <span class="emphasis"><em>build</em></span>
                   6203:               phase</a></span></dt>
                   6204: 
                   6205:               <dt><span class="sect1"><a href="#build.test">14.13.
                   6206:               The <span class="emphasis"><em>test</em></span>
                   6207:               phase</a></span></dt>
                   6208: 
                   6209:               <dt><span class="sect1"><a href=
                   6210:               "#build.install">14.14. The <span class=
                   6211:               "emphasis"><em>install</em></span>
                   6212:               phase</a></span></dt>
                   6213: 
                   6214:               <dt><span class="sect1"><a href=
                   6215:               "#build.package">14.15. The <span class=
                   6216:               "emphasis"><em>package</em></span>
                   6217:               phase</a></span></dt>
                   6218: 
                   6219:               <dt><span class="sect1"><a href=
                   6220:               "#build.helpful-targets">14.16. Other helpful
1.1       grant    6221:               targets</a></span></dt>
                   6222:             </dl>
                   6223:           </dd>
                   6224: 
1.55      rillig   6225:           <dt><span class="chapter"><a href="#fixes">15. Making
                   6226:           your package work</a></span></dt>
1.1       grant    6227: 
                   6228:           <dd>
                   6229:             <dl>
1.30      wiz      6230:               <dt><span class="sect1"><a href=
1.38      dillo    6231:               "#general-operation">15.1. General
1.30      wiz      6232:               operation</a></span></dt>
1.1       grant    6233: 
                   6234:               <dd>
                   6235:                 <dl>
                   6236:                   <dt><span class="sect2"><a href=
1.38      dillo    6237:                   "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30      wiz      6238:                   pull in variables from
                   6239:                   /etc/mk.conf</a></span></dt>
1.1       grant    6240: 
                   6241:                   <dt><span class="sect2"><a href=
1.38      dillo    6242:                   "#where-to-install-documentation">15.1.2. Where
1.31      wiz      6243:                   to install documentation</a></span></dt>
                   6244: 
                   6245:                   <dt><span class="sect2"><a href=
1.38      dillo    6246:                   "#restricted-packages">15.1.3. Restricted
1.1       grant    6247:                   packages</a></span></dt>
                   6248: 
                   6249:                   <dt><span class="sect2"><a href=
1.38      dillo    6250:                   "#dependencies">15.1.4. Handling
1.1       grant    6251:                   dependencies</a></span></dt>
                   6252: 
                   6253:                   <dt><span class="sect2"><a href=
1.38      dillo    6254:                   "#conflicts">15.1.5. Handling conflicts with
1.1       grant    6255:                   other packages</a></span></dt>
                   6256: 
                   6257:                   <dt><span class="sect2"><a href=
1.38      dillo    6258:                   "#not-building-packages">15.1.6. Packages that
1.30      wiz      6259:                   cannot or should not be built</a></span></dt>
1.1       grant    6260: 
                   6261:                   <dt><span class="sect2"><a href=
1.38      dillo    6262:                   "#undeletable-packages">15.1.7. Packages which
1.30      wiz      6263:                   should not be deleted, once
                   6264:                   installed</a></span></dt>
1.1       grant    6265: 
                   6266:                   <dt><span class="sect2"><a href=
1.38      dillo    6267:                   "#security-handling">15.1.8. Handling packages
1.1       grant    6268:                   with security problems</a></span></dt>
                   6269: 
                   6270:                   <dt><span class="sect2"><a href=
1.38      dillo    6271:                   "#compiler-bugs">15.1.9. How to handle compiler
1.1       grant    6272:                   bugs</a></span></dt>
                   6273: 
                   6274:                   <dt><span class="sect2"><a href=
1.38      dillo    6275:                   "#bumping-pkgrevision">15.1.10. How to handle
1.30      wiz      6276:                   incrementing versions when fixing an existing
1.1       grant    6277:                   package</a></span></dt>
                   6278: 
                   6279:                   <dt><span class="sect2"><a href=
1.38      dillo    6280:                   "#portability-of-packages">15.1.11. Portability
1.30      wiz      6281:                   of packages</a></span></dt>
1.1       grant    6282:                 </dl>
                   6283:               </dd>
                   6284: 
1.30      wiz      6285:               <dt><span class="sect1"><a href=
1.38      dillo    6286:               "#downloading-issues">15.2. Possible downloading
1.30      wiz      6287:               issues</a></span></dt>
1.1       grant    6288: 
                   6289:               <dd>
                   6290:                 <dl>
                   6291:                   <dt><span class="sect2"><a href=
1.38      dillo    6292:                   "#no-plain-download">15.2.1. Packages whose
1.30      wiz      6293:                   distfiles aren't available for plain
1.1       grant    6294:                   downloading</a></span></dt>
                   6295: 
                   6296:                   <dt><span class="sect2"><a href=
1.38      dillo    6297:                   "#modified-distfiles-same-name">15.2.2. How to
1.30      wiz      6298:                   handle modified distfiles with the 'old'
                   6299:                   name</a></span></dt>
1.1       grant    6300:                 </dl>
                   6301:               </dd>
                   6302: 
1.30      wiz      6303:               <dt><span class="sect1"><a href=
1.38      dillo    6304:               "#configuration-gotchas">15.3. Configuration
1.30      wiz      6305:               gotchas</a></span></dt>
1.1       grant    6306: 
                   6307:               <dd>
                   6308:                 <dl>
                   6309:                   <dt><span class="sect2"><a href=
1.38      dillo    6310:                   "#fixes.libtool">15.3.1. Shared libraries -
1.1       grant    6311:                   libtool</a></span></dt>
                   6312: 
                   6313:                   <dt><span class="sect2"><a href=
1.38      dillo    6314:                   "#using-libtool">15.3.2. Using libtool on GNU
1.1       grant    6315:                   packages that already support
                   6316:                   libtool</a></span></dt>
                   6317: 
                   6318:                   <dt><span class="sect2"><a href=
1.38      dillo    6319:                   "#autoconf-automake">15.3.3. GNU
1.1       grant    6320:                   Autoconf/Automake</a></span></dt>
                   6321:                 </dl>
                   6322:               </dd>
                   6323: 
1.55      rillig   6324:               <dt><span class="sect1"><a href="#fixes-build">15.4.
                   6325:               Building the package</a></span></dt>
1.1       grant    6326: 
                   6327:               <dd>
                   6328:                 <dl>
                   6329:                   <dt><span class="sect2"><a href=
1.38      dillo    6330:                   "#cpp-defines">15.4.1. CPP
1.30      wiz      6331:                   defines</a></span></dt>
1.51      rillig   6332: 
                   6333:                   <dt><span class="sect2"><a href=
                   6334:                   "#cpp-list">15.4.2. Getting a list of CPP
                   6335:                   defines</a></span></dt>
1.1       grant    6336:                 </dl>
                   6337:               </dd>
                   6338: 
1.30      wiz      6339:               <dt><span class="sect1"><a href=
1.38      dillo    6340:               "#package-specific-actions">15.5. Package specific
1.30      wiz      6341:               actions</a></span></dt>
1.1       grant    6342: 
                   6343:               <dd>
                   6344:                 <dl>
                   6345:                   <dt><span class="sect2"><a href=
1.38      dillo    6346:                   "#user-interaction">15.5.1. User
1.2       hubertf  6347:                   interaction</a></span></dt>
1.1       grant    6348: 
                   6349:                   <dt><span class="sect2"><a href=
1.38      dillo    6350:                   "#handling-licenses">15.5.2. Handling
1.1       grant    6351:                   licenses</a></span></dt>
                   6352: 
                   6353:                   <dt><span class="sect2"><a href=
1.38      dillo    6354:                   "#installing-score-files">15.5.3. Installing
1.30      wiz      6355:                   score files</a></span></dt>
1.1       grant    6356: 
                   6357:                   <dt><span class="sect2"><a href=
1.38      dillo    6358:                   "#perl-scripts">15.5.4. Packages containing perl
1.1       grant    6359:                   scripts</a></span></dt>
                   6360: 
                   6361:                   <dt><span class="sect2"><a href=
1.38      dillo    6362:                   "#hardcoded-paths">15.5.5. Packages with
1.30      wiz      6363:                   hardcoded paths to other
                   6364:                   interpreters</a></span></dt>
1.1       grant    6365: 
                   6366:                   <dt><span class="sect2"><a href=
1.38      dillo    6367:                   "#perl-modules">15.5.6. Packages installing perl
1.1       grant    6368:                   modules</a></span></dt>
                   6369: 
                   6370:                   <dt><span class="sect2"><a href=
1.38      dillo    6371:                   "#faq.info-files">15.5.7. Packages installing
1.1       grant    6372:                   info files</a></span></dt>
                   6373: 
                   6374:                   <dt><span class="sect2"><a href=
1.57      minskim  6375:                   "#manpages">15.5.8. Packages installing man
                   6376:                   pages</a></span></dt>
                   6377: 
                   6378:                   <dt><span class="sect2"><a href=
                   6379:                   "#gconf2-data-files">15.5.9. Packages installing
1.30      wiz      6380:                   GConf2 data files</a></span></dt>
1.1       grant    6381: 
                   6382:                   <dt><span class="sect2"><a href=
1.57      minskim  6383:                   "#scrollkeeper-data-files">15.5.10. Packages
1.30      wiz      6384:                   installing scrollkeeper data
                   6385:                   files</a></span></dt>
1.1       grant    6386: 
                   6387:                   <dt><span class="sect2"><a href=
1.57      minskim  6388:                   "#x11-fonts">15.5.11. Packages installing X11
1.1       grant    6389:                   fonts</a></span></dt>
                   6390: 
                   6391:                   <dt><span class="sect2"><a href=
1.57      minskim  6392:                   "#gtk2-modules">15.5.12. Packages installing GTK2
1.1       grant    6393:                   modules</a></span></dt>
                   6394: 
                   6395:                   <dt><span class="sect2"><a href=
1.57      minskim  6396:                   "#sgml-xml-data">15.5.13. Packages installing
1.30      wiz      6397:                   SGML or XML data</a></span></dt>
1.1       grant    6398: 
                   6399:                   <dt><span class="sect2"><a href=
1.57      minskim  6400:                   "#mime-database">15.5.14. Packages installing
1.1       grant    6401:                   extensions to the MIME database</a></span></dt>
                   6402: 
                   6403:                   <dt><span class="sect2"><a href=
1.57      minskim  6404:                   "#intltool">15.5.15. Packages using
1.1       grant    6405:                   intltool</a></span></dt>
1.18      xtraeme  6406: 
                   6407:                   <dt><span class="sect2"><a href=
1.57      minskim  6408:                   "#startup-scripts">15.5.16. Packages installing
1.30      wiz      6409:                   startup scripts</a></span></dt>
1.57      minskim  6410: 
                   6411:                   <dt><span class="sect2"><a href=
                   6412:                   "#tex-packages">15.5.17. Packages installing TeX
                   6413:                   modules</a></span></dt>
1.1       grant    6414:                 </dl>
                   6415:               </dd>
                   6416: 
1.30      wiz      6417:               <dt><span class="sect1"><a href=
1.38      dillo    6418:               "#feedback-to-author">15.6. Feedback to the
1.30      wiz      6419:               author</a></span></dt>
1.1       grant    6420:             </dl>
                   6421:           </dd>
                   6422: 
1.38      dillo    6423:           <dt><span class="chapter"><a href="#debug">16.
1.1       grant    6424:           Debugging</a></span></dt>
                   6425: 
1.38      dillo    6426:           <dt><span class="chapter"><a href="#submit">17.
1.1       grant    6427:           Submitting and Committing</a></span></dt>
                   6428: 
                   6429:           <dd>
                   6430:             <dl>
1.30      wiz      6431:               <dt><span class="sect1"><a href=
1.38      dillo    6432:               "#submitting-your-package">17.1. Submitting your
1.30      wiz      6433:               packages</a></span></dt>
1.1       grant    6434: 
1.30      wiz      6435:               <dt><span class="sect1"><a href=
1.41      wiz      6436:               "#general-notes-for-changes">17.2. General notes when
                   6437:               adding, updating, or removing
                   6438:               packages</a></span></dt>
                   6439: 
                   6440:               <dt><span class="sect1"><a href=
                   6441:               "#committing-importing">17.3. Committing: Importing a
1.30      wiz      6442:               package into CVS</a></span></dt>
1.1       grant    6443: 
1.30      wiz      6444:               <dt><span class="sect1"><a href=
1.41      wiz      6445:               "#updating-package">17.4. Updating a package to a
1.30      wiz      6446:               newer version</a></span></dt>
1.1       grant    6447: 
1.30      wiz      6448:               <dt><span class="sect1"><a href=
1.41      wiz      6449:               "#moving-package">17.5. Moving a package in
1.30      wiz      6450:               pkgsrc</a></span></dt>
1.1       grant    6451:             </dl>
                   6452:           </dd>
                   6453:         </dl>
                   6454:       </div>
                   6455: 
1.59    ! rillig   6456:       <div class="chapter" lang="en" xml:lang="en">
1.1       grant    6457:         <div class="titlepage">
                   6458:           <div>
                   6459:             <div>
1.59    ! rillig   6460:               <h2 class="title"><a name="components" id=
1.38      dillo    6461:               "components"></a>Chapter&nbsp;8.&nbsp;Package
1.27      rillig   6462:               components - files, directories and contents</h2>
1.25      rillig   6463:             </div>
                   6464:           </div>
                   6465:         </div>
                   6466: 
                   6467:         <div class="toc">
                   6468:           <p><b>Table of Contents</b></p>
                   6469: 
                   6470:           <dl>
                   6471:             <dt><span class="sect1"><a href=
1.45      wiz      6472:             "#components.Makefile">8.1. <code xmlns=
                   6473:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6474:             "filename">Makefile</code></a></span></dt>
                   6475: 
                   6476:             <dt><span class="sect1"><a href=
1.45      wiz      6477:             "#components.distinfo">8.2. <code xmlns=
                   6478:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6479:             "filename">distinfo</code></a></span></dt>
                   6480: 
                   6481:             <dt><span class="sect1"><a href=
1.38      dillo    6482:             "#components.patches">8.3. patches/*</a></span></dt>
1.25      rillig   6483: 
1.30      wiz      6484:             <dt><span class="sect1"><a href=
1.38      dillo    6485:             "#other-mandatory-files">8.4. Other mandatory
1.30      wiz      6486:             files</a></span></dt>
1.25      rillig   6487: 
1.27      rillig   6488:             <dt><span class="sect1"><a href=
1.38      dillo    6489:             "#components.optional">8.5. Optional
1.27      rillig   6490:             files</a></span></dt>
1.25      rillig   6491: 
1.38      dillo    6492:             <dt><span class="sect1"><a href="#work-dir">8.6.
1.45      wiz      6493:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6494:             class="filename">work*</code></a></span></dt>
1.25      rillig   6495: 
1.38      dillo    6496:             <dt><span class="sect1"><a href="#files-dir">8.7.
1.45      wiz      6497:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6498:             class="filename">files/*</code></a></span></dt>
1.25      rillig   6499:           </dl>
                   6500:         </div>
                   6501: 
1.27      rillig   6502:         <p>Whenever you're preparing a package, there are a number
                   6503:         of files involved which are described in the following
                   6504:         sections.</p>
1.25      rillig   6505: 
1.59    ! rillig   6506:         <div class="sect1" lang="en" xml:lang="en">
1.25      rillig   6507:           <div class="titlepage">
                   6508:             <div>
                   6509:               <div>
                   6510:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   6511:                 "components.Makefile" id=
1.45      wiz      6512:                 "components.Makefile"></a>8.1.&nbsp;<code xmlns=
                   6513:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6514:                 "filename">Makefile</code></h2>
1.25      rillig   6515:               </div>
                   6516:             </div>
                   6517:           </div>
                   6518: 
1.27      rillig   6519:           <p>Building, installation and creation of a binary
1.45      wiz      6520:           package are all controlled by the package's <code xmlns=
                   6521:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6522:           "filename">Makefile</code>. The <code xmlns=
                   6523:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6524:           "filename">Makefile</code> describes various things about
                   6525:           a package, for example from where to get it, how to
                   6526:           configure, build, and install it.</p>
                   6527: 
1.45      wiz      6528:           <p>A package <code xmlns=
                   6529:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6530:           "filename">Makefile</code> contains several sections that
                   6531:           describe the package.</p>
1.25      rillig   6532: 
1.27      rillig   6533:           <p>In the first section there are the following
                   6534:           variables, which should appear exactly in the order given
                   6535:           here.</p>
1.25      rillig   6536: 
                   6537:           <div class="itemizedlist">
                   6538:             <ul type="disc">
                   6539:               <li>
1.27      rillig   6540:                 <p><code class="varname">DISTNAME</code> is the
                   6541:                 basename of the distribution file to be downloaded
                   6542:                 from the package's website.</p>
                   6543:               </li>
                   6544: 
                   6545:               <li>
                   6546:                 <p><code class="varname">PKGNAME</code> is the name
                   6547:                 of the package, as used by pkgsrc. You only need to
1.50      rillig   6548:                 provide it if it differs from <code class=
                   6549:                 "varname">DISTNAME</code>. Usually it is the
                   6550:                 directory name together with the version number. It
                   6551:                 must match the regular expression <code class=
1.27      rillig   6552:                 "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
                   6553:                 that is, it starts with a letter or digit, and
                   6554:                 contains only letters, digits, dashes, underscores,
                   6555:                 dots and plus signs.</p>
1.25      rillig   6556:               </li>
                   6557: 
                   6558:               <li>
1.27      rillig   6559:                 <p><code class="varname">CATEGORIES</code> is a
                   6560:                 list of categories which the package fits in. You
                   6561:                 can choose any of the top-level directories of
                   6562:                 pkgsrc for it.</p>
1.45      wiz      6563: 
                   6564:                 <p>Currently the following values are available for
                   6565:                 <code class="varname">CATEGORIES</code>. If more
                   6566:                 than one is used, they need to be separated by
                   6567:                 spaces:</p>
                   6568:                 <pre class="programlisting">
1.51      rillig   6569:     archivers     cross         geography     meta-pkgs     security
                   6570:     audio         databases     graphics      misc          shells
                   6571:     benchmarks    devel         ham           multimedia    sysutils
                   6572:     biology       editors       inputmethod   net           textproc
                   6573:     cad           emulators     lang          news          time
                   6574:     chat          finance       mail          parallel      wm
                   6575:     comms         fonts         math          pkgtools      www
                   6576:     converters    games         mbone         print         x11
1.45      wiz      6577: </pre>
1.25      rillig   6578:               </li>
                   6579: 
                   6580:               <li>
1.27      rillig   6581:                 <p><code class="varname">MASTER_SITES</code> is a
                   6582:                 list of URLs where the distribution files can be
                   6583:                 downloaded. Each URL must end with a slash.</p>
1.45      wiz      6584: 
                   6585:                 <p>The <code class="varname">MASTER_SITES</code>
                   6586:                 may make use of the following predefined sites:</p>
                   6587:                 <pre class="programlisting">
1.51      rillig   6588:     ${MASTER_SITE_APACHE}
                   6589:     ${MASTER_SITE_BACKUP}
                   6590:     ${MASTER_SITE_CYGWIN}
                   6591:     ${MASTER_SITE_DEBIAN}
                   6592:     ${MASTER_SITE_FREEBSD}
                   6593:     ${MASTER_SITE_FREEBSD_LOCAL}
                   6594:     ${MASTER_SITE_GNOME}
                   6595:     ${MASTER_SITE_GNU}
                   6596:     ${MASTER_SITE_GNUSTEP}
                   6597:     ${MASTER_SITE_IFARCHIVE}
                   6598:     ${MASTER_SITE_MOZILLA}
                   6599:     ${MASTER_SITE_OPENOFFICE}
                   6600:     ${MASTER_SITE_PERL_CPAN}
                   6601:     ${MASTER_SITE_R_CRAN}
                   6602:     ${MASTER_SITE_SOURCEFORGE}
                   6603:     ${MASTER_SITE_SUNSITE}
                   6604:     ${MASTER_SITE_SUSE}
                   6605:     ${MASTER_SITE_TEX_CTAN}
                   6606:     ${MASTER_SITE_XCONTRIB}
                   6607:     ${MASTER_SITE_XEMACS}
1.45      wiz      6608: </pre>
                   6609: 
                   6610:                 <p>If one of these predefined sites is chosen, you
                   6611:                 may want to specify a subdirectory of that site.
                   6612:                 Since these macros may expand to more than one
                   6613:                 actual site, you <span class=
                   6614:                 "emphasis"><em>must</em></span> use the following
                   6615:                 construct to specify a subdirectory:</p>
                   6616:                 <pre class="programlisting">
1.51      rillig   6617:     ${MASTER_SITE_GNU:=subdirectory/name/}
                   6618:     ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.45      wiz      6619: </pre>
                   6620: 
                   6621:                 <p>Note the trailing slash after the subdirectory
                   6622:                 name.</p>
                   6623: 
                   6624:                 <p>If the package has multiple <code class=
                   6625:                 "varname">DISTFILES</code> or multiple <code class=
                   6626:                 "varname">PATCHFILES</code> from different sites,
                   6627:                 set <code class="varname">SITES_foo</code> to a
1.47      reed     6628:                 list of URIs where file &#8220;<span class=
1.45      wiz      6629:                 "quote">foo</span>&#8221; may be found.
                   6630:                 &#8220;<span class="quote">foo</span>&#8221;
1.47      reed     6631:                 includes the suffix, e.g.:</p>
1.45      wiz      6632:                 <pre class="programlisting">
1.51      rillig   6633:     DISTFILES=      ${DISTNAME}${EXTRACT_SUFX}
                   6634:     DISTFILES+=     foo-file.tar.gz
                   6635:     SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
                   6636:             http://www.somewhereelse.com/mirror/somehow/
1.45      wiz      6637: </pre>
                   6638:               </li>
                   6639: 
                   6640:               <li>
                   6641:                 <p><code class="varname">DISTFILES</code>: Name(s)
                   6642:                 of archive file(s) containing distribution. The
                   6643:                 default is <code xmlns=
                   6644:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6645:                 "filename">${DISTNAME}${EXTRACT_SUFX}</code>.
                   6646:                 Should only be set if you have more than one
                   6647:                 distfile.</p>
                   6648: 
                   6649:                 <p>Note that the normal default setting of
                   6650:                 <code class="varname">DISTFILES</code> must be made
                   6651:                 explicit if you want to add to it (rather than
                   6652:                 replace it), as you usually would.</p>
                   6653:               </li>
                   6654: 
                   6655:               <li>
                   6656:                 <p><code class="varname">EXTRACT_SUFX</code>:
                   6657:                 Suffix of the distribution file, will be appended
                   6658:                 to <code class="varname">DISTNAME</code>. Defaults
                   6659:                 to <code xmlns=
                   6660:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6661:                 "filename">.tar.gz</code>.</p>
                   6662:               </li>
                   6663:             </ul>
                   6664:           </div>
                   6665: 
                   6666:           <p>The second section contains information about
                   6667:           separately downloaded patches, if any.</p>
                   6668: 
                   6669:           <div class="itemizedlist">
                   6670:             <ul type="disc">
                   6671:               <li>
1.47      reed     6672:                 <p><code class="varname">PATCHFILES:</code> Name(s)
1.45      wiz      6673:                 of additional files that contain distribution
                   6674:                 patches. There is no default. pkgsrc will look for
                   6675:                 them at <code class="varname">PATCH_SITES</code>.
                   6676:                 They will automatically be uncompressed before
                   6677:                 patching if the names end with <code xmlns=
                   6678:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6679:                 "filename">.gz</code> or <code xmlns=
                   6680:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6681:                 "filename">.Z</code>.</p>
                   6682:               </li>
                   6683: 
                   6684:               <li>
                   6685:                 <p><code class="varname">PATCH_SITES</code>:
                   6686:                 Primary location(s) for distribution patch files
                   6687:                 (see <code class="varname">PATCHFILES</code> below)
                   6688:                 if not found locally.</p>
1.25      rillig   6689:               </li>
                   6690:             </ul>
                   6691:           </div>
                   6692: 
1.45      wiz      6693:           <p>The third section contains the following
1.27      rillig   6694:           variables.</p>
1.25      rillig   6695: 
1.27      rillig   6696:           <div class="itemizedlist">
                   6697:             <ul type="disc">
                   6698:               <li>
                   6699:                 <p><code class="varname">MAINTAINER</code> is the
1.50      rillig   6700:                 email address of the person who feels responsible
                   6701:                 for this package, and who is most likely to look at
                   6702:                 problems or questions regarding this package which
                   6703:                 have been reported with <a href=
1.45      wiz      6704:                 "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
                   6705:                 <span class="citerefentry"><span class=
1.50      rillig   6706:                 "refentrytitle">send-pr</span>(1)</span></a>. Other
                   6707:                 developers should contact the <code class=
                   6708:                 "varname">MAINTAINER</code> before making major
                   6709:                 changes to the package. When packaging a new
                   6710:                 program, set <code class=
                   6711:                 "varname">MAINTAINER</code> to yourself. If you
                   6712:                 really can't maintain the package for future
                   6713:                 updates, set it to <code class="email">&lt;<a href=
1.45      wiz      6714:                 "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>&gt;</code>.</p>
1.27      rillig   6715:               </li>
1.25      rillig   6716: 
1.27      rillig   6717:               <li>
                   6718:                 <p><code class="varname">HOMEPAGE</code> is a URL
                   6719:                 where users can find more information about the
1.23      wiz      6720:                 package.</p>
                   6721:               </li>
1.1       grant    6722: 
1.23      wiz      6723:               <li>
                   6724:                 <p><code class="varname">COMMENT</code> is a
1.45      wiz      6725:                 one-line description of the package (should not
                   6726:                 include the package name).</p>
1.23      wiz      6727:               </li>
                   6728:             </ul>
                   6729:           </div>
1.1       grant    6730: 
1.45      wiz      6731:           <p>Other variables that affect the build:</p>
1.1       grant    6732: 
1.45      wiz      6733:           <div class="itemizedlist">
                   6734:             <ul type="disc">
                   6735:               <li>
                   6736:                 <p><code class="varname">WRKSRC</code>: The
1.50      rillig   6737:                 directory where the interesting distribution files
                   6738:                 of the package are found. The default is
                   6739:                 <code xmlns=
                   6740:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6741:                 "filename">${WRKDIR}/${DISTNAME}</code>, which
                   6742:                 works for most packages.</p>
                   6743: 
                   6744:                 <p>If a package doesn't create a subdirectory for
                   6745:                 itself (most GNU software does, for instance), but
                   6746:                 extracts itself in the current directory, you
                   6747:                 should set <code class="varname">WRKSRC=
                   6748:                 ${WRKDIR}</code>.</p>
                   6749: 
                   6750:                 <p>If a package doesn't create a subdirectory with
                   6751:                 the name of <code class="varname">DISTNAME</code>
                   6752:                 but some different name, set <code class=
                   6753:                 "varname">WRKSRC</code> to point to the proper name
                   6754:                 in <code xmlns=
                   6755:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6756:                 "filename">${WRKDIR}</code>, for example
                   6757:                 <code class="varname">WRKSRC=
                   6758:                 ${WRKDIR}/${DISTNAME}/unix</code>. See <a xmlns=
                   6759:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6760:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
                   6761:                 target="_top"><code xmlns="" class=
                   6762:                 "filename">lang/tcl</code></a> and <a xmlns=
                   6763:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6764:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
                   6765:                 target="_top"><code xmlns="" class=
                   6766:                 "filename">x11/tk</code></a> for other
                   6767:                 examples.</p>
                   6768: 
                   6769:                 <p>The name of the working directory created by
                   6770:                 pkgsrc is taken from the <code class=
                   6771:                 "varname">WRKDIR_BASENAME</code> variable. By
                   6772:                 default, its value is <code xmlns=
                   6773:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6774:                 "filename">work</code>. If you want to use the same
                   6775:                 pkgsrc tree for building different kinds of binary
                   6776:                 packages, you can change the variable according to
                   6777:                 your needs. Two other variables handle common cases
                   6778:                 of setting <code class=
                   6779:                 "varname">WRKDIR_BASENAME</code> individually. If
                   6780:                 <code class="varname">OBJHOSTNAME</code> is defined
                   6781:                 in <code xmlns=
1.45      wiz      6782:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.50      rillig   6783:                 "filename">/etc/mk.conf</code>, the first component
                   6784:                 of the host's name is attached to the directory
                   6785:                 name. If <code class="varname">OBJMACHINE</code> is
                   6786:                 defined, the platform name is attached, which might
                   6787:                 look like <code xmlns=
                   6788:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6789:                 "filename">work.i386</code> or <code xmlns=
1.45      wiz      6790:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.50      rillig   6791:                 "filename">work.sparc</code>.</p>
1.45      wiz      6792:               </li>
                   6793:             </ul>
1.1       grant    6794:           </div>
                   6795: 
                   6796:           <p>Please pay attention to the following gotchas:</p>
                   6797: 
                   6798:           <div class="itemizedlist">
                   6799:             <ul type="disc">
                   6800:               <li>
1.14      xtraeme  6801:                 <p>Add <code class="varname">MANCOMPRESSED</code>
1.47      reed     6802:                 if man pages are installed in compressed form by
                   6803:                 the package; see comment in <code xmlns=
1.45      wiz      6804:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6805:                 "filename">bsd.pkg.mk</code>.</p>
1.1       grant    6806:               </li>
                   6807: 
                   6808:               <li>
1.45      wiz      6809:                 <p>Replace <code xmlns=
                   6810:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6811:                 "filename">/usr/local</code> with
                   6812:                 &#8220;<span class="quote">${PREFIX}</span>&#8221;
                   6813:                 in all files (see patches, below).</p>
1.1       grant    6814:               </li>
                   6815: 
                   6816:               <li>
                   6817:                 <p>If the package installs any info files, see
                   6818:                 <a href="#faq.info-files" title=
1.45      wiz      6819:                 "15.5.7.&nbsp;Packages installing info files">Section&nbsp;15.5.7,
                   6820:                 &#8220;Packages installing info
1.1       grant    6821:                 files&#8221;</a>.</p>
                   6822:               </li>
                   6823:             </ul>
                   6824:           </div>
                   6825:         </div>
                   6826: 
1.59    ! rillig   6827:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    6828:           <div class="titlepage">
                   6829:             <div>
                   6830:               <div>
                   6831:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   6832:                 "components.distinfo" id=
1.45      wiz      6833:                 "components.distinfo"></a>8.2.&nbsp;<code xmlns=
                   6834:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6835:                 "filename">distinfo</code></h2>
1.1       grant    6836:               </div>
                   6837:             </div>
                   6838:           </div>
                   6839: 
1.50      rillig   6840:           <p>The <code xmlns=
                   6841:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6842:           "filename">distinfo</code> file contains the message
                   6843:           digest, or checksum, of each distfile needed for the
                   6844:           package. This ensures that the distfiles retrieved from
                   6845:           the Internet have not been corrupted during transfer or
                   6846:           altered by a malign force to introduce a security hole.
                   6847:           Due to recent rumor about weaknesses of digest
                   6848:           algorithms, all distfiles are protected using both SHA1
                   6849:           and RMD160 message digests, as well as the file size.</p>
                   6850: 
                   6851:           <p>The <code xmlns=
                   6852:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6853:           "filename">distinfo</code> file also contains the
                   6854:           checksums for all the patches found in the <code xmlns=
                   6855:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6856:           "filename">patches</code> directory (see <a href=
                   6857:           "#components.patches" title=
                   6858:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
                   6859:           &#8220;patches/*&#8221;</a>).</p>
                   6860: 
                   6861:           <p>To regenerate the <code xmlns=
                   6862:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6863:           "filename">distinfo</code> file, use the
1.14      xtraeme  6864:           <span><strong class="command">make
1.50      rillig   6865:           makedistinfo</strong></span> or <span><strong class=
                   6866:           "command">make mdi</strong></span> command.</p>
1.1       grant    6867: 
1.50      rillig   6868:           <p>Some packages have different sets of distfiles
                   6869:           depending on the platform, for example <a xmlns=
1.1       grant    6870:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   6871:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.45      wiz      6872:           target="_top"><code xmlns="" class=
                   6873:           "filename">www/navigator</code></a>). These are kept in
1.50      rillig   6874:           the same <code xmlns=
1.45      wiz      6875:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.50      rillig   6876:           "filename">distinfo</code> file and care should be taken
                   6877:           when upgrading such a package to ensure distfile
                   6878:           information is not lost.</p>
1.1       grant    6879:         </div>
                   6880: 
1.59    ! rillig   6881:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    6882:           <div class="titlepage">
                   6883:             <div>
                   6884:               <div>
                   6885:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   6886:                 "components.patches" id=
1.38      dillo    6887:                 "components.patches"></a>8.3.&nbsp;patches/*</h2>
1.1       grant    6888:               </div>
                   6889:             </div>
                   6890:           </div>
                   6891: 
                   6892:           <p>This directory contains files that are used by the
                   6893:           <a href=
                   6894:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   6895:           <span class="citerefentry"><span class=
                   6896:           "refentrytitle">patch</span>(1)</span></a> command to
                   6897:           modify the sources as distributed in the distribution
                   6898:           file into a form that will compile and run perfectly on
                   6899:           NetBSD. The files are applied successively in alphabetic
                   6900:           order (as returned by a shell &#8220;<span class=
                   6901:           "quote">patches/patch-*</span>&#8221; glob expansion), so
1.45      wiz      6902:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6903:           class="filename">patch-aa</code> is applied before
                   6904:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6905:           class="filename">patch-ab</code>, etc.</p>
                   6906: 
                   6907:           <p>The <code xmlns=
                   6908:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6909:           "filename">patch-*</code> files should be in
                   6910:           <span><strong class="command">diff -bu</strong></span>
                   6911:           format, and apply without a fuzz to avoid problems. (To
                   6912:           force patches to apply with fuzz you can set <code class=
1.14      xtraeme  6913:           "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1       grant    6914:           not put changes for more than one file into a single
1.47      reed     6915:           patch file, as this will make future modifications more
1.1       grant    6916:           difficult.</p>
                   6917: 
                   6918:           <p>Similar, a file should be patched at most once, not
                   6919:           several times by several different patches. If a file
                   6920:           needs several patches, they should be combined into one
                   6921:           file.</p>
                   6922: 
                   6923:           <p>One important thing to mention is to pay attention
                   6924:           that no RCS IDs get stored in the patch files, as these
                   6925:           will cause problems when later checked into the NetBSD
1.14      xtraeme  6926:           CVS tree. Use the <span><strong class=
                   6927:           "command">pkgdiff</strong></span> from the <a xmlns=
1.1       grant    6928:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   6929:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45      wiz      6930:           target="_top"><code xmlns="" class=
                   6931:           "filename">pkgtools/pkgdiff</code></a> package to avoid
1.20      ben      6932:           these problems.</p>
1.1       grant    6933: 
                   6934:           <p>For even more automation, we recommend using
1.14      xtraeme  6935:           <span><strong class="command">mkpatches</strong></span>
                   6936:           from the same package to make a whole set of patches. You
                   6937:           just have to backup files before you edit them to
1.45      wiz      6938:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6939:           class="filename">filename.orig</code>, e.g. with
1.14      xtraeme  6940:           <span><strong class="command">cp -p filename
                   6941:           filename.orig</strong></span> or, easier, by using
                   6942:           <span><strong class="command">pkgvi</strong></span> again
                   6943:           from the same package. If you upgrade a package this way,
                   6944:           you can easily compare the new set of patches with the
                   6945:           previously existing one with <span><strong class=
                   6946:           "command">patchdiff</strong></span>.</p>
1.1       grant    6947: 
                   6948:           <p>When you have finished a package, remember to generate
                   6949:           the checksums for the patch files by using the
1.14      xtraeme  6950:           <span><strong class="command">make
                   6951:           makepatchsum</strong></span> command, see <a href=
                   6952:           "#components.distinfo" title=
1.38      dillo    6953:           "8.2.&nbsp;distinfo">Section&nbsp;8.2,
1.45      wiz      6954:           &#8220;<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6955:           class="filename">distinfo</code>&#8221;</a>.</p>
1.1       grant    6956: 
1.46      gdt      6957:           <p>When adding a patch that corrects a problem in the
                   6958:           distfile (rather than e.g. enforcing pkgsrc's view of
                   6959:           where man pages should go), send the patch as a bug
                   6960:           report to the maintainer. This benefits non-pkgsrc users
                   6961:           of the package, and usually enables removing the patch in
                   6962:           future version.</p>
                   6963: 
1.1       grant    6964:           <p>Patch files that are distributed by the author or
1.14      xtraeme  6965:           other maintainers can be listed in <code class=
                   6966:           "varname">$PATCHFILES</code>.</p>
1.1       grant    6967: 
                   6968:           <p>If it is desired to store any patches that should not
                   6969:           be committed into pkgsrc, they can be kept outside the
1.45      wiz      6970:           pkgsrc tree in the <code xmlns=
                   6971:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6972:           "filename">$LOCALPATCHES</code> directory. The directory
1.1       grant    6973:           tree there is expected to have the same
                   6974:           &#8220;<span class="quote">category/package</span>&#8221;
                   6975:           structure as pkgsrc, and patches are expected to be
1.45      wiz      6976:           stored inside these dirs (also known as <code xmlns=
                   6977:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     6978:           "filename">$LOCALPATCHES/$PKGPATH</code>). For example,
                   6979:           if you want to keep a private patch for <code xmlns=
1.45      wiz      6980:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6981:           "filename">pkgsrc/graphics/png</code>, keep it in
1.45      wiz      6982:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6983:           class=
1.14      xtraeme  6984:           "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
                   6985:           files in the named directory are expected to be patch
1.1       grant    6986:           files, and <span class="emphasis"><em>they are applied
                   6987:           after pkgsrc patches are applied</em></span>.</p>
1.27      rillig   6988:         </div>
                   6989: 
1.59    ! rillig   6990:         <div class="sect1" lang="en" xml:lang="en">
1.27      rillig   6991:           <div class="titlepage">
                   6992:             <div>
                   6993:               <div>
                   6994:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   6995:                 "other-mandatory-files" id=
1.38      dillo    6996:                 "other-mandatory-files"></a>8.4.&nbsp;Other
1.27      rillig   6997:                 mandatory files</h2>
                   6998:               </div>
                   6999:             </div>
                   7000:           </div>
                   7001: 
                   7002:           <div class="variablelist">
                   7003:             <dl>
1.45      wiz      7004:               <dt><span class="term"><code xmlns=
                   7005:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7006:               "filename">DESCR</code></span></dt>
                   7007: 
                   7008:               <dd>
                   7009:                 <p>A multi-line description of the piece of
                   7010:                 software. This should include any credits where
                   7011:                 they are due. Please bear in mind that others do
                   7012:                 not share your sense of humour (or spelling
                   7013:                 idiosyncrasies), and that others will read
                   7014:                 everything that you write here.</p>
                   7015:               </dd>
                   7016: 
1.45      wiz      7017:               <dt><span class="term"><code xmlns=
                   7018:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7019:               "filename">PLIST</code></span></dt>
                   7020: 
                   7021:               <dd>
                   7022:                 <p>This file governs the files that are installed
                   7023:                 on your system: all the binaries, manual pages,
                   7024:                 etc. There are other directives which may be
                   7025:                 entered in this file, to control the creation and
                   7026:                 deletion of directories, and the location of
                   7027:                 inserted files. See <a href="#plist" title=
1.38      dillo    7028:                 "Chapter&nbsp;10.&nbsp;PLIST issues">Chapter&nbsp;10,
1.27      rillig   7029:                 <i>PLIST issues</i></a> for more information.</p>
                   7030:               </dd>
                   7031:             </dl>
                   7032:           </div>
                   7033:         </div>
                   7034: 
1.59    ! rillig   7035:         <div class="sect1" lang="en" xml:lang="en">
1.27      rillig   7036:           <div class="titlepage">
                   7037:             <div>
                   7038:               <div>
                   7039:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   7040:                 "components.optional" id=
1.38      dillo    7041:                 "components.optional"></a>8.5.&nbsp;Optional
1.27      rillig   7042:                 files</h2>
                   7043:               </div>
                   7044:             </div>
                   7045:           </div>
                   7046: 
                   7047:           <div class="variablelist">
                   7048:             <dl>
1.45      wiz      7049:               <dt><span class="term"><code xmlns=
                   7050:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7051:               "filename">INSTALL</code></span></dt>
                   7052: 
                   7053:               <dd>
                   7054:                 <p>This shell script is invoked twice by <a href=
                   7055:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7056:                 <span class="citerefentry"><span class=
                   7057:                 "refentrytitle">pkg_add</span>(1)</span></a>. First
                   7058:                 time after package extraction and before files are
                   7059:                 moved in place, the second time after the files to
                   7060:                 install are moved in place. This can be used to do
                   7061:                 any custom procedures not possible with @exec
1.45      wiz      7062:                 commands in <code xmlns=
                   7063:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7064:                 "filename">PLIST</code>. See <a href=
1.27      rillig   7065:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7066:                 <span class="citerefentry"><span class=
                   7067:                 "refentrytitle">pkg_add</span>(1)</span></a> and
                   7068:                 <a href=
                   7069:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   7070:                 <span class="citerefentry"><span class=
                   7071:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   7072:                 more information.</p>
                   7073:               </dd>
                   7074: 
1.45      wiz      7075:               <dt><span class="term"><code xmlns=
                   7076:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7077:               "filename">DEINSTALL</code></span></dt>
                   7078: 
                   7079:               <dd>
                   7080:                 <p>This script is executed before and after any
                   7081:                 files are removed. It is this script's
                   7082:                 responsibility to clean up any additional messy
                   7083:                 details around the package's installation, since
                   7084:                 all pkg_delete knows is how to delete the files
                   7085:                 created in the original distribution. See <a href=
                   7086:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   7087:                 <span class="citerefentry"><span class=
                   7088:                 "refentrytitle">pkg_delete</span>(1)</span></a> and
                   7089:                 <a href=
                   7090:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   7091:                 <span class="citerefentry"><span class=
                   7092:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   7093:                 more information.</p>
                   7094:               </dd>
                   7095: 
1.45      wiz      7096:               <dt><span class="term"><code xmlns=
                   7097:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7098:               "filename">MESSAGE</code></span></dt>
                   7099: 
                   7100:               <dd>
1.50      rillig   7101:                 <p>This file is displayed after installation of the
1.27      rillig   7102:                 package. Useful for things like legal notices on
                   7103:                 almost-free software and hints for updating config
                   7104:                 files after installing modules for apache, PHP etc.
                   7105:                 Please note that you can modify variables in it
                   7106:                 easily by using <code class=
                   7107:                 "varname">MESSAGE_SUBST</code> in the package's
1.45      wiz      7108:                 <code xmlns=
                   7109:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7110:                 "filename">Makefile</code>:</p>
1.27      rillig   7111:                 <pre class="programlisting">
1.51      rillig   7112:     MESSAGE_SUBST+=  SOMEVAR="somevalue"
1.27      rillig   7113: </pre>
                   7114: 
                   7115:                 <p>replaces "${SOMEVAR}" with &#8220;<span class=
1.45      wiz      7116:                 "quote">somevalue</span>&#8221; in <code xmlns=
                   7117:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7118:                 "filename">MESSAGE</code>.</p>
                   7119:               </dd>
                   7120:             </dl>
                   7121:           </div>
                   7122:         </div>
                   7123: 
1.59    ! rillig   7124:         <div class="sect1" lang="en" xml:lang="en">
1.27      rillig   7125:           <div class="titlepage">
                   7126:             <div>
                   7127:               <div>
                   7128:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   7129:                 "work-dir" id="work-dir"></a>8.6.&nbsp;<code xmlns=
1.45      wiz      7130:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7131:                 "filename">work*</code></h2>
                   7132:               </div>
                   7133:             </div>
                   7134:           </div>
                   7135: 
                   7136:           <p>When you type <span><strong class=
1.47      reed     7137:           "command">make</strong></span>, the distribution files
                   7138:           are unpacked into the directory denoted by <code class=
1.45      wiz      7139:           "varname">WRKDIR</code>. It can be removed by running
                   7140:           <span><strong class="command">make clean</strong></span>.
                   7141:           Besides the sources, this directory is also used to keep
                   7142:           various timestamp files. The directory gets <span class=
                   7143:           "emphasis"><em>removed completely</em></span> on clean.
                   7144:           The default is <code xmlns=
                   7145:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   7146:           "filename">${.CURDIR}/work</code> or <code xmlns=
                   7147:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   7148:           "filename">${.CURDIR}/work.${MACHINE_ARCH}</code> if
                   7149:           <code class="varname">OBJMACHINE</code> is set.</p>
1.27      rillig   7150:         </div>
                   7151: 
1.59    ! rillig   7152:         <div class="sect1" lang="en" xml:lang="en">
1.27      rillig   7153:           <div class="titlepage">
                   7154:             <div>
                   7155:               <div>
                   7156:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   7157:                 "files-dir" id=
1.45      wiz      7158:                 "files-dir"></a>8.7.&nbsp;<code xmlns=
                   7159:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7160:                 "filename">files/*</code></h2>
                   7161:               </div>
                   7162:             </div>
                   7163:           </div>
                   7164: 
                   7165:           <p>If you have any files that you wish to be placed in
                   7166:           the package prior to configuration or building, you could
                   7167:           place these files here and use a &#8220;<span class=
                   7168:           "quote">${CP}</span>&#8221; command in the
                   7169:           &#8220;<span class="quote">pre-configure</span>&#8221;
                   7170:           target to achieve this. Alternatively, you could simply
1.45      wiz      7171:           diff the file against <code xmlns=
                   7172:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7173:           "filename">/dev/null</code> and use the patch mechanism
                   7174:           to manage the creation of this file.</p>
                   7175:         </div>
                   7176:       </div>
                   7177: 
1.59    ! rillig   7178:       <div class="chapter" lang="en" xml:lang="en">
1.27      rillig   7179:         <div class="titlepage">
                   7180:           <div>
                   7181:             <div>
1.59    ! rillig   7182:               <h2 class="title"><a name="makefile" id=
1.38      dillo    7183:               "makefile"></a>Chapter&nbsp;9.&nbsp;Programming in
1.45      wiz      7184:               <code xmlns=
                   7185:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   7186:               "filename">Makefile</code>s</h2>
1.27      rillig   7187:             </div>
                   7188:           </div>
                   7189:         </div>
                   7190: 
                   7191:         <div class="toc">
                   7192:           <p><b>Table of Contents</b></p>
                   7193: 
                   7194:           <dl>
                   7195:             <dt><span class="sect1"><a href=
1.45      wiz      7196:             "#makefile.variables">9.1. <code xmlns=
                   7197:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7198:             "filename">Makefile</code> variables</a></span></dt>
                   7199: 
                   7200:             <dd>
                   7201:               <dl>
                   7202:                 <dt><span class="sect2"><a href=
1.38      dillo    7203:                 "#makefile.variables.names">9.1.1. Naming
1.27      rillig   7204:                 conventions</a></span></dt>
                   7205:               </dl>
                   7206:             </dd>
                   7207: 
1.38      dillo    7208:             <dt><span class="sect1"><a href="#makefile.code">9.2.
1.27      rillig   7209:             Code snippets</a></span></dt>
                   7210: 
                   7211:             <dd>
                   7212:               <dl>
1.30      wiz      7213:                 <dt><span class="sect2"><a href=
1.38      dillo    7214:                 "#adding-to-list">9.2.1. Adding things to a
1.30      wiz      7215:                 list</a></span></dt>
1.27      rillig   7216: 
1.30      wiz      7217:                 <dt><span class="sect2"><a href=
1.38      dillo    7218:                 "#converting-internal-to-external">9.2.2.
1.27      rillig   7219:                 Converting an internal list into an external
                   7220:                 list</a></span></dt>
                   7221: 
1.30      wiz      7222:                 <dt><span class="sect2"><a href=
1.38      dillo    7223:                 "#passing-variable-to-shell">9.2.3. Passing
1.30      wiz      7224:                 variables to a shell command</a></span></dt>
1.27      rillig   7225: 
1.30      wiz      7226:                 <dt><span class="sect2"><a href=
1.38      dillo    7227:                 "#quoting-guideline">9.2.4. Quoting
1.30      wiz      7228:                 guideline</a></span></dt>
1.27      rillig   7229: 
1.30      wiz      7230:                 <dt><span class="sect2"><a href=
1.38      dillo    7231:                 "#bsd-make-bug-workaround">9.2.5. Workaround for a
1.30      wiz      7232:                 bug in BSD Make</a></span></dt>
1.27      rillig   7233:               </dl>
                   7234:             </dd>
                   7235:           </dl>
                   7236:         </div>
                   7237: 
1.45      wiz      7238:         <p>Pkgsrc consists of many <code xmlns=
                   7239:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7240:         "filename">Makefile</code> fragments, each of which forms a
                   7241:         well-defined part of the pkgsrc system. Using the <a href=
                   7242:         "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7243:         <span class="citerefentry"><span class=
                   7244:         "refentrytitle">make</span>(1)</span></a> system as a
                   7245:         programming language for a big system like pkgsrc requires
                   7246:         some discipline to keep the code correct and
                   7247:         understandable.</p>
                   7248: 
1.45      wiz      7249:         <p>The basic ingredients for <code xmlns=
                   7250:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7251:         "filename">Makefile</code> programming are variables (which
                   7252:         are actually macros) and shell commands. Among these shell
                   7253:         commands may even be more complex ones like <a href=
                   7254:         "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
                   7255:         <span class="citerefentry"><span class=
                   7256:         "refentrytitle">awk</span>(1)</span></a> programs. To make
                   7257:         sure that every shell command runs as intended it is
                   7258:         necessary to quote all variables correctly when they are
                   7259:         used.</p>
                   7260: 
                   7261:         <p>This chapter describes some patterns, that appear quite
1.45      wiz      7262:         often in <code xmlns=
                   7263:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   7264:         "filename">Makefile</code>s, including the pitfalls that
                   7265:         come along with them.</p>
1.27      rillig   7266: 
1.59    ! rillig   7267:         <div class="sect1" lang="en" xml:lang="en">
1.27      rillig   7268:           <div class="titlepage">
                   7269:             <div>
                   7270:               <div>
                   7271:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   7272:                 "makefile.variables" id=
1.45      wiz      7273:                 "makefile.variables"></a>9.1.&nbsp;<code xmlns=
                   7274:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7275:                 "filename">Makefile</code> variables</h2>
                   7276:               </div>
                   7277:             </div>
                   7278:           </div>
                   7279: 
1.45      wiz      7280:           <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7281:           class="filename">Makefile</code> variables contain
                   7282:           strings that can be processed using the five operators
                   7283:           ``='', ``+='', ``?='', ``:='', and ``!='', which are
                   7284:           described in the <a href=
1.27      rillig   7285:           "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7286:           <span class="citerefentry"><span class=
                   7287:           "refentrytitle">make</span>(1)</span></a> man page.</p>
                   7288: 
1.45      wiz      7289:           <p>When a variable's value is parsed from a <code xmlns=
                   7290:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7291:           "filename">Makefile</code>, the hash character ``#'' and
                   7292:           the backslash character ``\'' are handled specially. If a
                   7293:           backslash is followed by a newline, any whitespace
                   7294:           immediately in front of the backslash, the backslash, the
                   7295:           newline, and any whitespace immediately behind the
                   7296:           newline are replaced with a single space. A backspace
                   7297:           character and an immediately following hash character are
1.47      reed     7298:           replaced with a single hash character. Otherwise, the
1.27      rillig   7299:           backslash is passed as is. In a variable assignment, any
                   7300:           hash character that is not preceded by a backslash starts
                   7301:           a comment that continues upto the end of the logical
                   7302:           line.</p>
                   7303: 
                   7304:           <p><span class="emphasis"><em>Note:</em></span> Because
                   7305:           of this parsing algorithm the only way to create a
                   7306:           variable consisting of a single backslash is using the
                   7307:           ``!='' operator, for example: <code class=
                   7308:           "varname">BACKSLASH!=echo "\\"</code>.</p>
                   7309: 
                   7310:           <p>So far for defining variables. The other thing you can
                   7311:           do with variables is evaluating them. A variable is
                   7312:           evaluated when it is part of the right side of the ``:=''
                   7313:           or the ``!='' operator, or directly before executing a
                   7314:           shell command which the variable is part of. In all other
1.47      reed     7315:           cases, <a href=
1.27      rillig   7316:           "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7317:           <span class="citerefentry"><span class=
                   7318:           "refentrytitle">make</span>(1)</span></a> performs lazy
                   7319:           evaluation, that is, variables are not evaluated until
                   7320:           there's no other way. The ``modifiers'' mentioned in the
                   7321:           man page also evaluate the variable.</p>
                   7322: 
                   7323:           <p>Some of the modifiers split the string into words and
                   7324:           then operate on the words, others operate on the string
1.47      reed     7325:           as a whole. When a string is split into words, it is
                   7326:           split as you would expect it from <a href=
1.27      rillig   7327:           "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
                   7328:           <span class="citerefentry"><span class=
                   7329:           "refentrytitle">sh</span>(1)</span></a>.</p>
                   7330: 
                   7331:           <p>No rule without exception&#8212;the
                   7332:           <span><strong class="command">.for</strong></span> loop
                   7333:           does not follow the shell quoting rules but splits at
                   7334:           sequences of whitespace.</p>
                   7335: 
                   7336:           <p>There are several types of variables that should be
                   7337:           handled differently. Strings and two types of lists.</p>
                   7338: 
                   7339:           <div class="itemizedlist">
                   7340:             <ul type="disc">
                   7341:               <li>
                   7342:                 <p><span class="emphasis"><em>Strings</em></span>
1.47      reed     7343:                 can contain arbitrary characters. Nevertheless, you
1.27      rillig   7344:                 should restrict yourself to only using printable
                   7345:                 characters. Examples are <code class=
                   7346:                 "varname">PREFIX</code> and <code class=
                   7347:                 "varname">COMMENT</code>.</p>
                   7348:               </li>
                   7349: 
                   7350:               <li>
                   7351:                 <p><span class="emphasis"><em>Internal
                   7352:                 lists</em></span> are lists that are never exported
                   7353:                 to any shell command. Their elements are separated
1.47      reed     7354:                 by whitespace. Therefore, the elements themselves
1.27      rillig   7355:                 cannot have embedded whitespace. Any other
                   7356:                 characters are allowed. Internal lists can be used
                   7357:                 in <span><strong class=
                   7358:                 "command">.for</strong></span> loops. Examples are
                   7359:                 <code class="varname">DEPENDS</code> and
                   7360:                 <code class="varname">BUILD_DEPENDS</code>.</p>
                   7361:               </li>
                   7362: 
                   7363:               <li>
                   7364:                 <p><span class="emphasis"><em>External
                   7365:                 lists</em></span> are lists that may be exported to
                   7366:                 a shell command. Their elements can contain any
                   7367:                 characters, including whitespace. That's why they
                   7368:                 cannot be used in <span><strong class=
                   7369:                 "command">.for</strong></span> loops. Examples are
                   7370:                 <code class="varname">DISTFILES</code> and
                   7371:                 <code class="varname">MASTER_SITES</code>.</p>
                   7372:               </li>
                   7373:             </ul>
                   7374:           </div>
                   7375: 
1.59    ! rillig   7376:           <div class="sect2" lang="en" xml:lang="en">
1.27      rillig   7377:             <div class="titlepage">
                   7378:               <div>
                   7379:                 <div>
                   7380:                   <h3 class="title"><a name=
1.59    ! rillig   7381:                   "makefile.variables.names" id=
1.38      dillo    7382:                   "makefile.variables.names"></a>9.1.1.&nbsp;Naming
1.27      rillig   7383:                   conventions</h3>
                   7384:                 </div>
                   7385:               </div>
                   7386:             </div>
                   7387: 
                   7388:             <div class="itemizedlist">
                   7389:               <ul type="disc">
                   7390:                 <li>
                   7391:                   <p>All variable names starting with an underscore
                   7392:                   are reserved for use by the pkgsrc
                   7393:                   infrastructure. They shall not be used by package
1.45      wiz      7394:                   <code xmlns=
                   7395:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   7396:                   "filename">Makefile</code>s.</p>
1.27      rillig   7397:                 </li>
                   7398: 
                   7399:                 <li>
                   7400:                   <p>In <span><strong class=
                   7401:                   "command">.for</strong></span> loops you should
                   7402:                   use lowercase variable names for the iteration
                   7403:                   variables.</p>
                   7404:                 </li>
                   7405: 
                   7406:                 <li>
                   7407:                   <p>All list variables should have a ``plural''
                   7408:                   name, e.g. <code class=
                   7409:                   "varname">PKG_OPTIONS</code> or <code class=
                   7410:                   "varname">DISTFILES</code>.</p>
                   7411:                 </li>
                   7412:               </ul>
                   7413:             </div>
                   7414:           </div>
                   7415:         </div>
                   7416: 
1.59    ! rillig   7417:         <div class="sect1" lang="en" xml:lang="en">
1.27      rillig   7418:           <div class="titlepage">
                   7419:             <div>
                   7420:               <div>
                   7421:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   7422:                 "makefile.code" id=
1.38      dillo    7423:                 "makefile.code"></a>9.2.&nbsp;Code snippets</h2>
1.27      rillig   7424:               </div>
                   7425:             </div>
                   7426:           </div>
                   7427: 
                   7428:           <p>This section presents you with some code snippets you
                   7429:           should use in your own code. If you don't find anything
                   7430:           appropriate here, you should test your code and add it
                   7431:           here.</p>
                   7432: 
1.59    ! rillig   7433:           <div class="sect2" lang="en" xml:lang="en">
1.27      rillig   7434:             <div class="titlepage">
                   7435:               <div>
                   7436:                 <div>
1.59    ! rillig   7437:                   <h3 class="title"><a name="adding-to-list" id=
1.38      dillo    7438:                   "adding-to-list"></a>9.2.1.&nbsp;Adding things to
1.30      wiz      7439:                   a list</h3>
1.27      rillig   7440:                 </div>
                   7441:               </div>
                   7442:             </div>
                   7443:             <pre class="programlisting">
1.51      rillig   7444:     STRING=                 foo * bar `date`
                   7445:     INT_LIST=               # empty
                   7446:     ANOTHER_INT_LIST=       apache-[0-9]*:../../www/apache
                   7447:     EXT_LIST=               # empty
                   7448:     ANOTHER_EXT_LIST=       a=b c=d
                   7449: 
                   7450:     INT_LIST+=              ${STRING}               # 1
                   7451:     INT_LIST+=              ${ANOTHER_INT_LIST}     # 2
                   7452:     EXT_LIST+=              ${STRING:Q}             # 3
                   7453:     EXT_LIST+=              ${ANOTHER_EXT_LIST}     # 4
1.27      rillig   7454: </pre>
                   7455: 
                   7456:             <p>When you add a string to an external list (example
                   7457:             3), it must be quoted. In all other cases, you must not
                   7458:             add a quoting level. You must not merge internal and
                   7459:             external lists, unless you are sure that all entries
                   7460:             are correctly interpreted in both lists.</p>
                   7461:           </div>
                   7462: 
1.59    ! rillig   7463:           <div class="sect2" lang="en" xml:lang="en">
1.27      rillig   7464:             <div class="titlepage">
                   7465:               <div>
                   7466:                 <div>
1.30      wiz      7467:                   <h3 class="title"><a name=
1.59    ! rillig   7468:                   "converting-internal-to-external" id=
1.38      dillo    7469:                   "converting-internal-to-external"></a>9.2.2.&nbsp;Converting
1.30      wiz      7470:                   an internal list into an external list</h3>
1.27      rillig   7471:                 </div>
                   7472:               </div>
                   7473:             </div>
                   7474:             <pre class="programlisting">
1.51      rillig   7475:     EXT_LIST=       # empty
                   7476:     .for i in ${INT_LIST}
                   7477:     EXT_LIST+=      ${i:Q}""
                   7478:     .endfor
1.27      rillig   7479: </pre>
                   7480: 
                   7481:             <p>This code converts the internal list <code class=
                   7482:             "varname">INT_LIST</code> into the external list
                   7483:             <code class="varname">EXT_LIST</code>. As the elements
                   7484:             of an internal list are unquoted they must be quoted
                   7485:             here. The reason for appending <code class=
                   7486:             "varname">""</code> is explained below.</p>
                   7487:           </div>
1.1       grant    7488: 
1.59    ! rillig   7489:           <div class="sect2" lang="en" xml:lang="en">
1.27      rillig   7490:             <div class="titlepage">
1.1       grant    7491:               <div>
1.27      rillig   7492:                 <div>
1.30      wiz      7493:                   <h3 class="title"><a name=
1.59    ! rillig   7494:                   "passing-variable-to-shell" id=
1.38      dillo    7495:                   "passing-variable-to-shell"></a>9.2.3.&nbsp;Passing
1.30      wiz      7496:                   variables to a shell command</h3>
1.27      rillig   7497:                 </div>
1.1       grant    7498:               </div>
                   7499:             </div>
1.27      rillig   7500:             <pre class="programlisting">
1.51      rillig   7501:     STRING=         foo bar &lt;    &gt; * `date` $$HOME ' "
                   7502:     EXT_LIST=       string=${STRING:Q} x=second\ item
1.27      rillig   7503: 
1.51      rillig   7504:     all:
                   7505:             echo ${STRING}                  # 1
                   7506:             echo "${STRING}"                # 2
                   7507:             echo "${STRING:Q}"              # 3
                   7508:             echo ${STRING:Q}                # 4
                   7509:             echo x${STRING:Q} | sed 1s,.,,  # 5
                   7510:             env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
1.27      rillig   7511: </pre>
                   7512: 
                   7513:             <p>Example 1 leads to a syntax error in the shell, as
                   7514:             the characters are just copied.</p>
                   7515: 
                   7516:             <p>Example 2 leads to a syntax error too, and if you
                   7517:             leave out the last " character from <code class=
                   7518:             "varname">${STRING}</code>, <a href=
                   7519:             "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
                   7520:             <span class="citerefentry"><span class=
                   7521:             "refentrytitle">date</span>(1)</span></a> will be
                   7522:             executed. The <code class="varname">$HOME</code> shell
                   7523:             variable would be evaluated, too.</p>
                   7524: 
                   7525:             <p>Example 3 outputs each space character preceded by a
                   7526:             backslash (or not), depending on the implementation of
                   7527:             the <a href=
                   7528:             "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   7529:             <span class="citerefentry"><span class=
                   7530:             "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1       grant    7531: 
1.27      rillig   7532:             <p>Example 4 handles correctly every string that does
                   7533:             not start with a dash. In that case, the result depends
                   7534:             on the implementation of the <a href=
                   7535:             "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   7536:             <span class="citerefentry"><span class=
                   7537:             "refentrytitle">echo</span>(1)</span></a> command. As
                   7538:             long as you can guarantee that your input does not
1.47      reed     7539:             start with a dash, this form is appropriate.</p>
1.1       grant    7540: 
1.27      rillig   7541:             <p>Example 5 handles even the case of a leading dash
                   7542:             correctly.</p>
1.1       grant    7543: 
1.27      rillig   7544:             <p>The <code class="varname">EXT_LIST</code> does not
1.47      reed     7545:             need to be quoted because the quoting has already been
1.27      rillig   7546:             done when adding elements to the list.</p>
1.1       grant    7547: 
1.27      rillig   7548:             <p>As internal lists shall not be passed to the shell,
                   7549:             there is no example for it.</p>
1.1       grant    7550:           </div>
                   7551: 
1.59    ! rillig   7552:           <div class="sect2" lang="en" xml:lang="en">
1.27      rillig   7553:             <div class="titlepage">
1.1       grant    7554:               <div>
1.27      rillig   7555:                 <div>
1.59    ! rillig   7556:                   <h3 class="title"><a name="quoting-guideline" id=
1.38      dillo    7557:                   "quoting-guideline"></a>9.2.4.&nbsp;Quoting
1.27      rillig   7558:                   guideline</h3>
                   7559:                 </div>
1.1       grant    7560:               </div>
                   7561:             </div>
                   7562: 
1.27      rillig   7563:             <p>There are many possible sources of wrongly quoted
                   7564:             variables. This section lists some of the commonly
                   7565:             known ones.</p>
1.1       grant    7566: 
1.27      rillig   7567:             <div class="itemizedlist">
                   7568:               <ul type="disc">
                   7569:                 <li>
                   7570:                   <p>Whenever you use the value of a list, think
                   7571:                   about what happens to leading or trailing
                   7572:                   whitespace. If the list is a well-formed shell
1.47      reed     7573:                   expression, you can apply the <code class=
1.27      rillig   7574:                   "varname">:M*</code> modifier to strip leading
                   7575:                   and trailing whitespace from each word. The
                   7576:                   <code class="varname">:M</code> operator first
                   7577:                   splits its argument according to the rules of the
                   7578:                   shell, and then creates a new list consisting of
                   7579:                   all words that match the shell glob expression
                   7580:                   <code class="varname">*</code>, that is: all. One
                   7581:                   class of situations where this is needed is when
                   7582:                   adding a variable like <code class=
                   7583:                   "varname">CPPFLAGS</code> to <code class=
                   7584:                   "varname">CONFIGURE_ARGS</code>. If the configure
1.47      reed     7585:                   script invokes other configure scripts, it strips
1.27      rillig   7586:                   the leading and trailing whitespace from the
                   7587:                   variable and then passes it to the other
                   7588:                   configure scripts. But these configure scripts
                   7589:                   expect the (child) <code class=
                   7590:                   "varname">CPPFLAGS</code> variable to be the same
                   7591:                   as the parent <code class=
                   7592:                   "varname">CPPFLAGS</code>. That's why we better
                   7593:                   pass the <code class="varname">CPPFLAGS</code>
                   7594:                   value properly trimmed. And here is how we do
                   7595:                   it:</p>
                   7596:                   <pre class="programlisting">
1.51      rillig   7597:     CPPFLAGS=               # empty
                   7598:     CPPFLAGS+=              -Wundef -DPREFIX=\"${PREFIX:Q}\"
                   7599:     CPPFLAGS+=              ${MY_CPPFLAGS}
                   7600: 
                   7601:     CONFIGURE_ARGS+=        CPPFLAGS=${CPPFLAGS:M*:Q}
                   7602: 
                   7603:     all:
                   7604:             echo x${CPPFLAGS:Q}x            # leading and trailing whitespace
                   7605:             echo x${CONFIGURE_ARGS}x        # properly trimmed
1.27      rillig   7606: </pre>
                   7607:                 </li>
1.1       grant    7608: 
1.27      rillig   7609:                 <li>
                   7610:                   <p>The example above contains one bug: The
                   7611:                   <code class="varname">${PREFIX}</code> is a
                   7612:                   properly quoted shell expression, but there is
                   7613:                   the C compiler after it, which also expects a
                   7614:                   properly quoted string (this time in C syntax).
                   7615:                   The version above is therefore only correct if
                   7616:                   <code class="varname">${PREFIX}</code> does not
                   7617:                   have embedded backslashes or double quotes. If
                   7618:                   you want to allow these, you have to add another
                   7619:                   layer of quoting to each variable that is used as
                   7620:                   a C string literal. You cannot use the
                   7621:                   <code class="varname">:Q</code> operator for it,
                   7622:                   as this operator only works for the shell.</p>
                   7623:                 </li>
1.1       grant    7624: 
1.27      rillig   7625:                 <li>
1.47      reed     7626:                   <p>Whenever a variable can be empty, the
1.27      rillig   7627:                   <code class="varname">:Q</code> operator can have
                   7628:                   surprising results. Here are two completely
                   7629:                   different cases which can be solved with the same
                   7630:                   trick.</p>
                   7631:                   <pre class="programlisting">
1.51      rillig   7632:     EMPTY=                  # empty
                   7633:     empty_test:
                   7634:             for i in a ${EMPTY:Q} c; do \
                   7635:                     echo "$$i"; \
                   7636:             done
                   7637: 
                   7638:     for_test:
                   7639:     .for i in a:\ a:\test.txt
                   7640:             echo ${i:Q}
                   7641:             echo "foo"
                   7642:     .endfor
1.1       grant    7643: </pre>
                   7644: 
1.27      rillig   7645:                   <p>The first example will only print two of the
                   7646:                   three lines we might have expected. This is
                   7647:                   because <code class="varname">${EMPTY:Q}</code>
                   7648:                   expands to the empty string, which the shell
                   7649:                   cannot see. The workaround is to write
                   7650:                   <code class="varname">${EMPTY:Q}""</code>. This
                   7651:                   pattern can be often found as <code class=
                   7652:                   "varname">${TEST} -z ${VAR:Q}</code> or as
                   7653:                   <code class="varname">${TEST} -f
                   7654:                   ${FNAME:Q}</code> (both of these are wrong).</p>
                   7655: 
                   7656:                   <p>The second example will only print three lines
                   7657:                   instead of four. The first line looks like
                   7658:                   <code class="varname">a:\ echo foo</code>. This
                   7659:                   is because the backslash of the value
                   7660:                   <code class="varname">a:\</code> is interpreted
                   7661:                   as a line-continuation by <a href=
                   7662:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7663:                   <span class="citerefentry"><span class=
                   7664:                   "refentrytitle">make</span>(1)</span></a>, which
                   7665:                   makes the second line the arguments of the
                   7666:                   <a href=
                   7667:                   "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   7668:                   <span class="citerefentry"><span class=
                   7669:                   "refentrytitle">echo</span>(1)</span></a> command
                   7670:                   from the first line. To avoid this, write
                   7671:                   <code class="varname">${i:Q}""</code>.</p>
                   7672:                 </li>
                   7673:               </ul>
                   7674:             </div>
1.1       grant    7675:           </div>
                   7676: 
1.59    ! rillig   7677:           <div class="sect2" lang="en" xml:lang="en">
1.27      rillig   7678:             <div class="titlepage">
1.1       grant    7679:               <div>
1.27      rillig   7680:                 <div>
1.30      wiz      7681:                   <h3 class="title"><a name=
1.59    ! rillig   7682:                   "bsd-make-bug-workaround" id=
1.38      dillo    7683:                   "bsd-make-bug-workaround"></a>9.2.5.&nbsp;Workaround
1.30      wiz      7684:                   for a bug in BSD Make</h3>
1.27      rillig   7685:                 </div>
1.1       grant    7686:               </div>
                   7687:             </div>
                   7688: 
1.27      rillig   7689:             <p>The pkgsrc bmake program does not handle the
                   7690:             following assignment correctly. In case <code class=
                   7691:             "varname">_othervar_</code> contains a ``-'' character,
                   7692:             one of the closing braces is included in <code class=
                   7693:             "varname">${VAR}</code> after this code executes.</p>
                   7694:             <pre class="programlisting">
1.51      rillig   7695:     VAR:=   ${VAR:N${_othervar_:C/-//}}
1.1       grant    7696: </pre>
                   7697: 
1.27      rillig   7698:             <p>For a more complex code snippet and a workaround,
                   7699:             see the package <a xmlns=
                   7700:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   7701:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
1.45      wiz      7702:             target="_top"><code xmlns="" class=
                   7703:             "filename">regress/make-quoting</code></a>, testcase
1.27      rillig   7704:             <code class="varname">bug1</code>.</p>
1.1       grant    7705:           </div>
                   7706:         </div>
                   7707:       </div>
                   7708: 
1.59    ! rillig   7709:       <div class="chapter" lang="en" xml:lang="en">
1.1       grant    7710:         <div class="titlepage">
                   7711:           <div>
                   7712:             <div>
1.59    ! rillig   7713:               <h2 class="title"><a name="plist" id=
1.38      dillo    7714:               "plist"></a>Chapter&nbsp;10.&nbsp;PLIST issues</h2>
1.1       grant    7715:             </div>
                   7716:           </div>
                   7717:         </div>
                   7718: 
                   7719:         <div class="toc">
                   7720:           <p><b>Table of Contents</b></p>
                   7721: 
                   7722:           <dl>
1.38      dillo    7723:             <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1       grant    7724:             ID</a></span></dt>
                   7725: 
1.30      wiz      7726:             <dt><span class="sect1"><a href=
1.38      dillo    7727:             "#automatic-plist-generation">10.2. Semi-automatic
1.45      wiz      7728:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7729:             class="filename">PLIST</code>
1.14      xtraeme  7730:             generation</a></span></dt>
1.1       grant    7731: 
1.38      dillo    7732:             <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14      xtraeme  7733:             Tweaking output of <span><strong class="command">make
                   7734:             print-PLIST</strong></span></a></span></dt>
1.1       grant    7735: 
1.38      dillo    7736:             <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1       grant    7737:             Variable substitution in PLIST</a></span></dt>
                   7738: 
1.30      wiz      7739:             <dt><span class="sect1"><a href=
1.48      dillo    7740:             "#manpage-compression">10.5. Man page
                   7741:             compression</a></span></dt>
1.1       grant    7742: 
1.38      dillo    7743:             <dt><span class="sect1"><a href=
                   7744:             "#using-PLIST_SRC">10.6. Changing PLIST source with
                   7745:             <code class="varname">PLIST_SRC</code></a></span></dt>
1.1       grant    7746: 
1.30      wiz      7747:             <dt><span class="sect1"><a href=
1.47      reed     7748:             "#platform-specific-plist">10.7. Platform-specific and
1.30      wiz      7749:             differing PLISTs</a></span></dt>
1.1       grant    7750: 
1.38      dillo    7751:             <dt><span class="sect1"><a href=
                   7752:             "#faq.common-dirs">10.8. Sharing directories between
                   7753:             packages</a></span></dt>
1.1       grant    7754:           </dl>
                   7755:         </div>
                   7756: 
1.45      wiz      7757:         <p>The <code xmlns=
                   7758:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   7759:         "filename">PLIST</code> file contains a package's
                   7760:         &#8220;<span class="quote">packing list</span>&#8221;, i.e.
                   7761:         a list of files that belong to the package (relative to the
                   7762:         <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7763:         class="filename">${PREFIX}</code> directory it's been
                   7764:         installed in) plus some additional statements - see the
                   7765:         <a href=
1.1       grant    7766:         "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   7767:         <span class="citerefentry"><span class=
1.47      reed     7768:         "refentrytitle">pkg_create</span>(1)</span></a> man page
                   7769:         for a full list. This chapter addresses some issues that
                   7770:         need attention when dealing with the <code xmlns=
1.45      wiz      7771:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7772:         "filename">PLIST</code> file (or files, see below!).</p>
1.1       grant    7773: 
1.59    ! rillig   7774:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    7775:           <div class="titlepage">
                   7776:             <div>
                   7777:               <div>
                   7778:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   7779:                 "rcs-id" id="rcs-id"></a>10.1.&nbsp;RCS ID</h2>
1.1       grant    7780:               </div>
                   7781:             </div>
                   7782:           </div>
                   7783: 
                   7784:           <p>Be sure to add a RCS ID line as the first thing in any
1.45      wiz      7785:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7786:           class="filename">PLIST</code> file you write:</p>
1.1       grant    7787:           <pre class="programlisting">
1.51      rillig   7788:     @comment $NetBSD$
1.1       grant    7789: </pre>
                   7790:         </div>
                   7791: 
1.59    ! rillig   7792:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    7793:           <div class="titlepage">
                   7794:             <div>
                   7795:               <div>
                   7796:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   7797:                 "automatic-plist-generation" id=
1.38      dillo    7798:                 "automatic-plist-generation"></a>10.2.&nbsp;Semi-automatic
1.45      wiz      7799:                 <code xmlns=
                   7800:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7801:                 "filename">PLIST</code> generation</h2>
1.1       grant    7802:               </div>
                   7803:             </div>
                   7804:           </div>
                   7805: 
1.14      xtraeme  7806:           <p>You can use the <span><strong class="command">make
                   7807:           print-PLIST</strong></span> command to output a PLIST
                   7808:           that matches any new files since the package was
                   7809:           extracted. See <a href="#build.helpful-targets" title=
1.56      rillig   7810:           "14.16.&nbsp;Other helpful targets">Section&nbsp;14.16,
1.1       grant    7811:           &#8220;Other helpful targets&#8221;</a> for more
                   7812:           information on this target.</p>
                   7813:         </div>
                   7814: 
1.59    ! rillig   7815:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    7816:           <div class="titlepage">
                   7817:             <div>
                   7818:               <div>
                   7819:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   7820:                 "print-PLIST" id=
1.38      dillo    7821:                 "print-PLIST"></a>10.3.&nbsp;Tweaking output of
1.14      xtraeme  7822:                 <span><strong class="command">make
                   7823:                 print-PLIST</strong></span></h2>
1.1       grant    7824:               </div>
                   7825:             </div>
                   7826:           </div>
                   7827: 
                   7828:           <p>If you have used any of the *-dirs packages, as
                   7829:           explained in <a href="#faq.common-dirs" title=
1.38      dillo    7830:           "10.8.&nbsp;Sharing directories between packages">Section&nbsp;10.8,
1.1       grant    7831:           &#8220;Sharing directories between packages&#8221;</a>,
1.14      xtraeme  7832:           you may have noticed that <span><strong class=
                   7833:           "command">make print-PLIST</strong></span> outputs a set
                   7834:           of <code class="varname">@comment</code>s instead of real
                   7835:           <code class="varname">@dirrm</code> lines. You can also
                   7836:           do this for specific directories and files, so that the
                   7837:           results of that command are very close to reality. This
                   7838:           helps <span class="emphasis"><em>a lot</em></span> during
                   7839:           the update of packages.</p>
                   7840: 
                   7841:           <p>The <code class="varname">PRINT_PLIST_AWK</code>
                   7842:           variable takes a set of AWK patterns and actions that are
                   7843:           used to filter the output of print-PLIST. You can
                   7844:           <span class="emphasis"><em>append</em></span> any chunk
                   7845:           of AWK scripting you like to it, but be careful with
1.1       grant    7846:           quoting.</p>
                   7847: 
1.45      wiz      7848:           <p>For example, to get all files inside the <code xmlns=
                   7849:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7850:           "filename">libdata/foo</code> directory removed from the
1.1       grant    7851:           resulting PLIST:</p>
                   7852:           <pre class="programlisting">
1.51      rillig   7853:     PRINT_PLIST_AWK+=       /^libdata\/foo/ { next; }
1.1       grant    7854: </pre>
                   7855: 
1.14      xtraeme  7856:           <p>And to get all the <code class="varname">@dirrm</code>
1.1       grant    7857:           lines referring to a specific (shared) directory
1.14      xtraeme  7858:           converted to <code class="varname">@comment</code>s:</p>
1.1       grant    7859:           <pre class="programlisting">
1.51      rillig   7860:     PRINT_PLIST_AWK+=       /^@dirrm share\/specific/ { print "@comment " $$0; next; }
1.1       grant    7861: </pre>
                   7862:         </div>
                   7863: 
1.59    ! rillig   7864:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    7865:           <div class="titlepage">
                   7866:             <div>
                   7867:               <div>
                   7868:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   7869:                 "plist.misc" id=
1.38      dillo    7870:                 "plist.misc"></a>10.4.&nbsp;Variable substitution
                   7871:                 in PLIST</h2>
1.1       grant    7872:               </div>
                   7873:             </div>
                   7874:           </div>
                   7875: 
                   7876:           <p>A number of variables are substituted automatically in
                   7877:           PLISTs when a package is installed on a system. This
                   7878:           includes the following variables:</p>
                   7879: 
                   7880:           <div class="variablelist">
                   7881:             <dl>
1.14      xtraeme  7882:               <dt><span class="term"><code class=
                   7883:               "varname">${MACHINE_ARCH}</code>, <code class=
                   7884:               "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1       grant    7885: 
                   7886:               <dd>
                   7887:                 <p>Some packages like emacs and perl embed
                   7888:                 information about which architecture they were
                   7889:                 built on into the pathnames where they install
1.47      reed     7890:                 their files. To handle this case, PLIST will be
1.1       grant    7891:                 preprocessed before actually used, and the symbol
1.14      xtraeme  7892:                 &#8220;<span class="quote"><code class=
                   7893:                 "varname">${MACHINE_ARCH}</code></span>&#8221; will
                   7894:                 be replaced by what <span><strong class=
                   7895:                 "command">uname -p</strong></span> gives. The same
                   7896:                 is done if the string <code class=
                   7897:                 "varname">${MACHINE_GNU_ARCH}</code> is embedded in
                   7898:                 PLIST somewhere - use this on packages that have
1.47      reed     7899:                 GNU autoconf-created configure scripts.</p>
1.1       grant    7900: 
                   7901:                 <div class="note" style=
                   7902:                 "margin-left: 0.5in; margin-right: 0.5in;">
                   7903:                   <h3 class="title">Legacy note</h3>
                   7904: 
                   7905:                   <p>There used to be a symbol &#8220;<span class=
1.14      xtraeme  7906:                   "quote"><code class=
                   7907:                   "varname">$ARCH</code></span>&#8221; that was
                   7908:                   replaced by the output of <span><strong class=
                   7909:                   "command">uname -m</strong></span>, but that's no
1.1       grant    7910:                   longer supported and has been removed.</p>
                   7911:                 </div>
                   7912:               </dd>
                   7913: 
1.14      xtraeme  7914:               <dt><span class="term"><code class=
                   7915:               "varname">${OPSYS}</code>, <code class=
                   7916:               "varname">${LOWER_OPSYS}</code>, <code class=
                   7917:               "varname">${OS_VERSION}</code></span></dt>
1.1       grant    7918: 
                   7919:               <dd>
                   7920:                 <p>Some packages want to embed the OS name and
                   7921:                 version into some paths. To do this, use these
1.45      wiz      7922:                 variables in the <code xmlns=
                   7923:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7924:                 "filename">PLIST</code>:</p>
1.1       grant    7925: 
                   7926:                 <div class="itemizedlist">
                   7927:                   <ul type="disc">
                   7928:                     <li>
1.14      xtraeme  7929:                       <p><code class="varname">${OPSYS}</code> -
                   7930:                       output of &#8220;<span class=
                   7931:                       "quote"><span><strong class="command">uname
                   7932:                       -s</strong></span></span>&#8221;</p>
1.1       grant    7933:                     </li>
                   7934: 
                   7935:                     <li>
1.14      xtraeme  7936:                       <p><code class=
                   7937:                       "varname">${LOWER_OPSYS}</code> - lowercase
                   7938:                       common name (eg. &#8220;<span class=
                   7939:                       "quote">solaris</span>&#8221;)</p>
1.1       grant    7940:                     </li>
                   7941: 
                   7942:                     <li>
1.14      xtraeme  7943:                       <p><code class="varname">${OS_VERSION}</code>
                   7944:                       - &#8220;<span class=
                   7945:                       "quote"><span><strong class="command">uname
                   7946:                       -r</strong></span></span>&#8221;</p>
1.1       grant    7947:                     </li>
                   7948:                   </ul>
                   7949:                 </div>
                   7950:               </dd>
                   7951: 
1.14      xtraeme  7952:               <dt><span class="term"><code class=
                   7953:               "varname">${PKGLOCALEDIR}</code></span></dt>
1.1       grant    7954: 
                   7955:               <dd>
                   7956:                 <p>Packages that install locale files should list
                   7957:                 them in the PLIST as &#8220;<span class=
                   7958:                 "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>&#8221;
                   7959:                 instead of &#8220;<span class=
                   7960:                 "quote">share/locale/de/LC_MESSAGES/...</span>&#8221;.
                   7961:                 This properly handles the fact that different
                   7962:                 operating systems expect locale files to be either
1.45      wiz      7963:                 in <code xmlns=
                   7964:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7965:                 "filename">share</code> or <code xmlns=
                   7966:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7967:                 "filename">lib</code> by default.</p>
1.1       grant    7968:               </dd>
                   7969:             </dl>
                   7970:           </div>
                   7971: 
                   7972:           <p>For a complete list of values which are replaced by
1.45      wiz      7973:           default, please look in <code xmlns=
                   7974:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7975:           "filename">bsd.pkg.mk</code> (and search for <span class=
1.1       grant    7976:           "emphasis"><em>PLIST_SUBST</em></span>).</p>
                   7977: 
                   7978:           <p>If you want to change other variables not listed
                   7979:           above, you can add variables and their expansions to this
1.14      xtraeme  7980:           variable in the following way, similar to <code class=
                   7981:           "varname">MESSAGE_SUBST</code> (see <a href=
1.1       grant    7982:           "#components.optional" title=
1.38      dillo    7983:           "8.5.&nbsp;Optional files">Section&nbsp;8.5,
1.1       grant    7984:           &#8220;Optional files&#8221;</a>):</p>
                   7985:           <pre class="programlisting">
1.51      rillig   7986:     PLIST_SUBST+=   SOMEVAR="somevalue"
1.1       grant    7987: </pre>
                   7988: 
                   7989:           <p>This replaces all occurrences of &#8220;<span class=
                   7990:           "quote">${SOMEVAR}</span>&#8221; in the PLIST with
                   7991:           &#8220;<span class="quote">somevalue</span>&#8221;.</p>
                   7992:         </div>
                   7993: 
1.59    ! rillig   7994:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    7995:           <div class="titlepage">
                   7996:             <div>
                   7997:               <div>
                   7998:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   7999:                 "manpage-compression" id=
1.48      dillo    8000:                 "manpage-compression"></a>10.5.&nbsp;Man page
                   8001:                 compression</h2>
1.1       grant    8002:               </div>
                   8003:             </div>
                   8004:           </div>
                   8005: 
1.47      reed     8006:           <p>Man pages should be installed in compressed form if
1.45      wiz      8007:           <code class="varname">MANZ</code> is set (in <code xmlns=
                   8008:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8009:           "filename">bsd.own.mk</code>), and uncompressed
1.45      wiz      8010:           otherwise. To handle this in the <code xmlns=
                   8011:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8012:           "filename">PLIST</code> file, the suffix
                   8013:           &#8220;<span class="quote">.gz</span>&#8221; is
1.47      reed     8014:           appended/removed automatically for man pages according to
1.14      xtraeme  8015:           <code class="varname">MANZ</code> and <code class=
                   8016:           "varname">MANCOMPRESSED</code> being set or not, see
1.45      wiz      8017:           above for details. This modification of the <code xmlns=
                   8018:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8019:           "filename">PLIST</code> file is done on a copy of it, not
1.45      wiz      8020:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8021:           class="filename">PLIST</code> itself.</p>
1.1       grant    8022:         </div>
                   8023: 
1.59    ! rillig   8024:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    8025:           <div class="titlepage">
                   8026:             <div>
                   8027:               <div>
                   8028:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   8029:                 "using-PLIST_SRC" id=
1.38      dillo    8030:                 "using-PLIST_SRC"></a>10.6.&nbsp;Changing PLIST
1.30      wiz      8031:                 source with <code class=
1.14      xtraeme  8032:                 "varname">PLIST_SRC</code></h2>
1.1       grant    8033:               </div>
                   8034:             </div>
                   8035:           </div>
                   8036: 
1.14      xtraeme  8037:           <p>To use one or more files as source for the
1.45      wiz      8038:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8039:           class="filename">PLIST</code> used in generating the
                   8040:           binary package, set the variable <code class=
1.14      xtraeme  8041:           "varname">PLIST_SRC</code> to the names of that file(s).
1.24      wiz      8042:           The files are later concatenated using <a href=
                   8043:           "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
                   8044:           <span class="citerefentry"><span class=
                   8045:           "refentrytitle">cat</span>(1)</span></a>, and order of
                   8046:           things is important.</p>
1.1       grant    8047:         </div>
                   8048: 
1.59    ! rillig   8049:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    8050:           <div class="titlepage">
                   8051:             <div>
                   8052:               <div>
                   8053:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   8054:                 "platform-specific-plist" id=
1.47      reed     8055:                 "platform-specific-plist"></a>10.7.&nbsp;Platform-specific
                   8056:                 and differing PLISTs</h2>
1.1       grant    8057:               </div>
                   8058:             </div>
                   8059:           </div>
                   8060: 
                   8061:           <p>Some packages decide to install a different set of
                   8062:           files based on the operating system being used. These
                   8063:           differences can be automatically handled by using the
                   8064:           following files:</p>
                   8065: 
                   8066:           <div class="itemizedlist">
                   8067:             <ul type="disc">
                   8068:               <li>
1.45      wiz      8069:                 <p><code xmlns=
                   8070:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8071:                 "filename">PLIST.common</code></p>
1.1       grant    8072:               </li>
                   8073: 
                   8074:               <li>
1.45      wiz      8075:                 <p><code xmlns=
                   8076:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8077:                 "filename">PLIST.${OPSYS}</code></p>
1.1       grant    8078:               </li>
                   8079: 
                   8080:               <li>
1.45      wiz      8081:                 <p><code xmlns=
                   8082:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.21      ben      8083:                 "filename">PLIST.${MACHINE_ARCH}</code></p>
                   8084:               </li>
                   8085: 
                   8086:               <li>
1.45      wiz      8087:                 <p><code xmlns=
                   8088:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.21      ben      8089:                 "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
                   8090:               </li>
                   8091: 
                   8092:               <li>
1.45      wiz      8093:                 <p><code xmlns=
                   8094:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8095:                 "filename">PLIST.common_end</code></p>
1.1       grant    8096:               </li>
                   8097:             </ul>
                   8098:           </div>
                   8099:         </div>
                   8100: 
1.59    ! 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.59    ! rillig   8106:                 "faq.common-dirs" id=
1.38      dillo    8107:                 "faq.common-dirs"></a>10.8.&nbsp;Sharing
                   8108:                 directories between packages</h2>
1.1       grant    8109:               </div>
                   8110:             </div>
                   8111:           </div>
                   8112: 
                   8113:           <p>A &#8220;<span class="quote">shared
                   8114:           directory</span>&#8221; is a directory where multiple
                   8115:           (and unrelated) packages install files. These directories
                   8116:           are problematic because you have to add special tricks in
                   8117:           the PLIST to conditionally remove them, or have some
                   8118:           centralized package handle them.</p>
                   8119: 
                   8120:           <p>Within pkgsrc, you'll find both approaches. If a
                   8121:           directory is shared by a few unrelated packages, it's
                   8122:           often not worth to add an extra package to remove it.
                   8123:           Therefore, one simply does:</p>
                   8124:           <pre class="programlisting">
1.51      rillig   8125:     @unexec ${RMDIR} %D/path/to/shared/directory 2&gt;/dev/null || ${TRUE}
1.1       grant    8126: </pre>
                   8127: 
                   8128:           <p>in the PLISTs of all affected packages, instead of the
                   8129:           regular "@dirrm" line.</p>
                   8130: 
                   8131:           <p>However, if the directory is shared across many
                   8132:           packages, two different solutions are available:</p>
                   8133: 
                   8134:           <div class="orderedlist">
                   8135:             <ol type="1">
                   8136:               <li>
                   8137:                 <p>If the packages have a common dependency, the
                   8138:                 directory can be removed in that. For example, see
                   8139:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8140:                 href=
                   8141:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.45      wiz      8142:                 target="_top"><code xmlns="" class=
                   8143:                 "filename">textproc/scrollkeeper</code></a>, which
                   8144:                 removes the shared directory <code xmlns=
                   8145:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      8146:                 "filename">share/omf</code>.</p>
1.1       grant    8147:               </li>
                   8148: 
                   8149:               <li>
                   8150:                 <p>If the packages using the directory are not
                   8151:                 related at all (they have no common dependencies),
                   8152:                 a *-dirs package is used.</p>
                   8153:               </li>
                   8154:             </ol>
                   8155:           </div>
                   8156: 
                   8157:           <p>From now on, we'll discuss the second solution. To get
                   8158:           an idea of the *-dirs packages available, issue:</p>
                   8159:           <pre class="programlisting">
1.51      rillig   8160:     <code class="prompt">%</code> cd .../pkgsrc
                   8161:     <code class="prompt">%</code> ls -d */*-dirs
1.1       grant    8162: </pre>
                   8163: 
                   8164:           <p>Their use from other packages is very simple. The
1.14      xtraeme  8165:           <code class="varname">USE_DIRS</code> variable takes a
                   8166:           list of package names (without the &#8220;<span class=
1.1       grant    8167:           "quote">-dirs</span>&#8221; part) together with the
                   8168:           required version number (always pick the latest one when
1.34      wiz      8169:           writing new packages).</p>
1.1       grant    8170: 
                   8171:           <p>For example, if a package installs files under
1.45      wiz      8172:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8173:           class="filename">share/applications</code>, it should
                   8174:           have the following line in it:</p>
1.1       grant    8175:           <pre class="programlisting">
1.51      rillig   8176:     USE_DIRS+=      xdg-1.1
1.1       grant    8177: </pre>
                   8178: 
1.14      xtraeme  8179:           <p>After regenerating the PLIST using
                   8180:           <span><strong class="command">make
                   8181:           print-PLIST</strong></span>, you should get the right
                   8182:           (commented out) lines.</p>
1.1       grant    8183: 
1.47      reed     8184:           <p>Note that even if your package is using <code xmlns=
1.45      wiz      8185:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8186:           "filename">$X11BASE</code>, it must not depend on the
1.1       grant    8187:           *-x11-dirs packages. Just specify the name without that
1.45      wiz      8188:           part and pkgsrc (in particular, <code xmlns=
                   8189:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8190:           "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1       grant    8191:         </div>
                   8192:       </div>
                   8193: 
1.59    ! rillig   8194:       <div class="chapter" lang="en" xml:lang="en">
1.1       grant    8195:         <div class="titlepage">
                   8196:           <div>
                   8197:             <div>
1.59    ! rillig   8198:               <h2 class="title"><a name="buildlink" id=
1.38      dillo    8199:               "buildlink"></a>Chapter&nbsp;11.&nbsp;Buildlink
1.1       grant    8200:               methodology</h2>
                   8201:             </div>
                   8202:           </div>
                   8203:         </div>
                   8204: 
                   8205:         <div class="toc">
                   8206:           <p><b>Table of Contents</b></p>
                   8207: 
                   8208:           <dl>
1.30      wiz      8209:             <dt><span class="sect1"><a href=
1.38      dillo    8210:             "#converting-to-buildlink3">11.1. Converting packages
1.30      wiz      8211:             to use buildlink3</a></span></dt>
1.1       grant    8212: 
1.30      wiz      8213:             <dt><span class="sect1"><a href=
1.45      wiz      8214:             "#creating-buildlink3.mk">11.2. Writing <code xmlns=
                   8215:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      8216:             "filename">buildlink3.mk</code> files</a></span></dt>
1.1       grant    8217: 
                   8218:             <dd>
                   8219:               <dl>
1.25      rillig   8220:                 <dt><span class="sect2"><a href=
1.38      dillo    8221:                 "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30      wiz      8222:                 buildlink3.mk file</a></span></dt>
1.1       grant    8223: 
1.25      rillig   8224:                 <dt><span class="sect2"><a href=
1.38      dillo    8225:                 "#updating-buildlink-depends">11.2.2. Updating
1.30      wiz      8226:                 <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14      xtraeme  8227:                 "replaceable"><code>pkg</code></em></code> in
1.45      wiz      8228:                 <code xmlns=
                   8229:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8230:                 "filename">buildlink3.mk</code>
1.1       grant    8231:                 files</a></span></dt>
                   8232:               </dl>
                   8233:             </dd>
                   8234: 
1.30      wiz      8235:             <dt><span class="sect1"><a href=
1.45      wiz      8236:             "#writing-builtin.mk">11.3. Writing <code xmlns=
                   8237:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      8238:             "filename">builtin.mk</code> files</a></span></dt>
1.1       grant    8239: 
                   8240:             <dd>
                   8241:               <dl>
1.25      rillig   8242:                 <dt><span class="sect2"><a href=
1.38      dillo    8243:                 "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45      wiz      8244:                 <code xmlns=
                   8245:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8246:                 "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    8247: 
1.25      rillig   8248:                 <dt><span class="sect2"><a href=
1.38      dillo    8249:                 "#native-or-pkgsrc-preference">11.3.2. Global
1.30      wiz      8250:                 preferences for native or pkgsrc
                   8251:                 software</a></span></dt>
1.1       grant    8252:               </dl>
                   8253:             </dd>
                   8254:           </dl>
                   8255:         </div>
                   8256: 
                   8257:         <p>Buildlink is a framework in pkgsrc that controls what
                   8258:         headers and libraries are seen by a package's configure and
                   8259:         build processes. This is implemented in a two step
                   8260:         process:</p>
                   8261: 
                   8262:         <div class="orderedlist">
                   8263:           <ol type="1">
                   8264:             <li>
                   8265:               <p>Symlink headers and libraries for dependencies
1.14      xtraeme  8266:               into <code class="varname">BUILDLINK_DIR</code>,
                   8267:               which by default is a subdirectory of <code class=
                   8268:               "varname">WRKDIR</code>.</p>
1.1       grant    8269:             </li>
                   8270: 
                   8271:             <li>
                   8272:               <p>Create wrapper scripts that are used in place of
1.14      xtraeme  8273:               the normal compiler tools that translate <code class=
                   8274:               "option">-I${LOCALBASE}/include</code> and
                   8275:               <code class="option">-L${LOCALBASE}/lib</code> into
                   8276:               references to <code class=
                   8277:               "varname">BUILDLINK_DIR</code>. The wrapper scripts
                   8278:               also make native compiler on some operating systems
                   8279:               look like GCC, so that packages that expect GCC won't
                   8280:               require modifications to build with those native
                   8281:               compilers.</p>
1.1       grant    8282:             </li>
                   8283:           </ol>
                   8284:         </div>
                   8285: 
                   8286:         <p>This normalizes the environment in which a package is
                   8287:         built so that the package may be built consistently despite
                   8288:         what other software may be installed. Please note that the
1.45      wiz      8289:         normal system header and library paths, e.g. <code xmlns=
                   8290:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   8291:         "filename">/usr/include</code>, <code xmlns=
                   8292:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8293:         "filename">/usr/lib</code>, etc., are always searched --
1.1       grant    8294:         buildlink3 is designed to insulate the package build from
                   8295:         non-system-supplied software.</p>
                   8296: 
1.59    ! rillig   8297:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    8298:           <div class="titlepage">
                   8299:             <div>
                   8300:               <div>
                   8301:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   8302:                 "converting-to-buildlink3" id=
1.38      dillo    8303:                 "converting-to-buildlink3"></a>11.1.&nbsp;Converting
1.30      wiz      8304:                 packages to use buildlink3</h2>
1.1       grant    8305:               </div>
                   8306:             </div>
                   8307:           </div>
                   8308: 
                   8309:           <p>The process of converting packages to use the
                   8310:           buildlink3 framework (&#8220;<span class=
                   8311:           "quote">bl3ifying</span>&#8221;) is fairly
                   8312:           straightforward. The things to keep in mind are:</p>
                   8313: 
                   8314:           <div class="orderedlist">
                   8315:             <ol type="1">
                   8316:               <li>
                   8317:                 <p>Ensure that the build always calls the wrapper
                   8318:                 scripts instead of the actual toolchain. Some
                   8319:                 packages are tricky, and the only way to know for
1.45      wiz      8320:                 sure is the check <code xmlns=
                   8321:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8322:                 "filename">${WRKDIR}/.work.log</code> to see if the
1.1       grant    8323:                 wrappers are being invoked.</p>
                   8324:               </li>
                   8325: 
                   8326:               <li>
1.14      xtraeme  8327:                 <p>Don't override <code class=
                   8328:                 "varname">PREFIX</code> from within the package
                   8329:                 Makefile, e.g. Java VMs, standalone shells, etc.,
1.45      wiz      8330:                 because the code to symlink files into <code xmlns=
                   8331:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8332:                 "filename">${BUILDLINK_DIR}</code> looks for files
1.1       grant    8333:                 relative to &#8220;<span class="quote">pkg_info -qp
1.14      xtraeme  8334:                 <em class=
                   8335:                 "replaceable"><code>pkgname</code></em></span>&#8221;.</p>
1.1       grant    8336:               </li>
                   8337: 
                   8338:               <li>
                   8339:                 <p>Remember that <span class=
1.45      wiz      8340:                 "emphasis"><em>only</em></span> the <code xmlns=
                   8341:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8342:                 "filename">buildlink3.mk</code> files that you list
1.1       grant    8343:                 in a package's Makefile are added as dependencies
                   8344:                 for that package.</p>
                   8345:               </li>
                   8346:             </ol>
                   8347:           </div>
                   8348: 
                   8349:           <p>If a dependency on a particular package is required
                   8350:           for its libraries and headers, then we replace:</p>
                   8351:           <pre class="programlisting">
1.51      rillig   8352:     DEPENDS+=   foo&gt;=1.1.0:../../category/foo
1.1       grant    8353: </pre>
                   8354: 
                   8355:           <p>with</p>
                   8356:           <pre class="programlisting">
1.51      rillig   8357:     .include "../../category/foo/buildlink3.mk"
1.1       grant    8358: </pre>
                   8359: 
1.47      reed     8360:           <p>The buildlink3.mk files usually define the required
                   8361:           dependencies. If you need a newer version of the
                   8362:           dependency when using buildlink3.mk files, then you can
                   8363:           define it in your Makefile; for example:</p>
                   8364:           <pre class="programlisting">
1.51      rillig   8365:     BUILDLINK_DEPENDS.foo+=   foo&gt;=1.1.0
                   8366:     .include "../../category/foo/buildlink3.mk"
1.47      reed     8367: </pre>
                   8368: 
1.45      wiz      8369:           <p>There are several <code xmlns=
                   8370:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   8371:           "filename">buildlink3.mk</code> files in <code xmlns=
                   8372:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8373:           "filename">pkgsrc/mk</code> that handle special package
1.1       grant    8374:           issues:</p>
                   8375: 
                   8376:           <div class="itemizedlist">
                   8377:             <ul type="disc">
                   8378:               <li>
1.45      wiz      8379:                 <p><code xmlns=
                   8380:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8381:                 "filename">bdb.buildlink3.mk</code> chooses either
                   8382:                 the native or a pkgsrc Berkeley DB implementation
                   8383:                 based on the values of <code class=
1.14      xtraeme  8384:                 "varname">BDB_ACCEPTED</code> and <code class=
                   8385:                 "varname">BDB_DEFAULT</code>.</p>
1.1       grant    8386:               </li>
                   8387: 
                   8388:               <li>
1.45      wiz      8389:                 <p><code xmlns=
                   8390:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     8391:                 "filename">curses.buildlink3.mk</code>: If the
1.14      xtraeme  8392:                 system comes with neither Curses nor NCurses, this
                   8393:                 will take care to install the <a xmlns=
                   8394:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    8395:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.45      wiz      8396:                 target="_top"><code xmlns="" class=
                   8397:                 "filename">devel/ncurses</code></a> package.</p>
1.1       grant    8398:               </li>
                   8399: 
                   8400:               <li>
1.45      wiz      8401:                 <p><code xmlns=
                   8402:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8403:                 "filename">krb5.buildlink3.mk</code> uses the value
                   8404:                 of <code class="varname">KRB5_ACCEPTED</code> to
                   8405:                 choose between adding a dependency on Heimdal or
                   8406:                 MIT-krb5 for packages that require a Kerberos 5
1.1       grant    8407:                 implementation.</p>
                   8408:               </li>
                   8409: 
                   8410:               <li>
1.45      wiz      8411:                 <p><code xmlns=
                   8412:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8413:                 "filename">motif.buildlink3.mk</code> checks for a
                   8414:                 system-provided Motif installation or adds a
                   8415:                 dependency on <a xmlns=
1.1       grant    8416:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8417:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.45      wiz      8418:                 target="_top"><code xmlns="" class=
                   8419:                 "filename">x11/lesstif</code></a> or <a xmlns=
1.20      ben      8420:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8421:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
1.45      wiz      8422:                 target="_top"><code xmlns="" class=
1.47      reed     8423:                 "filename">x11/openmotif</code></a>.</p>
1.1       grant    8424:               </li>
                   8425: 
                   8426:               <li>
1.45      wiz      8427:                 <p><code xmlns=
                   8428:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8429:                 "filename">ossaudio.buildlink3.mk</code> defines
                   8430:                 several variables that may be used by packages that
1.47      reed     8431:                 use the Open Sound System (OSS) API.</p>
1.1       grant    8432:               </li>
                   8433: 
                   8434:               <li>
1.45      wiz      8435:                 <p><code xmlns=
                   8436:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8437:                 "filename">pgsql.buildlink3.mk</code> will accept
                   8438:                 either Postgres 7.3 or 7.4, whichever is found
                   8439:                 installed. See the file for more information.</p>
1.1       grant    8440:               </li>
                   8441: 
                   8442:               <li>
1.45      wiz      8443:                 <p><code xmlns=
                   8444:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8445:                 "filename">pthread.buildlink3.mk</code> uses the
                   8446:                 value of <code class="varname">PTHREAD_OPTS</code>
                   8447:                 and checks for native pthreads or adds a dependency
                   8448:                 on <a xmlns=
1.1       grant    8449:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8450:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.45      wiz      8451:                 target="_top"><code xmlns="" class=
1.47      reed     8452:                 "filename">devel/pth</code></a> as needed.</p>
1.1       grant    8453:               </li>
                   8454: 
                   8455:               <li>
1.45      wiz      8456:                 <p><code xmlns=
                   8457:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8458:                 "filename">xaw.buildlink3.mk</code> uses the value
                   8459:                 of <code class="varname">XAW_TYPE</code> to choose
                   8460:                 a particular Athena widgets library.</p>
1.1       grant    8461:               </li>
                   8462:             </ul>
                   8463:           </div>
                   8464: 
1.45      wiz      8465:           <p>The comments in those <code xmlns=
                   8466:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8467:           "filename">buildlink3.mk</code> files provide a more
1.1       grant    8468:           complete description of how to use them properly.</p>
                   8469:         </div>
                   8470: 
1.59    ! rillig   8471:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    8472:           <div class="titlepage">
                   8473:             <div>
                   8474:               <div>
                   8475:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   8476:                 "creating-buildlink3.mk" id=
1.38      dillo    8477:                 "creating-buildlink3.mk"></a>11.2.&nbsp;Writing
1.45      wiz      8478:                 <code xmlns=
                   8479:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8480:                 "filename">buildlink3.mk</code> files</h2>
1.1       grant    8481:               </div>
                   8482:             </div>
                   8483:           </div>
                   8484: 
1.45      wiz      8485:           <p>A package's <code xmlns=
                   8486:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8487:           "filename">buildlink3.mk</code> file is included by
                   8488:           Makefiles to indicate the need to compile and link
                   8489:           against header files and libraries provided by the
1.45      wiz      8490:           package. A <code xmlns=
                   8491:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   8492:           "filename">buildlink3.mk</code> file should always
                   8493:           provide enough information to add the correct type of
                   8494:           dependency relationship and include any other
                   8495:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8496:           class="filename">buildlink3.mk</code> files that it needs
                   8497:           to find headers and libraries that it needs in turn.</p>
1.1       grant    8498: 
1.45      wiz      8499:           <p>To generate an initial <code xmlns=
                   8500:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8501:           "filename">buildlink3.mk</code> file for further editing,
1.1       grant    8502:           Rene Hexel's <a xmlns=
                   8503:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   8504:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.45      wiz      8505:           target="_top"><code xmlns="" class=
                   8506:           "filename">pkgtools/createbuildlink</code></a> package is
1.20      ben      8507:           highly recommended. For most packages, the following
                   8508:           command will generate a good starting point for
1.45      wiz      8509:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8510:           class="filename">buildlink3.mk</code> files:</p>
1.1       grant    8511:           <pre class="screen">
1.14      xtraeme  8512: <code class="prompt">%</code> <strong class=
                   8513: "userinput"><code>cd pkgsrc/<em class=
                   8514: "replaceable"><code>category</code></em>/<em class=
                   8515: "replaceable"><code>pkgdir</code></em>
                   8516: <code class=
1.49      rillig   8517: "prompt">%</code> createbuildlink &gt;buildlink3.mk</code></strong>
1.1       grant    8518: </pre>
                   8519: 
1.59    ! rillig   8520:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    8521:             <div class="titlepage">
                   8522:               <div>
                   8523:                 <div>
1.59    ! rillig   8524:                   <h3 class="title"><a name="anatomy-of-bl3" id=
        !          8525:                   "anatomy-of-bl3"></a>11.2.1. Anatomy of a
1.25      rillig   8526:                   buildlink3.mk file</h3>
1.1       grant    8527:                 </div>
                   8528:               </div>
                   8529:             </div>
                   8530: 
1.45      wiz      8531:             <p>The following real-life example <code xmlns=
                   8532:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8533:             "filename">buildlink3.mk</code> is taken from
1.45      wiz      8534:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8535:             class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1       grant    8536:             <pre class="programlisting">
1.51      rillig   8537:     # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1       grant    8538: 
1.51      rillig   8539:     BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH}+
                   8540:     TIFF_BUILDLINK3_MK:=    ${TIFF_BUILDLINK3_MK}+
1.1       grant    8541: 
1.51      rillig   8542:     .if !empty(BUILDLINK_DEPTH:M+)
                   8543:     BUILDLINK_DEPENDS+=     tiff
                   8544:     .endif
1.1       grant    8545: 
1.51      rillig   8546:     BUILDLINK_PACKAGES:=    ${BUILDLINK_PACKAGES:Ntiff}
                   8547:     BUILDLINK_PACKAGES+=    tiff
1.1       grant    8548: 
1.51      rillig   8549:     .if !empty(TIFF_BUILDLINK3_MK:M+)
                   8550:     BUILDLINK_DEPENDS.tiff+=        tiff&gt;=3.6.1
                   8551:     BUILDLINK_PKGSRCDIR.tiff?=      ../../graphics/tiff
                   8552:     .endif  # TIFF_BUILDLINK3_MK
1.1       grant    8553: 
1.51      rillig   8554:     .include "../../devel/zlib/buildlink3.mk"
                   8555:     .include "../../graphics/jpeg/buildlink3.mk"
1.1       grant    8556: 
1.51      rillig   8557:     BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH:S/+$//}
1.1       grant    8558: </pre>
                   8559: 
1.14      xtraeme  8560:             <p>The header and footer manipulate <code class=
                   8561:             "varname">BUILDLINK_DEPTH</code>, which is common
1.45      wiz      8562:             across all <code xmlns=
                   8563:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8564:             "filename">buildlink3.mk</code> files and is used to
                   8565:             track at what depth we are including <code xmlns=
                   8566:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8567:             "filename">buildlink3.mk</code> files.</p>
1.1       grant    8568: 
                   8569:             <p>The first section controls if the dependency on
1.14      xtraeme  8570:             <em class="replaceable"><code>pkg</code></em> is added.
                   8571:             <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1       grant    8572:             global list of packages for which dependencies are
                   8573:             added by buildlink3.</p>
                   8574: 
                   8575:             <p>The second section advises pkgsrc that the
1.45      wiz      8576:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8577:             class="filename">buildlink3.mk</code> file for
1.14      xtraeme  8578:             <em class="replaceable"><code>pkg</code></em> has been
                   8579:             included at some point. <code class=
                   8580:             "varname">BUILDLINK_PACKAGES</code> is the global list
1.45      wiz      8581:             of packages for which <code xmlns=
                   8582:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8583:             "filename">buildlink3.mk</code> files have been
                   8584:             included. It must <span class=
                   8585:             "emphasis"><em>always</em></span> be appended to within
1.45      wiz      8586:             a <code xmlns=
                   8587:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8588:             "filename">buildlink3.mk</code> file.</p>
1.1       grant    8589: 
                   8590:             <p>The third section is protected from multiple
1.14      xtraeme  8591:             inclusion and controls how the dependency on <em class=
                   8592:             "replaceable"><code>pkg</code></em> is added. Several
1.1       grant    8593:             important variables are set in the section:</p>
                   8594: 
                   8595:             <div class="itemizedlist">
                   8596:               <ul type="disc">
                   8597:                 <li>
1.14      xtraeme  8598:                   <p><code class=
                   8599:                   "varname">BUILDLINK_DEPENDS.<em class=
                   8600:                   "replaceable"><code>pkg</code></em></code> is the
                   8601:                   actual dependency recorded in the installed
                   8602:                   package; this should always be set using
                   8603:                   <span><strong class="command">+=</strong></span>
                   8604:                   to ensure that we're appending to any
                   8605:                   pre-existing list of values. This variable should
                   8606:                   be set to the first version of the package that
                   8607:                   had the last change in the major number of a
                   8608:                   shared library or that had a major API
                   8609:                   change.</p>
1.1       grant    8610:                 </li>
                   8611: 
                   8612:                 <li>
1.14      xtraeme  8613:                   <p><code class=
                   8614:                   "varname">BUILDLINK_PKGSRCDIR.<em class=
                   8615:                   "replaceable"><code>pkg</code></em></code> is the
                   8616:                   location of the <em class=
                   8617:                   "replaceable"><code>pkg</code></em> pkgsrc
1.47      reed     8618:                   directory.</p>
1.1       grant    8619:                 </li>
                   8620: 
                   8621:                 <li>
1.14      xtraeme  8622:                   <p><code class=
                   8623:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   8624:                   "replaceable"><code>pkg</code></em></code> (not
                   8625:                   shown above) controls whether we use <code class=
                   8626:                   "varname">BUILD_DEPENDS</code> or <code class=
                   8627:                   "varname">DEPENDS</code> to add the dependency on
                   8628:                   <em class="replaceable"><code>pkg</code></em>.
                   8629:                   The build dependency is selected by setting
                   8630:                   <code class=
                   8631:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   8632:                   "replaceable"><code>pkg</code></em></code> to
1.1       grant    8633:                   &#8220;<span class="quote">build</span>&#8221;.
                   8634:                   By default, the full dependency is used.</p>
                   8635:                 </li>
                   8636: 
                   8637:                 <li>
1.14      xtraeme  8638:                   <p><code class=
                   8639:                   "varname">BUILDLINK_INCDIRS.<em class=
                   8640:                   "replaceable"><code>pkg</code></em></code> and
                   8641:                   <code class=
1.59    ! rillig   8642:                   "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
        !          8643:                   <code>pkg</code></em></code> (not shown above)
        !          8644:                   are lists of subdirectories of <code xmlns=
1.45      wiz      8645:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8646:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8647:                   "replaceable"><code>pkg</code></em>}</code> to
                   8648:                   add to the header and library search paths. These
1.1       grant    8649:                   default to &#8220;<span class=
                   8650:                   "quote">include</span>&#8221; and
                   8651:                   &#8220;<span class="quote">lib</span>&#8221;
                   8652:                   respectively.</p>
                   8653:                 </li>
                   8654: 
                   8655:                 <li>
1.14      xtraeme  8656:                   <p><code class=
                   8657:                   "varname">BUILDLINK_CPPFLAGS.<em class=
                   8658:                   "replaceable"><code>pkg</code></em></code> (not
                   8659:                   shown above) is the list of preprocessor flags to
                   8660:                   add to <code class="varname">CPPFLAGS</code>,
                   8661:                   which are passed on to the configure and build
                   8662:                   phases. The &#8220;<span class=
                   8663:                   "quote">-I</span>&#8221; option should be avoided
                   8664:                   and instead be handled using <code class=
                   8665:                   "varname">BUILDLINK_INCDIRS.<em class=
                   8666:                   "replaceable"><code>pkg</code></em></code> as
                   8667:                   above.</p>
1.1       grant    8668:                 </li>
                   8669:               </ul>
                   8670:             </div>
                   8671: 
                   8672:             <p>The following variables are all optionally defined
                   8673:             within this second section (protected against multiple
                   8674:             inclusion) and control which package files are
1.45      wiz      8675:             symlinked into <code xmlns=
                   8676:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8677:             "filename">${BUILDLINK_DIR}</code> and how their names
1.1       grant    8678:             are transformed during the symlinking:</p>
                   8679: 
                   8680:             <div class="itemizedlist">
                   8681:               <ul type="disc">
                   8682:                 <li>
1.14      xtraeme  8683:                   <p><code class=
                   8684:                   "varname">BUILDLINK_FILES.<em class=
                   8685:                   "replaceable"><code>pkg</code></em></code> (not
                   8686:                   shown above) is a shell glob pattern relative to
1.45      wiz      8687:                   <code xmlns=
                   8688:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8689:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8690:                   "replaceable"><code>pkg</code></em>}</code> to be
1.45      wiz      8691:                   symlinked into <code xmlns=
                   8692:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8693:                   "filename">${BUILDLINK_DIR}</code>, e.g.
1.45      wiz      8694:                   <code xmlns=
                   8695:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8696:                   "filename">include/*.h</code>.</p>
1.1       grant    8697:                 </li>
                   8698: 
                   8699:                 <li>
1.14      xtraeme  8700:                   <p><code class=
                   8701:                   "varname">BUILDLINK_FILES_CMD.<em class=
                   8702:                   "replaceable"><code>pkg</code></em></code> (not
                   8703:                   shown above) is a shell pipeline that outputs to
1.45      wiz      8704:                   stdout a list of files relative to <code xmlns=
                   8705:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8706:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8707:                   "replaceable"><code>pkg</code></em>}</code>. The
1.1       grant    8708:                   resulting files are to be symlinked into
1.45      wiz      8709:                   <code xmlns=
                   8710:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8711:                   "filename">${BUILDLINK_DIR}</code>. By default,
                   8712:                   this takes the <code xmlns=
                   8713:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8714:                   "filename">+CONTENTS</code> of a <em class=
                   8715:                   "replaceable"><code>pkg</code></em> and filters
                   8716:                   it through <code class=
                   8717:                   "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
                   8718:                   "replaceable"><code>pkg</code></em>}</code>.</p>
1.1       grant    8719:                 </li>
                   8720: 
                   8721:                 <li>
1.14      xtraeme  8722:                   <p><code class=
                   8723:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   8724:                   "replaceable"><code>pkg</code></em></code> (not
                   8725:                   shown above) is a filter command that filters
1.45      wiz      8726:                   <code xmlns=
                   8727:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8728:                   "filename">+CONTENTS</code> input into a list of
                   8729:                   files relative to <code xmlns=
                   8730:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8731:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8732:                   "replaceable"><code>pkg</code></em>}</code> on
                   8733:                   stdout. By default for overwrite packages,
                   8734:                   <code class=
                   8735:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   8736:                   "replaceable"><code>pkg</code></em></code>
1.45      wiz      8737:                   outputs the contents of the <code xmlns=
                   8738:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8739:                   "filename">include</code> and <code xmlns=
                   8740:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8741:                   "filename">lib</code> directories in the package
1.45      wiz      8742:                   <code xmlns=
                   8743:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8744:                   "filename">+CONTENTS</code>, and for pkgviews
                   8745:                   packages, it outputs any libtool archives in
                   8746:                   <code xmlns=
                   8747:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8748:                   "filename">lib</code> directories.</p>
1.1       grant    8749:                 </li>
                   8750: 
                   8751:                 <li>
1.14      xtraeme  8752:                   <p><code class=
                   8753:                   "varname">BUILDLINK_TRANSFORM.<em class=
                   8754:                   "replaceable"><code>pkg</code></em></code> (not
                   8755:                   shown above) is a list of sed arguments used to
1.1       grant    8756:                   transform the name of the source filename into a
1.14      xtraeme  8757:                   destination filename, e.g. <span><strong class=
1.1       grant    8758:                   "command">-e
1.14      xtraeme  8759:                   "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1       grant    8760:                 </li>
                   8761:               </ul>
                   8762:             </div>
                   8763: 
1.45      wiz      8764:             <p>The last section includes any <code xmlns=
                   8765:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8766:             "filename">buildlink3.mk</code> needed for <em class=
                   8767:             "replaceable"><code>pkg</code></em>'s library
1.45      wiz      8768:             dependencies. Including these <code xmlns=
                   8769:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8770:             "filename">buildlink3.mk</code> files means that the
                   8771:             headers and libraries for these dependencies are also
1.45      wiz      8772:             symlinked into <code xmlns=
                   8773:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8774:             "filename">${BUILDLINK_DIR}</code> whenever the
                   8775:             <em class="replaceable"><code>pkg</code></em>
1.45      wiz      8776:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8777:             class="filename">buildlink3.mk</code> file is
1.14      xtraeme  8778:             included.</p>
1.1       grant    8779:           </div>
                   8780: 
1.59    ! rillig   8781:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    8782:             <div class="titlepage">
                   8783:               <div>
                   8784:                 <div>
1.30      wiz      8785:                   <h3 class="title"><a name=
1.59    ! rillig   8786:                   "updating-buildlink-depends" id=
        !          8787:                   "updating-buildlink-depends"></a>11.2.2. Updating
1.30      wiz      8788:                   <code class=
1.59    ! rillig   8789:                   "varname">BUILDLINK_DEPENDS.<em class="replaceable">
        !          8790:                   <code>pkg</code></em></code> in <code xmlns=
1.45      wiz      8791:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      8792:                   "filename">buildlink3.mk</code> files</h3>
1.1       grant    8793:                 </div>
                   8794:               </div>
                   8795:             </div>
                   8796: 
                   8797:             <p>There are two situations that require increasing the
1.14      xtraeme  8798:             dependency listed in <code class=
                   8799:             "varname">BUILDLINK_DEPENDS.<em class=
                   8800:             "replaceable"><code>pkg</code></em></code> after a
                   8801:             package update:</p>
1.1       grant    8802: 
                   8803:             <div class="orderedlist">
                   8804:               <ol type="1">
                   8805:                 <li>
                   8806:                   <p>if the sonames (major number of the library
                   8807:                   version) of any installed shared libraries
1.47      reed     8808:                   change.</p>
1.1       grant    8809:                 </li>
                   8810: 
                   8811:                 <li>
                   8812:                   <p>if the API or interface to the header files
                   8813:                   change.</p>
                   8814:                 </li>
                   8815:               </ol>
                   8816:             </div>
                   8817: 
1.14      xtraeme  8818:             <p>In these cases, <code class=
                   8819:             "varname">BUILDLINK_DEPENDS.<em class=
                   8820:             "replaceable"><code>pkg</code></em></code> should be
                   8821:             adjusted to require at least the new package version.
                   8822:             In some cases, the packages that depend on this new
                   8823:             version may need their <code class=
                   8824:             "varname">PKGREVISION</code>s increased and, if they
1.45      wiz      8825:             have <code xmlns=
                   8826:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8827:             "filename">buildlink3.mk</code> files, their
                   8828:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   8829:             "replaceable"><code>pkg</code></em></code> adjusted,
                   8830:             too. This is needed so that binary packages made using
                   8831:             it will require the correct package dependency and not
                   8832:             settle for an older one which will not contain the
                   8833:             necessary shared libraries.</p>
1.1       grant    8834: 
                   8835:             <p>Please take careful consideration before adjusting
1.14      xtraeme  8836:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   8837:             "replaceable"><code>pkg</code></em></code> as we don't
                   8838:             want to cause unneeded package deletions and rebuilds.
                   8839:             In many cases, new versions of packages work just fine
                   8840:             with older dependencies. See <a href="#dependencies"
1.59    ! rillig   8841:             title="15.1.4.&nbsp;Handling dependencies">Section
        !          8842:             15.1.4, &#8220;Handling dependencies&#8221;</a> for
        !          8843:             more information about dependencies on other packages,
1.25      rillig   8844:             including the <code class=
                   8845:             "varname">BUILDLINK_RECOMMENDED</code> and <code class=
                   8846:             "varname">RECOMMENDED</code> definitions.</p>
1.1       grant    8847:           </div>
                   8848:         </div>
                   8849: 
1.59    ! rillig   8850:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    8851:           <div class="titlepage">
                   8852:             <div>
                   8853:               <div>
                   8854:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   8855:                 "writing-builtin.mk" id=
1.38      dillo    8856:                 "writing-builtin.mk"></a>11.3.&nbsp;Writing
1.45      wiz      8857:                 <code xmlns=
                   8858:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8859:                 "filename">builtin.mk</code> files</h2>
1.1       grant    8860:               </div>
                   8861:             </div>
                   8862:           </div>
                   8863: 
                   8864:           <p>Some packages in pkgsrc install headers and libraries
                   8865:           that coincide with headers and libraries present in the
1.45      wiz      8866:           base system. Aside from a <code xmlns=
                   8867:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8868:           "filename">buildlink3.mk</code> file, these packages
1.45      wiz      8869:           should also include a <code xmlns=
                   8870:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8871:           "filename">builtin.mk</code> file that includes the
                   8872:           necessary checks to decide whether using the built-in
                   8873:           software or the pkgsrc software is appropriate.</p>
1.1       grant    8874: 
                   8875:           <p>The only requirements of a builtin.mk file for
1.14      xtraeme  8876:           <em class="replaceable"><code>pkg</code></em> are:</p>
1.1       grant    8877: 
                   8878:           <div class="orderedlist">
                   8879:             <ol type="1">
                   8880:               <li>
1.14      xtraeme  8881:                 <p>It should set <code class=
                   8882:                 "varname">USE_BUILTIN.<em class=
                   8883:                 "replaceable"><code>pkg</code></em></code> to
                   8884:                 either &#8220;<span class="quote">yes</span>&#8221;
                   8885:                 or &#8220;<span class="quote">no</span>&#8221;
                   8886:                 after it is included.</p>
1.1       grant    8887:               </li>
                   8888: 
                   8889:               <li>
                   8890:                 <p>It should <span class=
                   8891:                 "emphasis"><em>not</em></span> override any
1.14      xtraeme  8892:                 <code class="varname">USE_BUILTIN.<em class=
                   8893:                 "replaceable"><code>pkg</code></em></code> which is
1.45      wiz      8894:                 already set before the <code xmlns=
                   8895:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8896:                 "filename">builtin.mk</code> file is included.</p>
1.1       grant    8897:               </li>
                   8898: 
                   8899:               <li>
                   8900:                 <p>It should be written to allow multiple
                   8901:                 inclusion. This is <span class=
                   8902:                 "emphasis"><em>very</em></span> important and takes
1.45      wiz      8903:                 careful attention to <code xmlns=
                   8904:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8905:                 "filename">Makefile</code> coding.</p>
1.1       grant    8906:               </li>
                   8907:             </ol>
                   8908:           </div>
                   8909: 
1.59    ! rillig   8910:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    8911:             <div class="titlepage">
                   8912:               <div>
                   8913:                 <div>
1.59    ! rillig   8914:                   <h3 class="title"><a name="anatomy-of-builtin.mk"
        !          8915:                   id=
1.38      dillo    8916:                   "anatomy-of-builtin.mk"></a>11.3.1.&nbsp;Anatomy
1.45      wiz      8917:                   of a <code xmlns=
                   8918:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8919:                   "filename">builtin.mk</code> file</h3>
1.1       grant    8920:                 </div>
                   8921:               </div>
                   8922:             </div>
                   8923: 
                   8924:             <p>The following is the recommended template for
                   8925:             builtin.mk files:</p>
                   8926:             <pre class="programlisting">
1.51      rillig   8927:     .if !defined(IS_BUILTIN.foo)
                   8928:     #
                   8929:     # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
                   8930:     # genuinely exists in the system or not.
                   8931:     #
                   8932:     IS_BUILTIN.foo?=        no
                   8933: 
                   8934:     # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
                   8935:     # version can be determined.
                   8936:     #
                   8937:     .  if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
                   8938:     BUILTIN_PKG.foo?=       foo-1.0
                   8939:     .  endif
                   8940:     .endif  # IS_BUILTIN.foo
                   8941: 
                   8942:     .if !defined(USE_BUILTIN.foo)
                   8943:     USE_BUILTIN.foo?=       ${IS_BUILTIN.foo}
                   8944:     .  if defined(BUILTIN_PKG.foo)
                   8945:     .    for _depend_ in ${BUILDLINK_DEPENDS.foo}
                   8946:     .      if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
                   8947:     USE_BUILTIN.foo!=                                                       \
                   8948:           if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then     \
                   8949:                   ${ECHO} "yes";                                            \
                   8950:           else                                                              \
                   8951:                   ${ECHO} "no";                                             \
                   8952:           fi
                   8953:     .      endif
                   8954:     .    endfor
                   8955:     .  endif
                   8956:     .endif  # USE_BUILTIN.foo
                   8957: 
                   8958:     CHECK_BUILTIN.foo?=     no
                   8959:     .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
                   8960:     #
                   8961:     # Here we place code that depends on whether USE_BUILTIN.foo is set to
                   8962:     # "yes" or "no".
                   8963:     #
                   8964:     .endif  # CHECK_BUILTIN.foo
1.1       grant    8965: </pre>
                   8966: 
1.14      xtraeme  8967:             <p>The first section sets <code class=
                   8968:             "varname">IS_BUILTIN.<em class=
                   8969:             "replaceable"><code>pkg</code></em></code> depending on
                   8970:             if <em class="replaceable"><code>pkg</code></em> really
                   8971:             exists in the base system. This should not be a base
                   8972:             system software with similar functionality to
                   8973:             <em class="replaceable"><code>pkg</code></em>; it
                   8974:             should only be &#8220;<span class=
                   8975:             "quote">yes</span>&#8221; if the actual package is
                   8976:             included as part of the base system. This variable is
1.45      wiz      8977:             only used internally within the <code xmlns=
                   8978:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8979:             "filename">builtin.mk</code> file.</p>
                   8980: 
                   8981:             <p>The second section sets <code class=
                   8982:             "varname">BUILTIN_PKG.<em class=
                   8983:             "replaceable"><code>pkg</code></em></code> to the
                   8984:             version of <em class=
                   8985:             "replaceable"><code>pkg</code></em> in the base system
                   8986:             if it exists (if <code class=
                   8987:             "varname">IS_BUILTIN.<em class=
                   8988:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    8989:             &#8220;<span class="quote">yes</span>&#8221;). This
1.14      xtraeme  8990:             variable is only used internally within the
1.45      wiz      8991:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8992:             class="filename">builtin.mk</code> file.</p>
1.1       grant    8993: 
1.14      xtraeme  8994:             <p>The third section sets <code class=
                   8995:             "varname">USE_BUILTIN.<em class=
                   8996:             "replaceable"><code>pkg</code></em></code> and is
                   8997:             <span class="emphasis"><em>required</em></span> in all
1.45      wiz      8998:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8999:             class="filename">builtin.mk</code> files. The code in
                   9000:             this section must make the determination whether the
                   9001:             built-in software is adequate to satisfy the
                   9002:             dependencies listed in <code class=
1.14      xtraeme  9003:             "varname">BUILDLINK_DEPENDS.<em class=
                   9004:             "replaceable"><code>pkg</code></em></code>. This is
                   9005:             typically done by comparing <code class=
                   9006:             "varname">BUILTIN_PKG.<em class=
                   9007:             "replaceable"><code>pkg</code></em></code> against each
                   9008:             of the dependencies in <code class=
                   9009:             "varname">BUILDLINK_DEPENDS.<em class=
                   9010:             "replaceable"><code>pkg</code></em></code>.
                   9011:             <code class="varname">USE_BUILTIN.<em class=
                   9012:             "replaceable"><code>pkg</code></em></code> <span class=
1.1       grant    9013:             "emphasis"><em>must</em></span> be set to the correct
1.45      wiz      9014:             value by the end of the <code xmlns=
                   9015:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9016:             "filename">builtin.mk</code> file. Note that
                   9017:             <code class="varname">USE_BUILTIN.<em class=
                   9018:             "replaceable"><code>pkg</code></em></code> may be
1.1       grant    9019:             &#8220;<span class="quote">yes</span>&#8221; even if
1.14      xtraeme  9020:             <code class="varname">IS_BUILTIN.<em class=
                   9021:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    9022:             &#8220;<span class="quote">no</span>&#8221; because we
                   9023:             may make the determination that the built-in version of
                   9024:             the software is similar enough to be used as a
                   9025:             replacement.</p>
                   9026: 
1.14      xtraeme  9027:             <p>The last section is guarded by <code class=
                   9028:             "varname">CHECK_BUILTIN.<em class=
                   9029:             "replaceable"><code>pkg</code></em></code>, and
                   9030:             includes code that uses the value of <code class=
                   9031:             "varname">USE_BUILTIN.<em class=
                   9032:             "replaceable"><code>pkg</code></em></code> set in the
                   9033:             previous section. This typically includes, e.g., adding
1.1       grant    9034:             additional dependency restrictions and listing
1.45      wiz      9035:             additional files to symlink into <code xmlns=
                   9036:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9037:             "filename">${BUILDLINK_DIR}</code> (via <code class=
                   9038:             "varname">BUILDLINK_FILES.<em class=
                   9039:             "replaceable"><code>pkg</code></em></code>).</p>
1.1       grant    9040:           </div>
                   9041: 
1.59    ! rillig   9042:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    9043:             <div class="titlepage">
                   9044:               <div>
                   9045:                 <div>
1.30      wiz      9046:                   <h3 class="title"><a name=
1.59    ! rillig   9047:                   "native-or-pkgsrc-preference" id=
1.38      dillo    9048:                   "native-or-pkgsrc-preference"></a>11.3.2.&nbsp;Global
1.30      wiz      9049:                   preferences for native or pkgsrc software</h3>
1.1       grant    9050:                 </div>
                   9051:               </div>
                   9052:             </div>
                   9053: 
                   9054:             <p>When building packages, it's possible to choose
                   9055:             whether to set a global preference for using either the
                   9056:             built-in (native) version or the pkgsrc version of
                   9057:             software to satisfy a dependency. This is controlled by
1.14      xtraeme  9058:             setting <code class="varname">PREFER_PKGSRC</code> and
                   9059:             <code class="varname">PREFER_NATIVE</code>. These
                   9060:             variables take values of either &#8220;<span class=
1.1       grant    9061:             "quote">yes</span>&#8221;, &#8220;<span class=
                   9062:             "quote">no</span>&#8221;, or a list of packages.
1.14      xtraeme  9063:             <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
                   9064:             to use the pkgsrc versions of software, while
                   9065:             <code class="varname">PREFER_NATIVE</code> tells pkgsrc
                   9066:             to use the built-in versions. Preferences are
                   9067:             determined by the most specific instance of the package
                   9068:             in either <code class="varname">PREFER_PKGSRC</code> or
                   9069:             <code class="varname">PREFER_NATIVE</code>. If a
                   9070:             package is specified in neither or in both variables,
                   9071:             then <code class="varname">PREFER_PKGSRC</code> has
                   9072:             precedence over <code class=
                   9073:             "varname">PREFER_NATIVE</code>. For example, to require
                   9074:             using pkgsrc versions of software for all but the most
                   9075:             basic bits on a NetBSD system, you can set:</p>
1.1       grant    9076:             <pre class="programlisting">
1.51      rillig   9077:     PREFER_PKGSRC=  yes
                   9078:     PREFER_NATIVE=  getopt skey tcp_wrappers
1.1       grant    9079: </pre>
                   9080: 
                   9081:             <p>A package <span class=
1.45      wiz      9082:             "emphasis"><em>must</em></span> have a <code xmlns=
                   9083:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9084:             "filename">builtin.mk</code> file to be listed in
                   9085:             <code class="varname">PREFER_NATIVE</code>, otherwise
                   9086:             it is simply ignored in that list.</p>
1.1       grant    9087:           </div>
                   9088:         </div>
                   9089:       </div>
                   9090: 
1.59    ! rillig   9091:       <div class="chapter" lang="en" xml:lang="en">
1.1       grant    9092:         <div class="titlepage">
                   9093:           <div>
                   9094:             <div>
1.59    ! rillig   9095:               <h2 class="title"><a name="pkginstall" id=
1.38      dillo    9096:               "pkginstall"></a>Chapter&nbsp;12.&nbsp;The pkginstall
1.35      jmmv     9097:               framework</h2>
1.1       grant    9098:             </div>
                   9099:           </div>
                   9100:         </div>
                   9101: 
                   9102:         <div class="toc">
                   9103:           <p><b>Table of Contents</b></p>
                   9104: 
                   9105:           <dl>
1.30      wiz      9106:             <dt><span class="sect1"><a href=
1.38      dillo    9107:             "#files-and-dirs-outside-prefix">12.1. Files and
1.35      jmmv     9108:             directories outside the installation
                   9109:             prefix</a></span></dt>
                   9110: 
                   9111:             <dd>
                   9112:               <dl>
                   9113:                 <dt><span class="sect2"><a href=
1.38      dillo    9114:                 "#dirs-outside-prefix">12.1.1. Directory
1.35      jmmv     9115:                 manipulation</a></span></dt>
                   9116: 
                   9117:                 <dt><span class="sect2"><a href=
1.38      dillo    9118:                 "#files-outside-prefix">12.1.2. File
1.35      jmmv     9119:                 manipulation</a></span></dt>
                   9120:               </dl>
                   9121:             </dd>
                   9122: 
1.38      dillo    9123:             <dt><span class="sect1"><a href="#conf-files">12.2.
1.35      jmmv     9124:             Configuration files</a></span></dt>
                   9125: 
                   9126:             <dd>
                   9127:               <dl>
                   9128:                 <dt><span class="sect2"><a href=
1.38      dillo    9129:                 "#conf-files-sysconfdir">12.2.1. How <code class=
1.35      jmmv     9130:                 "varname">PKG_SYSCONFDIR</code> is
                   9131:                 set</a></span></dt>
                   9132: 
                   9133:                 <dt><span class="sect2"><a href=
1.38      dillo    9134:                 "#conf-files-configure">12.2.2. Telling the
1.47      reed     9135:                 software where configuration files
1.35      jmmv     9136:                 are</a></span></dt>
                   9137: 
                   9138:                 <dt><span class="sect2"><a href=
1.38      dillo    9139:                 "#conf-files-patching">12.2.3. Patching
1.35      jmmv     9140:                 installations</a></span></dt>
                   9141: 
                   9142:                 <dt><span class="sect2"><a href=
1.38      dillo    9143:                 "#conf-files-disable">12.2.4. Disabling handling of
1.35      jmmv     9144:                 configuration files</a></span></dt>
                   9145:               </dl>
                   9146:             </dd>
                   9147: 
1.38      dillo    9148:             <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35      jmmv     9149:             System startup scripts</a></span></dt>
                   9150: 
                   9151:             <dd>
                   9152:               <dl>
                   9153:                 <dt><span class="sect2"><a href=
1.38      dillo    9154:                 "#rcd-scripts-disable">12.3.1. Disabling handling
1.35      jmmv     9155:                 of system startup scripts</a></span></dt>
                   9156:               </dl>
                   9157:             </dd>
1.1       grant    9158: 
1.30      wiz      9159:             <dt><span class="sect1"><a href=
1.38      dillo    9160:             "#users-and-groups">12.4. System users and
1.35      jmmv     9161:             groups</a></span></dt>
                   9162: 
1.38      dillo    9163:             <dt><span class="sect1"><a href="#shells">12.5. System
1.35      jmmv     9164:             shells</a></span></dt>
                   9165: 
                   9166:             <dd>
                   9167:               <dl>
                   9168:                 <dt><span class="sect2"><a href=
1.38      dillo    9169:                 "#shells-disable">12.5.1. Disabling handling of
1.35      jmmv     9170:                 configuration files</a></span></dt>
                   9171:               </dl>
                   9172:             </dd>
1.1       grant    9173:           </dl>
                   9174:         </div>
                   9175: 
1.35      jmmv     9176:         <p>This chapter describes the framework known as
                   9177:         <code class="literal">pkginstall</code>, whose key features
                   9178:         are:</p>
                   9179: 
                   9180:         <div class="itemizedlist">
                   9181:           <ul type="disc">
                   9182:             <li>
                   9183:               <p>Generic installation and manipulation of
                   9184:               directories and files outside the pkgsrc-handled
                   9185:               tree, <code class="varname">LOCALBASE</code>.</p>
                   9186:             </li>
                   9187: 
                   9188:             <li>
                   9189:               <p>Automatic handling of configuration files during
                   9190:               installation, provided that packages are correctly
                   9191:               designed.</p>
                   9192:             </li>
                   9193: 
                   9194:             <li>
                   9195:               <p>Generation and installation of system startup
                   9196:               scripts.</p>
                   9197:             </li>
                   9198: 
                   9199:             <li>
                   9200:               <p>Registration of system users and groups.</p>
                   9201:             </li>
                   9202: 
                   9203:             <li>
                   9204:               <p>Registration of system shells.</p>
                   9205:             </li>
                   9206:           </ul>
                   9207:         </div>
                   9208: 
                   9209:         <p>The following sections inspect each of the above points
1.47      reed     9210:         in detail. Note that in order to use any of the described
1.35      jmmv     9211:         functionalities, you must add the following to your
1.45      wiz      9212:         package's <code xmlns=
                   9213:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   9214:         "filename">Makefile</code>:</p>
1.35      jmmv     9215:         <pre class="programlisting">
1.51      rillig   9216:     USE_PKGINSTALL= YES
1.35      jmmv     9217: </pre>
                   9218: 
                   9219:         <p>You may be thinking that many of the things described
                   9220:         here could be easily done with simple code in the package's
                   9221:         post-installation target (<code class=
                   9222:         "literal">post-install</code>). <span class=
                   9223:         "emphasis"><em>This is incorrect</em></span>, as the code
                   9224:         in them is only executed when building from source.
                   9225:         Machines using binary packages could not benefit from it at
                   9226:         all (as the code itself could be unavailable). Therefore,
                   9227:         the only way to achieve any of the items described above is
                   9228:         by means of the installation scripts, which are
                   9229:         automatically generated by pkginstall.</p>
1.1       grant    9230: 
1.59    ! rillig   9231:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    9232:           <div class="titlepage">
                   9233:             <div>
                   9234:               <div>
                   9235:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   9236:                 "files-and-dirs-outside-prefix" id=
        !          9237:                 "files-and-dirs-outside-prefix"></a>12.1. Files and
        !          9238:                 directories outside the installation prefix</h2>
1.1       grant    9239:               </div>
                   9240:             </div>
                   9241:           </div>
                   9242: 
1.45      wiz      9243:           <p>As you already know, the <code xmlns=
                   9244:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9245:           "filename">PLIST</code> file holds a list of files and
                   9246:           directories that belong to a package. The names used in
1.45      wiz      9247:           it are relative to the installation prefix (<code xmlns=
                   9248:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9249:           "filename">${PREFIX}</code>), which means that it cannot
                   9250:           register files outside this directory (absolute path
                   9251:           names are not allowed). Despite this restriction, some
                   9252:           packages need to install files outside this location;
1.45      wiz      9253:           e.g., under <code xmlns=
                   9254:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   9255:           "filename">${VARBASE}</code> or <code xmlns=
                   9256:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   9257:           "filename">${PKG_SYSCONFDIR}</code>.</p>
1.35      jmmv     9258: 
                   9259:           <p>The only way to achieve this is to create such files
                   9260:           during installation time by using the installation
                   9261:           scripts. These scripts can run arbitrary commands, so
                   9262:           they have the potential to create and manage files
1.47      reed     9263:           anywhere in the file system. Here is where pkginstall
1.35      jmmv     9264:           comes into play: it provides generic scripts to abstract
                   9265:           the manipulation of such files and directories based on
1.45      wiz      9266:           variables set in the package's <code xmlns=
                   9267:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9268:           "filename">Makefile</code>. The rest of this section
1.47      reed     9269:           describes these variables.</p>
1.1       grant    9270: 
1.59    ! rillig   9271:           <div class="sect2" lang="en" xml:lang="en">
1.35      jmmv     9272:             <div class="titlepage">
1.1       grant    9273:               <div>
1.35      jmmv     9274:                 <div>
1.59    ! rillig   9275:                   <h3 class="title"><a name="dirs-outside-prefix"
        !          9276:                   id="dirs-outside-prefix"></a>12.1.1. Directory
1.35      jmmv     9277:                   manipulation</h3>
                   9278:                 </div>
1.1       grant    9279:               </div>
                   9280:             </div>
                   9281: 
1.35      jmmv     9282:             <p>The following variables can be set to request the
1.47      reed     9283:             creation of directories anywhere in the file
                   9284:             system:</p>
1.27      rillig   9285: 
1.35      jmmv     9286:             <div class="itemizedlist">
                   9287:               <ul type="disc">
                   9288:                 <li>
                   9289:                   <p><code class="varname">MAKE_DIRS</code> and
                   9290:                   <code class="varname">OWN_DIRS</code> contain a
                   9291:                   list of directories that should be created and
                   9292:                   should attempt to be destroyed by the
                   9293:                   installation scripts. The difference between the
                   9294:                   two is that the latter prompts the administrator
                   9295:                   to remove any directories that may be left after
                   9296:                   deinstallation (because they were not empty),
                   9297:                   while the former does not.</p>
                   9298:                 </li>
1.1       grant    9299: 
1.35      jmmv     9300:                 <li>
                   9301:                   <p><code class="varname">MAKE_DIRS_PERMS</code>
                   9302:                   and <code class="varname">OWN_DIRS_PERMS</code>
                   9303:                   contain a list of tuples describing which
                   9304:                   directories should be created and should attempt
                   9305:                   to be destroyed by the installation scripts. Each
                   9306:                   tuple holds the following values, separated by
                   9307:                   spaces: the directory name, its owner, its group
                   9308:                   and its numerical mode. For example:</p>
                   9309:                   <pre class="programlisting">
1.51      rillig   9310:     MAKE_DIRS_PERMS+=         ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
1.35      jmmv     9311: </pre>
1.1       grant    9312: 
1.35      jmmv     9313:                   <p>The difference between the two is exactly the
                   9314:                   same as their non-<code class=
                   9315:                   "varname">PERMS</code> counterparts.</p>
                   9316:                 </li>
                   9317:               </ul>
                   9318:             </div>
                   9319:           </div>
                   9320: 
1.59    ! rillig   9321:           <div class="sect2" lang="en" xml:lang="en">
1.35      jmmv     9322:             <div class="titlepage">
                   9323:               <div>
                   9324:                 <div>
1.59    ! rillig   9325:                   <h3 class="title"><a name="files-outside-prefix"
        !          9326:                   id="files-outside-prefix"></a>12.1.2. File
1.35      jmmv     9327:                   manipulation</h3>
                   9328:                 </div>
                   9329:               </div>
                   9330:             </div>
                   9331: 
                   9332:             <p>Creating non-empty files outside the installation
1.45      wiz      9333:             prefix is tricky because the <code xmlns=
                   9334:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9335:             "filename">PLIST</code> forces all files to be inside
                   9336:             it. To overcome this problem, the only solution is to
                   9337:             extract the file in the known place (i.e., inside the
                   9338:             installation prefix) and copy it to the appropriate
                   9339:             location during installation (done by the installation
                   9340:             scripts generated by pkginstall). We will call the
                   9341:             former the <span class="emphasis"><em>master
                   9342:             file</em></span> in the following paragraphs, which
                   9343:             describe the variables that can be used to
                   9344:             automatically and consistently handle files outside the
                   9345:             installation prefix:</p>
                   9346: 
                   9347:             <div class="itemizedlist">
                   9348:               <ul type="disc">
                   9349:                 <li>
                   9350:                   <p><code class="varname">CONF_FILES</code> and
                   9351:                   <code class="varname">SUPPORT_FILES</code> are
                   9352:                   pairs of master and target files. During
                   9353:                   installation time, the master file is copied to
                   9354:                   the target one if and only if the latter does not
                   9355:                   exist. Upon deinstallation, the target file is
                   9356:                   removed provided that it was not modified by the
                   9357:                   installation.</p>
                   9358: 
                   9359:                   <p>The difference between the two is that the
                   9360:                   latter prompts the administrator to remove any
                   9361:                   files that may be left after deinstallation
                   9362:                   (because they were not empty), while the former
                   9363:                   does not.</p>
                   9364:                 </li>
                   9365: 
                   9366:                 <li>
                   9367:                   <p><code class="varname">CONF_FILES_PERMS</code>
                   9368:                   and <code class=
                   9369:                   "varname">SUPPORT_FILES_PERMS</code> contain
                   9370:                   tuples describing master files as well as their
                   9371:                   target locations. For each of them, it also
                   9372:                   specifies their owner, their group and their
                   9373:                   numeric permissions, in this order. For
                   9374:                   example:</p>
                   9375:                   <pre class="programlisting">
1.51      rillig   9376:     SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
1.35      jmmv     9377: </pre>
                   9378: 
                   9379:                   <p>The difference between the two is exactly the
                   9380:                   same as their non-<code class=
                   9381:                   "varname">PERMS</code> counterparts.</p>
                   9382:                 </li>
                   9383:               </ul>
                   9384:             </div>
                   9385:           </div>
                   9386:         </div>
                   9387: 
1.59    ! rillig   9388:         <div class="sect1" lang="en" xml:lang="en">
1.35      jmmv     9389:           <div class="titlepage">
                   9390:             <div>
                   9391:               <div>
                   9392:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   9393:                 "conf-files" id="conf-files"></a>12.2.
        !          9394:                 Configuration files</h2>
1.35      jmmv     9395:               </div>
                   9396:             </div>
                   9397:           </div>
                   9398: 
                   9399:           <p>Configuration files are special in the sense that they
                   9400:           are installed in their own specific directory,
                   9401:           <code class="varname">PKG_SYSCONFDIR</code>, and need
                   9402:           special treatment during installation (most of which is
                   9403:           automated by pkginstall). The main concept you must bear
1.36      wiz      9404:           in mind is that files marked as configuration files are
1.35      jmmv     9405:           automatically copied to the right place (somewhere inside
                   9406:           <code class="varname">PKG_SYSCONFDIR</code>) during
                   9407:           installation <span class="emphasis"><em>if and only
                   9408:           if</em></span> they didn't exist before. Similarly, they
                   9409:           will not be removed if they have local modifications.
1.36      wiz      9410:           This ensures that administrators never lose any custom
1.35      jmmv     9411:           changes they may have made.</p>
                   9412: 
1.59    ! rillig   9413:           <div class="sect2" lang="en" xml:lang="en">
1.35      jmmv     9414:             <div class="titlepage">
                   9415:               <div>
                   9416:                 <div>
1.59    ! rillig   9417:                   <h3 class="title"><a name="conf-files-sysconfdir"
        !          9418:                   id="conf-files-sysconfdir"></a>12.2.1. How
1.35      jmmv     9419:                   <code class="varname">PKG_SYSCONFDIR</code> is
                   9420:                   set</h3>
                   9421:                 </div>
                   9422:               </div>
                   9423:             </div>
                   9424: 
                   9425:             <p>As said before, the <code class=
                   9426:             "varname">PKG_SYSCONFDIR</code> variable specifies
                   9427:             where configuration files shall be installed. Its
                   9428:             contents are set based upon the following
                   9429:             variables:</p>
                   9430: 
                   9431:             <div class="itemizedlist">
                   9432:               <ul type="disc">
                   9433:                 <li>
                   9434:                   <p><code class="varname">PKG_SYSCONFBASE</code>:
                   9435:                   The configuration's root directory. Defaults to
1.45      wiz      9436:                   <code xmlns=
                   9437:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9438:                   "filename">${PREFIX}/etc</code> although it may
                   9439:                   be overridden by the user to point to his
                   9440:                   preferred location (e.g., <code xmlns=
                   9441:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9442:                   "filename">/etc</code>, <code xmlns=
                   9443:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9444:                   "filename">/etc/pkg</code>, etc.). Packages must
                   9445:                   not use it directly.</p>
                   9446:                 </li>
                   9447: 
                   9448:                 <li>
                   9449:                   <p><code class=
                   9450:                   "varname">PKG_SYSCONFSUBDIR</code>: A
                   9451:                   subdirectory of <code class=
                   9452:                   "varname">PKG_SYSCONFBASE</code> under which the
                   9453:                   configuration files for the package being built
                   9454:                   shall be installed. The definition of this
                   9455:                   variable only makes sense in the package's
1.45      wiz      9456:                   <code xmlns=
                   9457:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     9458:                   "filename">Makefile</code> (i.e., it is not
                   9459:                   user-customizable).</p>
1.35      jmmv     9460: 
                   9461:                   <p>As an example, consider the Apache package,
                   9462:                   <a xmlns=
                   9463:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   9464:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
1.45      wiz      9465:                   target="_top"><code xmlns="" class=
                   9466:                   "filename">www/apache2</code></a>, which places
                   9467:                   its configuration files under the <code xmlns=
                   9468:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9469:                   "filename">httpd/</code> subdirectory of
                   9470:                   <code class="varname">PKG_SYSCONFBASE</code>.
                   9471:                   This should be set in the package Makefile.</p>
                   9472:                 </li>
                   9473: 
                   9474:                 <li>
                   9475:                   <p><code class="varname">PKG_SYSCONFVAR</code>:
                   9476:                   Specifies the name of the variable that holds
                   9477:                   this package's configuration directory (if
                   9478:                   different from <code class=
                   9479:                   "varname">PKG_SYSCONFBASE</code>). It defaults to
                   9480:                   <code class="varname">PKGBASE</code>'s value, and
                   9481:                   is always prefixed with <code class=
                   9482:                   "literal">PKG_SYSCONFDIR</code>.</p>
                   9483:                 </li>
                   9484: 
                   9485:                 <li>
                   9486:                   <p><code class=
                   9487:                   "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
                   9488:                   Holds the directory where the configuration files
                   9489:                   for the package identified by <code class=
                   9490:                   "varname">PKG_SYSCONFVAR</code>'s shall be
                   9491:                   placed.</p>
                   9492:                 </li>
                   9493:               </ul>
                   9494:             </div>
                   9495: 
                   9496:             <p>Based on the above variables, pkginstall determines
                   9497:             the value of <code class=
                   9498:             "varname">PKG_SYSCONFDIR</code>, which is the
                   9499:             <span class="emphasis"><em>only</em></span> variable
                   9500:             that can be used within a package to refer to its
                   9501:             configuration directory. The algorithm used to set its
                   9502:             value is basically the following:</p>
                   9503: 
                   9504:             <div class="orderedlist">
                   9505:               <ol type="1">
                   9506:                 <li>
                   9507:                   <p>If <code class=
                   9508:                   "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   9509:                   is set, its value is used.</p>
                   9510:                 </li>
                   9511: 
                   9512:                 <li>
                   9513:                   <p>If the previous variable is not defined but
                   9514:                   <code class="varname">PKG_SYSCONFSUBDIR</code> is
1.45      wiz      9515:                   set in the package's <code xmlns=
                   9516:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9517:                   "filename">Makefile</code>, the resulting value
1.45      wiz      9518:                   is <code xmlns=
                   9519:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9520:                   "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
                   9521:                 </li>
                   9522: 
                   9523:                 <li>
1.45      wiz      9524:                   <p>Otherwise, it is set to <code xmlns=
                   9525:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9526:                   "filename">${PKG_SYSCONFBASE}</code>.</p>
                   9527:                 </li>
                   9528:               </ol>
                   9529:             </div>
                   9530: 
1.45      wiz      9531:             <p>It is worth mentioning that <code xmlns=
                   9532:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9533:             "filename">${PKG_SYSCONFDIR}</code> is automatically
1.45      wiz      9534:             added to <code xmlns=
                   9535:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   9536:             "filename">OWN_DIRS</code>. See <a href=
                   9537:             "#dirs-outside-prefix" title=
1.59    ! rillig   9538:             "12.1.1.&nbsp;Directory manipulation">Section 12.1.1,
1.35      jmmv     9539:             &#8220;Directory manipulation&#8221;</a> what this
                   9540:             means.</p>
                   9541:           </div>
                   9542: 
1.59    ! rillig   9543:           <div class="sect2" lang="en" xml:lang="en">
1.35      jmmv     9544:             <div class="titlepage">
                   9545:               <div>
                   9546:                 <div>
1.59    ! rillig   9547:                   <h3 class="title"><a name="conf-files-configure"
        !          9548:                   id="conf-files-configure"></a>12.2.2. Telling the
        !          9549:                   software where configuration files are</h3>
1.35      jmmv     9550:                 </div>
                   9551:               </div>
                   9552:             </div>
                   9553: 
                   9554:             <p>Given that pkgsrc (and users!) expect configuration
                   9555:             files to be in a known place, you need to teach each
1.36      wiz      9556:             package where it shall install its files. In some cases
1.35      jmmv     9557:             you will have to patch the package Makefiles to achieve
                   9558:             it. If you are lucky, though, it may be as easy as
                   9559:             passing an extra flag to the configuration script; this
1.47      reed     9560:             is the case of GNU Autoconf- generated files:</p>
1.35      jmmv     9561:             <pre class="programlisting">
1.51      rillig   9562:     CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.35      jmmv     9563: </pre>
                   9564: 
                   9565:             <p>Note that this specifies where the package has to
                   9566:             <span class="emphasis"><em>look for</em></span> its
                   9567:             configuration files, not where they will be originally
                   9568:             installed (although the difference is never explicit,
                   9569:             unfortunately).</p>
                   9570:           </div>
                   9571: 
1.59    ! rillig   9572:           <div class="sect2" lang="en" xml:lang="en">
1.35      jmmv     9573:             <div class="titlepage">
                   9574:               <div>
                   9575:                 <div>
1.59    ! rillig   9576:                   <h3 class="title"><a name="conf-files-patching"
        !          9577:                   id="conf-files-patching"></a>12.2.3. Patching
1.35      jmmv     9578:                   installations</h3>
                   9579:                 </div>
                   9580:               </div>
                   9581:             </div>
                   9582: 
                   9583:             <p>As said before, pkginstall automatically handles
                   9584:             configuration files. This means that <span class=
                   9585:             "strong"><strong>the packages themselves must not touch
1.45      wiz      9586:             the contents of <code xmlns=
                   9587:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9588:             "filename">${PKG_SYSCONFDIR}</code>
1.36      wiz      9589:             directly</strong></span>. Bad news is that many
                   9590:             software installation scripts will, out of the box,
                   9591:             mess with the contents of that directory. So what is
                   9592:             the correct procedure to fix this issue?</p>
1.35      jmmv     9593: 
                   9594:             <p>You must teach the package (usually by manually
                   9595:             patching it) to install any configuration files under
1.45      wiz      9596:             the examples hierarchy, <code xmlns=
                   9597:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9598:             "filename">share/examples/${PKGBASE}/</code>. This way,
1.45      wiz      9599:             the <code xmlns=
                   9600:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   9601:             "filename">PLIST</code> registers them and the
                   9602:             administrator always has the original copies
1.35      jmmv     9603:             available.</p>
                   9604: 
                   9605:             <p>Once the required configuration files are in place
                   9606:             (i.e., under the examples hierarchy), the pkginstall
                   9607:             framework can use them as master copies during the
1.45      wiz      9608:             package installation to update what is in <code xmlns=
                   9609:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9610:             "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
                   9611:             the variables <code class="varname">CONF_FILES</code>
                   9612:             and <code class="varname">CONF_FILES_PERMS</code> are
                   9613:             used. Check out <a href="#files-outside-prefix" title=
1.59    ! rillig   9614:             "12.1.2.&nbsp;File manipulation">Section 12.1.2,
1.35      jmmv     9615:             &#8220;File manipulation&#8221;</a> for information
                   9616:             about their syntax and their purpose. Here is an
                   9617:             example, taken from the <a xmlns=
                   9618:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9619:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
1.45      wiz      9620:             target="_top"><code xmlns="" class=
                   9621:             "filename">mail/mutt</code></a> package:</p>
1.35      jmmv     9622:             <pre class="programlisting">
1.51      rillig   9623:     EGDIR=        ${PREFIX}/share/doc/mutt/samples
                   9624:     CONF_FILES=   ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
1.35      jmmv     9625: </pre>
                   9626: 
                   9627:             <p>Note that the <code class="varname">EGDIR</code>
                   9628:             variable is specific to that package and has no meaning
                   9629:             outside it.</p>
                   9630:           </div>
                   9631: 
1.59    ! rillig   9632:           <div class="sect2" lang="en" xml:lang="en">
1.35      jmmv     9633:             <div class="titlepage">
                   9634:               <div>
                   9635:                 <div>
1.59    ! rillig   9636:                   <h3 class="title"><a name="conf-files-disable"
        !          9637:                   id="conf-files-disable"></a>12.2.4. Disabling
1.35      jmmv     9638:                   handling of configuration files</h3>
                   9639:                 </div>
                   9640:               </div>
                   9641:             </div>
                   9642: 
                   9643:             <p>The automatic copying of config files can be toggled
                   9644:             by setting the environment variable <code class=
                   9645:             "varname">PKG_CONFIG</code> prior to package
                   9646:             installation.</p>
                   9647:           </div>
                   9648:         </div>
                   9649: 
1.59    ! rillig   9650:         <div class="sect1" lang="en" xml:lang="en">
1.35      jmmv     9651:           <div class="titlepage">
                   9652:             <div>
                   9653:               <div>
                   9654:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   9655:                 "rcd-scripts" id="rcd-scripts"></a>12.3. System
        !          9656:                 startup scripts</h2>
1.35      jmmv     9657:               </div>
                   9658:             </div>
                   9659:           </div>
                   9660: 
                   9661:           <p>System startup scripts are special files because they
                   9662:           must be installed in a place known by the underlying OS,
                   9663:           usually outside the installation prefix. Therefore, the
                   9664:           same rules described in <a href=
                   9665:           "#files-and-dirs-outside-prefix" title=
1.38      dillo    9666:           "12.1.&nbsp;Files and directories outside the installation prefix">
1.59    ! rillig   9667:           Section 12.1, &#8220;Files and directories outside the
        !          9668:           installation prefix&#8221;</a> apply, and the same
1.35      jmmv     9669:           solutions can be used. However, pkginstall provides a
1.36      wiz      9670:           special mechanism to handle these files.</p>
1.35      jmmv     9671: 
                   9672:           <p>In order to provide system startup scripts, the
                   9673:           package has to:</p>
                   9674: 
                   9675:           <div class="orderedlist">
                   9676:             <ol type="1">
                   9677:               <li>
1.45      wiz      9678:                 <p>Store the script inside <code xmlns=
                   9679:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9680:                 "filename">${FILESDIR}</code>, with the
                   9681:                 <code class="literal">.sh</code> suffix appended.
                   9682:                 Considering the <a xmlns=
                   9683:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   9684:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
1.45      wiz      9685:                 target="_top"><code xmlns="" class=
                   9686:                 "filename">print/cups</code></a> package as an
                   9687:                 example, it has a <code xmlns=
                   9688:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9689:                 "filename">cupsd.sh</code> in its files
                   9690:                 directory.</p>
                   9691:               </li>
                   9692: 
                   9693:               <li>
                   9694:                 <p>Tell pkginstall to handle it, appending the name
                   9695:                 of the script, without its extension, to the
                   9696:                 <code class="varname">RCD_SCRIPTS</code> variable.
                   9697:                 Continuing the previous example:</p>
                   9698:                 <pre class="programlisting">
1.51      rillig   9699:     RCD_SCRIPTS+=   cupsd
1.35      jmmv     9700: </pre>
                   9701:               </li>
                   9702:             </ol>
                   9703:           </div>
                   9704: 
                   9705:           <p>Once this is done, pkginstall will do the following
                   9706:           steps for each script in an automated fashion:</p>
                   9707: 
                   9708:           <div class="orderedlist">
                   9709:             <ol type="1">
                   9710:               <li>
                   9711:                 <p>Process the file found in the files directory
                   9712:                 applying all the substitutions described in the
1.45      wiz      9713:                 <code xmlns=
                   9714:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   9715:                 "filename">FILES_SUBST</code> variable.</p>
1.35      jmmv     9716:               </li>
                   9717: 
                   9718:               <li>
                   9719:                 <p>Copy the script from the files directory to the
1.45      wiz      9720:                 examples hierarchy, <code xmlns=
                   9721:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9722:                 "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36      wiz      9723:                 Note that this master file must be explicitly
1.45      wiz      9724:                 registered in the <code xmlns=
                   9725:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9726:                 "filename">PLIST</code>.</p>
                   9727:               </li>
                   9728: 
                   9729:               <li>
                   9730:                 <p>Add code to the installation scripts to copy the
                   9731:                 startup script from the examples hierarchy into the
                   9732:                 system-wide startup scripts directory.</p>
                   9733:               </li>
                   9734:             </ol>
                   9735:           </div>
                   9736: 
1.59    ! rillig   9737:           <div class="sect2" lang="en" xml:lang="en">
1.35      jmmv     9738:             <div class="titlepage">
                   9739:               <div>
                   9740:                 <div>
1.59    ! rillig   9741:                   <h3 class="title"><a name="rcd-scripts-disable"
        !          9742:                   id="rcd-scripts-disable"></a>12.3.1. Disabling
1.35      jmmv     9743:                   handling of system startup scripts</h3>
                   9744:                 </div>
                   9745:               </div>
                   9746:             </div>
                   9747: 
                   9748:             <p>The automatic copying of config files can be toggled
                   9749:             by setting the environment variable <code class=
                   9750:             "varname">PKG_RCD_SCRIPTS</code> prior to package
                   9751:             installation. Note that the scripts will be always
1.45      wiz      9752:             copied inside the examples hierarchy, <code xmlns=
                   9753:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9754:             "filename">${PREFIX}/share/examples/rc.d/</code>, no
                   9755:             matter what the value of this variable is.</p>
                   9756:           </div>
                   9757:         </div>
                   9758: 
1.59    ! rillig   9759:         <div class="sect1" lang="en" xml:lang="en">
1.35      jmmv     9760:           <div class="titlepage">
                   9761:             <div>
                   9762:               <div>
                   9763:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   9764:                 "users-and-groups" id="users-and-groups"></a>12.4.
        !          9765:                 System users and groups</h2>
1.35      jmmv     9766:               </div>
                   9767:             </div>
                   9768:           </div>
                   9769: 
                   9770:           <p>If a package needs to create special users and/or
                   9771:           groups during installation, it can do so by using the
                   9772:           pkginstall framework.</p>
                   9773: 
                   9774:           <p>Users can be created by adding entries to the
                   9775:           <code class="varname">PKG_USERS</code> variable. Each
1.45      wiz      9776:           entry has the following syntax, which mimics <code xmlns=
                   9777:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9778:           "filename">/etc/passwd</code>:</p>
                   9779:           <pre class="programlisting">
1.51      rillig   9780:     user:group[:[userid][:[descr][:[home][:shell]]]]
1.35      jmmv     9781: </pre>
                   9782: 
                   9783:           <p>Only the user and group are required; everything else
                   9784:           is optional, but the colons must be in the right places
                   9785:           when specifying optional bits. By default, a new user
1.45      wiz      9786:           will have home directory <code xmlns=
                   9787:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9788:           "filename">/nonexistent</code>, and login shell
1.45      wiz      9789:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9790:           class="filename">/sbin/nologin</code> unless they are
                   9791:           specified as part of the user element. Note that if the
1.51      rillig   9792:           description contains spaces, then spaces should be
1.45      wiz      9793:           backslash-escaped, as in:</p>
1.35      jmmv     9794:           <pre class="programlisting">
1.51      rillig   9795:     foo:foogrp::The\ Foomister
1.35      jmmv     9796: </pre>
                   9797: 
                   9798:           <p>Similarly, groups can be created using the
                   9799:           <code class="varname">PKG_GROUPS</code> variable, whose
                   9800:           syntax is:</p>
                   9801:           <pre class="programlisting">
1.51      rillig   9802:     group[:groupid]
1.35      jmmv     9803: </pre>
                   9804: 
                   9805:           <p>As before, only the group name is required; the
                   9806:           numeric identifier is optional.</p>
                   9807:         </div>
                   9808: 
1.59    ! rillig   9809:         <div class="sect1" lang="en" xml:lang="en">
1.35      jmmv     9810:           <div class="titlepage">
                   9811:             <div>
                   9812:               <div>
                   9813:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   9814:                 "shells" id="shells"></a>12.5. System shells</h2>
1.35      jmmv     9815:               </div>
                   9816:             </div>
                   9817:           </div>
                   9818: 
                   9819:           <p>Packages that install system shells should register
1.45      wiz      9820:           them in the shell database, <code xmlns=
                   9821:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9822:           "filename">/etc/shells</code>, to make things easier to
                   9823:           the administrator. This must be done from the
                   9824:           installation scripts to keep binary packages working on
                   9825:           any system. pkginstall provides an easy way to accomplish
                   9826:           this task.</p>
                   9827: 
                   9828:           <p>When a package provides a shell interpreter, it has to
                   9829:           set the <code class="varname">PKG_SHELL</code> variable
                   9830:           to its absolute file name. This will add some hooks to
                   9831:           the installation scripts to handle it. Consider the
                   9832:           following example, taken from <a xmlns=
                   9833:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   9834:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
1.45      wiz      9835:           target="_top"><code xmlns="" class=
                   9836:           "filename">shells/zsh</code></a>:</p>
1.35      jmmv     9837:           <pre class="programlisting">
1.51      rillig   9838:     USE_PKGINSTALL= YES
                   9839:     PKG_SHELL=      ${PREFIX}/bin/zsh
1.35      jmmv     9840: </pre>
                   9841: 
1.59    ! rillig   9842:           <div class="sect2" lang="en" xml:lang="en">
1.35      jmmv     9843:             <div class="titlepage">
                   9844:               <div>
                   9845:                 <div>
1.59    ! rillig   9846:                   <h3 class="title"><a name="shells-disable" id=
        !          9847:                   "shells-disable"></a>12.5.1. Disabling handling
        !          9848:                   of configuration files</h3>
1.35      jmmv     9849:                 </div>
                   9850:               </div>
                   9851:             </div>
                   9852: 
                   9853:             <p>The automatic registration of shell interpreters can
                   9854:             be disabled by the administrator by setting the
1.45      wiz      9855:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9856:             class="filename">PKG_REGISTER_SHELLS</code> environment
                   9857:             variable to <code class="literal">NO</code>.</p>
1.35      jmmv     9858:           </div>
                   9859:         </div>
                   9860:       </div>
                   9861: 
1.59    ! rillig   9862:       <div class="chapter" lang="en" xml:lang="en">
1.35      jmmv     9863:         <div class="titlepage">
                   9864:           <div>
                   9865:             <div>
1.59    ! rillig   9866:               <h2 class="title"><a name="options" id=
1.38      dillo    9867:               "options"></a>Chapter&nbsp;13.&nbsp;Options
1.35      jmmv     9868:               handling</h2>
                   9869:             </div>
                   9870:           </div>
                   9871:         </div>
                   9872: 
                   9873:         <div class="toc">
                   9874:           <p><b>Table of Contents</b></p>
                   9875: 
                   9876:           <dl>
                   9877:             <dt><span class="sect1"><a href=
1.38      dillo    9878:             "#global-default-options">13.1. Global default
1.35      jmmv     9879:             options</a></span></dt>
                   9880: 
                   9881:             <dt><span class="sect1"><a href=
1.38      dillo    9882:             "#converting-to-options">13.2. Converting packages to
1.45      wiz      9883:             use <code xmlns=
                   9884:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9885:             "filename">bsd.options.mk</code></a></span></dt>
1.48      dillo    9886: 
                   9887:             <dt><span class="sect1"><a href="#option-names">13.3.
                   9888:             Option Names</a></span></dt>
1.35      jmmv     9889:           </dl>
                   9890:         </div>
                   9891: 
                   9892:         <p>Many packages have the ability to be built to support
1.45      wiz      9893:         different sets of features. <code xmlns=
                   9894:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9895:         "filename">bsd.options.mk</code> is a framework in pkgsrc
                   9896:         that provides generic handling of those options that
                   9897:         determine different ways in which the packages can be
                   9898:         built. It's possible for the user to specify exactly which
                   9899:         sets of options will be built into a package or to allow a
                   9900:         set of global default options apply.</p>
                   9901: 
1.59    ! rillig   9902:         <div class="sect1" lang="en" xml:lang="en">
1.35      jmmv     9903:           <div class="titlepage">
                   9904:             <div>
                   9905:               <div>
                   9906:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   9907:                 "global-default-options" id=
1.38      dillo    9908:                 "global-default-options"></a>13.1.&nbsp;Global
1.35      jmmv     9909:                 default options</h2>
                   9910:               </div>
                   9911:             </div>
                   9912:           </div>
                   9913: 
                   9914:           <p>Global default options are listed in <code class=
                   9915:           "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
                   9916:           the options that should be built into every package if
                   9917:           that option is supported. This variable should be set in
1.45      wiz      9918:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9919:           class="filename">/etc/mk.conf</code>.</p>
1.35      jmmv     9920:         </div>
                   9921: 
1.59    ! rillig   9922:         <div class="sect1" lang="en" xml:lang="en">
1.35      jmmv     9923:           <div class="titlepage">
                   9924:             <div>
                   9925:               <div>
                   9926:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   9927:                 "converting-to-options" id=
1.38      dillo    9928:                 "converting-to-options"></a>13.2.&nbsp;Converting
1.45      wiz      9929:                 packages to use <code xmlns=
                   9930:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9931:                 "filename">bsd.options.mk</code></h2>
                   9932:               </div>
                   9933:             </div>
                   9934:           </div>
                   9935: 
1.45      wiz      9936:           <p>The following example shows how <code xmlns=
                   9937:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9938:           "filename">bsd.options.mk</code> should be used by the
                   9939:           hypothetical ``wibble'' package, either in the package
1.45      wiz      9940:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9941:           class="filename">Makefile</code>, or in a file, e.g.
                   9942:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9943:           class="filename">options.mk</code>, that is included by
                   9944:           the main package <code xmlns=
                   9945:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9946:           "filename">Makefile</code>.</p>
                   9947:           <pre class="programlisting">
1.51      rillig   9948:     PKG_OPTIONS_VAR=            PKG_OPTIONS.wibble
                   9949:     PKG_SUPPORTED_OPTIONS=              wibble-foo ldap
                   9950:     PKG_OPTIONS_OPTIONAL_GROUPS=        database
                   9951:     PKG_OPTIONS_GROUP.database= mysql pgsql
                   9952:     PKG_SUGGESTED_OPTIONS=              wibble-foo
                   9953:     PKG_OPTIONS_LEGACY_VARS+=   WIBBLE_USE_OPENLDAP:ldap
                   9954:     PKG_OPTIONS_LEGACY_OPTS+=   foo:wibble-foo
                   9955: 
                   9956:     .include "../../mk/bsd.prefs.mk"
                   9957: 
                   9958:     # this package was previously named wibble2
                   9959:     .if defined(PKG_OPTIONS.wibble2)
                   9960:     PKG_LEGACY_OPTIONS+=  ${PKG_OPTIONS.wibble2}
                   9961:     PKG_OPTIONS_DEPRECATED_WARNINGS+= \
                   9962:             "Deprecated variable PKG_OPTIONS.wibble2 used, use "${PKG_OPTIONS_VAR:Q}" instead."
                   9963:     .endif
                   9964: 
                   9965:     .include "../../mk/bsd.options.mk"
                   9966: 
                   9967:     # Package-specific option-handling
                   9968: 
                   9969:     ###
                   9970:     ### FOO support
                   9971:     ###
                   9972:     .if !empty(PKG_OPTIONS:Mwibble-foo)
                   9973:     CONFIGURE_ARGS+=    --enable-foo
                   9974:     .endif
                   9975: 
                   9976:     ###
                   9977:     ### LDAP support
                   9978:     ###
                   9979:     .if !empty(PKG_OPTIONS:Mldap)
                   9980:     .  include "../../databases/openldap/buildlink3.mk"
                   9981:     CONFIGURE_ARGS+=    --enable-ldap=${BUILDLINK_PREFIX.openldap}
                   9982:     .endif
                   9983: 
                   9984:     ###
                   9985:     ### database support
                   9986:     ###
                   9987:     .if !empty(PKG_OPTIONS:Mmysql)
                   9988:     .  include "../../mk/mysql.buildlink3.mk"
                   9989:     .endif
                   9990:     .if !empty(PKG_OPTIONS:Mpgsql)
                   9991:     .  include "../../mk/pgsql.buildlink3.mk"
                   9992:     .endif
1.1       grant    9993: </pre>
                   9994: 
1.28      rillig   9995:           <p>The first section contains the information about which
                   9996:           build options are supported by the package, and any
1.1       grant    9997:           default options settings if needed.</p>
                   9998: 
                   9999:           <div class="orderedlist">
                   10000:             <ol type="1">
                   10001:               <li>
1.14      xtraeme  10002:                 <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27      rillig   10003:                 the name of the <a href=
1.1       grant    10004:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   10005:                 <span class="citerefentry"><span class=
1.27      rillig   10006:                 "refentrytitle">make</span>(1)</span></a> variable
1.37      dillo    10007:                 that the user can set to override the default
1.57      minskim  10008:                 options. It should be set to PKG_OPTIONS.<em class=
                   10009:                 "replaceable"><code>pkgbase</code></em>.</p>
1.1       grant    10010:               </li>
                   10011: 
                   10012:               <li>
1.14      xtraeme  10013:                 <p><code class=
                   10014:                 "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37      dillo    10015:                 build options supported by the package.</p>
                   10016:               </li>
                   10017: 
                   10018:               <li>
                   10019:                 <p><code class=
                   10020:                 "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
                   10021:                 list of names of groups of mutually exclusive
                   10022:                 options. The options in each group are listed in
                   10023:                 <code class="varname">PKG_OPTIONS_GROUP.<em class=
                   10024:                 "replaceable"><code>groupname</code></em></code>.
                   10025:                 The most specific setting of any option from the
                   10026:                 group takes precedence over all other options in
                   10027:                 the group. Options from the groups will be
                   10028:                 automatically added to <code class=
                   10029:                 "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
                   10030:               </li>
                   10031: 
                   10032:               <li>
                   10033:                 <p><code class=
                   10034:                 "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
                   10035:                 like <code class=
                   10036:                 "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
                   10037:                 building the packages will fail if no option from
                   10038:                 the group is selected.</p>
1.1       grant    10039:               </li>
                   10040: 
                   10041:               <li>
1.27      rillig   10042:                 <p><code class=
1.44      gdt      10043:                 "varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a
                   10044:                 list of names of sets of options. At least one
                   10045:                 option from each set must be selected. The options
                   10046:                 in each set are listed in <code class=
                   10047:                 "varname">PKG_OPTIONS_SET.<em class=
                   10048:                 "replaceable"><code>setname</code></em></code>.
                   10049:                 Options from the sets will be automatically added
                   10050:                 to <code class=
                   10051:                 "varname">PKG_SUPPORTED_OPTIONS</code>. Building
                   10052:                 the package will fail if no option from the set is
                   10053:                 selected.</p>
                   10054:               </li>
                   10055: 
                   10056:               <li>
                   10057:                 <p><code class=
1.27      rillig   10058:                 "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
                   10059:                 build options which are enabled by default.</p>
                   10060:               </li>
                   10061: 
                   10062:               <li>
1.37      dillo    10063:                 <p><code class=
                   10064:                 "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
                   10065:                 of &#8220;<span class="quote"><em class=
1.59    ! rillig   10066:                 "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable">
        !          10067:                 <code>option</code></em></span>&#8221; pairs that
        !          10068:                 map legacy <code xmlns=
1.45      wiz      10069:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.37      dillo    10070:                 "filename">/etc/mk.conf</code> variables to their
                   10071:                 option counterparts. Pairs should be added with
                   10072:                 &#8220;<span class="quote">+=</span>&#8221; to keep
                   10073:                 the listing of global legacy variables. A warning
                   10074:                 will be issued if the user uses a legacy
                   10075:                 variable.</p>
                   10076:               </li>
1.1       grant    10077: 
1.37      dillo    10078:               <li>
                   10079:                 <p><code class=
                   10080:                 "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
                   10081:                 of &#8220;<span class="quote"><em class=
1.59    ! rillig   10082:                 "replaceable"><code>old-option</code></em>:<em class="replaceable">
        !          10083:                 <code>new-option</code></em></span>&#8221; pairs
        !          10084:                 that map options that have been renamed to their
        !          10085:                 new counterparts. Pairs should be added with
1.37      dillo    10086:                 &#8220;<span class="quote">+=</span>&#8221; to keep
                   10087:                 the listing of global legacy options. A warning
                   10088:                 will be issued if the user uses a legacy
                   10089:                 option.</p>
                   10090:               </li>
1.1       grant    10091: 
1.37      dillo    10092:               <li>
                   10093:                 <p><code class="varname">PKG_LEGACY_OPTIONS</code>
                   10094:                 is a list of options implied by deprecated
                   10095:                 variables used. This can be used for cases that
                   10096:                 neither <code class=
                   10097:                 "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
                   10098:                 <code class=
                   10099:                 "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
                   10100:                 handle, e. g. when <code class=
                   10101:                 "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1       grant    10102:               </li>
                   10103: 
                   10104:               <li>
1.37      dillo    10105:                 <p><code class=
                   10106:                 "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
                   10107:                 a list of warnings about deprecated variables or
                   10108:                 options used, and what to use instead.</p>
1.1       grant    10109:               </li>
1.28      rillig   10110:             </ol>
1.1       grant    10111:           </div>
                   10112: 
1.37      dillo    10113:           <p>A package should never modify <code class=
                   10114:           "varname">PKG_DEFAULT_OPTIONS</code> or the variable
                   10115:           named in <code class="varname">PKG_OPTIONS_VAR</code>.
                   10116:           These are strictly user-settable. To suggest a default
                   10117:           set of options, use <code class=
                   10118:           "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
                   10119: 
1.42      dillo    10120:           <p><code class="varname">PKG_OPTIONS_VAR</code> must be
1.45      wiz      10121:           defined before including <code xmlns=
                   10122:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.42      dillo    10123:           "filename">bsd.options.mk</code>. If none of <code class=
1.37      dillo    10124:           "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
                   10125:           "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
                   10126:           <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
1.47      reed     10127:           are defined (as can happen with platform-specific options
1.42      dillo    10128:           if none of them is supported on the current platform),
                   10129:           <code class="varname">PKG_OPTIONS</code> is set to the
                   10130:           empty list and the package is otherwise treated as not
                   10131:           using the options framework.</p>
1.37      dillo    10132: 
1.45      wiz      10133:           <p>After the inclusion of <code xmlns=
                   10134:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.37      dillo    10135:           "filename">bsd.options.mk</code>, the variable
1.28      rillig   10136:           <code class="varname">PKG_OPTIONS</code> contains the
1.37      dillo    10137:           list of selected build options, properly filtered to
1.28      rillig   10138:           remove unsupported and duplicate options.</p>
                   10139: 
1.1       grant    10140:           <p>The remaining sections contain the logic that is
1.37      dillo    10141:           specific to each option. The correct way to check for an
                   10142:           option is to check whether it is listed in <code class=
                   10143:           "varname">PKG_OPTIONS</code>:</p>
                   10144:           <pre class="programlisting">
1.51      rillig   10145:     .if !empty(PKG_OPTIONS:M<em class=
1.37      dillo    10146: "replaceable"><code>option</code></em>)
                   10147: </pre>
1.48      dillo    10148:         </div>
1.37      dillo    10149: 
1.59    ! rillig   10150:         <div class="sect1" lang="en" xml:lang="en">
1.48      dillo    10151:           <div class="titlepage">
                   10152:             <div>
                   10153:               <div>
                   10154:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   10155:                 "option-names" id=
1.48      dillo    10156:                 "option-names"></a>13.3.&nbsp;Option Names</h2>
                   10157:               </div>
                   10158:             </div>
                   10159:           </div>
                   10160: 
                   10161:           <p>Options that enable similar features in different
                   10162:           packages (like optional support for a library) should use
                   10163:           a common name in all packages that support it (like the
                   10164:           name of the library). If another package already has an
                   10165:           option with the same meaning, use the same name.</p>
                   10166: 
                   10167:           <p>Options that enable features specific to one package,
                   10168:           where it's unlikely that another (unrelated) package has
                   10169:           the same (or a similar) optional feature, should use a
                   10170:           name prefixed with <code class="varname"><em class=
                   10171:           "replaceable"><code>pkgname</code></em>-</code>.</p>
                   10172: 
                   10173:           <p>If a group of related packages share an optional
                   10174:           feature specific to that group, prefix it with the name
                   10175:           of the &#8220;<span class="quote">main</span>&#8221;
                   10176:           package (e. g. <code class=
                   10177:           "varname">djbware-errno-hack</code>).</p>
                   10178: 
                   10179:           <p>For new options, add a line to <code xmlns=
                   10180:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10181:           "filename">mk/defaults/options.description</code>. Lines
                   10182:           have two fields, separated by tab. The first field is the
                   10183:           option name, the second its description. The description
                   10184:           should be a whole sentence (starting with an uppercase
                   10185:           letter and ending with a period) that describes what
                   10186:           enabling the option does. E. g. &#8220;<span class=
                   10187:           "quote">Enable ispell support.</span>&#8221; The file is
                   10188:           sorted by option names.</p>
1.1       grant    10189:         </div>
                   10190:       </div>
                   10191: 
1.59    ! rillig   10192:       <div class="chapter" lang="en" xml:lang="en">
1.1       grant    10193:         <div class="titlepage">
                   10194:           <div>
                   10195:             <div>
1.59    ! rillig   10196:               <h2 class="title"><a name="build" id=
1.38      dillo    10197:               "build"></a>Chapter&nbsp;14.&nbsp;The build
1.1       grant    10198:               process</h2>
                   10199:             </div>
                   10200:           </div>
                   10201:         </div>
                   10202: 
                   10203:         <div class="toc">
                   10204:           <p><b>Table of Contents</b></p>
                   10205: 
                   10206:           <dl>
1.56      rillig   10207:             <dt><span class="sect1"><a href="#build.intro">14.1.
                   10208:             Introduction</a></span></dt>
                   10209: 
                   10210:             <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1       grant    10211:             Program location</a></span></dt>
                   10212: 
1.56      rillig   10213:             <dt><span class="sect1"><a href=
                   10214:             "#build.builddirs">14.3. Directories used during the
                   10215:             build process</a></span></dt>
                   10216: 
                   10217:             <dt><span class="sect1"><a href="#build.running">14.4.
                   10218:             Running a phase</a></span></dt>
                   10219: 
                   10220:             <dt><span class="sect1"><a href="#build.fetch">14.5.
                   10221:             The <span class="emphasis"><em>fetch</em></span>
                   10222:             phase</a></span></dt>
                   10223: 
                   10224:             <dt><span class="sect1"><a href="#build.checksum">14.6.
                   10225:             The <span class="emphasis"><em>checksum</em></span>
                   10226:             phase</a></span></dt>
                   10227: 
                   10228:             <dt><span class="sect1"><a href="#build.extract">14.7.
                   10229:             The <span class="emphasis"><em>extract</em></span>
                   10230:             phase</a></span></dt>
                   10231: 
                   10232:             <dt><span class="sect1"><a href="#build.patch">14.8.
                   10233:             The <span class="emphasis"><em>patch</em></span>
                   10234:             phase</a></span></dt>
                   10235: 
                   10236:             <dt><span class="sect1"><a href="#build.tools">14.9.
                   10237:             The <span class="emphasis"><em>tools</em></span>
                   10238:             phase</a></span></dt>
                   10239: 
                   10240:             <dt><span class="sect1"><a href="#build.wrapper">14.10.
                   10241:             The <span class="emphasis"><em>wrapper</em></span>
                   10242:             phase</a></span></dt>
1.1       grant    10243: 
                   10244:             <dt><span class="sect1"><a href=
1.56      rillig   10245:             "#build.configure">14.11. The <span class=
                   10246:             "emphasis"><em>configure</em></span>
                   10247:             phase</a></span></dt>
                   10248: 
                   10249:             <dt><span class="sect1"><a href="#build.build">14.12.
                   10250:             The <span class="emphasis"><em>build</em></span>
                   10251:             phase</a></span></dt>
                   10252: 
                   10253:             <dt><span class="sect1"><a href="#build.test">14.13.
                   10254:             The <span class="emphasis"><em>test</em></span>
                   10255:             phase</a></span></dt>
                   10256: 
                   10257:             <dt><span class="sect1"><a href="#build.install">14.14.
                   10258:             The <span class="emphasis"><em>install</em></span>
                   10259:             phase</a></span></dt>
                   10260: 
                   10261:             <dt><span class="sect1"><a href="#build.package">14.15.
                   10262:             The <span class="emphasis"><em>package</em></span>
                   10263:             phase</a></span></dt>
                   10264: 
                   10265:             <dt><span class="sect1"><a href=
                   10266:             "#build.helpful-targets">14.16. Other helpful
1.1       grant    10267:             targets</a></span></dt>
                   10268:           </dl>
                   10269:         </div>
                   10270: 
1.59    ! rillig   10271:         <div class="sect1" lang="en" xml:lang="en">
1.56      rillig   10272:           <div class="titlepage">
                   10273:             <div>
                   10274:               <div>
                   10275:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   10276:                 "build.intro" id=
1.56      rillig   10277:                 "build.intro"></a>14.1.&nbsp;Introduction</h2>
                   10278:               </div>
                   10279:             </div>
                   10280:           </div>
                   10281: 
                   10282:           <p>This chapter gives a detailed description on how a
                   10283:           package is built. Building a package is separated into
                   10284:           different <span class="emphasis"><em>phases</em></span>
                   10285:           (for example <code class="varname">fetch</code>,
                   10286:           <code class="varname">build</code>, <code class=
                   10287:           "varname">install</code>), all of which are described in
                   10288:           the following sections. Each phase is splitted into
                   10289:           so-called <span class="emphasis"><em>stages</em></span>,
                   10290:           which take the name of the containing stage, prefixed by
                   10291:           one of <code class="varname">pre-</code>, <code class=
                   10292:           "varname">do-</code> or <code class=
                   10293:           "varname">post-</code>. (Examples are <code class=
                   10294:           "varname">pre-configure</code>, <code class=
                   10295:           "varname">post-build</code>.) Most of the actual work is
                   10296:           done in the <code class="varname">do-*</code> stages.</p>
                   10297: 
                   10298:           <p>The basic steps for building a program are always the
                   10299:           same. First the program's source (<span class=
                   10300:           "emphasis"><em>distfile</em></span>) must be brought to
                   10301:           the local system and then extracted. After any patches to
                   10302:           compile properly on NetBSD are applied, the software can
                   10303:           be configured, then built (usually by compiling), and
                   10304:           finally the generated binaries, etc. can be put into
                   10305:           place on the system. These are exactly the steps
                   10306:           performed by the NetBSD package system, which is
                   10307:           implemented as a series of targets in a central Makefile,
                   10308:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10309:           class="filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
                   10310:         </div>
1.1       grant    10311: 
1.59    ! rillig   10312:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    10313:           <div class="titlepage">
                   10314:             <div>
                   10315:               <div>
                   10316:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   10317:                 "build.prefix" id=
1.56      rillig   10318:                 "build.prefix"></a>14.2.&nbsp;Program location</h2>
1.1       grant    10319:               </div>
                   10320:             </div>
                   10321:           </div>
                   10322: 
                   10323:           <p>Before outlining the process performed by the NetBSD
                   10324:           package system in the next section, here's a brief
                   10325:           discussion on where programs are installed, and which
                   10326:           variables influence this.</p>
                   10327: 
1.14      xtraeme  10328:           <p>The automatic variable <code class=
                   10329:           "varname">PREFIX</code> indicates where all files of the
                   10330:           final program shall be installed. It is usually set to
1.45      wiz      10331:           <code class="varname">LOCALBASE</code> (<code xmlns=
                   10332:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10333:           "filename">/usr/pkg</code>), or <code class=
                   10334:           "varname">CROSSBASE</code> for pkgs in the
1.1       grant    10335:           &#8220;<span class="quote">cross</span>&#8221; category.
1.14      xtraeme  10336:           The value of <code class="varname">PREFIX</code> needs to
                   10337:           be put into the various places in the program's source
                   10338:           where paths to these files are encoded. See <a href=
1.1       grant    10339:           "#components.patches" title=
1.38      dillo    10340:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
1.1       grant    10341:           &#8220;patches/*&#8221;</a> and <a href="#fixes.libtool"
                   10342:           title=
1.38      dillo    10343:           "15.3.1.&nbsp;Shared libraries - libtool">Section&nbsp;15.3.1,
1.1       grant    10344:           &#8220;Shared libraries - libtool&#8221;</a> for more
                   10345:           details.</p>
                   10346: 
                   10347:           <p>When choosing which of these variables to use, follow
                   10348:           the following rules:</p>
                   10349: 
                   10350:           <div class="itemizedlist">
                   10351:             <ul type="disc">
                   10352:               <li>
1.14      xtraeme  10353:                 <p><code class="varname">PREFIX</code> always
                   10354:                 points to the location where the current pkg will
                   10355:                 be installed. When referring to a pkg's own
1.1       grant    10356:                 installation path, use &#8220;<span class=
                   10357:                 "quote">${PREFIX}</span>&#8221;.</p>
                   10358:               </li>
                   10359: 
                   10360:               <li>
1.14      xtraeme  10361:                 <p><code class="varname">LOCALBASE</code> is where
                   10362:                 all non-X11 pkgs are installed. If you need to
1.1       grant    10363:                 construct a -I or -L argument to the compiler to
                   10364:                 find includes and libraries installed by another
                   10365:                 non-X11 pkg, use &#8220;<span class=
                   10366:                 "quote">${LOCALBASE}</span>&#8221;.</p>
                   10367:               </li>
                   10368: 
                   10369:               <li>
1.14      xtraeme  10370:                 <p><code class="varname">X11BASE</code> is where
                   10371:                 the actual X11 distribution (from xsrc, etc.) is
1.1       grant    10372:                 installed. When looking for <span class=
                   10373:                 "emphasis"><em>standard</em></span> X11 includes
                   10374:                 (not those installed by a pkg), use
                   10375:                 &#8220;<span class=
                   10376:                 "quote">${X11BASE}</span>&#8221;.</p>
                   10377:               </li>
                   10378: 
                   10379:               <li>
1.47      reed     10380:                 <p>X11-based packages are special in that they may
                   10381:                 be installed in either <code class=
1.14      xtraeme  10382:                 "varname">X11BASE</code> or <code class=
                   10383:                 "varname">LOCALBASE</code>.</p>
1.1       grant    10384: 
                   10385:                 <p>Usually, X11 packages should be installed under
1.14      xtraeme  10386:                 <code class="varname">LOCALBASE</code> whenever
1.34      wiz      10387:                 possible. Note that you will need to include
1.45      wiz      10388:                 <code xmlns=
                   10389:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.34      wiz      10390:                 "filename">../../mk/x11.buildlink3.mk</code> in
                   10391:                 them to request the presence of X11 and to get the
                   10392:                 right compilation flags.</p>
1.1       grant    10393: 
                   10394:                 <p>Even though, there are some packages that cannot
1.14      xtraeme  10395:                 be installed under <code class=
                   10396:                 "varname">LOCALBASE</code>: those that come with
1.1       grant    10397:                 app-defaults files. These packages are special and
1.14      xtraeme  10398:                 they must be placed under <code class=
                   10399:                 "varname">X11BASE</code>. To accomplish this, set
                   10400:                 either <code class="varname">USE_X11BASE</code> or
                   10401:                 <code class="varname">USE_IMAKE</code> in your
1.1       grant    10402:                 package.</p>
                   10403: 
1.34      wiz      10404:                 <p>Some notes: If you need to find includes or
1.14      xtraeme  10405:                 libraries installed by a pkg that has <code class=
                   10406:                 "varname">USE_IMAKE</code> or <code class=
                   10407:                 "varname">USE_X11BASE</code> in its pkg
1.45      wiz      10408:                 <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10409:                 class="filename">Makefile</code>, you need to look
                   10410:                 in <span class="emphasis"><em>both</em></span>
                   10411:                 <code xmlns=
                   10412:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10413:                 "filename">${X11BASE}</code> and <code xmlns=
                   10414:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10415:                 "filename">${LOCALBASE}</code>. To force
                   10416:                 installation of all X11 packages in <code class=
                   10417:                 "varname">LOCALBASE</code>, the <a xmlns=
                   10418:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    10419:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45      wiz      10420:                 target="_top"><code xmlns="" class=
                   10421:                 "filename">pkgtools/xpkgwedge</code></a> package is
1.34      wiz      10422:                 enabled by default.</p>
1.1       grant    10423:               </li>
                   10424: 
                   10425:               <li>
1.14      xtraeme  10426:                 <p><code class="varname">X11PREFIX</code> should be
1.1       grant    10427:                 used to refer to the installed location of an X11
1.14      xtraeme  10428:                 package. <code class="varname">X11PREFIX</code>
                   10429:                 will be set to <code class="varname">X11BASE</code>
                   10430:                 if xpkgwedge is not installed, and to <code class=
                   10431:                 "varname">LOCALBASE</code> if xpkgwedge is
1.1       grant    10432:                 installed.</p>
                   10433:               </li>
                   10434: 
                   10435:               <li>
                   10436:                 <p>If xpkgwedge is installed, it is possible to
1.14      xtraeme  10437:                 have some packages installed in <code class=
                   10438:                 "varname">X11BASE</code> and some in <code class=
                   10439:                 "varname">LOCALBASE</code>. To determine the prefix
                   10440:                 of an installed package, the <code class=
                   10441:                 "varname">EVAL_PREFIX</code> definition can be
                   10442:                 used. It takes pairs in the format
                   10443:                 &#8220;<span class=
1.1       grant    10444:                 "quote">DIRNAME=&lt;package&gt;</span>&#8221;, and
1.24      wiz      10445:                 the <a href=
                   10446:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   10447:                 <span class="citerefentry"><span class=
                   10448:                 "refentrytitle">make</span>(1)</span></a> variable
                   10449:                 <code class="varname">DIRNAME</code> will be set to
                   10450:                 the prefix of the installed package
                   10451:                 &lt;package&gt;, or &#8220;<span class=
1.1       grant    10452:                 "quote">${X11PREFIX}</span>&#8221; if the package
                   10453:                 is not installed.</p>
                   10454: 
                   10455:                 <p>This is best illustrated by example.</p>
                   10456: 
1.45      wiz      10457:                 <p>The following lines are taken from <code xmlns=
                   10458:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10459:                 "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1       grant    10460:                 <pre class="programlisting">
1.51      rillig   10461:     EVAL_PREFIX+=           GTKDIR=gtk+
                   10462:     CONFIGURE_ARGS+=        --with-guile-prefix=${LOCALBASE}        \
                   10463:                             --with-gtk-prefix="${GTKDIR}"           \
                   10464:                             --enable-multibyte
1.1       grant    10465: </pre>
                   10466: 
                   10467:                 <p>Specific defaults can be defined for the
1.14      xtraeme  10468:                 packages evaluated using <code class=
                   10469:                 "varname">EVAL_PREFIX</code>, by using a definition
1.1       grant    10470:                 of the form:</p>
                   10471:                 <pre class="programlisting">
1.51      rillig   10472:     GTKDIR_DEFAULT= ${LOCALBASE}
1.1       grant    10473: </pre>
                   10474: 
1.14      xtraeme  10475:                 <p>where <code class="varname">GTKDIR</code>
1.1       grant    10476:                 corresponds to the first definition in the
1.14      xtraeme  10477:                 <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1       grant    10478:               </li>
                   10479: 
                   10480:               <li>
1.45      wiz      10481:                 <p>Within <code xmlns=
                   10482:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10483:                 "filename">${PREFIX}</code>, packages should
                   10484:                 install files according to <a href=
1.24      wiz      10485:                 "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
                   10486:                 <span class="citerefentry"><span class=
                   10487:                 "refentrytitle">hier</span>(7)</span></a>, with the
1.45      wiz      10488:                 exception that manual pages go into <code xmlns=
                   10489:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10490:                 "filename">${PREFIX}/man</code>, not <code xmlns=
                   10491:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10492:                 "filename">${PREFIX}/share/man</code>.</p>
1.1       grant    10493:               </li>
                   10494:             </ul>
                   10495:           </div>
                   10496:         </div>
                   10497: 
1.59    ! rillig   10498:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    10499:           <div class="titlepage">
                   10500:             <div>
                   10501:               <div>
                   10502:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   10503:                 "build.builddirs" id=
1.56      rillig   10504:                 "build.builddirs"></a>14.3.&nbsp;Directories used
                   10505:                 during the build process</h2>
1.1       grant    10506:               </div>
                   10507:             </div>
                   10508:           </div>
                   10509: 
1.56      rillig   10510:           <p>When building a package, a number of directories is
                   10511:           used to store source files, temporary files,
                   10512:           pkgsrc-internal files, and so on. These directories are
                   10513:           explained here.</p>
                   10514: 
                   10515:           <p>Some of the directory variables contain relative
                   10516:           pathnames. There are two common base directories for
                   10517:           these relative directories: <code class=
                   10518:           "varname">PKGSRCDIR/PKGPATH</code> is used for
                   10519:           directories that are pkgsrc-specific. <code class=
                   10520:           "varname">WRKSRC</code> is used for directories inside
                   10521:           the package itself. The permissions after each variable
                   10522:           indicate whether the variable may be changed by the
                   10523:           package Makefile.</p>
1.1       grant    10524: 
                   10525:           <div class="variablelist">
                   10526:             <dl>
1.56      rillig   10527:               <dt><span class="term"><code class=
                   10528:               "varname">PKGSRCDIR</code> (read-only)</span></dt>
                   10529: 
                   10530:               <dd>
                   10531:                 <p>This is an absolute pathname that points to the
                   10532:                 pkgsrc root directory. Generally, you don't need
                   10533:                 it.</p>
                   10534:               </dd>
                   10535: 
                   10536:               <dt><span class="term"><code class=
                   10537:               "varname">PKGPATH</code> (read-only)</span></dt>
1.1       grant    10538: 
                   10539:               <dd>
1.56      rillig   10540:                 <p>This is a pathname relative to <code class=
                   10541:                 "varname">PKGSRCDIR</code> that points to the
                   10542:                 current package.</p>
                   10543:               </dd>
                   10544: 
                   10545:               <dt><span class="term"><code class=
                   10546:               "varname">WRKDIR</code> (read-only)</span></dt>
                   10547: 
                   10548:               <dd>
                   10549:                 <p>This is an absolute pathname pointing to the
1.57      minskim  10550:                 directory where all work takes place. The distfiles
                   10551:                 are extraced to this directory. It also contains
                   10552:                 temporary directories and log files used by the
                   10553:                 various pkgsrc frameworks, like <span class=
                   10554:                 "emphasis"><em>buildlink</em></span> or the
                   10555:                 <span class=
1.56      rillig   10556:                 "emphasis"><em>wrappers</em></span>.</p>
                   10557:               </dd>
                   10558: 
                   10559:               <dt><span class="term"><code class=
                   10560:               "varname">WRKSRC</code> (read-write)</span></dt>
                   10561: 
                   10562:               <dd>
                   10563:                 <p>This is an absolute pathname pointing to the
                   10564:                 directory where the distfiles are extracted. It is
                   10565:                 usually a direct subdirectory of <code class=
                   10566:                 "varname">WRKDIR</code>, and often it's the only
                   10567:                 directory entry that isn't hidden.</p>
                   10568:               </dd>
                   10569:             </dl>
                   10570:           </div>
                   10571:         </div>
                   10572: 
1.59    ! rillig   10573:         <div class="sect1" lang="en" xml:lang="en">
1.56      rillig   10574:           <div class="titlepage">
                   10575:             <div>
                   10576:               <div>
                   10577:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   10578:                 "build.running" id=
1.56      rillig   10579:                 "build.running"></a>14.4.&nbsp;Running a phase</h2>
                   10580:               </div>
                   10581:             </div>
                   10582:           </div>
                   10583: 
                   10584:           <p>You can run a particular phase by typing
                   10585:           <span><strong class="command">make phase</strong></span>,
                   10586:           where <span class="emphasis"><em>phase</em></span> is the
                   10587:           name of the phase. This will automatically run all phases
                   10588:           that are required for this phase. The default phase is
                   10589:           <code class="varname">build</code>, that is, when you run
                   10590:           <span><strong class="command">make</strong></span>
                   10591:           without parameters in a package directory, the package
                   10592:           will be built, but not installed.</p>
                   10593:         </div>
                   10594: 
1.59    ! rillig   10595:         <div class="sect1" lang="en" xml:lang="en">
1.56      rillig   10596:           <div class="titlepage">
                   10597:             <div>
                   10598:               <div>
                   10599:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   10600:                 "build.fetch" id="build.fetch"></a>14.5.&nbsp;The
        !          10601:                 <span class="emphasis"><em>fetch</em></span>
        !          10602:                 phase</h2>
1.56      rillig   10603:               </div>
                   10604:             </div>
                   10605:           </div>
                   10606: 
                   10607:           <p>This will check if the file(s) given in the variables
                   10608:           <code class="varname">DISTFILES</code> and <code class=
                   10609:           "varname">PATCHFILES</code> (as defined in the package's
                   10610:           Makefile) are present on the local system in <code xmlns=
                   10611:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10612:           "filename">/usr/pkgsrc/distfiles</code>. If they are not
                   10613:           present, an attempt will be made to fetch them using
                   10614:           commands of the form:</p>
                   10615:           <pre class="programlisting">
1.51      rillig   10616:     ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
1.1       grant    10617: </pre>
                   10618: 
1.56      rillig   10619:           <p>where ${site} varies through several possibilities in
                   10620:           turn: first, <code class=
                   10621:           "varname">MASTER_SITE_OVERRIDE</code> is tried, then the
                   10622:           sites specified in either <code class=
                   10623:           "varname">SITES_file</code> if defined, else <code class=
                   10624:           "varname">MASTER_SITES</code> or <code class=
                   10625:           "varname">PATCH_SITES</code>, as applies, then finally
                   10626:           the value of <code class=
                   10627:           "varname">MASTER_SITE_BACKUP</code>. The order of all
                   10628:           except the first can be optionally sorted by the user,
                   10629:           via setting either <code class=
                   10630:           "varname">MASTER_SORT_AWK</code> or <code class=
                   10631:           "varname">MASTER_SORT_REGEX</code>.</p>
                   10632:         </div>
                   10633: 
1.59    ! rillig   10634:         <div class="sect1" lang="en" xml:lang="en">
1.56      rillig   10635:           <div class="titlepage">
                   10636:             <div>
                   10637:               <div>
                   10638:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   10639:                 "build.checksum" id=
1.56      rillig   10640:                 "build.checksum"></a>14.6.&nbsp;The <span class=
                   10641:                 "emphasis"><em>checksum</em></span> phase</h2>
                   10642:               </div>
                   10643:             </div>
                   10644:           </div>
                   10645: 
                   10646:           <p>After the distfile(s) are fetched, their checksum is
                   10647:           generated and compared with the checksums stored in the
                   10648:           distinfo file. If the checksums don't match, the build is
                   10649:           aborted. This is to ensure the same distfile is used for
                   10650:           building, and that the distfile wasn't changed, e.g. by
                   10651:           some malign force, deliberately changed distfiles on the
                   10652:           master distribution site or network lossage.</p>
                   10653:         </div>
                   10654: 
1.59    ! rillig   10655:         <div class="sect1" lang="en" xml:lang="en">
1.56      rillig   10656:           <div class="titlepage">
                   10657:             <div>
                   10658:               <div>
                   10659:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   10660:                 "build.extract" id=
1.56      rillig   10661:                 "build.extract"></a>14.7.&nbsp;The <span class=
                   10662:                 "emphasis"><em>extract</em></span> phase</h2>
                   10663:               </div>
                   10664:             </div>
                   10665:           </div>
                   10666: 
                   10667:           <p>When the distfiles are present on the local system,
                   10668:           they need to be extracted, as they are usually in the
                   10669:           form of some compressed archive format, most commonly
                   10670:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10671:           class="filename">.tar.gz</code>.</p>
1.1       grant    10672: 
1.56      rillig   10673:           <p>If only some of the distfiles need to be uncompressed,
                   10674:           the files to be uncompressed should be put into
                   10675:           <code class="varname">EXTRACT_ONLY</code>.</p>
1.1       grant    10676: 
1.56      rillig   10677:           <p>If the distfiles are not in <code xmlns=
                   10678:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10679:           "filename">.tar.gz</code> format, they can be extracted
                   10680:           by setting either <code class=
                   10681:           "varname">EXTRACT_SUFX</code>, or <code class=
                   10682:           "varname">EXTRACT_CMD</code>, <code class=
                   10683:           "varname">EXTRACT_BEFORE_ARGS</code> and <code class=
                   10684:           "varname">EXTRACT_AFTER_ARGS</code>. In the former case,
                   10685:           pkgsrc knows how to extract a number of suffixes
                   10686:           (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10687:           class="filename">.tar.gz</code>, <code xmlns=
                   10688:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10689:           "filename">.tgz</code>, <code xmlns=
                   10690:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10691:           "filename">.tar.gz2</code>, <code xmlns=
                   10692:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10693:           "filename">.tbz</code>, <code xmlns=
                   10694:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10695:           "filename">.tar.Z</code>, <code xmlns=
                   10696:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10697:           "filename">.tar</code>, <code xmlns=
                   10698:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10699:           "filename">.shar.gz</code>, <code xmlns=
                   10700:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10701:           "filename">.shar.bz2</code>, <code xmlns=
                   10702:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10703:           "filename">.shar.Z</code>, <code xmlns=
                   10704:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10705:           "filename">.shar</code>, <code xmlns=
                   10706:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10707:           "filename">.Z</code>, <code xmlns=
                   10708:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10709:           "filename">.bz2</code> and <code xmlns=
                   10710:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10711:           "filename">.gz</code>; see the definition of the various
                   10712:           <code class="varname">DECOMPRESS_CMD</code> variables in
                   10713:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10714:           class="filename">bsd.pkg.extract.mk</code> for a complete
                   10715:           list). Here's an example on how to use the other
                   10716:           variables for a program that comes with a compressed
                   10717:           shell archive whose name ends in <code xmlns=
                   10718:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10719:           "filename">.msg.gz</code>:</p>
                   10720:           <pre class="programlisting">
1.51      rillig   10721:     EXTRACT_SUFX=           .msg.gz
                   10722:     EXTRACT_CMD=            zcat
                   10723:     EXTRACT_BEFORE_ARGS=
                   10724:     EXTRACT_AFTER_ARGS=     |sh
1.1       grant    10725: </pre>
1.56      rillig   10726:         </div>
                   10727: 
1.59    ! rillig   10728:         <div class="sect1" lang="en" xml:lang="en">
1.56      rillig   10729:           <div class="titlepage">
                   10730:             <div>
                   10731:               <div>
                   10732:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   10733:                 "build.patch" id="build.patch"></a>14.8.&nbsp;The
        !          10734:                 <span class="emphasis"><em>patch</em></span>
        !          10735:                 phase</h2>
1.56      rillig   10736:               </div>
                   10737:             </div>
                   10738:           </div>
                   10739: 
                   10740:           <p>After extraction, all the patches named by the
                   10741:           <code class="varname">PATCHFILES</code>, those present in
                   10742:           the patches subdirectory of the package as well as in
                   10743:           $LOCALPATCHES/$PKGPATH (e.g. <code xmlns=
                   10744:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10745:           "filename">/usr/local/patches/graphics/png</code>) are
                   10746:           applied. Patchfiles ending in <code xmlns=
                   10747:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10748:           "filename">.Z</code> or <code xmlns=
                   10749:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10750:           "filename">.gz</code> are uncompressed before they are
                   10751:           applied, files ending in <code xmlns=
                   10752:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10753:           "filename">.orig</code> or <code xmlns=
                   10754:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10755:           "filename">.rej</code> are ignored. Any special options
                   10756:           to <a href=
                   10757:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   10758:           <span class="citerefentry"><span class=
                   10759:           "refentrytitle">patch</span>(1)</span></a> can be handed
                   10760:           in <code class="varname">PATCH_DIST_ARGS</code>. See
                   10761:           <a href="#components.patches" title=
                   10762:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
                   10763:           &#8220;patches/*&#8221;</a> for more details.</p>
                   10764: 
                   10765:           <p>By default <a href=
                   10766:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   10767:           <span class="citerefentry"><span class=
                   10768:           "refentrytitle">patch</span>(1)</span></a> is given
                   10769:           special args to make it fail if the patches apply with
                   10770:           some lines of fuzz. Please fix (regen) the patches so
                   10771:           that they apply cleanly. The rationale behind this is
                   10772:           that patches that don't apply cleanly may end up being
                   10773:           applied in the wrong place, and cause severe harm
                   10774:           there.</p>
                   10775:         </div>
                   10776: 
1.59    ! rillig   10777:         <div class="sect1" lang="en" xml:lang="en">
1.56      rillig   10778:           <div class="titlepage">
                   10779:             <div>
                   10780:               <div>
                   10781:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   10782:                 "build.tools" id="build.tools"></a>14.9.&nbsp;The
        !          10783:                 <span class="emphasis"><em>tools</em></span>
        !          10784:                 phase</h2>
1.56      rillig   10785:               </div>
                   10786:             </div>
                   10787:           </div>
                   10788: 
                   10789:           <p>[TODO]</p>
                   10790:         </div>
                   10791: 
1.59    ! rillig   10792:         <div class="sect1" lang="en" xml:lang="en">
1.56      rillig   10793:           <div class="titlepage">
                   10794:             <div>
                   10795:               <div>
                   10796:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   10797:                 "build.wrapper" id=
1.56      rillig   10798:                 "build.wrapper"></a>14.10.&nbsp;The <span class=
                   10799:                 "emphasis"><em>wrapper</em></span> phase</h2>
                   10800:               </div>
                   10801:             </div>
                   10802:           </div>
                   10803: 
                   10804:           <p>[TODO]</p>
                   10805:         </div>
                   10806: 
1.59    ! rillig   10807:         <div class="sect1" lang="en" xml:lang="en">
1.56      rillig   10808:           <div class="titlepage">
                   10809:             <div>
                   10810:               <div>
                   10811:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   10812:                 "build.configure" id=
1.56      rillig   10813:                 "build.configure"></a>14.11.&nbsp;The <span class=
                   10814:                 "emphasis"><em>configure</em></span> phase</h2>
                   10815:               </div>
                   10816:             </div>
                   10817:           </div>
                   10818: 
                   10819:           <p>Most pieces of software need information on the header
                   10820:           files, system calls, and library routines which are
                   10821:           available on the platform they run on. The process of
                   10822:           determining this information is known as configuration,
                   10823:           and is usually automated. In most cases, a script is
                   10824:           supplied with the distfiles, and its invocation results
                   10825:           in generation of header files, Makefiles, etc.</p>
                   10826: 
                   10827:           <p>If the package contains a configure script, this can
                   10828:           be invoked by setting <code class=
                   10829:           "varname">HAS_CONFIGURE</code> to &#8220;<span class=
                   10830:           "quote">yes</span>&#8221;. If the configure script is a
                   10831:           GNU autoconf script, you should set <code class=
                   10832:           "varname">GNU_CONFIGURE</code> to &#8220;<span class=
                   10833:           "quote">yes</span>&#8221; instead. What happens in the
                   10834:           <span class="emphasis"><em>configure</em></span> phase is
                   10835:           roughly:</p>
                   10836:           <pre class="programlisting">
                   10837:     .for d in ${CONFIGURE_DIRS}
                   10838:             cd ${WRKSRC} &amp;&amp; cd ${d} &amp;&amp; env ${CONFIGURE_ENV} \
                   10839:                 ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
                   10840:     .endfor
                   10841: </pre>
1.1       grant    10842: 
1.56      rillig   10843:           <p><code class="varname">CONFIGURE_DIRS</code> (default:
                   10844:           &#8220;<span class="quote">.</span>&#8221;) is a list of
                   10845:           pathnames relative to <code class=
                   10846:           "varname">WRKSRC</code>. In each of these directories,
                   10847:           the configure script is run with the environment
                   10848:           <code class="varname">CONFIGURE_ENV</code> and arguments
                   10849:           <code class="varname">CONFIGURE_ARGS</code>. The
                   10850:           variables <code class="varname">CONFIGURE_ENV</code>,
                   10851:           <code class="varname">CONFIGURE_SCRIPT</code> (default:
                   10852:           &#8220;<span class="quote">./configure</span>&#8221;) and
                   10853:           <code class="varname">CONFIGURE_ARGS</code> may all be
                   10854:           changed by the package.</p>
1.1       grant    10855: 
1.56      rillig   10856:           <p>If the program uses an <code xmlns=
                   10857:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10858:           "filename">Imakefile</code> for configuration, the
                   10859:           appropriate steps can be invoked by setting <code class=
                   10860:           "varname">USE_IMAKE</code> to &#8220;<span class=
                   10861:           "quote">yes</span>&#8221;. (If you only want the package
                   10862:           installed in <code class="varname">${X11PREFIX}</code>
                   10863:           but xmkmf not being run, set <code class=
                   10864:           "varname">USE_X11BASE</code> instead.)</p>
                   10865:         </div>
1.1       grant    10866: 
1.59    ! rillig   10867:         <div class="sect1" lang="en" xml:lang="en">
1.56      rillig   10868:           <div class="titlepage">
                   10869:             <div>
                   10870:               <div>
                   10871:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   10872:                 "build.build" id="build.build"></a>14.12.&nbsp;The
        !          10873:                 <span class="emphasis"><em>build</em></span>
        !          10874:                 phase</h2>
1.56      rillig   10875:               </div>
                   10876:             </div>
1.1       grant    10877:           </div>
                   10878: 
1.56      rillig   10879:           <p>For building a package, a rough equivalent of the
                   10880:           following code is executed.</p>
1.1       grant    10881:           <pre class="programlisting">
1.56      rillig   10882:     .for d in ${BUILD_DIRS}
                   10883:             cd ${WRKSRC} &amp;&amp; cd ${d} &amp;&amp; env ${MAKE_ENV} \
                   10884:                 ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} \
                   10885:                     -f ${MAKEFILE} ${BUILD_TARGET}
                   10886:     .endfor
1.1       grant    10887: </pre>
1.56      rillig   10888: 
                   10889:           <p><code class="varname">BUILD_DIRS</code> (default:
                   10890:           &#8220;<span class="quote">.</span>&#8221;) is a list of
                   10891:           pathnames relative to <code class=
                   10892:           "varname">WRKSRC</code>. In each of these directories,
                   10893:           <code class="varname">MAKE_PROGRAM</code> is run with the
                   10894:           environment <code class="varname">MAKE_ENV</code> and
                   10895:           arguments <code class="varname">BUILD_MAKE_FLAGS</code>.
                   10896:           The variables <code class="varname">MAKE_ENV</code>,
                   10897:           <code class="varname">BUILD_MAKE_FLAGS</code>,
                   10898:           <code class="varname">MAKEFILE</code> and <code class=
                   10899:           "varname">BUILD_TARGET</code> may all be changed by the
                   10900:           package.</p>
                   10901: 
                   10902:           <p>The default value of <code class=
                   10903:           "varname">MAKE_PROGRAM</code> is &#8220;<span class=
                   10904:           "quote">gmake</span>&#8221; if <code class=
                   10905:           "varname">USE_TOOLS</code> contains &#8220;<span class=
                   10906:           "quote">gmake</span>&#8221;, &#8220;<span class=
                   10907:           "quote">make</span>&#8221; otherwise. The default value
                   10908:           of <code class="varname">MAKEFILE</code> is
                   10909:           &#8220;<span class="quote">Makefile</span>&#8221;, and
                   10910:           <code class="varname">BUILD_TARGET</code> defaults to
                   10911:           &#8220;<span class="quote">all</span>&#8221;.</p>
                   10912:         </div>
                   10913: 
1.59    ! rillig   10914:         <div class="sect1" lang="en" xml:lang="en">
1.56      rillig   10915:           <div class="titlepage">
                   10916:             <div>
                   10917:               <div>
                   10918:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   10919:                 "build.test" id="build.test"></a>14.13.&nbsp;The
        !          10920:                 <span class="emphasis"><em>test</em></span>
        !          10921:                 phase</h2>
1.56      rillig   10922:               </div>
                   10923:             </div>
                   10924:           </div>
                   10925: 
                   10926:           <p>[TODO]</p>
                   10927:         </div>
                   10928: 
1.59    ! rillig   10929:         <div class="sect1" lang="en" xml:lang="en">
1.56      rillig   10930:           <div class="titlepage">
                   10931:             <div>
                   10932:               <div>
                   10933:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   10934:                 "build.install" id=
1.56      rillig   10935:                 "build.install"></a>14.14.&nbsp;The <span class=
                   10936:                 "emphasis"><em>install</em></span> phase</h2>
                   10937:               </div>
                   10938:             </div>
                   10939:           </div>
                   10940: 
                   10941:           <p>Once the build stage has completed, the final step is
                   10942:           to install the software in public directories, so users
                   10943:           can access the programs and files. As in the
                   10944:           build-target, <code class="varname">$MAKE_PROGRAM</code>
                   10945:           is invoked on <code class="varname">$MAKEFILE</code>
                   10946:           here, but with the <code class=
                   10947:           "varname">$INSTALL_TARGET</code> instead, the latter
                   10948:           defaulting to &#8220;<span class=
                   10949:           "quote">install</span>&#8221; (plus &#8220;<span class=
                   10950:           "quote">install.man</span>&#8221;, if <code class=
                   10951:           "varname">USE_IMAKE</code> is set).</p>
                   10952:         </div>
                   10953: 
1.59    ! rillig   10954:         <div class="sect1" lang="en" xml:lang="en">
1.56      rillig   10955:           <div class="titlepage">
                   10956:             <div>
                   10957:               <div>
                   10958:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   10959:                 "build.package" id=
1.56      rillig   10960:                 "build.package"></a>14.15.&nbsp;The <span class=
                   10961:                 "emphasis"><em>package</em></span> phase</h2>
                   10962:               </div>
                   10963:             </div>
                   10964:           </div>
                   10965: 
                   10966:           <p>[TODO]</p>
1.1       grant    10967:         </div>
                   10968: 
1.59    ! rillig   10969:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    10970:           <div class="titlepage">
                   10971:             <div>
                   10972:               <div>
                   10973:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   10974:                 "build.helpful-targets" id=
1.56      rillig   10975:                 "build.helpful-targets"></a>14.16.&nbsp;Other
1.1       grant    10976:                 helpful targets</h2>
                   10977:               </div>
                   10978:             </div>
                   10979:           </div>
                   10980: 
                   10981:           <div class="variablelist">
                   10982:             <dl>
                   10983:               <dt><span class="term">pre/post-*</span></dt>
                   10984: 
                   10985:               <dd>
                   10986:                 <p>For any of the main targets described in the
                   10987:                 previous section, two auxiliary targets exist with
                   10988:                 &#8220;<span class="quote">pre-</span>&#8221; and
                   10989:                 &#8220;<span class="quote">post-</span>&#8221; used
                   10990:                 as a prefix for the main target's name. These
                   10991:                 targets are invoked before and after the main
                   10992:                 target is called, allowing extra configuration or
                   10993:                 installation steps be performed from a package's
                   10994:                 Makefile, for example, which a program's configure
                   10995:                 script or install target omitted.</p>
                   10996:               </dd>
                   10997: 
                   10998:               <dt><span class="term">do-*</span></dt>
                   10999: 
                   11000:               <dd>
                   11001:                 <p>Should one of the main targets do the wrong
                   11002:                 thing, and should there be no variable to fix this,
                   11003:                 you can redefine it with the do-* target. (Note
                   11004:                 that redefining the target itself instead of the
                   11005:                 do-* target is a bad idea, as the pre-* and post-*
                   11006:                 targets won't be called anymore, etc.) You will not
                   11007:                 usually need to do this.</p>
                   11008:               </dd>
                   11009: 
                   11010:               <dt><span class="term">reinstall</span></dt>
                   11011: 
                   11012:               <dd>
1.14      xtraeme  11013:                 <p>If you did a <span><strong class="command">make
                   11014:                 install</strong></span> and you noticed some file
                   11015:                 was not installed properly, you can repeat the
1.1       grant    11016:                 installation with this target, which will ignore
                   11017:                 the &#8220;<span class="quote">already
                   11018:                 installed</span>&#8221; flag.</p>
                   11019:               </dd>
                   11020: 
                   11021:               <dt><span class="term">deinstall</span></dt>
                   11022: 
                   11023:               <dd>
1.24      wiz      11024:                 <p>This target does a <a href=
                   11025:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   11026:                 <span class="citerefentry"><span class=
                   11027:                 "refentrytitle">pkg_delete</span>(1)</span></a> in
                   11028:                 the current directory, effectively de-installing
                   11029:                 the package. The following variables can be used to
                   11030:                 tune the behaviour:</p>
1.1       grant    11031: 
                   11032:                 <div class="variablelist">
                   11033:                   <dl>
1.14      xtraeme  11034:                     <dt><span class="term"><code class=
                   11035:                     "varname">PKG_VERBOSE</code></span></dt>
1.1       grant    11036: 
                   11037:                     <dd>
                   11038:                       <p>Add a "-v" to the <a href=
                   11039:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   11040:                       <span class="citerefentry"><span class=
                   11041:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   11042:                       command.</p>
                   11043:                     </dd>
                   11044: 
1.14      xtraeme  11045:                     <dt><span class="term"><code class=
                   11046:                     "varname">DEINSTALLDEPENDS</code></span></dt>
1.1       grant    11047: 
                   11048:                     <dd>
                   11049:                       <p>Remove all packages that require (depend
                   11050:                       on) the given package. This can be used to
                   11051:                       remove any packages that may have been pulled
                   11052:                       in by a given package, e.g. if
1.14      xtraeme  11053:                       <span><strong class="command">make deinstall
                   11054:                       DEINSTALLDEPENDS=1</strong></span> is done in
1.45      wiz      11055:                       <code xmlns=
                   11056:                       "http://www.w3.org/TR/xhtml1/transitional"
                   11057:                       class="filename">pkgsrc/x11/kde</code>, this
                   11058:                       is likely to remove whole KDE. Works by
1.1       grant    11059:                       adding &#8220;<span class=
                   11060:                       "quote">-R</span>&#8221; to the <a href=
                   11061:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   11062:                       <span class="citerefentry"><span class=
                   11063:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   11064:                       command line.</p>
                   11065:                     </dd>
                   11066:                   </dl>
                   11067:                 </div>
                   11068:               </dd>
                   11069: 
                   11070:               <dt><span class="term">update</span></dt>
                   11071: 
                   11072:               <dd>
                   11073:                 <p>This target causes the current package to be
                   11074:                 updated to the latest version. The package and all
                   11075:                 depending packages first get de-installed, then
                   11076:                 current versions of the corresponding packages get
                   11077:                 compiled and installed. This is similar to manually
                   11078:                 noting which packages are currently installed, then
1.14      xtraeme  11079:                 performing a series of <span><strong class=
                   11080:                 "command">make deinstall</strong></span> and
                   11081:                 <span><strong class="command">make
                   11082:                 install</strong></span> (or whatever <code class=
                   11083:                 "varname">UPDATE_TARGET</code> is set to) for these
                   11084:                 packages.</p>
1.1       grant    11085: 
                   11086:                 <p>You can use the &#8220;<span class=
                   11087:                 "quote">update</span>&#8221; target to resume
1.14      xtraeme  11088:                 package updating in case a previous
                   11089:                 <span><strong class="command">make
                   11090:                 update</strong></span> was interrupted for some
                   11091:                 reason. However, in this case, make sure you don't
                   11092:                 call <span><strong class="command">make
                   11093:                 clean</strong></span> or otherwise remove the list
                   11094:                 of dependent packages in <code class=
1.47      reed     11095:                 "varname">WRKDIR</code>. Otherwise, you lose the
1.1       grant    11096:                 ability to automatically update the current package
                   11097:                 along with the dependent packages you have
                   11098:                 installed.</p>
                   11099: 
1.14      xtraeme  11100:                 <p>Resuming an interrupted <span><strong class=
                   11101:                 "command">make update</strong></span> will only
                   11102:                 work as long as the package tree remains unchanged.
                   11103:                 If the source code for one of the packages to be
                   11104:                 updated has been changed, resuming
                   11105:                 <span><strong class="command">make
                   11106:                 update</strong></span> will most certainly
                   11107:                 fail!</p>
1.1       grant    11108: 
                   11109:                 <p>The following variables can be used either on
1.45      wiz      11110:                 the command line or in <code xmlns=
                   11111:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11112:                 "filename">/etc/mk.conf</code> to alter the
                   11113:                 behaviour of <span><strong class="command">make
                   11114:                 update</strong></span>:</p>
1.1       grant    11115: 
                   11116:                 <div class="variablelist">
                   11117:                   <dl>
1.14      xtraeme  11118:                     <dt><span class="term"><code class=
                   11119:                     "varname">UPDATE_TARGET</code></span></dt>
1.1       grant    11120: 
                   11121:                     <dd>
                   11122:                       <p>Install target to recursively use for the
                   11123:                       updated package and the dependent packages.
1.14      xtraeme  11124:                       Defaults to <code class=
                   11125:                       "varname">DEPENDS_TARGET</code> if set,
1.1       grant    11126:                       &#8220;<span class=
                   11127:                       "quote">install</span>&#8221; otherwise for
1.14      xtraeme  11128:                       <span><strong class="command">make
                   11129:                       update</strong></span>. e.g.
                   11130:                       <span><strong class="command">make update
                   11131:                       UPDATE_TARGET=package</strong></span></p>
1.1       grant    11132:                     </dd>
                   11133: 
1.14      xtraeme  11134:                     <dt><span class="term"><code class=
                   11135:                     "varname">NOCLEAN</code></span></dt>
1.1       grant    11136: 
                   11137:                     <dd>
                   11138:                       <p>Don't clean up after updating. Useful if
                   11139:                       you want to leave the work sources of the
                   11140:                       updated packages around for inspection or
                   11141:                       other purposes. Be sure you eventually clean
                   11142:                       up the source tree (see the
                   11143:                       &#8220;<span class=
                   11144:                       "quote">clean-update</span>&#8221; target
                   11145:                       below) or you may run into troubles with old
                   11146:                       source code still lying around on your next
1.14      xtraeme  11147:                       <span><strong class=
                   11148:                       "command">make</strong></span> or
                   11149:                       <span><strong class="command">make
                   11150:                       update</strong></span>.</p>
1.1       grant    11151:                     </dd>
                   11152: 
1.14      xtraeme  11153:                     <dt><span class="term"><code class=
                   11154:                     "varname">REINSTALL</code></span></dt>
1.1       grant    11155: 
                   11156:                     <dd>
                   11157:                       <p>Deinstall each package before installing
1.14      xtraeme  11158:                       (making <code class=
                   11159:                       "varname">DEPENDS_TARGET</code>). This may be
1.1       grant    11160:                       necessary if the &#8220;<span class=
                   11161:                       "quote">clean-update</span>&#8221; target
                   11162:                       (see below) was called after interrupting a
1.14      xtraeme  11163:                       running <span><strong class="command">make
                   11164:                       update</strong></span>.</p>
1.1       grant    11165:                     </dd>
                   11166: 
1.14      xtraeme  11167:                     <dt><span class="term"><code class=
                   11168:                     "varname">DEPENDS_TARGET</code></span></dt>
1.1       grant    11169: 
                   11170:                     <dd>
                   11171:                       <p>Allows you to disable recursion and
                   11172:                       hardcode the target for packages. The default
                   11173:                       is &#8220;<span class=
                   11174:                       "quote">update</span>&#8221; for the update
                   11175:                       target, facilitating a recursive update of
1.14      xtraeme  11176:                       prerequisite packages. Only set <code class=
                   11177:                       "varname">DEPENDS_TARGET</code> if you want
                   11178:                       to disable recursive updates. Use
                   11179:                       <code class="varname">UPDATE_TARGET</code>
                   11180:                       instead to just set a specific target for
                   11181:                       each package to be installed during
                   11182:                       <span><strong class="command">make
                   11183:                       update</strong></span> (see above).</p>
1.1       grant    11184:                     </dd>
                   11185:                   </dl>
                   11186:                 </div>
                   11187:               </dd>
                   11188: 
                   11189:               <dt><span class="term">clean-update</span></dt>
                   11190: 
                   11191:               <dd>
                   11192:                 <p>Clean the source tree for all packages that
1.14      xtraeme  11193:                 would get updated if <span><strong class=
                   11194:                 "command">make update</strong></span> was called
                   11195:                 from the current directory. This target should not
                   11196:                 be used if the current package (or any of its
                   11197:                 depending packages) have already been de-installed
                   11198:                 (e.g., after calling <span><strong class=
                   11199:                 "command">make update</strong></span>) or you may
                   11200:                 lose some packages you intended to update. As a
                   11201:                 rule of thumb: only use this target <span class=
                   11202:                 "emphasis"><em>before</em></span> the first time
                   11203:                 you run <span><strong class="command">make
                   11204:                 update</strong></span> and only if you have a dirty
                   11205:                 package tree (e.g., if you used <code class=
                   11206:                 "varname">NOCLEAN</code>).</p>
1.1       grant    11207: 
1.47      reed     11208:                 <p>If you are unsure about whether your tree is
                   11209:                 clean, you can either perform a
1.14      xtraeme  11210:                 <span><strong class="command">make
1.47      reed     11211:                 clean</strong></span> at the top of the tree, or
                   11212:                 use the following sequence of commands from the
                   11213:                 directory of the package you want to update
                   11214:                 (<span class="emphasis"><em>before</em></span>
                   11215:                 running <span><strong class="command">make
1.14      xtraeme  11216:                 update</strong></span> for the first time,
                   11217:                 otherwise you lose all the packages you wanted to
                   11218:                 update!):</p>
1.1       grant    11219:                 <pre class="screen">
1.14      xtraeme  11220: <code class="prompt">#</code> <strong class=
                   11221: "userinput"><code>make clean-update</code></strong>
                   11222: <code class="prompt">#</code> <strong class=
                   11223: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
                   11224: <code class="prompt">#</code> <strong class=
                   11225: "userinput"><code>make update</code></strong>
1.1       grant    11226: </pre>
                   11227: 
                   11228:                 <p>The following variables can be used either on
1.45      wiz      11229:                 the command line or in <code xmlns=
                   11230:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11231:                 "filename">/etc/mk.conf</code> to alter the
                   11232:                 behaviour of <span><strong class="command">make
                   11233:                 clean-update</strong></span>:</p>
1.1       grant    11234: 
                   11235:                 <div class="variablelist">
                   11236:                   <dl>
1.14      xtraeme  11237:                     <dt><span class="term"><code class=
                   11238:                     "varname">CLEAR_DIRLIST</code></span></dt>
1.1       grant    11239: 
                   11240:                     <dd>
1.14      xtraeme  11241:                       <p>After <span><strong class="command">make
                   11242:                       clean</strong></span>, do not reconstruct the
                   11243:                       list of directories to update for this
                   11244:                       package. Only use this if
                   11245:                       <span><strong class="command">make
                   11246:                       update</strong></span> successfully installed
                   11247:                       all packages you wanted to update. Normally,
                   11248:                       this is done automatically on
                   11249:                       <span><strong class="command">make
                   11250:                       update</strong></span>, but may have been
                   11251:                       suppressed by the <code class=
                   11252:                       "varname">NOCLEAN</code> variable (see
1.1       grant    11253:                       above).</p>
                   11254:                     </dd>
                   11255:                   </dl>
                   11256:                 </div>
                   11257:               </dd>
                   11258: 
                   11259:               <dt><span class="term">info</span></dt>
                   11260: 
                   11261:               <dd>
                   11262:                 <p>This target invokes <a href=
                   11263:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   11264:                 <span class="citerefentry"><span class=
                   11265:                 "refentrytitle">pkg_info</span>(1)</span></a> for
                   11266:                 the current package. You can use this to check
                   11267:                 which version of a package is installed.</p>
                   11268:               </dd>
                   11269: 
                   11270:               <dt><span class="term">readme</span></dt>
                   11271: 
                   11272:               <dd>
1.45      wiz      11273:                 <p>This target generates a <code xmlns=
                   11274:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11275:                 "filename">README.html</code> file, which can be
1.1       grant    11276:                 viewed using a browser such as <a xmlns=
                   11277:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   11278:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45      wiz      11279:                 target="_top"><code xmlns="" class=
                   11280:                 "filename">www/mozilla</code></a> or <a xmlns=
1.20      ben      11281:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   11282:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
1.45      wiz      11283:                 target="_top"><code xmlns="" class=
                   11284:                 "filename">www/links</code></a>. The generated
                   11285:                 files contain references to any packages which are
                   11286:                 in the <code class="varname">PACKAGES</code>
                   11287:                 directory on the local host. The generated files
                   11288:                 can be made to refer to URLs based on <code class=
1.20      ben      11289:                 "varname">FTP_PKG_URL_HOST</code> and <code class=
                   11290:                 "varname">FTP_PKG_URL_DIR</code>. For example, if I
1.45      wiz      11291:                 wanted to generate <code xmlns=
                   11292:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      11293:                 "filename">README.html</code> files which pointed
                   11294:                 to binary packages on the local machine, in the
1.45      wiz      11295:                 directory <code xmlns=
                   11296:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      11297:                 "filename">/usr/packages</code>, set <code class=
                   11298:                 "varname">FTP_PKG_URL_HOST=file://localhost</code>
                   11299:                 and <code class=
                   11300:                 "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
                   11301:                 <code class="varname">${PACKAGES}</code> directory
                   11302:                 and its subdirectories will be searched for all the
                   11303:                 binary packages.</p>
1.1       grant    11304:               </dd>
                   11305: 
                   11306:               <dt><span class="term">readme-all</span></dt>
                   11307: 
                   11308:               <dd>
1.45      wiz      11309:                 <p>Use this target to create a file <code xmlns=
                   11310:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11311:                 "filename">README-all.html</code> which contains a
1.1       grant    11312:                 list of all packages currently available in the
                   11313:                 NetBSD Packages Collection, together with the
                   11314:                 category they belong to and a short description.
1.45      wiz      11315:                 This file is compiled from the <code xmlns=
                   11316:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11317:                 "filename">pkgsrc/*/README.html</code> files, so be
1.1       grant    11318:                 sure to run this <span class=
1.14      xtraeme  11319:                 "emphasis"><em>after</em></span> a
                   11320:                 <span><strong class="command">make
                   11321:                 readme</strong></span>.</p>
1.1       grant    11322:               </dd>
                   11323: 
                   11324:               <dt><span class="term">cdrom-readme</span></dt>
                   11325: 
                   11326:               <dd>
                   11327:                 <p>This is very much the same as the
                   11328:                 &#8220;<span class="quote">readme</span>&#8221;
                   11329:                 target (see above), but is to be used when
                   11330:                 generating a pkgsrc tree to be written to a CD-ROM.
1.45      wiz      11331:                 This target also produces <code xmlns=
                   11332:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11333:                 "filename">README.html</code> files, and can be
                   11334:                 made to refer to URLs based on <code class=
                   11335:                 "varname">CDROM_PKG_URL_HOST</code> and
                   11336:                 <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1       grant    11337:               </dd>
                   11338: 
                   11339:               <dt><span class="term">show-distfiles</span></dt>
                   11340: 
                   11341:               <dd>
                   11342:                 <p>This target shows which distfiles and patchfiles
1.14      xtraeme  11343:                 are needed to build the package. (<code class=
                   11344:                 "varname">DISTFILES</code> and <code class=
1.45      wiz      11345:                 "varname">PATCHFILES</code>, but not <code xmlns=
                   11346:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11347:                 "filename">patches/*</code>)</p>
1.1       grant    11348:               </dd>
                   11349: 
                   11350:               <dt><span class="term">show-downlevel</span></dt>
                   11351: 
                   11352:               <dd>
                   11353:                 <p>This target shows nothing if the package is not
                   11354:                 installed. If a version of this package is
                   11355:                 installed, but is not the version provided in this
                   11356:                 version of pkgsrc, then a warning message is
                   11357:                 displayed. This target can be used to show which of
                   11358:                 your installed packages are downlevel, and so the
                   11359:                 old versions can be deleted, and the current ones
                   11360:                 added.</p>
                   11361:               </dd>
                   11362: 
                   11363:               <dt><span class="term">show-pkgsrc-dir</span></dt>
                   11364: 
                   11365:               <dd>
                   11366:                 <p>This target shows the directory in the pkgsrc
                   11367:                 hierarchy from which the package can be built and
                   11368:                 installed. This may not be the same directory as
                   11369:                 the one from which the package was installed. This
                   11370:                 target is intended to be used by people who may
                   11371:                 wish to upgrade many packages on a single host, and
                   11372:                 can be invoked from the top-level pkgsrc Makefile
                   11373:                 by using the &#8220;<span class=
                   11374:                 "quote">show-host-specific-pkgs</span>&#8221;
                   11375:                 target.</p>
                   11376:               </dd>
                   11377: 
                   11378:               <dt><span class=
                   11379:               "term">show-installed-depends</span></dt>
                   11380: 
                   11381:               <dd>
                   11382:                 <p>This target shows which installed packages match
1.14      xtraeme  11383:                 the current package's <code class=
                   11384:                 "varname">DEPENDS</code>. Useful if out of date
1.1       grant    11385:                 dependencies are causing build problems.</p>
                   11386:               </dd>
                   11387: 
                   11388:               <dt><span class="term">check-shlibs</span></dt>
                   11389: 
                   11390:               <dd>
                   11391:                 <p>After a package is installed, check all its
                   11392:                 binaries and (on ELF platforms) shared libraries to
                   11393:                 see if they find the shared libs they need. Run by
1.14      xtraeme  11394:                 default if <code class=
                   11395:                 "varname">PKG_DEVELOPER</code> is set in
1.45      wiz      11396:                 <code xmlns=
                   11397:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11398:                 "filename">/etc/mk.conf</code>.</p>
1.1       grant    11399:               </dd>
                   11400: 
                   11401:               <dt><span class="term">print-PLIST</span></dt>
                   11402: 
                   11403:               <dd>
                   11404:                 <p>After a &#8220;<span class="quote">make
                   11405:                 install</span>&#8221; from a new or upgraded pkg,
                   11406:                 this prints out an attempt to generate a new
1.45      wiz      11407:                 <code xmlns=
                   11408:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11409:                 "filename">PLIST</code> from a <span><strong class=
                   11410:                 "command">find -newer
1.14      xtraeme  11411:                 work/.extract_done</strong></span>. An attempt is
                   11412:                 made to care for shared libs etc., but it is
1.1       grant    11413:                 <span class="emphasis"><em>strongly</em></span>
                   11414:                 recommended to review the result before putting it
1.45      wiz      11415:                 into <code xmlns=
                   11416:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11417:                 "filename">PLIST</code>. On upgrades, it's useful
                   11418:                 to diff the output of this command against an
                   11419:                 already existing <code xmlns=
                   11420:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11421:                 "filename">PLIST</code> file.</p>
1.1       grant    11422: 
1.24      wiz      11423:                 <p>If the package installs files via <a href=
                   11424:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   11425:                 <span class="citerefentry"><span class=
                   11426:                 "refentrytitle">tar</span>(1)</span></a> or other
                   11427:                 methods that don't update file access times, be
                   11428:                 sure to add these files manually to your
1.45      wiz      11429:                 <code xmlns=
                   11430:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11431:                 "filename">PLIST</code>, as the &#8220;<span class=
                   11432:                 "quote">find -newer</span>&#8221; command used by
                   11433:                 this target won't catch them!</p>
1.1       grant    11434: 
                   11435:                 <p>See <a href="#print-PLIST" title=
1.38      dillo    11436:                 "10.3.&nbsp;Tweaking output of make print-PLIST">Section&nbsp;10.3,
1.14      xtraeme  11437:                 &#8220;Tweaking output of <span><strong class=
                   11438:                 "command">make
                   11439:                 print-PLIST</strong></span>&#8221;</a> for more
                   11440:                 information on this target.</p>
1.1       grant    11441:               </dd>
                   11442: 
                   11443:               <dt><span class="term">bulk-package</span></dt>
                   11444: 
                   11445:               <dd>
                   11446:                 <p>Used to do bulk builds. If an appropriate binary
                   11447:                 package already exists, no action is taken. If not,
                   11448:                 this target will compile, install and package it
1.47      reed     11449:                 (and its depends, if <code class=
1.14      xtraeme  11450:                 "varname">PKG_DEPENDS</code> is set properly. See
1.1       grant    11451:                 <a href="#binary.configuration" title=
1.38      dillo    11452:                 "6.3.1.&nbsp;Configuration">Section&nbsp;6.3.1,
1.47      reed     11453:                 &#8220;Configuration&#8221;</a>). After creating
                   11454:                 the binary package, the sources, the just-installed
                   11455:                 package and its required packages are removed,
1.1       grant    11456:                 preserving free disk space.</p>
                   11457: 
                   11458:                 <p><span class="emphasis"><em>Beware that this
                   11459:                 target may deinstall all packages installed on a
                   11460:                 system!</em></span></p>
                   11461:               </dd>
                   11462: 
                   11463:               <dt><span class="term">bulk-install</span></dt>
                   11464: 
                   11465:               <dd>
                   11466:                 <p>Used during bulk-installs to install required
1.47      reed     11467:                 packages. If an up-to-date binary package is
1.1       grant    11468:                 available, it will be installed via <a href=
                   11469:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   11470:                 <span class="citerefentry"><span class=
                   11471:                 "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14      xtraeme  11472:                 not, <span><strong class="command">make
                   11473:                 bulk-package</strong></span> will be executed, but
1.47      reed     11474:                 the installed binary won't be removed.</p>
1.1       grant    11475: 
                   11476:                 <p>A binary package is considered
1.47      reed     11477:                 &#8220;<span class="quote">up-to-date</span>&#8221;
1.1       grant    11478:                 to be installed via <a href=
                   11479:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   11480:                 <span class="citerefentry"><span class=
                   11481:                 "refentrytitle">pkg_add</span>(1)</span></a>
                   11482:                 if:</p>
                   11483: 
                   11484:                 <div class="itemizedlist">
                   11485:                   <ul type="disc">
                   11486:                     <li>
1.45      wiz      11487:                       <p>None of the package's files (<code xmlns=
                   11488:                       "http://www.w3.org/TR/xhtml1/transitional"
                   11489:                       class="filename">Makefile</code>, ...) were
1.14      xtraeme  11490:                       modified since it was built.</p>
1.1       grant    11491:                     </li>
                   11492: 
                   11493:                     <li>
                   11494:                       <p>None of the package's required (binary)
                   11495:                       packages were modified since it was
                   11496:                       built.</p>
                   11497:                     </li>
                   11498:                   </ul>
                   11499:                 </div>
                   11500: 
                   11501:                 <p><span class="emphasis"><em>Beware that this
                   11502:                 target may deinstall all packages installed on a
                   11503:                 system!</em></span></p>
                   11504:               </dd>
                   11505:             </dl>
                   11506:           </div>
                   11507:         </div>
                   11508:       </div>
                   11509: 
1.59    ! rillig   11510:       <div class="chapter" lang="en" xml:lang="en">
1.1       grant    11511:         <div class="titlepage">
                   11512:           <div>
                   11513:             <div>
1.59    ! rillig   11514:               <h2 class="title"><a name="fixes" id=
1.55      rillig   11515:               "fixes"></a>Chapter&nbsp;15.&nbsp;Making your package
                   11516:               work</h2>
1.1       grant    11517:             </div>
                   11518:           </div>
                   11519:         </div>
                   11520: 
                   11521:         <div class="toc">
                   11522:           <p><b>Table of Contents</b></p>
                   11523: 
                   11524:           <dl>
1.30      wiz      11525:             <dt><span class="sect1"><a href=
1.38      dillo    11526:             "#general-operation">15.1. General
1.30      wiz      11527:             operation</a></span></dt>
1.1       grant    11528: 
                   11529:             <dd>
                   11530:               <dl>
                   11531:                 <dt><span class="sect2"><a href=
1.38      dillo    11532:                 "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30      wiz      11533:                 pull in variables from /etc/mk.conf</a></span></dt>
1.1       grant    11534: 
                   11535:                 <dt><span class="sect2"><a href=
1.38      dillo    11536:                 "#where-to-install-documentation">15.1.2. Where to
1.31      wiz      11537:                 install documentation</a></span></dt>
                   11538: 
                   11539:                 <dt><span class="sect2"><a href=
1.38      dillo    11540:                 "#restricted-packages">15.1.3. Restricted
1.1       grant    11541:                 packages</a></span></dt>
                   11542: 
                   11543:                 <dt><span class="sect2"><a href=
1.38      dillo    11544:                 "#dependencies">15.1.4. Handling
1.1       grant    11545:                 dependencies</a></span></dt>
                   11546: 
                   11547:                 <dt><span class="sect2"><a href=
1.38      dillo    11548:                 "#conflicts">15.1.5. Handling conflicts with other
1.1       grant    11549:                 packages</a></span></dt>
                   11550: 
                   11551:                 <dt><span class="sect2"><a href=
1.38      dillo    11552:                 "#not-building-packages">15.1.6. Packages that
1.30      wiz      11553:                 cannot or should not be built</a></span></dt>
1.1       grant    11554: 
                   11555:                 <dt><span class="sect2"><a href=
1.38      dillo    11556:                 "#undeletable-packages">15.1.7. Packages which
1.30      wiz      11557:                 should not be deleted, once
                   11558:                 installed</a></span></dt>
1.1       grant    11559: 
                   11560:                 <dt><span class="sect2"><a href=
1.38      dillo    11561:                 "#security-handling">15.1.8. Handling packages with
1.1       grant    11562:                 security problems</a></span></dt>
                   11563: 
                   11564:                 <dt><span class="sect2"><a href=
1.38      dillo    11565:                 "#compiler-bugs">15.1.9. How to handle compiler
1.1       grant    11566:                 bugs</a></span></dt>
                   11567: 
                   11568:                 <dt><span class="sect2"><a href=
1.38      dillo    11569:                 "#bumping-pkgrevision">15.1.10. How to handle
1.30      wiz      11570:                 incrementing versions when fixing an existing
1.1       grant    11571:                 package</a></span></dt>
                   11572: 
                   11573:                 <dt><span class="sect2"><a href=
1.38      dillo    11574:                 "#portability-of-packages">15.1.11. Portability of
1.1       grant    11575:                 packages</a></span></dt>
                   11576:               </dl>
                   11577:             </dd>
                   11578: 
1.30      wiz      11579:             <dt><span class="sect1"><a href=
1.38      dillo    11580:             "#downloading-issues">15.2. Possible downloading
1.30      wiz      11581:             issues</a></span></dt>
1.1       grant    11582: 
                   11583:             <dd>
                   11584:               <dl>
                   11585:                 <dt><span class="sect2"><a href=
1.38      dillo    11586:                 "#no-plain-download">15.2.1. Packages whose
1.30      wiz      11587:                 distfiles aren't available for plain
1.1       grant    11588:                 downloading</a></span></dt>
                   11589: 
                   11590:                 <dt><span class="sect2"><a href=
1.38      dillo    11591:                 "#modified-distfiles-same-name">15.2.2. How to
1.30      wiz      11592:                 handle modified distfiles with the 'old'
                   11593:                 name</a></span></dt>
1.1       grant    11594:               </dl>
                   11595:             </dd>
                   11596: 
1.30      wiz      11597:             <dt><span class="sect1"><a href=
1.38      dillo    11598:             "#configuration-gotchas">15.3. Configuration
1.30      wiz      11599:             gotchas</a></span></dt>
1.1       grant    11600: 
                   11601:             <dd>
                   11602:               <dl>
                   11603:                 <dt><span class="sect2"><a href=
1.38      dillo    11604:                 "#fixes.libtool">15.3.1. Shared libraries -
1.1       grant    11605:                 libtool</a></span></dt>
                   11606: 
                   11607:                 <dt><span class="sect2"><a href=
1.38      dillo    11608:                 "#using-libtool">15.3.2. Using libtool on GNU
1.30      wiz      11609:                 packages that already support
                   11610:                 libtool</a></span></dt>
1.1       grant    11611: 
                   11612:                 <dt><span class="sect2"><a href=
1.38      dillo    11613:                 "#autoconf-automake">15.3.3. GNU
1.1       grant    11614:                 Autoconf/Automake</a></span></dt>
                   11615:               </dl>
                   11616:             </dd>
                   11617: 
1.55      rillig   11618:             <dt><span class="sect1"><a href="#fixes-build">15.4.
                   11619:             Building the package</a></span></dt>
1.1       grant    11620: 
                   11621:             <dd>
                   11622:               <dl>
                   11623:                 <dt><span class="sect2"><a href=
1.38      dillo    11624:                 "#cpp-defines">15.4.1. CPP defines</a></span></dt>
1.51      rillig   11625: 
                   11626:                 <dt><span class="sect2"><a href="#cpp-list">15.4.2.
                   11627:                 Getting a list of CPP defines</a></span></dt>
1.1       grant    11628:               </dl>
                   11629:             </dd>
                   11630: 
1.30      wiz      11631:             <dt><span class="sect1"><a href=
1.38      dillo    11632:             "#package-specific-actions">15.5. Package specific
1.30      wiz      11633:             actions</a></span></dt>
1.1       grant    11634: 
                   11635:             <dd>
                   11636:               <dl>
                   11637:                 <dt><span class="sect2"><a href=
1.38      dillo    11638:                 "#user-interaction">15.5.1. User
1.2       hubertf  11639:                 interaction</a></span></dt>
1.1       grant    11640: 
                   11641:                 <dt><span class="sect2"><a href=
1.38      dillo    11642:                 "#handling-licenses">15.5.2. Handling
1.1       grant    11643:                 licenses</a></span></dt>
                   11644: 
                   11645:                 <dt><span class="sect2"><a href=
1.38      dillo    11646:                 "#installing-score-files">15.5.3. Installing score
1.1       grant    11647:                 files</a></span></dt>
                   11648: 
                   11649:                 <dt><span class="sect2"><a href=
1.38      dillo    11650:                 "#perl-scripts">15.5.4. Packages containing perl
1.1       grant    11651:                 scripts</a></span></dt>
                   11652: 
                   11653:                 <dt><span class="sect2"><a href=
1.38      dillo    11654:                 "#hardcoded-paths">15.5.5. Packages with hardcoded
1.30      wiz      11655:                 paths to other interpreters</a></span></dt>
1.1       grant    11656: 
                   11657:                 <dt><span class="sect2"><a href=
1.38      dillo    11658:                 "#perl-modules">15.5.6. Packages installing perl
1.1       grant    11659:                 modules</a></span></dt>
                   11660: 
                   11661:                 <dt><span class="sect2"><a href=
1.38      dillo    11662:                 "#faq.info-files">15.5.7. Packages installing info
1.1       grant    11663:                 files</a></span></dt>
                   11664: 
1.57      minskim  11665:                 <dt><span class="sect2"><a href="#manpages">15.5.8.
                   11666:                 Packages installing man pages</a></span></dt>
                   11667: 
1.1       grant    11668:                 <dt><span class="sect2"><a href=
1.57      minskim  11669:                 "#gconf2-data-files">15.5.9. Packages installing
1.30      wiz      11670:                 GConf2 data files</a></span></dt>
1.1       grant    11671: 
                   11672:                 <dt><span class="sect2"><a href=
1.57      minskim  11673:                 "#scrollkeeper-data-files">15.5.10. Packages
1.30      wiz      11674:                 installing scrollkeeper data files</a></span></dt>
1.1       grant    11675: 
                   11676:                 <dt><span class="sect2"><a href=
1.57      minskim  11677:                 "#x11-fonts">15.5.11. Packages installing X11
1.1       grant    11678:                 fonts</a></span></dt>
                   11679: 
                   11680:                 <dt><span class="sect2"><a href=
1.57      minskim  11681:                 "#gtk2-modules">15.5.12. Packages installing GTK2
1.1       grant    11682:                 modules</a></span></dt>
                   11683: 
                   11684:                 <dt><span class="sect2"><a href=
1.57      minskim  11685:                 "#sgml-xml-data">15.5.13. Packages installing SGML
1.30      wiz      11686:                 or XML data</a></span></dt>
1.1       grant    11687: 
                   11688:                 <dt><span class="sect2"><a href=
1.57      minskim  11689:                 "#mime-database">15.5.14. Packages installing
1.1       grant    11690:                 extensions to the MIME database</a></span></dt>
                   11691: 
                   11692:                 <dt><span class="sect2"><a href=
1.57      minskim  11693:                 "#intltool">15.5.15. Packages using
1.1       grant    11694:                 intltool</a></span></dt>
1.18      xtraeme  11695: 
                   11696:                 <dt><span class="sect2"><a href=
1.57      minskim  11697:                 "#startup-scripts">15.5.16. Packages installing
1.30      wiz      11698:                 startup scripts</a></span></dt>
1.57      minskim  11699: 
                   11700:                 <dt><span class="sect2"><a href=
                   11701:                 "#tex-packages">15.5.17. Packages installing TeX
                   11702:                 modules</a></span></dt>
1.1       grant    11703:               </dl>
                   11704:             </dd>
                   11705: 
1.30      wiz      11706:             <dt><span class="sect1"><a href=
1.38      dillo    11707:             "#feedback-to-author">15.6. Feedback to the
1.30      wiz      11708:             author</a></span></dt>
1.1       grant    11709:           </dl>
                   11710:         </div>
                   11711: 
1.59    ! rillig   11712:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    11713:           <div class="titlepage">
                   11714:             <div>
                   11715:               <div>
                   11716:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   11717:                 "general-operation" id=
1.38      dillo    11718:                 "general-operation"></a>15.1.&nbsp;General
1.1       grant    11719:                 operation</h2>
                   11720:               </div>
                   11721:             </div>
                   11722:           </div>
                   11723: 
1.59    ! rillig   11724:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    11725:             <div class="titlepage">
                   11726:               <div>
                   11727:                 <div>
1.30      wiz      11728:                   <h3 class="title"><a name=
1.59    ! rillig   11729:                   "pulling-vars-from-etc-mk.conf" id=
1.38      dillo    11730:                   "pulling-vars-from-etc-mk.conf"></a>15.1.1.&nbsp;How
1.30      wiz      11731:                   to pull in variables from /etc/mk.conf</h3>
1.1       grant    11732:                 </div>
                   11733:               </div>
                   11734:             </div>
                   11735: 
                   11736:             <p>The problem with package-defined variables that can
1.14      xtraeme  11737:             be overridden via <code class="varname">MAKECONF</code>
1.45      wiz      11738:             or <code xmlns=
                   11739:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   11740:             "filename">/etc/mk.conf</code> is that <a href=
1.1       grant    11741:             "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   11742:             <span class="citerefentry"><span class=
                   11743:             "refentrytitle">make</span>(1)</span></a> expands a
1.47      reed     11744:             variable as it is used, but evaluates preprocessor-like
1.1       grant    11745:             statements (.if, .ifdef and .ifndef) as they are read.
1.14      xtraeme  11746:             So, to use any variable (which may be set in
1.45      wiz      11747:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   11748:             class="filename">/etc/mk.conf</code>) in one of the
                   11749:             .if* statements, the file <code xmlns=
                   11750:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11751:             "filename">/etc/mk.conf</code> must be included before
1.1       grant    11752:             that .if* statement.</p>
                   11753: 
1.47      reed     11754:             <p>Rather than having a number of ad-hoc ways of
1.45      wiz      11755:             including <code xmlns=
                   11756:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   11757:             "filename">/etc/mk.conf</code>, should it exist, or
                   11758:             <code class="varname">MAKECONF</code>, should it exist,
                   11759:             include the <code xmlns=
                   11760:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   11761:             "filename">pkgsrc/mk/bsd.prefs.mk</code> file in the
                   11762:             package Makefile before any preprocessor-like .if,
                   11763:             .ifdef, or .ifndef statements:</p>
1.1       grant    11764:             <pre class="programlisting">
1.51      rillig   11765:     .include "../../mk/bsd.prefs.mk"
                   11766: 
1.1       grant    11767:     .if defined(USE_MENUS)
1.51      rillig   11768:     # ...
1.1       grant    11769:     .endif
                   11770: </pre>
                   11771: 
1.14      xtraeme  11772:             <p>If you wish to set the <code class=
1.45      wiz      11773:             "varname">CFLAGS</code> variable in <code xmlns=
                   11774:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     11775:             "filename">/etc/mk.conf</code>, please make sure to
1.1       grant    11776:             use:</p>
                   11777:             <pre class="programlisting">
1.51      rillig   11778:     CFLAGS+=  -your -flags
1.1       grant    11779: </pre>
                   11780: 
1.14      xtraeme  11781:             <p>Using <code class="varname">CFLAGS=</code> (i.e.
                   11782:             without the &#8220;<span class="quote">+</span>&#8221;)
                   11783:             may lead to problems with packages that need to add
                   11784:             their own flags. Also, you may want to take a look at
                   11785:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1       grant    11786:             href=
                   11787:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45      wiz      11788:             target="_top"><code xmlns="" class=
                   11789:             "filename">devel/cpuflags</code></a> package if you're
1.20      ben      11790:             interested in optimization for the current CPU.</p>
1.1       grant    11791:           </div>
                   11792: 
1.59    ! rillig   11793:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    11794:             <div class="titlepage">
                   11795:               <div>
                   11796:                 <div>
1.31      wiz      11797:                   <h3 class="title"><a name=
1.59    ! rillig   11798:                   "where-to-install-documentation" id=
1.38      dillo    11799:                   "where-to-install-documentation"></a>15.1.2.&nbsp;Where
1.31      wiz      11800:                   to install documentation</h3>
                   11801:                 </div>
                   11802:               </div>
                   11803:             </div>
                   11804: 
1.45      wiz      11805:             <p>Documentation should be installed into <code xmlns=
                   11806:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.31      wiz      11807:             "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
1.45      wiz      11808:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   11809:             class="filename">${PREFIX}/share/doc/${PKGNAME}</code>
                   11810:             (the latter includes the version number of the
                   11811:             package).</p>
1.31      wiz      11812:           </div>
                   11813: 
1.59    ! rillig   11814:           <div class="sect2" lang="en" xml:lang="en">
1.31      wiz      11815:             <div class="titlepage">
                   11816:               <div>
                   11817:                 <div>
1.59    ! rillig   11818:                   <h3 class="title"><a name="restricted-packages"
        !          11819:                   id=
1.38      dillo    11820:                   "restricted-packages"></a>15.1.3.&nbsp;Restricted
1.1       grant    11821:                   packages</h3>
                   11822:                 </div>
                   11823:               </div>
                   11824:             </div>
                   11825: 
                   11826:             <p>Some licenses restrict how software may be
                   11827:             re-distributed. In order to satisfy these restrictions,
                   11828:             the package system defines five make variables that can
                   11829:             be set to note these restrictions:</p>
                   11830: 
                   11831:             <div class="itemizedlist">
                   11832:               <ul type="disc">
                   11833:                 <li>
1.14      xtraeme  11834:                   <p><code class="varname">RESTRICTED</code></p>
1.1       grant    11835: 
                   11836:                   <p>This variable should be set whenever a
                   11837:                   restriction exists (regardless of its kind). Set
                   11838:                   this variable to a string containing the reason
                   11839:                   for the restriction.</p>
                   11840:                 </li>
                   11841: 
                   11842:                 <li>
1.14      xtraeme  11843:                   <p><code class=
                   11844:                   "varname">NO_BIN_ON_CDROM</code></p>
1.1       grant    11845: 
                   11846:                   <p>Binaries may not be placed on CD-ROM. Set this
1.14      xtraeme  11847:                   variable to <code class=
                   11848:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    11849:                   package may not be included on a CD-ROM.</p>
                   11850:                 </li>
                   11851: 
                   11852:                 <li>
1.14      xtraeme  11853:                   <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1       grant    11854: 
                   11855:                   <p>Binaries may not be placed on an FTP server.
1.14      xtraeme  11856:                   Set this variable to <code class=
                   11857:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    11858:                   package may not not be made available on the
                   11859:                   Internet.</p>
                   11860:                 </li>
                   11861: 
                   11862:                 <li>
1.14      xtraeme  11863:                   <p><code class=
                   11864:                   "varname">NO_SRC_ON_CDROM</code></p>
1.1       grant    11865: 
                   11866:                   <p>Distfiles may not be placed on CD-ROM. Set
1.14      xtraeme  11867:                   this variable to <code class=
                   11868:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    11869:                   of the source code or other distfile(s) is not
                   11870:                   allowed on CD-ROMs.</p>
                   11871:                 </li>
                   11872: 
                   11873:                 <li>
1.14      xtraeme  11874:                   <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1       grant    11875: 
                   11876:                   <p>Distfiles may not be placed on FTP. Set this
1.14      xtraeme  11877:                   variable to <code class=
                   11878:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    11879:                   of the source code or other distfile(s) via the
                   11880:                   Internet is not allowed.</p>
                   11881:                 </li>
                   11882:               </ul>
                   11883:             </div>
                   11884: 
1.14      xtraeme  11885:             <p>Please note that the use of <code class=
                   11886:             "varname">NO_PACKAGE</code>, <code class=
                   11887:             "varname">IGNORE</code>, <code class=
                   11888:             "varname">NO_CDROM</code>, or other generic make
1.1       grant    11889:             variables to denote restrictions is deprecated, because
                   11890:             they unconditionally prevent users from generating
                   11891:             binary packages!</p>
                   11892:           </div>
                   11893: 
1.59    ! rillig   11894:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    11895:             <div class="titlepage">
                   11896:               <div>
                   11897:                 <div>
1.59    ! rillig   11898:                   <h3 class="title"><a name="dependencies" id=
1.38      dillo    11899:                   "dependencies"></a>15.1.4.&nbsp;Handling
1.1       grant    11900:                   dependencies</h3>
                   11901:                 </div>
                   11902:               </div>
                   11903:             </div>
                   11904: 
                   11905:             <p>Your package may depend on some other package being
                   11906:             present - and there are various ways of expressing this
1.14      xtraeme  11907:             dependency. pkgsrc supports the <code class=
                   11908:             "varname">BUILD_DEPENDS</code> and <code class=
1.47      reed     11909:             "varname">DEPENDS</code> definitions, the <code class=
                   11910:             "varname">USE_TOOLS</code> definition, as well as
1.45      wiz      11911:             dependencies via <code xmlns=
                   11912:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11913:             "filename">buildlink3.mk</code>, which is the preferred
1.1       grant    11914:             way to handle dependencies, and which uses the
                   11915:             variables named above. See <a href="#buildlink" title=
1.38      dillo    11916:             "Chapter&nbsp;11.&nbsp;Buildlink methodology">Chapter&nbsp;11,
1.1       grant    11917:             <i>Buildlink methodology</i></a> for more
                   11918:             information.</p>
                   11919: 
                   11920:             <p>The basic difference between the two variables is as
1.14      xtraeme  11921:             follows: The <code class="varname">DEPENDS</code>
1.1       grant    11922:             definition registers that pre-requisite in the binary
                   11923:             package so it will be pulled in when the binary package
1.14      xtraeme  11924:             is later installed, whilst the <code class=
                   11925:             "varname">BUILD_DEPENDS</code> definition does not,
1.1       grant    11926:             marking a dependency that is only needed for building
                   11927:             the package.</p>
                   11928: 
                   11929:             <p>This means that if you only need a package present
                   11930:             whilst you are building, it should be noted as a
1.14      xtraeme  11931:             <code class="varname">BUILD_DEPENDS</code>.</p>
1.1       grant    11932: 
1.14      xtraeme  11933:             <p>The format for a <code class=
                   11934:             "varname">BUILD_DEPENDS</code> and a <code class=
                   11935:             "varname">DEPENDS</code> definition is:</p>
1.1       grant    11936:             <pre class="programlisting">
1.51      rillig   11937:     &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
1.1       grant    11938: </pre>
                   11939: 
                   11940:             <p>Please note that the &#8220;<span class=
                   11941:             "quote">pre-req-package-name</span>&#8221; may include
1.18      xtraeme  11942:             any of the wildcard version numbers recognized by
1.1       grant    11943:             <a href=
                   11944:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   11945:             <span class="citerefentry"><span class=
                   11946:             "refentrytitle">pkg_info</span>(1)</span></a>.</p>
                   11947: 
                   11948:             <div class="orderedlist">
                   11949:               <ol type="1">
                   11950:                 <li>
                   11951:                   <p>If your package needs another package's
                   11952:                   binaries or libraries to build or run, and if
1.45      wiz      11953:                   that package has a <code xmlns=
                   11954:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11955:                   "filename">buildlink3.mk</code> file available,
                   11956:                   use it:</p>
1.1       grant    11957:                   <pre class="programlisting">
                   11958:     .include "../../graphics/jpeg/buildlink3.mk"
                   11959: </pre>
                   11960:                 </li>
                   11961: 
                   11962:                 <li>
                   11963:                   <p>If your package needs to use another package
1.45      wiz      11964:                   to build itself and there is no <code xmlns=
                   11965:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11966:                   "filename">buildlink3.mk</code> file available,
                   11967:                   use the <code class=
                   11968:                   "varname">BUILD_DEPENDS</code> definition:</p>
1.1       grant    11969:                   <pre class="programlisting">
1.51      rillig   11970:     BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
1.1       grant    11971: </pre>
                   11972:                 </li>
                   11973: 
                   11974:                 <li>
                   11975:                   <p>If your package needs a library with which to
1.45      wiz      11976:                   link and again there is no <code xmlns=
                   11977:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11978:                   "filename">buildlink3.mk</code> file available,
                   11979:                   this is specified using the <code class=
                   11980:                   "varname">DEPENDS</code> definition. An example
                   11981:                   of this is the <a xmlns=
1.1       grant    11982:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   11983:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45      wiz      11984:                   target="_top"><code xmlns="" class=
                   11985:                   "filename">print/lyx</code></a> package, which
                   11986:                   uses the xpm library, version 3.4j to build:</p>
1.1       grant    11987:                   <pre class="programlisting">
1.51      rillig   11988:     DEPENDS+=       xpm-3.4j:../../graphics/xpm
1.1       grant    11989: </pre>
                   11990: 
                   11991:                   <p>You can also use wildcards in package
                   11992:                   dependences:</p>
                   11993:                   <pre class="programlisting">
1.51      rillig   11994:     DEPENDS+=       xpm-[0-9]*:../../graphics/xpm
1.1       grant    11995: </pre>
                   11996: 
                   11997:                   <p>Note that such wildcard dependencies are
                   11998:                   retained when creating binary packages. The
                   11999:                   dependency is checked when installing the binary
                   12000:                   package and any package which matches the pattern
                   12001:                   will be used. Wildcard dependencies should be
                   12002:                   used with care.</p>
                   12003: 
                   12004:                   <p>The &#8220;<span class=
                   12005:                   "quote">-[0-9]*</span>&#8221; should be used
                   12006:                   instead of &#8220;<span class=
                   12007:                   "quote">-*</span>&#8221; to avoid potentially
                   12008:                   ambiguous matches such as &#8220;<span class=
                   12009:                   "quote">tk-postgresql</span>&#8221; matching a
                   12010:                   &#8220;<span class="quote">tk-*</span>&#8221;
1.14      xtraeme  12011:                   <code class="varname">DEPENDS</code>.</p>
1.1       grant    12012: 
                   12013:                   <p>Wildcards can also be used to specify that a
                   12014:                   package will only build against a certain minimum
                   12015:                   version of a pre-requisite:</p>
                   12016:                   <pre class="programlisting">
1.51      rillig   12017:     DEPENDS+=       tiff&gt;=3.5.4:../../graphics/tiff
1.1       grant    12018: </pre>
                   12019: 
                   12020:                   <p>This means that the package will build against
                   12021:                   version 3.5.4 of the tiff library or newer. Such
                   12022:                   a dependency may be warranted if, for example,
                   12023:                   the API of the library has changed with version
                   12024:                   3.5.4 and a package would not compile against an
                   12025:                   earlier version of tiff.</p>
                   12026: 
                   12027:                   <p>Please note that such dependencies should only
                   12028:                   be updated if a package requires a newer
                   12029:                   pre-requisite, but not to denote recommendations
                   12030:                   such as security updates or ABI changes that do
                   12031:                   not prevent a package from building correctly.
                   12032:                   Such recommendations can be expressed using
1.14      xtraeme  12033:                   <code class="varname">RECOMMENDED</code>:</p>
1.1       grant    12034:                   <pre class="programlisting">
1.51      rillig   12035:     RECOMMENDED+=   tiff&gt;=3.6.1:../../graphics/tiff
1.1       grant    12036: </pre>
                   12037: 
1.14      xtraeme  12038:                   <p>In addition to the above <code class=
                   12039:                   "varname">DEPENDS</code> line, this denotes that
1.1       grant    12040:                   while a package will build against
                   12041:                   tiff&gt;=3.5.4, at least version 3.6.1 is
1.14      xtraeme  12042:                   recommended. <code class=
                   12043:                   "varname">RECOMMENDED</code> entries will be
                   12044:                   turned into dependencies unless explicitly
                   12045:                   ignored (in which case a warning will be
1.36      wiz      12046:                   printed).</p>
                   12047: 
                   12048:                   <p>To ignore these dependency recommendations and
                   12049:                   just use the required <code class=
                   12050:                   "varname">DEPENDS</code>, set <code class=
                   12051:                   "varname">IGNORE_RECOMMENDED=YES</code>. This may
                   12052:                   make it easier and faster to update packages
                   12053:                   built using pkgsrc, since older compatible
                   12054:                   dependencies can continue to be used. This is
                   12055:                   useful for people who watch their rebuilds very
                   12056:                   carefully; it is not very good as a
                   12057:                   general-purpose hammer. If you use it, you need
                   12058:                   to be mindful of possible ABI changes, including
                   12059:                   those from the underlying OS.</p>
                   12060: 
                   12061:                   <p>Packages that are built with recommendations
                   12062:                   ignored may not be uploaded to ftp.NetBSD.org by
                   12063:                   developers and should not be used across
                   12064:                   different systems that may have different
                   12065:                   versions of binary packages installed.</p>
1.1       grant    12066: 
                   12067:                   <p>For security fixes, please update the package
                   12068:                   vulnerabilities file as well as setting
1.14      xtraeme  12069:                   <code class="varname">RECOMMENDED</code>, see
1.1       grant    12070:                   <a href="#security-handling" title=
1.38      dillo    12071:                   "15.1.8.&nbsp;Handling packages with security problems">
1.59    ! rillig   12072:                   Section 15.1.8, &#8220;Handling packages with
        !          12073:                   security problems&#8221;</a> for more
1.1       grant    12074:                   information.</p>
                   12075:                 </li>
                   12076: 
                   12077:                 <li>
                   12078:                   <p>If your package needs some executable to be
1.17      sketch   12079:                   able to run correctly and if there's no
1.45      wiz      12080:                   <code xmlns=
                   12081:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12082:                   "filename">buildlink3.mk</code> file, this is
                   12083:                   specified using the <code class=
1.14      xtraeme  12084:                   "varname">DEPENDS</code> variable. The <a xmlns=
1.1       grant    12085:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   12086:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45      wiz      12087:                   target="_top"><code xmlns="" class=
                   12088:                   "filename">print/lyx</code></a> package needs to
                   12089:                   be able to execute the latex binary from the
                   12090:                   teTeX package when it runs, and that is
                   12091:                   specified:</p>
1.1       grant    12092:                   <pre class="programlisting">
1.51      rillig   12093:     DEPENDS+=        teTeX-[0-9]*:../../print/teTeX
1.1       grant    12094: </pre>
                   12095: 
                   12096:                   <p>The comment about wildcard dependencies from
                   12097:                   previous paragraph applies here, too.</p>
                   12098:                 </li>
                   12099:               </ol>
                   12100:             </div>
                   12101: 
                   12102:             <p>If your package needs files from another package to
                   12103:             build, see the first part of the &#8220;<span class=
                   12104:             "quote">do-configure</span>&#8221; target <a xmlns=
                   12105:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12106:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.45      wiz      12107:             target="_top"><code xmlns="" class=
                   12108:             "filename">print/ghostscript5</code></a> package (it
1.20      ben      12109:             relies on the jpeg sources being present in source form
                   12110:             during the build):</p>
1.1       grant    12111:             <pre class="programlisting">
1.51      rillig   12112:     if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then    \
                   12113:         cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} extract; \
1.1       grant    12114:     fi
                   12115: </pre>
                   12116: 
                   12117:             <p>If you build any other packages that way, please
                   12118:             make sure the working files are deleted too when this
                   12119:             package's working files are cleaned up. The easiest way
                   12120:             to do so is by adding a pre-clean target:</p>
                   12121:             <pre class="programlisting">
1.51      rillig   12122:     pre-clean:
                   12123:             cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} clean
1.1       grant    12124: </pre>
                   12125: 
1.14      xtraeme  12126:             <p>Please also note the <code class=
                   12127:             "varname">BUILD_USES_MSGFMT</code> and <code class=
                   12128:             "varname">BUILD_USES_GETTEXT_M4</code> definitions,
                   12129:             which are provided as convenience definitions. The
1.24      wiz      12130:             former works out whether <a href=
                   12131:             "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
                   12132:             <span class="citerefentry"><span class=
                   12133:             "refentrytitle">msgfmt</span>(1)</span></a> is part of
                   12134:             the base system, and, if it isn't, installs the
                   12135:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12136:             href=
1.1       grant    12137:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.45      wiz      12138:             target="_top"><code xmlns="" class=
                   12139:             "filename">devel/gettext</code></a> package. The latter
1.20      ben      12140:             adds a build dependency on either an installed version
                   12141:             of an older gettext package, or if it isn't, installs
                   12142:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12143:             href=
                   12144:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
1.45      wiz      12145:             target="_top"><code xmlns="" class=
                   12146:             "filename">devel/gettext-m4</code></a> package.</p>
1.1       grant    12147:           </div>
                   12148: 
1.59    ! rillig   12149:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    12150:             <div class="titlepage">
                   12151:               <div>
                   12152:                 <div>
1.59    ! rillig   12153:                   <h3 class="title"><a name="conflicts" id=
1.38      dillo    12154:                   "conflicts"></a>15.1.5.&nbsp;Handling conflicts
1.1       grant    12155:                   with other packages</h3>
                   12156:                 </div>
                   12157:               </div>
                   12158:             </div>
                   12159: 
                   12160:             <p>Your package may conflict with other packages a user
                   12161:             might already have installed on his system, e.g. if
                   12162:             your package installs the same set of files like
                   12163:             another package in our pkgsrc tree.</p>
                   12164: 
1.14      xtraeme  12165:             <p>In this case you can set <code class=
1.47      reed     12166:             "varname">CONFLICTS</code> to a space-separated list of
1.1       grant    12167:             packages (including version string) your package
                   12168:             conflicts with.</p>
                   12169: 
1.47      reed     12170:             <p>For example, <a xmlns=
1.1       grant    12171:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12172:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.45      wiz      12173:             target="_top"><code xmlns="" class=
                   12174:             "filename">x11/Xaw3d</code></a> and <a xmlns=
1.20      ben      12175:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12176:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
1.45      wiz      12177:             target="_top"><code xmlns="" class=
1.47      reed     12178:             "filename">x11/Xaw-Xpm</code></a> install the same
                   12179:             shared library, thus you set in <code xmlns=
1.45      wiz      12180:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      12181:             "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1       grant    12182:             <pre class="programlisting">
1.51      rillig   12183:     CONFLICTS=      Xaw-Xpm-[0-9]*
1.1       grant    12184: </pre>
                   12185: 
1.45      wiz      12186:             <p>and in <code xmlns=
                   12187:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12188:             "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1       grant    12189:             <pre class="programlisting">
1.51      rillig   12190:     CONFLICTS=      Xaw3d-[0-9]*
1.1       grant    12191: </pre>
                   12192: 
                   12193:             <p>Packages will automatically conflict with other
                   12194:             packages with the name prefix and a different version
                   12195:             string. &#8220;<span class=
                   12196:             "quote">Xaw3d-1.5</span>&#8221; e.g. will automatically
                   12197:             conflict with the older version &#8220;<span class=
                   12198:             "quote">Xaw3d-1.3</span>&#8221;.</p>
                   12199:           </div>
                   12200: 
1.59    ! rillig   12201:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    12202:             <div class="titlepage">
                   12203:               <div>
                   12204:                 <div>
1.59    ! rillig   12205:                   <h3 class="title"><a name="not-building-packages"
        !          12206:                   id=
1.38      dillo    12207:                   "not-building-packages"></a>15.1.6.&nbsp;Packages
1.30      wiz      12208:                   that cannot or should not be built</h3>
1.1       grant    12209:                 </div>
                   12210:               </div>
                   12211:             </div>
                   12212: 
                   12213:             <p>There are several reasons why a package might be
                   12214:             instructed to not build under certain circumstances. If
                   12215:             the package builds and runs on most platforms, the
1.14      xtraeme  12216:             exceptions should be noted with <code class=
                   12217:             "varname">NOT_FOR_PLATFORM</code>. If the package
                   12218:             builds and runs on a small handful of platforms, set
                   12219:             <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.45      wiz      12220:             Both <code class="varname">ONLY_FOR_PLATFORM</code> and
                   12221:             <code class="varname">NOT_FOR_PLATFORM</code> are OS
                   12222:             triples (OS-version-platform) that can use glob-style
                   12223:             wildcards.</p>
                   12224: 
                   12225:             <p>If the package should be skipped (for example,
                   12226:             because it provides functionality already provided by
                   12227:             the system), set <code class=
1.14      xtraeme  12228:             "varname">PKG_SKIP_REASON</code> to a descriptive
                   12229:             message. If the package should fail because some
                   12230:             preconditions are not met, set <code class=
                   12231:             "varname">PKG_FAIL_REASON</code> to a descriptive
1.1       grant    12232:             message.</p>
                   12233:           </div>
                   12234: 
1.59    ! rillig   12235:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    12236:             <div class="titlepage">
                   12237:               <div>
                   12238:                 <div>
1.59    ! rillig   12239:                   <h3 class="title"><a name="undeletable-packages"
        !          12240:                   id=
1.38      dillo    12241:                   "undeletable-packages"></a>15.1.7.&nbsp;Packages
1.30      wiz      12242:                   which should not be deleted, once installed</h3>
1.1       grant    12243:                 </div>
                   12244:               </div>
                   12245:             </div>
                   12246: 
                   12247:             <p>To ensure that a package may not be deleted, once it
1.14      xtraeme  12248:             has been installed, the <code class=
                   12249:             "varname">PKG_PRESERVE</code> definition should be set
                   12250:             in the package Makefile. This will be carried into any
1.1       grant    12251:             binary package that is made from this pkgsrc entry. A
                   12252:             &#8220;<span class="quote">preserved</span>&#8221;
                   12253:             package will not be deleted using <a href=
                   12254:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   12255:             <span class="citerefentry"><span class=
                   12256:             "refentrytitle">pkg_delete</span>(1)</span></a> unless
                   12257:             the &#8220;<span class="quote">-f</span>&#8221; option
                   12258:             is used.</p>
                   12259:           </div>
                   12260: 
1.59    ! rillig   12261:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    12262:             <div class="titlepage">
                   12263:               <div>
                   12264:                 <div>
1.59    ! rillig   12265:                   <h3 class="title"><a name="security-handling" id=
1.38      dillo    12266:                   "security-handling"></a>15.1.8.&nbsp;Handling
1.1       grant    12267:                   packages with security problems</h3>
                   12268:                 </div>
                   12269:               </div>
                   12270:             </div>
                   12271: 
                   12272:             <p>When a vulnerability is found, this should be noted
1.45      wiz      12273:             in <code xmlns=
                   12274:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12275:             "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.43      wiz      12276:             and after committing that file, use
                   12277:             <span><strong class="command">make
                   12278:             upload</strong></span> in the same directory to update
                   12279:             the file on ftp.NetBSD.org.</p>
                   12280: 
                   12281:             <p>After fixing the vulnerability by a patch, its
                   12282:             <code class="varname">PKGREVISION</code> should be
                   12283:             increased (this is of course not necessary if the
                   12284:             problem is fixed by using a newer release of the
1.45      wiz      12285:             software). In addition, if a <code xmlns=
                   12286:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12287:             "filename">buildlink3.mk</code> file exists for an
1.43      wiz      12288:             affected package, a corresponding <code class=
1.14      xtraeme  12289:             "varname">BUILDLINK_RECOMMENDED.<em class=
                   12290:             "replaceable"><code>pkg</code></em></code> entry should
1.43      wiz      12291:             be added or updated in it.</p>
1.1       grant    12292: 
                   12293:             <p>Also, if the fix should be applied to the stable
                   12294:             pkgsrc branch, be sure to submit a pullup request!</p>
1.43      wiz      12295: 
                   12296:             <p>Binary packages already on ftp.NetBSD.org will be
                   12297:             handled semi-automatically by a weekly cron job.</p>
1.1       grant    12298:           </div>
                   12299: 
1.59    ! rillig   12300:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    12301:             <div class="titlepage">
                   12302:               <div>
                   12303:                 <div>
1.59    ! rillig   12304:                   <h3 class="title"><a name="compiler-bugs" id=
1.38      dillo    12305:                   "compiler-bugs"></a>15.1.9.&nbsp;How to handle
1.1       grant    12306:                   compiler bugs</h3>
                   12307:                 </div>
                   12308:               </div>
                   12309:             </div>
                   12310: 
                   12311:             <p>Some source files trigger bugs in the compiler,
                   12312:             based on combinations of compiler version and
                   12313:             architecture and almost always relation to optimisation
                   12314:             being enabled. Common symptoms are gcc internal errors
                   12315:             or never finishing compiling a file.</p>
                   12316: 
1.47      reed     12317:             <p>Typically, a workaround involves testing the
1.14      xtraeme  12318:             <code class="varname">MACHINE_ARCH</code> and compiler
1.1       grant    12319:             version, disabling optimisation for that
1.14      xtraeme  12320:             file/<code class="varname">MACHINE_ARCH</code>/compiler
1.45      wiz      12321:             combination, and documenting it in <code xmlns=
                   12322:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12323:             "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1       grant    12324:             number of examples!</p>
                   12325:           </div>
                   12326: 
1.59    ! rillig   12327:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    12328:             <div class="titlepage">
                   12329:               <div>
                   12330:                 <div>
1.59    ! rillig   12331:                   <h3 class="title"><a name="bumping-pkgrevision"
        !          12332:                   id="bumping-pkgrevision"></a>15.1.10.&nbsp;How to
1.30      wiz      12333:                   handle incrementing versions when fixing an
                   12334:                   existing package</h3>
1.1       grant    12335:                 </div>
                   12336:               </div>
                   12337:             </div>
                   12338: 
                   12339:             <p>When making fixes to an existing package it can be
1.14      xtraeme  12340:             useful to change the version number in <code class=
                   12341:             "varname">PKGNAME</code>. To avoid conflicting with
1.1       grant    12342:             future versions by the original author, a
                   12343:             &#8220;<span class="quote">nb1</span>&#8221;,
                   12344:             &#8220;<span class="quote">nb2</span>&#8221;, ...
                   12345:             suffix can be used on package versions by setting
1.14      xtraeme  12346:             <code class="varname">PKGREVISION=1</code> (2, ...).
                   12347:             The &#8220;<span class="quote">nb</span>&#8221; is
                   12348:             treated like a &#8220;<span class=
                   12349:             "quote">.</span>&#8221; by the pkg tools. e.g.</p>
1.1       grant    12350:             <pre class="programlisting">
1.51      rillig   12351:     DISTNAME=       foo-17.42
                   12352:     PKGREVISION=    9
1.1       grant    12353: </pre>
                   12354: 
1.14      xtraeme  12355:             <p>will result in a <code class=
                   12356:             "varname">PKGNAME</code> of &#8220;<span class=
1.1       grant    12357:             "quote">foo-17.42nb9</span>&#8221;.</p>
                   12358: 
                   12359:             <p>When a new release of the package is released, the
1.14      xtraeme  12360:             <code class="varname">PKGREVISION</code> should be
1.47      reed     12361:             removed, e.g. on a new minor release of the above
1.14      xtraeme  12362:             package, things should be like:</p>
1.1       grant    12363:             <pre class="programlisting">
1.51      rillig   12364:     DISTNAME=       foo-17.43
1.1       grant    12365: </pre>
                   12366:           </div>
                   12367: 
1.59    ! rillig   12368:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    12369:             <div class="titlepage">
                   12370:               <div>
                   12371:                 <div>
1.30      wiz      12372:                   <h3 class="title"><a name=
1.59    ! rillig   12373:                   "portability-of-packages" id=
1.38      dillo    12374:                   "portability-of-packages"></a>15.1.11.&nbsp;Portability
1.30      wiz      12375:                   of packages</h3>
1.1       grant    12376:                 </div>
                   12377:               </div>
                   12378:             </div>
                   12379: 
                   12380:             <p>One appealing feature of pkgsrc is that it runs on
                   12381:             many different platforms. As a result, it is important
                   12382:             to ensure, where possible, that packages in pkgsrc are
                   12383:             portable. There are some particular details you should
                   12384:             pay attention to while working on pkgsrc.</p>
                   12385: 
1.59    ! rillig   12386:             <div class="sect3" lang="en" xml:lang="en">
1.1       grant    12387:               <div class="titlepage">
                   12388:                 <div>
                   12389:                   <div>
1.59    ! rillig   12390:                     <h4 class="title"><a name="install-scripts" id=
1.38      dillo    12391:                     "install-scripts"></a>15.1.11.1.&nbsp;${INSTALL},
1.1       grant    12392:                     ${INSTALL_DATA_DIR}, ...</h4>
                   12393:                   </div>
                   12394:                 </div>
                   12395:               </div>
                   12396: 
1.14      xtraeme  12397:               <p>The BSD-compatible <span><strong class=
                   12398:               "command">install</strong></span> supplied with some
1.1       grant    12399:               operating systems will not perform more than one
                   12400:               operation at a time. As such, you should call
                   12401:               &#8220;<span class="quote">${INSTALL}</span>&#8221;,
                   12402:               etc. like this:</p>
                   12403:               <pre class="programlisting">
1.51      rillig   12404:     ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   12405:     ${INSTALL_DATA_DIR} ${PREFIX}/dir2
1.1       grant    12406: </pre>
                   12407:             </div>
                   12408:           </div>
                   12409:         </div>
                   12410: 
1.59    ! rillig   12411:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    12412:           <div class="titlepage">
                   12413:             <div>
                   12414:               <div>
                   12415:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   12416:                 "downloading-issues" id=
1.38      dillo    12417:                 "downloading-issues"></a>15.2.&nbsp;Possible
1.1       grant    12418:                 downloading issues</h2>
                   12419:               </div>
                   12420:             </div>
                   12421:           </div>
                   12422: 
1.59    ! rillig   12423:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    12424:             <div class="titlepage">
                   12425:               <div>
                   12426:                 <div>
1.59    ! rillig   12427:                   <h3 class="title"><a name="no-plain-download" id=
1.38      dillo    12428:                   "no-plain-download"></a>15.2.1.&nbsp;Packages
1.30      wiz      12429:                   whose distfiles aren't available for plain
1.1       grant    12430:                   downloading</h3>
                   12431:                 </div>
                   12432:               </div>
                   12433:             </div>
                   12434: 
                   12435:             <p>If you need to download from a dynamic URL you can
1.14      xtraeme  12436:             set <code class="varname">DYNAMIC_MASTER_SITES</code>
                   12437:             and a <span><strong class="command">make
1.45      wiz      12438:             fetch</strong></span> will call <code xmlns=
                   12439:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12440:             "filename">files/getsite.sh</code> with the name of
                   12441:             each file to download as an argument, expecting it to
                   12442:             output the URL of the directory from which to download
                   12443:             it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12444:             href=
1.1       grant    12445:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.45      wiz      12446:             target="_top"><code xmlns="" class=
                   12447:             "filename">graphics/ns-cult3d</code></a> is an example
                   12448:             of this usage.</p>
1.1       grant    12449: 
                   12450:             <p>If the download can't be automated, because the user
                   12451:             must submit personal information to apply for a
                   12452:             password, or must pay for the source, or whatever, you
1.14      xtraeme  12453:             can set <code class="varname">_FETCH_MESSAGE</code> to
                   12454:             a macro which displays a message explaining the
                   12455:             situation. <code class="varname">_FETCH_MESSAGE</code>
                   12456:             must be executable shell commands, not just a message.
                   12457:             (Generally, it executes <code class=
                   12458:             "varname">${ECHO}</code>). As of this writing, the
1.1       grant    12459:             following packages use this: <a xmlns=
                   12460:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.20      ben      12461:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
1.45      wiz      12462:             target="_top"><code xmlns="" class=
                   12463:             "filename">cad/simian</code></a>, <a xmlns=
1.20      ben      12464:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12465:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
1.45      wiz      12466:             target="_top"><code xmlns="" class=
                   12467:             "filename">devel/ipv6socket</code></a>, <a xmlns=
1.20      ben      12468:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12469:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
1.45      wiz      12470:             target="_top"><code xmlns="" class=
                   12471:             "filename">emulators/vmware-module</code></a>,
                   12472:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12473:             href=
1.20      ben      12474:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
1.45      wiz      12475:             target="_top"><code xmlns="" class=
                   12476:             "filename">fonts/acroread-jpnfont</code></a>, <a xmlns=
1.20      ben      12477:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.43      wiz      12478:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/multimedia/realplayer/README.html"
1.45      wiz      12479:             target="_top"><code xmlns="" class=
                   12480:             "filename">multimedia/realplayer</code></a>, <a xmlns=
1.43      wiz      12481:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.20      ben      12482:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
1.45      wiz      12483:             target="_top"><code xmlns="" class=
                   12484:             "filename">sysutils/storage-manager</code></a>,
                   12485:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12486:             href=
1.20      ben      12487:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
1.45      wiz      12488:             target="_top"><code xmlns="" class=
                   12489:             "filename">www/ap-aolserver</code></a>, <a xmlns=
1.20      ben      12490:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12491:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
1.45      wiz      12492:             target="_top"><code xmlns="" class=
                   12493:             "filename">www/openacs</code></a>. Try to be consistent
1.20      ben      12494:             with them.</p>
1.1       grant    12495:           </div>
                   12496: 
1.59    ! rillig   12497:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    12498:             <div class="titlepage">
                   12499:               <div>
                   12500:                 <div>
1.30      wiz      12501:                   <h3 class="title"><a name=
1.59    ! rillig   12502:                   "modified-distfiles-same-name" id=
1.38      dillo    12503:                   "modified-distfiles-same-name"></a>15.2.2.&nbsp;How
1.30      wiz      12504:                   to handle modified distfiles with the 'old'
                   12505:                   name</h3>
1.1       grant    12506:                 </div>
                   12507:               </div>
                   12508:             </div>
                   12509: 
                   12510:             <p>Sometimes authors of a software package make some
                   12511:             modifications after the software was released, and they
                   12512:             put up a new distfile without changing the package's
                   12513:             version number. If a package is already in pkgsrc at
1.32      wiz      12514:             that time, the checksum will no longer match. The
                   12515:             contents of the new distfile should be compared against
                   12516:             the old one before changing anything, to make sure the
                   12517:             distfile was really updated on purpose, and that no
                   12518:             trojan horse or so crept in. Then, the correct way to
                   12519:             work around this is to set <code class=
                   12520:             "varname">DIST_SUBDIR</code> to a unique directory
                   12521:             name, usually based on <code class=
                   12522:             "varname">PKGNAME_NOREV</code>. In case this happens
                   12523:             more often, <code class="varname">PKGNAME</code> can be
1.45      wiz      12524:             used (thus including the <code xmlns=
                   12525:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.32      wiz      12526:             "filename">nbX</code> suffix) or a date stamp can be
                   12527:             appended, like <code class=
                   12528:             "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
1.45      wiz      12529:             forget regenerating the <code xmlns=
                   12530:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.32      wiz      12531:             "filename">distinfo</code> file after that, since it
                   12532:             contains the <code class="varname">DIST_SUBDIR</code>
                   12533:             path in the filenames. Furthermore, a mail to the
                   12534:             package's authors seems appropriate telling them that
                   12535:             changing distfiles after releases without changing the
                   12536:             file names is not good practice.</p>
1.1       grant    12537:           </div>
                   12538:         </div>
                   12539: 
1.59    ! rillig   12540:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    12541:           <div class="titlepage">
                   12542:             <div>
                   12543:               <div>
                   12544:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   12545:                 "configuration-gotchas" id=
1.38      dillo    12546:                 "configuration-gotchas"></a>15.3.&nbsp;Configuration
1.1       grant    12547:                 gotchas</h2>
                   12548:               </div>
                   12549:             </div>
                   12550:           </div>
                   12551: 
1.59    ! rillig   12552:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    12553:             <div class="titlepage">
                   12554:               <div>
                   12555:                 <div>
1.59    ! rillig   12556:                   <h3 class="title"><a name="fixes.libtool" id=
1.38      dillo    12557:                   "fixes.libtool"></a>15.3.1.&nbsp;Shared libraries
1.1       grant    12558:                   - libtool</h3>
                   12559:                 </div>
                   12560:               </div>
                   12561:             </div>
                   12562: 
                   12563:             <p>pkgsrc supports many different machines, with
                   12564:             different object formats like a.out and ELF, and
                   12565:             varying abilities to do shared library and dynamic
                   12566:             loading at all. To accompany this, varying commands and
                   12567:             options have to be passed to the compiler, linker, etc.
                   12568:             to get the Right Thing, which can be pretty annoying
                   12569:             especially if you don't have all the machines at your
                   12570:             hand to test things. The <a xmlns=
                   12571:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12572:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.45      wiz      12573:             target="_top"><code xmlns="" class=
                   12574:             "filename">devel/libtool</code></a> pkg can help here,
                   12575:             as it just &#8220;<span class=
                   12576:             "quote">knows</span>&#8221; how to build both static
                   12577:             and dynamic libraries from a set of source files, thus
1.47      reed     12578:             being platform-independent.</p>
1.1       grant    12579: 
                   12580:             <p>Here's how to use libtool in a pkg in seven simple
                   12581:             steps:</p>
                   12582: 
                   12583:             <div class="orderedlist">
                   12584:               <ol type="1">
                   12585:                 <li>
1.14      xtraeme  12586:                   <p>Add <code class=
                   12587:                   "varname">USE_LIBTOOL=yes</code> to the package
                   12588:                   Makefile.</p>
1.1       grant    12589:                 </li>
                   12590: 
                   12591:                 <li>
                   12592:                   <p>For library objects, use &#8220;<span class=
                   12593:                   "quote">${LIBTOOL} --mode=compile
                   12594:                   ${CC}</span>&#8221; in place of
                   12595:                   &#8220;<span class="quote">${CC}</span>&#8221;.
                   12596:                   You could even add it to the definition of
1.14      xtraeme  12597:                   <code class="varname">CC</code>, if only
                   12598:                   libraries are being built in a given Makefile.
                   12599:                   This one command will build both PIC and non-PIC
                   12600:                   library objects, so you need not have separate
                   12601:                   shared and non-shared library rules.</p>
1.1       grant    12602:                 </li>
                   12603: 
                   12604:                 <li>
                   12605:                   <p>For the linking of the library, remove any
                   12606:                   &#8220;<span class="quote">ar</span>&#8221;,
                   12607:                   &#8220;<span class="quote">ranlib</span>&#8221;,
                   12608:                   and &#8220;<span class="quote">ld
                   12609:                   -Bshareable</span>&#8221; commands, and instead
                   12610:                   use:</p>
                   12611:                   <pre class="programlisting">
1.51      rillig   12612:     ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} \
                   12613:         -rpath ${PREFIX}/lib -version-info major:minor
1.1       grant    12614: </pre>
                   12615: 
                   12616:                   <p>Note that the library is changed to have a
1.45      wiz      12617:                   <code xmlns=
                   12618:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12619:                   "filename">.la</code> extension, and the objects
                   12620:                   are changed to have a <code xmlns=
                   12621:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12622:                   "filename">.lo</code> extension. Change
                   12623:                   <code class="varname">OBJS</code> as necessary.
                   12624:                   This automatically creates all of the
1.45      wiz      12625:                   <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12626:                   class="filename">.a</code>, <code xmlns=
                   12627:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12628:                   "filename">.so.major.minor</code>, and ELF
                   12629:                   symlinks (if necessary) in the build directory.
                   12630:                   Be sure to include &#8220;<span class=
1.1       grant    12631:                   "quote">-version-info</span>&#8221;, especially
                   12632:                   when major and minor are zero, as libtool will
                   12633:                   otherwise strip off the shared library
                   12634:                   version.</p>
                   12635: 
                   12636:                   <p>From the libtool manual:</p>
                   12637:                   <pre class="programlisting">
1.51      rillig   12638:     So, libtool library versions are described by three integers:
1.1       grant    12639: 
1.51      rillig   12640:     CURRENT
                   12641:         The most recent interface number that this library implements.
1.1       grant    12642: 
1.51      rillig   12643:     REVISION
                   12644:         The implementation number of the CURRENT interface.
1.1       grant    12645: 
1.51      rillig   12646:     AGE
                   12647:         The difference between the newest and oldest interfaces that
                   12648:         this library implements.  In other words, the library implements
                   12649:         all the interface numbers in the range from number `CURRENT -
                   12650:         AGE' to `CURRENT'.
1.1       grant    12651:        
1.51      rillig   12652:     If two libraries have identical CURRENT and AGE numbers, then the
                   12653:     dynamic linker chooses the library with the greater REVISION number.
1.1       grant    12654: </pre>
                   12655: 
                   12656:                   <p>The &#8220;<span class=
                   12657:                   "quote">-release</span>&#8221; option will
                   12658:                   produce different results for a.out and ELF
                   12659:                   (excluding symlinks) in only one case. An ELF
                   12660:                   library of the form &#8220;<span class=
                   12661:                   "quote">libfoo-release.so.<span class=
                   12662:                   "emphasis"><em>x</em></span>.<span class=
                   12663:                   "emphasis"><em>y</em></span></span>&#8221; will
                   12664:                   have a symlink of &#8220;<span class=
                   12665:                   "quote">libfoo.so.<span class=
                   12666:                   "emphasis"><em>x</em></span>.<span class=
                   12667:                   "emphasis"><em>y</em></span></span>&#8221; on an
                   12668:                   a.out platform. This is handled
                   12669:                   automatically.</p>
                   12670: 
                   12671:                   <p>The &#8220;<span class="quote">-rpath
                   12672:                   argument</span>&#8221; is the install directory
                   12673:                   of the library being built.</p>
                   12674: 
1.45      wiz      12675:                   <p>In the <code xmlns=
                   12676:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12677:                   "filename">PLIST</code>, include only the
                   12678:                   <code xmlns=
                   12679:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.19      hubertf  12680:                   "filename">.la</code> file, the other files will
                   12681:                   be added automatically.</p>
1.1       grant    12682:                 </li>
                   12683: 
                   12684:                 <li>
1.45      wiz      12685:                   <p>When linking shared object (<code xmlns=
                   12686:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12687:                   "filename">.so</code>) files, i.e. files that are
1.24      wiz      12688:                   loaded via <a href=
                   12689:                   "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
                   12690:                   <span class="citerefentry"><span class=
                   12691:                   "refentrytitle">dlopen</span>(3)</span></a>, NOT
                   12692:                   shared libraries, use &#8220;<span class=
                   12693:                   "quote">-module -avoid-version</span>&#8221; to
                   12694:                   prevent them getting version tacked on.</p>
1.1       grant    12695: 
1.45      wiz      12696:                   <p>The <code xmlns=
                   12697:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12698:                   "filename">PLIST</code> file gets the
                   12699:                   <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12700:                   class="filename">foo.so</code> entry.</p>
1.1       grant    12701:                 </li>
                   12702: 
                   12703:                 <li>
                   12704:                   <p>When linking programs that depend on these
                   12705:                   libraries <span class=
                   12706:                   "emphasis"><em>before</em></span> they are
                   12707:                   installed, preface the <a href=
                   12708:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
                   12709:                   <span class="citerefentry"><span class=
                   12710:                   "refentrytitle">cc</span>(1)</span></a> or
                   12711:                   <a href=
                   12712:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   12713:                   <span class="citerefentry"><span class=
                   12714:                   "refentrytitle">ld</span>(1)</span></a> line with
                   12715:                   &#8220;<span class="quote">${LIBTOOL}
                   12716:                   --mode=link</span>&#8221;, and it will find the
                   12717:                   correct libraries (static or shared), but please
                   12718:                   be aware that libtool will not allow you to
                   12719:                   specify a relative path in -L (such as
                   12720:                   &#8220;<span class=
                   12721:                   "quote">-L../somelib</span>&#8221;), because it
                   12722:                   expects you to change that argument to be the
1.45      wiz      12723:                   <code xmlns=
                   12724:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12725:                   "filename">.la</code> file. e.g.</p>
1.1       grant    12726:                   <pre class="programlisting">
1.51      rillig   12727:     ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
1.1       grant    12728: </pre>
                   12729: 
                   12730:                   <p>should be changed to:</p>
                   12731:                   <pre class="programlisting">
1.51      rillig   12732:     ${LIBTOOL} --mode=link ${CC} -o <em class=
1.14      xtraeme  12733: "replaceable"><code>someprog</code></em> <em class=
                   12734: "replaceable"><code>../somelib/somelib.la</code></em>
1.1       grant    12735: </pre>
                   12736: 
                   12737:                   <p>and it will do the right thing with the
                   12738:                   libraries.</p>
                   12739:                 </li>
                   12740: 
                   12741:                 <li>
                   12742:                   <p>When installing libraries, preface the
                   12743:                   <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   12744:                   <span class="citerefentry"><span class=
                   12745:                   "refentrytitle">install</span>(1)</span></a> or
                   12746:                   <a href=
                   12747:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
                   12748:                   <span class="citerefentry"><span class=
                   12749:                   "refentrytitle">cp</span>(1)</span></a> command
                   12750:                   with &#8220;<span class="quote">${LIBTOOL}
                   12751:                   --mode=install</span>&#8221;, and change the
1.45      wiz      12752:                   library name to <code xmlns=
                   12753:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12754:                   "filename">.la</code>. e.g.</p>
1.1       grant    12755:                   <pre class="programlisting">
1.51      rillig   12756:     ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1       grant    12757: </pre>
                   12758: 
1.45      wiz      12759:                   <p>This will install the static <code xmlns=
                   12760:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12761:                   "filename">.a</code>, shared library, any needed
1.1       grant    12762:                   symlinks, and run <a href=
                   12763:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
                   12764:                   <span class="citerefentry"><span class=
                   12765:                   "refentrytitle">ldconfig</span>(8)</span></a>.</p>
                   12766:                 </li>
                   12767: 
                   12768:                 <li>
1.45      wiz      12769:                   <p>In your <code xmlns=
                   12770:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12771:                   "filename">PLIST</code>, include only the
                   12772:                   <code xmlns=
                   12773:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.23      wiz      12774:                   "filename">.la</code> file (this is a change from
                   12775:                   previous behaviour).</p>
1.1       grant    12776:                 </li>
                   12777:               </ol>
                   12778:             </div>
                   12779:           </div>
                   12780: 
1.59    ! rillig   12781:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    12782:             <div class="titlepage">
                   12783:               <div>
                   12784:                 <div>
1.59    ! rillig   12785:                   <h3 class="title"><a name="using-libtool" id=
1.38      dillo    12786:                   "using-libtool"></a>15.3.2.&nbsp;Using libtool on
1.30      wiz      12787:                   GNU packages that already support libtool</h3>
1.1       grant    12788:                 </div>
                   12789:               </div>
                   12790:             </div>
                   12791: 
1.14      xtraeme  12792:             <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
                   12793:             the package Makefile. This will override the package's
                   12794:             own libtool in most cases. For older libtool using
1.1       grant    12795:             packages, libtool is made by ltconfig script during the
                   12796:             do-configure step; you can check the libtool script
1.14      xtraeme  12797:             location by doing <span><strong class="command">make
                   12798:             configure; find work*/ -name
                   12799:             libtool</strong></span>.</p>
                   12800: 
                   12801:             <p><code class="varname">LIBTOOL_OVERRIDE</code>
                   12802:             specifies which libtool scripts, relative to
                   12803:             <code class="varname">WRKSRC</code>, to override. By
                   12804:             default, it is set to &#8220;<span class=
                   12805:             "quote">libtool */libtool */*/libtool</span>&#8221;. If
                   12806:             this does not match the location of the package's
                   12807:             libtool script(s), set it as appropriate.</p>
1.13      hubertf  12808: 
1.45      wiz      12809:             <p>If you do not need <code xmlns=
                   12810:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12811:             "filename">*.a</code> static libraries built and
                   12812:             installed, then use <code class=
                   12813:             "varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.1       grant    12814: 
1.47      reed     12815:             <p>If your package makes use of the
                   12816:             platform-independent library for loading dynamic shared
                   12817:             objects, that comes with libtool (libltdl), you should
                   12818:             include devel/libltdl/buildlink3.mk.</p>
1.1       grant    12819: 
                   12820:             <p>Some packages use libtool incorrectly so that the
                   12821:             package may not work or build in some circumstances.
                   12822:             Some of the more common errors are:</p>
                   12823: 
                   12824:             <div class="itemizedlist">
                   12825:               <ul type="disc">
                   12826:                 <li>
                   12827:                   <p>The inclusion of a shared object (-module) as
                   12828:                   a dependent library in an executable or library.
                   12829:                   This in itself isn't a problem if one of two
                   12830:                   things has been done:</p>
                   12831: 
                   12832:                   <div class="orderedlist">
                   12833:                     <ol type="1">
                   12834:                       <li>
                   12835:                         <p>The shared object is named correctly,
1.45      wiz      12836:                         i.e. <code xmlns=
                   12837:                         "http://www.w3.org/TR/xhtml1/transitional"
                   12838:                         class="filename">libfoo.la</code>, not
                   12839:                         <code xmlns=
                   12840:                         "http://www.w3.org/TR/xhtml1/transitional"
                   12841:                         class="filename">foo.la</code></p>
1.1       grant    12842:                       </li>
                   12843: 
                   12844:                       <li>
                   12845:                         <p>The -dlopen option is used when linking
                   12846:                         an executable.</p>
                   12847:                       </li>
                   12848:                     </ol>
                   12849:                   </div>
                   12850:                 </li>
                   12851: 
                   12852:                 <li>
                   12853:                   <p>The use of libltdl without the correct calls
                   12854:                   to initialisation routines. The function
                   12855:                   lt_dlinit() should be called and the macro
1.14      xtraeme  12856:                   <code class=
                   12857:                   "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1       grant    12858:                   included in executables.</p>
                   12859:                 </li>
                   12860:               </ul>
                   12861:             </div>
                   12862:           </div>
                   12863: 
1.59    ! rillig   12864:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    12865:             <div class="titlepage">
                   12866:               <div>
                   12867:                 <div>
1.59    ! rillig   12868:                   <h3 class="title"><a name="autoconf-automake" id=
1.38      dillo    12869:                   "autoconf-automake"></a>15.3.3.&nbsp;GNU
1.1       grant    12870:                   Autoconf/Automake</h3>
                   12871:                 </div>
                   12872:               </div>
                   12873:             </div>
                   12874: 
                   12875:             <p>If a package needs GNU autoconf or automake to be
                   12876:             executed to regenerate the configure script and
                   12877:             Makefile.in makefile templates, then they should be
1.35      jmmv     12878:             executed in a pre-configure target.</p>
1.1       grant    12879: 
                   12880:             <p>For packages that need only autoconf:</p>
                   12881:             <pre class="programlisting">
1.51      rillig   12882:     AUTOCONF_REQD=  2.50            # if default version is not good enough
                   12883:     USE_TOOLS+=     autoconf        # use "autoconf213" for autoconf-2.13
                   12884:     ...
1.1       grant    12885: 
1.51      rillig   12886:     pre-configure:
                   12887:             cd ${WRKSRC}; autoconf
1.1       grant    12888: 
1.51      rillig   12889:     ...
1.1       grant    12890: </pre>
                   12891: 
                   12892:             <p>and for packages that need automake and
                   12893:             autoconf:</p>
                   12894:             <pre class="programlisting">
1.51      rillig   12895:     AUTOMAKE_REQD=  1.7.1           # if default version is not good enough
                   12896:     USE_TOOLS+=     automake        # use "automake14" for automake-1.4
                   12897:     ...
1.1       grant    12898: 
1.51      rillig   12899:     pre-configure:
                   12900:             cd ${WRKSRC};                          \
                   12901:             aclocal; autoheader;                   \
                   12902:             automake -a --foreign -i; autoconf
                   12903: 
                   12904:     ...
1.1       grant    12905: </pre>
                   12906: 
                   12907:             <p>Packages which use GNU Automake will almost
1.35      jmmv     12908:             certainly require GNU Make.</p>
1.1       grant    12909: 
                   12910:             <p>There are times when the configure process makes
                   12911:             additional changes to the generated files, which then
                   12912:             causes the build process to try to re-execute the
                   12913:             automake sequence. This is prevented by touching
                   12914:             various files in the configure stage. If this causes
1.14      xtraeme  12915:             problems with your package you can set <code class=
                   12916:             "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1       grant    12917:             Makefile.</p>
                   12918:           </div>
                   12919:         </div>
                   12920: 
1.59    ! rillig   12921:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    12922:           <div class="titlepage">
                   12923:             <div>
                   12924:               <div>
                   12925:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   12926:                 "fixes-build" id=
1.55      rillig   12927:                 "fixes-build"></a>15.4.&nbsp;Building the
                   12928:                 package</h2>
1.1       grant    12929:               </div>
                   12930:             </div>
                   12931:           </div>
                   12932: 
1.59    ! rillig   12933:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    12934:             <div class="titlepage">
                   12935:               <div>
                   12936:                 <div>
1.59    ! rillig   12937:                   <h3 class="title"><a name="cpp-defines" id=
1.38      dillo    12938:                   "cpp-defines"></a>15.4.1.&nbsp;CPP defines</h3>
1.1       grant    12939:                 </div>
                   12940:               </div>
                   12941:             </div>
                   12942: 
1.55      rillig   12943:             <p>Sometimes you need to compile different code
                   12944:             depending on the target platform. The C preprocessor
                   12945:             has a set of predefined macros that can be queried by
                   12946:             using <code class="varname">#ifdef FOO</code> or
                   12947:             <code class="varname">#if defined(FOO)</code>. Among
                   12948:             these macros are usually ones that describe the target
                   12949:             CPU and operating system. Depending of which of the
                   12950:             macros are defined, you can write code that uses
                   12951:             features unique to a specific platform. The best way to
                   12952:             handle these differences is to use the GNU autotools
                   12953:             (automake, autoconf, etc.) to check for specific
                   12954:             features (like the existence of a header file, a
                   12955:             function or a library).</p>
                   12956: 
                   12957:             <p>If that is not possible you can use the predefined
                   12958:             macros below to configure your code to the platform it
                   12959:             runs on. Almost every operating system, hardware
                   12960:             architecture and compiler has its own macro. For
                   12961:             example, if the macros <code class=
                   12962:             "varname">__GNUC__</code>, <code class=
                   12963:             "varname">__i386__</code> and <code class=
                   12964:             "varname">__NetBSD__</code> are all defined, you know
                   12965:             that you are using NetBSD on an Intel CPU, and your
                   12966:             compiler is GCC.</p>
                   12967: 
1.59    ! rillig   12968:             <div class="sect3" lang="en" xml:lang="en">
1.55      rillig   12969:               <div class="titlepage">
                   12970:                 <div>
                   12971:                   <div>
                   12972:                     <h4 class="title"><a name=
1.59    ! rillig   12973:                     "fixes-build-cpp-opsys" id=
1.55      rillig   12974:                     "fixes-build-cpp-opsys"></a>15.4.1.1.&nbsp;CPP
                   12975:                     defines for operating systems</h4>
                   12976:                   </div>
                   12977:                 </div>
                   12978:               </div>
                   12979: 
                   12980:               <p>To distinguish between 4.4 BSD-derived systems and
                   12981:               the rest of the world, you should use the following
                   12982:               code.</p>
                   12983:               <pre class="programlisting">
1.51      rillig   12984:     #include &lt;sys/param.h&gt;
1.55      rillig   12985:     #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
                   12986:       /* your BSD-specific code goes here */
                   12987:     #else
                   12988:       /* non-BSD-specific code */
                   12989:     #endif
1.1       grant    12990: </pre>
                   12991: 
1.55      rillig   12992:               <p>If this distinction is not fine enough, you can
                   12993:               also use the following defines.</p>
                   12994:               <pre class="programlisting">
                   12995:     FreeBSD     __FreeBSD__
1.56      rillig   12996:     DragonFly   __DragonFly__
1.57      minskim  12997:     Interix     __INTERIX
1.55      rillig   12998:     Linux       linux, __linux, __linux__
                   12999:     NetBSD      __NetBSD__
                   13000:     OpenBSD     __OpenBSD__
                   13001:     Solaris     sun, __sun (GCC and SunPro), __sun__ (only GCC)
1.1       grant    13002: </pre>
1.55      rillig   13003:             </div>
1.1       grant    13004: 
1.59    ! rillig   13005:             <div class="sect3" lang="en" xml:lang="en">
1.55      rillig   13006:               <div class="titlepage">
                   13007:                 <div>
                   13008:                   <div>
1.59    ! rillig   13009:                     <h4 class="title"><a name="fixes-build-cpp-cpu"
        !          13010:                     id="fixes-build-cpp-cpu"></a>15.4.1.2.&nbsp;CPP
1.55      rillig   13011:                     defines for CPUs</h4>
                   13012:                   </div>
                   13013:                 </div>
                   13014:               </div>
                   13015:               <pre class="programlisting">
                   13016:     i386        i386, __i386, __i386__
                   13017:     MIPS        __mips
                   13018:     SPARC       sparc, __sparc
                   13019: </pre>
                   13020:             </div>
                   13021: 
1.59    ! rillig   13022:             <div class="sect3" lang="en" xml:lang="en">
1.55      rillig   13023:               <div class="titlepage">
                   13024:                 <div>
                   13025:                   <div>
                   13026:                     <h4 class="title"><a name=
1.59    ! rillig   13027:                     "fixes-build-cpp-compiler" id=
1.55      rillig   13028:                     "fixes-build-cpp-compiler"></a>15.4.1.3.&nbsp;CPP
                   13029:                     defines for compilers</h4>
                   13030:                   </div>
                   13031:                 </div>
                   13032:               </div>
                   13033:               <pre class="programlisting">
                   13034:     GCC         __GNUC__ (major version), __GNUC_MINOR__
                   13035: </pre>
                   13036:             </div>
1.1       grant    13037:           </div>
1.51      rillig   13038: 
1.59    ! rillig   13039:           <div class="sect2" lang="en" xml:lang="en">
1.51      rillig   13040:             <div class="titlepage">
                   13041:               <div>
                   13042:                 <div>
1.59    ! rillig   13043:                   <h3 class="title"><a name="cpp-list" id=
1.51      rillig   13044:                   "cpp-list"></a>15.4.2.&nbsp;Getting a list of CPP
                   13045:                   defines</h3>
                   13046:                 </div>
                   13047:               </div>
                   13048:             </div>
                   13049: 
                   13050:             <p>When your system uses the GNU C Compiler, you can
                   13051:             get a list of symbols that are defined by default, e.g.
                   13052:             to identify the platform, with the following
                   13053:             command:</p>
                   13054:             <pre class="programlisting">
                   13055:     gcc -E -dM - &lt; /dev/null 
                   13056: </pre>
                   13057:           </div>
1.1       grant    13058:         </div>
                   13059: 
1.59    ! rillig   13060:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    13061:           <div class="titlepage">
                   13062:             <div>
                   13063:               <div>
                   13064:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   13065:                 "package-specific-actions" id=
1.38      dillo    13066:                 "package-specific-actions"></a>15.5.&nbsp;Package
1.1       grant    13067:                 specific actions</h2>
                   13068:               </div>
                   13069:             </div>
                   13070:           </div>
                   13071: 
1.59    ! rillig   13072:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    13073:             <div class="titlepage">
                   13074:               <div>
                   13075:                 <div>
1.59    ! rillig   13076:                   <h3 class="title"><a name="user-interaction" id=
1.38      dillo    13077:                   "user-interaction"></a>15.5.1.&nbsp;User
1.2       hubertf  13078:                   interaction</h3>
1.1       grant    13079:                 </div>
                   13080:               </div>
                   13081:             </div>
                   13082: 
                   13083:             <p>Occasionally, packages require interaction from the
                   13084:             user, and this can be in a number of ways:</p>
                   13085: 
                   13086:             <div class="itemizedlist">
                   13087:               <ul type="disc">
                   13088:                 <li>
                   13089:                   <p>help in fetching the distfiles</p>
                   13090:                 </li>
                   13091: 
                   13092:                 <li>
                   13093:                   <p>help to configure the package before it is
                   13094:                   built</p>
                   13095:                 </li>
                   13096: 
                   13097:                 <li>
                   13098:                   <p>help during the build process</p>
                   13099:                 </li>
                   13100: 
                   13101:                 <li>
                   13102:                   <p>help during the installation of a package</p>
                   13103:                 </li>
                   13104:               </ul>
                   13105:             </div>
                   13106: 
1.14      xtraeme  13107:             <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1       grant    13108:             definition is provided to notify the pkgsrc mechanism
                   13109:             of an interactive stage which will be needed, and this
1.45      wiz      13110:             should be set in the package's <code xmlns=
                   13111:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     13112:             "filename">Makefile</code>, e.g.:</p>
1.1       grant    13113:             <pre class="programlisting">
1.51      rillig   13114:     INTERACTIVE_STAGE=      build
1.1       grant    13115: </pre>
                   13116: 
                   13117:             <p>Multiple interactive stages can be specified:</p>
                   13118:             <pre class="programlisting">
1.51      rillig   13119:     INTERACTIVE_STAGE=      configure install
1.1       grant    13120: </pre>
                   13121:           </div>
                   13122: 
1.59    ! rillig   13123:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    13124:             <div class="titlepage">
                   13125:               <div>
                   13126:                 <div>
1.59    ! rillig   13127:                   <h3 class="title"><a name="handling-licenses" id=
1.38      dillo    13128:                   "handling-licenses"></a>15.5.2.&nbsp;Handling
1.1       grant    13129:                   licenses</h3>
                   13130:                 </div>
                   13131:               </div>
                   13132:             </div>
                   13133: 
1.44      gdt      13134:             <p>A package may be covered by a license which the user
                   13135:             has or has not agreed to accept. For these cases,
                   13136:             pkgsrc contains a mechanism to note that a package is
                   13137:             covered by a particular license, and the package cannot
                   13138:             be built unless the user has accepted the license.
                   13139:             (Installation of binary packages are not currently
                   13140:             subject to this mechanism.) Packages with licenses that
                   13141:             are either Open Source according to the Open Source
                   13142:             Initiative or Free according to the Free Software
                   13143:             Foundation will not be marked with a license tag.
                   13144:             Packages with licenses that have not been determined to
                   13145:             meet either definition will be marked with a license
                   13146:             tag referring to the license. This will prevent
                   13147:             building unless pkgsrc is informed that the license is
                   13148:             acceptable, and enables displaying the license.</p>
                   13149: 
                   13150:             <p>The license tag mechanism is intended to address
                   13151:             copyright-related issues surrounding building,
                   13152:             installing and using a package, and not to address
                   13153:             redistribution issues (see <code class=
                   13154:             "varname">RESTRICTED</code> and <code class=
                   13155:             "varname">NO_SRC_ON_FTP</code>, etc.). However, the
                   13156:             above definition of licenses for which tags are not
                   13157:             needed implies that packages with redistribution
                   13158:             restrictions should have tags.</p>
                   13159: 
                   13160:             <p>Denoting that a package is covered by a particular
1.45      wiz      13161:             license is done by placing the license in <code xmlns=
                   13162:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.44      gdt      13163:             "filename">pkgsrc/licenses</code> and setting the
                   13164:             <code class="varname">LICENSE</code> variable to a
                   13165:             string identifying the license, e.g. in <a xmlns=
1.14      xtraeme  13166:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.44      gdt      13167:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/xv/README.html"
1.45      wiz      13168:             target="_top"><code xmlns="" class=
                   13169:             "filename">graphics/xv</code></a>:</p>
1.1       grant    13170:             <pre class="programlisting">
1.51      rillig   13171:     LICENSE=        xv-license
1.1       grant    13172: </pre>
                   13173: 
                   13174:             <p>When trying to build, the user will get a notice
1.44      gdt      13175:             that the package is covered by a license which has not
                   13176:             been accepted:</p>
1.1       grant    13177:             <pre class="programlisting">
1.51      rillig   13178:     <code class="prompt">%</code> <strong class=
1.14      xtraeme  13179: "userinput"><code>make</code></strong>
1.51      rillig   13180:     ===&gt; xv-3.10anb9 has an unacceptable license: xv-license.
                   13181:     ===&gt;     To view the license, enter "/usr/bin/make show-license".
                   13182:     ===&gt;     To indicate acceptance, add this line to your /etc/mk.conf:
                   13183:     ===&gt;     ACCEPTABLE_LICENSES+=xv-license
                   13184:     *** Error code 1
1.1       grant    13185: </pre>
                   13186: 
1.14      xtraeme  13187:             <p>The license can be viewed with <span><strong class=
                   13188:             "command">make show-license</strong></span>, and if it
                   13189:             is considered appropriate, the line printed above can
1.45      wiz      13190:             be added to <code xmlns=
                   13191:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13192:             "filename">/etc/mk.conf</code> to indicate acceptance
                   13193:             of the particular license:</p>
1.1       grant    13194:             <pre class="programlisting">
1.51      rillig   13195:     ACCEPTABLE_LICENSES+=xv-license
1.1       grant    13196: </pre>
                   13197: 
                   13198:             <p>When adding a package with a new license, the
1.45      wiz      13199:             license text should be added to <code xmlns=
                   13200:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13201:             "filename">pkgsrc/licenses</code> for displaying. A
                   13202:             list of known licenses can be seen in this directory as
                   13203:             well as by looking at the list of (commented out)
                   13204:             <code class="varname">ACCEPTABLE_LICENSES</code>
1.45      wiz      13205:             variable settings in <code xmlns=
                   13206:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13207:             "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1       grant    13208: 
1.44      gdt      13209:             <p>The use of <code class=
                   13210:             "varname">LICENSE=shareware</code>, <code class=
                   13211:             "varname">LICENSE=no-commercial-use</code>, and similar
                   13212:             language is deprecated because it does not crisply
                   13213:             refer to a particular license text. Another problem
                   13214:             with such usage is that it does not enable a user to
                   13215:             denote acceptance of the license for a single package
                   13216:             without accepting the same license text for another
                   13217:             package. In particular, this can be inappropriate when
                   13218:             e.g. one accepts a particular license to indicate to
                   13219:             pkgsrc that a fee has been paid.</p>
1.1       grant    13220:           </div>
                   13221: 
1.59    ! rillig   13222:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    13223:             <div class="titlepage">
                   13224:               <div>
                   13225:                 <div>
1.30      wiz      13226:                   <h3 class="title"><a name=
1.59    ! rillig   13227:                   "installing-score-files" id=
1.38      dillo    13228:                   "installing-score-files"></a>15.5.3.&nbsp;Installing
1.30      wiz      13229:                   score files</h3>
1.1       grant    13230:                 </div>
                   13231:               </div>
                   13232:             </div>
                   13233: 
                   13234:             <p>Certain packages, most of them in the games
                   13235:             category, install a score file that allows all users on
                   13236:             the system to record their highscores. In order for
                   13237:             this to work, the binaries need to be installed setgid
                   13238:             and the score files owned by the appropriate group
                   13239:             and/or owner (traditionally the "games" user/group).
                   13240:             The following variables, documented in more detail in
1.45      wiz      13241:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13242:             class="filename">mk/defaults/mk.conf</code>, control
                   13243:             this behaviour: <code class=
1.14      xtraeme  13244:             "varname">SETGIDGAME</code>, <code class=
                   13245:             "varname">GAMEDATAMODE</code>, <code class=
                   13246:             "varname">GAMEGRP</code>, <code class=
                   13247:             "varname">GAMEMODE</code>, <code class=
                   13248:             "varname">GAMEOWN</code>.</p>
1.1       grant    13249: 
                   13250:             <p>Note that per default, setgid installation of games
1.14      xtraeme  13251:             is disabled; setting <code class=
                   13252:             "varname">SETGIDGAME=YES</code> will set all the other
1.1       grant    13253:             variables accordingly.</p>
                   13254: 
                   13255:             <p>A package should therefor never hard code file
1.14      xtraeme  13256:             ownership or access permissions but rely on
                   13257:             <code class="varname">INSTALL_GAME</code> and
                   13258:             <code class="varname">INSTALL_GAME_DATA</code> to set
                   13259:             these correctly.</p>
1.1       grant    13260:           </div>
                   13261: 
1.59    ! rillig   13262:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    13263:             <div class="titlepage">
                   13264:               <div>
                   13265:                 <div>
1.59    ! rillig   13266:                   <h3 class="title"><a name="perl-scripts" id=
1.38      dillo    13267:                   "perl-scripts"></a>15.5.4.&nbsp;Packages
1.30      wiz      13268:                   containing perl scripts</h3>
1.1       grant    13269:                 </div>
                   13270:               </div>
                   13271:             </div>
                   13272: 
                   13273:             <p>If your package contains interpreted perl scripts,
1.14      xtraeme  13274:             set <code class="varname">REPLACE_PERL</code> to ensure
                   13275:             that the proper interpreter path is set. <code class=
                   13276:             "varname">REPLACE_PERL</code> should contain a list of
                   13277:             scripts, relative to <code class=
                   13278:             "varname">WRKSRC</code>, that you want adjusted.</p>
1.1       grant    13279:           </div>
                   13280: 
1.59    ! rillig   13281:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    13282:             <div class="titlepage">
                   13283:               <div>
                   13284:                 <div>
1.59    ! rillig   13285:                   <h3 class="title"><a name="hardcoded-paths" id=
1.38      dillo    13286:                   "hardcoded-paths"></a>15.5.5.&nbsp;Packages with
1.1       grant    13287:                   hardcoded paths to other interpreters</h3>
                   13288:                 </div>
                   13289:               </div>
                   13290:             </div>
                   13291: 
                   13292:             <p>Your package may also contain scripts with hardcoded
                   13293:             paths to other interpreters besides (or as well as)
                   13294:             perl. To correct the full pathname to the script
                   13295:             interpreter, you need to set the following definitions
1.45      wiz      13296:             in your <code xmlns=
                   13297:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13298:             "filename">Makefile</code> (we shall use
                   13299:             <span><strong class="command">tclsh</strong></span> in
                   13300:             this example):</p>
1.1       grant    13301:             <pre class="programlisting">
1.51      rillig   13302:     REPLACE_INTERPRETER+=   tcl
                   13303:     _REPLACE.tcl.old=       .*/bin/tclsh
                   13304:     _REPLACE.tcl.new=       ${PREFIX}/bin/tclsh
                   13305:     _REPLACE_FILES.tcl=     # list of tcl scripts which need to be fixed,
                   13306:                             # relative to ${WRKSRC}, just as in REPLACE_PERL
1.1       grant    13307: </pre>
                   13308:           </div>
                   13309: 
1.59    ! rillig   13310:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    13311:             <div class="titlepage">
                   13312:               <div>
                   13313:                 <div>
1.59    ! rillig   13314:                   <h3 class="title"><a name="perl-modules" id=
1.38      dillo    13315:                   "perl-modules"></a>15.5.6.&nbsp;Packages
1.30      wiz      13316:                   installing perl modules</h3>
1.1       grant    13317:                 </div>
                   13318:               </div>
                   13319:             </div>
                   13320: 
                   13321:             <p>Makefiles of packages providing perl5 modules should
1.45      wiz      13322:             include the Makefile fragment <code xmlns=
                   13323:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13324:             "filename">../../lang/perl5/module.mk</code>. It
                   13325:             provides a <span><strong class=
                   13326:             "command">do-configure</strong></span> target for the
                   13327:             standard perl configuration for such modules as well as
                   13328:             various hooks to tune this configuration. See comments
                   13329:             in this file for details.</p>
1.1       grant    13330: 
                   13331:             <p>Perl5 modules will install into different places
                   13332:             depending on the version of perl used during the build
                   13333:             process. To address this, pkgsrc will append lines to
1.45      wiz      13334:             the <code xmlns=
                   13335:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13336:             "filename">PLIST</code> corresponding to the files
                   13337:             listed in the installed <code xmlns=
                   13338:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13339:             "filename">.packlist</code> file generated by most
                   13340:             perl5 modules. This is invoked by defining <code class=
                   13341:             "varname">PERL5_PACKLIST</code> to a space-separated
                   13342:             list of paths to packlist files, e.g.:</p>
1.1       grant    13343:             <pre class="programlisting">
1.51      rillig   13344:     PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
1.1       grant    13345: </pre>
                   13346: 
1.14      xtraeme  13347:             <p>The variables <code class=
                   13348:             "varname">PERL5_SITELIB</code>, <code class=
                   13349:             "varname">PERL5_SITEARCH</code>, and <code class=
                   13350:             "varname">PERL5_ARCHLIB</code> represent the three
1.1       grant    13351:             locations in which perl5 modules may be installed, and
                   13352:             may be used by perl5 packages that don't have a
                   13353:             packlist. These three variables are also substituted
1.45      wiz      13354:             for in the <code xmlns=
                   13355:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13356:             "filename">PLIST</code>.</p>
1.1       grant    13357:           </div>
                   13358: 
1.59    ! rillig   13359:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    13360:             <div class="titlepage">
                   13361:               <div>
                   13362:                 <div>
1.59    ! rillig   13363:                   <h3 class="title"><a name="faq.info-files" id=
1.38      dillo    13364:                   "faq.info-files"></a>15.5.7.&nbsp;Packages
1.1       grant    13365:                   installing info files</h3>
                   13366:                 </div>
                   13367:               </div>
                   13368:             </div>
                   13369: 
                   13370:             <p>Some packages install info files or use the
                   13371:             &#8220;<span class="quote">makeinfo</span>&#8221; or
                   13372:             &#8220;<span class="quote">install-info</span>&#8221;
                   13373:             commands. Each of the info files:</p>
                   13374: 
                   13375:             <div class="itemizedlist">
                   13376:               <ul type="disc">
                   13377:                 <li>
                   13378:                   <p>is considered to be installed in the directory
1.45      wiz      13379:                   <code xmlns=
                   13380:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13381:                   "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1       grant    13382:                 </li>
                   13383: 
                   13384:                 <li>
                   13385:                   <p>is registered in the Info directory file
1.45      wiz      13386:                   <code xmlns=
                   13387:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13388:                   "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1       grant    13389:                 </li>
                   13390: 
                   13391:                 <li>
                   13392:                   <p>and must be listed as a filename in the
1.14      xtraeme  13393:                   <code class="varname">INFO_FILES</code> variable
                   13394:                   in the package Makefile.</p>
1.1       grant    13395:                 </li>
                   13396:               </ul>
                   13397:             </div>
                   13398: 
1.14      xtraeme  13399:             <p><code class="varname">INFO_DIR</code> defaults to
1.1       grant    13400:             &#8220;<span class="quote">info</span>&#8221; and can
1.45      wiz      13401:             be overridden in the package Makefile. <code xmlns=
                   13402:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13403:             "filename">INSTALL</code> and <code xmlns=
                   13404:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13405:             "filename">DEINSTALL</code> scripts will be generated
                   13406:             to handle registration of the info files in the Info
1.1       grant    13407:             directory file. The &#8220;<span class=
                   13408:             "quote">install-info</span>&#8221; command used for the
                   13409:             info files registration is either provided by the
                   13410:             system, or by a special purpose package automatically
                   13411:             added as dependency if needed.</p>
                   13412: 
                   13413:             <p>A package which needs the &#8220;<span class=
                   13414:             "quote">makeinfo</span>&#8221; command at build time
1.14      xtraeme  13415:             must define the variable <code class=
                   13416:             "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1       grant    13417:             minimum version of the &#8220;<span class=
                   13418:             "quote">makeinfo</span>&#8221; command is needed it
1.14      xtraeme  13419:             should be noted with the <code class=
                   13420:             "varname">TEXINFO_REQD</code> variable in the package
1.45      wiz      13421:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13422:             class="filename">Makefile</code>. By default, a minimum
                   13423:             version of 3.12 is required. If the system does not
                   13424:             provide a <span><strong class=
1.14      xtraeme  13425:             "command">makeinfo</strong></span> command or if it
                   13426:             does not match the required minimum, a build dependency
                   13427:             on the <a xmlns=
                   13428:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    13429:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.45      wiz      13430:             target="_top"><code xmlns="" class=
                   13431:             "filename">devel/gtexinfo</code></a> package will be
1.20      ben      13432:             added automatically.</p>
1.1       grant    13433: 
                   13434:             <p>The build and installation process of the software
                   13435:             provided by the package should not use the
1.14      xtraeme  13436:             <span><strong class=
                   13437:             "command">install-info</strong></span> command as the
                   13438:             registration of info files is the task of the package
1.45      wiz      13439:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13440:             class="filename">INSTALL</code> script, and it must use
                   13441:             the appropriate <span><strong class=
1.14      xtraeme  13442:             "command">makeinfo</strong></span> command.</p>
1.1       grant    13443: 
1.47      reed     13444:             <p>To achieve this goal, the pkgsrc infrastructure
1.14      xtraeme  13445:             creates overriding scripts for the <span><strong class=
                   13446:             "command">install-info</strong></span> and
                   13447:             <span><strong class="command">makeinfo</strong></span>
                   13448:             commands in a directory listed early in <code class=
                   13449:             "varname">PATH</code>.</p>
1.1       grant    13450: 
1.14      xtraeme  13451:             <p>The script overriding <span><strong class=
                   13452:             "command">install-info</strong></span> has no effect
                   13453:             except the logging of a message. The script overriding
                   13454:             <span><strong class="command">makeinfo</strong></span>
                   13455:             logs a message and according to the value of
                   13456:             <code class="varname">USE_MAKEINFO</code> and
                   13457:             <code class="varname">TEXINFO_REQD</code> either run
                   13458:             the appropriate <span><strong class=
                   13459:             "command">makeinfo</strong></span> command or exit on
                   13460:             error.</p>
1.1       grant    13461:           </div>
                   13462: 
1.59    ! rillig   13463:           <div class="sect2" lang="en" xml:lang="en">
1.57      minskim  13464:             <div class="titlepage">
                   13465:               <div>
                   13466:                 <div>
1.59    ! rillig   13467:                   <h3 class="title"><a name="manpages" id=
1.57      minskim  13468:                   "manpages"></a>15.5.8.&nbsp;Packages installing
                   13469:                   man pages</h3>
                   13470:                 </div>
                   13471:               </div>
                   13472:             </div>
                   13473: 
                   13474:             <p>Many packages install manual pages. The man pages
                   13475:             are installed under <code class=
                   13476:             "varname">${PREFIX}/${PKGMANDIR}</code> which is
                   13477:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13478:             class="filename">/usr/pkg/man</code> by default.
                   13479:             <code class="varname">PKGMANDIR</code> defaults to
                   13480:             &#8220;<span class="quote">man</span>&#8221;. For
                   13481:             example, you can set <code class=
                   13482:             "varname">PKGMANDIR</code> to &#8220;<span class=
                   13483:             "quote">share/man</span>&#8221; to have man pages
                   13484:             install under <code xmlns=
                   13485:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13486:             "filename">/usr/pkg/share/man/</code> by default.</p>
                   13487: 
                   13488:             <div class="note" style=
                   13489:             "margin-left: 0.5in; margin-right: 0.5in;">
                   13490:               <h3 class="title">Note</h3>
                   13491: 
                   13492:               <p>The support for a custom <code class=
                   13493:               "varname">PKGMANDIR</code> is not complete.</p>
                   13494:             </div>
                   13495: 
                   13496:             <p>The <code xmlns=
                   13497:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13498:             "filename">PLIST</code> files can just use <code xmlns=
                   13499:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13500:             "filename">man/</code> as the top level directory for
                   13501:             the man page file entries and the pkgsrc framework will
                   13502:             convert as needed.</p>
                   13503: 
                   13504:             <p>Packages that are configured with <code class=
                   13505:             "varname">GNU_CONFIGURE</code> set as
                   13506:             &#8220;<span class="quote">yes</span>&#8221;, by
                   13507:             default will use the <code xmlns=
                   13508:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13509:             "filename">./configure</code> --mandir switch to set
                   13510:             where the man pages should be installed. The path is
                   13511:             <code class="varname">GNU_CONFIGURE_MANDIR</code> which
                   13512:             defaults to <code class=
                   13513:             "varname">${PREFIX}/${PKGMANDIR}</code>.</p>
                   13514: 
                   13515:             <p>Packages that use <code class=
                   13516:             "varname">GNU_CONFIGURE</code> but do not use --mandir,
                   13517:             can set <code class=
                   13518:             "varname">CONFIGURE_HAS_MANDIR</code> to
                   13519:             &#8220;<span class="quote">no</span>&#8221;. Or if the
                   13520:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13521:             class="filename">./configure</code> script uses a
                   13522:             non-standard use of --mandir, you can set <code class=
                   13523:             "varname">GNU_CONFIGURE_MANDIR</code> as needed.</p>
                   13524: 
                   13525:             <p>See <a href="#manpage-compression" title=
                   13526:             "10.5.&nbsp;Man page compression">Section&nbsp;10.5,
                   13527:             &#8220;Man page compression&#8221;</a> for information
                   13528:             on installation of compressed manual pages.</p>
                   13529:           </div>
                   13530: 
1.59    ! rillig   13531:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    13532:             <div class="titlepage">
                   13533:               <div>
                   13534:                 <div>
1.59    ! rillig   13535:                   <h3 class="title"><a name="gconf2-data-files" id=
1.57      minskim  13536:                   "gconf2-data-files"></a>15.5.9.&nbsp;Packages
1.30      wiz      13537:                   installing GConf2 data files</h3>
1.1       grant    13538:                 </div>
                   13539:               </div>
                   13540:             </div>
                   13541: 
1.45      wiz      13542:             <p>If a package installs <code xmlns=
                   13543:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13544:             "filename">.schemas</code> or <code xmlns=
                   13545:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13546:             "filename">.entries</code> files, used by GConf2, you
1.1       grant    13547:             need to take some extra steps to make sure they get
                   13548:             registered in the database:</p>
                   13549: 
                   13550:             <div class="orderedlist">
                   13551:               <ol type="1">
                   13552:                 <li>
1.45      wiz      13553:                   <p>Include <code xmlns=
                   13554:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13555:                   "filename">../../devel/GConf2/schemas.mk</code>
1.45      wiz      13556:                   instead of its <code xmlns=
                   13557:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13558:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    13559:                   care of rebuilding the GConf2 database at
                   13560:                   installation and deinstallation time, and tells
                   13561:                   the package where to install GConf2 data files
                   13562:                   using some standard configure arguments. It also
                   13563:                   disallows any access to the database directly
                   13564:                   from the package.</p>
                   13565:                 </li>
                   13566: 
                   13567:                 <li>
                   13568:                   <p>Ensure that the package installs its
1.45      wiz      13569:                   <code xmlns=
                   13570:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13571:                   "filename">.schemas</code> files under
                   13572:                   <code xmlns=
                   13573:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13574:                   "filename">${PREFIX}/share/gconf/schemas</code>.
1.45      wiz      13575:                   If they get installed under <code xmlns=
                   13576:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13577:                   "filename">${PREFIX}/etc</code>, you will need to
1.1       grant    13578:                   manually patch the package.</p>
                   13579:                 </li>
                   13580: 
                   13581:                 <li>
                   13582:                   <p>Check the PLIST and remove any entries under
                   13583:                   the etc/gconf directory, as they will be handled
                   13584:                   automatically. See <a href="#faq.conf" title=
1.38      dillo    13585:                   "7.14.&nbsp;How do I change the location of configuration files?">
                   13586:                   Section&nbsp;7.14, &#8220;How do I change the
1.35      jmmv     13587:                   location of configuration files?&#8221;</a> for
                   13588:                   more information.</p>
1.1       grant    13589:                 </li>
                   13590: 
                   13591:                 <li>
1.14      xtraeme  13592:                   <p>Define the <code class=
                   13593:                   "varname">GCONF2_SCHEMAS</code> variable in your
1.45      wiz      13594:                   <code xmlns=
                   13595:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13596:                   "filename">Makefile</code> with a list of all
                   13597:                   <code xmlns=
                   13598:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13599:                   "filename">.schemas</code> files installed by the
                   13600:                   package, if any. Names must not contain any
                   13601:                   directories in them.</p>
1.1       grant    13602:                 </li>
                   13603: 
                   13604:                 <li>
1.14      xtraeme  13605:                   <p>Define the <code class=
                   13606:                   "varname">GCONF2_ENTRIES</code> variable in your
1.45      wiz      13607:                   <code xmlns=
                   13608:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13609:                   "filename">Makefile</code> with a list of all
                   13610:                   <code xmlns=
                   13611:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13612:                   "filename">.entries</code> files installed by the
                   13613:                   package, if any. Names must not contain any
                   13614:                   directories in them.</p>
1.1       grant    13615:                 </li>
                   13616:               </ol>
                   13617:             </div>
                   13618:           </div>
                   13619: 
1.59    ! rillig   13620:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    13621:             <div class="titlepage">
                   13622:               <div>
                   13623:                 <div>
1.30      wiz      13624:                   <h3 class="title"><a name=
1.59    ! rillig   13625:                   "scrollkeeper-data-files" id=
1.57      minskim  13626:                   "scrollkeeper-data-files"></a>15.5.10.&nbsp;Packages
1.30      wiz      13627:                   installing scrollkeeper data files</h3>
1.1       grant    13628:                 </div>
                   13629:               </div>
                   13630:             </div>
                   13631: 
1.45      wiz      13632:             <p>If a package installs <code xmlns=
                   13633:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13634:             "filename">.omf</code> files, used by scrollkeeper, you
                   13635:             need to take some extra steps to make sure they get
                   13636:             registered in the database:</p>
1.1       grant    13637: 
                   13638:             <div class="orderedlist">
                   13639:               <ol type="1">
                   13640:                 <li>
1.45      wiz      13641:                   <p>Include <code xmlns=
                   13642:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13643:                   "filename">../../textproc/scrollkeeper/omf.mk</code>
1.45      wiz      13644:                   instead of its <code xmlns=
                   13645:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13646:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    13647:                   care of rebuilding the scrollkeeper database at
                   13648:                   installation and deinstallation time, and
                   13649:                   disallows any access to it directly from the
                   13650:                   package.</p>
                   13651:                 </li>
                   13652: 
                   13653:                 <li>
                   13654:                   <p>Check the PLIST and remove any entries under
1.45      wiz      13655:                   the <code xmlns=
                   13656:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13657:                   "filename">libdata/scrollkeeper</code> directory,
1.1       grant    13658:                   as they will be handled automatically.</p>
                   13659:                 </li>
                   13660: 
                   13661:                 <li>
1.45      wiz      13662:                   <p>Remove the <code xmlns=
                   13663:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13664:                   "filename">share/omf</code> directory from the
                   13665:                   PLIST. It will be handled by scrollkeeper.</p>
1.1       grant    13666:                 </li>
                   13667:               </ol>
                   13668:             </div>
                   13669:           </div>
                   13670: 
1.59    ! rillig   13671:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    13672:             <div class="titlepage">
                   13673:               <div>
                   13674:                 <div>
1.59    ! rillig   13675:                   <h3 class="title"><a name="x11-fonts" id=
1.57      minskim  13676:                   "x11-fonts"></a>15.5.11.&nbsp;Packages installing
1.1       grant    13677:                   X11 fonts</h3>
                   13678:                 </div>
                   13679:               </div>
                   13680:             </div>
                   13681: 
                   13682:             <p>If a package installs font files, you will need to
                   13683:             rebuild the fonts database in the directory where they
                   13684:             get installed at installation and deinstallation time.
1.45      wiz      13685:             This can be automatically done by using <code xmlns=
                   13686:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13687:             "filename">mk/fonts.mk</code>, which you need to
1.45      wiz      13688:             include in your <code xmlns=
                   13689:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13690:             "filename">Makefile</code>.</p>
1.1       grant    13691: 
                   13692:             <p>When the file is included, you can list the
1.14      xtraeme  13693:             directories where fonts are installed in the
                   13694:             <code class="varname">FONTS_<em class=
                   13695:             "replaceable"><code>type</code></em>_DIRS</code>
                   13696:             variables, where <em class=
                   13697:             "replaceable"><code>type</code></em> can be one of
                   13698:             &#8220;<span class="quote">TTF</span>&#8221;,
1.1       grant    13699:             &#8220;<span class="quote">TYPE1</span>&#8221; or
                   13700:             &#8220;<span class="quote">X11</span>&#8221;. Also make
1.45      wiz      13701:             sure that the database file <code xmlns=
                   13702:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13703:             "filename">fonts.dir</code> is not listed in the
1.1       grant    13704:             PLIST.</p>
                   13705: 
                   13706:             <p>Note that you should not create new directories for
                   13707:             fonts; instead use the standard ones to avoid that the
                   13708:             user needs to manually configure his X server to find
                   13709:             them.</p>
                   13710:           </div>
                   13711: 
1.59    ! rillig   13712:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    13713:             <div class="titlepage">
                   13714:               <div>
                   13715:                 <div>
1.59    ! rillig   13716:                   <h3 class="title"><a name="gtk2-modules" id=
1.57      minskim  13717:                   "gtk2-modules"></a>15.5.12.&nbsp;Packages
1.30      wiz      13718:                   installing GTK2 modules</h3>
1.1       grant    13719:                 </div>
                   13720:               </div>
                   13721:             </div>
                   13722: 
1.47      reed     13723:             <p>If a package installs GTK2 immodules or loaders, you
1.1       grant    13724:             need to take some extra steps to get them registered in
                   13725:             the GTK2 database properly:</p>
                   13726: 
                   13727:             <div class="orderedlist">
                   13728:               <ol type="1">
                   13729:                 <li>
1.45      wiz      13730:                   <p>Include <code xmlns=
                   13731:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13732:                   "filename">../../x11/gtk2/modules.mk</code>
1.45      wiz      13733:                   instead of its <code xmlns=
                   13734:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13735:                   "filename">buildlink3.mk</code> file. This takes
                   13736:                   care of rebuilding the database at installation
                   13737:                   and deinstallation time.</p>
1.1       grant    13738:                 </li>
                   13739: 
                   13740:                 <li>
1.14      xtraeme  13741:                   <p>Set <code class=
                   13742:                   "varname">GTK2_IMMODULES=YES</code> if your
                   13743:                   package installs GTK2 immodules.</p>
1.1       grant    13744:                 </li>
                   13745: 
                   13746:                 <li>
1.14      xtraeme  13747:                   <p>Set <code class=
                   13748:                   "varname">GTK2_LOADERS=YES</code> if your package
                   13749:                   installs GTK2 loaders.</p>
1.1       grant    13750:                 </li>
                   13751: 
                   13752:                 <li>
1.47      reed     13753:                   <p>Patch the package to not touch any of the GTK2
1.1       grant    13754:                   databases directly. These are:</p>
                   13755: 
                   13756:                   <div class="itemizedlist">
                   13757:                     <ul type="disc">
                   13758:                       <li>
1.45      wiz      13759:                         <p><code xmlns=
                   13760:                         "http://www.w3.org/TR/xhtml1/transitional"
                   13761:                         class=
1.14      xtraeme  13762:                         "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1       grant    13763:                       </li>
                   13764: 
                   13765:                       <li>
1.45      wiz      13766:                         <p><code xmlns=
                   13767:                         "http://www.w3.org/TR/xhtml1/transitional"
                   13768:                         class=
1.14      xtraeme  13769:                         "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1       grant    13770:                       </li>
                   13771:                     </ul>
                   13772:                   </div>
                   13773:                 </li>
                   13774: 
                   13775:                 <li>
                   13776:                   <p>Check the PLIST and remove any entries under
1.45      wiz      13777:                   the <code xmlns=
                   13778:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13779:                   "filename">libdata/gtk-2.0</code> directory, as
                   13780:                   they will be handled automatically.</p>
1.1       grant    13781:                 </li>
                   13782:               </ol>
                   13783:             </div>
                   13784:           </div>
                   13785: 
1.59    ! rillig   13786:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    13787:             <div class="titlepage">
                   13788:               <div>
                   13789:                 <div>
1.59    ! rillig   13790:                   <h3 class="title"><a name="sgml-xml-data" id=
1.57      minskim  13791:                   "sgml-xml-data"></a>15.5.13.&nbsp;Packages
1.30      wiz      13792:                   installing SGML or XML data</h3>
1.1       grant    13793:                 </div>
                   13794:               </div>
                   13795:             </div>
                   13796: 
                   13797:             <p>If a package installs SGML or XML data files that
                   13798:             need to be registered in system-wide catalogs (like
                   13799:             DTDs, sub-catalogs, etc.), you need to take some extra
                   13800:             steps:</p>
                   13801: 
                   13802:             <div class="orderedlist">
                   13803:               <ol type="1">
                   13804:                 <li>
1.45      wiz      13805:                   <p>Include <code xmlns=
                   13806:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13807:                   "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
1.45      wiz      13808:                   in your <code xmlns=
                   13809:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13810:                   "filename">Makefile</code>, which takes care of
                   13811:                   registering those files in system-wide catalogs
                   13812:                   at installation and deinstallation time.</p>
1.1       grant    13813:                 </li>
                   13814: 
                   13815:                 <li>
1.14      xtraeme  13816:                   <p>Set <code class="varname">SGML_CATALOGS</code>
                   13817:                   to the full path of any SGML catalogs installed
                   13818:                   by the package.</p>
1.1       grant    13819:                 </li>
                   13820: 
                   13821:                 <li>
1.14      xtraeme  13822:                   <p>Set <code class="varname">XML_CATALOGS</code>
                   13823:                   to the full path of any XML catalogs installed by
1.1       grant    13824:                   the package.</p>
                   13825:                 </li>
                   13826: 
                   13827:                 <li>
1.14      xtraeme  13828:                   <p>Set <code class="varname">SGML_ENTRIES</code>
                   13829:                   to individual entries to be added to the SGML
1.1       grant    13830:                   catalog. These come in groups of three strings;
                   13831:                   see xmlcatmgr(1) for more information
                   13832:                   (specifically, arguments recognized by the 'add'
                   13833:                   action). Note that you will normally not use this
                   13834:                   variable.</p>
                   13835:                 </li>
                   13836: 
                   13837:                 <li>
1.14      xtraeme  13838:                   <p>Set <code class="varname">XML_ENTRIES</code>
                   13839:                   to individual entries to be added to the XML
1.1       grant    13840:                   catalog. These come in groups of three strings;
                   13841:                   see xmlcatmgr(1) for more information
                   13842:                   (specifically, arguments recognized by the 'add'
                   13843:                   action). Note that you will normally not use this
                   13844:                   variable.</p>
                   13845:                 </li>
                   13846:               </ol>
                   13847:             </div>
                   13848:           </div>
                   13849: 
1.59    ! rillig   13850:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    13851:             <div class="titlepage">
                   13852:               <div>
                   13853:                 <div>
1.59    ! rillig   13854:                   <h3 class="title"><a name="mime-database" id=
1.57      minskim  13855:                   "mime-database"></a>15.5.14.&nbsp;Packages
1.30      wiz      13856:                   installing extensions to the MIME database</h3>
1.1       grant    13857:                 </div>
                   13858:               </div>
                   13859:             </div>
                   13860: 
                   13861:             <p>If a package provides extensions to the MIME
1.45      wiz      13862:             database by installing <code xmlns=
                   13863:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13864:             "filename">.xml</code> files inside <code xmlns=
                   13865:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13866:             "filename">${PREFIX}/share/mime/packages</code>, you
                   13867:             need to take some extra steps to ensure that the
                   13868:             database is kept consistent with respect to these new
                   13869:             files:</p>
1.1       grant    13870: 
                   13871:             <div class="orderedlist">
                   13872:               <ol type="1">
                   13873:                 <li>
1.45      wiz      13874:                   <p>Include <code xmlns=
                   13875:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13876:                   "filename">../../databases/shared-mime-info/mimedb.mk</code>
1.45      wiz      13877:                   (avoid using the <code xmlns=
                   13878:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13879:                   "filename">buildlink3.mk</code> file from this
                   13880:                   same directory, which is reserved for inclusion
1.45      wiz      13881:                   from other <code xmlns=
                   13882:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13883:                   "filename">buildlink3.mk</code> files). It takes
                   13884:                   care of rebuilding the MIME database at
                   13885:                   installation and deinstallation time, and
                   13886:                   disallows any access to it directly from the
1.1       grant    13887:                   package.</p>
                   13888:                 </li>
                   13889: 
                   13890:                 <li>
                   13891:                   <p>Check the PLIST and remove any entries under
1.45      wiz      13892:                   the <code xmlns=
                   13893:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13894:                   "filename">share/mime</code> directory,
                   13895:                   <span class="emphasis"><em>except</em></span> for
                   13896:                   files saved under <code xmlns=
                   13897:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13898:                   "filename">share/mime/packages</code>. The former
1.1       grant    13899:                   are handled automatically by the
1.47      reed     13900:                   update-mime-database program, but the latter are
1.1       grant    13901:                   package-dependent and must be removed by the
                   13902:                   package that installed them in the first
                   13903:                   place.</p>
                   13904:                 </li>
                   13905: 
                   13906:                 <li>
1.45      wiz      13907:                   <p>Remove any <code xmlns=
                   13908:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13909:                   "filename">share/mime/*</code> directories from
                   13910:                   the PLIST. They will be handled by the
1.1       grant    13911:                   shared-mime-info package.</p>
                   13912:                 </li>
                   13913:               </ol>
                   13914:             </div>
                   13915:           </div>
                   13916: 
1.59    ! rillig   13917:           <div class="sect2" lang="en" xml:lang="en">
1.1       grant    13918:             <div class="titlepage">
                   13919:               <div>
                   13920:                 <div>
1.59    ! rillig   13921:                   <h3 class="title"><a name="intltool" id=
1.57      minskim  13922:                   "intltool"></a>15.5.15.&nbsp;Packages using
1.1       grant    13923:                   intltool</h3>
                   13924:                 </div>
                   13925:               </div>
                   13926:             </div>
                   13927: 
                   13928:             <p>If a package uses intltool during its build, include
1.45      wiz      13929:             the <code xmlns=
                   13930:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13931:             "filename">../../textproc/intltool/buildlink3.mk</code>
1.1       grant    13932:             file, which forces it to use the intltool package
                   13933:             provided by pkgsrc, instead of the one bundled with the
                   13934:             distribution file.</p>
                   13935: 
                   13936:             <p>This tracks intltool's build-time dependencies and
                   13937:             uses the latest available version; this way, the
                   13938:             package benefits of any bug fixes that may have
                   13939:             appeared since it was released.</p>
                   13940:           </div>
1.18      xtraeme  13941: 
1.59    ! rillig   13942:           <div class="sect2" lang="en" xml:lang="en">
1.18      xtraeme  13943:             <div class="titlepage">
                   13944:               <div>
                   13945:                 <div>
1.59    ! rillig   13946:                   <h3 class="title"><a name="startup-scripts" id=
1.57      minskim  13947:                   "startup-scripts"></a>15.5.16.&nbsp;Packages
1.30      wiz      13948:                   installing startup scripts</h3>
1.18      xtraeme  13949:                 </div>
                   13950:               </div>
                   13951:             </div>
                   13952: 
                   13953:             <p>If a package contains a rc.d script, it won't be
                   13954:             copied into the startup directory by default, but you
                   13955:             can enable it, by adding the option <code class=
1.45      wiz      13956:             "varname">PKG_RCD_SCRIPTS=YES</code> in <code xmlns=
                   13957:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.18      xtraeme  13958:             "filename">/etc/mk.conf</code>. This option will copy
1.45      wiz      13959:             the scripts into <code xmlns=
                   13960:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.18      xtraeme  13961:             "filename">/etc/rc.d</code> when a package is
                   13962:             installed, and it will automatically remove the scripts
                   13963:             when the package is deinstalled.</p>
                   13964:           </div>
1.57      minskim  13965: 
1.59    ! rillig   13966:           <div class="sect2" lang="en" xml:lang="en">
1.57      minskim  13967:             <div class="titlepage">
                   13968:               <div>
                   13969:                 <div>
1.59    ! rillig   13970:                   <h3 class="title"><a name="tex-packages" id=
1.57      minskim  13971:                   "tex-packages"></a>15.5.17.&nbsp;Packages
                   13972:                   installing TeX modules</h3>
                   13973:                 </div>
                   13974:               </div>
                   13975:             </div>
                   13976: 
                   13977:             <p>If a package installs TeX packages into the texmf
                   13978:             tree, the <code xmlns=
                   13979:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13980:             "filename">ls-R</code> database of the tree needs to be
                   13981:             updated.</p>
                   13982: 
                   13983:             <div class="note" style=
                   13984:             "margin-left: 0.5in; margin-right: 0.5in;">
                   13985:               <h3 class="title">Note</h3>
                   13986: 
                   13987:               <p>Except the main TeX packages such as teTeX-texmf,
                   13988:               packages should install files into <code class=
                   13989:               "varname">PKG_LOCALTEXMFPREFIX</code>, not
                   13990:               <code class="varname">PKG_TEXMFPREFIX</code>.</p>
                   13991:             </div>
                   13992: 
                   13993:             <div class="orderedlist">
                   13994:               <ol type="1">
                   13995:                 <li>
                   13996:                   <p>Include <code xmlns=
                   13997:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13998:                   "filename">../../print/teTeX/module.mk</code>
                   13999:                   instead of <code xmlns=
                   14000:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14001:                   "filename">../../mk/tex.buildlink3.mk</code>.
                   14002:                   This takes care of rebuilding the <code xmlns=
                   14003:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14004:                   "filename">ls-R</code> database at installation
                   14005:                   and deinstallation time.</p>
                   14006:                 </li>
                   14007: 
                   14008:                 <li>
                   14009:                   <p>If your package installs files into a texmf
                   14010:                   tree other than the one at <code class=
                   14011:                   "varname">PKG_LOCALTEXMFPREFIX</code>, set
                   14012:                   <code class="varname">TEXMFDIRS</code> to the
                   14013:                   list of all texmf trees that need database
                   14014:                   update.</p>
                   14015:                 </li>
                   14016: 
                   14017:                 <li>
                   14018:                   <p>Make sure that none of <code xmlns=
                   14019:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14020:                   "filename">ls-R</code> databases are included in
                   14021:                   <code xmlns=
                   14022:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14023:                   "filename">PLIST</code>, as they will be removed
                   14024:                   only by the teTeX-bin package.</p>
                   14025:                 </li>
                   14026:               </ol>
                   14027:             </div>
                   14028:           </div>
1.1       grant    14029:         </div>
                   14030: 
1.59    ! rillig   14031:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    14032:           <div class="titlepage">
                   14033:             <div>
                   14034:               <div>
                   14035:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   14036:                 "feedback-to-author" id=
1.38      dillo    14037:                 "feedback-to-author"></a>15.6.&nbsp;Feedback to the
1.30      wiz      14038:                 author</h2>
1.1       grant    14039:               </div>
                   14040:             </div>
                   14041:           </div>
                   14042: 
                   14043:           <p>If you have found any bugs in the package you make
                   14044:           available, if you had to do special steps to make it run
                   14045:           under NetBSD or if you enhanced the software in various
                   14046:           other ways, be sure to report these changes back to the
                   14047:           original author of the program! With that kind of
                   14048:           support, the next release of the program can incorporate
                   14049:           these fixes, and people not using the NetBSD packages
                   14050:           system can win from your efforts.</p>
                   14051: 
                   14052:           <p>Support the idea of free software!</p>
                   14053:         </div>
                   14054:       </div>
                   14055: 
1.59    ! rillig   14056:       <div class="chapter" lang="en" xml:lang="en">
1.1       grant    14057:         <div class="titlepage">
                   14058:           <div>
                   14059:             <div>
1.59    ! rillig   14060:               <h2 class="title"><a name="debug" id=
1.38      dillo    14061:               "debug"></a>Chapter&nbsp;16.&nbsp;Debugging</h2>
1.1       grant    14062:             </div>
                   14063:           </div>
                   14064:         </div>
                   14065: 
                   14066:         <p>To check out all the gotchas when building a package,
                   14067:         here are the steps that I do in order to get a package
                   14068:         working. Please note this is basically the same as what was
                   14069:         explained in the previous sections, only with some
                   14070:         debugging aids.</p>
                   14071: 
                   14072:         <div class="itemizedlist">
                   14073:           <ul type="disc">
                   14074:             <li>
1.14      xtraeme  14075:               <p>Be sure to set <code class=
1.45      wiz      14076:               "varname">PKG_DEVELOPER=1</code> in <code xmlns=
                   14077:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14078:               "filename">/etc/mk.conf</code></p>
1.1       grant    14079:             </li>
                   14080: 
                   14081:             <li>
                   14082:               <p>Install <a xmlns=
                   14083:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   14084:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45      wiz      14085:               target="_top"><code xmlns="" class=
                   14086:               "filename">pkgtools/url2pkg</code></a>, create a
1.20      ben      14087:               directory for a new package, change into it, then run
                   14088:               <span><strong class=
                   14089:               "command">url2pkg</strong></span>:</p>
1.1       grant    14090:               <pre class="screen">
1.14      xtraeme  14091: <code class="prompt">%</code> <strong class=
                   14092: "userinput"><code>mkdir /usr/pkgsrc/<em class=
                   14093: "replaceable"><code>category</code></em>/<em class=
                   14094: "replaceable"><code>examplepkg</code></em></code></strong>
                   14095: <code class="prompt">%</code> <strong class=
                   14096: "userinput"><code>cd /usr/pkgsrc/<em class=
                   14097: "replaceable"><code>category</code></em>/<em class=
                   14098: "replaceable"><code>examplepkg</code></em></code></strong>
                   14099: <code class="prompt">%</code> <strong class=
                   14100: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1       grant    14101: </pre>
                   14102:             </li>
                   14103: 
                   14104:             <li>
1.45      wiz      14105:               <p>Edit the <code xmlns=
                   14106:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14107:               "filename">Makefile</code> as requested.</p>
1.1       grant    14108:             </li>
                   14109: 
                   14110:             <li>
1.45      wiz      14111:               <p>Fill in the <code xmlns=
                   14112:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14113:               "filename">DESCR</code> file</p>
1.1       grant    14114:             </li>
                   14115: 
                   14116:             <li>
1.14      xtraeme  14117:               <p>Run <span><strong class="command">make
                   14118:               configure</strong></span></p>
1.1       grant    14119:             </li>
                   14120: 
                   14121:             <li>
                   14122:               <p>Add any dependencies glimpsed from documentation
1.45      wiz      14123:               and the configure step to the package's <code xmlns=
                   14124:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14125:               "filename">Makefile</code>.</p>
1.1       grant    14126:             </li>
                   14127: 
                   14128:             <li>
                   14129:               <p>Make the package compile, doing multiple rounds
                   14130:               of</p>
                   14131:               <pre class="screen">
1.14      xtraeme  14132: <code class="prompt">%</code> <strong class=
                   14133: "userinput"><code>make</code></strong>
                   14134: <code class="prompt">%</code> <strong class=
                   14135: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
                   14136: <code class="prompt">%</code> <strong class=
                   14137: "userinput"><code>mkpatches</code></strong>
                   14138: <code class="prompt">%</code> <strong class=
                   14139: "userinput"><code>patchdiff</code></strong>
                   14140: <code class="prompt">%</code> <strong class=
                   14141: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
                   14142: <code class="prompt">%</code> <strong class=
                   14143: "userinput"><code>make mps</code></strong>
                   14144: <code class="prompt">%</code> <strong class=
                   14145: "userinput"><code>make clean</code></strong>
1.1       grant    14146: </pre>
                   14147: 
                   14148:               <p>Doing as non-root user will ensure that no files
                   14149:               are modified that shouldn't be, especially during the
1.14      xtraeme  14150:               build phase. <span><strong class=
                   14151:               "command">mkpatches</strong></span>,
                   14152:               <span><strong class=
                   14153:               "command">patchdiff</strong></span> and
                   14154:               <span><strong class="command">pkgvi</strong></span>
                   14155:               are from the <a xmlns=
1.1       grant    14156:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   14157:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45      wiz      14158:               target="_top"><code xmlns="" class=
                   14159:               "filename">pkgtools/pkgdiff</code></a> package.</p>
1.1       grant    14160:             </li>
                   14161: 
                   14162:             <li>
1.45      wiz      14163:               <p>Look at the <code xmlns=
                   14164:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14165:               "filename">Makefile</code>, fix if necessary; see
                   14166:               <a href="#components.Makefile" title=
1.38      dillo    14167:               "8.1.&nbsp;Makefile">Section&nbsp;8.1,
1.45      wiz      14168:               &#8220;<code xmlns=
                   14169:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14170:               "filename">Makefile</code>&#8221;</a>.</p>
1.1       grant    14171:             </li>
                   14172: 
                   14173:             <li>
1.45      wiz      14174:               <p>Generate a <code xmlns=
                   14175:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14176:               "filename">PLIST</code>:</p>
1.1       grant    14177:               <pre class="screen">
1.14      xtraeme  14178: <code class="prompt">#</code> <strong class=
                   14179: "userinput"><code>make install</code></strong>
                   14180: <code class="prompt">#</code> <strong class=
                   14181: "userinput"><code>make print-PLIST &gt;PLIST</code></strong>
                   14182: <code class="prompt">#</code> <strong class=
                   14183: "userinput"><code>make deinstall</code></strong>
                   14184: <code class="prompt">#</code> <strong class=
                   14185: "userinput"><code>make install</code></strong>
                   14186: <code class="prompt">#</code> <strong class=
                   14187: "userinput"><code>make deinstall</code></strong>
1.1       grant    14188: </pre>
                   14189: 
1.45      wiz      14190:               <p>You usually need to be <code xmlns=
                   14191:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14192:               "username">root</code> to do this. Look if there are
1.1       grant    14193:               any files left:</p>
                   14194:               <pre class="screen">
1.14      xtraeme  14195: <code class="prompt">#</code> <strong class=
                   14196: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    14197: </pre>
                   14198: 
                   14199:               <p>If this reveals any files that are missing in
1.45      wiz      14200:               <code xmlns=
                   14201:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14202:               "filename">PLIST</code>, add them.</p>
1.1       grant    14203:             </li>
                   14204: 
                   14205:             <li>
1.45      wiz      14206:               <p>Now that the <code xmlns=
                   14207:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14208:               "filename">PLIST</code> is OK, install the package
                   14209:               again and make a binary package:</p>
1.1       grant    14210:               <pre class="screen">
1.14      xtraeme  14211: <code class="prompt">#</code> <strong class=
                   14212: "userinput"><code>make reinstall</code></strong>
                   14213: <code class="prompt">#</code> <strong class=
                   14214: "userinput"><code>make package</code></strong>
1.1       grant    14215: </pre>
                   14216:             </li>
                   14217: 
                   14218:             <li>
                   14219:               <p>Delete the installed package:</p>
                   14220:               <pre class="screen">
1.14      xtraeme  14221: <code class="prompt">#</code> <strong class=
                   14222: "userinput"><code>pkg_delete blub</code></strong>
1.1       grant    14223: </pre>
                   14224:             </li>
                   14225: 
                   14226:             <li>
1.14      xtraeme  14227:               <p>Repeat the above <span><strong class=
                   14228:               "command">make print-PLIST</strong></span> command,
                   14229:               which shouldn't find anything now:</p>
1.1       grant    14230:               <pre class="screen">
1.14      xtraeme  14231: <code class="prompt">#</code> <strong class=
                   14232: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    14233: </pre>
                   14234:             </li>
                   14235: 
                   14236:             <li>
                   14237:               <p>Reinstall the binary package:</p>
                   14238:               <pre class="screen">
1.14      xtraeme  14239: <code class="prompt">#</code> <strong class=
                   14240: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1       grant    14241: </pre>
                   14242:             </li>
                   14243: 
                   14244:             <li>
                   14245:               <p>Play with it. Make sure everything works.</p>
                   14246:             </li>
                   14247: 
                   14248:             <li>
1.14      xtraeme  14249:               <p>Run <span><strong class=
                   14250:               "command">pkglint</strong></span> from <a xmlns=
1.1       grant    14251:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   14252:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45      wiz      14253:               target="_top"><code xmlns="" class=
                   14254:               "filename">pkgtools/pkglint</code></a>, and fix the
1.20      ben      14255:               problems it reports:</p>
1.1       grant    14256:               <pre class="screen">
1.14      xtraeme  14257: <code class="prompt">#</code> <strong class=
                   14258: "userinput"><code>pkglint</code></strong>
1.1       grant    14259: </pre>
                   14260:             </li>
                   14261: 
                   14262:             <li>
                   14263:               <p>Submit (or commit, if you have cvs access); see
                   14264:               <a href="#submit" title=
1.38      dillo    14265:               "Chapter&nbsp;17.&nbsp;Submitting and Committing">Chapter&nbsp;17,
1.1       grant    14266:               <i>Submitting and Committing</i></a>.</p>
                   14267:             </li>
                   14268:           </ul>
                   14269:         </div>
                   14270:       </div>
                   14271: 
1.59    ! rillig   14272:       <div class="chapter" lang="en" xml:lang="en">
1.1       grant    14273:         <div class="titlepage">
                   14274:           <div>
                   14275:             <div>
1.59    ! rillig   14276:               <h2 class="title"><a name="submit" id=
1.38      dillo    14277:               "submit"></a>Chapter&nbsp;17.&nbsp;Submitting and
1.1       grant    14278:               Committing</h2>
                   14279:             </div>
                   14280:           </div>
                   14281:         </div>
                   14282: 
                   14283:         <div class="toc">
                   14284:           <p><b>Table of Contents</b></p>
                   14285: 
                   14286:           <dl>
1.30      wiz      14287:             <dt><span class="sect1"><a href=
1.38      dillo    14288:             "#submitting-your-package">17.1. Submitting your
1.30      wiz      14289:             packages</a></span></dt>
1.1       grant    14290: 
1.30      wiz      14291:             <dt><span class="sect1"><a href=
1.41      wiz      14292:             "#general-notes-for-changes">17.2. General notes when
                   14293:             adding, updating, or removing packages</a></span></dt>
                   14294: 
                   14295:             <dt><span class="sect1"><a href=
                   14296:             "#committing-importing">17.3. Committing: Importing a
1.30      wiz      14297:             package into CVS</a></span></dt>
1.1       grant    14298: 
1.30      wiz      14299:             <dt><span class="sect1"><a href=
1.41      wiz      14300:             "#updating-package">17.4. Updating a package to a newer
1.30      wiz      14301:             version</a></span></dt>
1.1       grant    14302: 
1.41      wiz      14303:             <dt><span class="sect1"><a href="#moving-package">17.5.
1.2       hubertf  14304:             Moving a package in pkgsrc</a></span></dt>
1.1       grant    14305:           </dl>
                   14306:         </div>
                   14307: 
1.59    ! rillig   14308:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    14309:           <div class="titlepage">
                   14310:             <div>
                   14311:               <div>
                   14312:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   14313:                 "submitting-your-package" id=
1.38      dillo    14314:                 "submitting-your-package"></a>17.1.&nbsp;Submitting
1.30      wiz      14315:                 your packages</h2>
1.1       grant    14316:               </div>
                   14317:             </div>
                   14318:           </div>
                   14319: 
                   14320:           <p>You have to separate between binary and
                   14321:           &#8220;<span class="quote">normal</span>&#8221; (source)
                   14322:           packages here:</p>
                   14323: 
                   14324:           <div class="itemizedlist">
                   14325:             <ul type="disc">
                   14326:               <li>
                   14327:                 <p>precompiled binary packages</p>
                   14328: 
                   14329:                 <p>Our policy is that we accept binaries only from
                   14330:                 pkgsrc developers to guarantee that the packages
                   14331:                 don't contain any trojan horses etc. This is not to
1.13      hubertf  14332:                 annoy anyone but rather to protect our users!
1.1       grant    14333:                 You're still free to put up your home-made binary
1.13      hubertf  14334:                 packages and tell the world where to get them.
                   14335:                 NetBSD developers doing bulk builds and wanting to
                   14336:                 upload them please see <a href="#bulk-upload"
1.38      dillo    14337:                 title="6.3.8.&nbsp;Uploading results of a bulk build">
                   14338:                 Section&nbsp;6.3.8, &#8220;Uploading results of a
1.13      hubertf  14339:                 bulk build&#8221;</a>.</p>
1.1       grant    14340:               </li>
                   14341: 
                   14342:               <li>
                   14343:                 <p>packages</p>
                   14344: 
                   14345:                 <p>First, check that your package is complete,
                   14346:                 compiles and runs well; see <a href="#debug" title=
1.38      dillo    14347:                 "Chapter&nbsp;16.&nbsp;Debugging">Chapter&nbsp;16,
1.1       grant    14348:                 <i>Debugging</i></a> and the rest of this document.
1.24      wiz      14349:                 Next, generate an uuencoded gzipped <a href=
                   14350:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   14351:                 <span class="citerefentry"><span class=
                   14352:                 "refentrytitle">tar</span>(1)</span></a> archive,
1.1       grant    14353:                 preferably with all files in a single directory.
1.14      xtraeme  14354:                 Finally, <span><strong class=
                   14355:                 "command">send-pr</strong></span> with category
1.1       grant    14356:                 &#8220;<span class="quote">pkg</span>&#8221;, a
                   14357:                 synopsis which includes the package name and
                   14358:                 version number, a short description of your package
                   14359:                 (contents of the COMMENT variable or DESCR file are
                   14360:                 OK) and attach the archive to your PR.</p>
                   14361: 
                   14362:                 <p>If you want to submit several packages, please
                   14363:                 send a separate PR for each one, it's easier for us
                   14364:                 to track things that way.</p>
                   14365: 
                   14366:                 <p>Alternatively, you can also import new packages
                   14367:                 into pkgsrc-wip (&#8220;<span class="quote">pkgsrc
                   14368:                 work-in-progress</span>&#8221;); see the homepage
                   14369:                 at <a href="http://pkgsrc-wip.sourceforge.net/"
                   14370:                 target=
                   14371:                 "_top">http://pkgsrc-wip.sourceforge.net/</a> for
                   14372:                 details.</p>
                   14373:               </li>
                   14374:             </ul>
                   14375:           </div>
                   14376:         </div>
                   14377: 
1.59    ! rillig   14378:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    14379:           <div class="titlepage">
                   14380:             <div>
                   14381:               <div>
                   14382:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   14383:                 "general-notes-for-changes" id=
1.41      wiz      14384:                 "general-notes-for-changes"></a>17.2.&nbsp;General
                   14385:                 notes when adding, updating, or removing
                   14386:                 packages</h2>
                   14387:               </div>
                   14388:             </div>
                   14389:           </div>
                   14390: 
                   14391:           <p>Please note all package additions, updates, moves, and
1.45      wiz      14392:           removals in <code xmlns=
                   14393:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      14394:           "filename">pkgsrc/doc/CHANGES</code>. It's very important
                   14395:           to keep this file up to date and conforming to the
                   14396:           existing format, because it will be used by scripts to
                   14397:           automatically update pages on <a href=
                   14398:           "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
1.45      wiz      14399:           and other sites. Additionally, check the <code xmlns=
                   14400:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      14401:           "filename">pkgsrc/doc/TODO</code> file and remove the
                   14402:           entry for the package you updated or removed, in case it
                   14403:           was mentioned there.</p>
                   14404: 
                   14405:           <p>There is a make target that helps in creating proper
1.45      wiz      14406:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   14407:           class="filename">CHANGES</code> entries:
1.41      wiz      14408:           <span><strong class="command">make
                   14409:           changes-entry</strong></span>. It uses the optional
                   14410:           <code class="varname">CTYPE</code> and <code class=
                   14411:           "varname">NETBSD_LOGIN_NAME</code> variables. The general
1.45      wiz      14412:           usage is to first make sure that your <code xmlns=
                   14413:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      14414:           "filename">CHANGES</code> file is up-to-date (to avoid
                   14415:           having to resolve conflicts later-on) and then to
                   14416:           <span><strong class="command">cd</strong></span> to the
                   14417:           package directory. For package updates,
                   14418:           <span><strong class="command">make
                   14419:           changes-entry</strong></span> is enough. For new
                   14420:           packages, or package moves or removals, set the
                   14421:           <code class="varname">CTYPE</code> variable on the
                   14422:           command line to "Added", "Moved", or "Removed". You can
                   14423:           set <code class="varname">NETBSD_LOGIN_NAME</code> in
1.45      wiz      14424:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   14425:           class="filename">/etc/mk.conf</code> if your local login
                   14426:           name is not the same as your NetBSD login name. Don't
                   14427:           forget to commit the changes to <code xmlns=
                   14428:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      14429:           "filename">pkgsrc/doc/CHANGES</code>!</p>
                   14430:         </div>
                   14431: 
1.59    ! rillig   14432:         <div class="sect1" lang="en" xml:lang="en">
1.41      wiz      14433:           <div class="titlepage">
                   14434:             <div>
                   14435:               <div>
                   14436:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   14437:                 "committing-importing" id=
1.41      wiz      14438:                 "committing-importing"></a>17.3.&nbsp;Committing:
1.30      wiz      14439:                 Importing a package into CVS</h2>
1.1       grant    14440:               </div>
                   14441:             </div>
                   14442:           </div>
                   14443: 
                   14444:           <p>This section is only of interest for pkgsrc developers
                   14445:           with write access to the pkgsrc repository. Please
                   14446:           remember that cvs imports files relative to the current
                   14447:           working directory, and that the pathname that you give
1.14      xtraeme  14448:           the <span><strong class="command">cvs
                   14449:           import</strong></span> command is so that it knows where
                   14450:           to place the files in the repository. Newly created
                   14451:           packages should be imported with a vendor tag of
                   14452:           &#8220;<span class="quote">TNF</span>&#8221; and a
                   14453:           release tag of &#8220;<span class=
                   14454:           "quote">pkgsrc-base</span>&#8221;, e.g:</p>
1.1       grant    14455:           <pre class="programlisting">
1.51      rillig   14456:     <code class="prompt">$</code> cd .../pkgsrc/category/pkgname
                   14457:     <code class=
                   14458: "prompt">$</code> cvs import pkgsrc/category/pkgname TNF pkgsrc-base
1.1       grant    14459: </pre>
                   14460: 
                   14461:           <p>Remember to move the directory from which you imported
                   14462:           out of the way, or cvs will complain the next time you
                   14463:           &#8220;<span class="quote">cvs update</span>&#8221; your
                   14464:           source tree. Also don't forget to add the new package to
1.45      wiz      14465:           the category's <code xmlns=
                   14466:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14467:           "filename">Makefile</code>.</p>
1.1       grant    14468: 
                   14469:           <p>The commit message of the initial import should
1.45      wiz      14470:           include part of the <code xmlns=
                   14471:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   14472:           "filename">DESCR</code> file, so people reading the
                   14473:           mailing lists know what the package is/does.</p>
1.1       grant    14474: 
                   14475:           <p>For new packages, &#8220;<span class="quote">cvs
                   14476:           import</span>&#8221; is preferred to &#8220;<span class=
                   14477:           "quote">cvs add</span>&#8221; because the former gets
                   14478:           everything with a single command, and provides a
                   14479:           consistent tag.</p>
                   14480:         </div>
                   14481: 
1.59    ! rillig   14482:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    14483:           <div class="titlepage">
                   14484:             <div>
                   14485:               <div>
                   14486:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   14487:                 "updating-package" id=
1.41      wiz      14488:                 "updating-package"></a>17.4.&nbsp;Updating a
1.30      wiz      14489:                 package to a newer version</h2>
1.1       grant    14490:               </div>
                   14491:             </div>
                   14492:           </div>
                   14493: 
                   14494:           <p>Please always put a concise, appropriate and relevant
                   14495:           summary of the changes between old and new versions into
                   14496:           the commit log when updating a package. There are various
                   14497:           reasons for this:</p>
                   14498: 
                   14499:           <div class="itemizedlist">
                   14500:             <ul type="disc">
                   14501:               <li>
                   14502:                 <p>A URL is volatile, and can change over time. It
                   14503:                 may go away completely or its information may be
                   14504:                 overwritten by newer information.</p>
                   14505:               </li>
                   14506: 
                   14507:               <li>
                   14508:                 <p>Having the change information between old and
                   14509:                 new versions in our CVS repository is very useful
                   14510:                 for people who use either cvs or anoncvs.</p>
                   14511:               </li>
                   14512: 
                   14513:               <li>
                   14514:                 <p>Having the change information between old and
                   14515:                 new versions in our CVS repository is very useful
                   14516:                 for people who read the pkgsrc-changes mailing
                   14517:                 list, so that they can make tactical decisions
                   14518:                 about when to upgrade the package.</p>
                   14519:               </li>
                   14520:             </ul>
                   14521:           </div>
                   14522: 
1.18      xtraeme  14523:           <p>Please also recognize that, just because a new version
1.1       grant    14524:           of a package has been released, it should not
                   14525:           automatically be upgraded in the CVS repository. We
                   14526:           prefer to be conservative in the packages that are
                   14527:           included in pkgsrc - development or beta packages are not
                   14528:           really the best thing for most places in which pkgsrc is
                   14529:           used. Please use your judgement about what should go into
                   14530:           pkgsrc, and bear in mind that stability is to be
                   14531:           preferred above new and possibly untested features.</p>
                   14532:         </div>
                   14533: 
1.59    ! rillig   14534:         <div class="sect1" lang="en" xml:lang="en">
1.1       grant    14535:           <div class="titlepage">
                   14536:             <div>
                   14537:               <div>
                   14538:                 <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   14539:                 "moving-package" id=
1.41      wiz      14540:                 "moving-package"></a>17.5.&nbsp;Moving a package in
1.30      wiz      14541:                 pkgsrc</h2>
1.1       grant    14542:               </div>
                   14543:             </div>
                   14544:           </div>
                   14545: 
                   14546:           <div class="orderedlist">
                   14547:             <ol type="1">
                   14548:               <li>
                   14549:                 <p>Make a copy of the directory somewhere else.</p>
                   14550:               </li>
                   14551: 
                   14552:               <li>
                   14553:                 <p>Remove all CVS dirs.</p>
                   14554: 
                   14555:                 <p>Alternatively to the first two steps you can
                   14556:                 also do:</p>
                   14557:                 <pre class="screen">
1.14      xtraeme  14558: <code class="prompt">%</code> <strong class=
                   14559: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1       grant    14560: </pre>
                   14561: 
                   14562:                 <p>and use that for further work.</p>
                   14563:               </li>
                   14564: 
                   14565:               <li>
1.14      xtraeme  14566:                 <p>Fix <code class="varname">CATEGORIES</code> and
                   14567:                 any <code class="varname">DEPENDS</code> paths that
                   14568:                 just did &#8220;<span class=
1.1       grant    14569:                 "quote">../package</span>&#8221; instead of
                   14570:                 &#8220;<span class=
                   14571:                 "quote">../../category/package</span>&#8221;.</p>
                   14572:               </li>
                   14573: 
                   14574:               <li>
1.14      xtraeme  14575:                 <p><span><strong class="command">cvs
                   14576:                 import</strong></span> the modified package in the
                   14577:                 new place.</p>
1.1       grant    14578:               </li>
                   14579: 
                   14580:               <li>
                   14581:                 <p>Check if any package depends on it:</p>
                   14582:                 <pre class="screen">
1.14      xtraeme  14583: <code class="prompt">%</code> <strong class=
                   14584: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   14585: <code class="prompt">%</code> <strong class=
                   14586: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1       grant    14587: </pre>
                   14588:               </li>
                   14589: 
                   14590:               <li>
                   14591:                 <p>Fix paths in packages from step 5 to point to
                   14592:                 new location.</p>
                   14593:               </li>
                   14594: 
                   14595:               <li>
1.14      xtraeme  14596:                 <p><span><strong class="command">cvs rm
                   14597:                 (-f)</strong></span> the package at the old
                   14598:                 location.</p>
1.1       grant    14599:               </li>
                   14600: 
                   14601:               <li>
1.45      wiz      14602:                 <p>Remove from <code xmlns=
                   14603:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14604:                 "filename">oldcategory/Makefile</code>.</p>
1.1       grant    14605:               </li>
                   14606: 
                   14607:               <li>
1.45      wiz      14608:                 <p>Add to <code xmlns=
                   14609:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14610:                 "filename">newcategory/Makefile</code>.</p>
1.1       grant    14611:               </li>
                   14612: 
                   14613:               <li>
                   14614:                 <p>Commit the changed and removed files:</p>
                   14615:                 <pre class="screen">
1.14      xtraeme  14616: <code class="prompt">%</code> <strong class=
                   14617: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1       grant    14618: </pre>
                   14619: 
                   14620:                 <p>(and any packages from step 5, of course).</p>
                   14621:               </li>
                   14622:             </ol>
                   14623:           </div>
                   14624:         </div>
                   14625:       </div>
                   14626:     </div>
                   14627: 
1.59    ! rillig   14628:     <div class="appendix" lang="en" xml:lang="en">
1.1       grant    14629:       <div class="titlepage">
                   14630:         <div>
                   14631:           <div>
1.59    ! rillig   14632:             <h2 class="title"><a name="examples" id=
1.46      gdt      14633:             "examples"></a>Appendix&nbsp;A.&nbsp;A simple example
1.1       grant    14634:             package: bison</h2>
                   14635:           </div>
                   14636:         </div>
                   14637:       </div>
                   14638: 
                   14639:       <div class="toc">
                   14640:         <p><b>Table of Contents</b></p>
                   14641: 
                   14642:         <dl>
1.46      gdt      14643:           <dt><span class="sect1"><a href="#example-files">A.1.
1.1       grant    14644:           files</a></span></dt>
                   14645: 
                   14646:           <dd>
                   14647:             <dl>
1.30      wiz      14648:               <dt><span class="sect2"><a href=
1.46      gdt      14649:               "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1       grant    14650: 
1.30      wiz      14651:               <dt><span class="sect2"><a href=
1.46      gdt      14652:               "#example-descr">A.1.2. DESCR</a></span></dt>
1.1       grant    14653: 
1.30      wiz      14654:               <dt><span class="sect2"><a href=
1.46      gdt      14655:               "#example-plist">A.1.3. PLIST</a></span></dt>
1.1       grant    14656: 
1.30      wiz      14657:               <dt><span class="sect2"><a href=
1.46      gdt      14658:               "#checking-package-with-pkglint">A.1.4. Checking a
1.30      wiz      14659:               package with <span><strong class=
1.14      xtraeme  14660:               "command">pkglint</strong></span></a></span></dt>
1.1       grant    14661:             </dl>
                   14662:           </dd>
                   14663: 
1.46      gdt      14664:           <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30      wiz      14665:           Steps for building, installing, packaging</a></span></dt>
1.1       grant    14666:         </dl>
                   14667:       </div>
                   14668: 
                   14669:       <p>We checked to find a piece of software that wasn't in the
                   14670:       packages collection, and picked GNU bison. Quite why someone
1.14      xtraeme  14671:       would want to have <span><strong class=
                   14672:       "command">bison</strong></span> when Berkeley
                   14673:       <span><strong class="command">yacc</strong></span> is already
                   14674:       present in the tree is beyond us, but it's useful for the
                   14675:       purposes of this exercise.</p>
1.1       grant    14676: 
1.59    ! rillig   14677:       <div class="sect1" lang="en" xml:lang="en">
1.1       grant    14678:         <div class="titlepage">
                   14679:           <div>
                   14680:             <div>
                   14681:               <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   14682:               "example-files" id=
1.46      gdt      14683:               "example-files"></a>A.1.&nbsp;files</h2>
1.1       grant    14684:             </div>
                   14685:           </div>
                   14686:         </div>
                   14687: 
1.59    ! rillig   14688:         <div class="sect2" lang="en" xml:lang="en">
1.1       grant    14689:           <div class="titlepage">
                   14690:             <div>
                   14691:               <div>
1.59    ! rillig   14692:                 <h3 class="title"><a name="example-Makefile" id=
1.46      gdt      14693:                 "example-Makefile"></a>A.1.1.&nbsp;Makefile</h3>
1.1       grant    14694:               </div>
                   14695:             </div>
                   14696:           </div>
                   14697:           <pre class="programlisting">
1.51      rillig   14698:     # $NetBSD$
                   14699:     #
1.1       grant    14700: 
1.51      rillig   14701:     DISTNAME=       bison-1.25
                   14702:     CATEGORIES=     devel
                   14703:     MASTER_SITES=   ${MASTER_SITE_GNU}
1.1       grant    14704: 
1.51      rillig   14705:     MAINTAINER=     thorpej@NetBSD.org
                   14706:     HOMEPAGE=       http://www.gnu.org/software/bison/bison.html
                   14707:     COMMENT=        GNU yacc clone
1.1       grant    14708: 
1.51      rillig   14709:     GNU_CONFIGURE=  yes
                   14710:     INFO_FILES=     bison.info
1.1       grant    14711: 
1.51      rillig   14712:     .include "../../mk/bsd.pkg.mk"
1.1       grant    14713: </pre>
                   14714:         </div>
                   14715: 
1.59    ! rillig   14716:         <div class="sect2" lang="en" xml:lang="en">
1.1       grant    14717:           <div class="titlepage">
                   14718:             <div>
                   14719:               <div>
1.59    ! rillig   14720:                 <h3 class="title"><a name="example-descr" id=
1.46      gdt      14721:                 "example-descr"></a>A.1.2.&nbsp;DESCR</h3>
1.1       grant    14722:               </div>
                   14723:             </div>
                   14724:           </div>
                   14725:           <pre class="programlisting">
1.51      rillig   14726:     GNU version of yacc.  Can make re-entrant parsers, and numerous other
                   14727:     improvements.  Why you would want this when Berkeley <a href=
1.1       grant    14728: "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   14729:     of the NetBSD source tree is beyond me.
1.1       grant    14730: </pre>
                   14731:         </div>
                   14732: 
1.59    ! rillig   14733:         <div class="sect2" lang="en" xml:lang="en">
1.1       grant    14734:           <div class="titlepage">
                   14735:             <div>
                   14736:               <div>
1.59    ! rillig   14737:                 <h3 class="title"><a name="example-plist" id=
1.46      gdt      14738:                 "example-plist"></a>A.1.3.&nbsp;PLIST</h3>
1.1       grant    14739:               </div>
                   14740:             </div>
                   14741:           </div>
                   14742:           <pre class="programlisting">
1.51      rillig   14743:     @comment $NetBSD$
                   14744:     bin/bison
                   14745:     man/man1/bison.1.gz
                   14746:     share/bison.simple
                   14747:     share/bison.hairy
1.1       grant    14748: </pre>
                   14749:         </div>
                   14750: 
1.59    ! rillig   14751:         <div class="sect2" lang="en" xml:lang="en">
1.1       grant    14752:           <div class="titlepage">
                   14753:             <div>
                   14754:               <div>
1.30      wiz      14755:                 <h3 class="title"><a name=
1.59    ! rillig   14756:                 "checking-package-with-pkglint" id=
1.46      gdt      14757:                 "checking-package-with-pkglint"></a>A.1.4.&nbsp;Checking
1.30      wiz      14758:                 a package with <span><strong class=
1.14      xtraeme  14759:                 "command">pkglint</strong></span></h3>
1.1       grant    14760:               </div>
                   14761:             </div>
                   14762:           </div>
                   14763: 
                   14764:           <p>The NetBSD package system comes with <a xmlns=
                   14765:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   14766:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45      wiz      14767:           target="_top"><code xmlns="" class=
                   14768:           "filename">pkgtools/pkglint</code></a> which helps to
                   14769:           check the contents of these files. After installation it
                   14770:           is quite easy to use, just change to the directory of the
1.20      ben      14771:           package you wish to examine and execute
                   14772:           <span><strong class=
                   14773:           "command">pkglint</strong></span>:</p>
1.1       grant    14774:           <pre class="screen">
1.14      xtraeme  14775: <code class="prompt">$</code> <strong class=
                   14776: "userinput"><code>pkglint</code></strong>
1.1       grant    14777: looks fine.
                   14778: </pre>
                   14779: 
                   14780:           <p>Depending on the supplied command line arguments (see
1.47      reed     14781:           pkglint(1)), more verbose checks will be performed. Use
1.14      xtraeme  14782:           e.g. <span><strong class="command">pkglint
                   14783:           -v</strong></span> for a very verbose check.</p>
1.1       grant    14784:         </div>
                   14785:       </div>
                   14786: 
1.59    ! rillig   14787:       <div class="sect1" lang="en" xml:lang="en">
1.1       grant    14788:         <div class="titlepage">
                   14789:           <div>
                   14790:             <div>
                   14791:               <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   14792:               "steps-for-b-i-p" id=
1.46      gdt      14793:               "steps-for-b-i-p"></a>A.2.&nbsp;Steps for building,
1.30      wiz      14794:               installing, packaging</h2>
1.1       grant    14795:             </div>
                   14796:           </div>
                   14797:         </div>
                   14798: 
                   14799:         <p>Create the directory where the package lives, plus any
                   14800:         auxiliary directories:</p>
                   14801:         <pre class="screen">
1.14      xtraeme  14802: <code class="prompt">#</code> <strong class=
                   14803: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
                   14804: <code class="prompt">#</code> <strong class=
                   14805: "userinput"><code>mkdir bison</code></strong>
                   14806: <code class="prompt">#</code> <strong class=
                   14807: "userinput"><code>cd bison</code></strong>
                   14808: <code class="prompt">#</code> <strong class=
                   14809: "userinput"><code>mkdir patches</code></strong>
1.1       grant    14810: </pre>
                   14811: 
1.45      wiz      14812:         <p>Create <code xmlns=
                   14813:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   14814:         "filename">Makefile</code>, <code xmlns=
                   14815:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   14816:         "filename">DESCR</code> and <code xmlns=
                   14817:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14818:         "filename">PLIST</code> (see <a href="#components" title=
1.38      dillo    14819:         "Chapter&nbsp;8.&nbsp;Package components - files, directories and contents">
1.59    ! rillig   14820:         Chapter 8, <i>Package components - files, directories and
        !          14821:         contents</i></a>) then continue with fetching the
1.1       grant    14822:         distfile:</p>
                   14823:         <pre class="screen">
1.14      xtraeme  14824: <code class="prompt">#</code> <strong class=
                   14825: "userinput"><code>make fetch</code></strong>
1.1       grant    14826: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   14827: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   14828: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   14829: ftp: Error retrieving file: 500 Internal error
                   14830: 
                   14831: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   14832: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   14833: ftp: Error retrieving file: 500 Internal error
                   14834: 
                   14835: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   14836: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   14837: Successfully retrieved file.
                   14838: </pre>
                   14839: 
1.45      wiz      14840:         <p>Generate the checksum of the distfile into <code xmlns=
                   14841:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14842:         "filename">distinfo</code>:</p>
1.1       grant    14843:         <pre class="screen">
1.14      xtraeme  14844: <code class="prompt">#</code> <strong class=
                   14845: "userinput"><code>make makesum</code></strong>
1.1       grant    14846: </pre>
                   14847: 
                   14848:         <p>Now compile:</p>
                   14849:         <pre class="screen">
1.14      xtraeme  14850: <code class="prompt">#</code> <strong class=
                   14851: "userinput"><code>make</code></strong>
1.1       grant    14852: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   14853: ===&gt;  Extracting for bison-1.25
                   14854: ===&gt;  Patching for bison-1.25
                   14855: ===&gt;   Ignoring empty patch directory
                   14856: ===&gt;  Configuring for bison-1.25
                   14857: creating cache ./config.cache
                   14858: checking for gcc... cc
                   14859: checking whether we are using GNU C... yes
                   14860: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   14861: checking how to run the C preprocessor... cc -E
                   14862: checking for minix/config.h... no
                   14863: checking for POSIXized ISC... no
                   14864: checking whether cross-compiling... no
                   14865: checking for ANSI C header files... yes
                   14866: checking for string.h... yes
                   14867: checking for stdlib.h... yes
                   14868: checking for memory.h... yes
                   14869: checking for working const... yes
                   14870: checking for working alloca.h... no
                   14871: checking for alloca... yes
                   14872: checking for strerror... yes
                   14873: updating cache ./config.cache
                   14874: creating ./config.status
                   14875: creating Makefile
                   14876: ===&gt;  Building for bison-1.25
                   14877: 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
                   14878: 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
                   14879: 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
                   14880: 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
                   14881: 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
                   14882: 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 
                   14883: 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
                   14884: 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
                   14885: 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
                   14886: 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
                   14887: 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
                   14888: 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
                   14889: 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
                   14890: 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
                   14891: 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
                   14892: 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
                   14893: 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
                   14894: 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
                   14895: 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
                   14896: 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
                   14897: 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
                   14898: 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
                   14899: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   14900: rm -f bison.s1
                   14901: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1
                   14902: </pre>
                   14903: 
                   14904:         <p>Everything seems OK, so install the files:</p>
                   14905:         <pre class="screen">
1.14      xtraeme  14906: <code class="prompt">#</code> <strong class=
                   14907: "userinput"><code>make install</code></strong>
1.1       grant    14908: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   14909: ===&gt;  Installing for bison-1.25
                   14910: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   14911: rm -f /usr/pkg/bin/bison
                   14912: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   14913: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   14914: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   14915: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   14916: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   14917: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   14918: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
                   14919: ===&gt;  Registering installation for bison-1.25
                   14920: </pre>
                   14921: 
                   14922:         <p>You can now use bison, and also - if you decide so -
1.14      xtraeme  14923:         remove it with <span><strong class="command">pkg_delete
                   14924:         bison</strong></span>. Should you decide that you want a
                   14925:         binary package, do this now:</p>
1.1       grant    14926:         <pre class="screen">
1.14      xtraeme  14927: <code class="prompt">#</code> <strong class=
                   14928: "userinput"><code>make package</code></strong>
1.1       grant    14929: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   14930: ===&gt;  Building package for bison-1.25
                   14931: Creating package bison-1.25.tgz
                   14932: Registering depends:.
                   14933: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
                   14934: </pre>
                   14935: 
                   14936:         <p>Now that you don't need the source and object files any
                   14937:         more, clean up:</p>
                   14938:         <pre class="screen">
1.14      xtraeme  14939: <code class="prompt">#</code> <strong class=
                   14940: "userinput"><code>make clean</code></strong>
1.1       grant    14941: ===&gt;  Cleaning for bison-1.25
                   14942: </pre>
                   14943:       </div>
                   14944:     </div>
                   14945: 
1.59    ! rillig   14946:     <div class="appendix" lang="en" xml:lang="en">
1.1       grant    14947:       <div class="titlepage">
                   14948:         <div>
                   14949:           <div>
1.59    ! rillig   14950:             <h2 class="title"><a name="logs" id=
1.46      gdt      14951:             "logs"></a>Appendix&nbsp;B.&nbsp;Build logs</h2>
1.1       grant    14952:           </div>
                   14953:         </div>
                   14954:       </div>
                   14955: 
                   14956:       <div class="toc">
                   14957:         <p><b>Table of Contents</b></p>
                   14958: 
                   14959:         <dl>
1.46      gdt      14960:           <dt><span class="sect1"><a href="#logs.building">B.1.
1.1       grant    14961:           Building figlet</a></span></dt>
                   14962: 
1.46      gdt      14963:           <dt><span class="sect1"><a href="#logs.package">B.2.
1.1       grant    14964:           Packaging figlet</a></span></dt>
                   14965:         </dl>
                   14966:       </div>
                   14967: 
1.59    ! rillig   14968:       <div class="sect1" lang="en" xml:lang="en">
1.1       grant    14969:         <div class="titlepage">
                   14970:           <div>
                   14971:             <div>
                   14972:               <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   14973:               "logs.building" id=
1.46      gdt      14974:               "logs.building"></a>B.1.&nbsp;Building figlet</h2>
1.1       grant    14975:             </div>
                   14976:           </div>
                   14977:         </div>
                   14978:         <pre class="screen">
1.14      xtraeme  14979: <code class="prompt">#</code> <strong class=
                   14980: "userinput"><code>make</code></strong>
1.1       grant    14981: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   14982: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   14983: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   14984: =&gt; [172219 bytes]
                   14985: Connected to ftp.plig.net.
                   14986: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   14987: 331 Guest login ok, send your complete e-mail address as password.
                   14988: 230-You are user #5 of 500 simultaneous users allowed.
                   14989: 230-
                   14990: 230-  ___ _             _ _                   
                   14991: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___ 
                   14992: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   14993: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   14994: 230-         |_|   |_|     |___|         |___|
                   14995: 230-
                   14996: 230-** Welcome to ftp.plig.org **
                   14997: 230-
                   14998: 230-Please note that all transfers from this FTP site are logged. If you
                   14999: 230-do not like this, please disconnect now.
                   15000: 230-
                   15001: 230-This arhive is available via
                   15002: 230-
                   15003: 230-HTTP:  http://ftp.plig.org/
                   15004: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   15005: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   15006: 230-
                   15007: 230-Please email comments, bug reports and requests for packages to be
                   15008: 230-mirrored to ftp-admin@plig.org.   
                   15009: 230-
                   15010: 230-
                   15011: 230 Logged in anonymously.
                   15012: Remote system type is UNIX.
                   15013: Using binary mode to transfer files.
                   15014: 200 Type okay.
                   15015: 250 "/pub" is new cwd.
                   15016: 250-"/pub/figlet" is new cwd.
                   15017: 250-
                   15018: 250-Welcome to the figlet archive at ftp.figlet.org
                   15019: 250-    
                   15020: 250-    ftp://ftp.figlet.org/pub/figlet/
                   15021: 250-
                   15022: 250-The official FIGlet web page is:
                   15023: 250-    http://www.figlet.org/
                   15024: 250-
                   15025: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   15026: 250-contribute a font or something else, you can email us.
                   15027: 250 
                   15028: 250 "/pub/figlet/program" is new cwd.
                   15029: 250 "/pub/figlet/program/unix" is new cwd.
                   15030: local: figlet221.tar.gz remote: figlet221.tar.gz
                   15031: 502 Unimplemented command.
                   15032: 227 Entering Passive Mode (195,40,6,41,246,104)
                   15033: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   15034: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   15035: 226 Transfer completed.
                   15036: 172219 bytes received in 00:02 (75.99 KB/s)
                   15037: 221 Goodbye.
                   15038: =&gt; Checksum OK for figlet221.tar.gz.
                   15039: ===&gt; Extracting for figlet-2.2.1nb2
                   15040: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   15041: ===&gt; Patching for figlet-2.2.1nb2
                   15042: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   15043: ===&gt; Overriding tools for figlet-2.2.1nb2
                   15044: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   15045: ===&gt; Configuring for figlet-2.2.1nb2
                   15046: ===&gt; Building for figlet-2.2.1nb2
                   15047: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   15048: chmod a+x figlet
                   15049: gcc -O2 -o chkfont chkfont.c
                   15050: =&gt; Unwrapping files-to-be-installed.
1.14      xtraeme  15051: <code class="prompt">#</code>
                   15052: <code class="prompt">#</code> <strong class=
                   15053: "userinput"><code>make install</code></strong>
1.1       grant    15054: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   15055: ===&gt; Installing for figlet-2.2.1nb2
                   15056: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   15057: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   15058: mkdir -p /usr/pkg/share/figlet
                   15059: cp figlet /usr/pkg/bin
                   15060: cp chkfont /usr/pkg/bin
                   15061: chmod 555 figlist showfigfonts
                   15062: cp figlist /usr/pkg/bin
                   15063: cp showfigfonts /usr/pkg/bin
                   15064: cp fonts/*.flf /usr/pkg/share/figlet
                   15065: cp fonts/*.flc /usr/pkg/share/figlet
                   15066: cp figlet.6 /usr/pkg/man/man6
                   15067: ===&gt; Registering installation for figlet-2.2.1nb2
1.14      xtraeme  15068: <code class="prompt">#</code>
1.1       grant    15069: </pre>
                   15070:       </div>
                   15071: 
1.59    ! rillig   15072:       <div class="sect1" lang="en" xml:lang="en">
1.1       grant    15073:         <div class="titlepage">
                   15074:           <div>
                   15075:             <div>
                   15076:               <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   15077:               "logs.package" id=
1.46      gdt      15078:               "logs.package"></a>B.2.&nbsp;Packaging figlet</h2>
1.1       grant    15079:             </div>
                   15080:           </div>
                   15081:         </div>
                   15082:         <pre class="screen">
1.14      xtraeme  15083: <code class="prompt">#</code> <strong class=
                   15084: "userinput"><code>make package</code></strong>
1.1       grant    15085: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   15086: ===&gt; Packaging figlet-2.2.1nb2
                   15087: ===&gt; Building binary package for figlet-2.2.1nb2
                   15088: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   15089: Using SrcDir value of /usr/pkg
                   15090: Registering depends:.  
1.14      xtraeme  15091: <code class="prompt">#</code>
1.1       grant    15092: </pre>
                   15093:       </div>
                   15094:     </div>
                   15095: 
1.59    ! rillig   15096:     <div class="appendix" lang="en" xml:lang="en">
1.1       grant    15097:       <div class="titlepage">
                   15098:         <div>
                   15099:           <div>
1.59    ! rillig   15100:             <h2 class="title"><a name="ftp-layout" id=
1.46      gdt      15101:             "ftp-layout"></a>Appendix&nbsp;C.&nbsp;Layout of the
1.1       grant    15102:             FTP server's package archive</h2>
                   15103:           </div>
                   15104:         </div>
                   15105:       </div>
                   15106: 
                   15107:       <p>Layout for precompiled binary packages on
                   15108:       ftp.NetBSD.org:</p>
                   15109:       <pre class="programlisting">
1.51      rillig   15110:     /pub/NetBSD/packages/
                   15111:         distfiles/
1.1       grant    15112: 
1.51      rillig   15113:         # Unpacked pkgsrc trees
                   15114:         pkgsrc-current -&gt; /pub/NetBSD/NetBSD-current/pkgsrc
                   15115:         pkgsrc-2003Q4 -&gt; N/A
                   15116:         pkgsrc-2004Q1/pkgsrc
                   15117: 
                   15118:         # pkgsrc archives
                   15119:         pkgsrc-current.tar.gz -&gt; ../NetBSD-current/tar_files/pkgsrc.tar.gz
                   15120:         pkgsrc-2003Q4.tar.gz -&gt; N/A
                   15121:         pkgsrc-2004Q1.tar.gz -&gt; N/A
                   15122: 
                   15123:         # Per pkgsrc-release/OS-release/arch package archives
                   15124:         pkgsrc-2003Q4/
                   15125:             NetBSD-1.6.2/
                   15126:                 i386/
                   15127:                     All/
                   15128:                     archivers/
                   15129:                         foo -&gt; ../All/foo
                   15130:                     ...
                   15131:         pkgsrc-2004Q1/
                   15132:             NetBSD-1.6.2/
                   15133:                 i386/
                   15134:                     All/
                   15135:                     ...
                   15136:             NetBSD-2.0/
                   15137:                 i386/
                   15138:                     All/
                   15139:                     ...
                   15140:             SunOS-5.9/
                   15141:                 sparc/
                   15142:                     All/
                   15143:                     ...
                   15144:                 x86/
                   15145:                     All/
                   15146:                     ...
                   15147: 
                   15148:         # Per os-release package archive convenience links
                   15149:         NetBSD-1.6.2 -&gt; 1.6.2
                   15150:         1.6.2/
                   15151:             i386 -&gt; ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
                   15152:             m68k/
                   15153:                 All/
                   15154:                 archivers/
                   15155:                     foo -&gt; ../All/foo
                   15156:                 ...
                   15157:             amiga -&gt; m68k
                   15158:             atari -&gt; m68k
                   15159:             ...
                   15160: 
                   15161:         2.0 -&gt; NetBSD-2.0       # backward compat, historic
                   15162:         NetBSD-2.0/
                   15163:             i386 -&gt; ../pkgsrc-2004Q1/NetBSD-2.0/i386
                   15164:         SunOS-5.9/
                   15165:             sparc -&gt; ../pkgsrc-2004Q1/SunOS-5.9/sparc
                   15166:             x86 -&gt; ../pkgsrc-2004Q1/SunOS-5.9/x86
1.1       grant    15167: </pre>
                   15168: 
                   15169:       <p>To create:</p>
                   15170: 
                   15171:       <div class="orderedlist">
                   15172:         <ol type="1">
                   15173:           <li>
                   15174:             <p>Run bulk build, see <a href="#bulkbuild" title=
1.59    ! rillig   15175:             "6.3.&nbsp;Doing a bulk build of all packages">Section
        !          15176:             6.3, &#8220;Doing a bulk build of all
1.1       grant    15177:             packages&#8221;</a></p>
                   15178:           </li>
                   15179: 
                   15180:           <li>
                   15181:             <p>Upload /usr/pkgsrc/packages to</p>
                   15182:             <pre class="programlisting">
                   15183:     ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.51      rillig   15184:         pkgsrc-2004Q4/\             # pkgsrc-branch
                   15185:         `uname -s`-`uname -r`/\     # OS &amp; version
                   15186:         `uname -p`                  # architecture
1.1       grant    15187: </pre>
                   15188:           </li>
                   15189: 
                   15190:           <li>
1.14      xtraeme  15191:             <p>If necessary, create a symlink <span><strong class=
                   15192:             "command">ln -s `uname -m` `uname -p`</strong></span>
                   15193:             (amiga -&gt; m68k, ...)</p>
1.1       grant    15194:           </li>
                   15195:         </ol>
                   15196:       </div>
                   15197:     </div>
1.2       hubertf  15198: 
1.59    ! rillig   15199:     <div class="appendix" lang="en" xml:lang="en">
1.2       hubertf  15200:       <div class="titlepage">
                   15201:         <div>
                   15202:           <div>
1.59    ! rillig   15203:             <h2 class="title"><a name="editing" id=
1.46      gdt      15204:             "editing"></a>Appendix&nbsp;D.&nbsp;Editing guidelines
1.2       hubertf  15205:             for the pkgsrc guide</h2>
                   15206:           </div>
                   15207:         </div>
                   15208:       </div>
                   15209: 
                   15210:       <div class="toc">
                   15211:         <p><b>Table of Contents</b></p>
                   15212: 
                   15213:         <dl>
1.46      gdt      15214:           <dt><span class="sect1"><a href="#targets">D.1.
1.2       hubertf  15215:           Targets</a></span></dt>
                   15216: 
1.46      gdt      15217:           <dt><span class="sect1"><a href="#procedure">D.2.
1.2       hubertf  15218:           Procedure</a></span></dt>
                   15219:         </dl>
                   15220:       </div>
                   15221: 
                   15222:       <p>This section contains information on editing the pkgsrc
                   15223:       guide itself.</p>
                   15224: 
1.59    ! rillig   15225:       <div class="sect1" lang="en" xml:lang="en">
1.2       hubertf  15226:         <div class="titlepage">
                   15227:           <div>
                   15228:             <div>
                   15229:               <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   15230:               "targets" id="targets"></a>D.1.&nbsp;Targets</h2>
1.2       hubertf  15231:             </div>
                   15232:           </div>
                   15233:         </div>
                   15234: 
1.45      wiz      15235:         <p>The pkgsrc guide's source code is stored in <code xmlns=
                   15236:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15237:         "filename">pkgsrc/doc/guide/files</code>, and several files
1.2       hubertf  15238:         are created from it:</p>
                   15239: 
                   15240:         <div class="itemizedlist">
                   15241:           <ul type="disc">
                   15242:             <li>
1.45      wiz      15243:               <p><code xmlns=
                   15244:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.23      wiz      15245:               "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2       hubertf  15246:             </li>
                   15247: 
                   15248:             <li>
1.45      wiz      15249:               <p><code xmlns=
                   15250:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15251:               "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2       hubertf  15252:             </li>
                   15253: 
                   15254:             <li>
1.45      wiz      15255:               <p><code xmlns=
                   15256:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15257:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2       hubertf  15258:               the documentation on the NetBSD website will be built
                   15259:               from pkgsrc and kept up to date on the web server
                   15260:               itself. This means you <span class=
                   15261:               "emphasis"><em>must</em></span> make sure that your
                   15262:               changes haven't broken the build!</p>
                   15263:             </li>
1.6       hubertf  15264: 
                   15265:             <li>
1.45      wiz      15266:               <p><code xmlns=
                   15267:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15268:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6       hubertf  15269:               PDF version of the pkgsrc guide.</p>
                   15270:             </li>
                   15271: 
                   15272:             <li>
1.45      wiz      15273:               <p><code xmlns=
                   15274:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15275:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6       hubertf  15276:               PostScript version of the pkgsrc guide.</p>
                   15277:             </li>
1.2       hubertf  15278:           </ul>
                   15279:         </div>
                   15280:       </div>
                   15281: 
1.59    ! rillig   15282:       <div class="sect1" lang="en" xml:lang="en">
1.2       hubertf  15283:         <div class="titlepage">
                   15284:           <div>
                   15285:             <div>
                   15286:               <h2 class="title" style="clear: both"><a name=
1.59    ! rillig   15287:               "procedure" id=
1.46      gdt      15288:               "procedure"></a>D.2.&nbsp;Procedure</h2>
1.2       hubertf  15289:             </div>
                   15290:           </div>
                   15291:         </div>
                   15292: 
                   15293:         <p>The procedure to edit the pkgsrc guide is:</p>
                   15294: 
                   15295:         <div class="itemizedlist">
                   15296:           <ul type="disc">
                   15297:             <li>
1.6       hubertf  15298:               <p>Make sure you have the packages needed to
                   15299:               re-generate the pkgsrc guide (and other XML-based
                   15300:               NetBSD documentation) installed. These are
1.11      ben      15301:               &#8220;<span class="quote">netbsd-doc</span>&#8221;
1.47      reed     15302:               for creating the ASCII and HTML versions, and
1.6       hubertf  15303:               &#8220;<span class=
1.47      reed     15304:               "quote">netbsd-doc-print</span>&#8221; for the
                   15305:               PostScript and PDF versions. You will need both
1.6       hubertf  15306:               packages installed, to make sure documentation is
                   15307:               consistent across all formats. The packages can be
1.45      wiz      15308:               found in <code xmlns=
                   15309:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15310:               "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
1.45      wiz      15311:               <code xmlns=
                   15312:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15313:               "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6       hubertf  15314:             </li>
                   15315: 
                   15316:             <li>
1.45      wiz      15317:               <p>Edit the XML file(s) in <code xmlns=
                   15318:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15319:               "filename">pkgsrc/doc/guide/files</code>.</p>
1.2       hubertf  15320:             </li>
                   15321: 
                   15322:             <li>
1.14      xtraeme  15323:               <p>Run <span><strong class="command">make extract
                   15324:               &amp;&amp; make do-lint</strong></span> in
1.45      wiz      15325:               <code xmlns=
                   15326:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   15327:               "filename">pkgsrc/doc/guide</code> to check the XML
                   15328:               syntax, and fix it if needed.</p>
1.4       hubertf  15329:             </li>
                   15330: 
                   15331:             <li>
1.14      xtraeme  15332:               <p>Run <span><strong class=
1.45      wiz      15333:               "command">make</strong></span> in <code xmlns=
                   15334:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15335:               "filename">pkgsrc/doc/guide</code> to build the HTML
                   15336:               and ASCII version.</p>
1.2       hubertf  15337:             </li>
                   15338: 
                   15339:             <li>
1.14      xtraeme  15340:               <p>If all is well, run <span><strong class=
                   15341:               "command">make install-doc</strong></span> to put the
1.45      wiz      15342:               generated files into <code xmlns=
                   15343:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15344:               "filename">pkgsrc/doc</code>.</p>
1.2       hubertf  15345:             </li>
                   15346: 
                   15347:             <li>
1.14      xtraeme  15348:               <p><span><strong class="command">cvs commit
                   15349:               pkgsrc/doc/guide/files</strong></span></p>
1.2       hubertf  15350:             </li>
                   15351: 
                   15352:             <li>
1.14      xtraeme  15353:               <p><span><strong class="command">cvs commit -m
                   15354:               re-generate
                   15355:               pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2       hubertf  15356:             </li>
1.4       hubertf  15357: 
                   15358:             <li>
                   15359:               <p>Until the webserver on www.NetBSD.org is really
                   15360:               updated automatically to pick up changes to the
1.14      xtraeme  15361:               pkgsrc guide automatically, also run
1.18      xtraeme  15362:               <span><strong class="command">make install-htdocs
1.14      xtraeme  15363:               HTDOCSDIR=../../../htdocs</strong></span> (or
                   15364:               similar, adjust <code class=
                   15365:               "varname">HTDOCSDIR</code>!).</p>
1.4       hubertf  15366:             </li>
                   15367: 
                   15368:             <li>
1.14      xtraeme  15369:               <p><span><strong class="command">cvs commit
                   15370:               htdocs/Documentation/pkgsrc</strong></span></p>
1.4       hubertf  15371:             </li>
1.2       hubertf  15372:           </ul>
                   15373:         </div>
                   15374:       </div>
                   15375:     </div>
1.1       grant    15376:   </div>
                   15377: </body>
                   15378: </html>

CVSweb <webmaster@jp.NetBSD.org>