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

1.1       grant       1: <html xmlns="http://www.w3.org/1999/xhtml">
                      2: <head>
                      3:   <meta name="generator" content=
1.67    ! hubertf     4:   "HTML Tidy for NetBSD (vers 1 September 2005), see www.w3.org" />
1.1       grant       5:   <meta http-equiv="Content-Type" content=
                      6:   "text/html; charset=us-ascii" />
                      7: 
                      8:   <title>The pkgsrc guide</title>
                      9:   <link rel="stylesheet" href="/NetBSD.css" type="text/css" />
                     10:   <meta name="generator" content=
1.23      wiz        11:   "DocBook XSL Stylesheets VX.X.X" />
1.1       grant      12:   <meta name="description" content=
                     13:   "Information about using the NetBSD package system (pkgsrc) from both a user view for installing packages as well as from a pkgsrc developers' view for creating new packages." />
                     14:   </head>
                     15: 
                     16: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084"
                     17: alink="#0000FF">
1.67    ! hubertf    18:   <div class="book" lang="en">
1.1       grant      19:     <div class="titlepage">
                     20:       <div>
                     21:         <div>
1.67    ! hubertf    22:           <h1 class="title"><a name="the-pkgsrc-guide"></a>The
        !            23:           pkgsrc guide</h1>
1.1       grant      24:         </div>
                     25: 
                     26:         <div>
1.2       hubertf    27:           <h2 class="subtitle">Documentation on the NetBSD packages
1.1       grant      28:           system</h2>
                     29:         </div>
                     30: 
                     31:         <div>
                     32:           <div class="authorgroup">
                     33:             <div class="author">
                     34:               <h3 class="author"><span class=
                     35:               "firstname">Alistair</span> <span class=
                     36:               "surname">Crooks</span></h3>
                     37: 
                     38:               <div class="affiliation">
                     39:                 <div class="address">
1.14      xtraeme    40:                   <p><code class="email">&lt;<a href=
                     41:                   "mailto:agc@NetBSD.org">agc@NetBSD.org</a>&gt;</code></p>
1.1       grant      42:                 </div>
                     43:               </div>
                     44:             </div>
                     45: 
                     46:             <div class="author">
                     47:               <h3 class="author"><span class=
                     48:               "firstname">Hubert</span> <span class=
                     49:               "surname">Feyrer</span></h3>
                     50: 
                     51:               <div class="affiliation">
                     52:                 <div class="address">
1.14      xtraeme    53:                   <p><code class="email">&lt;<a href=
                     54:                   "mailto:hubertf@NetBSD.org">hubertf@NetBSD.org</a>&gt;</code></p>
1.1       grant      55:                 </div>
                     56:               </div>
                     57:             </div>
1.2       hubertf    58: 
1.3       hubertf    59:             <h3 class="corpauthor">The pkgsrc Developers</h3>
1.1       grant      60:           </div>
                     61:         </div>
                     62: 
                     63:         <div>
1.48      dillo      64:           <p class="copyright">Copyright &#169; 1994-2005 The
1.1       grant      65:           NetBSD Foundation, Inc</p>
                     66:         </div>
                     67: 
1.23      wiz        68:         <div xmlns="http://www.w3.org/TR/xhtml1/transitional">
1.48      dillo      69:           <p xmlns="" class="pubdate">$NetBSD: pkgsrc.xml,v 1.10
                     70:           2005/10/05 13:59:56 dillo Exp $</p>
1.1       grant      71:         </div>
                     72: 
                     73:         <div>
                     74:           <div class="abstract">
                     75:             <p class="title"><b>Abstract</b></p>
                     76: 
                     77:             <p>Information about using the NetBSD package system
                     78:             (pkgsrc) from both a user view for installing packages
                     79:             as well as from a pkgsrc developers' view for creating
                     80:             new packages.</p>
                     81:           </div>
                     82:         </div>
                     83:       </div>
                     84:       <hr />
                     85:     </div>
                     86: 
                     87:     <div class="toc">
                     88:       <p><b>Table of Contents</b></p>
                     89: 
                     90:       <dl>
1.51      rillig     91:         <dt><span class="chapter"><a href="#introduction">1. What
                     92:         is pkgsrc?</a></span></dt>
1.1       grant      93: 
                     94:         <dd>
                     95:           <dl>
1.30      wiz        96:             <dt><span class="sect1"><a href=
                     97:             "#introduction-section">1.1.
1.1       grant      98:             Introduction</a></span></dt>
                     99: 
                    100:             <dt><span class="sect1"><a href="#overview">1.2.
                    101:             Overview</a></span></dt>
                    102: 
                    103:             <dt><span class="sect1"><a href="#terminology">1.3.
                    104:             Terminology</a></span></dt>
                    105: 
                    106:             <dt><span class="sect1"><a href="#typography">1.4.
                    107:             Typography</a></span></dt>
                    108:           </dl>
                    109:         </dd>
                    110: 
1.46      gdt       111:         <dt><span class="part"><a href="#users-guide">I. The pkgsrc
1.1       grant     112:         user's guide</a></span></dt>
                    113: 
                    114:         <dd>
                    115:           <dl>
                    116:             <dt><span class="chapter"><a href="#getting">2. Where
1.59      rillig    117:             to get pkgsrc and how to keep it
                    118:             up-to-date</a></span></dt>
1.1       grant     119: 
                    120:             <dd>
                    121:               <dl>
1.30      wiz       122:                 <dt><span class="sect1"><a href="#as-tar-file">2.1.
1.1       grant     123:                 As tar file</a></span></dt>
                    124: 
1.30      wiz       125:                 <dt><span class="sect1"><a href="#via-sup">2.2. Via
                    126:                 SUP</a></span></dt>
1.1       grant     127: 
1.30      wiz       128:                 <dt><span class="sect1"><a href="#via-cvs">2.3. Via
                    129:                 CVS</a></span></dt>
1.59      rillig    130: 
                    131:                 <dt><span class="sect1"><a href=
                    132:                 "#uptodate-cvs">2.4. Keeping pkgsrc up-to-date via
                    133:                 CVS</a></span></dt>
1.1       grant     134:               </dl>
                    135:             </dd>
                    136: 
                    137:             <dt><span class="chapter"><a href="#platforms">3. Using
                    138:             pkgsrc on systems other than NetBSD</a></span></dt>
                    139: 
                    140:             <dd>
                    141:               <dl>
1.30      wiz       142:                 <dt><span class="sect1"><a href=
                    143:                 "#bootstrapping-pkgsrc">3.1. Bootstrapping
                    144:                 pkgsrc</a></span></dt>
1.1       grant     145: 
1.30      wiz       146:                 <dt><span class="sect1"><a href=
1.47      reed      147:                 "#platform-specific-notes">3.2. Platform-specific
1.30      wiz       148:                 notes</a></span></dt>
1.1       grant     149: 
                    150:                 <dd>
                    151:                   <dl>
                    152:                     <dt><span class="sect2"><a href=
1.30      wiz       153:                     "#darwin">3.2.1. Darwin (Mac OS
1.1       grant     154:                     X)</a></span></dt>
                    155: 
                    156:                     <dt><span class="sect2"><a href=
1.30      wiz       157:                     "#freebsd">3.2.2. FreeBSD</a></span></dt>
1.1       grant     158: 
                    159:                     <dt><span class="sect2"><a href=
1.30      wiz       160:                     "#interix">3.2.3. Interix</a></span></dt>
1.1       grant     161: 
1.30      wiz       162:                     <dt><span class="sect2"><a href="#irix">3.2.4.
                    163:                     IRIX</a></span></dt>
1.1       grant     164: 
1.30      wiz       165:                     <dt><span class="sect2"><a href="#linux">3.2.5.
                    166:                     Linux</a></span></dt>
1.1       grant     167: 
                    168:                     <dt><span class="sect2"><a href=
1.30      wiz       169:                     "#openbsd">3.2.6. OpenBSD</a></span></dt>
1.22      tv        170: 
                    171:                     <dt><span class="sect2"><a href=
1.30      wiz       172:                     "#solaris">3.2.7. Solaris</a></span></dt>
1.1       grant     173:                   </dl>
                    174:                 </dd>
                    175:               </dl>
                    176:             </dd>
                    177: 
                    178:             <dt><span class="chapter"><a href="#using">4. Using
                    179:             pkgsrc</a></span></dt>
                    180: 
                    181:             <dd>
                    182:               <dl>
                    183:                 <dt><span class="sect1"><a href=
                    184:                 "#getting-started">4.1. Working with binary
                    185:                 packages</a></span></dt>
                    186: 
                    187:                 <dd>
                    188:                   <dl>
                    189:                     <dt><span class="sect2"><a href=
1.30      wiz       190:                     "#where-to-get-binary-packages">4.1.1. Where to
                    191:                     get binary packages</a></span></dt>
1.1       grant     192: 
                    193:                     <dt><span class="sect2"><a href=
1.30      wiz       194:                     "#how-to-use-binary-packages">4.1.2. How to use
                    195:                     binary packages</a></span></dt>
1.1       grant     196: 
                    197:                     <dt><span class="sect2"><a href=
1.30      wiz       198:                     "#a-word-of-warning">4.1.3. A word of
1.1       grant     199:                     warning</a></span></dt>
                    200:                   </dl>
                    201:                 </dd>
                    202: 
1.30      wiz       203:                 <dt><span class="sect1"><a href=
                    204:                 "#building-packages-from-source">4.2. Building
                    205:                 packages from source</a></span></dt>
1.1       grant     206: 
                    207:                 <dd>
                    208:                   <dl>
                    209:                     <dt><span class="sect2"><a href=
1.30      wiz       210:                     "#requirements">4.2.1.
1.1       grant     211:                     Requirements</a></span></dt>
                    212: 
                    213:                     <dt><span class="sect2"><a href=
1.30      wiz       214:                     "#fetching-distfiles">4.2.2. Fetching
1.1       grant     215:                     distfiles</a></span></dt>
                    216: 
                    217:                     <dt><span class="sect2"><a href=
1.30      wiz       218:                     "#how-to-build-and-install">4.2.3. How to build
                    219:                     and install</a></span></dt>
1.1       grant     220: 
                    221:                     <dt><span class="sect2"><a href=
1.30      wiz       222:                     "#selecting-the-compiler">4.2.4. Selecting the
1.1       grant     223:                     compiler</a></span></dt>
                    224:                   </dl>
                    225:                 </dd>
                    226:               </dl>
                    227:             </dd>
                    228: 
1.38      dillo     229:             <dt><span class="chapter"><a href="#configuring">5.
                    230:             Configuring pkgsrc</a></span></dt>
                    231: 
                    232:             <dd>
                    233:               <dl>
                    234:                 <dt><span class="sect1"><a href=
1.45      wiz       235:                 "#general-configuration">5.1. General
                    236:                 configuration</a></span></dt>
                    237: 
                    238:                 <dt><span class="sect1"><a href=
                    239:                 "#variables-affecting-build">5.2. Variables
                    240:                 affecting the build process</a></span></dt>
                    241: 
                    242:                 <dt><span class="sect1"><a href=
                    243:                 "#developer-advanced-settings">5.3.
                    244:                 Developer/advanced settings</a></span></dt>
                    245: 
                    246:                 <dt><span class="sect1"><a href=
                    247:                 "#selecting-build-options">5.4. Selecting Build
1.42      dillo     248:                 Options</a></span></dt>
1.38      dillo     249:               </dl>
                    250:             </dd>
                    251: 
                    252:             <dt><span class="chapter"><a href="#binary">6. Creating
1.1       grant     253:             binary packages</a></span></dt>
                    254: 
                    255:             <dd>
                    256:               <dl>
1.30      wiz       257:                 <dt><span class="sect1"><a href=
1.38      dillo     258:                 "#building-a-single-binary-package">6.1. Building a
1.30      wiz       259:                 single binary package</a></span></dt>
1.1       grant     260: 
1.30      wiz       261:                 <dt><span class="sect1"><a href=
1.38      dillo     262:                 "#settings-for-creationg-of-binary-packages">6.2.
1.1       grant     263:                 Settings for creation of binary
                    264:                 packages</a></span></dt>
                    265: 
1.38      dillo     266:                 <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1       grant     267:                 Doing a bulk build of all packages</a></span></dt>
                    268: 
                    269:                 <dd>
                    270:                   <dl>
                    271:                     <dt><span class="sect2"><a href=
1.38      dillo     272:                     "#binary.configuration">6.3.1.
1.1       grant     273:                     Configuration</a></span></dt>
                    274: 
                    275:                     <dt><span class="sect2"><a href=
1.38      dillo     276:                     "#other-environmental-considerations">6.3.2.
1.30      wiz       277:                     Other environmental
1.1       grant     278:                     considerations</a></span></dt>
                    279: 
                    280:                     <dt><span class="sect2"><a href=
1.38      dillo     281:                     "#operation">6.3.3. Operation</a></span></dt>
1.1       grant     282: 
                    283:                     <dt><span class="sect2"><a href=
1.38      dillo     284:                     "#what-it-does">6.3.4. What it
1.1       grant     285:                     does</a></span></dt>
                    286: 
                    287:                     <dt><span class="sect2"><a href=
1.38      dillo     288:                     "#disk-space-requirements">6.3.5. Disk space
1.1       grant     289:                     requirements</a></span></dt>
                    290: 
                    291:                     <dt><span class="sect2"><a href=
1.38      dillo     292:                     "#setting-up-a-sandbox">6.3.6. Setting up a
1.47      reed      293:                     sandbox for chrooted builds</a></span></dt>
1.1       grant     294: 
                    295:                     <dt><span class="sect2"><a href=
1.38      dillo     296:                     "#building-a-partial-set">6.3.7. Building a
1.30      wiz       297:                     partial set of packages</a></span></dt>
1.13      hubertf   298: 
                    299:                     <dt><span class="sect2"><a href=
1.38      dillo     300:                     "#bulk-upload">6.3.8. Uploading results of a
1.13      hubertf   301:                     bulk build</a></span></dt>
1.1       grant     302:                   </dl>
                    303:                 </dd>
                    304: 
1.30      wiz       305:                 <dt><span class="sect1"><a href=
1.38      dillo     306:                 "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30      wiz       307:                 packages collection</a></span></dt>
1.1       grant     308: 
                    309:                 <dd>
                    310:                   <dl>
                    311:                     <dt><span class="sect2"><a href=
1.38      dillo     312:                     "#cdpack-example">6.4.1. Example of
1.1       grant     313:                     cdpack</a></span></dt>
                    314:                   </dl>
                    315:                 </dd>
                    316:               </dl>
                    317:             </dd>
                    318: 
1.38      dillo     319:             <dt><span class="chapter"><a href="#faq">7. Frequently
1.1       grant     320:             Asked Questions</a></span></dt>
                    321: 
                    322:             <dd>
                    323:               <dl>
1.30      wiz       324:                 <dt><span class="sect1"><a href=
1.38      dillo     325:                 "#mailing-list-pointers">7.1. Are there any mailing
1.30      wiz       326:                 lists for pkg-related discussion?</a></span></dt>
1.1       grant     327: 
1.30      wiz       328:                 <dt><span class="sect1"><a href=
1.38      dillo     329:                 "#pkgviews-docs">7.2. Where's the pkgviews
1.30      wiz       330:                 documentation?</a></span></dt>
1.1       grant     331: 
1.5       hubertf   332:                 <dt><span class="sect1"><a href=
1.38      dillo     333:                 "#faq-pkgtools">7.3. Utilities for package
1.5       hubertf   334:                 management (pkgtools)</a></span></dt>
1.1       grant     335: 
1.30      wiz       336:                 <dt><span class="sect1"><a href=
1.38      dillo     337:                 "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30      wiz       338:                 non-root</a></span></dt>
                    339: 
                    340:                 <dt><span class="sect1"><a href=
1.38      dillo     341:                 "#resume-transfers">7.5. How to resume transfers
1.30      wiz       342:                 when fetching distfiles?</a></span></dt>
                    343: 
                    344:                 <dt><span class="sect1"><a href=
1.38      dillo     345:                 "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30      wiz       346:                 XFree86 from pkgsrc?</a></span></dt>
                    347: 
                    348:                 <dt><span class="sect1"><a href=
1.38      dillo     349:                 "#x.org-from-pkgsrc">7.7. How can I install/use
1.30      wiz       350:                 X.org from pkgsrc?</a></span></dt>
1.1       grant     351: 
1.30      wiz       352:                 <dt><span class="sect1"><a href=
1.38      dillo     353:                 "#fetch-behind-firewall">7.8. How to fetch files
1.30      wiz       354:                 from behind a firewall</a></span></dt>
1.1       grant     355: 
1.38      dillo     356:                 <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.14      xtraeme   357:                 How do I tell <span><strong class="command">make
                    358:                 fetch</strong></span> to do passive
1.1       grant     359:                 FTP?</a></span></dt>
                    360: 
1.30      wiz       361:                 <dt><span class="sect1"><a href=
1.38      dillo     362:                 "#fetching-all-distfiles">7.10. How to fetch all
1.30      wiz       363:                 distfiles at once</a></span></dt>
1.1       grant     364: 
1.30      wiz       365:                 <dt><span class="sect1"><a href=
1.38      dillo     366:                 "#tmac.andoc-missing">7.11. What does
1.30      wiz       367:                 &#8220;<span class="quote">Don't know how to make
                    368:                 /usr/share/tmac/tmac.andoc</span>&#8221;
1.14      xtraeme   369:                 mean?</a></span></dt>
1.13      hubertf   370: 
1.30      wiz       371:                 <dt><span class="sect1"><a href=
1.38      dillo     372:                 "#bsd.own.mk-missing">7.12. What does
1.30      wiz       373:                 &#8220;<span class="quote">Could not find
1.14      xtraeme   374:                 bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant     375: 
1.30      wiz       376:                 <dt><span class="sect1"><a href=
1.38      dillo     377:                 "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30      wiz       378:                 pkgsrc</a></span></dt>
1.1       grant     379: 
1.38      dillo     380:                 <dt><span class="sect1"><a href="#faq.conf">7.14.
1.35      jmmv      381:                 How do I change the location of configuration
                    382:                 files?</a></span></dt>
1.1       grant     383: 
                    384:                 <dt><span class="sect1"><a href=
1.38      dillo     385:                 "#audit-packages">7.15. Automated security
1.1       grant     386:                 checks</a></span></dt>
                    387:               </dl>
                    388:             </dd>
                    389:           </dl>
                    390:         </dd>
                    391: 
1.46      gdt       392:         <dt><span class="part"><a href="#developers-guide">II. The
1.1       grant     393:         pkgsrc developer's guide</a></span></dt>
                    394: 
                    395:         <dd>
                    396:           <dl>
1.38      dillo     397:             <dt><span class="chapter"><a href="#components">8.
1.27      rillig    398:             Package components - files, directories and
                    399:             contents</a></span></dt>
                    400: 
                    401:             <dd>
                    402:               <dl>
                    403:                 <dt><span class="sect1"><a href=
1.45      wiz       404:                 "#components.Makefile">8.1. <code xmlns=
                    405:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig    406:                 "filename">Makefile</code></a></span></dt>
                    407: 
                    408:                 <dt><span class="sect1"><a href=
1.45      wiz       409:                 "#components.distinfo">8.2. <code xmlns=
                    410:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig    411:                 "filename">distinfo</code></a></span></dt>
                    412: 
                    413:                 <dt><span class="sect1"><a href=
1.38      dillo     414:                 "#components.patches">8.3.
1.27      rillig    415:                 patches/*</a></span></dt>
                    416: 
1.30      wiz       417:                 <dt><span class="sect1"><a href=
1.38      dillo     418:                 "#other-mandatory-files">8.4. Other mandatory
1.30      wiz       419:                 files</a></span></dt>
1.27      rillig    420: 
                    421:                 <dt><span class="sect1"><a href=
1.38      dillo     422:                 "#components.optional">8.5. Optional
1.27      rillig    423:                 files</a></span></dt>
                    424: 
1.38      dillo     425:                 <dt><span class="sect1"><a href="#work-dir">8.6.
1.45      wiz       426:                 <code xmlns=
                    427:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                    428:                 "filename">work*</code></a></span></dt>
1.27      rillig    429: 
1.38      dillo     430:                 <dt><span class="sect1"><a href="#files-dir">8.7.
1.45      wiz       431:                 <code xmlns=
                    432:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig    433:                 "filename">files/*</code></a></span></dt>
                    434:               </dl>
                    435:             </dd>
                    436: 
1.38      dillo     437:             <dt><span class="chapter"><a href="#makefile">9.
1.45      wiz       438:             Programming in <code xmlns=
                    439:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.25      rillig    440:             "filename">Makefile</code>s</a></span></dt>
                    441: 
                    442:             <dd>
                    443:               <dl>
                    444:                 <dt><span class="sect1"><a href=
1.45      wiz       445:                 "#makefile.variables">9.1. <code xmlns=
                    446:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.25      rillig    447:                 "filename">Makefile</code>
                    448:                 variables</a></span></dt>
                    449: 
1.27      rillig    450:                 <dd>
                    451:                   <dl>
                    452:                     <dt><span class="sect2"><a href=
1.38      dillo     453:                     "#makefile.variables.names">9.1.1. Naming
1.27      rillig    454:                     conventions</a></span></dt>
                    455:                   </dl>
                    456:                 </dd>
                    457: 
1.25      rillig    458:                 <dt><span class="sect1"><a href=
1.38      dillo     459:                 "#makefile.code">9.2. Code snippets</a></span></dt>
1.25      rillig    460: 
                    461:                 <dd>
                    462:                   <dl>
                    463:                     <dt><span class="sect2"><a href=
1.38      dillo     464:                     "#adding-to-list">9.2.1. Adding things to a
1.25      rillig    465:                     list</a></span></dt>
                    466: 
                    467:                     <dt><span class="sect2"><a href=
1.38      dillo     468:                     "#converting-internal-to-external">9.2.2.
1.30      wiz       469:                     Converting an internal list into an external
                    470:                     list</a></span></dt>
1.25      rillig    471: 
                    472:                     <dt><span class="sect2"><a href=
1.38      dillo     473:                     "#passing-variable-to-shell">9.2.3. Passing
1.30      wiz       474:                     variables to a shell command</a></span></dt>
1.27      rillig    475: 
                    476:                     <dt><span class="sect2"><a href=
1.38      dillo     477:                     "#quoting-guideline">9.2.4. Quoting
1.27      rillig    478:                     guideline</a></span></dt>
                    479: 
                    480:                     <dt><span class="sect2"><a href=
1.38      dillo     481:                     "#bsd-make-bug-workaround">9.2.5. Workaround
1.30      wiz       482:                     for a bug in BSD Make</a></span></dt>
1.25      rillig    483:                   </dl>
                    484:                 </dd>
                    485:               </dl>
                    486:             </dd>
                    487: 
1.38      dillo     488:             <dt><span class="chapter"><a href="#plist">10. PLIST
1.1       grant     489:             issues</a></span></dt>
                    490: 
                    491:             <dd>
                    492:               <dl>
1.38      dillo     493:                 <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.30      wiz       494:                 ID</a></span></dt>
1.1       grant     495: 
1.30      wiz       496:                 <dt><span class="sect1"><a href=
1.38      dillo     497:                 "#automatic-plist-generation">10.2. Semi-automatic
1.45      wiz       498:                 <code xmlns=
                    499:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                    500:                 "filename">PLIST</code> generation</a></span></dt>
1.1       grant     501: 
1.38      dillo     502:                 <dt><span class="sect1"><a href=
                    503:                 "#print-PLIST">10.3. Tweaking output of
                    504:                 <span><strong class="command">make
1.14      xtraeme   505:                 print-PLIST</strong></span></a></span></dt>
1.1       grant     506: 
1.38      dillo     507:                 <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1       grant     508:                 Variable substitution in PLIST</a></span></dt>
                    509: 
1.30      wiz       510:                 <dt><span class="sect1"><a href=
1.48      dillo     511:                 "#manpage-compression">10.5. Man page
                    512:                 compression</a></span></dt>
1.1       grant     513: 
1.30      wiz       514:                 <dt><span class="sect1"><a href=
1.38      dillo     515:                 "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30      wiz       516:                 <code class=
1.14      xtraeme   517:                 "varname">PLIST_SRC</code></a></span></dt>
1.1       grant     518: 
1.30      wiz       519:                 <dt><span class="sect1"><a href=
1.47      reed      520:                 "#platform-specific-plist">10.7. Platform-specific
1.30      wiz       521:                 and differing PLISTs</a></span></dt>
1.1       grant     522: 
                    523:                 <dt><span class="sect1"><a href=
1.38      dillo     524:                 "#faq.common-dirs">10.8. Sharing directories
                    525:                 between packages</a></span></dt>
1.1       grant     526:               </dl>
                    527:             </dd>
                    528: 
1.38      dillo     529:             <dt><span class="chapter"><a href="#buildlink">11.
1.1       grant     530:             Buildlink methodology</a></span></dt>
                    531: 
                    532:             <dd>
                    533:               <dl>
1.30      wiz       534:                 <dt><span class="sect1"><a href=
1.38      dillo     535:                 "#converting-to-buildlink3">11.1. Converting
1.30      wiz       536:                 packages to use buildlink3</a></span></dt>
1.1       grant     537: 
1.30      wiz       538:                 <dt><span class="sect1"><a href=
1.38      dillo     539:                 "#creating-buildlink3.mk">11.2. Writing
1.45      wiz       540:                 <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                    541:                 class="filename">buildlink3.mk</code>
1.14      xtraeme   542:                 files</a></span></dt>
1.1       grant     543: 
                    544:                 <dd>
                    545:                   <dl>
                    546:                     <dt><span class="sect2"><a href=
1.38      dillo     547:                     "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30      wiz       548:                     buildlink3.mk file</a></span></dt>
1.1       grant     549: 
                    550:                     <dt><span class="sect2"><a href=
1.38      dillo     551:                     "#updating-buildlink-depends">11.2.2. Updating
1.30      wiz       552:                     <code class=
1.14      xtraeme   553:                     "varname">BUILDLINK_DEPENDS.<em class=
                    554:                     "replaceable"><code>pkg</code></em></code> in
1.45      wiz       555:                     <code xmlns=
                    556:                     "http://www.w3.org/TR/xhtml1/transitional"
                    557:                     class="filename">buildlink3.mk</code>
1.1       grant     558:                     files</a></span></dt>
                    559:                   </dl>
                    560:                 </dd>
                    561: 
1.30      wiz       562:                 <dt><span class="sect1"><a href=
1.45      wiz       563:                 "#writing-builtin.mk">11.3. Writing <code xmlns=
                    564:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz       565:                 "filename">builtin.mk</code> files</a></span></dt>
1.1       grant     566: 
                    567:                 <dd>
                    568:                   <dl>
                    569:                     <dt><span class="sect2"><a href=
1.38      dillo     570:                     "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45      wiz       571:                     <code xmlns=
                    572:                     "http://www.w3.org/TR/xhtml1/transitional"
                    573:                     class="filename">builtin.mk</code>
1.1       grant     574:                     file</a></span></dt>
                    575: 
                    576:                     <dt><span class="sect2"><a href=
1.38      dillo     577:                     "#native-or-pkgsrc-preference">11.3.2. Global
1.30      wiz       578:                     preferences for native or pkgsrc
                    579:                     software</a></span></dt>
1.1       grant     580:                   </dl>
                    581:                 </dd>
                    582:               </dl>
                    583:             </dd>
                    584: 
1.38      dillo     585:             <dt><span class="chapter"><a href="#pkginstall">12. The
1.35      jmmv      586:             pkginstall framework</a></span></dt>
                    587: 
                    588:             <dd>
                    589:               <dl>
                    590:                 <dt><span class="sect1"><a href=
1.38      dillo     591:                 "#files-and-dirs-outside-prefix">12.1. Files and
1.35      jmmv      592:                 directories outside the installation
                    593:                 prefix</a></span></dt>
                    594: 
                    595:                 <dd>
                    596:                   <dl>
                    597:                     <dt><span class="sect2"><a href=
1.38      dillo     598:                     "#dirs-outside-prefix">12.1.1. Directory
1.35      jmmv      599:                     manipulation</a></span></dt>
                    600: 
                    601:                     <dt><span class="sect2"><a href=
1.38      dillo     602:                     "#files-outside-prefix">12.1.2. File
1.35      jmmv      603:                     manipulation</a></span></dt>
                    604:                   </dl>
                    605:                 </dd>
                    606: 
1.38      dillo     607:                 <dt><span class="sect1"><a href="#conf-files">12.2.
1.35      jmmv      608:                 Configuration files</a></span></dt>
                    609: 
                    610:                 <dd>
                    611:                   <dl>
                    612:                     <dt><span class="sect2"><a href=
1.38      dillo     613:                     "#conf-files-sysconfdir">12.2.1. How
1.35      jmmv      614:                     <code class="varname">PKG_SYSCONFDIR</code> is
                    615:                     set</a></span></dt>
                    616: 
                    617:                     <dt><span class="sect2"><a href=
1.38      dillo     618:                     "#conf-files-configure">12.2.2. Telling the
1.47      reed      619:                     software where configuration files
1.35      jmmv      620:                     are</a></span></dt>
                    621: 
                    622:                     <dt><span class="sect2"><a href=
1.38      dillo     623:                     "#conf-files-patching">12.2.3. Patching
1.35      jmmv      624:                     installations</a></span></dt>
                    625: 
                    626:                     <dt><span class="sect2"><a href=
1.38      dillo     627:                     "#conf-files-disable">12.2.4. Disabling
1.35      jmmv      628:                     handling of configuration files</a></span></dt>
                    629:                   </dl>
                    630:                 </dd>
                    631: 
                    632:                 <dt><span class="sect1"><a href=
1.38      dillo     633:                 "#rcd-scripts">12.3. System startup
1.35      jmmv      634:                 scripts</a></span></dt>
                    635: 
                    636:                 <dd>
                    637:                   <dl>
                    638:                     <dt><span class="sect2"><a href=
1.38      dillo     639:                     "#rcd-scripts-disable">12.3.1. Disabling
1.35      jmmv      640:                     handling of system startup
                    641:                     scripts</a></span></dt>
                    642:                   </dl>
                    643:                 </dd>
                    644: 
                    645:                 <dt><span class="sect1"><a href=
1.38      dillo     646:                 "#users-and-groups">12.4. System users and
1.35      jmmv      647:                 groups</a></span></dt>
                    648: 
1.38      dillo     649:                 <dt><span class="sect1"><a href="#shells">12.5.
1.35      jmmv      650:                 System shells</a></span></dt>
                    651: 
                    652:                 <dd>
                    653:                   <dl>
                    654:                     <dt><span class="sect2"><a href=
1.65      hubertf   655:                     "#shells-disable">12.5.1. Disabling shell
                    656:                     registration</a></span></dt>
                    657:                   </dl>
                    658:                 </dd>
                    659: 
                    660:                 <dt><span class="sect1"><a href="#fonts">12.6.
                    661:                 Fonts</a></span></dt>
                    662: 
                    663:                 <dd>
                    664:                   <dl>
                    665:                     <dt><span class="sect2"><a href=
                    666:                     "#fonts-disable">12.6.1. Disabling automatic
                    667:                     update of the fonts databases</a></span></dt>
1.35      jmmv      668:                   </dl>
                    669:                 </dd>
                    670:               </dl>
                    671:             </dd>
                    672: 
1.38      dillo     673:             <dt><span class="chapter"><a href="#options">13.
1.1       grant     674:             Options handling</a></span></dt>
                    675: 
                    676:             <dd>
                    677:               <dl>
1.30      wiz       678:                 <dt><span class="sect1"><a href=
1.38      dillo     679:                 "#global-default-options">13.1. Global default
1.30      wiz       680:                 options</a></span></dt>
1.1       grant     681: 
1.30      wiz       682:                 <dt><span class="sect1"><a href=
1.38      dillo     683:                 "#converting-to-options">13.2. Converting packages
1.45      wiz       684:                 to use <code xmlns=
                    685:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme   686:                 "filename">bsd.options.mk</code></a></span></dt>
1.48      dillo     687: 
                    688:                 <dt><span class="sect1"><a href=
                    689:                 "#option-names">13.3. Option Names</a></span></dt>
1.1       grant     690:               </dl>
                    691:             </dd>
                    692: 
1.38      dillo     693:             <dt><span class="chapter"><a href="#build">14. The
1.1       grant     694:             build process</a></span></dt>
                    695: 
                    696:             <dd>
                    697:               <dl>
                    698:                 <dt><span class="sect1"><a href=
1.56      rillig    699:                 "#build.intro">14.1. Introduction</a></span></dt>
                    700: 
                    701:                 <dt><span class="sect1"><a href=
                    702:                 "#build.prefix">14.2. Program
1.1       grant     703:                 location</a></span></dt>
                    704: 
1.30      wiz       705:                 <dt><span class="sect1"><a href=
1.56      rillig    706:                 "#build.builddirs">14.3. Directories used during
                    707:                 the build process</a></span></dt>
                    708: 
                    709:                 <dt><span class="sect1"><a href=
                    710:                 "#build.running">14.4. Running a
                    711:                 phase</a></span></dt>
                    712: 
                    713:                 <dt><span class="sect1"><a href=
                    714:                 "#build.fetch">14.5. The <span class=
                    715:                 "emphasis"><em>fetch</em></span>
                    716:                 phase</a></span></dt>
                    717: 
                    718:                 <dt><span class="sect1"><a href=
                    719:                 "#build.checksum">14.6. The <span class=
                    720:                 "emphasis"><em>checksum</em></span>
                    721:                 phase</a></span></dt>
                    722: 
                    723:                 <dt><span class="sect1"><a href=
                    724:                 "#build.extract">14.7. The <span class=
                    725:                 "emphasis"><em>extract</em></span>
                    726:                 phase</a></span></dt>
                    727: 
                    728:                 <dt><span class="sect1"><a href=
                    729:                 "#build.patch">14.8. The <span class=
                    730:                 "emphasis"><em>patch</em></span>
                    731:                 phase</a></span></dt>
                    732: 
                    733:                 <dt><span class="sect1"><a href=
                    734:                 "#build.tools">14.9. The <span class=
                    735:                 "emphasis"><em>tools</em></span>
                    736:                 phase</a></span></dt>
                    737: 
                    738:                 <dt><span class="sect1"><a href=
                    739:                 "#build.wrapper">14.10. The <span class=
                    740:                 "emphasis"><em>wrapper</em></span>
                    741:                 phase</a></span></dt>
                    742: 
                    743:                 <dt><span class="sect1"><a href=
                    744:                 "#build.configure">14.11. The <span class=
                    745:                 "emphasis"><em>configure</em></span>
                    746:                 phase</a></span></dt>
                    747: 
                    748:                 <dt><span class="sect1"><a href=
                    749:                 "#build.build">14.12. The <span class=
                    750:                 "emphasis"><em>build</em></span>
                    751:                 phase</a></span></dt>
                    752: 
                    753:                 <dt><span class="sect1"><a href=
                    754:                 "#build.test">14.13. The <span class=
                    755:                 "emphasis"><em>test</em></span>
                    756:                 phase</a></span></dt>
                    757: 
                    758:                 <dt><span class="sect1"><a href=
                    759:                 "#build.install">14.14. The <span class=
                    760:                 "emphasis"><em>install</em></span>
                    761:                 phase</a></span></dt>
1.1       grant     762: 
                    763:                 <dt><span class="sect1"><a href=
1.56      rillig    764:                 "#build.package">14.15. The <span class=
                    765:                 "emphasis"><em>package</em></span>
                    766:                 phase</a></span></dt>
                    767: 
                    768:                 <dt><span class="sect1"><a href=
                    769:                 "#build.helpful-targets">14.16. Other helpful
1.1       grant     770:                 targets</a></span></dt>
                    771:               </dl>
                    772:             </dd>
                    773: 
1.55      rillig    774:             <dt><span class="chapter"><a href="#fixes">15. Making
                    775:             your package work</a></span></dt>
1.1       grant     776: 
                    777:             <dd>
                    778:               <dl>
1.30      wiz       779:                 <dt><span class="sect1"><a href=
1.38      dillo     780:                 "#general-operation">15.1. General
1.30      wiz       781:                 operation</a></span></dt>
1.1       grant     782: 
                    783:                 <dd>
                    784:                   <dl>
                    785:                     <dt><span class="sect2"><a href=
1.38      dillo     786:                     "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30      wiz       787:                     pull in variables from
                    788:                     /etc/mk.conf</a></span></dt>
1.1       grant     789: 
                    790:                     <dt><span class="sect2"><a href=
1.38      dillo     791:                     "#where-to-install-documentation">15.1.2. Where
1.31      wiz       792:                     to install documentation</a></span></dt>
                    793: 
                    794:                     <dt><span class="sect2"><a href=
1.38      dillo     795:                     "#restricted-packages">15.1.3. Restricted
1.1       grant     796:                     packages</a></span></dt>
                    797: 
                    798:                     <dt><span class="sect2"><a href=
1.38      dillo     799:                     "#dependencies">15.1.4. Handling
1.1       grant     800:                     dependencies</a></span></dt>
                    801: 
                    802:                     <dt><span class="sect2"><a href=
1.38      dillo     803:                     "#conflicts">15.1.5. Handling conflicts with
1.1       grant     804:                     other packages</a></span></dt>
                    805: 
                    806:                     <dt><span class="sect2"><a href=
1.38      dillo     807:                     "#not-building-packages">15.1.6. Packages that
1.30      wiz       808:                     cannot or should not be built</a></span></dt>
1.1       grant     809: 
                    810:                     <dt><span class="sect2"><a href=
1.38      dillo     811:                     "#undeletable-packages">15.1.7. Packages which
1.30      wiz       812:                     should not be deleted, once
                    813:                     installed</a></span></dt>
1.1       grant     814: 
                    815:                     <dt><span class="sect2"><a href=
1.38      dillo     816:                     "#security-handling">15.1.8. Handling packages
1.1       grant     817:                     with security problems</a></span></dt>
                    818: 
                    819:                     <dt><span class="sect2"><a href=
1.38      dillo     820:                     "#compiler-bugs">15.1.9. How to handle compiler
1.1       grant     821:                     bugs</a></span></dt>
                    822: 
                    823:                     <dt><span class="sect2"><a href=
1.38      dillo     824:                     "#bumping-pkgrevision">15.1.10. How to handle
1.30      wiz       825:                     incrementing versions when fixing an existing
1.1       grant     826:                     package</a></span></dt>
                    827: 
                    828:                     <dt><span class="sect2"><a href=
1.38      dillo     829:                     "#portability-of-packages">15.1.11. Portability
1.30      wiz       830:                     of packages</a></span></dt>
1.1       grant     831:                   </dl>
                    832:                 </dd>
                    833: 
1.30      wiz       834:                 <dt><span class="sect1"><a href=
1.38      dillo     835:                 "#downloading-issues">15.2. Possible downloading
1.30      wiz       836:                 issues</a></span></dt>
1.1       grant     837: 
                    838:                 <dd>
                    839:                   <dl>
                    840:                     <dt><span class="sect2"><a href=
1.38      dillo     841:                     "#no-plain-download">15.2.1. Packages whose
1.30      wiz       842:                     distfiles aren't available for plain
1.1       grant     843:                     downloading</a></span></dt>
                    844: 
                    845:                     <dt><span class="sect2"><a href=
1.38      dillo     846:                     "#modified-distfiles-same-name">15.2.2. How to
1.30      wiz       847:                     handle modified distfiles with the 'old'
                    848:                     name</a></span></dt>
1.1       grant     849:                   </dl>
                    850:                 </dd>
                    851: 
1.30      wiz       852:                 <dt><span class="sect1"><a href=
1.38      dillo     853:                 "#configuration-gotchas">15.3. Configuration
1.30      wiz       854:                 gotchas</a></span></dt>
1.1       grant     855: 
                    856:                 <dd>
                    857:                   <dl>
                    858:                     <dt><span class="sect2"><a href=
1.38      dillo     859:                     "#fixes.libtool">15.3.1. Shared libraries -
1.1       grant     860:                     libtool</a></span></dt>
                    861: 
                    862:                     <dt><span class="sect2"><a href=
1.38      dillo     863:                     "#using-libtool">15.3.2. Using libtool on GNU
1.1       grant     864:                     packages that already support
                    865:                     libtool</a></span></dt>
                    866: 
                    867:                     <dt><span class="sect2"><a href=
1.38      dillo     868:                     "#autoconf-automake">15.3.3. GNU
1.1       grant     869:                     Autoconf/Automake</a></span></dt>
                    870:                   </dl>
                    871:                 </dd>
                    872: 
1.30      wiz       873:                 <dt><span class="sect1"><a href=
1.55      rillig    874:                 "#fixes-build">15.4. Building the
                    875:                 package</a></span></dt>
1.1       grant     876: 
                    877:                 <dd>
                    878:                   <dl>
                    879:                     <dt><span class="sect2"><a href=
1.38      dillo     880:                     "#cpp-defines">15.4.1. CPP
1.1       grant     881:                     defines</a></span></dt>
1.51      rillig    882: 
                    883:                     <dt><span class="sect2"><a href=
1.60      rillig    884:                     "#cpp-list-examples">15.4.2. Examples of CPP
                    885:                     defines for some platforms</a></span></dt>
                    886: 
                    887:                     <dt><span class="sect2"><a href=
                    888:                     "#cpp-list">15.4.3. Getting a list of CPP
1.51      rillig    889:                     defines</a></span></dt>
1.1       grant     890:                   </dl>
                    891:                 </dd>
                    892: 
1.30      wiz       893:                 <dt><span class="sect1"><a href=
1.38      dillo     894:                 "#package-specific-actions">15.5. Package specific
1.30      wiz       895:                 actions</a></span></dt>
1.1       grant     896: 
                    897:                 <dd>
                    898:                   <dl>
                    899:                     <dt><span class="sect2"><a href=
1.38      dillo     900:                     "#user-interaction">15.5.1. User
1.2       hubertf   901:                     interaction</a></span></dt>
1.1       grant     902: 
                    903:                     <dt><span class="sect2"><a href=
1.38      dillo     904:                     "#handling-licenses">15.5.2. Handling
1.1       grant     905:                     licenses</a></span></dt>
                    906: 
                    907:                     <dt><span class="sect2"><a href=
1.38      dillo     908:                     "#installing-score-files">15.5.3. Installing
1.30      wiz       909:                     score files</a></span></dt>
1.1       grant     910: 
                    911:                     <dt><span class="sect2"><a href=
1.38      dillo     912:                     "#perl-scripts">15.5.4. Packages containing
1.30      wiz       913:                     perl scripts</a></span></dt>
1.1       grant     914: 
                    915:                     <dt><span class="sect2"><a href=
1.38      dillo     916:                     "#hardcoded-paths">15.5.5. Packages with
1.30      wiz       917:                     hardcoded paths to other
                    918:                     interpreters</a></span></dt>
1.1       grant     919: 
                    920:                     <dt><span class="sect2"><a href=
1.38      dillo     921:                     "#perl-modules">15.5.6. Packages installing
1.30      wiz       922:                     perl modules</a></span></dt>
1.1       grant     923: 
                    924:                     <dt><span class="sect2"><a href=
1.38      dillo     925:                     "#faq.info-files">15.5.7. Packages installing
1.1       grant     926:                     info files</a></span></dt>
                    927: 
                    928:                     <dt><span class="sect2"><a href=
1.57      minskim   929:                     "#manpages">15.5.8. Packages installing man
                    930:                     pages</a></span></dt>
                    931: 
                    932:                     <dt><span class="sect2"><a href=
                    933:                     "#gconf2-data-files">15.5.9. Packages
1.30      wiz       934:                     installing GConf2 data files</a></span></dt>
1.1       grant     935: 
                    936:                     <dt><span class="sect2"><a href=
1.57      minskim   937:                     "#scrollkeeper-data-files">15.5.10. Packages
1.30      wiz       938:                     installing scrollkeeper data
                    939:                     files</a></span></dt>
1.1       grant     940: 
                    941:                     <dt><span class="sect2"><a href=
1.57      minskim   942:                     "#x11-fonts">15.5.11. Packages installing X11
1.1       grant     943:                     fonts</a></span></dt>
                    944: 
                    945:                     <dt><span class="sect2"><a href=
1.57      minskim   946:                     "#gtk2-modules">15.5.12. Packages installing
1.30      wiz       947:                     GTK2 modules</a></span></dt>
1.1       grant     948: 
                    949:                     <dt><span class="sect2"><a href=
1.57      minskim   950:                     "#sgml-xml-data">15.5.13. Packages installing
1.30      wiz       951:                     SGML or XML data</a></span></dt>
1.1       grant     952: 
                    953:                     <dt><span class="sect2"><a href=
1.57      minskim   954:                     "#mime-database">15.5.14. Packages installing
1.1       grant     955:                     extensions to the MIME database</a></span></dt>
                    956: 
                    957:                     <dt><span class="sect2"><a href=
1.57      minskim   958:                     "#intltool">15.5.15. Packages using
1.1       grant     959:                     intltool</a></span></dt>
1.18      xtraeme   960: 
                    961:                     <dt><span class="sect2"><a href=
1.57      minskim   962:                     "#startup-scripts">15.5.16. Packages installing
1.18      xtraeme   963:                     startup scripts</a></span></dt>
1.57      minskim   964: 
                    965:                     <dt><span class="sect2"><a href=
                    966:                     "#tex-packages">15.5.17. Packages installing
                    967:                     TeX modules</a></span></dt>
1.1       grant     968:                   </dl>
                    969:                 </dd>
                    970: 
1.30      wiz       971:                 <dt><span class="sect1"><a href=
1.38      dillo     972:                 "#feedback-to-author">15.6. Feedback to the
1.30      wiz       973:                 author</a></span></dt>
1.1       grant     974:               </dl>
                    975:             </dd>
                    976: 
1.38      dillo     977:             <dt><span class="chapter"><a href="#debug">16.
1.1       grant     978:             Debugging</a></span></dt>
                    979: 
1.38      dillo     980:             <dt><span class="chapter"><a href="#submit">17.
1.1       grant     981:             Submitting and Committing</a></span></dt>
                    982: 
                    983:             <dd>
                    984:               <dl>
1.30      wiz       985:                 <dt><span class="sect1"><a href=
1.38      dillo     986:                 "#submitting-your-package">17.1. Submitting your
1.30      wiz       987:                 packages</a></span></dt>
1.1       grant     988: 
1.30      wiz       989:                 <dt><span class="sect1"><a href=
1.41      wiz       990:                 "#general-notes-for-changes">17.2. General notes
                    991:                 when adding, updating, or removing
                    992:                 packages</a></span></dt>
                    993: 
                    994:                 <dt><span class="sect1"><a href=
                    995:                 "#committing-importing">17.3. Committing: Importing
1.30      wiz       996:                 a package into CVS</a></span></dt>
1.1       grant     997: 
1.30      wiz       998:                 <dt><span class="sect1"><a href=
1.41      wiz       999:                 "#updating-package">17.4. Updating a package to a
1.30      wiz      1000:                 newer version</a></span></dt>
1.1       grant    1001: 
1.30      wiz      1002:                 <dt><span class="sect1"><a href=
1.41      wiz      1003:                 "#moving-package">17.5. Moving a package in
1.30      wiz      1004:                 pkgsrc</a></span></dt>
1.1       grant    1005:               </dl>
                   1006:             </dd>
                   1007:           </dl>
                   1008:         </dd>
                   1009: 
1.46      gdt      1010:         <dt><span class="appendix"><a href="#examples">A. A simple
1.1       grant    1011:         example package: bison</a></span></dt>
                   1012: 
                   1013:         <dd>
                   1014:           <dl>
1.46      gdt      1015:             <dt><span class="sect1"><a href="#example-files">A.1.
1.1       grant    1016:             files</a></span></dt>
                   1017: 
                   1018:             <dd>
                   1019:               <dl>
1.30      wiz      1020:                 <dt><span class="sect2"><a href=
1.46      gdt      1021:                 "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1       grant    1022: 
1.30      wiz      1023:                 <dt><span class="sect2"><a href=
1.46      gdt      1024:                 "#example-descr">A.1.2. DESCR</a></span></dt>
1.1       grant    1025: 
1.30      wiz      1026:                 <dt><span class="sect2"><a href=
1.46      gdt      1027:                 "#example-plist">A.1.3. PLIST</a></span></dt>
1.1       grant    1028: 
1.30      wiz      1029:                 <dt><span class="sect2"><a href=
1.46      gdt      1030:                 "#checking-package-with-pkglint">A.1.4. Checking a
1.30      wiz      1031:                 package with <span><strong class=
1.14      xtraeme  1032:                 "command">pkglint</strong></span></a></span></dt>
1.1       grant    1033:               </dl>
                   1034:             </dd>
                   1035: 
1.46      gdt      1036:             <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30      wiz      1037:             Steps for building, installing,
                   1038:             packaging</a></span></dt>
1.1       grant    1039:           </dl>
                   1040:         </dd>
                   1041: 
1.46      gdt      1042:         <dt><span class="appendix"><a href="#logs">B. Build
1.1       grant    1043:         logs</a></span></dt>
                   1044: 
                   1045:         <dd>
                   1046:           <dl>
1.46      gdt      1047:             <dt><span class="sect1"><a href="#logs.building">B.1.
1.1       grant    1048:             Building figlet</a></span></dt>
                   1049: 
1.46      gdt      1050:             <dt><span class="sect1"><a href="#logs.package">B.2.
1.1       grant    1051:             Packaging figlet</a></span></dt>
                   1052:           </dl>
                   1053:         </dd>
                   1054: 
1.46      gdt      1055:         <dt><span class="appendix"><a href="#ftp-layout">C. Layout
1.1       grant    1056:         of the FTP server's package archive</a></span></dt>
1.2       hubertf  1057: 
1.46      gdt      1058:         <dt><span class="appendix"><a href="#editing">D. Editing
1.2       hubertf  1059:         guidelines for the pkgsrc guide</a></span></dt>
                   1060: 
                   1061:         <dd>
                   1062:           <dl>
1.46      gdt      1063:             <dt><span class="sect1"><a href="#targets">D.1.
1.2       hubertf  1064:             Targets</a></span></dt>
                   1065: 
1.46      gdt      1066:             <dt><span class="sect1"><a href="#procedure">D.2.
1.2       hubertf  1067:             Procedure</a></span></dt>
                   1068:           </dl>
                   1069:         </dd>
1.1       grant    1070:       </dl>
                   1071:     </div>
                   1072: 
1.67    ! hubertf  1073:     <div class="chapter" lang="en">
1.1       grant    1074:       <div class="titlepage">
                   1075:         <div>
                   1076:           <div>
1.67    ! hubertf  1077:             <h2 class="title"><a name=
1.51      rillig   1078:             "introduction"></a>Chapter&nbsp;1.&nbsp;What is
                   1079:             pkgsrc?</h2>
1.1       grant    1080:           </div>
                   1081:         </div>
                   1082:       </div>
                   1083: 
                   1084:       <div class="toc">
                   1085:         <p><b>Table of Contents</b></p>
                   1086: 
                   1087:         <dl>
1.30      wiz      1088:           <dt><span class="sect1"><a href=
                   1089:           "#introduction-section">1.1. Introduction</a></span></dt>
1.1       grant    1090: 
                   1091:           <dt><span class="sect1"><a href="#overview">1.2.
                   1092:           Overview</a></span></dt>
                   1093: 
                   1094:           <dt><span class="sect1"><a href="#terminology">1.3.
                   1095:           Terminology</a></span></dt>
                   1096: 
                   1097:           <dt><span class="sect1"><a href="#typography">1.4.
                   1098:           Typography</a></span></dt>
                   1099:         </dl>
                   1100:       </div>
                   1101: 
1.67    ! hubertf  1102:       <div class="sect1" lang="en">
1.1       grant    1103:         <div class="titlepage">
                   1104:           <div>
                   1105:             <div>
                   1106:               <h2 class="title" style="clear: both"><a name=
1.30      wiz      1107:               "introduction-section"></a>1.1.&nbsp;Introduction</h2>
1.1       grant    1108:             </div>
                   1109:           </div>
                   1110:         </div>
                   1111: 
1.47      reed     1112:         <p>There is a lot of software freely available for
                   1113:         Unix-based systems, which usually runs on NetBSD and other
1.1       grant    1114:         Unix-flavoured systems, too, sometimes with some
                   1115:         modifications. The NetBSD Packages Collection (pkgsrc)
                   1116:         incorporates any such changes necessary to make that
                   1117:         software run, and makes the installation (and
                   1118:         de-installation) of the software package easy by means of a
                   1119:         single command.</p>
                   1120: 
                   1121:         <p>Once the software has been built, it is manipulated with
1.14      xtraeme  1122:         the <span><strong class="command">pkg_*</strong></span>
                   1123:         tools so that installation and de-installation, printing of
                   1124:         an inventory of all installed packages and retrieval of
                   1125:         one-line comments or more verbose descriptions are all
                   1126:         simple.</p>
1.1       grant    1127: 
                   1128:         <p>pkgsrc currently contains several thousand packages,
                   1129:         including:</p>
                   1130: 
                   1131:         <div class="itemizedlist">
                   1132:           <ul type="disc">
                   1133:             <li>
                   1134:               <p><a xmlns=
                   1135:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1136:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.45      wiz      1137:               target="_top"><code xmlns="" class=
                   1138:               "filename">www/apache</code></a> - The Apache web
1.20      ben      1139:               server</p>
1.1       grant    1140:             </li>
                   1141: 
                   1142:             <li>
                   1143:               <p><a xmlns=
                   1144:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1145:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45      wiz      1146:               target="_top"><code xmlns="" class=
                   1147:               "filename">www/mozilla</code></a> - The Mozilla web
1.20      ben      1148:               browser</p>
1.1       grant    1149:             </li>
                   1150: 
                   1151:             <li>
                   1152:               <p><a xmlns=
                   1153:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1154:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.45      wiz      1155:               target="_top"><code xmlns="" class=
                   1156:               "filename">meta-pkgs/gnome</code></a> - The GNOME
1.20      ben      1157:               Desktop Environment</p>
1.1       grant    1158:             </li>
                   1159: 
                   1160:             <li>
                   1161:               <p><a xmlns=
                   1162:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1163:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.45      wiz      1164:               target="_top"><code xmlns="" class=
                   1165:               "filename">meta-pkgs/kde3</code></a> - The K Desktop
1.20      ben      1166:               Environment</p>
1.1       grant    1167:             </li>
                   1168:           </ul>
                   1169:         </div>
                   1170: 
                   1171:         <p>...just to name a few.</p>
                   1172: 
                   1173:         <p>pkgsrc has built-in support for handling varying
                   1174:         dependencies, such as pthreads and X11, and extended
                   1175:         features such as IPv6 support on a range of platforms.</p>
                   1176: 
                   1177:         <p>pkgsrc was derived from FreeBSD's ports system, and
                   1178:         initially developed for NetBSD only. Since then, pkgsrc has
                   1179:         grown a lot, and now supports the following platforms:</p>
                   1180: 
                   1181:         <div class="itemizedlist">
                   1182:           <ul type="disc">
                   1183:             <li>
                   1184:               <p><a href="http://developer.apple.com/darwin/"
                   1185:               target="_top">Darwin</a> (<a href=
                   1186:               "http://www.apple.com/macosx/" target="_top">Mac OS
                   1187:               X</a>)</p>
                   1188:             </li>
                   1189: 
                   1190:             <li>
1.3       hubertf  1191:               <p><a href="http://www.DragonFlyBSD.org/" target=
                   1192:               "_top">DragonFlyBSD</a></p>
                   1193:             </li>
                   1194: 
                   1195:             <li>
1.1       grant    1196:               <p><a href="http://www.FreeBSD.org/" target=
                   1197:               "_top">FreeBSD</a></p>
                   1198:             </li>
                   1199: 
                   1200:             <li>
1.3       hubertf  1201:               <p>Microsoft Windows, via <a href=
                   1202:               "http://www.microsoft.com/windows/sfu/" target=
                   1203:               "_top">Interix</a></p>
1.1       grant    1204:             </li>
                   1205: 
                   1206:             <li>
                   1207:               <p><a href="http://www.sgi.com/software/irix6.5/"
                   1208:               target="_top">IRIX</a></p>
                   1209:             </li>
                   1210: 
                   1211:             <li>
                   1212:               <p><a href="http://www.linux.org/" target=
                   1213:               "_top">Linux</a></p>
                   1214:             </li>
                   1215: 
                   1216:             <li>
                   1217:               <p><a href="http://www.NetBSD.org/" target=
                   1218:               "_top">NetBSD</a> (of course)</p>
                   1219:             </li>
                   1220: 
                   1221:             <li>
1.17      sketch   1222:               <p><a href="http://h30097.www3.hp.com/" target=
                   1223:               "_top">Tru64</a> (Digital UNIX, OSF1)</p>
                   1224:             </li>
                   1225: 
                   1226:             <li>
1.1       grant    1227:               <p><a href="http://www.openbsd.org/" target=
                   1228:               "_top">OpenBSD</a></p>
                   1229:             </li>
                   1230: 
                   1231:             <li>
                   1232:               <p><a href="http://www.sun.com/solaris/" target=
                   1233:               "_top">Solaris</a></p>
                   1234:             </li>
                   1235:           </ul>
                   1236:         </div>
                   1237:       </div>
                   1238: 
1.67    ! hubertf  1239:       <div class="sect1" lang="en">
1.1       grant    1240:         <div class="titlepage">
                   1241:           <div>
                   1242:             <div>
                   1243:               <h2 class="title" style="clear: both"><a name=
1.67    ! hubertf  1244:               "overview"></a>1.2.&nbsp;Overview</h2>
1.1       grant    1245:             </div>
                   1246:           </div>
                   1247:         </div>
                   1248: 
                   1249:         <p>This document is divided into two parts. The first,
                   1250:         <a href="#users-guide" title=
1.46      gdt      1251:         "Part&nbsp;I.&nbsp;The pkgsrc user's guide">The pkgsrc
1.2       hubertf  1252:         user's guide</a>, describes how one can use one of the
                   1253:         packages in the Package Collection, either by installing a
                   1254:         precompiled binary package, or by building one's own copy
                   1255:         using the NetBSD package system. The second part, <a href=
1.1       grant    1256:         "#developers-guide" title=
1.46      gdt      1257:         "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">The
                   1258:         pkgsrc developer's guide</a>, explains how to prepare a
                   1259:         package so it can be easily built by other NetBSD users
                   1260:         without knowing about the package's building details.</p>
1.1       grant    1261: 
                   1262:         <p>This document is available in various formats:</p>
                   1263: 
                   1264:         <div class="itemizedlist">
                   1265:           <ul type="disc">
                   1266:             <li>
                   1267:               <p><a href="index.html" target="_top">HTML</a></p>
                   1268:             </li>
                   1269: 
                   1270:             <li>
                   1271:               <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
                   1272:             </li>
                   1273: 
                   1274:             <li>
                   1275:               <p><a href="pkgsrc.ps" target="_top">PS</a></p>
                   1276:             </li>
                   1277: 
                   1278:             <li>
                   1279:               <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
                   1280:             </li>
                   1281:           </ul>
                   1282:         </div>
                   1283:       </div>
                   1284: 
1.67    ! hubertf  1285:       <div class="sect1" lang="en">
1.1       grant    1286:         <div class="titlepage">
                   1287:           <div>
                   1288:             <div>
                   1289:               <h2 class="title" style="clear: both"><a name=
                   1290:               "terminology"></a>1.3.&nbsp;Terminology</h2>
                   1291:             </div>
                   1292:           </div>
                   1293:         </div>
                   1294: 
                   1295:         <p>There has been a lot of talk about &#8220;<span class=
                   1296:         "quote">ports</span>&#8221;, &#8220;<span class=
                   1297:         "quote">packages</span>&#8221;, etc. so far. Here is a
                   1298:         description of all the terminology used within this
                   1299:         document.</p>
                   1300: 
                   1301:         <div class="variablelist">
                   1302:           <dl>
                   1303:             <dt><span class="term">Package</span></dt>
                   1304: 
                   1305:             <dd>
                   1306:               <p>A set of files and building instructions that
                   1307:               describe what's necessary to build a certain piece of
                   1308:               software using pkgsrc. Packages are traditionally
1.45      wiz      1309:               stored under <code xmlns=
                   1310:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1311:               "filename">/usr/pkgsrc</code>.</p>
1.1       grant    1312:             </dd>
                   1313: 
                   1314:             <dt><span class="term">The NetBSD package
                   1315:             system</span></dt>
                   1316: 
                   1317:             <dd>
                   1318:               <p>This is the former name of &#8220;<span class=
                   1319:               "quote">pkgsrc</span>&#8221;. It is part of the
1.27      rillig   1320:               NetBSD operating system and can be bootstrapped to
                   1321:               run on non-NetBSD operating systems as well. It
                   1322:               handles building (compiling), installing, and
                   1323:               removing of packages.</p>
1.1       grant    1324:             </dd>
                   1325: 
                   1326:             <dt><span class="term">Distfile</span></dt>
                   1327: 
                   1328:             <dd>
                   1329:               <p>This term describes the file or files that are
                   1330:               provided by the author of the piece of software to
                   1331:               distribute his work. All the changes necessary to
                   1332:               build on NetBSD are reflected in the corresponding
                   1333:               package. Usually the distfile is in the form of a
                   1334:               compressed tar-archive, but other types are possible,
1.45      wiz      1335:               too. Distfiles are usually stored below <code xmlns=
                   1336:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1337:               "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    1338:             </dd>
                   1339: 
                   1340:             <dt><span class="term">Port</span></dt>
                   1341: 
                   1342:             <dd>
                   1343:               <p>This is the term used by FreeBSD and OpenBSD
                   1344:               people for what we call a package. In NetBSD
                   1345:               terminology, &#8220;<span class=
                   1346:               "quote">port</span>&#8221; refers to a different
                   1347:               architecture.</p>
                   1348:             </dd>
                   1349: 
                   1350:             <dt><span class="term">Precompiled/binary
                   1351:             package</span></dt>
                   1352: 
                   1353:             <dd>
                   1354:               <p>A set of binaries built with pkgsrc from a
1.14      xtraeme  1355:               distfile and stuffed together in a single
1.45      wiz      1356:               <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   1357:               class="filename">.tgz</code> file so it can be
1.14      xtraeme  1358:               installed on machines of the same machine
                   1359:               architecture without the need to recompile. Packages
1.45      wiz      1360:               are usually generated in <code xmlns=
                   1361:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1362:               "filename">/usr/pkgsrc/packages</code>; there is also
                   1363:               an archive on <a href=
1.1       grant    1364:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
                   1365:               "_top">ftp.NetBSD.org</a>.</p>
                   1366: 
                   1367:               <p>Sometimes, this is referred to by the term
                   1368:               &#8220;<span class="quote">package</span>&#8221; too,
                   1369:               especially in the context of precompiled
                   1370:               packages.</p>
                   1371:             </dd>
                   1372: 
                   1373:             <dt><span class="term">Program</span></dt>
                   1374: 
                   1375:             <dd>
                   1376:               <p>The piece of software to be installed which will
1.47      reed     1377:               be constructed from all the files in the distfile by
1.1       grant    1378:               the actions defined in the corresponding package.</p>
                   1379:             </dd>
                   1380:           </dl>
                   1381:         </div>
                   1382:       </div>
                   1383: 
1.67    ! hubertf  1384:       <div class="sect1" lang="en">
1.1       grant    1385:         <div class="titlepage">
                   1386:           <div>
                   1387:             <div>
                   1388:               <h2 class="title" style="clear: both"><a name=
                   1389:               "typography"></a>1.4.&nbsp;Typography</h2>
                   1390:             </div>
                   1391:           </div>
                   1392:         </div>
                   1393: 
                   1394:         <p>When giving examples for commands, shell prompts are
                   1395:         used to show if the command should/can be issued as root,
                   1396:         or if &#8220;<span class="quote">normal</span>&#8221; user
1.14      xtraeme  1397:         privileges are sufficient. We use a <code class=
                   1398:         "prompt">#</code> for root's shell prompt, and a
1.27      rillig   1399:         <code class="prompt">%</code> for users' shell prompt,
1.14      xtraeme  1400:         assuming they use the C-shell or tcsh.</p>
1.1       grant    1401:       </div>
                   1402:     </div>
                   1403: 
1.67    ! hubertf  1404:     <div class="part" lang="en">
1.1       grant    1405:       <div class="titlepage">
                   1406:         <div>
                   1407:           <div>
1.67    ! hubertf  1408:             <h1 class="title"><a name=
1.48      dillo    1409:             "users-guide"></a>Part&nbsp;I.&nbsp;The pkgsrc user's
                   1410:             guide</h1>
1.1       grant    1411:           </div>
                   1412:         </div>
                   1413:       </div>
                   1414: 
                   1415:       <div class="toc">
                   1416:         <p><b>Table of Contents</b></p>
                   1417: 
                   1418:         <dl>
                   1419:           <dt><span class="chapter"><a href="#getting">2. Where to
1.59      rillig   1420:           get pkgsrc and how to keep it up-to-date</a></span></dt>
1.1       grant    1421: 
                   1422:           <dd>
                   1423:             <dl>
1.30      wiz      1424:               <dt><span class="sect1"><a href="#as-tar-file">2.1.
                   1425:               As tar file</a></span></dt>
1.1       grant    1426: 
1.30      wiz      1427:               <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1       grant    1428:               SUP</a></span></dt>
                   1429: 
1.30      wiz      1430:               <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1       grant    1431:               CVS</a></span></dt>
1.59      rillig   1432: 
                   1433:               <dt><span class="sect1"><a href="#uptodate-cvs">2.4.
                   1434:               Keeping pkgsrc up-to-date via CVS</a></span></dt>
1.1       grant    1435:             </dl>
                   1436:           </dd>
                   1437: 
                   1438:           <dt><span class="chapter"><a href="#platforms">3. Using
                   1439:           pkgsrc on systems other than NetBSD</a></span></dt>
                   1440: 
                   1441:           <dd>
                   1442:             <dl>
1.30      wiz      1443:               <dt><span class="sect1"><a href=
                   1444:               "#bootstrapping-pkgsrc">3.1. Bootstrapping
                   1445:               pkgsrc</a></span></dt>
1.1       grant    1446: 
1.30      wiz      1447:               <dt><span class="sect1"><a href=
1.47      reed     1448:               "#platform-specific-notes">3.2. Platform-specific
1.30      wiz      1449:               notes</a></span></dt>
1.1       grant    1450: 
                   1451:               <dd>
                   1452:                 <dl>
1.30      wiz      1453:                   <dt><span class="sect2"><a href="#darwin">3.2.1.
                   1454:                   Darwin (Mac OS X)</a></span></dt>
1.1       grant    1455: 
1.30      wiz      1456:                   <dt><span class="sect2"><a href="#freebsd">3.2.2.
                   1457:                   FreeBSD</a></span></dt>
1.22      tv       1458: 
1.30      wiz      1459:                   <dt><span class="sect2"><a href="#interix">3.2.3.
                   1460:                   Interix</a></span></dt>
1.1       grant    1461: 
1.30      wiz      1462:                   <dt><span class="sect2"><a href="#irix">3.2.4.
                   1463:                   IRIX</a></span></dt>
1.1       grant    1464: 
1.30      wiz      1465:                   <dt><span class="sect2"><a href="#linux">3.2.5.
                   1466:                   Linux</a></span></dt>
1.1       grant    1467: 
1.30      wiz      1468:                   <dt><span class="sect2"><a href="#openbsd">3.2.6.
                   1469:                   OpenBSD</a></span></dt>
1.1       grant    1470: 
1.30      wiz      1471:                   <dt><span class="sect2"><a href="#solaris">3.2.7.
                   1472:                   Solaris</a></span></dt>
1.1       grant    1473:                 </dl>
                   1474:               </dd>
                   1475:             </dl>
                   1476:           </dd>
                   1477: 
                   1478:           <dt><span class="chapter"><a href="#using">4. Using
                   1479:           pkgsrc</a></span></dt>
                   1480: 
                   1481:           <dd>
                   1482:             <dl>
                   1483:               <dt><span class="sect1"><a href=
                   1484:               "#getting-started">4.1. Working with binary
                   1485:               packages</a></span></dt>
                   1486: 
                   1487:               <dd>
                   1488:                 <dl>
                   1489:                   <dt><span class="sect2"><a href=
1.30      wiz      1490:                   "#where-to-get-binary-packages">4.1.1. Where to
                   1491:                   get binary packages</a></span></dt>
1.1       grant    1492: 
                   1493:                   <dt><span class="sect2"><a href=
1.30      wiz      1494:                   "#how-to-use-binary-packages">4.1.2. How to use
                   1495:                   binary packages</a></span></dt>
1.1       grant    1496: 
                   1497:                   <dt><span class="sect2"><a href=
1.30      wiz      1498:                   "#a-word-of-warning">4.1.3. A word of
1.1       grant    1499:                   warning</a></span></dt>
                   1500:                 </dl>
                   1501:               </dd>
                   1502: 
1.30      wiz      1503:               <dt><span class="sect1"><a href=
                   1504:               "#building-packages-from-source">4.2. Building
                   1505:               packages from source</a></span></dt>
1.1       grant    1506: 
                   1507:               <dd>
                   1508:                 <dl>
                   1509:                   <dt><span class="sect2"><a href=
1.30      wiz      1510:                   "#requirements">4.2.1.
                   1511:                   Requirements</a></span></dt>
1.1       grant    1512: 
                   1513:                   <dt><span class="sect2"><a href=
1.30      wiz      1514:                   "#fetching-distfiles">4.2.2. Fetching
1.1       grant    1515:                   distfiles</a></span></dt>
                   1516: 
                   1517:                   <dt><span class="sect2"><a href=
1.30      wiz      1518:                   "#how-to-build-and-install">4.2.3. How to build
                   1519:                   and install</a></span></dt>
1.1       grant    1520: 
                   1521:                   <dt><span class="sect2"><a href=
1.30      wiz      1522:                   "#selecting-the-compiler">4.2.4. Selecting the
1.1       grant    1523:                   compiler</a></span></dt>
                   1524:                 </dl>
                   1525:               </dd>
                   1526:             </dl>
                   1527:           </dd>
                   1528: 
1.38      dillo    1529:           <dt><span class="chapter"><a href="#configuring">5.
                   1530:           Configuring pkgsrc</a></span></dt>
                   1531: 
                   1532:           <dd>
                   1533:             <dl>
                   1534:               <dt><span class="sect1"><a href=
1.45      wiz      1535:               "#general-configuration">5.1. General
                   1536:               configuration</a></span></dt>
                   1537: 
                   1538:               <dt><span class="sect1"><a href=
                   1539:               "#variables-affecting-build">5.2. Variables affecting
                   1540:               the build process</a></span></dt>
                   1541: 
                   1542:               <dt><span class="sect1"><a href=
                   1543:               "#developer-advanced-settings">5.3.
                   1544:               Developer/advanced settings</a></span></dt>
                   1545: 
                   1546:               <dt><span class="sect1"><a href=
                   1547:               "#selecting-build-options">5.4. Selecting Build
1.42      dillo    1548:               Options</a></span></dt>
1.38      dillo    1549:             </dl>
                   1550:           </dd>
                   1551: 
                   1552:           <dt><span class="chapter"><a href="#binary">6. Creating
1.1       grant    1553:           binary packages</a></span></dt>
                   1554: 
                   1555:           <dd>
                   1556:             <dl>
1.30      wiz      1557:               <dt><span class="sect1"><a href=
1.38      dillo    1558:               "#building-a-single-binary-package">6.1. Building a
1.30      wiz      1559:               single binary package</a></span></dt>
1.1       grant    1560: 
1.30      wiz      1561:               <dt><span class="sect1"><a href=
1.38      dillo    1562:               "#settings-for-creationg-of-binary-packages">6.2.
1.1       grant    1563:               Settings for creation of binary
                   1564:               packages</a></span></dt>
                   1565: 
1.38      dillo    1566:               <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1       grant    1567:               Doing a bulk build of all packages</a></span></dt>
                   1568: 
                   1569:               <dd>
                   1570:                 <dl>
                   1571:                   <dt><span class="sect2"><a href=
1.38      dillo    1572:                   "#binary.configuration">6.3.1.
1.1       grant    1573:                   Configuration</a></span></dt>
                   1574: 
                   1575:                   <dt><span class="sect2"><a href=
1.38      dillo    1576:                   "#other-environmental-considerations">6.3.2.
1.30      wiz      1577:                   Other environmental
1.1       grant    1578:                   considerations</a></span></dt>
                   1579: 
                   1580:                   <dt><span class="sect2"><a href=
1.38      dillo    1581:                   "#operation">6.3.3. Operation</a></span></dt>
1.1       grant    1582: 
                   1583:                   <dt><span class="sect2"><a href=
1.38      dillo    1584:                   "#what-it-does">6.3.4. What it
1.30      wiz      1585:                   does</a></span></dt>
1.1       grant    1586: 
                   1587:                   <dt><span class="sect2"><a href=
1.38      dillo    1588:                   "#disk-space-requirements">6.3.5. Disk space
1.1       grant    1589:                   requirements</a></span></dt>
                   1590: 
                   1591:                   <dt><span class="sect2"><a href=
1.38      dillo    1592:                   "#setting-up-a-sandbox">6.3.6. Setting up a
1.47      reed     1593:                   sandbox for chrooted builds</a></span></dt>
1.1       grant    1594: 
                   1595:                   <dt><span class="sect2"><a href=
1.38      dillo    1596:                   "#building-a-partial-set">6.3.7. Building a
1.30      wiz      1597:                   partial set of packages</a></span></dt>
1.13      hubertf  1598: 
                   1599:                   <dt><span class="sect2"><a href=
1.38      dillo    1600:                   "#bulk-upload">6.3.8. Uploading results of a bulk
1.13      hubertf  1601:                   build</a></span></dt>
1.1       grant    1602:                 </dl>
                   1603:               </dd>
                   1604: 
1.30      wiz      1605:               <dt><span class="sect1"><a href=
1.38      dillo    1606:               "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30      wiz      1607:               packages collection</a></span></dt>
1.1       grant    1608: 
                   1609:               <dd>
                   1610:                 <dl>
                   1611:                   <dt><span class="sect2"><a href=
1.38      dillo    1612:                   "#cdpack-example">6.4.1. Example of
1.1       grant    1613:                   cdpack</a></span></dt>
                   1614:                 </dl>
                   1615:               </dd>
                   1616:             </dl>
                   1617:           </dd>
                   1618: 
1.38      dillo    1619:           <dt><span class="chapter"><a href="#faq">7. Frequently
1.1       grant    1620:           Asked Questions</a></span></dt>
                   1621: 
                   1622:           <dd>
                   1623:             <dl>
1.30      wiz      1624:               <dt><span class="sect1"><a href=
1.38      dillo    1625:               "#mailing-list-pointers">7.1. Are there any mailing
1.30      wiz      1626:               lists for pkg-related discussion?</a></span></dt>
1.1       grant    1627: 
1.38      dillo    1628:               <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1       grant    1629:               Where's the pkgviews documentation?</a></span></dt>
                   1630: 
1.38      dillo    1631:               <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1       grant    1632:               Utilities for package management
                   1633:               (pkgtools)</a></span></dt>
                   1634: 
1.30      wiz      1635:               <dt><span class="sect1"><a href=
1.38      dillo    1636:               "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30      wiz      1637:               non-root</a></span></dt>
1.1       grant    1638: 
1.30      wiz      1639:               <dt><span class="sect1"><a href=
1.38      dillo    1640:               "#resume-transfers">7.5. How to resume transfers when
1.30      wiz      1641:               fetching distfiles?</a></span></dt>
1.14      xtraeme  1642: 
1.30      wiz      1643:               <dt><span class="sect1"><a href=
1.38      dillo    1644:               "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30      wiz      1645:               XFree86 from pkgsrc?</a></span></dt>
1.1       grant    1646: 
1.30      wiz      1647:               <dt><span class="sect1"><a href=
1.38      dillo    1648:               "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30      wiz      1649:               from pkgsrc?</a></span></dt>
1.1       grant    1650: 
1.30      wiz      1651:               <dt><span class="sect1"><a href=
1.38      dillo    1652:               "#fetch-behind-firewall">7.8. How to fetch files from
1.30      wiz      1653:               behind a firewall</a></span></dt>
1.1       grant    1654: 
1.38      dillo    1655:               <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.30      wiz      1656:               How do I tell <span><strong class="command">make
1.14      xtraeme  1657:               fetch</strong></span> to do passive
1.1       grant    1658:               FTP?</a></span></dt>
                   1659: 
1.30      wiz      1660:               <dt><span class="sect1"><a href=
1.38      dillo    1661:               "#fetching-all-distfiles">7.10. How to fetch all
1.30      wiz      1662:               distfiles at once</a></span></dt>
1.1       grant    1663: 
1.30      wiz      1664:               <dt><span class="sect1"><a href=
1.38      dillo    1665:               "#tmac.andoc-missing">7.11. What does
1.30      wiz      1666:               &#8220;<span class="quote">Don't know how to make
                   1667:               /usr/share/tmac/tmac.andoc</span>&#8221;
1.14      xtraeme  1668:               mean?</a></span></dt>
1.13      hubertf  1669: 
1.30      wiz      1670:               <dt><span class="sect1"><a href=
1.38      dillo    1671:               "#bsd.own.mk-missing">7.12. What does
1.30      wiz      1672:               &#8220;<span class="quote">Could not find
1.14      xtraeme  1673:               bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    1674: 
1.30      wiz      1675:               <dt><span class="sect1"><a href=
1.38      dillo    1676:               "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30      wiz      1677:               pkgsrc</a></span></dt>
1.1       grant    1678: 
1.38      dillo    1679:               <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35      jmmv     1680:               do I change the location of configuration
                   1681:               files?</a></span></dt>
1.1       grant    1682: 
                   1683:               <dt><span class="sect1"><a href=
1.38      dillo    1684:               "#audit-packages">7.15. Automated security
1.1       grant    1685:               checks</a></span></dt>
                   1686:             </dl>
                   1687:           </dd>
                   1688:         </dl>
                   1689:       </div>
                   1690: 
1.67    ! hubertf  1691:       <div class="chapter" lang="en">
1.1       grant    1692:         <div class="titlepage">
                   1693:           <div>
                   1694:             <div>
1.67    ! hubertf  1695:               <h2 class="title"><a name=
1.1       grant    1696:               "getting"></a>Chapter&nbsp;2.&nbsp;Where to get
1.59      rillig   1697:               pkgsrc and how to keep it up-to-date</h2>
1.1       grant    1698:             </div>
                   1699:           </div>
                   1700:         </div>
                   1701: 
                   1702:         <div class="toc">
                   1703:           <p><b>Table of Contents</b></p>
                   1704: 
                   1705:           <dl>
1.30      wiz      1706:             <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1       grant    1707:             tar file</a></span></dt>
                   1708: 
1.30      wiz      1709:             <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1       grant    1710:             SUP</a></span></dt>
                   1711: 
1.30      wiz      1712:             <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1       grant    1713:             CVS</a></span></dt>
1.59      rillig   1714: 
                   1715:             <dt><span class="sect1"><a href="#uptodate-cvs">2.4.
                   1716:             Keeping pkgsrc up-to-date via CVS</a></span></dt>
1.1       grant    1717:           </dl>
                   1718:         </div>
                   1719: 
                   1720:         <p>There are three ways to get pkgsrc. Either as a tar
                   1721:         file, via SUP, or via CVS. All three ways are described
                   1722:         here.</p>
                   1723: 
1.67    ! hubertf  1724:         <div class="sect1" lang="en">
1.1       grant    1725:           <div class="titlepage">
                   1726:             <div>
                   1727:               <div>
                   1728:                 <h2 class="title" style="clear: both"><a name=
1.67    ! hubertf  1729:                 "as-tar-file"></a>2.1.&nbsp;As tar file</h2>
1.1       grant    1730:               </div>
                   1731:             </div>
                   1732:           </div>
                   1733: 
                   1734:           <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
                   1735:           file from <a href=
1.11      ben      1736:           "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20      ben      1737:           target="_top">ftp.NetBSD.org</a> and unpack it into
1.45      wiz      1738:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   1739:           class="filename">/usr/pkgsrc</code>.</p>
1.1       grant    1740:         </div>
                   1741: 
1.67    ! hubertf  1742:         <div class="sect1" lang="en">
1.1       grant    1743:           <div class="titlepage">
                   1744:             <div>
                   1745:               <div>
                   1746:                 <h2 class="title" style="clear: both"><a name=
1.67    ! hubertf  1747:                 "via-sup"></a>2.2.&nbsp;Via SUP</h2>
1.1       grant    1748:               </div>
                   1749:             </div>
                   1750:           </div>
                   1751: 
                   1752:           <p>As an alternative to the tar file, you can get pkgsrc
                   1753:           via the Software Update Protocol, SUP. To do so, make
                   1754:           sure your supfile has a line</p>
                   1755:           <pre class="programlisting">
1.51      rillig   1756:     release=pkgsrc
1.1       grant    1757: </pre>
                   1758: 
1.45      wiz      1759:           <p>in it, see the examples in <code xmlns=
                   1760:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1761:           "filename">/usr/share/examples/supfiles</code>, and that
1.45      wiz      1762:           the <code xmlns=
                   1763:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1764:           "filename">/usr/pkgsrc</code> directory exists. Then,
                   1765:           simply run <span><strong class="command">sup -v
                   1766:           <em class="replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1       grant    1767:         </div>
                   1768: 
1.67    ! hubertf  1769:         <div class="sect1" lang="en">
1.1       grant    1770:           <div class="titlepage">
                   1771:             <div>
                   1772:               <div>
                   1773:                 <h2 class="title" style="clear: both"><a name=
1.67    ! hubertf  1774:                 "via-cvs"></a>2.3.&nbsp;Via CVS</h2>
1.1       grant    1775:               </div>
                   1776:             </div>
                   1777:           </div>
                   1778: 
                   1779:           <p>To get pkgsrc via CVS, make sure you have
                   1780:           &#8220;<span class="quote">cvs</span>&#8221; installed.
1.27      rillig   1781:           To do an initial (full) checkout of pkgsrc, do the
                   1782:           following steps:</p>
1.1       grant    1783:           <pre class="screen">
1.14      xtraeme  1784: <code class="prompt">%</code> <strong class=
                   1785: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
                   1786: <code class="prompt">%</code> <strong class=
                   1787: "userinput"><code>setenv CVS_RSH ssh</code></strong>
                   1788: <code class="prompt">%</code> <strong class=
                   1789: "userinput"><code>cd /usr</code></strong>
                   1790: <code class="prompt">%</code> <strong class=
                   1791: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
                   1792: </pre>
                   1793: 
1.45      wiz      1794:           <p>This will create the <code xmlns=
                   1795:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1796:           "filename">pkgsrc</code> directory in your <code xmlns=
                   1797:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1798:           "filename">/usr</code>, and all the package source will
1.45      wiz      1799:           be stored under <code xmlns=
                   1800:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1801:           "filename">/usr/pkgsrc</code>. To update pkgsrc after the
                   1802:           initial checkout, make sure you have <code class=
                   1803:           "varname">CVS_RSH</code> set as above, then do:</p>
1.1       grant    1804:           <pre class="screen">
1.14      xtraeme  1805: <code class="prompt">%</code> <strong class=
                   1806: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   1807: <code class="prompt">%</code> <strong class=
                   1808: "userinput"><code>cvs -q update -dP</code></strong>
1.1       grant    1809: </pre>
                   1810: 
                   1811:           <p>Please also note that it is possible to have multiple
                   1812:           copies of the pkgsrc hierarchy in use at any one time -
                   1813:           all work is done relatively within the pkgsrc tree.</p>
                   1814:         </div>
1.59      rillig   1815: 
1.67    ! hubertf  1816:         <div class="sect1" lang="en">
1.59      rillig   1817:           <div class="titlepage">
                   1818:             <div>
                   1819:               <div>
                   1820:                 <h2 class="title" style="clear: both"><a name=
                   1821:                 "uptodate-cvs"></a>2.4.&nbsp;Keeping pkgsrc
                   1822:                 up-to-date via CVS</h2>
                   1823:               </div>
                   1824:             </div>
                   1825:           </div>
                   1826: 
                   1827:           <p>If your copy of pkgsrc contains a lot of <code xmlns=
                   1828:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1829:           "filename">CVS</code> directories, you can update it
                   1830:           using the <a href=
                   1831:           "http://netbsd.gw.com/cgi-bin/man-cgi?cvs+1+NetBSD-current">
                   1832:           <span class="citerefentry"><span class=
                   1833:           "refentrytitle">cvs</span>(1)</span></a> program. First,
                   1834:           <span><strong class="command">cd</strong></span> to the
                   1835:           top level directory of pkgsrc. Then run
                   1836:           <span><strong class="command">cvs -q update
                   1837:           -dP</strong></span>, and you're done.</p>
                   1838: 
                   1839:           <p>If that doesn't work and the file <code xmlns=
                   1840:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1841:           "filename">CVS/Root</code> contains the string
                   1842:           &#8220;<span class="quote">:pserver:</span>&#8221;, you
                   1843:           have to run <span><strong class="command">cvs
                   1844:           login</strong></span> once to get known to the NetBSD CVS
                   1845:           server. The <span><strong class=
                   1846:           "command">cvs</strong></span> utility will then ask you
                   1847:           for a password. Just enter &#8220;<span class=
                   1848:           "quote">anoncvs</span>&#8221;. Then try again to
                   1849:           update.</p>
                   1850:         </div>
1.1       grant    1851:       </div>
                   1852: 
1.67    ! hubertf  1853:       <div class="chapter" lang="en">
1.1       grant    1854:         <div class="titlepage">
                   1855:           <div>
                   1856:             <div>
1.67    ! hubertf  1857:               <h2 class="title"><a name=
1.1       grant    1858:               "platforms"></a>Chapter&nbsp;3.&nbsp;Using pkgsrc on
                   1859:               systems other than NetBSD</h2>
                   1860:             </div>
                   1861:           </div>
                   1862:         </div>
                   1863: 
                   1864:         <div class="toc">
                   1865:           <p><b>Table of Contents</b></p>
                   1866: 
                   1867:           <dl>
1.30      wiz      1868:             <dt><span class="sect1"><a href=
                   1869:             "#bootstrapping-pkgsrc">3.1. Bootstrapping
                   1870:             pkgsrc</a></span></dt>
1.1       grant    1871: 
1.30      wiz      1872:             <dt><span class="sect1"><a href=
1.47      reed     1873:             "#platform-specific-notes">3.2. Platform-specific
1.30      wiz      1874:             notes</a></span></dt>
1.1       grant    1875: 
                   1876:             <dd>
                   1877:               <dl>
1.30      wiz      1878:                 <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1       grant    1879:                 Darwin (Mac OS X)</a></span></dt>
                   1880: 
1.30      wiz      1881:                 <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1       grant    1882:                 FreeBSD</a></span></dt>
                   1883: 
1.30      wiz      1884:                 <dt><span class="sect2"><a href="#interix">3.2.3.
1.1       grant    1885:                 Interix</a></span></dt>
                   1886: 
1.30      wiz      1887:                 <dt><span class="sect2"><a href="#irix">3.2.4.
1.1       grant    1888:                 IRIX</a></span></dt>
                   1889: 
1.30      wiz      1890:                 <dt><span class="sect2"><a href="#linux">3.2.5.
1.22      tv       1891:                 Linux</a></span></dt>
                   1892: 
1.30      wiz      1893:                 <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1       grant    1894:                 OpenBSD</a></span></dt>
                   1895: 
1.30      wiz      1896:                 <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1       grant    1897:                 Solaris</a></span></dt>
                   1898:               </dl>
                   1899:             </dd>
                   1900:           </dl>
                   1901:         </div>
                   1902: 
1.67    ! hubertf  1903:         <div class="sect1" lang="en">
1.1       grant    1904:           <div class="titlepage">
                   1905:             <div>
                   1906:               <div>
                   1907:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      1908:                 "bootstrapping-pkgsrc"></a>3.1.&nbsp;Bootstrapping
                   1909:                 pkgsrc</h2>
1.1       grant    1910:               </div>
                   1911:             </div>
                   1912:           </div>
                   1913: 
1.27      rillig   1914:           <p>For operating systems other than NetBSD, we provide a
1.1       grant    1915:           bootstrap kit to build the required tools to use pkgsrc
                   1916:           on your platform. Besides support for native NetBSD,
                   1917:           pkgsrc and the bootstrap kit have support for the
                   1918:           following operating systems:</p>
                   1919: 
                   1920:           <div class="itemizedlist">
                   1921:             <ul type="disc">
                   1922:               <li>
                   1923:                 <p>Darwin (Mac OS X)</p>
                   1924:               </li>
                   1925: 
                   1926:               <li>
1.16      grant    1927:                 <p>DragonFlyBSD</p>
                   1928:               </li>
                   1929: 
                   1930:               <li>
1.1       grant    1931:                 <p>FreeBSD</p>
                   1932:               </li>
                   1933: 
                   1934:               <li>
                   1935:                 <p>Interix (Windows 2000, XP, 2003)</p>
                   1936:               </li>
                   1937: 
                   1938:               <li>
                   1939:                 <p>IRIX</p>
                   1940:               </li>
                   1941: 
                   1942:               <li>
                   1943:                 <p>Linux</p>
                   1944:               </li>
                   1945: 
                   1946:               <li>
                   1947:                 <p>OpenBSD</p>
                   1948:               </li>
                   1949: 
                   1950:               <li>
                   1951:                 <p>Solaris</p>
                   1952:               </li>
1.16      grant    1953: 
                   1954:               <li>
                   1955:                 <p>Tru64 (Digital UNIX/OSF1)</p>
                   1956:               </li>
1.1       grant    1957:             </ul>
                   1958:           </div>
                   1959: 
                   1960:           <p>Support for other platforms is under development.</p>
                   1961: 
                   1962:           <p>Installing the bootstrap kit should be as simple
                   1963:           as:</p>
                   1964:           <pre class="screen">
1.14      xtraeme  1965: <code class="prompt">#</code> <strong class=
                   1966: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
                   1967: <code class="prompt">#</code> <strong class=
                   1968: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1969: <code class="prompt">#</code> <strong class=
                   1970: "userinput"><code>./bootstrap</code></strong>
1.1       grant    1971: </pre>
                   1972: 
                   1973:           <p>See <a href="#getting" title=
1.59      rillig   1974:           "Chapter&nbsp;2.&nbsp;Where to get pkgsrc and how to keep it up-to-date">
1.67    ! hubertf  1975:           Chapter&nbsp;2, <i>Where to get pkgsrc and how to keep it
1.59      rillig   1976:           up-to-date</i></a> for other ways to get pkgsrc before
                   1977:           bootstrapping. The given <span><strong class=
                   1978:           "command">bootstrap</strong></span> command will use the
                   1979:           defaults of <code xmlns=
1.45      wiz      1980:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1981:           "filename">/usr/pkg</code> for the <span class=
                   1982:           "emphasis"><em>prefix</em></span> where programs will be
1.45      wiz      1983:           installed in, and <code xmlns=
                   1984:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1985:           "filename">/var/db/pkg</code> for the package database
1.27      rillig   1986:           directory where pkgsrc will do its internal bookkeeping.
1.1       grant    1987:           However, these can also be set using command-line
1.27      rillig   1988:           arguments.</p>
1.1       grant    1989: 
                   1990:           <p>Binary packages for the pkgsrc tools and an initial
                   1991:           set of packages is available for supported platforms. An
                   1992:           up-to-date list of these can be found on <a href=
                   1993:           "http://www.pkgsrc.org/" target=
1.63      dillo    1994:           "_top">www.pkgsrc.org</a>. Note that this only works for
                   1995:           privileged builds that install into <code xmlns=
                   1996:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1997:           "filename">/usr/pkg</code>.</p>
1.47      reed     1998: 
                   1999:           <div class="note" style=
                   2000:           "margin-left: 0.5in; margin-right: 0.5in;">
                   2001:             <h3 class="title">Note</h3>
                   2002: 
                   2003:             <p>The bootstrap installs a <span><strong class=
                   2004:             "command">bmake</strong></span> tool. Use this
                   2005:             <span><strong class="command">bmake</strong></span>
                   2006:             when building via pkgsrc. For examples in this guide,
                   2007:             use <span><strong class="command">bmake</strong></span>
                   2008:             instead of &#8220;<span class=
                   2009:             "quote">make</span>&#8221;.</p>
                   2010:           </div>
1.1       grant    2011:         </div>
                   2012: 
1.67    ! hubertf  2013:         <div class="sect1" lang="en">
1.1       grant    2014:           <div class="titlepage">
                   2015:             <div>
                   2016:               <div>
                   2017:                 <h2 class="title" style="clear: both"><a name=
1.47      reed     2018:                 "platform-specific-notes"></a>3.2.&nbsp;Platform-specific
                   2019:                 notes</h2>
1.1       grant    2020:               </div>
                   2021:             </div>
                   2022:           </div>
                   2023: 
                   2024:           <p>Here are some platform-specific notes you should be
                   2025:           aware of.</p>
                   2026: 
1.67    ! hubertf  2027:           <div class="sect2" lang="en">
1.1       grant    2028:             <div class="titlepage">
                   2029:               <div>
                   2030:                 <div>
1.67    ! hubertf  2031:                   <h3 class="title"><a name=
1.30      wiz      2032:                   "darwin"></a>3.2.1.&nbsp;Darwin (Mac OS X)</h3>
1.1       grant    2033:                 </div>
                   2034:               </div>
                   2035:             </div>
                   2036: 
                   2037:             <p>Darwin 5.x and 6.x are supported. There are two
                   2038:             methods of using pkgsrc on Mac OS X, by using a
                   2039:             <a href="#platform.osx-image" title=
                   2040:             "3.2.1.1.&nbsp;Using a disk image">disk image</a>, or a
                   2041:             <a href="#platform.osx-ufs" title=
                   2042:             "3.2.1.2.&nbsp;Using a UFS partition">UFS
                   2043:             partition</a>.</p>
                   2044: 
                   2045:             <p>Before you start, you will need to download and
                   2046:             install the Mac OS X Developer Tools from Apple's
                   2047:             Developer Connection. See <a href=
                   2048:             "http://developer.apple.com/macosx/" target=
                   2049:             "_top">http://developer.apple.com/macosx/</a> for
                   2050:             details. Also, make sure you install X11 for Mac OS X
                   2051:             and the X11 SDK from <a href=
                   2052:             "http://www.apple.com/macosx/x11/download/" target=
                   2053:             "_top">http://www.apple.com/macosx/x11/download/</a> if
                   2054:             you intend to build packages that use the X11 Window
                   2055:             System.</p>
                   2056: 
                   2057:             <p>If you already have a UFS partition, or have a spare
                   2058:             partition that you can format as UFS, it is recommended
                   2059:             to use that instead of the disk image. It'll be
                   2060:             somewhat faster and will mount automatically at boot
                   2061:             time, where you must manually mount a disk image.</p>
                   2062: 
                   2063:             <div class="note" style=
                   2064:             "margin-left: 0.5in; margin-right: 0.5in;">
                   2065:               <h3 class="title">Note</h3>
                   2066: 
                   2067:               <p>You cannot use a HFS+ file system for pkgsrc,
1.47      reed     2068:               because pkgsrc currently requires the file system to
1.1       grant    2069:               be case-sensitive, and HFS+ is not.</p>
                   2070:             </div>
                   2071: 
1.67    ! hubertf  2072:             <div class="sect3" lang="en">
1.1       grant    2073:               <div class="titlepage">
                   2074:                 <div>
                   2075:                   <div>
1.67    ! hubertf  2076:                     <h4 class="title"><a name=
        !          2077:                     "platform.osx-image"></a>3.2.1.1.&nbsp;Using a
        !          2078:                     disk image</h4>
1.1       grant    2079:                   </div>
                   2080:                 </div>
                   2081:               </div>
                   2082: 
                   2083:               <p>Create the disk image:</p>
                   2084:               <pre class="screen">
1.14      xtraeme  2085: <code class="prompt">#</code> <strong class=
                   2086: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   2087: <code class="prompt">#</code> <strong class=
                   2088: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
                   2089: <code class="prompt">#</code> <strong class=
                   2090: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
                   2091: <code class="prompt">#</code> <strong class=
                   2092: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1       grant    2093: </pre>
                   2094: 
                   2095:               <p>That's it!</p>
                   2096:             </div>
                   2097: 
1.67    ! hubertf  2098:             <div class="sect3" lang="en">
1.1       grant    2099:               <div class="titlepage">
                   2100:                 <div>
                   2101:                   <div>
1.67    ! hubertf  2102:                     <h4 class="title"><a name=
        !          2103:                     "platform.osx-ufs"></a>3.2.1.2.&nbsp;Using a
1.1       grant    2104:                     UFS partition</h4>
                   2105:                   </div>
                   2106:                 </div>
                   2107:               </div>
                   2108: 
1.45      wiz      2109:               <p>By default, <code xmlns=
                   2110:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   2111:               "filename">/usr</code> will be on your root file
                   2112:               system, normally HFS+. It is possible to use the
                   2113:               default <span class="emphasis"><em>prefix</em></span>
                   2114:               of <code xmlns=
                   2115:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   2116:               "filename">/usr/pkg</code> by symlinking <code xmlns=
                   2117:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2118:               "filename">/usr/pkg</code> to a directory on a UFS
                   2119:               file system. Obviously, another symlink is required
                   2120:               if you want to place the package database directory
                   2121:               outside the <span class=
                   2122:               "emphasis"><em>prefix</em></span>. e.g.</p>
1.1       grant    2123:               <pre class="screen">
1.14      xtraeme  2124: <code class="prompt">#</code> <strong class=
1.59      rillig   2125: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb</code></strong>
1.1       grant    2126: </pre>
                   2127: 
                   2128:               <p>If you created your partitions at the time of
                   2129:               installing Mac OS X and formatted the target
                   2130:               partition as UFS, it should automatically mount on
1.45      wiz      2131:               <code xmlns=
                   2132:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   2133:               "filename">/Volumes/&lt;volume name&gt;</code> when
                   2134:               the machine boots. If you are (re)formatting a
                   2135:               partition as UFS, you need to ensure that the
                   2136:               partition map correctly reflects &#8220;<span class=
                   2137:               "quote">Apple_UFS</span>&#8221; and not
                   2138:               &#8220;<span class=
1.1       grant    2139:               "quote">Apple_HFS</span>&#8221;.</p>
                   2140: 
                   2141:               <p>The problem is that none of the disk tools will
                   2142:               let you touch a disk that is booted from. You can
                   2143:               unmount the partition, but even if you newfs it, the
                   2144:               partition type will be incorrect and the automounter
                   2145:               won't mount it. It can be mounted manually, but it
                   2146:               won't appear in Finder.</p>
                   2147: 
                   2148:               <p>You'll need to boot off of the OS X Installation
                   2149:               (User) CD. When the Installation program starts, go
                   2150:               up to the menu and select Disk Utility. Now, you will
                   2151:               be able to select the partition you want to be UFS,
                   2152:               and Format it Apple UFS. Quit the Disk Utility, quit
                   2153:               the installer which will reboot your machine. The new
                   2154:               UFS file system will appear in Finder.</p>
                   2155: 
                   2156:               <p>Be aware that the permissions on the new file
                   2157:               system will be writable by root only.</p>
                   2158: 
                   2159:               <p>This note is as of 10.2 (Jaguar) and applies to
                   2160:               earlier versions. Hopefully Apple will fix Disk
                   2161:               Utility in 10.3 (Panther).</p>
                   2162:             </div>
                   2163:           </div>
                   2164: 
1.67    ! hubertf  2165:           <div class="sect2" lang="en">
1.1       grant    2166:             <div class="titlepage">
                   2167:               <div>
                   2168:                 <div>
1.67    ! hubertf  2169:                   <h3 class="title"><a name=
1.30      wiz      2170:                   "freebsd"></a>3.2.2.&nbsp;FreeBSD</h3>
1.1       grant    2171:                 </div>
                   2172:               </div>
                   2173:             </div>
                   2174: 
                   2175:             <p>FreeBSD 4.7 and 5.0 have been tested and are
                   2176:             supported, other versions may work.</p>
                   2177: 
                   2178:             <p>Care should be taken so that the tools that this kit
                   2179:             installs do not conflict with the FreeBSD userland
                   2180:             tools. There are several steps:</p>
                   2181: 
                   2182:             <div class="orderedlist">
                   2183:               <ol type="1">
                   2184:                 <li>
                   2185:                   <p>FreeBSD stores its ports pkg database in
1.45      wiz      2186:                   <code xmlns=
                   2187:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   2188:                   "filename">/var/db/pkg</code>. It is therefore
                   2189:                   recommended that you choose a different location
                   2190:                   (e.g. <code xmlns=
                   2191:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2192:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2193:                   --pkgdbdir option to the bootstrap script.</p>
                   2194:                 </li>
                   2195: 
                   2196:                 <li>
                   2197:                   <p>If you do not intend to use the FreeBSD ports
                   2198:                   tools, it's probably a good idea to move them out
                   2199:                   of the way to avoid confusion, e.g.</p>
                   2200:                   <pre class="screen">
1.14      xtraeme  2201: <code class="prompt">#</code> <strong class=
                   2202: "userinput"><code>cd /usr/sbin</code></strong>
                   2203: <code class="prompt">#</code> <strong class=
                   2204: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2205: <code class="prompt">#</code> <strong class=
                   2206: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2207: <code class="prompt">#</code> <strong class=
                   2208: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2209: <code class="prompt">#</code> <strong class=
                   2210: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2211: </pre>
                   2212:                 </li>
                   2213: 
                   2214:                 <li>
1.45      wiz      2215:                   <p>An example <code xmlns=
                   2216:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2217:                   "filename">/etc/mk.conf</code> file will be
1.45      wiz      2218:                   placed in <code xmlns=
                   2219:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2220:                   "filename">/etc/mk.conf.example</code> file when
                   2221:                   you use the bootstrap script.</p>
1.1       grant    2222:                 </li>
                   2223:               </ol>
                   2224:             </div>
                   2225:           </div>
                   2226: 
1.67    ! hubertf  2227:           <div class="sect2" lang="en">
1.1       grant    2228:             <div class="titlepage">
                   2229:               <div>
                   2230:                 <div>
1.67    ! hubertf  2231:                   <h3 class="title"><a name=
1.30      wiz      2232:                   "interix"></a>3.2.3.&nbsp;Interix</h3>
1.1       grant    2233:                 </div>
                   2234:               </div>
                   2235:             </div>
                   2236: 
1.47      reed     2237:             <p>Interix is a POSIX-compatible subsystem for the
1.1       grant    2238:             Windows NT kernel, providing a Unix-like environment
                   2239:             with a tighter kernel integration than available with
                   2240:             Cygwin. It is part of the Windows Services for Unix
                   2241:             package, available for free for any licensed copy of
1.22      tv       2242:             Windows 2000, XP (not including XP Home), or 2003. SFU
                   2243:             can be downloaded from <a href=
                   2244:             "http://www.microsoft.com/windows/sfu/" target=
1.1       grant    2245:             "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
                   2246: 
                   2247:             <p>Services for Unix 3.5, current as of this writing,
                   2248:             has been tested. 3.0 or 3.1 may work, but are not
                   2249:             officially supported. (The main difference in 3.0/3.1
                   2250:             is lack of pthreads.)</p>
                   2251: 
1.67    ! hubertf  2252:             <div class="sect3" lang="en">
1.1       grant    2253:               <div class="titlepage">
                   2254:                 <div>
                   2255:                   <div>
                   2256:                     <h4 class="title"><a name=
                   2257:                     "platform.interix-sfu-install"></a>3.2.3.1.&nbsp;When
1.2       hubertf  2258:                     installing Interix/SFU</h4>
1.1       grant    2259:                   </div>
                   2260:                 </div>
                   2261:               </div>
                   2262: 
                   2263:               <p>At an absolute minimum, the following packages
                   2264:               must be installed from the Windows Services for Unix
                   2265:               3.5 distribution in order to use pkgsrc:</p>
                   2266: 
                   2267:               <div class="itemizedlist">
                   2268:                 <ul type="disc">
                   2269:                   <li>
                   2270:                     <p>Utilities -&gt; Base Utilities</p>
                   2271:                   </li>
                   2272: 
                   2273:                   <li>
                   2274:                     <p>Interix GNU Components -&gt; (all)</p>
                   2275:                   </li>
                   2276: 
                   2277:                   <li>
                   2278:                     <p>Remote Connectivity</p>
                   2279:                   </li>
                   2280: 
                   2281:                   <li>
                   2282:                     <p>Interix SDK</p>
                   2283:                   </li>
                   2284:                 </ul>
                   2285:               </div>
                   2286: 
                   2287:               <p>When using pkgsrc on Interix, DO NOT install the
                   2288:               Utilities subcomponent "UNIX Perl". That is Perl 5.6
                   2289:               without shared module support, installed to
                   2290:               /usr/local, and will only cause confusion. Instead,
                   2291:               install Perl 5.8 from pkgsrc (or from a binary
                   2292:               package).</p>
                   2293: 
                   2294:               <p>The Remote Connectivity subcomponent "Windows
                   2295:               Remote Shell Service" does not need to be installed,
                   2296:               but Remote Connectivity itself should be installed in
                   2297:               order to have a working inetd.</p>
                   2298: 
1.52      tv       2299:               <p>During installation you may be asked whether to
                   2300:               enable setuid behavior for Interix programs, and
                   2301:               whether to make pathnames default to case-sensitive.
                   2302:               Setuid should be enabled, and case-sensitivity MUST
                   2303:               be enabled. (Without case-sensitivity, a large number
                   2304:               of packages including perl will not build.)</p>
                   2305: 
                   2306:               <p>NOTE: Newer Windows service packs change the way
                   2307:               binary execution works (via the Data Execution
                   2308:               Prevention feature). In order to use pkgsrc and other
                   2309:               gcc-compiled binaries reliably, a hotfix containing
                   2310:               POSIX.EXE, PSXDLL.DLL, PSXRUN.EXE, and PSXSS.EXE
                   2311:               (899522 or newer) must be installed. Hotfixes are
                   2312:               available from Microsoft through a support contract;
                   2313:               however, a NetBSD developer has made most Interix
                   2314:               hotfixes available for personal use from <a href=
                   2315:               "http://www.duh.org/interix/hotfixes.php" target=
                   2316:               "_top">http://www.duh.org/interix/hotfixes.php</a>.</p>
1.1       grant    2317:             </div>
                   2318: 
1.67    ! hubertf  2319:             <div class="sect3" lang="en">
1.1       grant    2320:               <div class="titlepage">
                   2321:                 <div>
                   2322:                   <div>
                   2323:                     <h4 class="title"><a name=
                   2324:                     "platform.interix-sfu-postinstall"></a>3.2.3.2.&nbsp;What
                   2325:                     to do if Interix/SFU is already installed</h4>
                   2326:                   </div>
                   2327:                 </div>
                   2328:               </div>
                   2329: 
                   2330:               <p>If SFU is already installed and you wish to alter
                   2331:               these settings to work with pkgsrc, note the
                   2332:               following things.</p>
                   2333: 
                   2334:               <div class="itemizedlist">
                   2335:                 <ul type="disc">
                   2336:                   <li>
                   2337:                     <p>To uninstall UNIX Perl, use Add/Remove
                   2338:                     Programs, select Microsoft Windows Services for
                   2339:                     UNIX, then click Change. In the installer,
                   2340:                     choose Add or Remove, then uncheck
                   2341:                     Utilities-&gt;UNIX Perl.</p>
                   2342:                   </li>
                   2343: 
                   2344:                   <li>
1.47      reed     2345:                     <p>To enable case-sensitivity for the file
                   2346:                     system, run REGEDIT.EXE, and change the
1.1       grant    2347:                     following registry key:</p>
                   2348: 
                   2349:                     <p>
                   2350:                     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
                   2351:                     Manager\kernel</p>
                   2352: 
                   2353:                     <p>Set the DWORD value "obcaseinsensitive" to
                   2354:                     0; then reboot.</p>
                   2355:                   </li>
                   2356: 
                   2357:                   <li>
                   2358:                     <p>To enable setuid binaries (optional), run
                   2359:                     REGEDIT.EXE, and change the following registry
                   2360:                     key:</p>
                   2361: 
                   2362:                     <p>
                   2363:                     HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
                   2364:                     for UNIX</p>
                   2365: 
                   2366:                     <p>Set the DWORD value "EnableSetuidBinaries"
                   2367:                     to 1; then reboot.</p>
                   2368:                   </li>
                   2369:                 </ul>
                   2370:               </div>
                   2371:             </div>
                   2372: 
1.67    ! hubertf  2373:             <div class="sect3" lang="en">
1.1       grant    2374:               <div class="titlepage">
                   2375:                 <div>
                   2376:                   <div>
                   2377:                     <h4 class="title"><a name=
                   2378:                     "platform.interix-notes"></a>3.2.3.3.&nbsp;Important
                   2379:                     notes for using pkgsrc</h4>
                   2380:                   </div>
                   2381:                 </div>
                   2382:               </div>
                   2383: 
1.52      tv       2384:               <p>The package manager (either the pkgsrc "su" user,
1.1       grant    2385:               or the user running "pkg_add") must be a member of
                   2386:               the local Administrators group. Such a user must also
                   2387:               be used to run the bootstrap. This is slightly
                   2388:               relaxed from the normal pkgsrc requirement of
                   2389:               "root".</p>
                   2390: 
                   2391:               <p>The package manager should use a umask of 002.
                   2392:               "make install" will automatically complain if this is
                   2393:               not the case. This ensures that directories written
                   2394:               in /var/db/pkg are Administrators-group
                   2395:               writeable.</p>
                   2396: 
                   2397:               <p>The popular Interix binary packages from
                   2398:               http://www.interopsystems.com/ use an older version
                   2399:               of pkgsrc's pkg_* tools. Ideally, these should NOT be
                   2400:               used in conjunction with pkgsrc. If you choose to use
                   2401:               them at the same time as the pkgsrc packages, ensure
                   2402:               that you use the proper pkg_* tools for each type of
                   2403:               binary package.</p>
1.22      tv       2404: 
                   2405:               <p>The TERM setting used for DOS-type console windows
                   2406:               (including those invoked by the csh and ksh startup
                   2407:               shortcuts) is "interix". Most systems don't have a
                   2408:               termcap/terminfo entry for it, but the following
                   2409:               .termcap entry provides adequate emulation in most
                   2410:               cases:</p>
                   2411:               <pre class="programlisting">
1.51      rillig   2412:     interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
1.22      tv       2413: </pre>
1.1       grant    2414:             </div>
1.52      tv       2415: 
1.67    ! hubertf  2416:             <div class="sect3" lang="en">
1.52      tv       2417:               <div class="titlepage">
                   2418:                 <div>
                   2419:                   <div>
                   2420:                     <h4 class="title"><a name=
                   2421:                     "platform.interix-limits"></a>3.2.3.4.&nbsp;Limitations
                   2422:                     of the Interix platform</h4>
                   2423:                   </div>
                   2424:                 </div>
                   2425:               </div>
                   2426: 
                   2427:               <p>Though Interix suffices as a familiar and flexible
                   2428:               substitute for a full Unix-like platform, it has some
                   2429:               drawbacks that should be noted for those desiring to
                   2430:               make the most of Interix.</p>
                   2431: 
                   2432:               <div class="itemizedlist">
                   2433:                 <ul type="disc">
                   2434:                   <li>
1.54      tv       2435:                     <p><span class=
1.57      minskim  2436:                     "strong"><strong>X11:</strong></span></p>
1.52      tv       2437: 
                   2438:                     <p>Interix comes with the standard set of X11R6
1.57      minskim  2439:                     client libraries, and can run X11 based
1.52      tv       2440:                     applications, but it does <span class=
                   2441:                     "emphasis"><em>not</em></span> come with an X
                   2442:                     server. Some options are <a href=
                   2443:                     "http://www.starnet.com/products/xwin32/"
                   2444:                     target="_top">StarNet X-Win32</a>, <a href=
                   2445:                     "http://connectivity.hummingbird.com/products/nc/exceed/"
1.57      minskim  2446:                     target="_top">Hummingbird Exceed</a> (available
                   2447:                     in a trimmed version for Interix from Interop
                   2448:                     Systems as the <a href=
                   2449:                     "http://www.interopsystems.com/InteropXserver.htm"
                   2450:                     target="_top">Interop X Server</a>), and the
                   2451:                     free X11 server included with <a href=
1.52      tv       2452:                     "http://x.cygwin.com/" target=
                   2453:                     "_top">Cygwin</a>.</p>
                   2454: 
                   2455:                     <p>Also, StarNet Communications has graciously
                   2456:                     provided a free version of their X-Win32
                   2457:                     product that accepts connections only from
                   2458:                     localhost: <a href=
                   2459:                     "http://www.starnet.com/xwin32LX/get_xwin32LX.htm"
                   2460:                     target="_top">X-Win32 LX</a>, recommended by
                   2461:                     the maintainer of Interix pkgsrc support.</p>
                   2462:                   </li>
                   2463: 
                   2464:                   <li>
1.57      minskim  2465:                     <p><span class="strong"><strong>X11
1.54      tv       2466:                     acceleration:</strong></span></p>
1.52      tv       2467: 
                   2468:                     <p>Because Interix runs in a completely
                   2469:                     different NT subsystem from Win32 applications,
                   2470:                     it does not currently support various X11
                   2471:                     protocol extensions for acceleration (such as
                   2472:                     MIT-SHM or DGA). Most interactive applications
                   2473:                     to a local X server will run reasonably fast,
                   2474:                     but full motion video and other graphics
                   2475:                     intensive applications may require a
                   2476:                     faster-than-expected CPU.</p>
                   2477:                   </li>
                   2478: 
                   2479:                   <li>
1.54      tv       2480:                     <p><span class=
                   2481:                     "strong"><strong>Audio:</strong></span></p>
1.52      tv       2482: 
                   2483:                     <p>Interix has no native support for audio
1.53      tv       2484:                     output. For audio support, pkgsrc uses the
                   2485:                     <span><strong class=
1.52      tv       2486:                     "command">esound</strong></span> client/server
                   2487:                     audio system on Interix. Unlike on most
                   2488:                     platforms, the <a xmlns=
                   2489:                     "http://www.w3.org/TR/xhtml1/transitional"
                   2490:                     href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/esound/README.html"
                   2491:                     target="_top"><code xmlns="" class=
                   2492:                     "filename">audio/esound</code></a> package does
                   2493:                     <span class="emphasis"><em>not</em></span>
                   2494:                     contain the <span><strong class=
1.53      tv       2495:                     "command">esd</strong></span> server component.
                   2496:                     To output audio via an Interix host, the
                   2497:                     <a xmlns=
1.52      tv       2498:                     "http://www.w3.org/TR/xhtml1/transitional"
                   2499:                     href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/cygwin_esound/README.html"
                   2500:                     target="_top"><code xmlns="" class=
                   2501:                     "filename">emulators/cygwin_esound</code></a>
                   2502:                     package must also be installed.</p>
                   2503:                   </li>
                   2504: 
                   2505:                   <li>
1.54      tv       2506:                     <p><span class="strong"><strong>CD/DVDs, USB,
                   2507:                     and SCSI:</strong></span></p>
1.52      tv       2508: 
                   2509:                     <p>Direct device access is not currently
                   2510:                     supported in Interix, so it is not currently
                   2511:                     possible to access CD/DVD drives, USB devices,
                   2512:                     or SCSI devices through non-filesystem means.
                   2513:                     Among other things, this makes it impossible to
                   2514:                     use Interix directly for CD/DVD burning.</p>
                   2515:                   </li>
                   2516: 
                   2517:                   <li>
1.54      tv       2518:                     <p><span class="strong"><strong>Tape
                   2519:                     drives:</strong></span></p>
1.52      tv       2520: 
                   2521:                     <p>Due to the same limitations as for CD-ROMs
                   2522:                     and SCSI devices, tape drives are also not
                   2523:                     directly accessible in Interix. However,
                   2524:                     support is in work to make tape drive access
                   2525:                     possible by using Cygwin as a bridge (similarly
                   2526:                     to audio bridged via Cygwin's esound
                   2527:                     server).</p>
                   2528:                   </li>
                   2529:                 </ul>
                   2530:               </div>
                   2531:             </div>
                   2532: 
1.67    ! hubertf  2533:             <div class="sect3" lang="en">
1.52      tv       2534:               <div class="titlepage">
                   2535:                 <div>
                   2536:                   <div>
                   2537:                     <h4 class="title"><a name=
                   2538:                     "platform.interix-knownissues"></a>3.2.3.5.&nbsp;Known
                   2539:                     issues for pkgsrc on Interix</h4>
                   2540:                   </div>
                   2541:                 </div>
                   2542:               </div>
                   2543: 
                   2544:               <p>It is not necessary, in general, to have a "root"
                   2545:               user on the Windows system; any member of the local
                   2546:               Administrators group will suffice. However, some
                   2547:               packages currently assume that the user named "root"
                   2548:               is the privileged user. To accommodate these, you may
                   2549:               create such a user; make sure it is in the local
                   2550:               group Administrators (or your language
                   2551:               equivalent).</p>
                   2552: 
                   2553:               <p>"pkg_add" creates directories of mode 0755, not
                   2554:               0775, in $PKG_DBDIR. For the time being, install
                   2555:               packages as the local Administrator (or your language
                   2556:               equivalent), or run the following command after
                   2557:               installing a package to work around the issue:</p>
                   2558:               <pre class="screen">
                   2559: <code class="prompt">#</code> <strong class=
                   2560: "userinput"><code>chmod -R g+w $PKG_DBDIR</code></strong>
                   2561: </pre>
                   2562:             </div>
1.1       grant    2563:           </div>
                   2564: 
1.67    ! hubertf  2565:           <div class="sect2" lang="en">
1.1       grant    2566:             <div class="titlepage">
                   2567:               <div>
                   2568:                 <div>
1.67    ! hubertf  2569:                   <h3 class="title"><a name=
1.30      wiz      2570:                   "irix"></a>3.2.4.&nbsp;IRIX</h3>
1.1       grant    2571:                 </div>
                   2572:               </div>
                   2573:             </div>
                   2574: 
                   2575:             <p>You will need a working C compiler, either gcc or
                   2576:             SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14      xtraeme  2577:             the <code class="varname">CC</code> environment
                   2578:             variable according to your preference. If you do not
                   2579:             have a license for the MIPSpro compiler suite, you can
1.1       grant    2580:             download a gcc tardist file from <a href=
                   2581:             "http://freeware.sgi.com/" target=
                   2582:             "_top">http://freeware.sgi.com/</a>.</p>
                   2583: 
                   2584:             <p>Please note that you will need IRIX 6.5.17 or
                   2585:             higher, as this is the earliest version of IRIX
1.24      wiz      2586:             providing support for <a href=
                   2587:             "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
                   2588:             <span class="citerefentry"><span class=
                   2589:             "refentrytitle">if_indextoname</span>(3)</span></a>,
                   2590:             <a href=
                   2591:             "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
                   2592:             <span class="citerefentry"><span class=
                   2593:             "refentrytitle">if_nametoindex</span>(3)</span></a>,
                   2594:             etc.</p>
1.1       grant    2595: 
1.27      rillig   2596:             <p>At this point in time, pkgsrc only supports one ABI
                   2597:             at a time. That is, you can not switch between the old
                   2598:             32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
                   2599:             you start out using "abi=n32", that's what all your
                   2600:             packages will be built with.</p>
1.1       grant    2601: 
                   2602:             <p>Therefore, please make sure that you have no
1.14      xtraeme  2603:             conflicting <code class="varname">CFLAGS</code> in your
1.45      wiz      2604:             environment or the <code xmlns=
                   2605:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2606:             "filename">/etc/mk.conf</code>. Particularly, make sure
1.1       grant    2607:             that you do not try to link n32 object files with lib64
1.45      wiz      2608:             or vice versa. Check your <code xmlns=
                   2609:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2610:             "filename">/etc/compiler.defaults</code>!</p>
1.1       grant    2611: 
                   2612:             <p>If you have the actual pkgsrc tree mounted via NFS
                   2613:             from a different host, please make sure to set
1.14      xtraeme  2614:             <code class="varname">WRKOBJDIR</code> to a local
1.1       grant    2615:             directory, as it appears that IRIX linker occasionally
1.47      reed     2616:             runs into issues when trying to link over a
                   2617:             network-mounted file system.</p>
1.1       grant    2618: 
                   2619:             <p>The bootstrapping process should set all the right
                   2620:             options for programs such as imake(1), but you may want
                   2621:             to set some options depending on your local setup.
1.45      wiz      2622:             Please see <code xmlns=
                   2623:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2624:             "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27      rillig   2625:             course, your compiler's man pages for details.</p>
1.22      tv       2626: 
                   2627:             <p>If you are using SGI's MIPSPro compiler, please
                   2628:             set</p>
                   2629:             <pre class="programlisting">
1.51      rillig   2630:     PKGSRC_COMPILER=        mipspro
1.22      tv       2631: </pre>
                   2632: 
1.45      wiz      2633:             <p>in <code xmlns=
                   2634:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   2635:             "filename">/etc/mk.conf</code>. Otherwise, pkgsrc will
                   2636:             assume you are using gcc and may end up passing invalid
                   2637:             flags to the compiler. Note that bootstrap should
                   2638:             create an appropriate <code xmlns=
                   2639:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2640:             "filename">mk.conf.example</code> by default.</p>
                   2641: 
                   2642:             <p>If you have both the MIPSPro compiler chain
                   2643:             installed as well as gcc, but want to make sure that
                   2644:             MIPRPro is used, please set your <code class=
                   2645:             "varname">PATH</code> to <span class=
                   2646:             "emphasis"><em>not</em></span> include the location of
1.45      wiz      2647:             gcc (often <code xmlns=
                   2648:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2649:             "filename">/usr/freeware/bin</code>), and (important)
                   2650:             pass the '--preserve-path' flag.</p>
1.1       grant    2651:           </div>
                   2652: 
1.67    ! hubertf  2653:           <div class="sect2" lang="en">
1.1       grant    2654:             <div class="titlepage">
                   2655:               <div>
                   2656:                 <div>
1.67    ! hubertf  2657:                   <h3 class="title"><a name=
1.30      wiz      2658:                   "linux"></a>3.2.5.&nbsp;Linux</h3>
1.22      tv       2659:                 </div>
                   2660:               </div>
                   2661:             </div>
                   2662: 
                   2663:             <p>Some versions of Linux (for example Debian
                   2664:             GNU/Linux) need either libtermcap or libcurses
                   2665:             (libncurses). Installing the distributions
                   2666:             libncurses-dev package (or equivalent) should fix the
                   2667:             problem.</p>
                   2668: 
                   2669:             <p>pkgsrc supports both gcc (GNU Compiler Collection)
                   2670:             and icc (Intel C++ Compiler). gcc is the default. icc
                   2671:             8.0 and 8.1 on i386 have been tested.</p>
                   2672: 
                   2673:             <p>To bootstrap using icc, assuming the default icc
                   2674:             installation directory:</p>
                   2675:             <pre class="programlisting">
1.51      rillig   2676:     env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
                   2677:             ac_cv___attribute__=yes ./bootstrap
1.22      tv       2678: </pre>
                   2679: 
                   2680:             <div class="note" style=
                   2681:             "margin-left: 0.5in; margin-right: 0.5in;">
                   2682:               <h3 class="title">Note</h3>
                   2683: 
                   2684:               <p>icc 8.1 needs the `-i-static' argument instead of
                   2685:               -static-libcxa.</p>
                   2686:             </div>
                   2687: 
                   2688:             <p>icc supports __attribute__, but the GNU configure
                   2689:             test uses a nested function, which icc does not
                   2690:             support. #undef'ing __attribute__ has the unfortunate
                   2691:             side-effect of breaking many of the Linux header files,
                   2692:             which cannot be compiled properly without
                   2693:             __attribute__. The test must be overridden so that
                   2694:             __attribute__ is assumed supported by the compiler.</p>
                   2695: 
                   2696:             <p>After bootstrapping, you should set <code class=
1.45      wiz      2697:             "varname">PKGSRC_COMPILER</code> in <code xmlns=
                   2698:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2699:             "filename">/etc/mk.conf</code>:</p>
                   2700:             <pre class="programlisting">
1.51      rillig   2701:     PKGSRC_COMPILER=        icc
1.22      tv       2702: </pre>
                   2703: 
                   2704:             <p>The default installation directory for icc is
1.45      wiz      2705:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2706:             class="filename">/opt/intel_cc_80</code>, which is also
                   2707:             the pkgsrc default. If you have installed it into a
                   2708:             different directory, set <code class=
                   2709:             "varname">ICCBASE</code> in <code xmlns=
                   2710:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2711:             "filename">/etc/mk.conf</code>:</p>
                   2712:             <pre class="programlisting">
1.51      rillig   2713:     ICCBASE=                /opt/icc
1.22      tv       2714: </pre>
                   2715: 
                   2716:             <p>pkgsrc uses the static linking method of the runtime
                   2717:             libraries provided by icc, so binaries can be run on
                   2718:             other systems which do not have the shared libraries
                   2719:             installed.</p>
                   2720: 
                   2721:             <p>Libtool, however, extracts a list of libraries from
1.24      wiz      2722:             the <a href=
                   2723:             "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   2724:             <span class="citerefentry"><span class=
                   2725:             "refentrytitle">ld</span>(1)</span></a> command run
                   2726:             when linking a C++ shared library and records it,
                   2727:             throwing away the -Bstatic and -Bdynamic options
                   2728:             interspersed between the libraries. This means that
                   2729:             libtool-linked C++ shared libraries will have a runtime
                   2730:             dependency on the icc libraries until this is fixed in
                   2731:             libtool.</p>
1.22      tv       2732:           </div>
                   2733: 
1.67    ! hubertf  2734:           <div class="sect2" lang="en">
1.22      tv       2735:             <div class="titlepage">
                   2736:               <div>
                   2737:                 <div>
1.67    ! hubertf  2738:                   <h3 class="title"><a name=
1.30      wiz      2739:                   "openbsd"></a>3.2.6.&nbsp;OpenBSD</h3>
1.1       grant    2740:                 </div>
                   2741:               </div>
                   2742:             </div>
                   2743: 
                   2744:             <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
                   2745: 
                   2746:             <p>Care should be taken so that the tools that this kit
                   2747:             installs do not conflict with the OpenBSD userland
                   2748:             tools. There are several steps:</p>
                   2749: 
                   2750:             <div class="orderedlist">
                   2751:               <ol type="1">
                   2752:                 <li>
                   2753:                   <p>OpenBSD stores its ports pkg database in
1.45      wiz      2754:                   <code xmlns=
                   2755:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   2756:                   "filename">/var/db/pkg</code>. It is therefore
                   2757:                   recommended that you choose a different location
                   2758:                   (e.g. <code xmlns=
                   2759:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2760:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2761:                   --pkgdbdir option to the bootstrap script.</p>
                   2762:                 </li>
                   2763: 
                   2764:                 <li>
                   2765:                   <p>If you do not intend to use the OpenBSD ports
                   2766:                   tools, it's probably a good idea to move them out
                   2767:                   of the way to avoid confusion, e.g.</p>
                   2768:                   <pre class="screen">
1.14      xtraeme  2769: <code class="prompt">#</code> <strong class=
                   2770: "userinput"><code>cd /usr/sbin</code></strong>
                   2771: <code class="prompt">#</code> <strong class=
                   2772: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2773: <code class="prompt">#</code> <strong class=
                   2774: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2775: <code class="prompt">#</code> <strong class=
                   2776: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2777: <code class="prompt">#</code> <strong class=
                   2778: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2779: </pre>
                   2780:                 </li>
                   2781: 
                   2782:                 <li>
1.45      wiz      2783:                   <p>An example <code xmlns=
                   2784:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2785:                   "filename">/etc/mk.conf</code> file will be
1.45      wiz      2786:                   placed in <code xmlns=
                   2787:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2788:                   "filename">/etc/mk.conf.example</code> file when
                   2789:                   you use the bootstrap script. OpenBSD's make
1.45      wiz      2790:                   program uses <code xmlns=
                   2791:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2792:                   "filename">/etc/mk.conf</code> as well. You can
1.47      reed     2793:                   work around this by enclosing all the
                   2794:                   pkgsrc-specific parts of the file with:</p>
1.1       grant    2795:                   <pre class="programlisting">
1.51      rillig   2796:     .ifdef BSD_PKG_MK
                   2797:     # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
                   2798:     .else
                   2799:     # OpenBSD stuff
                   2800:     .endif
1.1       grant    2801: </pre>
                   2802:                 </li>
                   2803:               </ol>
                   2804:             </div>
                   2805:           </div>
                   2806: 
1.67    ! hubertf  2807:           <div class="sect2" lang="en">
1.1       grant    2808:             <div class="titlepage">
                   2809:               <div>
                   2810:                 <div>
1.67    ! hubertf  2811:                   <h3 class="title"><a name=
1.30      wiz      2812:                   "solaris"></a>3.2.7.&nbsp;Solaris</h3>
1.1       grant    2813:                 </div>
                   2814:               </div>
                   2815:             </div>
                   2816: 
                   2817:             <p>Solaris 2.6 through 9 are supported on both x86 and
                   2818:             sparc. You will need a working C compiler. Both gcc
                   2819:             2.95.3 and Sun WorkShop 5 have been tested.</p>
                   2820: 
                   2821:             <p>The following packages are required on Solaris 8 for
                   2822:             the bootstrap process and to build packages.</p>
                   2823: 
                   2824:             <div class="itemizedlist">
                   2825:               <ul type="disc">
                   2826:                 <li>
                   2827:                   <p>SUNWsprot</p>
                   2828:                 </li>
                   2829: 
                   2830:                 <li>
                   2831:                   <p>SUNWarc</p>
                   2832:                 </li>
                   2833: 
                   2834:                 <li>
                   2835:                   <p>SUNWbtool</p>
                   2836:                 </li>
                   2837: 
                   2838:                 <li>
                   2839:                   <p>SUNWtoo</p>
                   2840:                 </li>
                   2841: 
                   2842:                 <li>
                   2843:                   <p>SUNWlibm</p>
                   2844:                 </li>
                   2845:               </ul>
                   2846:             </div>
                   2847: 
                   2848:             <p>Please note the use of GNU binutils on Solaris is
                   2849:             <span class="emphasis"><em>not</em></span>
                   2850:             supported.</p>
                   2851: 
1.67    ! hubertf  2852:             <div class="sect3" lang="en">
1.1       grant    2853:               <div class="titlepage">
                   2854:                 <div>
                   2855:                   <div>
1.67    ! hubertf  2856:                     <h4 class="title"><a name=
        !          2857:                     "solaris-gcc-note"></a>3.2.7.1.&nbsp;If you are
        !          2858:                     using gcc</h4>
1.1       grant    2859:                   </div>
                   2860:                 </div>
                   2861:               </div>
                   2862: 
                   2863:               <p>It makes life much simpler if you only use the
                   2864:               same gcc consistently for building all packages.</p>
                   2865: 
                   2866:               <p>It is recommended that an external gcc be used
                   2867:               only for bootstrapping, then either build gcc from
                   2868:               <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2869:               href=
                   2870:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.45      wiz      2871:               target="_top"><code xmlns="" class=
                   2872:               "filename">lang/gcc</code></a> or install a binary
                   2873:               gcc package, then remove gcc used during
1.20      ben      2874:               bootstrapping.</p>
1.1       grant    2875: 
                   2876:               <p>Binary packages of gcc can be found through
                   2877:               <a href=
                   2878:               "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20      ben      2879:               target=
                   2880:               "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1       grant    2881:             </div>
                   2882: 
1.67    ! hubertf  2883:             <div class="sect3" lang="en">
1.1       grant    2884:               <div class="titlepage">
                   2885:                 <div>
                   2886:                   <div>
1.30      wiz      2887:                     <h4 class="title"><a name=
                   2888:                     "solaris-sun-workshop-note"></a>3.2.7.2.&nbsp;If
                   2889:                     you are using Sun WorkShop</h4>
1.1       grant    2890:                   </div>
                   2891:                 </div>
                   2892:               </div>
                   2893: 
                   2894:               <p>You will need at least the following packages
                   2895:               installed (from WorkShop 5.0)</p>
                   2896: 
                   2897:               <div class="itemizedlist">
                   2898:                 <ul type="disc">
                   2899:                   <li>
                   2900:                     <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
                   2901:                   </li>
                   2902: 
                   2903:                   <li>
                   2904:                     <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
                   2905:                   </li>
                   2906: 
                   2907:                   <li>
                   2908:                     <p>SPROild - Sun WorkShop Incremental
                   2909:                     Linker</p>
                   2910:                   </li>
                   2911: 
                   2912:                   <li>
                   2913:                     <p>SPROlang - Sun WorkShop Compilers common
                   2914:                     components</p>
                   2915:                   </li>
                   2916:                 </ul>
                   2917:               </div>
                   2918: 
1.14      xtraeme  2919:               <p>You should set <code class="varname">CC</code>,
                   2920:               <code class="varname">CXX</code> and optionally,
1.45      wiz      2921:               <code class="varname">CPP</code> in <code xmlns=
                   2922:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     2923:               "filename">/etc/mk.conf</code>, e.g.:</p>
1.1       grant    2924:               <pre class="programlisting">
1.51      rillig   2925:     CC=     cc
                   2926:     CXX=    CC
                   2927:     CPP=    /usr/ccs/lib/cpp
1.1       grant    2928: </pre>
                   2929: 
                   2930:               <p>You may also want to build 64-bit binaries,
1.47      reed     2931:               e.g.:</p>
1.1       grant    2932:               <pre class="programlisting">
1.51      rillig   2933:     CFLAGS= -xtarget=ultra -xarch=v9
1.1       grant    2934: </pre>
                   2935: 
                   2936:               <p>Whichever compiler you use, please ensure the
                   2937:               compiler tools and your $prefix are in your
1.14      xtraeme  2938:               <code class="varname">PATH</code>. This includes
1.45      wiz      2939:               <code xmlns=
                   2940:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     2941:               "filename">/usr/ccs/{bin,lib}</code> and e.g.
1.45      wiz      2942:               <code xmlns=
                   2943:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2944:               "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1       grant    2945:             </div>
                   2946:           </div>
                   2947:         </div>
                   2948:       </div>
                   2949: 
1.67    ! hubertf  2950:       <div class="chapter" lang="en">
1.1       grant    2951:         <div class="titlepage">
                   2952:           <div>
                   2953:             <div>
1.67    ! hubertf  2954:               <h2 class="title"><a name=
1.1       grant    2955:               "using"></a>Chapter&nbsp;4.&nbsp;Using pkgsrc</h2>
                   2956:             </div>
                   2957:           </div>
                   2958:         </div>
                   2959: 
                   2960:         <div class="toc">
                   2961:           <p><b>Table of Contents</b></p>
                   2962: 
                   2963:           <dl>
                   2964:             <dt><span class="sect1"><a href="#getting-started">4.1.
                   2965:             Working with binary packages</a></span></dt>
                   2966: 
                   2967:             <dd>
                   2968:               <dl>
1.30      wiz      2969:                 <dt><span class="sect2"><a href=
                   2970:                 "#where-to-get-binary-packages">4.1.1. Where to get
                   2971:                 binary packages</a></span></dt>
1.1       grant    2972: 
1.30      wiz      2973:                 <dt><span class="sect2"><a href=
                   2974:                 "#how-to-use-binary-packages">4.1.2. How to use
                   2975:                 binary packages</a></span></dt>
1.1       grant    2976: 
1.30      wiz      2977:                 <dt><span class="sect2"><a href=
                   2978:                 "#a-word-of-warning">4.1.3. A word of
                   2979:                 warning</a></span></dt>
1.1       grant    2980:               </dl>
                   2981:             </dd>
                   2982: 
1.30      wiz      2983:             <dt><span class="sect1"><a href=
                   2984:             "#building-packages-from-source">4.2. Building packages
                   2985:             from source</a></span></dt>
1.1       grant    2986: 
                   2987:             <dd>
                   2988:               <dl>
1.30      wiz      2989:                 <dt><span class="sect2"><a href=
                   2990:                 "#requirements">4.2.1. Requirements</a></span></dt>
1.1       grant    2991: 
1.30      wiz      2992:                 <dt><span class="sect2"><a href=
                   2993:                 "#fetching-distfiles">4.2.2. Fetching
                   2994:                 distfiles</a></span></dt>
1.1       grant    2995: 
1.30      wiz      2996:                 <dt><span class="sect2"><a href=
                   2997:                 "#how-to-build-and-install">4.2.3. How to build and
                   2998:                 install</a></span></dt>
1.1       grant    2999: 
1.30      wiz      3000:                 <dt><span class="sect2"><a href=
                   3001:                 "#selecting-the-compiler">4.2.4. Selecting the
                   3002:                 compiler</a></span></dt>
1.1       grant    3003:               </dl>
                   3004:             </dd>
                   3005:           </dl>
                   3006:         </div>
                   3007: 
1.67    ! hubertf  3008:         <div class="sect1" lang="en">
1.1       grant    3009:           <div class="titlepage">
                   3010:             <div>
                   3011:               <div>
                   3012:                 <h2 class="title" style="clear: both"><a name=
                   3013:                 "getting-started"></a>4.1.&nbsp;Working with binary
                   3014:                 packages</h2>
                   3015:               </div>
                   3016:             </div>
                   3017:           </div>
                   3018: 
                   3019:           <p>This section describes how to find, retrieve and
                   3020:           install a precompiled binary package that someone else
                   3021:           already prepared for your type of machine.</p>
                   3022: 
1.67    ! hubertf  3023:           <div class="sect2" lang="en">
1.1       grant    3024:             <div class="titlepage">
                   3025:               <div>
                   3026:                 <div>
1.30      wiz      3027:                   <h3 class="title"><a name=
                   3028:                   "where-to-get-binary-packages"></a>4.1.1.&nbsp;Where
                   3029:                   to get binary packages</h3>
1.1       grant    3030:                 </div>
                   3031:               </div>
                   3032:             </div>
                   3033: 
                   3034:             <p>Precompiled packages are stored on ftp.NetBSD.org
1.45      wiz      3035:             and its mirrors in the directory <code xmlns=
                   3036:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   3037:             "filename">/pub/NetBSD/packages/&lt;OSVERSION&gt;/&lt;ARCH&gt;/</code>
                   3038:             for anonymous FTP access. <code class=
                   3039:             "varname">OSVERSION</code> is the NetBSD version
                   3040:             (<span><strong class="command">uname
                   3041:             -r</strong></span>), <code class="varname">ARCH</code>
                   3042:             is the architecture (<span><strong class=
                   3043:             "command">uname -p</strong></span>). In that directory,
                   3044:             there is a subdirectory for each category plus a
1.45      wiz      3045:             subdirectory <code xmlns=
                   3046:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3047:             "filename">All</code> which includes the actual
                   3048:             binaries in <code xmlns=
                   3049:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   3050:             "filename">.tgz</code> files. The category
                   3051:             subdirectories use symbolic links to those files (this
1.45      wiz      3052:             is the same directory layout as in <code xmlns=
                   3053:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3054:             "filename">/usr/pkgsrc/packages</code>).</p>
1.1       grant    3055: 
1.47      reed     3056:             <p>This same directory layout applies for CD-ROM
1.1       grant    3057:             distributions, only that the directory may be rooted
1.45      wiz      3058:             somewhere else, probably somewhere below <code xmlns=
                   3059:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     3060:             "filename">/cdrom</code>. Please consult your CD-ROMs
1.1       grant    3061:             documentation for the exact location.</p>
                   3062:           </div>
                   3063: 
1.67    ! hubertf  3064:           <div class="sect2" lang="en">
1.1       grant    3065:             <div class="titlepage">
                   3066:               <div>
                   3067:                 <div>
1.30      wiz      3068:                   <h3 class="title"><a name=
                   3069:                   "how-to-use-binary-packages"></a>4.1.2.&nbsp;How
                   3070:                   to use binary packages</h3>
1.1       grant    3071:                 </div>
                   3072:               </div>
                   3073:             </div>
                   3074: 
1.47      reed     3075:             <p>If you have the files on a CD-ROM or downloaded them
1.23      wiz      3076:             to your hard disk, you can install them with the
1.27      rillig   3077:             following command (be sure to <span><strong class=
1.14      xtraeme  3078:             "command">su</strong></span> to root first):</p>
1.1       grant    3079:             <pre class="screen">
1.14      xtraeme  3080: <code class="prompt">#</code> <strong class=
                   3081: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1       grant    3082: </pre>
                   3083: 
                   3084:             <p>If you have FTP access and you don't want to
                   3085:             download the packages via FTP prior to installation,
1.14      xtraeme  3086:             you can do this automatically by giving
                   3087:             <span><strong class="command">pkg_add</strong></span>
                   3088:             an FTP URL:</p>
1.1       grant    3089:             <pre class="screen">
1.14      xtraeme  3090: <code class="prompt">#</code> <strong class=
1.27      rillig   3091: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/&lt;OSVERSION&gt;/&lt;ARCH&gt;/All/package.tgz</code></strong>
1.1       grant    3092: </pre>
                   3093: 
1.27      rillig   3094:             <p>Note that any prerequisite packages needed to run
                   3095:             the package in question will be installed, too,
1.1       grant    3096:             assuming they are present where you install from.</p>
                   3097: 
1.23      wiz      3098:             <p>To save some typing, you can set the <code class=
                   3099:             "varname">PKG_PATH</code> environment variable to a
1.47      reed     3100:             semicolon-separated list of paths (including remote
1.23      wiz      3101:             URLs); trailing slashes are not allowed.</p>
                   3102: 
1.45      wiz      3103:             <p>Additionally to the <code xmlns=
                   3104:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.23      wiz      3105:             "filename">All</code> directory there exists a
1.45      wiz      3106:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3107:             class="filename">vulnerable</code> directory to which
                   3108:             binary packages with known vulnerabilities are moved,
                   3109:             since removing them could cause missing dependencies.
                   3110:             To use these packages, add the <code xmlns=
                   3111:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3112:             "filename">vulnerable</code> directory to your
                   3113:             <code class="varname">PKG_PATH</code>. However, you
                   3114:             should run <a xmlns=
1.23      wiz      3115:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   3116:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45      wiz      3117:             target="_top"><code xmlns="" class=
                   3118:             "filename">security/audit-packages</code></a>
1.47      reed     3119:             regularly, especially after installing new packages,
                   3120:             and verify that the vulnerabilities are acceptable for
                   3121:             your configuration. An example <code class=
                   3122:             "varname">PKG_PATH</code> would be: <code xmlns=
                   3123:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   3124:             "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/&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      3125:             Please note that semicolon (';') is a shell
                   3126:             meta-character, so you'll probably have to quote
                   3127:             it.</p>
                   3128: 
1.1       grant    3129:             <p>After you've installed packages, be sure to have
1.45      wiz      3130:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3131:             class="filename">/usr/pkg/bin</code> and <code xmlns=
                   3132:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3133:             "filename">/usr/pkg/sbin</code> in your <code class=
                   3134:             "varname">PATH</code> so you can actually start the
                   3135:             just installed program.</p>
1.1       grant    3136:           </div>
                   3137: 
1.67    ! hubertf  3138:           <div class="sect2" lang="en">
1.1       grant    3139:             <div class="titlepage">
                   3140:               <div>
                   3141:                 <div>
1.67    ! hubertf  3142:                   <h3 class="title"><a name=
1.30      wiz      3143:                   "a-word-of-warning"></a>4.1.3.&nbsp;A word of
1.1       grant    3144:                   warning</h3>
                   3145:                 </div>
                   3146:               </div>
                   3147:             </div>
                   3148: 
                   3149:             <p>Please pay very careful attention to the warnings
                   3150:             expressed in the <a href=
                   3151:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3152:             <span class="citerefentry"><span class=
                   3153:             "refentrytitle">pkg_add</span>(1)</span></a> manual
                   3154:             page about the inherent dangers of installing binary
                   3155:             packages which you did not create yourself, and the
                   3156:             security holes that can be introduced onto your system
                   3157:             by indiscriminate adding of such files.</p>
1.66      rillig   3158: 
                   3159:             <p>The same warning of course applies to every package
                   3160:             you install from source when you haven't completely
                   3161:             read and understood the source code of the package, the
                   3162:             compiler that is used to build the package and all the
                   3163:             other tools that are involved.</p>
1.1       grant    3164:           </div>
                   3165:         </div>
                   3166: 
1.67    ! hubertf  3167:         <div class="sect1" lang="en">
1.1       grant    3168:           <div class="titlepage">
                   3169:             <div>
                   3170:               <div>
                   3171:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      3172:                 "building-packages-from-source"></a>4.2.&nbsp;Building
1.1       grant    3173:                 packages from source</h2>
                   3174:               </div>
                   3175:             </div>
                   3176:           </div>
                   3177: 
                   3178:           <p>This assumes that the package is already in pkgsrc. If
                   3179:           it is not, see <a href="#developers-guide" title=
1.46      gdt      3180:           "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">Part&nbsp;II,
1.27      rillig   3181:           &#8220;The pkgsrc developer's guide&#8221;</a> for
                   3182:           instructions how to create your own packages.</p>
1.1       grant    3183: 
1.67    ! hubertf  3184:           <div class="sect2" lang="en">
1.1       grant    3185:             <div class="titlepage">
                   3186:               <div>
                   3187:                 <div>
1.67    ! hubertf  3188:                   <h3 class="title"><a name=
1.30      wiz      3189:                   "requirements"></a>4.2.1.&nbsp;Requirements</h3>
1.1       grant    3190:                 </div>
                   3191:               </div>
                   3192:             </div>
                   3193: 
                   3194:             <p>To build packages from source on a NetBSD system the
                   3195:             &#8220;<span class="quote">comp</span>&#8221; and the
                   3196:             &#8220;<span class="quote">text</span>&#8221;
                   3197:             distribution sets must be installed. If you want to
1.47      reed     3198:             build X11-related packages the &#8220;<span class=
1.1       grant    3199:             "quote">xbase</span>&#8221; and &#8220;<span class=
                   3200:             "quote">xcomp</span>&#8221; distribution sets are
                   3201:             required, too.</p>
                   3202:           </div>
                   3203: 
1.67    ! hubertf  3204:           <div class="sect2" lang="en">
1.1       grant    3205:             <div class="titlepage">
                   3206:               <div>
                   3207:                 <div>
1.67    ! hubertf  3208:                   <h3 class="title"><a name=
        !          3209:                   "fetching-distfiles"></a>4.2.2.&nbsp;Fetching
1.1       grant    3210:                   distfiles</h3>
                   3211:                 </div>
                   3212:               </div>
                   3213:             </div>
                   3214: 
1.27      rillig   3215:             <p>The first step for building a package is downloading
                   3216:             the distfiles (i.e. the unmodified source). If they
                   3217:             have not yet been downloaded, pkgsrc will fetch them
1.1       grant    3218:             automatically.</p>
                   3219: 
                   3220:             <p>You can overwrite some of the major distribution
                   3221:             sites to fit to sites that are close to your own. Have
1.45      wiz      3222:             a look at <code xmlns=
                   3223:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3224:             "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27      rillig   3225:             some examples &#8212; in particular, look for the
1.14      xtraeme  3226:             <code class="varname">MASTER_SORT</code>, <code class=
                   3227:             "varname">MASTER_SORT_REGEX</code> and <code class=
                   3228:             "varname">INET_COUNTRY</code> definitions. This may
                   3229:             save some of your bandwidth and time.</p>
1.1       grant    3230: 
                   3231:             <p>You can change these settings either in your shell's
                   3232:             environment, or, if you want to keep the settings, by
1.45      wiz      3233:             editing the <code xmlns=
                   3234:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3235:             "filename">/etc/mk.conf</code> file, and adding the
                   3236:             definitions there.</p>
1.1       grant    3237: 
                   3238:             <p>If you don't have a permanent Internet connection
                   3239:             and you want to know which files to download,
1.14      xtraeme  3240:             <span><strong class="command">make
                   3241:             fetch-list</strong></span> will tell you what you'll
1.45      wiz      3242:             need. Put these distfiles into <code xmlns=
                   3243:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3244:             "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    3245:           </div>
                   3246: 
1.67    ! hubertf  3247:           <div class="sect2" lang="en">
1.1       grant    3248:             <div class="titlepage">
                   3249:               <div>
                   3250:                 <div>
1.30      wiz      3251:                   <h3 class="title"><a name=
                   3252:                   "how-to-build-and-install"></a>4.2.3.&nbsp;How to
                   3253:                   build and install</h3>
1.1       grant    3254:                 </div>
                   3255:               </div>
                   3256:             </div>
                   3257: 
                   3258:             <p>Assuming that the distfile has been fetched (see
                   3259:             previous section), become root and change into the
1.47      reed     3260:             relevant directory and run <span><strong class=
                   3261:             "command">make</strong></span>.</p>
                   3262: 
                   3263:             <div class="note" style=
                   3264:             "margin-left: 0.5in; margin-right: 0.5in;">
                   3265:               <h3 class="title">Note</h3>
                   3266: 
                   3267:               <p>If using bootstrap or pkgsrc on a non-NetBSD
                   3268:               system, use the pkgsrc <span><strong class=
                   3269:               "command">bmake</strong></span> command instead of
                   3270:               &#8220;<span class="quote">make</span>&#8221; in the
                   3271:               examples in this guide.</p>
                   3272:             </div>
                   3273: 
                   3274:             <p>For example, type</p>
1.1       grant    3275:             <pre class="screen">
1.14      xtraeme  3276: <code class="prompt">%</code> <strong class=
                   3277: "userinput"><code>cd misc/figlet</code></strong>
                   3278: <code class="prompt">%</code> <strong class=
                   3279: "userinput"><code>make</code></strong>
1.1       grant    3280: </pre>
                   3281: 
                   3282:             <p>at the shell prompt to build the various components
                   3283:             of the package, and</p>
                   3284:             <pre class="screen">
1.14      xtraeme  3285: <code class="prompt">#</code> <strong class=
                   3286: "userinput"><code>make install</code></strong>
1.1       grant    3287: </pre>
                   3288: 
                   3289:             <p>to install the various components into the correct
                   3290:             places on your system. Installing the package on your
                   3291:             system requires you to be root. However, pkgsrc has a
                   3292:             <span class="emphasis"><em>just-in-time-su</em></span>
                   3293:             feature, which allows you to only become root for the
                   3294:             actual installation step</p>
                   3295: 
                   3296:             <p>Taking the figlet utility as an example, we can
                   3297:             install it on our system by building as shown in
                   3298:             <a href="#logs" title=
1.67    ! hubertf  3299:             "Appendix&nbsp;B.&nbsp;Build logs">Appendix&nbsp;B,
        !          3300:             <i>Build logs</i></a>.</p>
1.1       grant    3301: 
                   3302:             <p>The program is installed under the default root of
1.45      wiz      3303:             the packages tree - <code xmlns=
                   3304:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3305:             "filename">/usr/pkg</code>. Should this not conform to
                   3306:             your tastes, set the <code class=
                   3307:             "varname">LOCALBASE</code> variable in your
1.1       grant    3308:             environment, and it will use that value as the root of
1.45      wiz      3309:             your packages tree. So, to use <code xmlns=
                   3310:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3311:             "filename">/usr/local</code>, set <code class=
                   3312:             "varname">LOCALBASE=/usr/local</code> in your
1.1       grant    3313:             environment. Please note that you should use a
                   3314:             directory which is dedicated to packages and not shared
1.47      reed     3315:             with other programs (i.e., do not try and use
1.14      xtraeme  3316:             <code class="varname">LOCALBASE=/usr</code>). Also, you
                   3317:             should not try to add any of your own files or
1.45      wiz      3318:             directories (such as <code xmlns=
                   3319:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3320:             "filename">src/</code>, <code xmlns=
                   3321:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3322:             "filename">obj/</code>, or <code xmlns=
                   3323:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3324:             "filename">pkgsrc/</code>) below the <code class=
                   3325:             "varname">LOCALBASE</code> tree. This is to prevent
1.1       grant    3326:             possible conflicts between programs and other files
                   3327:             installed by the package system and whatever else may
                   3328:             have been installed there.</p>
                   3329: 
1.45      wiz      3330:             <p>Some packages look in <code xmlns=
                   3331:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3332:             "filename">/etc/mk.conf</code> to alter some
1.1       grant    3333:             configuration options at build time. Have a look at
1.45      wiz      3334:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3335:             class="filename">pkgsrc/mk/defaults/mk.conf</code> to
                   3336:             get an overview of what will be set there by default.
1.14      xtraeme  3337:             Environment variables such as <code class=
1.45      wiz      3338:             "varname">LOCALBASE</code> can be set in <code xmlns=
                   3339:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3340:             "filename">/etc/mk.conf</code> to save having to
                   3341:             remember to set them each time you want to use
                   3342:             pkgsrc.</p>
1.1       grant    3343: 
                   3344:             <p>Occasionally, people want to &#8220;<span class=
                   3345:             "quote">look under the covers</span>&#8221; to see what
                   3346:             is going on when a package is building or being
                   3347:             installed. This may be for debugging purposes, or out
                   3348:             of simple curiosity. A number of utility values have
                   3349:             been added to help with this.</p>
                   3350: 
                   3351:             <div class="orderedlist">
                   3352:               <ol type="1">
                   3353:                 <li>
                   3354:                   <p>If you invoke the <a href=
                   3355:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   3356:                   <span class="citerefentry"><span class=
                   3357:                   "refentrytitle">make</span>(1)</span></a> command
1.14      xtraeme  3358:                   with <code class=
                   3359:                   "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
                   3360:                   amount of information will be displayed. For
                   3361:                   example,</p>
1.1       grant    3362:                   <pre class="screen">
1.14      xtraeme  3363: <strong class=
                   3364: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1       grant    3365: </pre>
                   3366: 
                   3367:                   <p>will show all the commands that are invoked,
                   3368:                   up to and including the &#8220;<span class=
                   3369:                   "quote">patch</span>&#8221; stage.</p>
                   3370:                 </li>
                   3371: 
                   3372:                 <li>
                   3373:                   <p>If you want to know the value of a certain
1.22      tv       3374:                   <a href=
                   3375:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   3376:                   <span class="citerefentry"><span class=
                   3377:                   "refentrytitle">make</span>(1)</span></a>
                   3378:                   definition, then the <code class=
1.14      xtraeme  3379:                   "varname">VARNAME</code> definition should be
                   3380:                   used, in conjunction with the show-var target.
                   3381:                   e.g. to show the expansion of the <a href=
1.1       grant    3382:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   3383:                   <span class="citerefentry"><span class=
                   3384:                   "refentrytitle">make</span>(1)</span></a>
1.14      xtraeme  3385:                   variable <code class=
1.22      tv       3386:                   "varname">LOCALBASE</code>:</p>
1.1       grant    3387:                   <pre class="screen">
1.14      xtraeme  3388: <code class="prompt">%</code> <strong class=
                   3389: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1       grant    3390: /usr/pkg
1.14      xtraeme  3391: <code class="prompt">%</code>
1.1       grant    3392:           
                   3393: </pre>
                   3394:                 </li>
                   3395:               </ol>
                   3396:             </div>
                   3397: 
                   3398:             <p>If you want to install a binary package that you've
                   3399:             either created yourself (see next section), that you
                   3400:             put into pkgsrc/packages manually or that is located on
1.8       wiz      3401:             a remote FTP server, you can use the "bin-install"
1.1       grant    3402:             target. This target will install a binary package - if
                   3403:             available - via <a href=
                   3404:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3405:             <span class="citerefentry"><span class=
                   3406:             "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14      xtraeme  3407:             <span><strong class="command">make
                   3408:             package</strong></span>. The list of remote FTP sites
                   3409:             searched is kept in the variable <code class=
                   3410:             "varname">BINPKG_SITES</code>, which defaults to
                   3411:             ftp.NetBSD.org. Any flags that should be added to
                   3412:             <a href=
1.1       grant    3413:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3414:             <span class="citerefentry"><span class=
                   3415:             "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14      xtraeme  3416:             into <code class="varname">BIN_INSTALL_FLAGS</code>.
1.45      wiz      3417:             See <code xmlns=
                   3418:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3419:             "filename">pkgsrc/mk/defaults/mk.conf</code> for more
                   3420:             details.</p>
1.1       grant    3421: 
1.47      reed     3422:             <p>A final word of warning: If you set up a system that
1.14      xtraeme  3423:             has a non-standard setting for <code class=
                   3424:             "varname">LOCALBASE</code>, be sure to set that before
1.1       grant    3425:             any packages are installed, as you can not use several
                   3426:             directories for the same purpose. Doing so will result
                   3427:             in pkgsrc not being able to properly detect your
                   3428:             installed packages, and fail miserably. Note also that
                   3429:             precompiled binary packages are usually built with the
1.14      xtraeme  3430:             default <code class="varname">LOCALBASE</code> of
1.45      wiz      3431:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3432:             class="filename">/usr/pkg</code>, and that you should
                   3433:             <span class="emphasis"><em>not</em></span> install any
                   3434:             if you use a non-standard <code class=
1.14      xtraeme  3435:             "varname">LOCALBASE</code>.</p>
1.1       grant    3436:           </div>
                   3437: 
1.67    ! hubertf  3438:           <div class="sect2" lang="en">
1.1       grant    3439:             <div class="titlepage">
                   3440:               <div>
                   3441:                 <div>
1.30      wiz      3442:                   <h3 class="title"><a name=
                   3443:                   "selecting-the-compiler"></a>4.2.4.&nbsp;Selecting
                   3444:                   the compiler</h3>
1.1       grant    3445:                 </div>
                   3446:               </div>
                   3447:             </div>
                   3448: 
                   3449:             <p>By default, pkgsrc will use GCC to build packages.
                   3450:             This may be overridden by setting the following
                   3451:             variables in /etc/mk.conf:</p>
                   3452: 
                   3453:             <div class="variablelist">
                   3454:               <dl>
1.14      xtraeme  3455:                 <dt><span class="term"><code class=
                   3456:                 "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1       grant    3457: 
                   3458:                 <dd>
                   3459:                   <p>This is a list of values specifying the chain
                   3460:                   of compilers to invoke when building packages.
                   3461:                   Valid values are:</p>
                   3462: 
                   3463:                   <div class="itemizedlist">
                   3464:                     <ul type="disc">
                   3465:                       <li>
1.14      xtraeme  3466:                         <p><code class="varname">distcc</code>:
1.1       grant    3467:                         distributed C/C++ (chainable)</p>
                   3468:                       </li>
                   3469: 
                   3470:                       <li>
1.14      xtraeme  3471:                         <p><code class="varname">ccache</code>:
1.1       grant    3472:                         compiler cache (chainable)</p>
                   3473:                       </li>
                   3474: 
                   3475:                       <li>
1.14      xtraeme  3476:                         <p><code class="varname">gcc</code>: GNU
                   3477:                         C/C++ Compiler</p>
1.1       grant    3478:                       </li>
                   3479: 
                   3480:                       <li>
1.14      xtraeme  3481:                         <p><code class="varname">mipspro</code>:
1.1       grant    3482:                         Silicon Graphics, Inc. MIPSpro
                   3483:                         (n32/n64)</p>
                   3484:                       </li>
                   3485: 
                   3486:                       <li>
1.14      xtraeme  3487:                         <p><code class="varname">mipspro</code>:
1.1       grant    3488:                         Silicon Graphics, Inc. MIPSpro (o32)</p>
                   3489:                       </li>
                   3490: 
                   3491:                       <li>
1.64      kim      3492:                         <p><code class="varname">sunpro</code>: Sun
1.1       grant    3493:                         Microsystems, Inc. WorkShip/Forte/Sun ONE
                   3494:                         Studio</p>
                   3495:                       </li>
                   3496:                     </ul>
                   3497:                   </div>
                   3498: 
                   3499:                   <p>The default is &#8220;<span class=
1.14      xtraeme  3500:                   "quote"><code class=
                   3501:                   "varname">gcc</code></span>&#8221;. You can use
                   3502:                   <code class="varname">ccache</code> and/or
                   3503:                   <code class="varname">distcc</code> with an
                   3504:                   appropriate <code class=
                   3505:                   "varname">PKGSRC_COMPILER</code> setting, e.g.
                   3506:                   &#8220;<span class="quote"><code class=
                   3507:                   "varname">ccache gcc</code></span>&#8221;. This
1.1       grant    3508:                   variable should always be terminated with a value
                   3509:                   for a real compiler.</p>
                   3510:                 </dd>
                   3511: 
1.14      xtraeme  3512:                 <dt><span class="term"><code class=
                   3513:                 "varname">GCC_REQD</code>:</span></dt>
1.1       grant    3514: 
                   3515:                 <dd>
                   3516:                   <p>This specifies the minimum version of GCC to
                   3517:                   use when building packages. If the system GCC
                   3518:                   doesn't satisfy this requirement, then pkgsrc
                   3519:                   will build and install one of the GCC packages to
                   3520:                   use instead.</p>
                   3521:                 </dd>
                   3522:               </dl>
                   3523:             </div>
                   3524:           </div>
                   3525:         </div>
                   3526:       </div>
                   3527: 
1.67    ! hubertf  3528:       <div class="chapter" lang="en">
1.1       grant    3529:         <div class="titlepage">
                   3530:           <div>
                   3531:             <div>
1.67    ! hubertf  3532:               <h2 class="title"><a name=
1.38      dillo    3533:               "configuring"></a>Chapter&nbsp;5.&nbsp;Configuring
                   3534:               pkgsrc</h2>
                   3535:             </div>
                   3536:           </div>
                   3537:         </div>
                   3538: 
                   3539:         <div class="toc">
                   3540:           <p><b>Table of Contents</b></p>
                   3541: 
                   3542:           <dl>
                   3543:             <dt><span class="sect1"><a href=
1.45      wiz      3544:             "#general-configuration">5.1. General
                   3545:             configuration</a></span></dt>
                   3546: 
                   3547:             <dt><span class="sect1"><a href=
                   3548:             "#variables-affecting-build">5.2. Variables affecting
                   3549:             the build process</a></span></dt>
                   3550: 
                   3551:             <dt><span class="sect1"><a href=
                   3552:             "#developer-advanced-settings">5.3. Developer/advanced
                   3553:             settings</a></span></dt>
                   3554: 
                   3555:             <dt><span class="sect1"><a href=
                   3556:             "#selecting-build-options">5.4. Selecting Build
1.42      dillo    3557:             Options</a></span></dt>
1.38      dillo    3558:           </dl>
                   3559:         </div>
                   3560: 
1.67    ! hubertf  3561:         <div class="sect1" lang="en">
1.38      dillo    3562:           <div class="titlepage">
                   3563:             <div>
                   3564:               <div>
                   3565:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      3566:                 "general-configuration"></a>5.1.&nbsp;General
                   3567:                 configuration</h2>
                   3568:               </div>
                   3569:             </div>
                   3570:           </div>
                   3571: 
1.47      reed     3572:           <p>In this section, you can find some variables that
                   3573:           apply to all pkgsrc packages. The preferred method of
                   3574:           setting these variables is by setting them in
                   3575:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3576:           class="filename">/etc/mk.conf</code>.</p>
1.45      wiz      3577: 
                   3578:           <div class="itemizedlist">
                   3579:             <ul type="disc">
                   3580:               <li>
                   3581:                 <p><code class="varname">LOCALBASE</code>: Where
                   3582:                 packages will be installed. The default is
                   3583:                 <code xmlns=
                   3584:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3585:                 "filename">/usr/pkg</code>. Do not mix binary
                   3586:                 packages with different <code class=
                   3587:                 "varname">LOCALBASE</code>s!</p>
                   3588:               </li>
                   3589: 
                   3590:               <li>
                   3591:                 <p><code class="varname">CROSSBASE</code>: Where
                   3592:                 &#8220;<span class="quote">cross</span>&#8221;
                   3593:                 category packages will be installed. The default is
                   3594:                 <code xmlns=
                   3595:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3596:                 "filename">${LOCALBASE}/cross</code>.</p>
                   3597:               </li>
                   3598: 
                   3599:               <li>
                   3600:                 <p><code class="varname">X11BASE</code>: Where X11
                   3601:                 is installed on the system. The default is
                   3602:                 <code xmlns=
                   3603:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3604:                 "filename">/usr/X11R6</code>.</p>
                   3605:               </li>
                   3606: 
                   3607:               <li>
                   3608:                 <p><code class="varname">DISTDIR</code>: Where to
                   3609:                 store the downloaded copies of the original source
                   3610:                 distributions used for building pkgsrc packages.
                   3611:                 The default is <code xmlns=
                   3612:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3613:                 "filename">${PKGSRCDIR}/distfiles</code>.</p>
                   3614:               </li>
                   3615: 
                   3616:               <li>
                   3617:                 <p><code class=
                   3618:                 "varname">MASTER_SITE_OVERRIDE</code>: If set,
                   3619:                 override the packages' <code class=
                   3620:                 "varname">MASTER_SITES</code> with this value.</p>
                   3621:               </li>
                   3622: 
                   3623:               <li>
                   3624:                 <p><code class="varname">MASTER_SITE_BACKUP</code>:
                   3625:                 Backup location(s) for distribution files and patch
                   3626:                 files if not found locally or in <code xmlns=
                   3627:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3628:                 "filename">${MASTER_SITES}</code> or <code xmlns=
                   3629:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3630:                 "filename">${PATCH_SITES}</code> respectively. The
                   3631:                 defaults are <code xmlns=
                   3632:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3633:                 "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/${DIST_SUBDIR}/</code>
                   3634:                 and <code xmlns=
                   3635:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3636:                 "filename">ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/</code>.</p>
                   3637:               </li>
                   3638: 
                   3639:               <li>
                   3640:                 <p><code class="varname">BINPKG_SITES</code>: List
                   3641:                 of sites carrying binary pkgs.</p>
                   3642:               </li>
                   3643:             </ul>
                   3644:           </div>
                   3645:         </div>
                   3646: 
1.67    ! hubertf  3647:         <div class="sect1" lang="en">
1.45      wiz      3648:           <div class="titlepage">
                   3649:             <div>
                   3650:               <div>
                   3651:                 <h2 class="title" style="clear: both"><a name=
                   3652:                 "variables-affecting-build"></a>5.2.&nbsp;Variables
                   3653:                 affecting the build process</h2>
                   3654:               </div>
                   3655:             </div>
                   3656:           </div>
                   3657: 
                   3658:           <p>XXX</p>
                   3659: 
                   3660:           <div class="itemizedlist">
                   3661:             <ul type="disc">
                   3662:               <li>
                   3663:                 <p><code class="varname">PACKAGES</code>: The top
                   3664:                 level directory for the binary packages. The
                   3665:                 default is <code xmlns=
                   3666:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3667:                 "filename">${PKGSRCDIR}/packages</code>.</p>
                   3668:               </li>
                   3669: 
                   3670:               <li>
                   3671:                 <p><code class="varname">WRKOBJDIR</code>: The top
                   3672:                 level directory where, if defined, the separate
                   3673:                 working directories will get created, and
                   3674:                 symbolically linked to from <code xmlns=
                   3675:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3676:                 "filename">${WRKDIR}</code> (see below). This is
                   3677:                 useful for building packages on several
                   3678:                 architectures, then <code xmlns=
                   3679:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3680:                 "filename">${PKGSRCDIR}</code> can be NFS-mounted
                   3681:                 while <code xmlns=
                   3682:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3683:                 "filename">${WRKOBJDIR}</code> is local to every
                   3684:                 architecture. (It should be noted that <code class=
                   3685:                 "varname">PKGSRCDIR</code> should not be set by the
                   3686:                 user &#8212; it is an internal definition which
                   3687:                 refers to the root of the pkgsrc tree. It is
                   3688:                 possible to have many pkgsrc tree instances.)</p>
                   3689:               </li>
                   3690: 
                   3691:               <li>
                   3692:                 <p><code class="varname">LOCALPATCHES</code>:
                   3693:                 Directory for local patches that aren't part of
                   3694:                 pkgsrc. See <a href="#components.patches" title=
                   3695:                 "8.3.&nbsp;patches/*">Section&nbsp;8.3,
                   3696:                 &#8220;patches/*&#8221;</a> for more information.
                   3697:                 <em class="replaceable"><code>rel</code></em> and
                   3698:                 <em class="replaceable"><code>arch</code></em> are
                   3699:                 replaced with OS release (&#8220;<span class=
                   3700:                 "quote">2.0</span>&#8221;, etc.) and architecture
                   3701:                 (&#8220;<span class="quote">mipsel</span>&#8221;,
                   3702:                 etc.).</p>
                   3703:               </li>
                   3704: 
                   3705:               <li>
                   3706:                 <p><code class="varname">PKGMAKECONF</code>:
                   3707:                 Location of the <code xmlns=
                   3708:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3709:                 "filename">mk.conf</code> file used by a package's
                   3710:                 BSD-style Makefile. If this is not set,
                   3711:                 <code class="varname">MAKECONF</code> is set to
                   3712:                 <code xmlns=
                   3713:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3714:                 "filename">/dev/null</code> to avoid picking up
                   3715:                 settings used by builds in <code xmlns=
                   3716:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3717:                 "filename">/usr/src</code>.</p>
                   3718:               </li>
                   3719:             </ul>
                   3720:           </div>
                   3721:         </div>
                   3722: 
1.67    ! hubertf  3723:         <div class="sect1" lang="en">
1.45      wiz      3724:           <div class="titlepage">
                   3725:             <div>
                   3726:               <div>
                   3727:                 <h2 class="title" style="clear: both"><a name=
                   3728:                 "developer-advanced-settings"></a>5.3.&nbsp;Developer/advanced
                   3729:                 settings</h2>
                   3730:               </div>
                   3731:             </div>
                   3732:           </div>
                   3733: 
                   3734:           <p>XXX</p>
                   3735: 
                   3736:           <div class="itemizedlist">
                   3737:             <ul type="disc">
                   3738:               <li>
                   3739:                 <p><code class="varname">PKG_DEVELOPER</code>: Run
                   3740:                 some sanity checks that package developers
                   3741:                 want:</p>
                   3742: 
                   3743:                 <div class="itemizedlist">
                   3744:                   <ul type="circle">
                   3745:                     <li>
                   3746:                       <p>make sure patches apply with zero fuzz</p>
                   3747:                     </li>
                   3748: 
                   3749:                     <li>
                   3750:                       <p>run check-shlibs to see that all binaries
                   3751:                       will find their shared libs.</p>
                   3752:                     </li>
                   3753:                   </ul>
                   3754:                 </div>
                   3755:               </li>
                   3756: 
                   3757:               <li>
                   3758:                 <p><code class="varname">PKG_DEBUG_LEVEL</code>:
                   3759:                 The level of debugging output which is displayed
                   3760:                 whilst making and installing the package. The
                   3761:                 default value for this is 0, which will not display
                   3762:                 the commands as they are executed (normal, default,
                   3763:                 quiet operation); the value 1 will display all
                   3764:                 shell commands before their invocation, and the
                   3765:                 value 2 will display both the shell commands before
                   3766:                 their invocation, and their actual execution
                   3767:                 progress with <span><strong class="command">set
                   3768:                 -x</strong></span> will be displayed.</p>
                   3769:               </li>
1.58      erh      3770: 
                   3771:               <li>
                   3772:                 <p><code class=
                   3773:                 "varname">ALLOW_VULNERABILITIES.<em class=
                   3774:                 "replaceable"><code>pkgbase</code></em></code>: A
                   3775:                 space separated list of vulnerability IDs that may
                   3776:                 be ignored when performing the automated security
                   3777:                 checks. These IDs are listed in the
                   3778:                 pkg-vulnerabilities file and are displayed by
                   3779:                 <span><strong class=
                   3780:                 "command">audit-packages</strong></span> when it
                   3781:                 finds a vulnerable package.</p>
                   3782:               </li>
                   3783: 
                   3784:               <li>
                   3785:                 <p><code class=
                   3786:                 "varname">SKIP_AUDIT_PACKAGES</code>: If this is
                   3787:                 set to &#8220;<span class=
                   3788:                 "quote">yes</span>&#8221;, the automated security
                   3789:                 checks (which use the <a xmlns=
                   3790:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3791:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
                   3792:                 target="_top"><code xmlns="" class=
                   3793:                 "filename">security/audit-packages</code></a>
                   3794:                 package) will be <span class=
                   3795:                 "strong"><strong>entirely</strong></span> skipped
                   3796:                 for <span class=
                   3797:                 "strong"><strong>all</strong></span> packages
                   3798:                 built. Normally you'll want to use
                   3799:                 ALLOW_VULNERABILITIES instead of this.</p>
                   3800:               </li>
1.45      wiz      3801:             </ul>
                   3802:           </div>
                   3803:         </div>
                   3804: 
1.67    ! hubertf  3805:         <div class="sect1" lang="en">
1.45      wiz      3806:           <div class="titlepage">
                   3807:             <div>
                   3808:               <div>
                   3809:                 <h2 class="title" style="clear: both"><a name=
                   3810:                 "selecting-build-options"></a>5.4.&nbsp;Selecting
                   3811:                 Build Options</h2>
1.38      dillo    3812:               </div>
                   3813:             </div>
                   3814:           </div>
                   3815: 
                   3816:           <p>Some packages have build time options, usually to
                   3817:           select between different dependencies, enable optional
                   3818:           support for big dependencies or enable experimental
                   3819:           features.</p>
                   3820: 
                   3821:           <p>To see which options, if any, a package supports, and
                   3822:           which options are mutually exclusive, run
                   3823:           <span><strong class="command">make
                   3824:           show-options</strong></span>, for example:</p>
                   3825:           <pre class="programlisting">
1.51      rillig   3826:     The following options are supported by this package:
                   3827:     ssl      Enable SSL support.
                   3828:     Exactly one of the following gecko options is required:
                   3829:     firefox  Use firefox as gecko rendering engine.
                   3830:     mozilla  Use mozilla as gecko rendering engine.
                   3831:     At most one of the following database options may be selected:
                   3832:     mysql    Enable support for MySQL database.
                   3833:     pgsql    Enable support for PostgreSQL database.
                   3834: 
                   3835:     These options are enabled by default: firefox
                   3836:     These options are currently enabled: mozilla ssl
1.38      dillo    3837: </pre>
                   3838: 
1.45      wiz      3839:           <p>The following variables can be defined in <code xmlns=
                   3840:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.38      dillo    3841:           "filename">/etc/mk.conf</code> to select which options to
                   3842:           enable for a package: <code class=
                   3843:           "varname">PKG_DEFAULT_OPTIONS</code>, which can be used
                   3844:           to select or disable options for all packages that
                   3845:           support them, and <code class=
                   3846:           "varname">PKG_OPTIONS.<em class=
                   3847:           "replaceable"><code>pkgbase</code></em></code>, which can
                   3848:           be used to select or disable options specifically for
                   3849:           package <em class=
                   3850:           "replaceable"><code>pkgbase</code></em>. Options listed
                   3851:           in these variables are selected, options preceded by
1.67    ! hubertf  3852:           &#8220;<span class="quote">-</span>&#8221; are disabled.
        !          3853:           A few examples:</p>
        !          3854:           <pre class="screen">
        !          3855: <code class="prompt">$</code> <span><strong class=
        !          3856: "command">grep "PKG.*OPTION" /etc/mk.conf</strong></span>
        !          3857: PKG_DEFAULT_OPTIONS=    -arts -dvdread -esound 
        !          3858: PKG_OPTIONS.kdebase=    debug -sasl
        !          3859: PKG_OPTIONS.apache=     suexec 
        !          3860: </pre>
1.38      dillo    3861: 
1.39      dillo    3862:           <p>The following settings are consulted in the order
                   3863:           given, and the last setting that selects or disables an
                   3864:           option is used:</p>
1.38      dillo    3865: 
                   3866:           <div class="orderedlist">
                   3867:             <ol type="1">
                   3868:               <li>
                   3869:                 <p>the default options as suggested by the package
                   3870:                 maintainer</p>
                   3871:               </li>
                   3872: 
                   3873:               <li>
                   3874:                 <p>the options implied by the settings of legacy
                   3875:                 variables (see below)</p>
                   3876:               </li>
                   3877: 
                   3878:               <li>
                   3879:                 <p><code class=
                   3880:                 "varname">PKG_DEFAULT_OPTIONS</code></p>
                   3881:               </li>
                   3882: 
                   3883:               <li>
                   3884:                 <p><code class="varname">PKG_OPTIONS.<em class=
                   3885:                 "replaceable"><code>pkgbase</code></em></code></p>
                   3886:               </li>
                   3887:             </ol>
                   3888:           </div>
                   3889: 
                   3890:           <p>For groups of mutually exclusive options, the last
                   3891:           option selected is used, all others are automatically
                   3892:           disabled. If an option of the group is explicitly
                   3893:           disabled, the previously selected option, if any, is
                   3894:           used. It is an error if no option from a required group
                   3895:           of options is selected, and building the package will
                   3896:           fail.</p>
                   3897: 
                   3898:           <p>Before the options framework was introduced, build
1.65      hubertf  3899:           options were selected by setting a variable (often named
                   3900:           <code class="varname">USE_<em class=
                   3901:           "replaceable"><code>FOO</code></em></code>) in
1.45      wiz      3902:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3903:           class="filename">/etc/mk.conf</code> for each option. To
                   3904:           ease transition to the options framework for the user,
                   3905:           these legacy variables are converted to the appropriate
1.65      hubertf  3906:           options setting (<code class=
                   3907:           "varname">PKG_OPTIONS.<em class=
                   3908:           "replaceable"><code>pkgbase</code></em></code>)
                   3909:           automatically. A warning is issued to prompt the user to
                   3910:           update <code xmlns=
1.45      wiz      3911:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.38      dillo    3912:           "filename">/etc/mk.conf</code> to use the options
1.65      hubertf  3913:           framework directly. Support for the legacy variables will
                   3914:           be removed eventually.</p>
1.38      dillo    3915:         </div>
                   3916:       </div>
                   3917: 
1.67    ! hubertf  3918:       <div class="chapter" lang="en">
1.38      dillo    3919:         <div class="titlepage">
                   3920:           <div>
                   3921:             <div>
1.67    ! hubertf  3922:               <h2 class="title"><a name=
1.38      dillo    3923:               "binary"></a>Chapter&nbsp;6.&nbsp;Creating binary
1.1       grant    3924:               packages</h2>
                   3925:             </div>
                   3926:           </div>
                   3927:         </div>
                   3928: 
                   3929:         <div class="toc">
                   3930:           <p><b>Table of Contents</b></p>
                   3931: 
                   3932:           <dl>
1.30      wiz      3933:             <dt><span class="sect1"><a href=
1.38      dillo    3934:             "#building-a-single-binary-package">6.1. Building a
1.30      wiz      3935:             single binary package</a></span></dt>
1.1       grant    3936: 
1.30      wiz      3937:             <dt><span class="sect1"><a href=
1.38      dillo    3938:             "#settings-for-creationg-of-binary-packages">6.2.
1.1       grant    3939:             Settings for creation of binary
                   3940:             packages</a></span></dt>
                   3941: 
1.38      dillo    3942:             <dt><span class="sect1"><a href="#bulkbuild">6.3. Doing
1.1       grant    3943:             a bulk build of all packages</a></span></dt>
                   3944: 
                   3945:             <dd>
                   3946:               <dl>
                   3947:                 <dt><span class="sect2"><a href=
1.38      dillo    3948:                 "#binary.configuration">6.3.1.
1.1       grant    3949:                 Configuration</a></span></dt>
                   3950: 
1.30      wiz      3951:                 <dt><span class="sect2"><a href=
1.38      dillo    3952:                 "#other-environmental-considerations">6.3.2. Other
1.30      wiz      3953:                 environmental considerations</a></span></dt>
1.1       grant    3954: 
1.38      dillo    3955:                 <dt><span class="sect2"><a href="#operation">6.3.3.
1.1       grant    3956:                 Operation</a></span></dt>
                   3957: 
1.30      wiz      3958:                 <dt><span class="sect2"><a href=
1.38      dillo    3959:                 "#what-it-does">6.3.4. What it does</a></span></dt>
1.1       grant    3960: 
1.30      wiz      3961:                 <dt><span class="sect2"><a href=
1.38      dillo    3962:                 "#disk-space-requirements">6.3.5. Disk space
1.30      wiz      3963:                 requirements</a></span></dt>
1.1       grant    3964: 
1.30      wiz      3965:                 <dt><span class="sect2"><a href=
1.38      dillo    3966:                 "#setting-up-a-sandbox">6.3.6. Setting up a sandbox
1.47      reed     3967:                 for chrooted builds</a></span></dt>
1.1       grant    3968: 
1.30      wiz      3969:                 <dt><span class="sect2"><a href=
1.38      dillo    3970:                 "#building-a-partial-set">6.3.7. Building a partial
1.30      wiz      3971:                 set of packages</a></span></dt>
1.13      hubertf  3972: 
                   3973:                 <dt><span class="sect2"><a href=
1.38      dillo    3974:                 "#bulk-upload">6.3.8. Uploading results of a bulk
1.13      hubertf  3975:                 build</a></span></dt>
1.1       grant    3976:               </dl>
                   3977:             </dd>
                   3978: 
1.38      dillo    3979:             <dt><span class="sect1"><a href="#creating-cdroms">6.4.
1.1       grant    3980:             Creating a multiple CD-ROM packages
                   3981:             collection</a></span></dt>
                   3982: 
                   3983:             <dd>
                   3984:               <dl>
1.30      wiz      3985:                 <dt><span class="sect2"><a href=
1.38      dillo    3986:                 "#cdpack-example">6.4.1. Example of
1.30      wiz      3987:                 cdpack</a></span></dt>
1.1       grant    3988:               </dl>
                   3989:             </dd>
                   3990:           </dl>
                   3991:         </div>
                   3992: 
1.67    ! hubertf  3993:         <div class="sect1" lang="en">
1.1       grant    3994:           <div class="titlepage">
                   3995:             <div>
                   3996:               <div>
                   3997:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    3998:                 "building-a-single-binary-package"></a>6.1.&nbsp;Building
1.30      wiz      3999:                 a single binary package</h2>
1.1       grant    4000:               </div>
                   4001:             </div>
                   4002:           </div>
                   4003: 
                   4004:           <p>Once you have built and installed a package, you can
                   4005:           create a <span class="emphasis"><em>binary
                   4006:           package</em></span> which can be installed on another
                   4007:           system with <a href=
                   4008:           "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   4009:           <span class="citerefentry"><span class=
1.47      reed     4010:           "refentrytitle">pkg_add</span>(1)</span></a>. This saves
1.1       grant    4011:           having to build the same package on a group of hosts and
                   4012:           wasting CPU time. It also provides a simple means for
                   4013:           others to install your package, should you distribute
                   4014:           it.</p>
                   4015: 
                   4016:           <p>To create a binary package, change into the
1.14      xtraeme  4017:           appropriate directory in pkgsrc, and run
                   4018:           <span><strong class="command">make
                   4019:           package</strong></span>:</p>
1.1       grant    4020:           <pre class="screen">
1.14      xtraeme  4021: <code class="prompt">#</code> <strong class=
                   4022: "userinput"><code>cd misc/figlet</code></strong>
                   4023: <code class="prompt">#</code> <strong class=
                   4024: "userinput"><code>make package</code></strong>
1.1       grant    4025: </pre>
                   4026: 
                   4027:           <p>This will build and install your package (if not
                   4028:           already done), and then build a binary package from what
1.14      xtraeme  4029:           was installed. You can then use the <span><strong class=
                   4030:           "command">pkg_*</strong></span> tools to manipulate it.
1.45      wiz      4031:           Binary packages are created by default in <code xmlns=
                   4032:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4033:           "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1       grant    4034:           gzipped tar file. See <a href="#logs.package" title=
1.67    ! hubertf  4035:           "B.2.&nbsp;Packaging figlet">Section&nbsp;B.2,
1.1       grant    4036:           &#8220;Packaging figlet&#8221;</a> for a continuation of
                   4037:           the above <a xmlns=
                   4038:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4039:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.45      wiz      4040:           target="_top"><code xmlns="" class=
                   4041:           "filename">misc/figlet</code></a> example.</p>
1.1       grant    4042: 
                   4043:           <p>See <a href="#submit" title=
1.67    ! hubertf  4044:           "Chapter&nbsp;17.&nbsp;Submitting and Committing">Chapter&nbsp;17,
        !          4045:           <i>Submitting and Committing</i></a> for information on
        !          4046:           how to submit such a binary package.</p>
1.1       grant    4047:         </div>
                   4048: 
1.67    ! hubertf  4049:         <div class="sect1" lang="en">
1.1       grant    4050:           <div class="titlepage">
                   4051:             <div>
                   4052:               <div>
                   4053:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    4054:                 "settings-for-creationg-of-binary-packages"></a>6.2.&nbsp;Settings
1.1       grant    4055:                 for creation of binary packages</h2>
                   4056:               </div>
                   4057:             </div>
                   4058:           </div>
                   4059: 
                   4060:           <p>See <a href="#build.helpful-targets" title=
1.56      rillig   4061:           "14.16.&nbsp;Other helpful targets">Section&nbsp;14.16,
1.1       grant    4062:           &#8220;Other helpful targets&#8221;</a>.</p>
                   4063:         </div>
                   4064: 
1.67    ! hubertf  4065:         <div class="sect1" lang="en">
1.1       grant    4066:           <div class="titlepage">
                   4067:             <div>
                   4068:               <div>
                   4069:                 <h2 class="title" style="clear: both"><a name=
1.67    ! hubertf  4070:                 "bulkbuild"></a>6.3.&nbsp;Doing a bulk build of all
        !          4071:                 packages</h2>
1.1       grant    4072:               </div>
                   4073:             </div>
                   4074:           </div>
                   4075: 
                   4076:           <p>If you want to get a full set of precompiled binary
                   4077:           packages, this section describes how to get them. Beware
                   4078:           that the bulk build will remove all currently installed
1.63      dillo    4079:           packages from your system!</p>
                   4080: 
                   4081:           <p>Having an FTP server configured either on the machine
                   4082:           doing the bulk builds or on a nearby NFS server can help
                   4083:           to make the packages available to other machines that can
                   4084:           then save time by installing only the binary packages.
                   4085:           See <a href=
1.1       grant    4086:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
                   4087:           <span class="citerefentry"><span class=
                   4088:           "refentrytitle">ftpd</span>(8)</span></a> for more
                   4089:           information. If you use a remote NFS server's storage, be
                   4090:           sure to not actually compile on NFS storage, as this
                   4091:           slows things down a lot.</p>
                   4092: 
1.67    ! hubertf  4093:           <div class="sect2" lang="en">
1.1       grant    4094:             <div class="titlepage">
                   4095:               <div>
                   4096:                 <div>
1.67    ! hubertf  4097:                   <h3 class="title"><a name=
1.38      dillo    4098:                   "binary.configuration"></a>6.3.1.&nbsp;Configuration</h3>
1.1       grant    4099:                 </div>
                   4100:               </div>
                   4101:             </div>
                   4102: 
1.67    ! hubertf  4103:             <div class="sect3" lang="en">
1.1       grant    4104:               <div class="titlepage">
                   4105:                 <div>
                   4106:                   <div>
1.63      dillo    4107:                     <h4 class="title"><a name=
                   4108:                     "binary.bulk.build.conf"></a>6.3.1.1.&nbsp;<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4109:                     class="filename">build.conf</code></h4>
                   4110:                   </div>
                   4111:                 </div>
                   4112:               </div>
                   4113: 
                   4114:               <p>The <code xmlns=
                   4115:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4116:               "filename">build.conf</code> file is the main
                   4117:               configuration file for bulk builds. You can configure
                   4118:               how your copy of pkgsrc is kept up to date, how the
                   4119:               distfiles are downloaded, how the packages are built
                   4120:               and how the report is generated. You can find an
                   4121:               annotated example file in <code xmlns=
                   4122:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4123:               "filename">pkgsrc/mk/bulk/build.conf-example</code>.
                   4124:               To use it, copy <code xmlns=
                   4125:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4126:               "filename">build.conf-example</code> to <code xmlns=
                   4127:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4128:               "filename">build.conf</code> and edit it, following
                   4129:               the comments in that file.</p>
                   4130:             </div>
                   4131: 
1.67    ! hubertf  4132:             <div class="sect3" lang="en">
1.63      dillo    4133:               <div class="titlepage">
                   4134:                 <div>
                   4135:                   <div>
1.67    ! hubertf  4136:                     <h4 class="title"><a name=
1.63      dillo    4137:                     "binary.mk.conf"></a>6.3.1.2.&nbsp;/etc/mk.conf</h4>
1.1       grant    4138:                   </div>
                   4139:                 </div>
                   4140:               </div>
                   4141: 
1.45      wiz      4142:               <p>You may want to set variables in <code xmlns=
                   4143:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4144:               "filename">/etc/mk.conf</code>. Look at <code xmlns=
                   4145:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4146:               "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1       grant    4147:               details of the default settings. You will want to
1.14      xtraeme  4148:               ensure that <code class=
                   4149:               "varname">ACCEPTABLE_LICENSES</code> meet your local
                   4150:               policy. As used in this example, <code class=
                   4151:               "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1       grant    4152:               "emphasis"><em>all</em></span> licenses.</p>
                   4153:               <pre class="programlisting">
1.51      rillig   4154:     PACKAGES?=      ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
                   4155:     WRKOBJDIR?=     /usr/tmp/pkgsrc   # build here instead of in pkgsrc
                   4156:     BSDSRCDIR=      /usr/src
                   4157:     BSDXSRCDIR=     /usr/xsrc         # for x11/xservers
                   4158:     OBJHOSTNAME?=   yes               # use work.`hostname`
                   4159:     FAILOVER_FETCH= yes               # insist on the correct checksum
                   4160:     PKG_DEVELOPER?= yes
                   4161:     _ACCEPTABLE=    yes
1.1       grant    4162: </pre>
                   4163: 
1.63      dillo    4164:               <p>Some options that are especially useful for bulk
                   4165:               builds can be found at the top lines of the file
                   4166:               <code xmlns=
                   4167:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4168:               "filename">mk/bulk/bsd.bulk-pkg.mk</code>. The most
                   4169:               useful options of these are briefly described
                   4170:               here.</p>
                   4171: 
                   4172:               <div class="itemizedlist">
                   4173:                 <ul type="disc">
                   4174:                   <li>
                   4175:                     <p>If you are on a slow machine, you may want
                   4176:                     to set <code class=
                   4177:                     "varname">USE_BULK_BROKEN_CHECK</code> to
                   4178:                     &#8220;<span class=
                   4179:                     "quote">no</span>&#8221;.</p>
                   4180:                   </li>
                   4181: 
                   4182:                   <li>
                   4183:                     <p>If you are doing bulk builds from a
                   4184:                     read-only copy of pkgsrc, you have to set
                   4185:                     <code class="varname">BULKFILESDIR</code> to
                   4186:                     the directory where all log files are created.
                   4187:                     Otherwise the log files are created in the
                   4188:                     pkgsrc directory.</p>
                   4189:                   </li>
                   4190: 
                   4191:                   <li>
                   4192:                     <p>Another important variable is <code class=
                   4193:                     "varname">BULK_PREREQ</code>, which is a list
                   4194:                     of packages that should be always available
                   4195:                     while building other packages.</p>
                   4196:                   </li>
                   4197:                 </ul>
1.1       grant    4198:               </div>
                   4199:             </div>
                   4200: 
1.67    ! hubertf  4201:             <div class="sect3" lang="en">
1.1       grant    4202:               <div class="titlepage">
                   4203:                 <div>
                   4204:                   <div>
1.67    ! hubertf  4205:                     <h4 class="title"><a name=
1.45      wiz      4206:                     "pre-build.local"></a>6.3.1.3.&nbsp;<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4207:                     class="filename">pre-build.local</code></h4>
1.1       grant    4208:                   </div>
                   4209:                 </div>
                   4210:               </div>
                   4211: 
                   4212:               <p>It is possible to configure the bulk build to
1.47      reed     4213:               perform certain site-specific tasks at the end of the
1.45      wiz      4214:               pre-build stage. If the file <code xmlns=
                   4215:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4216:               "filename">pre-build.local</code> exists in
1.45      wiz      4217:               <code xmlns=
                   4218:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4219:               "filename">/usr/pkgsrc/mk/bulk</code>, it will be
                   4220:               executed (as a <a href=
1.24      wiz      4221:               "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
                   4222:               <span class="citerefentry"><span class=
                   4223:               "refentrytitle">sh</span>(1)</span></a> script) at
                   4224:               the end of the usual pre-build stage. An example use
1.45      wiz      4225:               of <code xmlns=
                   4226:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4227:               "filename">pre-build.local</code> is to have the
                   4228:               line:</p>
1.1       grant    4229:               <pre class="screen">
1.14      xtraeme  4230: <code class="prompt">#</code> <strong class=
                   4231: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23      wiz      4232:     &gt; pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1       grant    4233: </pre>
                   4234: 
                   4235:               <p>to prevent the system from trying to build a
                   4236:               particular package which requires nearly 3 GB of disk
                   4237:               space.</p>
                   4238:             </div>
                   4239:           </div>
                   4240: 
1.67    ! hubertf  4241:           <div class="sect2" lang="en">
1.1       grant    4242:             <div class="titlepage">
                   4243:               <div>
                   4244:                 <div>
1.30      wiz      4245:                   <h3 class="title"><a name=
1.38      dillo    4246:                   "other-environmental-considerations"></a>6.3.2.&nbsp;Other
1.30      wiz      4247:                   environmental considerations</h3>
1.1       grant    4248:                 </div>
                   4249:               </div>
                   4250:             </div>
                   4251: 
1.45      wiz      4252:             <p>As <code xmlns=
                   4253:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4254:             "filename">/usr/pkg</code> will be completely deleted
                   4255:             at the start of bulk builds, make sure your login shell
                   4256:             is placed somewhere else. Either drop it into
                   4257:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4258:             class="filename">/usr/local/bin</code> (and adjust your
                   4259:             login shell in the passwd file), or (re-)install it via
1.14      xtraeme  4260:             <a href=
1.1       grant    4261:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   4262:             <span class="citerefentry"><span class=
                   4263:             "refentrytitle">pkg_add</span>(1)</span></a> from
1.45      wiz      4264:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4265:             class="filename">/etc/rc.local</code>, so you can login
                   4266:             after a reboot (remember that your current process
                   4267:             won't die if the package is removed, you just can't
                   4268:             start any new instances of the shell any more). Also,
                   4269:             if you use NetBSD earlier than 1.5, or you still want
                   4270:             to use the pkgsrc version of ssh for some reason, be
                   4271:             sure to install ssh before starting it from
                   4272:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4273:             class="filename">rc.local</code>:</p>
1.1       grant    4274:             <pre class="programlisting">
1.51      rillig   4275:     ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
                   4276:     if [ -f /usr/pkg/etc/rc.d/sshd ]; then
                   4277:         /usr/pkg/etc/rc.d/sshd
                   4278:     fi
1.1       grant    4279: </pre>
                   4280: 
                   4281:             <p>Not doing so will result in you being not able to
                   4282:             log in via ssh after the bulk build is finished or if
                   4283:             the machine gets rebooted or crashes. You have been
                   4284:             warned! :)</p>
                   4285:           </div>
                   4286: 
1.67    ! hubertf  4287:           <div class="sect2" lang="en">
1.1       grant    4288:             <div class="titlepage">
                   4289:               <div>
                   4290:                 <div>
1.67    ! hubertf  4291:                   <h3 class="title"><a name=
1.38      dillo    4292:                   "operation"></a>6.3.3.&nbsp;Operation</h3>
1.1       grant    4293:                 </div>
                   4294:               </div>
                   4295:             </div>
                   4296: 
                   4297:             <p>Make sure you don't need any of the packages still
                   4298:             installed.</p>
                   4299: 
                   4300:             <div class="warning" style=
                   4301:             "margin-left: 0.5in; margin-right: 0.5in;">
                   4302:               <h3 class="title">Warning</h3>
                   4303: 
                   4304:               <p>During the bulk build, <span class=
                   4305:               "emphasis"><em>all packages will be
                   4306:               removed!</em></span></p>
                   4307:             </div>
                   4308: 
                   4309:             <p>Be sure to remove all other things that might
                   4310:             interfere with builds, like some libs installed in
1.45      wiz      4311:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4312:             class="filename">/usr/local</code>, etc. then become
                   4313:             root and type:</p>
1.1       grant    4314:             <pre class="screen">
1.14      xtraeme  4315: <code class="prompt">#</code> <strong class=
                   4316: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   4317: <code class="prompt">#</code> <strong class=
                   4318: "userinput"><code>sh mk/bulk/build</code></strong>
1.1       grant    4319: </pre>
                   4320: 
                   4321:             <p>If for some reason your last build didn't complete
                   4322:             (power failure, system panic, ...), you can continue it
                   4323:             by running:</p>
                   4324:             <pre class="screen">
1.14      xtraeme  4325: <code class="prompt">#</code> <strong class=
                   4326: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1       grant    4327: </pre>
                   4328: 
                   4329:             <p>At the end of the bulk build, you will get a summary
                   4330:             via mail, and find build logs in the directory
1.14      xtraeme  4331:             specified by <code class="varname">FTP</code> in the
1.45      wiz      4332:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4333:             class="filename">build.conf</code> file.</p>
1.1       grant    4334:           </div>
                   4335: 
1.67    ! hubertf  4336:           <div class="sect2" lang="en">
1.1       grant    4337:             <div class="titlepage">
                   4338:               <div>
                   4339:                 <div>
1.67    ! hubertf  4340:                   <h3 class="title"><a name=
1.38      dillo    4341:                   "what-it-does"></a>6.3.4.&nbsp;What it does</h3>
1.1       grant    4342:                 </div>
                   4343:               </div>
                   4344:             </div>
                   4345: 
                   4346:             <p>The bulk builds consist of three steps:</p>
                   4347: 
                   4348:             <div class="variablelist">
                   4349:               <dl>
                   4350:                 <dt><span class="term">1. pre-build</span></dt>
                   4351: 
                   4352:                 <dd>
                   4353:                   <p>The script updates your pkgsrc tree via
                   4354:                   (anon)cvs, then cleans out any broken distfiles,
                   4355:                   and removes all packages installed.</p>
                   4356:                 </dd>
                   4357: 
                   4358:                 <dt><span class="term">2. the bulk
                   4359:                 build</span></dt>
                   4360: 
                   4361:                 <dd>
                   4362:                   <p>This is basically &#8220;<span class=
                   4363:                   "quote">make bulk-package</span>&#8221; with an
                   4364:                   optimised order in which packages will be built.
                   4365:                   Packages that don't require other packages will
                   4366:                   be built first, and packages with many
                   4367:                   dependencies will be built later.</p>
                   4368:                 </dd>
                   4369: 
                   4370:                 <dt><span class="term">3. post-build</span></dt>
                   4371: 
                   4372:                 <dd>
                   4373:                   <p>Generates a report that's placed in the
1.45      wiz      4374:                   directory specified in the <code xmlns=
                   4375:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4376:                   "filename">build.conf</code> file named
1.45      wiz      4377:                   <code xmlns=
                   4378:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4379:                   "filename">broken.html</code>, a short version of
                   4380:                   that report will also be mailed to the build's
                   4381:                   admin.</p>
1.1       grant    4382:                 </dd>
                   4383:               </dl>
                   4384:             </div>
                   4385: 
                   4386:             <p>During the build, a list of broken packages will be
1.45      wiz      4387:             compiled in <code xmlns=
                   4388:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4389:             "filename">/usr/pkgsrc/.broken</code> (or <code xmlns=
                   4390:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4391:             "filename">.../.broken.${MACHINE}</code> if
                   4392:             <code class="varname">OBJMACHINE</code> is set),
                   4393:             individual build logs of broken builds can be found in
                   4394:             the package's directory. These files are used by the
                   4395:             bulk-targets to mark broken builds to not waste time
                   4396:             trying to rebuild them, and they can be used to debug
                   4397:             these broken package builds later.</p>
1.1       grant    4398:           </div>
                   4399: 
1.67    ! hubertf  4400:           <div class="sect2" lang="en">
1.1       grant    4401:             <div class="titlepage">
                   4402:               <div>
                   4403:                 <div>
1.30      wiz      4404:                   <h3 class="title"><a name=
1.38      dillo    4405:                   "disk-space-requirements"></a>6.3.5.&nbsp;Disk
1.30      wiz      4406:                   space requirements</h3>
1.1       grant    4407:                 </div>
                   4408:               </div>
                   4409:             </div>
                   4410: 
                   4411:             <p>Currently, roughly the following requirements are
                   4412:             valid for NetBSD 2.0/i386:</p>
                   4413: 
                   4414:             <div class="itemizedlist">
                   4415:               <ul type="disc">
                   4416:                 <li>
                   4417:                   <p>10 GB - distfiles (NFS ok)</p>
                   4418:                 </li>
                   4419: 
                   4420:                 <li>
                   4421:                   <p>8 GB - full set of all binaries (NFS ok)</p>
                   4422:                 </li>
                   4423: 
                   4424:                 <li>
                   4425:                   <p>5 GB - temp space for compiling (local disk
                   4426:                   recommended)</p>
                   4427:                 </li>
                   4428:               </ul>
                   4429:             </div>
                   4430: 
                   4431:             <p>Note that all pkgs will be de-installed as soon as
                   4432:             they are turned into a binary package, and that sources
                   4433:             are removed, so there is no excessively huge demand to
                   4434:             disk space. Afterwards, if the package is needed again,
                   4435:             it will be installed via <a href=
                   4436:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   4437:             <span class="citerefentry"><span class=
                   4438:             "refentrytitle">pkg_add</span>(1)</span></a> instead of
                   4439:             building again, so there are no cycles wasted by
                   4440:             recompiling.</p>
                   4441:           </div>
                   4442: 
1.67    ! hubertf  4443:           <div class="sect2" lang="en">
1.1       grant    4444:             <div class="titlepage">
                   4445:               <div>
                   4446:                 <div>
1.67    ! hubertf  4447:                   <h3 class="title"><a name=
        !          4448:                   "setting-up-a-sandbox"></a>6.3.6.&nbsp;Setting up
        !          4449:                   a sandbox for chrooted builds</h3>
1.1       grant    4450:                 </div>
                   4451:               </div>
                   4452:             </div>
                   4453: 
1.12      agc      4454:             <p>If you don't want all the packages nuked from a
                   4455:             machine (rendering it useless for anything but pkg
1.23      wiz      4456:             compiling), there is the possibility of doing the
                   4457:             package bulk build inside a chroot environment.</p>
1.12      agc      4458: 
                   4459:             <p>The first step is to set up a chroot sandbox, e.g.
1.45      wiz      4460:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4461:             class="filename">/usr/sandbox</code>. This can be done
                   4462:             by using null mounts, or manually.</p>
1.12      agc      4463: 
1.45      wiz      4464:             <p>There is a shell script called <code xmlns=
                   4465:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4466:             "filename">pkgsrc/mk/bulk/mksandbox</code> which will
                   4467:             set up the sandbox environment using null mounts. It
1.45      wiz      4468:             will also create a script called <code xmlns=
                   4469:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4470:             "filename">sandbox</code> in the root of the sandbox
1.12      agc      4471:             environment, which will allow the null mounts to be
1.14      xtraeme  4472:             activated using the <span><strong class=
                   4473:             "command">sandbox mount</strong></span> command and
                   4474:             deactivated using the <span><strong class=
                   4475:             "command">sandbox umount</strong></span> command.</p>
1.12      agc      4476: 
                   4477:             <p>To set up a sandbox environment by hand, after
                   4478:             extracting all the sets from a NetBSD installation or
1.14      xtraeme  4479:             doing a <span><strong class="command">make distribution
1.45      wiz      4480:             DESTDIR=/usr/sandbox</strong></span> in <code xmlns=
                   4481:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4482:             "filename">/usr/src/etc</code>, be sure the following
1.7       wiz      4483:             items are present and properly configured:</p>
1.1       grant    4484: 
                   4485:             <div class="procedure">
                   4486:               <ol type="1">
                   4487:                 <li>
                   4488:                   <p>Kernel</p>
                   4489:                   <pre class="screen">
1.14      xtraeme  4490: <code class="prompt">#</code> <strong class=
                   4491: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1       grant    4492: </pre>
                   4493:                 </li>
                   4494: 
                   4495:                 <li>
1.45      wiz      4496:                   <p><code xmlns=
                   4497:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4498:                   "filename">/dev/*</code></p>
1.1       grant    4499:                   <pre class="screen">
1.14      xtraeme  4500: <code class="prompt">#</code> <strong class=
                   4501: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1       grant    4502: </pre>
                   4503:                 </li>
                   4504: 
                   4505:                 <li>
1.45      wiz      4506:                   <p><code xmlns=
                   4507:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4508:                   "filename">/etc/resolv.conf</code> (for <a xmlns=
1.1       grant    4509:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   4510:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45      wiz      4511:                   target="_top"><code xmlns="" class=
                   4512:                   "filename">security/smtpd</code></a> and
                   4513:                   mail):</p>
1.1       grant    4514:                   <pre class="screen">
1.14      xtraeme  4515: <code class="prompt">#</code> <strong class=
                   4516: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1       grant    4517: </pre>
                   4518:                 </li>
                   4519: 
                   4520:                 <li>
                   4521:                   <p>Working(!) mail config (hostname,
                   4522:                   sendmail.cf):</p>
                   4523:                   <pre class="screen">
1.14      xtraeme  4524: <code class="prompt">#</code> <strong class=
                   4525: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1       grant    4526: </pre>
                   4527:                 </li>
                   4528: 
                   4529:                 <li>
1.45      wiz      4530:                   <p><code xmlns=
                   4531:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4532:                   "filename">/etc/localtime</code> (for <a xmlns=
1.1       grant    4533:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   4534:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45      wiz      4535:                   target="_top"><code xmlns="" class=
                   4536:                   "filename">security/smtpd</code></a>):</p>
1.1       grant    4537:                   <pre class="screen">
1.14      xtraeme  4538: <code class="prompt">#</code> <strong class=
                   4539: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1       grant    4540: </pre>
                   4541:                 </li>
                   4542: 
                   4543:                 <li>
1.45      wiz      4544:                   <p><code xmlns=
                   4545:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4546:                   "filename">/usr/src</code> (system sources, for
                   4547:                   <a xmlns=
1.1       grant    4548:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   4549:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.45      wiz      4550:                   target="_top"><code xmlns="" class=
                   4551:                   "filename">sysutils/aperture</code></a>,
                   4552:                   <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4553:                   href=
1.20      ben      4554:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
1.45      wiz      4555:                   target="_top"><code xmlns="" class=
                   4556:                   "filename">net/ppp-mppe</code></a>):</p>
1.1       grant    4557:                   <pre class="screen">
1.14      xtraeme  4558: <code class="prompt">#</code> <strong class=
                   4559: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
                   4560: <code class="prompt">#</code> <strong class=
1.23      wiz      4561: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1       grant    4562: </pre>
                   4563:                 </li>
                   4564: 
                   4565:                 <li>
1.45      wiz      4566:                   <p>Create <code xmlns=
                   4567:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4568:                   "filename">/var/db/pkg</code> (not part of
                   4569:                   default install):</p>
1.1       grant    4570:                   <pre class="screen">
1.14      xtraeme  4571: <code class="prompt">#</code> <strong class=
                   4572: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1       grant    4573: </pre>
                   4574:                 </li>
                   4575: 
                   4576:                 <li>
1.45      wiz      4577:                   <p>Create <code xmlns=
                   4578:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4579:                   "filename">/usr/pkg</code> (not part of default
                   4580:                   install):</p>
1.1       grant    4581:                   <pre class="screen">
1.14      xtraeme  4582: <code class="prompt">#</code> <strong class=
                   4583: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1       grant    4584: </pre>
                   4585:                 </li>
                   4586: 
                   4587:                 <li>
1.45      wiz      4588:                   <p>Checkout pkgsrc via cvs into <code xmlns=
                   4589:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4590:                   "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1       grant    4591:                   <pre class="screen">
1.14      xtraeme  4592: <code class="prompt">#</code> <strong class=
                   4593: "userinput"><code>cd /usr/sandbox/usr</code></strong>
                   4594: <code class="prompt">#</code> <strong class=
                   4595: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1       grant    4596: </pre>
                   4597: 
                   4598:                   <p>Do not mount/link this to the copy of your
                   4599:                   pkgsrc tree you do development in, as this will
                   4600:                   likely cause problems!</p>
                   4601:                 </li>
                   4602: 
                   4603:                 <li>
1.45      wiz      4604:                   <p>Make <code xmlns=
                   4605:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4606:                   "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.45      wiz      4607:                   and <code xmlns=
                   4608:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4609:                   "filename">.../distfiles</code> point somewhere
                   4610:                   appropriate. NFS- and/or nullfs-mounts may come
                   4611:                   in handy!</p>
1.1       grant    4612:                 </li>
                   4613: 
                   4614:                 <li>
1.45      wiz      4615:                   <p>Edit <code xmlns=
                   4616:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4617:                   "filename">/etc/mk.conf</code>, see <a href=
                   4618:                   "#binary.mk.conf" title=
1.63      dillo    4619:                   "6.3.1.2.&nbsp;/etc/mk.conf">Section&nbsp;6.3.1.2,
1.1       grant    4620:                   &#8220;/etc/mk.conf&#8221;</a>.</p>
                   4621:                 </li>
                   4622: 
                   4623:                 <li>
1.45      wiz      4624:                   <p>Adjust <code xmlns=
                   4625:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4626:                   "filename">mk/bulk/build.conf</code> to suit your
1.1       grant    4627:                   needs.</p>
                   4628:                 </li>
                   4629: 
                   4630:                 <li>
1.14      xtraeme  4631:                   <p>If you have set <code class=
1.45      wiz      4632:                   "varname">CVS_USER</code> in <code xmlns=
                   4633:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4634:                   "filename">build.conf</code>, make sure that
                   4635:                   account exists and can do a <span><strong class=
                   4636:                   "command">cvs ${CVS_FLAGS} update</strong></span>
1.1       grant    4637:                   properly!</p>
                   4638:                 </li>
                   4639:               </ol>
                   4640:             </div>
                   4641: 
1.47      reed     4642:             <p>When the chroot sandbox is set up, you can start the
1.1       grant    4643:             build with the following steps:</p>
                   4644:             <pre class="screen">
1.14      xtraeme  4645: <code class="prompt">#</code> <strong class=
                   4646: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
                   4647: <code class="prompt">#</code> <strong class=
                   4648: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1       grant    4649: </pre>
                   4650: 
                   4651:             <p>This will just jump inside the sandbox and start
                   4652:             building. At the end of the build, mail will be sent
                   4653:             with the results of the build. Created binary pkgs will
1.45      wiz      4654:             be in <code xmlns=
                   4655:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4656:             "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1       grant    4657:             (wherever that points/mounts to/from).</p>
                   4658:           </div>
                   4659: 
1.67    ! hubertf  4660:           <div class="sect2" lang="en">
1.1       grant    4661:             <div class="titlepage">
                   4662:               <div>
                   4663:                 <div>
1.30      wiz      4664:                   <h3 class="title"><a name=
1.38      dillo    4665:                   "building-a-partial-set"></a>6.3.7.&nbsp;Building
1.30      wiz      4666:                   a partial set of packages</h3>
1.1       grant    4667:                 </div>
                   4668:               </div>
                   4669:             </div>
                   4670: 
                   4671:             <p>In addition to building a complete set of all
1.45      wiz      4672:             packages in pkgsrc, the <code xmlns=
                   4673:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4674:             "filename">pkgsrc/mk/bulk/build</code> script may be
                   4675:             used to build a subset of the packages contained in
1.47      reed     4676:             pkgsrc. By setting <code class=
1.45      wiz      4677:             "varname">SPECIFIC_PKGS</code> in <code xmlns=
                   4678:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4679:             "filename">/etc/mk.conf</code>, the variables</p>
1.1       grant    4680: 
                   4681:             <div class="itemizedlist">
                   4682:               <ul type="disc">
                   4683:                 <li>
                   4684:                   <p>SITE_SPECIFIC_PKGS</p>
                   4685:                 </li>
                   4686: 
                   4687:                 <li>
                   4688:                   <p>HOST_SPECIFIC_PKGS</p>
                   4689:                 </li>
                   4690: 
                   4691:                 <li>
                   4692:                   <p>GROUP_SPECIFIC_PKGS</p>
                   4693:                 </li>
                   4694: 
                   4695:                 <li>
                   4696:                   <p>USER_SPECIFIC_PKGS</p>
                   4697:                 </li>
                   4698:               </ul>
                   4699:             </div>
                   4700: 
                   4701:             <p>will define the set of packages which should be
                   4702:             built. The bulk build code will also include any
                   4703:             packages which are needed as dependencies for the
                   4704:             explicitly listed packages.</p>
                   4705: 
                   4706:             <p>One use of this is to do a bulk build with
1.14      xtraeme  4707:             <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1       grant    4708:             sandbox periodically to have a complete set of the
                   4709:             binary packages needed for your site available without
                   4710:             the overhead of building extra packages that are not
                   4711:             needed.</p>
                   4712:           </div>
1.13      hubertf  4713: 
1.67    ! hubertf  4714:           <div class="sect2" lang="en">
1.13      hubertf  4715:             <div class="titlepage">
                   4716:               <div>
                   4717:                 <div>
1.67    ! hubertf  4718:                   <h3 class="title"><a name=
1.38      dillo    4719:                   "bulk-upload"></a>6.3.8.&nbsp;Uploading results
1.13      hubertf  4720:                   of a bulk build</h3>
                   4721:                 </div>
                   4722:               </div>
                   4723:             </div>
                   4724: 
                   4725:             <p>This section describes how pkgsrc developers can
                   4726:             upload binary pkgs built by bulk builds to
                   4727:             ftp.NetBSD.org.</p>
                   4728: 
1.17      sketch   4729:             <p>If you would like to automatically create checksum
                   4730:             files for the binary packages you intend to upload,
                   4731:             remember to set <code class="varname">MKSUMS=yes</code>
1.45      wiz      4732:             in your <code xmlns=
                   4733:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.17      sketch   4734:             "filename">mk/bulk/build.conf</code>.</p>
                   4735: 
                   4736:             <p>If you would like to PGP sign the checksum files
                   4737:             (highly recommended!), remember to set <code class=
                   4738:             "varname">SIGN_AS=username@NetBSD.org</code> in your
1.45      wiz      4739:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4740:             class="filename">mk/bulk/build.conf</code>. This will
                   4741:             prompt you for your GPG password to sign the files
1.17      sketch   4742:             before uploading everything.</p>
                   4743: 
                   4744:             <p>Then, make sure that you have <code class=
1.14      xtraeme  4745:             "varname">RSYNC_DST</code> set properly in your
1.45      wiz      4746:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4747:             class="filename">mk/bulk/build.conf</code> file, i.e.
                   4748:             adjust it to something like one of the following:</p>
1.13      hubertf  4749:             <pre class="screen">
                   4750: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   4751: </pre>
                   4752: 
1.47      reed     4753:             <p>Please use appropriate values for "pkgsrc-200xQy",
1.13      hubertf  4754:             "NetBSD-a.b.c" and "arch" here. If your login on
1.14      xtraeme  4755:             ftp.NetBSD.org is different from <code class=
                   4756:             "varname">CVS_USER</code>, write your login directly
                   4757:             into the variable, e.g. my local account is "feyrer",
                   4758:             but for my login "hubertf", I use:</p>
1.13      hubertf  4759:             <pre class="screen">
                   4760: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   4761: </pre>
                   4762: 
1.45      wiz      4763:             <p>A separate <code xmlns=
                   4764:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4765:             "filename">upload</code> directory is used here to
                   4766:             allow "closing" the directory during upload. To do so,
                   4767:             run the following command on ftp.NetBSD.org next:</p>
1.13      hubertf  4768:             <pre class="screen">
1.14      xtraeme  4769: nbftp% <strong class=
                   4770: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13      hubertf  4771: </pre>
                   4772: 
1.45      wiz      4773:             <p>Please note that <code xmlns=
                   4774:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4775:             "filename">/pub/NetBSD/packages</code> is only
1.13      hubertf  4776:             appropriate for packages for the NetBSD operating
                   4777:             system. Binary packages for other operating systems
1.45      wiz      4778:             should go into <code xmlns=
                   4779:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4780:             "filename">/pub/pkgsrc</code>.</p>
1.13      hubertf  4781: 
                   4782:             <p>Before uploading the binary pkgs, ssh authentication
1.47      reed     4783:             needs to be set up. This example shows how to set up
1.13      hubertf  4784:             temporary keys for the root account <span class=
                   4785:             "emphasis"><em>inside the sandbox</em></span> (assuming
                   4786:             that no keys should be present there usually):</p>
                   4787:             <pre class="screen">
1.14      xtraeme  4788: <code class="prompt">#</code> <strong class=
                   4789: "userinput"><code>chroot /usr/sandbox</code></strong>        
                   4790: chroot-<code class="prompt">#</code> <strong class=
                   4791: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>        
                   4792: chroot-<code class="prompt">#</code> <strong class=
                   4793: "userinput"><code>ssh-keygen -t dsa</code></strong>        
                   4794: chroot-<code class="prompt">#</code> <strong class=
                   4795: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong> 
1.13      hubertf  4796: </pre>
                   4797: 
1.45      wiz      4798:             <p>Now take the output of <code xmlns=
                   4799:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4800:             "filename">id-dsa.pub</code> and append it to your
1.45      wiz      4801:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4802:             class="filename">~/.ssh/authorized_keys</code> file on
                   4803:             ftp.NetBSD.org. You can remove the key after the upload
                   4804:             is done!</p>
1.13      hubertf  4805: 
                   4806:             <p>Next, test if your ssh connection really works:</p>
                   4807:             <pre class="screen">
1.14      xtraeme  4808: chroot-<code class="prompt">#</code> <strong class=
                   4809: "userinput"><code>ssh ftp.NetBSD.org date</code></strong> 
1.13      hubertf  4810: </pre>
                   4811: 
                   4812:             <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
                   4813: 
                   4814:             <p>Now after all this works, you can exit the sandbox
                   4815:             and start the upload:</p>
                   4816:             <pre class="screen">
1.14      xtraeme  4817: chroot-<code class="prompt">#</code> <strong class=
                   4818: "userinput"><code>exit</code></strong>        
                   4819: <code class="prompt">#</code> <strong class=
                   4820: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>        
                   4821: <code class="prompt">#</code> <strong class=
                   4822: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong> 
1.13      hubertf  4823: </pre>
                   4824: 
                   4825:             <p>The upload process may take quite some time. Use
1.24      wiz      4826:             <a href=
                   4827:             "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
                   4828:             <span class="citerefentry"><span class=
                   4829:             "refentrytitle">ls</span>(1)</span></a> or <a href=
                   4830:             "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
                   4831:             <span class="citerefentry"><span class=
                   4832:             "refentrytitle">du</span>(1)</span></a> on the FTP
                   4833:             server to monitor progress of the upload. The upload
                   4834:             script will take care of not uploading restricted
                   4835:             packages and putting vulnerable packages into the
1.45      wiz      4836:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4837:             class="filename">vulnerable</code> subdirectory.</p>
1.13      hubertf  4838: 
                   4839:             <p>After the upload has ended, first thing is to revoke
                   4840:             ssh access:</p>
                   4841:             <pre class="screen">
1.14      xtraeme  4842: nbftp% <strong class=
                   4843: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13      hubertf  4844: Gdd:x! 
                   4845: </pre>
                   4846: 
                   4847:             <p>Use whatever is needed to remove the key you've
                   4848:             entered before! Last, move the uploaded packages out of
1.45      wiz      4849:             the <code xmlns=
                   4850:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4851:             "filename">upload</code> directory to have them
                   4852:             accessible to everyone:</p>
1.13      hubertf  4853:             <pre class="screen">
1.14      xtraeme  4854: nbftp% <strong class=
                   4855: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
                   4856: nbftp% <strong class=
                   4857: "userinput"><code>mv upload/* .</code></strong>
                   4858: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
                   4859: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong> 
1.13      hubertf  4860: </pre>
                   4861:           </div>
1.1       grant    4862:         </div>
                   4863: 
1.67    ! hubertf  4864:         <div class="sect1" lang="en">
1.1       grant    4865:           <div class="titlepage">
                   4866:             <div>
                   4867:               <div>
                   4868:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    4869:                 "creating-cdroms"></a>6.4.&nbsp;Creating a multiple
1.30      wiz      4870:                 CD-ROM packages collection</h2>
1.1       grant    4871:               </div>
                   4872:             </div>
                   4873:           </div>
                   4874: 
                   4875:           <p>After your pkgsrc bulk-build has completed, you may
                   4876:           wish to create a CD-ROM set of the resulting binary
                   4877:           packages to assist in installing packages on other
                   4878:           machines. The <a xmlns=
                   4879:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4880:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.45      wiz      4881:           target="_top"><code xmlns="" class=
                   4882:           "filename">pkgtools/cdpack</code></a> package provides a
1.20      ben      4883:           simple tool for creating the ISO 9660 images.
                   4884:           <span><strong class="command">cdpack</strong></span>
                   4885:           arranges the packages on the CD-ROMs in a way that keeps
1.47      reed     4886:           all the dependencies for a given package on the same CD
                   4887:           as that package.</p>
1.1       grant    4888: 
1.67    ! hubertf  4889:           <div class="sect2" lang="en">
1.1       grant    4890:             <div class="titlepage">
                   4891:               <div>
                   4892:                 <div>
1.67    ! hubertf  4893:                   <h3 class="title"><a name=
1.38      dillo    4894:                   "cdpack-example"></a>6.4.1.&nbsp;Example of
1.1       grant    4895:                   cdpack</h3>
                   4896:                 </div>
                   4897:               </div>
                   4898:             </div>
                   4899: 
                   4900:             <p>Complete documentation for cdpack is found in the
1.47      reed     4901:             cdpack(1) man page. The following short example assumes
1.45      wiz      4902:             that the binary packages are left in <code xmlns=
                   4903:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4904:             "filename">/usr/pkgsrc/packages/All</code> and that
1.45      wiz      4905:             sufficient disk space exists in <code xmlns=
                   4906:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4907:             "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1       grant    4908:             <pre class="screen">
1.14      xtraeme  4909: <code class="prompt">#</code> <strong class=
                   4910: "userinput"><code>mkdir /u2/images</code></strong>
                   4911: <code class="prompt">#</code> <strong class=
                   4912: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
                   4913: <code class="prompt">#</code> <strong class=
                   4914: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    4915: </pre>
                   4916: 
                   4917:             <p>If you wish to include a common set of files
1.45      wiz      4918:             (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4919:             class="filename">COPYRIGHT</code>, <code xmlns=
                   4920:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4921:             "filename">README</code>, etc.) on each CD in the
1.1       grant    4922:             collection, then you need to create a directory which
                   4923:             contains these files. e.g.</p>
                   4924:             <pre class="screen">
1.14      xtraeme  4925: <code class="prompt">#</code> <strong class=
                   4926: "userinput"><code>mkdir /tmp/common</code></strong>
                   4927: <code class="prompt">#</code> <strong class=
                   4928: "userinput"><code>echo "This is a README" &gt; /tmp/common/README</code></strong>
                   4929: <code class="prompt">#</code> <strong class=
                   4930: "userinput"><code>echo "Another file" &gt; /tmp/common/COPYING</code></strong>
                   4931: <code class="prompt">#</code> <strong class=
                   4932: "userinput"><code>mkdir /tmp/common/bin</code></strong>
                   4933: <code class="prompt">#</code> <strong class=
                   4934: "userinput"><code>echo "#!/bin/sh" &gt; /tmp/common/bin/myscript</code></strong>
                   4935: <code class="prompt">#</code> <strong class=
                   4936: "userinput"><code>echo "echo Hello world" &gt;&gt; /tmp/common/bin/myscript</code></strong>
                   4937: <code class="prompt">#</code> <strong class=
                   4938: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1       grant    4939: </pre>
                   4940: 
                   4941:             <p>Now create the images:</p>
                   4942:             <pre class="screen">
1.14      xtraeme  4943: <code class="prompt">#</code> <strong class=
                   4944: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    4945: </pre>
                   4946: 
1.45      wiz      4947:             <p>Each image will contain <code xmlns=
                   4948:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4949:             "filename">README</code>, <code xmlns=
                   4950:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4951:             "filename">COPYING</code>, and <code xmlns=
                   4952:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4953:             "filename">bin/myscript</code> in their root
1.1       grant    4954:             directories.</p>
                   4955:           </div>
                   4956:         </div>
                   4957:       </div>
                   4958: 
1.67    ! hubertf  4959:       <div class="chapter" lang="en">
1.1       grant    4960:         <div class="titlepage">
                   4961:           <div>
                   4962:             <div>
1.67    ! hubertf  4963:               <h2 class="title"><a name=
1.38      dillo    4964:               "faq"></a>Chapter&nbsp;7.&nbsp;Frequently Asked
1.1       grant    4965:               Questions</h2>
                   4966:             </div>
                   4967:           </div>
                   4968:         </div>
                   4969: 
                   4970:         <div class="toc">
                   4971:           <p><b>Table of Contents</b></p>
                   4972: 
                   4973:           <dl>
1.30      wiz      4974:             <dt><span class="sect1"><a href=
1.38      dillo    4975:             "#mailing-list-pointers">7.1. Are there any mailing
1.30      wiz      4976:             lists for pkg-related discussion?</a></span></dt>
1.1       grant    4977: 
1.38      dillo    4978:             <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1       grant    4979:             Where's the pkgviews documentation?</a></span></dt>
                   4980: 
1.38      dillo    4981:             <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1       grant    4982:             Utilities for package management
                   4983:             (pkgtools)</a></span></dt>
                   4984: 
1.38      dillo    4985:             <dt><span class="sect1"><a href="#non-root-pkgsrc">7.4.
1.30      wiz      4986:             How to use pkgsrc as non-root</a></span></dt>
1.1       grant    4987: 
1.30      wiz      4988:             <dt><span class="sect1"><a href=
1.38      dillo    4989:             "#resume-transfers">7.5. How to resume transfers when
1.30      wiz      4990:             fetching distfiles?</a></span></dt>
1.14      xtraeme  4991: 
1.30      wiz      4992:             <dt><span class="sect1"><a href=
1.38      dillo    4993:             "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30      wiz      4994:             XFree86 from pkgsrc?</a></span></dt>
1.1       grant    4995: 
1.30      wiz      4996:             <dt><span class="sect1"><a href=
1.38      dillo    4997:             "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30      wiz      4998:             from pkgsrc?</a></span></dt>
1.1       grant    4999: 
1.30      wiz      5000:             <dt><span class="sect1"><a href=
1.38      dillo    5001:             "#fetch-behind-firewall">7.8. How to fetch files from
1.30      wiz      5002:             behind a firewall</a></span></dt>
1.1       grant    5003: 
1.38      dillo    5004:             <dt><span class="sect1"><a href="#passive-ftp">7.9. How
1.14      xtraeme  5005:             do I tell <span><strong class="command">make
                   5006:             fetch</strong></span> to do passive
                   5007:             FTP?</a></span></dt>
1.1       grant    5008: 
1.30      wiz      5009:             <dt><span class="sect1"><a href=
1.38      dillo    5010:             "#fetching-all-distfiles">7.10. How to fetch all
1.30      wiz      5011:             distfiles at once</a></span></dt>
1.1       grant    5012: 
1.30      wiz      5013:             <dt><span class="sect1"><a href=
1.38      dillo    5014:             "#tmac.andoc-missing">7.11. What does
1.30      wiz      5015:             &#8220;<span class="quote">Don't know how to make
1.14      xtraeme  5016:             /usr/share/tmac/tmac.andoc</span>&#8221;
1.1       grant    5017:             mean?</a></span></dt>
                   5018: 
1.30      wiz      5019:             <dt><span class="sect1"><a href=
1.38      dillo    5020:             "#bsd.own.mk-missing">7.12. What does
1.30      wiz      5021:             &#8220;<span class="quote">Could not find
1.14      xtraeme  5022:             bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    5023: 
1.30      wiz      5024:             <dt><span class="sect1"><a href=
1.38      dillo    5025:             "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30      wiz      5026:             pkgsrc</a></span></dt>
1.1       grant    5027: 
1.38      dillo    5028:             <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35      jmmv     5029:             do I change the location of configuration
                   5030:             files?</a></span></dt>
1.1       grant    5031: 
1.38      dillo    5032:             <dt><span class="sect1"><a href="#audit-packages">7.15.
1.1       grant    5033:             Automated security checks</a></span></dt>
                   5034:           </dl>
                   5035:         </div>
                   5036: 
                   5037:         <p>This section contains hints, tips &amp; tricks on
                   5038:         special things in pkgsrc that we didn't find a better place
                   5039:         for in the previous chapters, and it contains items for
                   5040:         both pkgsrc users and developers.</p>
                   5041: 
1.67    ! hubertf  5042:         <div class="sect1" lang="en">
1.1       grant    5043:           <div class="titlepage">
                   5044:             <div>
                   5045:               <div>
                   5046:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5047:                 "mailing-list-pointers"></a>7.1.&nbsp;Are there any
1.30      wiz      5048:                 mailing lists for pkg-related discussion?</h2>
1.1       grant    5049:               </div>
                   5050:             </div>
                   5051:           </div>
                   5052: 
1.18      xtraeme  5053:           <p>The following mailing lists may be of interest to
                   5054:           pkgsrc users:</p>
                   5055: 
                   5056:           <div class="itemizedlist">
                   5057:             <ul type="disc">
                   5058:               <li>
                   5059:                 <p><a href=
                   5060:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.34      wiz      5061:                 target="_top">pkgsrc-bugs</a>: A list where problem
                   5062:                 reports related to pkgsrc are sent and
                   5063:                 discussed.</p>
1.18      xtraeme  5064:               </li>
                   5065: 
                   5066:               <li>
                   5067:                 <p><a href=
                   5068:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34      wiz      5069:                 target="_top">pkgsrc-bulk</a>: A list where the
1.20      ben      5070:                 results of pkgsrc bulk builds are sent and
1.34      wiz      5071:                 discussed.</p>
1.18      xtraeme  5072:               </li>
                   5073: 
                   5074:               <li>
                   5075:                 <p><a href=
                   5076:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.34      wiz      5077:                 target="_top">pkgsrc-changes</a>: A list where all
                   5078:                 commit messages to pkgsrc are sent.</p>
1.18      xtraeme  5079:               </li>
                   5080: 
                   5081:               <li>
                   5082:                 <p><a href=
                   5083:                 "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.34      wiz      5084:                 target="_top">tech-pkg</a>: A general discussion
                   5085:                 list for all things related to pkgsrc.</p>
1.18      xtraeme  5086:               </li>
                   5087:             </ul>
                   5088:           </div>
                   5089: 
                   5090:           <p>To subscribe, do:</p>
1.1       grant    5091:           <pre class="programlisting">
1.51      rillig   5092:     <code class="prompt">%</code> echo subscribe <em class=
1.18      xtraeme  5093: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1       grant    5094: </pre>
                   5095: 
1.18      xtraeme  5096:           <p>Archives for all these mailing lists are available
                   5097:           from <a href="http://mail-index.NetBSD.org/" target=
                   5098:           "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1       grant    5099:         </div>
                   5100: 
1.67    ! hubertf  5101:         <div class="sect1" lang="en">
1.1       grant    5102:           <div class="titlepage">
                   5103:             <div>
                   5104:               <div>
                   5105:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5106:                 "pkgviews-docs"></a>7.2.&nbsp;Where's the pkgviews
1.30      wiz      5107:                 documentation?</h2>
1.1       grant    5108:               </div>
                   5109:             </div>
                   5110:           </div>
                   5111: 
                   5112:           <p>Pkgviews is tightly integrated with buildlink. You can
1.45      wiz      5113:           find a pkgviews User's guide in <code xmlns=
                   5114:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5115:           "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1       grant    5116:         </div>
                   5117: 
1.67    ! hubertf  5118:         <div class="sect1" lang="en">
1.1       grant    5119:           <div class="titlepage">
                   5120:             <div>
                   5121:               <div>
                   5122:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5123:                 "faq-pkgtools"></a>7.3.&nbsp;Utilities for package
1.5       hubertf  5124:                 management (pkgtools)</h2>
1.1       grant    5125:               </div>
                   5126:             </div>
                   5127:           </div>
                   5128: 
1.45      wiz      5129:           <p>The <code xmlns=
                   5130:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5131:           "filename">pkgsrc/pkgtools</code> directory pkgtools
                   5132:           contains a number of useful utilities for both users and
                   5133:           developers of pkgsrc. This section attempts only to make
                   5134:           the reader aware of the utilities and when they might be
                   5135:           useful, and not to duplicate the documentation that comes
                   5136:           with each package.</p>
1.1       grant    5137: 
                   5138:           <p>Utilities used by pkgsrc (automatically installed when
                   5139:           needed):</p>
                   5140: 
                   5141:           <div class="itemizedlist">
                   5142:             <ul type="disc">
                   5143:               <li>
                   5144:                 <p><a xmlns=
                   5145:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5146:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.45      wiz      5147:                 target="_top"><code xmlns="" class=
                   5148:                 "filename">pkgtools/x11-links</code></a>: Symlinks
1.34      wiz      5149:                 for use by buildlink.</p>
1.1       grant    5150:               </li>
                   5151:             </ul>
                   5152:           </div>
                   5153: 
                   5154:           <p>OS tool augmentation (automatically installed when
                   5155:           needed):</p>
                   5156: 
                   5157:           <div class="itemizedlist">
                   5158:             <ul type="disc">
                   5159:               <li>
                   5160:                 <p><a xmlns=
                   5161:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5162:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.45      wiz      5163:                 target="_top"><code xmlns="" class=
                   5164:                 "filename">pkgtools/digest</code></a>: Calculates
1.34      wiz      5165:                 various kinds of checksums (including SHA1).</p>
1.1       grant    5166:               </li>
                   5167: 
                   5168:               <li>
                   5169:                 <p><a xmlns=
                   5170:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5171:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.45      wiz      5172:                 target="_top"><code xmlns="" class=
                   5173:                 "filename">pkgtools/libnbcompat</code></a>:
1.34      wiz      5174:                 Compatibility library for pkgsrc tools.</p>
1.1       grant    5175:               </li>
                   5176: 
                   5177:               <li>
                   5178:                 <p><a xmlns=
                   5179:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5180:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.45      wiz      5181:                 target="_top"><code xmlns="" class=
                   5182:                 "filename">pkgtools/mtree</code></a>: Installed on
1.34      wiz      5183:                 non-BSD systems due to lack of native mtree.</p>
1.1       grant    5184:               </li>
                   5185: 
                   5186:               <li>
                   5187:                 <p><a xmlns=
                   5188:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5189:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45      wiz      5190:                 target="_top"><code xmlns="" class=
                   5191:                 "filename">pkgtools/pkg_install</code></a>:
                   5192:                 Up-to-date replacement for <code xmlns=
                   5193:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.34      wiz      5194:                 "filename">/usr/sbin/pkg_install</code>, or for use
                   5195:                 on operating systems where pkg_install is not
                   5196:                 present.</p>
1.1       grant    5197:               </li>
                   5198:             </ul>
                   5199:           </div>
                   5200: 
                   5201:           <p>Utilities used by pkgsrc (not automatically
                   5202:           installed):</p>
                   5203: 
                   5204:           <div class="itemizedlist">
                   5205:             <ul type="disc">
                   5206:               <li>
                   5207:                 <p><a xmlns=
                   5208:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5209:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.45      wiz      5210:                 target="_top"><code xmlns="" class=
                   5211:                 "filename">pkgtools/pkg_tarup</code></a>: Create a
1.20      ben      5212:                 binary package from an already-installed package.
1.34      wiz      5213:                 Used by <span><strong class="command">make
                   5214:                 replace</strong></span> to save the old
                   5215:                 package.</p>
1.1       grant    5216:               </li>
                   5217: 
                   5218:               <li>
                   5219:                 <p><a xmlns=
                   5220:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.5       hubertf  5221:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.45      wiz      5222:                 target="_top"><code xmlns="" class=
                   5223:                 "filename">pkgtools/dfdisk</code></a>: Adds extra
1.20      ben      5224:                 functionality to pkgsrc, allowing it to fetch
                   5225:                 distfiles from multiple locations. It currently
                   5226:                 supports the following methods: multiple CD-ROMs
                   5227:                 and network FTP/HTTP connections.</p>
1.5       hubertf  5228:               </li>
                   5229: 
                   5230:               <li>
                   5231:                 <p><a xmlns=
                   5232:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    5233:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45      wiz      5234:                 target="_top"><code xmlns="" class=
                   5235:                 "filename">pkgtools/xpkgwedge</code></a>: Put X11
1.34      wiz      5236:                 packages someplace else (enabled by default).</p>
1.1       grant    5237:               </li>
1.5       hubertf  5238: 
                   5239:               <li>
                   5240:                 <p><a xmlns=
                   5241:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5242:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45      wiz      5243:                 target="_top"><code xmlns="" class=
                   5244:                 "filename">devel/cpuflags</code></a>: Determine the
1.34      wiz      5245:                 best compiler flags to optimise code for your
1.20      ben      5246:                 current CPU and compiler.</p>
1.5       hubertf  5247:               </li>
1.1       grant    5248:             </ul>
                   5249:           </div>
                   5250: 
                   5251:           <p>Utilities for keeping track of installed packages,
                   5252:           being up to date, etc:</p>
                   5253: 
                   5254:           <div class="itemizedlist">
                   5255:             <ul type="disc">
                   5256:               <li>
                   5257:                 <p><a xmlns=
                   5258:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5259:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.45      wiz      5260:                 target="_top"><code xmlns="" class=
                   5261:                 "filename">pkgtools/pkg_chk</code></a>: Reports on
1.27      rillig   5262:                 packages whose installed versions do not match the
1.34      wiz      5263:                 latest pkgsrc entries.</p>
1.1       grant    5264:               </li>
                   5265: 
                   5266:               <li>
                   5267:                 <p><a xmlns=
                   5268:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5269:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45      wiz      5270:                 target="_top"><code xmlns="" class=
                   5271:                 "filename">pkgtools/pkgdep</code></a>: Makes
1.20      ben      5272:                 dependency graphs of packages, to aid in choosing a
1.34      wiz      5273:                 strategy for updating.</p>
1.1       grant    5274:               </li>
                   5275: 
                   5276:               <li>
                   5277:                 <p><a xmlns=
                   5278:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5279:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.45      wiz      5280:                 target="_top"><code xmlns="" class=
                   5281:                 "filename">pkgtools/pkgdepgraph</code></a>: Makes
1.27      rillig   5282:                 graphs from the output of <a xmlns=
                   5283:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5284:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45      wiz      5285:                 target="_top"><code xmlns="" class=
                   5286:                 "filename">pkgtools/pkgdep</code></a> (uses
1.34      wiz      5287:                 graphviz).</p>
1.1       grant    5288:               </li>
                   5289: 
                   5290:               <li>
                   5291:                 <p><a xmlns=
                   5292:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5293:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45      wiz      5294:                 target="_top"><code xmlns="" class=
                   5295:                 "filename">pkgtools/pkglint</code></a>: The
1.27      rillig   5296:                 pkglint(1) program checks a pkgsrc entry for
                   5297:                 errors, lintpkgsrc(1) does various checks on the
                   5298:                 complete pkgsrc system.</p>
1.1       grant    5299:               </li>
                   5300: 
                   5301:               <li>
                   5302:                 <p><a xmlns=
                   5303:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5304:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.45      wiz      5305:                 target="_top"><code xmlns="" class=
                   5306:                 "filename">pkgtools/pkgsurvey</code></a>: Report
                   5307:                 what packages you have installed.</p>
1.1       grant    5308:               </li>
                   5309:             </ul>
                   5310:           </div>
                   5311: 
                   5312:           <p>Utilities for people maintaining or creating
                   5313:           individual packages:</p>
                   5314: 
                   5315:           <div class="itemizedlist">
                   5316:             <ul type="disc">
                   5317:               <li>
                   5318:                 <p><a xmlns=
                   5319:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5320:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45      wiz      5321:                 target="_top"><code xmlns="" class=
                   5322:                 "filename">pkgtools/pkgdiff</code></a>: Automate
1.20      ben      5323:                 making and maintaining patches for a package
1.34      wiz      5324:                 (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1       grant    5325:               </li>
                   5326: 
                   5327:               <li>
                   5328:                 <p><a xmlns=
                   5329:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5330:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.45      wiz      5331:                 target="_top"><code xmlns="" class=
                   5332:                 "filename">pkgtools/rpm2pkg</code></a>, <a xmlns=
1.20      ben      5333:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5334:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45      wiz      5335:                 target="_top"><code xmlns="" class=
                   5336:                 "filename">pkgtools/url2pkg</code></a>: Aids in
1.34      wiz      5337:                 converting to pkgsrc.</p>
1.1       grant    5338:               </li>
                   5339: 
                   5340:               <li>
                   5341:                 <p><a xmlns=
                   5342:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5343:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.45      wiz      5344:                 target="_top"><code xmlns="" class=
                   5345:                 "filename">pkgtools/gensolpkg</code></a>: Convert
1.34      wiz      5346:                 pkgsrc to a Solaris package.</p>
1.1       grant    5347:               </li>
                   5348:             </ul>
                   5349:           </div>
                   5350: 
1.47      reed     5351:           <p>Utilities for people maintaining pkgsrc (or: more
1.1       grant    5352:           obscure pkg utilities)</p>
                   5353: 
                   5354:           <div class="itemizedlist">
                   5355:             <ul type="disc">
                   5356:               <li>
                   5357:                 <p><a xmlns=
                   5358:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5359:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.45      wiz      5360:                 target="_top"><code xmlns="" class=
                   5361:                 "filename">pkgtools/pkg_comp</code></a>: Build
1.34      wiz      5362:                 packages in a chrooted area.</p>
1.1       grant    5363:               </li>
                   5364: 
                   5365:               <li>
                   5366:                 <p><a xmlns=
                   5367:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5368:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.45      wiz      5369:                 target="_top"><code xmlns="" class=
                   5370:                 "filename">pkgtools/libkver</code></a>: Spoof
                   5371:                 kernel version for chrooted cross builds.</p>
1.1       grant    5372:               </li>
                   5373:             </ul>
                   5374:           </div>
                   5375:         </div>
                   5376: 
1.67    ! hubertf  5377:         <div class="sect1" lang="en">
1.1       grant    5378:           <div class="titlepage">
                   5379:             <div>
                   5380:               <div>
                   5381:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5382:                 "non-root-pkgsrc"></a>7.4.&nbsp;How to use pkgsrc
1.30      wiz      5383:                 as non-root</h2>
1.1       grant    5384:               </div>
                   5385:             </div>
                   5386:           </div>
                   5387: 
                   5388:           <p>If you want to use pkgsrc as non-root user, you can
                   5389:           set some variables to make pkgsrc work under these
1.33      jmmv     5390:           conditions. At the very least, you need to set
                   5391:           <code class="varname">UNPRIVILEGED</code> to
                   5392:           &#8220;<span class="quote">yes</span>&#8221;; this will
                   5393:           turn on unprivileged mode and set multiple related
                   5394:           variables to allow installation of packages as
                   5395:           non-root.</p>
                   5396: 
                   5397:           <p>In case the defaults are not enough, you may want to
                   5398:           tune some other variables used. For example, if the
                   5399:           automatic user/group detection leads to incorrect values
                   5400:           (or not the ones you would like to use), you can change
                   5401:           them by setting <code class=
                   5402:           "varname">UNPRIVILEGED_USER</code> and <code class=
                   5403:           "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
                   5404: 
                   5405:           <p>As regards bootstrapping, please note that the
                   5406:           <span><strong class="command">bootstrap</strong></span>
                   5407:           script will ease non-root configuration when given the
                   5408:           &#8220;<span class=
                   5409:           "quote">--ignore-user-check</span>&#8221; flag, as it
                   5410:           will choose and use multiple default directories under
1.45      wiz      5411:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5412:           class="filename">~/pkg</code> as the installation
1.33      jmmv     5413:           targets. These directories can be overriden by the
                   5414:           &#8220;<span class="quote">--prefix</span>&#8221; flag
                   5415:           provided by the script, as well as some others that allow
                   5416:           finer tuning of the tree layout.</p>
1.14      xtraeme  5417:         </div>
                   5418: 
1.67    ! hubertf  5419:         <div class="sect1" lang="en">
1.14      xtraeme  5420:           <div class="titlepage">
                   5421:             <div>
                   5422:               <div>
                   5423:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5424:                 "resume-transfers"></a>7.5.&nbsp;How to resume
1.30      wiz      5425:                 transfers when fetching distfiles?</h2>
1.14      xtraeme  5426:               </div>
                   5427:             </div>
                   5428:           </div>
                   5429: 
1.47      reed     5430:           <p>By default, resuming transfers in pkgsrc is disabled,
1.15      xtraeme  5431:           but you can enable this feature by adding the option
                   5432:           <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
1.45      wiz      5433:           into <code xmlns=
                   5434:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5435:           "filename">/etc/mk.conf</code>. If, during a fetch step,
                   5436:           an incomplete distfile is found, pkgsrc will try to
                   5437:           resume it.</p>
1.15      xtraeme  5438: 
                   5439:           <p>You can also use a different program than the default
1.24      wiz      5440:           <a href=
                   5441:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   5442:           <span class="citerefentry"><span class=
                   5443:           "refentrytitle">ftp</span>(1)</span></a> by changing the
                   5444:           <code class="varname">FETCH_CMD</code> variable. Don't
                   5445:           forget to set <code class=
                   5446:           "varname">FETCH_RESUME_ARGS</code> and <code class=
                   5447:           "varname">FETCH_OUTPUT_ARGS</code> if you are not using
                   5448:           default values.</p>
1.14      xtraeme  5449: 
1.45      wiz      5450:           <p>For example, if you want to use <code xmlns=
                   5451:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5452:           "filename">wget</code> to resume downloads, you'll have
                   5453:           to use something like:</p>
                   5454:           <pre class="programlisting">
1.51      rillig   5455:     FETCH_CMD=             wget
                   5456:     FETCH_BEFORE_ARGS=     --passive-ftp
                   5457:     FETCH_RESUME_ARGS=     -c
                   5458:     FETCH_OUTPUT_ARGS=     -O
1.14      xtraeme  5459: </pre>
1.1       grant    5460:         </div>
                   5461: 
1.67    ! hubertf  5462:         <div class="sect1" lang="en">
1.1       grant    5463:           <div class="titlepage">
                   5464:             <div>
                   5465:               <div>
                   5466:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5467:                 "XFree86-from-pkgsrc"></a>7.6.&nbsp;How can I
1.1       grant    5468:                 install/use XFree86 from pkgsrc?</h2>
                   5469:               </div>
                   5470:             </div>
                   5471:           </div>
                   5472: 
                   5473:           <p>If you want to use XFree86 from pkgsrc instead of your
1.45      wiz      5474:           system's own X11 (<code xmlns=
                   5475:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5476:           "filename">/usr/X11R6</code>, <code xmlns=
                   5477:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5478:           "filename">/usr/openwin</code>, ...), you will have to
1.45      wiz      5479:           add the following line into <code xmlns=
                   5480:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.15      xtraeme  5481:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    5482:           <pre class="programlisting">
1.51      rillig   5483:     X11_TYPE=XFree86
1.1       grant    5484: </pre>
                   5485:         </div>
                   5486: 
1.67    ! hubertf  5487:         <div class="sect1" lang="en">
1.1       grant    5488:           <div class="titlepage">
                   5489:             <div>
                   5490:               <div>
                   5491:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5492:                 "x.org-from-pkgsrc"></a>7.7.&nbsp;How can I
1.1       grant    5493:                 install/use X.org from pkgsrc?</h2>
                   5494:               </div>
                   5495:             </div>
                   5496:           </div>
                   5497: 
                   5498:           <p>If you want to use X.org from pkgsrc instead of your
1.45      wiz      5499:           system's own X11 (<code xmlns=
                   5500:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5501:           "filename">/usr/X11R6</code>, <code xmlns=
                   5502:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5503:           "filename">/usr/openwin</code>, ...) you will have to add
1.45      wiz      5504:           the following line into <code xmlns=
                   5505:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.15      xtraeme  5506:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    5507:           <pre class="programlisting">
1.51      rillig   5508:     X11_TYPE=xorg
1.1       grant    5509: </pre>
                   5510:         </div>
                   5511: 
1.67    ! hubertf  5512:         <div class="sect1" lang="en">
1.1       grant    5513:           <div class="titlepage">
                   5514:             <div>
                   5515:               <div>
                   5516:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5517:                 "fetch-behind-firewall"></a>7.8.&nbsp;How to fetch
1.30      wiz      5518:                 files from behind a firewall</h2>
1.1       grant    5519:               </div>
                   5520:             </div>
                   5521:           </div>
                   5522: 
                   5523:           <p>If you are sitting behind a firewall which does not
                   5524:           allow direct connections to Internet hosts (i.e.
                   5525:           non-NAT), you may specify the relevant proxy hosts. This
                   5526:           is done using an environment variable in the form of a
1.47      reed     5527:           URL, e.g. in Amdahl, the machine &#8220;<span class=
1.1       grant    5528:           "quote">orpheus.amdahl.com</span>&#8221; is one of the
                   5529:           firewalls, and it uses port 80 as the proxy port number.
                   5530:           So the proxy environment variables are:</p>
                   5531:           <pre class="programlisting">
1.51      rillig   5532:     ftp_proxy=ftp://orpheus.amdahl.com:80/
                   5533:     http_proxy=http://orpheus.amdahl.com:80/
1.1       grant    5534: </pre>
                   5535:         </div>
                   5536: 
1.67    ! hubertf  5537:         <div class="sect1" lang="en">
1.1       grant    5538:           <div class="titlepage">
                   5539:             <div>
                   5540:               <div>
                   5541:                 <h2 class="title" style="clear: both"><a name=
1.67    ! hubertf  5542:                 "passive-ftp"></a>7.9.&nbsp;How do I tell
        !          5543:                 <span><strong class="command">make
1.14      xtraeme  5544:                 fetch</strong></span> to do passive FTP?</h2>
1.1       grant    5545:               </div>
                   5546:             </div>
                   5547:           </div>
                   5548: 
                   5549:           <p>This depends on which utility is used to retrieve
1.45      wiz      5550:           distfiles. From <code xmlns=
                   5551:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5552:           "filename">bsd.pkg.mk</code>, <code class=
                   5553:           "varname">FETCH_CMD</code> is assigned the first
                   5554:           available command from the following list:</p>
1.34      wiz      5555: 
                   5556:           <div class="itemizedlist">
                   5557:             <ul type="disc">
                   5558:               <li>
1.45      wiz      5559:                 <p><code xmlns=
                   5560:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.34      wiz      5561:                 "filename">${LOCALBASE}/bin/ftp</code></p>
                   5562:               </li>
                   5563: 
                   5564:               <li>
1.45      wiz      5565:                 <p><code xmlns=
                   5566:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   5567:                 "filename">/usr/bin/ftp</code></p>
1.34      wiz      5568:               </li>
                   5569:             </ul>
                   5570:           </div>
1.1       grant    5571: 
                   5572:           <p>On a default NetBSD installation, this will be
1.45      wiz      5573:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5574:           class="filename">/usr/bin/ftp</code>, which automatically
                   5575:           tries passive connections first, and falls back to active
                   5576:           connections if the server refuses to do passive. For the
                   5577:           other tools, add the following to your <code xmlns=
                   5578:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5579:           "filename">/etc/mk.conf</code> file: <code class=
                   5580:           "varname">PASSIVE_FETCH=1</code>.</p>
1.1       grant    5581: 
1.45      wiz      5582:           <p>Having that option present will prevent <code xmlns=
                   5583:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5584:           "filename">/usr/bin/ftp</code> from falling back to
                   5585:           active transfers.</p>
1.1       grant    5586:         </div>
                   5587: 
1.67    ! hubertf  5588:         <div class="sect1" lang="en">
1.1       grant    5589:           <div class="titlepage">
                   5590:             <div>
                   5591:               <div>
                   5592:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5593:                 "fetching-all-distfiles"></a>7.10.&nbsp;How to
1.1       grant    5594:                 fetch all distfiles at once</h2>
                   5595:               </div>
                   5596:             </div>
                   5597:           </div>
                   5598: 
                   5599:           <p>You would like to download all the distfiles in a
                   5600:           single batch from work or university, where you can't run
1.14      xtraeme  5601:           a <span><strong class="command">make
                   5602:           fetch</strong></span>. There is an archive of distfiles
                   5603:           on <a href=
1.1       grant    5604:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
                   5605:           target="_top">ftp.NetBSD.org</a>, but downloading the
                   5606:           entire directory may not be appropriate.</p>
                   5607: 
1.14      xtraeme  5608:           <p>The answer here is to do a <span><strong class=
1.45      wiz      5609:           "command">make fetch-list</strong></span> in <code xmlns=
                   5610:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     5611:           "filename">/usr/pkgsrc</code> or one of its
1.1       grant    5612:           subdirectories, carry the resulting list to your machine
1.23      wiz      5613:           at work/school and use it there. If you don't have a
1.24      wiz      5614:           NetBSD-compatible <a href=
                   5615:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   5616:           <span class="citerefentry"><span class=
                   5617:           "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
                   5618:           at work, don't forget to set <code class=
                   5619:           "varname">FETCH_CMD</code> to something that fetches a
                   5620:           URL:</p>
1.1       grant    5621: 
                   5622:           <p>At home:</p>
                   5623:           <pre class="screen">
1.14      xtraeme  5624: <code class="prompt">%</code> <strong class=
                   5625: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   5626: <code class="prompt">%</code> <strong class=
                   5627: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles &gt;/tmp/fetch.sh</code></strong>
                   5628: <code class="prompt">%</code> <strong class=
                   5629: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1       grant    5630: </pre>
                   5631: 
                   5632:           <p>At work:</p>
                   5633:           <pre class="screen">
1.14      xtraeme  5634: <code class="prompt">%</code> <strong class=
                   5635: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1       grant    5636: </pre>
                   5637: 
1.45      wiz      5638:           <p>then tar up <code xmlns=
                   5639:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5640:           "filename">/tmp/distfiles</code> and take it home.</p>
1.1       grant    5641: 
                   5642:           <p>If you have a machine running NetBSD, and you want to
                   5643:           get <span class="emphasis"><em>all</em></span> distfiles
                   5644:           (even ones that aren't for your machine architecture),
                   5645:           you can do so by using the above-mentioned
1.14      xtraeme  5646:           <span><strong class="command">make
                   5647:           fetch-list</strong></span> approach, or fetch the
                   5648:           distfiles directly by running:</p>
1.1       grant    5649:           <pre class="screen">
1.14      xtraeme  5650: <code class="prompt">%</code> <strong class=
                   5651: "userinput"><code>make mirror-distfiles</code></strong>
1.1       grant    5652: </pre>
                   5653: 
1.14      xtraeme  5654:           <p>If you even decide to ignore <code class=
                   5655:           "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
                   5656:           can get everything by running:</p>
1.1       grant    5657:           <pre class="screen">
1.14      xtraeme  5658: <code class="prompt">%</code> <strong class=
                   5659: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1       grant    5660: </pre>
                   5661:         </div>
                   5662: 
1.67    ! hubertf  5663:         <div class="sect1" lang="en">
1.1       grant    5664:           <div class="titlepage">
                   5665:             <div>
                   5666:               <div>
                   5667:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5668:                 "tmac.andoc-missing"></a>7.11.&nbsp;What does
1.1       grant    5669:                 &#8220;<span class="quote">Don't know how to make
                   5670:                 /usr/share/tmac/tmac.andoc</span>&#8221; mean?</h2>
                   5671:               </div>
                   5672:             </div>
                   5673:           </div>
                   5674: 
                   5675:           <p>When compiling the <a xmlns=
                   5676:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5677:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45      wiz      5678:           target="_top"><code xmlns="" class=
                   5679:           "filename">pkgtools/pkg_install</code></a> package, you
                   5680:           get the error from make that it doesn't know how to make
                   5681:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5682:           class="filename">/usr/share/tmac/tmac.andoc</code>? This
                   5683:           indicates that you don't have installed the
1.23      wiz      5684:           &#8220;<span class="quote">text</span>&#8221; set (nroff,
                   5685:           ...) from the NetBSD base distribution on your machine.
1.47      reed     5686:           It is recommended to do that to format man pages.</p>
1.1       grant    5687: 
                   5688:           <p>In the case of the <a xmlns=
                   5689:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5690:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45      wiz      5691:           target="_top"><code xmlns="" class=
                   5692:           "filename">pkgtools/pkg_install</code></a> package, you
                   5693:           can get away with setting <code class=
1.20      ben      5694:           "varname">NOMAN=YES</code> either in the environment or
1.45      wiz      5695:           in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5696:           class="filename">/etc/mk.conf</code>.</p>
1.1       grant    5697:         </div>
                   5698: 
1.67    ! hubertf  5699:         <div class="sect1" lang="en">
1.1       grant    5700:           <div class="titlepage">
                   5701:             <div>
                   5702:               <div>
                   5703:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5704:                 "bsd.own.mk-missing"></a>7.12.&nbsp;What does
1.1       grant    5705:                 &#8220;<span class="quote">Could not find
                   5706:                 bsd.own.mk</span>&#8221; mean?</h2>
                   5707:               </div>
                   5708:             </div>
                   5709:           </div>
                   5710: 
1.45      wiz      5711:           <p>You didn't install the compiler set, <code xmlns=
                   5712:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5713:           "filename">comp.tgz</code>, when you installed your
1.47      reed     5714:           NetBSD machine. Please get and install it, by extracting
                   5715:           it in <code xmlns=
1.45      wiz      5716:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5717:           "filename">/</code>:</p>
1.1       grant    5718:           <pre class="screen">
1.14      xtraeme  5719: <code class="prompt">#</code> <strong class=
                   5720: "userinput"><code>cd /</code></strong>
                   5721: <code class="prompt">#</code> <strong class=
                   5722: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1       grant    5723: </pre>
                   5724: 
1.45      wiz      5725:           <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5726:           class="filename">comp.tgz</code> is part of every NetBSD
                   5727:           release. Get the one that corresponds to your release
                   5728:           (determine via <span><strong class="command">uname
                   5729:           -r</strong></span>).</p>
1.1       grant    5730:         </div>
                   5731: 
1.67    ! hubertf  5732:         <div class="sect1" lang="en">
1.1       grant    5733:           <div class="titlepage">
                   5734:             <div>
                   5735:               <div>
                   5736:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5737:                 "using-sudo-with-pkgsrc"></a>7.13.&nbsp;Using
1.1       grant    5738:                 'sudo' with pkgsrc</h2>
                   5739:               </div>
                   5740:             </div>
                   5741:           </div>
                   5742: 
                   5743:           <p>When installing packages as non-root user and using
1.24      wiz      5744:           the just-in-time <a href=
                   5745:           "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
                   5746:           <span class="citerefentry"><span class=
                   5747:           "refentrytitle">su</span>(1)</span></a> feature of
                   5748:           pkgsrc, it can become annoying to type in the root
                   5749:           password for each required package installed. To avoid
                   5750:           this, the sudo package can be used, which does password
                   5751:           caching over a limited time. To use it, install sudo
                   5752:           (either as binary package or from <a xmlns=
                   5753:           "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    5754:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.45      wiz      5755:           target="_top"><code xmlns="" class=
                   5756:           "filename">security/sudo</code></a>) and then put the
                   5757:           following into your <code xmlns=
                   5758:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      5759:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    5760:           <pre class="programlisting">
1.51      rillig   5761:     .if exists(${LOCALBASE}/bin/sudo)
                   5762:     SU_CMD=        ${LOCALBASE}/bin/sudo /bin/sh -c
                   5763:     .endif
1.1       grant    5764: </pre>
                   5765:         </div>
                   5766: 
1.67    ! hubertf  5767:         <div class="sect1" lang="en">
1.1       grant    5768:           <div class="titlepage">
                   5769:             <div>
                   5770:               <div>
                   5771:                 <h2 class="title" style="clear: both"><a name=
1.67    ! hubertf  5772:                 "faq.conf"></a>7.14.&nbsp;How do I change the
        !          5773:                 location of configuration files?</h2>
1.1       grant    5774:               </div>
                   5775:             </div>
                   5776:           </div>
                   5777: 
1.35      jmmv     5778:           <p>As the system administrator, you can choose where
                   5779:           configuration files are installed. The default settings
1.45      wiz      5780:           make all these files go into <code xmlns=
                   5781:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     5782:           "filename">${PREFIX}/etc</code> or some of its
                   5783:           subdirectories; this may be suboptimal depending on your
                   5784:           expectations (e.g., a read-only, NFS-exported
                   5785:           <code class="varname">PREFIX</code> with a need of
                   5786:           per-machine configuration of the provided packages).</p>
                   5787: 
                   5788:           <p>In order to change the defaults, you can modify the
                   5789:           <code class="varname">PKG_SYSCONFBASE</code> variable (in
1.45      wiz      5790:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5791:           class="filename">/etc/mk.conf</code>) to point to your
                   5792:           preferred configuration directory; some common examples
                   5793:           include <code xmlns=
                   5794:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5795:           "filename">/etc</code> or <code xmlns=
                   5796:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5797:           "filename">/etc/pkg</code>.</p>
1.35      jmmv     5798: 
                   5799:           <p>Furthermore, you can change this value on a
                   5800:           per-package basis by setting the <code class=
                   5801:           "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   5802:           variable. <code class="varname">PKG_SYSCONFVAR</code>'s
                   5803:           value usually matches the name of the package you would
                   5804:           like to modify, that is, the contents of <code class=
                   5805:           "varname">PKGBASE</code>.</p>
1.1       grant    5806: 
1.47      reed     5807:           <p>Note that after changing these settings, you must
1.35      jmmv     5808:           rebuild and reinstall any affected packages.</p>
1.1       grant    5809:         </div>
                   5810: 
1.67    ! hubertf  5811:         <div class="sect1" lang="en">
1.1       grant    5812:           <div class="titlepage">
                   5813:             <div>
                   5814:               <div>
                   5815:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5816:                 "audit-packages"></a>7.15.&nbsp;Automated security
1.1       grant    5817:                 checks</h2>
                   5818:               </div>
                   5819:             </div>
                   5820:           </div>
                   5821: 
                   5822:           <p>Please be aware that there can often be bugs in
                   5823:           third-party software, and some of these bugs can leave a
                   5824:           machine vulnerable to exploitation by attackers. In an
                   5825:           effort to lessen the exposure, the NetBSD packages team
                   5826:           maintains a database of known-exploits to packages which
                   5827:           have at one time been included in pkgsrc. The database
                   5828:           can be downloaded automatically, and a security audit of
                   5829:           all packages installed on a system can take place. To do
                   5830:           this, install the <a xmlns=
                   5831:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5832:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45      wiz      5833:           target="_top"><code xmlns="" class=
                   5834:           "filename">security/audit-packages</code></a> package. It
1.20      ben      5835:           has two components:</p>
1.1       grant    5836: 
                   5837:           <div class="orderedlist">
                   5838:             <ol type="1">
                   5839:               <li>
1.34      wiz      5840:                 <p><span><strong class=
                   5841:                 "command">download-vulnerability-list</strong></span>,
1.1       grant    5842:                 an easy way to download a list of the security
                   5843:                 vulnerabilities information. This list is kept up
                   5844:                 to date by the NetBSD security officer and the
                   5845:                 NetBSD packages team, and is distributed from the
                   5846:                 NetBSD ftp server:</p>
                   5847: 
                   5848:                 <p><a href=
                   5849:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20      ben      5850:                 target=
                   5851:                 "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1       grant    5852:               </li>
                   5853: 
                   5854:               <li>
1.34      wiz      5855:                 <p><span><strong class=
                   5856:                 "command">audit-packages</strong></span>, an easy
                   5857:                 way to audit the current machine, checking each
1.1       grant    5858:                 vulnerability which is known. If a vulnerable
                   5859:                 package is installed, it will be shown by output to
                   5860:                 stdout, including a description of the type of
                   5861:                 vulnerability, and a URL containing more
                   5862:                 information.</p>
                   5863:               </li>
                   5864:             </ol>
                   5865:           </div>
                   5866: 
1.23      wiz      5867:           <p>Use of the <a xmlns=
                   5868:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5869:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45      wiz      5870:           target="_top"><code xmlns="" class=
                   5871:           "filename">security/audit-packages</code></a> package is
1.23      wiz      5872:           strongly recommended! After &#8220;<span class=
                   5873:           "quote">audit-packages</span>&#8221; is installed, please
                   5874:           read the package's message, which you can get by running
                   5875:           <strong class="userinput"><code>pkg_info -D
1.65      hubertf  5876:           audit-packages</code></strong>.</p>
1.58      erh      5877: 
                   5878:           <p>If this package is installed, pkgsrc builds will use
                   5879:           it to perform a security check before building any
                   5880:           package. See <a href="#variables-affecting-build" title=
                   5881:           "5.2.&nbsp;Variables affecting the build process">Section&nbsp;5.2,
                   5882:           &#8220;Variables affecting the build process&#8221;</a>
1.59      rillig   5883:           for ways to control this check.</p>
1.1       grant    5884:         </div>
                   5885:       </div>
                   5886:     </div>
                   5887: 
1.67    ! hubertf  5888:     <div class="part" lang="en">
1.1       grant    5889:       <div class="titlepage">
                   5890:         <div>
                   5891:           <div>
1.67    ! hubertf  5892:             <h1 class="title"><a name=
1.48      dillo    5893:             "developers-guide"></a>Part&nbsp;II.&nbsp;The pkgsrc
                   5894:             developer's guide</h1>
1.1       grant    5895:           </div>
                   5896:         </div>
                   5897:       </div>
                   5898: 
                   5899:       <div class="toc">
                   5900:         <p><b>Table of Contents</b></p>
                   5901: 
                   5902:         <dl>
1.38      dillo    5903:           <dt><span class="chapter"><a href="#components">8.
1.27      rillig   5904:           Package components - files, directories and
                   5905:           contents</a></span></dt>
                   5906: 
                   5907:           <dd>
                   5908:             <dl>
                   5909:               <dt><span class="sect1"><a href=
1.45      wiz      5910:               "#components.Makefile">8.1. <code xmlns=
                   5911:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   5912:               "filename">Makefile</code></a></span></dt>
                   5913: 
                   5914:               <dt><span class="sect1"><a href=
1.45      wiz      5915:               "#components.distinfo">8.2. <code xmlns=
                   5916:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   5917:               "filename">distinfo</code></a></span></dt>
                   5918: 
                   5919:               <dt><span class="sect1"><a href=
1.38      dillo    5920:               "#components.patches">8.3. patches/*</a></span></dt>
1.27      rillig   5921: 
1.30      wiz      5922:               <dt><span class="sect1"><a href=
1.38      dillo    5923:               "#other-mandatory-files">8.4. Other mandatory
1.30      wiz      5924:               files</a></span></dt>
1.27      rillig   5925: 
                   5926:               <dt><span class="sect1"><a href=
1.38      dillo    5927:               "#components.optional">8.5. Optional
1.27      rillig   5928:               files</a></span></dt>
                   5929: 
1.38      dillo    5930:               <dt><span class="sect1"><a href="#work-dir">8.6.
1.45      wiz      5931:               <code xmlns=
                   5932:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   5933:               "filename">work*</code></a></span></dt>
1.27      rillig   5934: 
1.38      dillo    5935:               <dt><span class="sect1"><a href="#files-dir">8.7.
1.45      wiz      5936:               <code xmlns=
                   5937:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   5938:               "filename">files/*</code></a></span></dt>
1.27      rillig   5939:             </dl>
                   5940:           </dd>
                   5941: 
1.38      dillo    5942:           <dt><span class="chapter"><a href="#makefile">9.
1.45      wiz      5943:           Programming in <code xmlns=
                   5944:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.25      rillig   5945:           "filename">Makefile</code>s</a></span></dt>
                   5946: 
                   5947:           <dd>
                   5948:             <dl>
                   5949:               <dt><span class="sect1"><a href=
1.45      wiz      5950:               "#makefile.variables">9.1. <code xmlns=
                   5951:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.25      rillig   5952:               "filename">Makefile</code> variables</a></span></dt>
                   5953: 
1.27      rillig   5954:               <dd>
                   5955:                 <dl>
                   5956:                   <dt><span class="sect2"><a href=
1.38      dillo    5957:                   "#makefile.variables.names">9.1.1. Naming
1.27      rillig   5958:                   conventions</a></span></dt>
                   5959:                 </dl>
                   5960:               </dd>
                   5961: 
1.38      dillo    5962:               <dt><span class="sect1"><a href="#makefile.code">9.2.
1.25      rillig   5963:               Code snippets</a></span></dt>
                   5964: 
                   5965:               <dd>
                   5966:                 <dl>
                   5967:                   <dt><span class="sect2"><a href=
1.38      dillo    5968:                   "#adding-to-list">9.2.1. Adding things to a
1.25      rillig   5969:                   list</a></span></dt>
                   5970: 
                   5971:                   <dt><span class="sect2"><a href=
1.38      dillo    5972:                   "#converting-internal-to-external">9.2.2.
1.30      wiz      5973:                   Converting an internal list into an external
                   5974:                   list</a></span></dt>
1.25      rillig   5975: 
                   5976:                   <dt><span class="sect2"><a href=
1.38      dillo    5977:                   "#passing-variable-to-shell">9.2.3. Passing
1.30      wiz      5978:                   variables to a shell command</a></span></dt>
1.27      rillig   5979: 
                   5980:                   <dt><span class="sect2"><a href=
1.38      dillo    5981:                   "#quoting-guideline">9.2.4. Quoting
1.27      rillig   5982:                   guideline</a></span></dt>
                   5983: 
                   5984:                   <dt><span class="sect2"><a href=
1.38      dillo    5985:                   "#bsd-make-bug-workaround">9.2.5. Workaround for
1.30      wiz      5986:                   a bug in BSD Make</a></span></dt>
1.25      rillig   5987:                 </dl>
                   5988:               </dd>
                   5989:             </dl>
                   5990:           </dd>
                   5991: 
1.38      dillo    5992:           <dt><span class="chapter"><a href="#plist">10. PLIST
1.1       grant    5993:           issues</a></span></dt>
                   5994: 
                   5995:           <dd>
                   5996:             <dl>
1.38      dillo    5997:               <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1       grant    5998:               ID</a></span></dt>
                   5999: 
1.30      wiz      6000:               <dt><span class="sect1"><a href=
1.38      dillo    6001:               "#automatic-plist-generation">10.2. Semi-automatic
1.45      wiz      6002:               <code xmlns=
                   6003:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   6004:               "filename">PLIST</code> generation</a></span></dt>
1.1       grant    6005: 
1.38      dillo    6006:               <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14      xtraeme  6007:               Tweaking output of <span><strong class="command">make
                   6008:               print-PLIST</strong></span></a></span></dt>
1.1       grant    6009: 
1.38      dillo    6010:               <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1       grant    6011:               Variable substitution in PLIST</a></span></dt>
                   6012: 
1.30      wiz      6013:               <dt><span class="sect1"><a href=
1.48      dillo    6014:               "#manpage-compression">10.5. Man page
                   6015:               compression</a></span></dt>
1.1       grant    6016: 
1.30      wiz      6017:               <dt><span class="sect1"><a href=
1.38      dillo    6018:               "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30      wiz      6019:               <code class=
1.14      xtraeme  6020:               "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    6021: 
1.30      wiz      6022:               <dt><span class="sect1"><a href=
1.47      reed     6023:               "#platform-specific-plist">10.7. Platform-specific
1.38      dillo    6024:               and differing PLISTs</a></span></dt>
1.1       grant    6025: 
                   6026:               <dt><span class="sect1"><a href=
1.38      dillo    6027:               "#faq.common-dirs">10.8. Sharing directories between
1.1       grant    6028:               packages</a></span></dt>
                   6029:             </dl>
                   6030:           </dd>
                   6031: 
1.38      dillo    6032:           <dt><span class="chapter"><a href="#buildlink">11.
1.1       grant    6033:           Buildlink methodology</a></span></dt>
                   6034: 
                   6035:           <dd>
                   6036:             <dl>
1.30      wiz      6037:               <dt><span class="sect1"><a href=
1.38      dillo    6038:               "#converting-to-buildlink3">11.1. Converting packages
1.30      wiz      6039:               to use buildlink3</a></span></dt>
1.1       grant    6040: 
1.30      wiz      6041:               <dt><span class="sect1"><a href=
1.45      wiz      6042:               "#creating-buildlink3.mk">11.2. Writing <code xmlns=
                   6043:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      6044:               "filename">buildlink3.mk</code> files</a></span></dt>
1.1       grant    6045: 
                   6046:               <dd>
                   6047:                 <dl>
                   6048:                   <dt><span class="sect2"><a href=
1.38      dillo    6049:                   "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30      wiz      6050:                   buildlink3.mk file</a></span></dt>
1.1       grant    6051: 
                   6052:                   <dt><span class="sect2"><a href=
1.38      dillo    6053:                   "#updating-buildlink-depends">11.2.2. Updating
1.30      wiz      6054:                   <code class=
1.67    ! hubertf  6055:                   "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
        !          6056:                   in <code xmlns=
1.45      wiz      6057:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      6058:                   "filename">buildlink3.mk</code>
1.1       grant    6059:                   files</a></span></dt>
                   6060:                 </dl>
                   6061:               </dd>
                   6062: 
1.30      wiz      6063:               <dt><span class="sect1"><a href=
1.45      wiz      6064:               "#writing-builtin.mk">11.3. Writing <code xmlns=
                   6065:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      6066:               "filename">builtin.mk</code> files</a></span></dt>
1.1       grant    6067: 
                   6068:               <dd>
                   6069:                 <dl>
                   6070:                   <dt><span class="sect2"><a href=
1.38      dillo    6071:                   "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45      wiz      6072:                   <code xmlns=
                   6073:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   6074:                   "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    6075: 
                   6076:                   <dt><span class="sect2"><a href=
1.38      dillo    6077:                   "#native-or-pkgsrc-preference">11.3.2. Global
1.30      wiz      6078:                   preferences for native or pkgsrc
                   6079:                   software</a></span></dt>
1.1       grant    6080:                 </dl>
                   6081:               </dd>
                   6082:             </dl>
                   6083:           </dd>
                   6084: 
1.38      dillo    6085:           <dt><span class="chapter"><a href="#pkginstall">12. The
1.35      jmmv     6086:           pkginstall framework</a></span></dt>
                   6087: 
                   6088:           <dd>
                   6089:             <dl>
                   6090:               <dt><span class="sect1"><a href=
1.38      dillo    6091:               "#files-and-dirs-outside-prefix">12.1. Files and
1.35      jmmv     6092:               directories outside the installation
                   6093:               prefix</a></span></dt>
                   6094: 
                   6095:               <dd>
                   6096:                 <dl>
                   6097:                   <dt><span class="sect2"><a href=
1.38      dillo    6098:                   "#dirs-outside-prefix">12.1.1. Directory
1.35      jmmv     6099:                   manipulation</a></span></dt>
                   6100: 
                   6101:                   <dt><span class="sect2"><a href=
1.38      dillo    6102:                   "#files-outside-prefix">12.1.2. File
1.35      jmmv     6103:                   manipulation</a></span></dt>
                   6104:                 </dl>
                   6105:               </dd>
                   6106: 
1.38      dillo    6107:               <dt><span class="sect1"><a href="#conf-files">12.2.
1.35      jmmv     6108:               Configuration files</a></span></dt>
                   6109: 
                   6110:               <dd>
                   6111:                 <dl>
                   6112:                   <dt><span class="sect2"><a href=
1.38      dillo    6113:                   "#conf-files-sysconfdir">12.2.1. How <code class=
1.35      jmmv     6114:                   "varname">PKG_SYSCONFDIR</code> is
                   6115:                   set</a></span></dt>
                   6116: 
                   6117:                   <dt><span class="sect2"><a href=
1.38      dillo    6118:                   "#conf-files-configure">12.2.2. Telling the
1.47      reed     6119:                   software where configuration files
1.35      jmmv     6120:                   are</a></span></dt>
                   6121: 
                   6122:                   <dt><span class="sect2"><a href=
1.38      dillo    6123:                   "#conf-files-patching">12.2.3. Patching
1.35      jmmv     6124:                   installations</a></span></dt>
                   6125: 
                   6126:                   <dt><span class="sect2"><a href=
1.38      dillo    6127:                   "#conf-files-disable">12.2.4. Disabling handling
1.35      jmmv     6128:                   of configuration files</a></span></dt>
                   6129:                 </dl>
                   6130:               </dd>
                   6131: 
1.38      dillo    6132:               <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35      jmmv     6133:               System startup scripts</a></span></dt>
                   6134: 
                   6135:               <dd>
                   6136:                 <dl>
                   6137:                   <dt><span class="sect2"><a href=
1.38      dillo    6138:                   "#rcd-scripts-disable">12.3.1. Disabling handling
1.35      jmmv     6139:                   of system startup scripts</a></span></dt>
                   6140:                 </dl>
                   6141:               </dd>
                   6142: 
                   6143:               <dt><span class="sect1"><a href=
1.38      dillo    6144:               "#users-and-groups">12.4. System users and
1.35      jmmv     6145:               groups</a></span></dt>
                   6146: 
1.38      dillo    6147:               <dt><span class="sect1"><a href="#shells">12.5.
1.35      jmmv     6148:               System shells</a></span></dt>
                   6149: 
                   6150:               <dd>
                   6151:                 <dl>
                   6152:                   <dt><span class="sect2"><a href=
1.65      hubertf  6153:                   "#shells-disable">12.5.1. Disabling shell
                   6154:                   registration</a></span></dt>
                   6155:                 </dl>
                   6156:               </dd>
                   6157: 
                   6158:               <dt><span class="sect1"><a href="#fonts">12.6.
                   6159:               Fonts</a></span></dt>
                   6160: 
                   6161:               <dd>
                   6162:                 <dl>
                   6163:                   <dt><span class="sect2"><a href=
                   6164:                   "#fonts-disable">12.6.1. Disabling automatic
                   6165:                   update of the fonts databases</a></span></dt>
1.35      jmmv     6166:                 </dl>
                   6167:               </dd>
                   6168:             </dl>
                   6169:           </dd>
                   6170: 
1.38      dillo    6171:           <dt><span class="chapter"><a href="#options">13. Options
1.1       grant    6172:           handling</a></span></dt>
                   6173: 
                   6174:           <dd>
                   6175:             <dl>
1.30      wiz      6176:               <dt><span class="sect1"><a href=
1.38      dillo    6177:               "#global-default-options">13.1. Global default
1.30      wiz      6178:               options</a></span></dt>
1.1       grant    6179: 
1.30      wiz      6180:               <dt><span class="sect1"><a href=
1.38      dillo    6181:               "#converting-to-options">13.2. Converting packages to
1.45      wiz      6182:               use <code xmlns=
                   6183:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6184:               "filename">bsd.options.mk</code></a></span></dt>
1.48      dillo    6185: 
                   6186:               <dt><span class="sect1"><a href="#option-names">13.3.
                   6187:               Option Names</a></span></dt>
1.1       grant    6188:             </dl>
                   6189:           </dd>
                   6190: 
1.38      dillo    6191:           <dt><span class="chapter"><a href="#build">14. The build
1.1       grant    6192:           process</a></span></dt>
                   6193: 
                   6194:           <dd>
                   6195:             <dl>
1.56      rillig   6196:               <dt><span class="sect1"><a href="#build.intro">14.1.
                   6197:               Introduction</a></span></dt>
                   6198: 
                   6199:               <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1       grant    6200:               Program location</a></span></dt>
                   6201: 
1.56      rillig   6202:               <dt><span class="sect1"><a href=
                   6203:               "#build.builddirs">14.3. Directories used during the
                   6204:               build process</a></span></dt>
1.1       grant    6205: 
                   6206:               <dt><span class="sect1"><a href=
1.56      rillig   6207:               "#build.running">14.4. Running a
                   6208:               phase</a></span></dt>
                   6209: 
                   6210:               <dt><span class="sect1"><a href="#build.fetch">14.5.
                   6211:               The <span class="emphasis"><em>fetch</em></span>
                   6212:               phase</a></span></dt>
                   6213: 
                   6214:               <dt><span class="sect1"><a href=
                   6215:               "#build.checksum">14.6. The <span class=
                   6216:               "emphasis"><em>checksum</em></span>
                   6217:               phase</a></span></dt>
                   6218: 
                   6219:               <dt><span class="sect1"><a href=
                   6220:               "#build.extract">14.7. The <span class=
                   6221:               "emphasis"><em>extract</em></span>
                   6222:               phase</a></span></dt>
                   6223: 
                   6224:               <dt><span class="sect1"><a href="#build.patch">14.8.
                   6225:               The <span class="emphasis"><em>patch</em></span>
                   6226:               phase</a></span></dt>
                   6227: 
                   6228:               <dt><span class="sect1"><a href="#build.tools">14.9.
                   6229:               The <span class="emphasis"><em>tools</em></span>
                   6230:               phase</a></span></dt>
                   6231: 
                   6232:               <dt><span class="sect1"><a href=
                   6233:               "#build.wrapper">14.10. The <span class=
                   6234:               "emphasis"><em>wrapper</em></span>
                   6235:               phase</a></span></dt>
                   6236: 
                   6237:               <dt><span class="sect1"><a href=
                   6238:               "#build.configure">14.11. The <span class=
                   6239:               "emphasis"><em>configure</em></span>
                   6240:               phase</a></span></dt>
                   6241: 
                   6242:               <dt><span class="sect1"><a href="#build.build">14.12.
                   6243:               The <span class="emphasis"><em>build</em></span>
                   6244:               phase</a></span></dt>
                   6245: 
                   6246:               <dt><span class="sect1"><a href="#build.test">14.13.
                   6247:               The <span class="emphasis"><em>test</em></span>
                   6248:               phase</a></span></dt>
                   6249: 
                   6250:               <dt><span class="sect1"><a href=
                   6251:               "#build.install">14.14. The <span class=
                   6252:               "emphasis"><em>install</em></span>
                   6253:               phase</a></span></dt>
                   6254: 
                   6255:               <dt><span class="sect1"><a href=
                   6256:               "#build.package">14.15. The <span class=
                   6257:               "emphasis"><em>package</em></span>
                   6258:               phase</a></span></dt>
                   6259: 
                   6260:               <dt><span class="sect1"><a href=
                   6261:               "#build.helpful-targets">14.16. Other helpful
1.1       grant    6262:               targets</a></span></dt>
                   6263:             </dl>
                   6264:           </dd>
                   6265: 
1.55      rillig   6266:           <dt><span class="chapter"><a href="#fixes">15. Making
                   6267:           your package work</a></span></dt>
1.1       grant    6268: 
                   6269:           <dd>
                   6270:             <dl>
1.30      wiz      6271:               <dt><span class="sect1"><a href=
1.38      dillo    6272:               "#general-operation">15.1. General
1.30      wiz      6273:               operation</a></span></dt>
1.1       grant    6274: 
                   6275:               <dd>
                   6276:                 <dl>
                   6277:                   <dt><span class="sect2"><a href=
1.38      dillo    6278:                   "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30      wiz      6279:                   pull in variables from
                   6280:                   /etc/mk.conf</a></span></dt>
1.1       grant    6281: 
                   6282:                   <dt><span class="sect2"><a href=
1.38      dillo    6283:                   "#where-to-install-documentation">15.1.2. Where
1.31      wiz      6284:                   to install documentation</a></span></dt>
                   6285: 
                   6286:                   <dt><span class="sect2"><a href=
1.38      dillo    6287:                   "#restricted-packages">15.1.3. Restricted
1.1       grant    6288:                   packages</a></span></dt>
                   6289: 
                   6290:                   <dt><span class="sect2"><a href=
1.38      dillo    6291:                   "#dependencies">15.1.4. Handling
1.1       grant    6292:                   dependencies</a></span></dt>
                   6293: 
                   6294:                   <dt><span class="sect2"><a href=
1.38      dillo    6295:                   "#conflicts">15.1.5. Handling conflicts with
1.1       grant    6296:                   other packages</a></span></dt>
                   6297: 
                   6298:                   <dt><span class="sect2"><a href=
1.38      dillo    6299:                   "#not-building-packages">15.1.6. Packages that
1.30      wiz      6300:                   cannot or should not be built</a></span></dt>
1.1       grant    6301: 
                   6302:                   <dt><span class="sect2"><a href=
1.38      dillo    6303:                   "#undeletable-packages">15.1.7. Packages which
1.30      wiz      6304:                   should not be deleted, once
                   6305:                   installed</a></span></dt>
1.1       grant    6306: 
                   6307:                   <dt><span class="sect2"><a href=
1.38      dillo    6308:                   "#security-handling">15.1.8. Handling packages
1.1       grant    6309:                   with security problems</a></span></dt>
                   6310: 
                   6311:                   <dt><span class="sect2"><a href=
1.38      dillo    6312:                   "#compiler-bugs">15.1.9. How to handle compiler
1.1       grant    6313:                   bugs</a></span></dt>
                   6314: 
                   6315:                   <dt><span class="sect2"><a href=
1.38      dillo    6316:                   "#bumping-pkgrevision">15.1.10. How to handle
1.30      wiz      6317:                   incrementing versions when fixing an existing
1.1       grant    6318:                   package</a></span></dt>
                   6319: 
                   6320:                   <dt><span class="sect2"><a href=
1.38      dillo    6321:                   "#portability-of-packages">15.1.11. Portability
1.30      wiz      6322:                   of packages</a></span></dt>
1.1       grant    6323:                 </dl>
                   6324:               </dd>
                   6325: 
1.30      wiz      6326:               <dt><span class="sect1"><a href=
1.38      dillo    6327:               "#downloading-issues">15.2. Possible downloading
1.30      wiz      6328:               issues</a></span></dt>
1.1       grant    6329: 
                   6330:               <dd>
                   6331:                 <dl>
                   6332:                   <dt><span class="sect2"><a href=
1.38      dillo    6333:                   "#no-plain-download">15.2.1. Packages whose
1.30      wiz      6334:                   distfiles aren't available for plain
1.1       grant    6335:                   downloading</a></span></dt>
                   6336: 
                   6337:                   <dt><span class="sect2"><a href=
1.38      dillo    6338:                   "#modified-distfiles-same-name">15.2.2. How to
1.30      wiz      6339:                   handle modified distfiles with the 'old'
                   6340:                   name</a></span></dt>
1.1       grant    6341:                 </dl>
                   6342:               </dd>
                   6343: 
1.30      wiz      6344:               <dt><span class="sect1"><a href=
1.38      dillo    6345:               "#configuration-gotchas">15.3. Configuration
1.30      wiz      6346:               gotchas</a></span></dt>
1.1       grant    6347: 
                   6348:               <dd>
                   6349:                 <dl>
                   6350:                   <dt><span class="sect2"><a href=
1.38      dillo    6351:                   "#fixes.libtool">15.3.1. Shared libraries -
1.1       grant    6352:                   libtool</a></span></dt>
                   6353: 
                   6354:                   <dt><span class="sect2"><a href=
1.38      dillo    6355:                   "#using-libtool">15.3.2. Using libtool on GNU
1.1       grant    6356:                   packages that already support
                   6357:                   libtool</a></span></dt>
                   6358: 
                   6359:                   <dt><span class="sect2"><a href=
1.38      dillo    6360:                   "#autoconf-automake">15.3.3. GNU
1.1       grant    6361:                   Autoconf/Automake</a></span></dt>
                   6362:                 </dl>
                   6363:               </dd>
                   6364: 
1.55      rillig   6365:               <dt><span class="sect1"><a href="#fixes-build">15.4.
                   6366:               Building the package</a></span></dt>
1.1       grant    6367: 
                   6368:               <dd>
                   6369:                 <dl>
                   6370:                   <dt><span class="sect2"><a href=
1.38      dillo    6371:                   "#cpp-defines">15.4.1. CPP
1.30      wiz      6372:                   defines</a></span></dt>
1.51      rillig   6373: 
                   6374:                   <dt><span class="sect2"><a href=
1.60      rillig   6375:                   "#cpp-list-examples">15.4.2. Examples of CPP
                   6376:                   defines for some platforms</a></span></dt>
                   6377: 
                   6378:                   <dt><span class="sect2"><a href=
                   6379:                   "#cpp-list">15.4.3. Getting a list of CPP
1.51      rillig   6380:                   defines</a></span></dt>
1.1       grant    6381:                 </dl>
                   6382:               </dd>
                   6383: 
1.30      wiz      6384:               <dt><span class="sect1"><a href=
1.38      dillo    6385:               "#package-specific-actions">15.5. Package specific
1.30      wiz      6386:               actions</a></span></dt>
1.1       grant    6387: 
                   6388:               <dd>
                   6389:                 <dl>
                   6390:                   <dt><span class="sect2"><a href=
1.38      dillo    6391:                   "#user-interaction">15.5.1. User
1.2       hubertf  6392:                   interaction</a></span></dt>
1.1       grant    6393: 
                   6394:                   <dt><span class="sect2"><a href=
1.38      dillo    6395:                   "#handling-licenses">15.5.2. Handling
1.1       grant    6396:                   licenses</a></span></dt>
                   6397: 
                   6398:                   <dt><span class="sect2"><a href=
1.38      dillo    6399:                   "#installing-score-files">15.5.3. Installing
1.30      wiz      6400:                   score files</a></span></dt>
1.1       grant    6401: 
                   6402:                   <dt><span class="sect2"><a href=
1.38      dillo    6403:                   "#perl-scripts">15.5.4. Packages containing perl
1.1       grant    6404:                   scripts</a></span></dt>
                   6405: 
                   6406:                   <dt><span class="sect2"><a href=
1.38      dillo    6407:                   "#hardcoded-paths">15.5.5. Packages with
1.30      wiz      6408:                   hardcoded paths to other
                   6409:                   interpreters</a></span></dt>
1.1       grant    6410: 
                   6411:                   <dt><span class="sect2"><a href=
1.38      dillo    6412:                   "#perl-modules">15.5.6. Packages installing perl
1.1       grant    6413:                   modules</a></span></dt>
                   6414: 
                   6415:                   <dt><span class="sect2"><a href=
1.38      dillo    6416:                   "#faq.info-files">15.5.7. Packages installing
1.1       grant    6417:                   info files</a></span></dt>
                   6418: 
                   6419:                   <dt><span class="sect2"><a href=
1.57      minskim  6420:                   "#manpages">15.5.8. Packages installing man
                   6421:                   pages</a></span></dt>
                   6422: 
                   6423:                   <dt><span class="sect2"><a href=
                   6424:                   "#gconf2-data-files">15.5.9. Packages installing
1.30      wiz      6425:                   GConf2 data files</a></span></dt>
1.1       grant    6426: 
                   6427:                   <dt><span class="sect2"><a href=
1.57      minskim  6428:                   "#scrollkeeper-data-files">15.5.10. Packages
1.30      wiz      6429:                   installing scrollkeeper data
                   6430:                   files</a></span></dt>
1.1       grant    6431: 
                   6432:                   <dt><span class="sect2"><a href=
1.57      minskim  6433:                   "#x11-fonts">15.5.11. Packages installing X11
1.1       grant    6434:                   fonts</a></span></dt>
                   6435: 
                   6436:                   <dt><span class="sect2"><a href=
1.57      minskim  6437:                   "#gtk2-modules">15.5.12. Packages installing GTK2
1.1       grant    6438:                   modules</a></span></dt>
                   6439: 
                   6440:                   <dt><span class="sect2"><a href=
1.57      minskim  6441:                   "#sgml-xml-data">15.5.13. Packages installing
1.30      wiz      6442:                   SGML or XML data</a></span></dt>
1.1       grant    6443: 
                   6444:                   <dt><span class="sect2"><a href=
1.57      minskim  6445:                   "#mime-database">15.5.14. Packages installing
1.1       grant    6446:                   extensions to the MIME database</a></span></dt>
                   6447: 
                   6448:                   <dt><span class="sect2"><a href=
1.57      minskim  6449:                   "#intltool">15.5.15. Packages using
1.1       grant    6450:                   intltool</a></span></dt>
1.18      xtraeme  6451: 
                   6452:                   <dt><span class="sect2"><a href=
1.57      minskim  6453:                   "#startup-scripts">15.5.16. Packages installing
1.30      wiz      6454:                   startup scripts</a></span></dt>
1.57      minskim  6455: 
                   6456:                   <dt><span class="sect2"><a href=
                   6457:                   "#tex-packages">15.5.17. Packages installing TeX
                   6458:                   modules</a></span></dt>
1.1       grant    6459:                 </dl>
                   6460:               </dd>
                   6461: 
1.30      wiz      6462:               <dt><span class="sect1"><a href=
1.38      dillo    6463:               "#feedback-to-author">15.6. Feedback to the
1.30      wiz      6464:               author</a></span></dt>
1.1       grant    6465:             </dl>
                   6466:           </dd>
                   6467: 
1.38      dillo    6468:           <dt><span class="chapter"><a href="#debug">16.
1.1       grant    6469:           Debugging</a></span></dt>
                   6470: 
1.38      dillo    6471:           <dt><span class="chapter"><a href="#submit">17.
1.1       grant    6472:           Submitting and Committing</a></span></dt>
                   6473: 
                   6474:           <dd>
                   6475:             <dl>
1.30      wiz      6476:               <dt><span class="sect1"><a href=
1.38      dillo    6477:               "#submitting-your-package">17.1. Submitting your
1.30      wiz      6478:               packages</a></span></dt>
1.1       grant    6479: 
1.30      wiz      6480:               <dt><span class="sect1"><a href=
1.41      wiz      6481:               "#general-notes-for-changes">17.2. General notes when
                   6482:               adding, updating, or removing
                   6483:               packages</a></span></dt>
                   6484: 
                   6485:               <dt><span class="sect1"><a href=
                   6486:               "#committing-importing">17.3. Committing: Importing a
1.30      wiz      6487:               package into CVS</a></span></dt>
1.1       grant    6488: 
1.30      wiz      6489:               <dt><span class="sect1"><a href=
1.41      wiz      6490:               "#updating-package">17.4. Updating a package to a
1.30      wiz      6491:               newer version</a></span></dt>
1.1       grant    6492: 
1.30      wiz      6493:               <dt><span class="sect1"><a href=
1.41      wiz      6494:               "#moving-package">17.5. Moving a package in
1.30      wiz      6495:               pkgsrc</a></span></dt>
1.1       grant    6496:             </dl>
                   6497:           </dd>
                   6498:         </dl>
                   6499:       </div>
                   6500: 
1.67    ! hubertf  6501:       <div class="chapter" lang="en">
1.1       grant    6502:         <div class="titlepage">
                   6503:           <div>
                   6504:             <div>
1.67    ! hubertf  6505:               <h2 class="title"><a name=
1.38      dillo    6506:               "components"></a>Chapter&nbsp;8.&nbsp;Package
1.27      rillig   6507:               components - files, directories and contents</h2>
1.25      rillig   6508:             </div>
                   6509:           </div>
                   6510:         </div>
                   6511: 
                   6512:         <div class="toc">
                   6513:           <p><b>Table of Contents</b></p>
                   6514: 
                   6515:           <dl>
                   6516:             <dt><span class="sect1"><a href=
1.45      wiz      6517:             "#components.Makefile">8.1. <code xmlns=
                   6518:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6519:             "filename">Makefile</code></a></span></dt>
                   6520: 
                   6521:             <dt><span class="sect1"><a href=
1.45      wiz      6522:             "#components.distinfo">8.2. <code xmlns=
                   6523:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6524:             "filename">distinfo</code></a></span></dt>
                   6525: 
                   6526:             <dt><span class="sect1"><a href=
1.38      dillo    6527:             "#components.patches">8.3. patches/*</a></span></dt>
1.25      rillig   6528: 
1.30      wiz      6529:             <dt><span class="sect1"><a href=
1.38      dillo    6530:             "#other-mandatory-files">8.4. Other mandatory
1.30      wiz      6531:             files</a></span></dt>
1.25      rillig   6532: 
1.27      rillig   6533:             <dt><span class="sect1"><a href=
1.38      dillo    6534:             "#components.optional">8.5. Optional
1.27      rillig   6535:             files</a></span></dt>
1.25      rillig   6536: 
1.38      dillo    6537:             <dt><span class="sect1"><a href="#work-dir">8.6.
1.45      wiz      6538:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6539:             class="filename">work*</code></a></span></dt>
1.25      rillig   6540: 
1.38      dillo    6541:             <dt><span class="sect1"><a href="#files-dir">8.7.
1.45      wiz      6542:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6543:             class="filename">files/*</code></a></span></dt>
1.25      rillig   6544:           </dl>
                   6545:         </div>
                   6546: 
1.27      rillig   6547:         <p>Whenever you're preparing a package, there are a number
                   6548:         of files involved which are described in the following
                   6549:         sections.</p>
1.25      rillig   6550: 
1.67    ! hubertf  6551:         <div class="sect1" lang="en">
1.25      rillig   6552:           <div class="titlepage">
                   6553:             <div>
                   6554:               <div>
                   6555:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      6556:                 "components.Makefile"></a>8.1.&nbsp;<code xmlns=
                   6557:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6558:                 "filename">Makefile</code></h2>
1.25      rillig   6559:               </div>
                   6560:             </div>
                   6561:           </div>
                   6562: 
1.27      rillig   6563:           <p>Building, installation and creation of a binary
1.45      wiz      6564:           package are all controlled by the package's <code xmlns=
                   6565:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6566:           "filename">Makefile</code>. The <code xmlns=
                   6567:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6568:           "filename">Makefile</code> describes various things about
                   6569:           a package, for example from where to get it, how to
                   6570:           configure, build, and install it.</p>
                   6571: 
1.45      wiz      6572:           <p>A package <code xmlns=
                   6573:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6574:           "filename">Makefile</code> contains several sections that
                   6575:           describe the package.</p>
1.25      rillig   6576: 
1.27      rillig   6577:           <p>In the first section there are the following
                   6578:           variables, which should appear exactly in the order given
                   6579:           here.</p>
1.25      rillig   6580: 
                   6581:           <div class="itemizedlist">
                   6582:             <ul type="disc">
                   6583:               <li>
1.27      rillig   6584:                 <p><code class="varname">DISTNAME</code> is the
                   6585:                 basename of the distribution file to be downloaded
                   6586:                 from the package's website.</p>
                   6587:               </li>
                   6588: 
                   6589:               <li>
                   6590:                 <p><code class="varname">PKGNAME</code> is the name
                   6591:                 of the package, as used by pkgsrc. You only need to
1.50      rillig   6592:                 provide it if it differs from <code class=
                   6593:                 "varname">DISTNAME</code>. Usually it is the
                   6594:                 directory name together with the version number. It
                   6595:                 must match the regular expression <code class=
1.27      rillig   6596:                 "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
                   6597:                 that is, it starts with a letter or digit, and
                   6598:                 contains only letters, digits, dashes, underscores,
                   6599:                 dots and plus signs.</p>
1.25      rillig   6600:               </li>
                   6601: 
                   6602:               <li>
1.27      rillig   6603:                 <p><code class="varname">CATEGORIES</code> is a
                   6604:                 list of categories which the package fits in. You
                   6605:                 can choose any of the top-level directories of
                   6606:                 pkgsrc for it.</p>
1.45      wiz      6607: 
                   6608:                 <p>Currently the following values are available for
                   6609:                 <code class="varname">CATEGORIES</code>. If more
                   6610:                 than one is used, they need to be separated by
                   6611:                 spaces:</p>
                   6612:                 <pre class="programlisting">
1.51      rillig   6613:     archivers     cross         geography     meta-pkgs     security
                   6614:     audio         databases     graphics      misc          shells
                   6615:     benchmarks    devel         ham           multimedia    sysutils
                   6616:     biology       editors       inputmethod   net           textproc
                   6617:     cad           emulators     lang          news          time
                   6618:     chat          finance       mail          parallel      wm
                   6619:     comms         fonts         math          pkgtools      www
                   6620:     converters    games         mbone         print         x11
1.45      wiz      6621: </pre>
1.25      rillig   6622:               </li>
                   6623: 
                   6624:               <li>
1.27      rillig   6625:                 <p><code class="varname">MASTER_SITES</code> is a
                   6626:                 list of URLs where the distribution files can be
                   6627:                 downloaded. Each URL must end with a slash.</p>
1.45      wiz      6628: 
                   6629:                 <p>The <code class="varname">MASTER_SITES</code>
                   6630:                 may make use of the following predefined sites:</p>
                   6631:                 <pre class="programlisting">
1.51      rillig   6632:     ${MASTER_SITE_APACHE}
                   6633:     ${MASTER_SITE_BACKUP}
                   6634:     ${MASTER_SITE_CYGWIN}
                   6635:     ${MASTER_SITE_DEBIAN}
                   6636:     ${MASTER_SITE_FREEBSD}
                   6637:     ${MASTER_SITE_FREEBSD_LOCAL}
                   6638:     ${MASTER_SITE_GNOME}
                   6639:     ${MASTER_SITE_GNU}
                   6640:     ${MASTER_SITE_GNUSTEP}
                   6641:     ${MASTER_SITE_IFARCHIVE}
                   6642:     ${MASTER_SITE_MOZILLA}
                   6643:     ${MASTER_SITE_OPENOFFICE}
                   6644:     ${MASTER_SITE_PERL_CPAN}
                   6645:     ${MASTER_SITE_R_CRAN}
                   6646:     ${MASTER_SITE_SOURCEFORGE}
                   6647:     ${MASTER_SITE_SUNSITE}
                   6648:     ${MASTER_SITE_SUSE}
                   6649:     ${MASTER_SITE_TEX_CTAN}
                   6650:     ${MASTER_SITE_XCONTRIB}
                   6651:     ${MASTER_SITE_XEMACS}
1.45      wiz      6652: </pre>
                   6653: 
                   6654:                 <p>If one of these predefined sites is chosen, you
                   6655:                 may want to specify a subdirectory of that site.
                   6656:                 Since these macros may expand to more than one
                   6657:                 actual site, you <span class=
                   6658:                 "emphasis"><em>must</em></span> use the following
                   6659:                 construct to specify a subdirectory:</p>
                   6660:                 <pre class="programlisting">
1.51      rillig   6661:     ${MASTER_SITE_GNU:=subdirectory/name/}
                   6662:     ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.45      wiz      6663: </pre>
                   6664: 
                   6665:                 <p>Note the trailing slash after the subdirectory
                   6666:                 name.</p>
                   6667: 
                   6668:                 <p>If the package has multiple <code class=
                   6669:                 "varname">DISTFILES</code> or multiple <code class=
                   6670:                 "varname">PATCHFILES</code> from different sites,
                   6671:                 set <code class="varname">SITES_foo</code> to a
1.47      reed     6672:                 list of URIs where file &#8220;<span class=
1.45      wiz      6673:                 "quote">foo</span>&#8221; may be found.
                   6674:                 &#8220;<span class="quote">foo</span>&#8221;
1.47      reed     6675:                 includes the suffix, e.g.:</p>
1.45      wiz      6676:                 <pre class="programlisting">
1.51      rillig   6677:     DISTFILES=      ${DISTNAME}${EXTRACT_SUFX}
                   6678:     DISTFILES+=     foo-file.tar.gz
                   6679:     SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
                   6680:             http://www.somewhereelse.com/mirror/somehow/
1.45      wiz      6681: </pre>
                   6682:               </li>
                   6683: 
                   6684:               <li>
                   6685:                 <p><code class="varname">DISTFILES</code>: Name(s)
                   6686:                 of archive file(s) containing distribution. The
                   6687:                 default is <code xmlns=
                   6688:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6689:                 "filename">${DISTNAME}${EXTRACT_SUFX}</code>.
                   6690:                 Should only be set if you have more than one
                   6691:                 distfile.</p>
                   6692: 
                   6693:                 <p>Note that the normal default setting of
                   6694:                 <code class="varname">DISTFILES</code> must be made
                   6695:                 explicit if you want to add to it (rather than
                   6696:                 replace it), as you usually would.</p>
                   6697:               </li>
                   6698: 
                   6699:               <li>
                   6700:                 <p><code class="varname">EXTRACT_SUFX</code>:
                   6701:                 Suffix of the distribution file, will be appended
                   6702:                 to <code class="varname">DISTNAME</code>. Defaults
                   6703:                 to <code xmlns=
                   6704:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6705:                 "filename">.tar.gz</code>.</p>
                   6706:               </li>
                   6707:             </ul>
                   6708:           </div>
                   6709: 
                   6710:           <p>The second section contains information about
                   6711:           separately downloaded patches, if any.</p>
                   6712: 
                   6713:           <div class="itemizedlist">
                   6714:             <ul type="disc">
                   6715:               <li>
1.47      reed     6716:                 <p><code class="varname">PATCHFILES:</code> Name(s)
1.45      wiz      6717:                 of additional files that contain distribution
                   6718:                 patches. There is no default. pkgsrc will look for
                   6719:                 them at <code class="varname">PATCH_SITES</code>.
                   6720:                 They will automatically be uncompressed before
                   6721:                 patching if the names end with <code xmlns=
                   6722:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6723:                 "filename">.gz</code> or <code xmlns=
                   6724:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6725:                 "filename">.Z</code>.</p>
                   6726:               </li>
                   6727: 
                   6728:               <li>
                   6729:                 <p><code class="varname">PATCH_SITES</code>:
                   6730:                 Primary location(s) for distribution patch files
                   6731:                 (see <code class="varname">PATCHFILES</code> below)
                   6732:                 if not found locally.</p>
1.25      rillig   6733:               </li>
                   6734:             </ul>
                   6735:           </div>
                   6736: 
1.45      wiz      6737:           <p>The third section contains the following
1.27      rillig   6738:           variables.</p>
1.25      rillig   6739: 
1.27      rillig   6740:           <div class="itemizedlist">
                   6741:             <ul type="disc">
                   6742:               <li>
                   6743:                 <p><code class="varname">MAINTAINER</code> is the
1.50      rillig   6744:                 email address of the person who feels responsible
                   6745:                 for this package, and who is most likely to look at
                   6746:                 problems or questions regarding this package which
                   6747:                 have been reported with <a href=
1.45      wiz      6748:                 "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
                   6749:                 <span class="citerefentry"><span class=
1.50      rillig   6750:                 "refentrytitle">send-pr</span>(1)</span></a>. Other
                   6751:                 developers should contact the <code class=
                   6752:                 "varname">MAINTAINER</code> before making major
                   6753:                 changes to the package. When packaging a new
                   6754:                 program, set <code class=
                   6755:                 "varname">MAINTAINER</code> to yourself. If you
                   6756:                 really can't maintain the package for future
                   6757:                 updates, set it to <code class="email">&lt;<a href=
1.45      wiz      6758:                 "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>&gt;</code>.</p>
1.27      rillig   6759:               </li>
1.25      rillig   6760: 
1.27      rillig   6761:               <li>
                   6762:                 <p><code class="varname">HOMEPAGE</code> is a URL
                   6763:                 where users can find more information about the
1.23      wiz      6764:                 package.</p>
                   6765:               </li>
1.1       grant    6766: 
1.23      wiz      6767:               <li>
                   6768:                 <p><code class="varname">COMMENT</code> is a
1.45      wiz      6769:                 one-line description of the package (should not
                   6770:                 include the package name).</p>
1.23      wiz      6771:               </li>
                   6772:             </ul>
                   6773:           </div>
1.1       grant    6774: 
1.45      wiz      6775:           <p>Other variables that affect the build:</p>
1.1       grant    6776: 
1.45      wiz      6777:           <div class="itemizedlist">
                   6778:             <ul type="disc">
                   6779:               <li>
                   6780:                 <p><code class="varname">WRKSRC</code>: The
1.50      rillig   6781:                 directory where the interesting distribution files
                   6782:                 of the package are found. The default is
                   6783:                 <code xmlns=
                   6784:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6785:                 "filename">${WRKDIR}/${DISTNAME}</code>, which
                   6786:                 works for most packages.</p>
                   6787: 
                   6788:                 <p>If a package doesn't create a subdirectory for
                   6789:                 itself (most GNU software does, for instance), but
                   6790:                 extracts itself in the current directory, you
                   6791:                 should set <code class="varname">WRKSRC=
                   6792:                 ${WRKDIR}</code>.</p>
                   6793: 
                   6794:                 <p>If a package doesn't create a subdirectory with
                   6795:                 the name of <code class="varname">DISTNAME</code>
                   6796:                 but some different name, set <code class=
                   6797:                 "varname">WRKSRC</code> to point to the proper name
                   6798:                 in <code xmlns=
                   6799:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6800:                 "filename">${WRKDIR}</code>, for example
                   6801:                 <code class="varname">WRKSRC=
                   6802:                 ${WRKDIR}/${DISTNAME}/unix</code>. See <a xmlns=
                   6803:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6804:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
                   6805:                 target="_top"><code xmlns="" class=
                   6806:                 "filename">lang/tcl</code></a> and <a xmlns=
                   6807:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6808:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
                   6809:                 target="_top"><code xmlns="" class=
                   6810:                 "filename">x11/tk</code></a> for other
                   6811:                 examples.</p>
                   6812: 
                   6813:                 <p>The name of the working directory created by
                   6814:                 pkgsrc is taken from the <code class=
                   6815:                 "varname">WRKDIR_BASENAME</code> variable. By
                   6816:                 default, its value is <code xmlns=
                   6817:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6818:                 "filename">work</code>. If you want to use the same
                   6819:                 pkgsrc tree for building different kinds of binary
                   6820:                 packages, you can change the variable according to
                   6821:                 your needs. Two other variables handle common cases
                   6822:                 of setting <code class=
                   6823:                 "varname">WRKDIR_BASENAME</code> individually. If
                   6824:                 <code class="varname">OBJHOSTNAME</code> is defined
                   6825:                 in <code xmlns=
1.45      wiz      6826:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.50      rillig   6827:                 "filename">/etc/mk.conf</code>, the first component
                   6828:                 of the host's name is attached to the directory
                   6829:                 name. If <code class="varname">OBJMACHINE</code> is
                   6830:                 defined, the platform name is attached, which might
                   6831:                 look like <code xmlns=
                   6832:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6833:                 "filename">work.i386</code> or <code xmlns=
1.45      wiz      6834:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.50      rillig   6835:                 "filename">work.sparc</code>.</p>
1.45      wiz      6836:               </li>
                   6837:             </ul>
1.1       grant    6838:           </div>
                   6839: 
                   6840:           <p>Please pay attention to the following gotchas:</p>
                   6841: 
                   6842:           <div class="itemizedlist">
                   6843:             <ul type="disc">
                   6844:               <li>
1.14      xtraeme  6845:                 <p>Add <code class="varname">MANCOMPRESSED</code>
1.47      reed     6846:                 if man pages are installed in compressed form by
                   6847:                 the package; see comment in <code xmlns=
1.45      wiz      6848:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6849:                 "filename">bsd.pkg.mk</code>.</p>
1.1       grant    6850:               </li>
                   6851: 
                   6852:               <li>
1.45      wiz      6853:                 <p>Replace <code xmlns=
                   6854:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6855:                 "filename">/usr/local</code> with
                   6856:                 &#8220;<span class="quote">${PREFIX}</span>&#8221;
                   6857:                 in all files (see patches, below).</p>
1.1       grant    6858:               </li>
                   6859: 
                   6860:               <li>
                   6861:                 <p>If the package installs any info files, see
                   6862:                 <a href="#faq.info-files" title=
1.45      wiz      6863:                 "15.5.7.&nbsp;Packages installing info files">Section&nbsp;15.5.7,
                   6864:                 &#8220;Packages installing info
1.1       grant    6865:                 files&#8221;</a>.</p>
                   6866:               </li>
                   6867:             </ul>
                   6868:           </div>
                   6869:         </div>
                   6870: 
1.67    ! hubertf  6871:         <div class="sect1" lang="en">
1.1       grant    6872:           <div class="titlepage">
                   6873:             <div>
                   6874:               <div>
                   6875:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      6876:                 "components.distinfo"></a>8.2.&nbsp;<code xmlns=
                   6877:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6878:                 "filename">distinfo</code></h2>
1.1       grant    6879:               </div>
                   6880:             </div>
                   6881:           </div>
                   6882: 
1.50      rillig   6883:           <p>The <code xmlns=
                   6884:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6885:           "filename">distinfo</code> file contains the message
                   6886:           digest, or checksum, of each distfile needed for the
                   6887:           package. This ensures that the distfiles retrieved from
                   6888:           the Internet have not been corrupted during transfer or
                   6889:           altered by a malign force to introduce a security hole.
                   6890:           Due to recent rumor about weaknesses of digest
                   6891:           algorithms, all distfiles are protected using both SHA1
                   6892:           and RMD160 message digests, as well as the file size.</p>
                   6893: 
                   6894:           <p>The <code xmlns=
                   6895:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6896:           "filename">distinfo</code> file also contains the
                   6897:           checksums for all the patches found in the <code xmlns=
                   6898:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6899:           "filename">patches</code> directory (see <a href=
                   6900:           "#components.patches" title=
                   6901:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
                   6902:           &#8220;patches/*&#8221;</a>).</p>
                   6903: 
                   6904:           <p>To regenerate the <code xmlns=
                   6905:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6906:           "filename">distinfo</code> file, use the
1.14      xtraeme  6907:           <span><strong class="command">make
1.50      rillig   6908:           makedistinfo</strong></span> or <span><strong class=
                   6909:           "command">make mdi</strong></span> command.</p>
1.1       grant    6910: 
1.50      rillig   6911:           <p>Some packages have different sets of distfiles
                   6912:           depending on the platform, for example <a xmlns=
1.1       grant    6913:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   6914:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.45      wiz      6915:           target="_top"><code xmlns="" class=
                   6916:           "filename">www/navigator</code></a>). These are kept in
1.50      rillig   6917:           the same <code xmlns=
1.45      wiz      6918:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.50      rillig   6919:           "filename">distinfo</code> file and care should be taken
                   6920:           when upgrading such a package to ensure distfile
                   6921:           information is not lost.</p>
1.1       grant    6922:         </div>
                   6923: 
1.67    ! hubertf  6924:         <div class="sect1" lang="en">
1.1       grant    6925:           <div class="titlepage">
                   6926:             <div>
                   6927:               <div>
                   6928:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    6929:                 "components.patches"></a>8.3.&nbsp;patches/*</h2>
1.1       grant    6930:               </div>
                   6931:             </div>
                   6932:           </div>
                   6933: 
                   6934:           <p>This directory contains files that are used by the
                   6935:           <a href=
                   6936:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   6937:           <span class="citerefentry"><span class=
                   6938:           "refentrytitle">patch</span>(1)</span></a> command to
                   6939:           modify the sources as distributed in the distribution
                   6940:           file into a form that will compile and run perfectly on
                   6941:           NetBSD. The files are applied successively in alphabetic
                   6942:           order (as returned by a shell &#8220;<span class=
                   6943:           "quote">patches/patch-*</span>&#8221; glob expansion), so
1.45      wiz      6944:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6945:           class="filename">patch-aa</code> is applied before
                   6946:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6947:           class="filename">patch-ab</code>, etc.</p>
                   6948: 
                   6949:           <p>The <code xmlns=
                   6950:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6951:           "filename">patch-*</code> files should be in
                   6952:           <span><strong class="command">diff -bu</strong></span>
                   6953:           format, and apply without a fuzz to avoid problems. (To
                   6954:           force patches to apply with fuzz you can set <code class=
1.14      xtraeme  6955:           "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1       grant    6956:           not put changes for more than one file into a single
1.47      reed     6957:           patch file, as this will make future modifications more
1.1       grant    6958:           difficult.</p>
                   6959: 
                   6960:           <p>Similar, a file should be patched at most once, not
                   6961:           several times by several different patches. If a file
                   6962:           needs several patches, they should be combined into one
                   6963:           file.</p>
                   6964: 
                   6965:           <p>One important thing to mention is to pay attention
                   6966:           that no RCS IDs get stored in the patch files, as these
                   6967:           will cause problems when later checked into the NetBSD
1.14      xtraeme  6968:           CVS tree. Use the <span><strong class=
                   6969:           "command">pkgdiff</strong></span> from the <a xmlns=
1.1       grant    6970:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   6971:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45      wiz      6972:           target="_top"><code xmlns="" class=
                   6973:           "filename">pkgtools/pkgdiff</code></a> package to avoid
1.20      ben      6974:           these problems.</p>
1.1       grant    6975: 
                   6976:           <p>For even more automation, we recommend using
1.14      xtraeme  6977:           <span><strong class="command">mkpatches</strong></span>
                   6978:           from the same package to make a whole set of patches. You
                   6979:           just have to backup files before you edit them to
1.45      wiz      6980:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6981:           class="filename">filename.orig</code>, e.g. with
1.14      xtraeme  6982:           <span><strong class="command">cp -p filename
                   6983:           filename.orig</strong></span> or, easier, by using
                   6984:           <span><strong class="command">pkgvi</strong></span> again
                   6985:           from the same package. If you upgrade a package this way,
                   6986:           you can easily compare the new set of patches with the
                   6987:           previously existing one with <span><strong class=
                   6988:           "command">patchdiff</strong></span>.</p>
1.1       grant    6989: 
                   6990:           <p>When you have finished a package, remember to generate
                   6991:           the checksums for the patch files by using the
1.14      xtraeme  6992:           <span><strong class="command">make
                   6993:           makepatchsum</strong></span> command, see <a href=
                   6994:           "#components.distinfo" title=
1.38      dillo    6995:           "8.2.&nbsp;distinfo">Section&nbsp;8.2,
1.45      wiz      6996:           &#8220;<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6997:           class="filename">distinfo</code>&#8221;</a>.</p>
1.1       grant    6998: 
1.46      gdt      6999:           <p>When adding a patch that corrects a problem in the
                   7000:           distfile (rather than e.g. enforcing pkgsrc's view of
                   7001:           where man pages should go), send the patch as a bug
                   7002:           report to the maintainer. This benefits non-pkgsrc users
                   7003:           of the package, and usually enables removing the patch in
                   7004:           future version.</p>
                   7005: 
1.1       grant    7006:           <p>Patch files that are distributed by the author or
1.14      xtraeme  7007:           other maintainers can be listed in <code class=
                   7008:           "varname">$PATCHFILES</code>.</p>
1.1       grant    7009: 
                   7010:           <p>If it is desired to store any patches that should not
                   7011:           be committed into pkgsrc, they can be kept outside the
1.45      wiz      7012:           pkgsrc tree in the <code xmlns=
                   7013:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7014:           "filename">$LOCALPATCHES</code> directory. The directory
1.1       grant    7015:           tree there is expected to have the same
                   7016:           &#8220;<span class="quote">category/package</span>&#8221;
                   7017:           structure as pkgsrc, and patches are expected to be
1.45      wiz      7018:           stored inside these dirs (also known as <code xmlns=
                   7019:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     7020:           "filename">$LOCALPATCHES/$PKGPATH</code>). For example,
                   7021:           if you want to keep a private patch for <code xmlns=
1.45      wiz      7022:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7023:           "filename">pkgsrc/graphics/png</code>, keep it in
1.45      wiz      7024:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7025:           class=
1.14      xtraeme  7026:           "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
                   7027:           files in the named directory are expected to be patch
1.1       grant    7028:           files, and <span class="emphasis"><em>they are applied
                   7029:           after pkgsrc patches are applied</em></span>.</p>
1.27      rillig   7030:         </div>
                   7031: 
1.67    ! hubertf  7032:         <div class="sect1" lang="en">
1.27      rillig   7033:           <div class="titlepage">
                   7034:             <div>
                   7035:               <div>
                   7036:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7037:                 "other-mandatory-files"></a>8.4.&nbsp;Other
1.27      rillig   7038:                 mandatory files</h2>
                   7039:               </div>
                   7040:             </div>
                   7041:           </div>
                   7042: 
                   7043:           <div class="variablelist">
                   7044:             <dl>
1.45      wiz      7045:               <dt><span class="term"><code xmlns=
                   7046:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7047:               "filename">DESCR</code></span></dt>
                   7048: 
                   7049:               <dd>
                   7050:                 <p>A multi-line description of the piece of
                   7051:                 software. This should include any credits where
                   7052:                 they are due. Please bear in mind that others do
                   7053:                 not share your sense of humour (or spelling
                   7054:                 idiosyncrasies), and that others will read
                   7055:                 everything that you write here.</p>
                   7056:               </dd>
                   7057: 
1.45      wiz      7058:               <dt><span class="term"><code xmlns=
                   7059:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7060:               "filename">PLIST</code></span></dt>
                   7061: 
                   7062:               <dd>
                   7063:                 <p>This file governs the files that are installed
                   7064:                 on your system: all the binaries, manual pages,
                   7065:                 etc. There are other directives which may be
                   7066:                 entered in this file, to control the creation and
                   7067:                 deletion of directories, and the location of
                   7068:                 inserted files. See <a href="#plist" title=
1.38      dillo    7069:                 "Chapter&nbsp;10.&nbsp;PLIST issues">Chapter&nbsp;10,
1.27      rillig   7070:                 <i>PLIST issues</i></a> for more information.</p>
                   7071:               </dd>
                   7072:             </dl>
                   7073:           </div>
                   7074:         </div>
                   7075: 
1.67    ! hubertf  7076:         <div class="sect1" lang="en">
1.27      rillig   7077:           <div class="titlepage">
                   7078:             <div>
                   7079:               <div>
                   7080:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7081:                 "components.optional"></a>8.5.&nbsp;Optional
1.27      rillig   7082:                 files</h2>
                   7083:               </div>
                   7084:             </div>
                   7085:           </div>
                   7086: 
                   7087:           <div class="variablelist">
                   7088:             <dl>
1.45      wiz      7089:               <dt><span class="term"><code xmlns=
                   7090:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7091:               "filename">INSTALL</code></span></dt>
                   7092: 
                   7093:               <dd>
                   7094:                 <p>This shell script is invoked twice by <a href=
                   7095:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7096:                 <span class="citerefentry"><span class=
                   7097:                 "refentrytitle">pkg_add</span>(1)</span></a>. First
                   7098:                 time after package extraction and before files are
                   7099:                 moved in place, the second time after the files to
                   7100:                 install are moved in place. This can be used to do
                   7101:                 any custom procedures not possible with @exec
1.45      wiz      7102:                 commands in <code xmlns=
                   7103:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7104:                 "filename">PLIST</code>. See <a href=
1.27      rillig   7105:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7106:                 <span class="citerefentry"><span class=
                   7107:                 "refentrytitle">pkg_add</span>(1)</span></a> and
                   7108:                 <a href=
                   7109:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   7110:                 <span class="citerefentry"><span class=
                   7111:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   7112:                 more information.</p>
                   7113:               </dd>
                   7114: 
1.45      wiz      7115:               <dt><span class="term"><code xmlns=
                   7116:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7117:               "filename">DEINSTALL</code></span></dt>
                   7118: 
                   7119:               <dd>
                   7120:                 <p>This script is executed before and after any
                   7121:                 files are removed. It is this script's
                   7122:                 responsibility to clean up any additional messy
                   7123:                 details around the package's installation, since
                   7124:                 all pkg_delete knows is how to delete the files
                   7125:                 created in the original distribution. See <a href=
                   7126:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   7127:                 <span class="citerefentry"><span class=
                   7128:                 "refentrytitle">pkg_delete</span>(1)</span></a> and
                   7129:                 <a href=
                   7130:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   7131:                 <span class="citerefentry"><span class=
                   7132:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   7133:                 more information.</p>
                   7134:               </dd>
                   7135: 
1.45      wiz      7136:               <dt><span class="term"><code xmlns=
                   7137:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7138:               "filename">MESSAGE</code></span></dt>
                   7139: 
                   7140:               <dd>
1.50      rillig   7141:                 <p>This file is displayed after installation of the
1.27      rillig   7142:                 package. Useful for things like legal notices on
                   7143:                 almost-free software and hints for updating config
                   7144:                 files after installing modules for apache, PHP etc.
                   7145:                 Please note that you can modify variables in it
                   7146:                 easily by using <code class=
                   7147:                 "varname">MESSAGE_SUBST</code> in the package's
1.45      wiz      7148:                 <code xmlns=
                   7149:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7150:                 "filename">Makefile</code>:</p>
1.27      rillig   7151:                 <pre class="programlisting">
1.51      rillig   7152:     MESSAGE_SUBST+=  SOMEVAR="somevalue"
1.27      rillig   7153: </pre>
                   7154: 
                   7155:                 <p>replaces "${SOMEVAR}" with &#8220;<span class=
1.45      wiz      7156:                 "quote">somevalue</span>&#8221; in <code xmlns=
                   7157:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7158:                 "filename">MESSAGE</code>.</p>
                   7159:               </dd>
                   7160:             </dl>
                   7161:           </div>
                   7162:         </div>
                   7163: 
1.67    ! hubertf  7164:         <div class="sect1" lang="en">
1.27      rillig   7165:           <div class="titlepage">
                   7166:             <div>
                   7167:               <div>
                   7168:                 <h2 class="title" style="clear: both"><a name=
1.67    ! hubertf  7169:                 "work-dir"></a>8.6.&nbsp;<code xmlns=
1.45      wiz      7170:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7171:                 "filename">work*</code></h2>
                   7172:               </div>
                   7173:             </div>
                   7174:           </div>
                   7175: 
                   7176:           <p>When you type <span><strong class=
1.47      reed     7177:           "command">make</strong></span>, the distribution files
                   7178:           are unpacked into the directory denoted by <code class=
1.45      wiz      7179:           "varname">WRKDIR</code>. It can be removed by running
                   7180:           <span><strong class="command">make clean</strong></span>.
                   7181:           Besides the sources, this directory is also used to keep
                   7182:           various timestamp files. The directory gets <span class=
                   7183:           "emphasis"><em>removed completely</em></span> on clean.
                   7184:           The default is <code xmlns=
                   7185:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   7186:           "filename">${.CURDIR}/work</code> or <code xmlns=
                   7187:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   7188:           "filename">${.CURDIR}/work.${MACHINE_ARCH}</code> if
                   7189:           <code class="varname">OBJMACHINE</code> is set.</p>
1.27      rillig   7190:         </div>
                   7191: 
1.67    ! hubertf  7192:         <div class="sect1" lang="en">
1.27      rillig   7193:           <div class="titlepage">
                   7194:             <div>
                   7195:               <div>
                   7196:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      7197:                 "files-dir"></a>8.7.&nbsp;<code xmlns=
                   7198:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7199:                 "filename">files/*</code></h2>
                   7200:               </div>
                   7201:             </div>
                   7202:           </div>
                   7203: 
                   7204:           <p>If you have any files that you wish to be placed in
                   7205:           the package prior to configuration or building, you could
                   7206:           place these files here and use a &#8220;<span class=
                   7207:           "quote">${CP}</span>&#8221; command in the
                   7208:           &#8220;<span class="quote">pre-configure</span>&#8221;
                   7209:           target to achieve this. Alternatively, you could simply
1.45      wiz      7210:           diff the file against <code xmlns=
                   7211:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7212:           "filename">/dev/null</code> and use the patch mechanism
                   7213:           to manage the creation of this file.</p>
                   7214:         </div>
                   7215:       </div>
                   7216: 
1.67    ! hubertf  7217:       <div class="chapter" lang="en">
1.27      rillig   7218:         <div class="titlepage">
                   7219:           <div>
                   7220:             <div>
1.67    ! hubertf  7221:               <h2 class="title"><a name=
1.38      dillo    7222:               "makefile"></a>Chapter&nbsp;9.&nbsp;Programming in
1.45      wiz      7223:               <code xmlns=
                   7224:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   7225:               "filename">Makefile</code>s</h2>
1.27      rillig   7226:             </div>
                   7227:           </div>
                   7228:         </div>
                   7229: 
                   7230:         <div class="toc">
                   7231:           <p><b>Table of Contents</b></p>
                   7232: 
                   7233:           <dl>
                   7234:             <dt><span class="sect1"><a href=
1.45      wiz      7235:             "#makefile.variables">9.1. <code xmlns=
                   7236:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7237:             "filename">Makefile</code> variables</a></span></dt>
                   7238: 
                   7239:             <dd>
                   7240:               <dl>
                   7241:                 <dt><span class="sect2"><a href=
1.38      dillo    7242:                 "#makefile.variables.names">9.1.1. Naming
1.27      rillig   7243:                 conventions</a></span></dt>
                   7244:               </dl>
                   7245:             </dd>
                   7246: 
1.38      dillo    7247:             <dt><span class="sect1"><a href="#makefile.code">9.2.
1.27      rillig   7248:             Code snippets</a></span></dt>
                   7249: 
                   7250:             <dd>
                   7251:               <dl>
1.30      wiz      7252:                 <dt><span class="sect2"><a href=
1.38      dillo    7253:                 "#adding-to-list">9.2.1. Adding things to a
1.30      wiz      7254:                 list</a></span></dt>
1.27      rillig   7255: 
1.30      wiz      7256:                 <dt><span class="sect2"><a href=
1.38      dillo    7257:                 "#converting-internal-to-external">9.2.2.
1.27      rillig   7258:                 Converting an internal list into an external
                   7259:                 list</a></span></dt>
                   7260: 
1.30      wiz      7261:                 <dt><span class="sect2"><a href=
1.38      dillo    7262:                 "#passing-variable-to-shell">9.2.3. Passing
1.30      wiz      7263:                 variables to a shell command</a></span></dt>
1.27      rillig   7264: 
1.30      wiz      7265:                 <dt><span class="sect2"><a href=
1.38      dillo    7266:                 "#quoting-guideline">9.2.4. Quoting
1.30      wiz      7267:                 guideline</a></span></dt>
1.27      rillig   7268: 
1.30      wiz      7269:                 <dt><span class="sect2"><a href=
1.38      dillo    7270:                 "#bsd-make-bug-workaround">9.2.5. Workaround for a
1.30      wiz      7271:                 bug in BSD Make</a></span></dt>
1.27      rillig   7272:               </dl>
                   7273:             </dd>
                   7274:           </dl>
                   7275:         </div>
                   7276: 
1.45      wiz      7277:         <p>Pkgsrc consists of many <code xmlns=
                   7278:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7279:         "filename">Makefile</code> fragments, each of which forms a
                   7280:         well-defined part of the pkgsrc system. Using the <a href=
                   7281:         "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7282:         <span class="citerefentry"><span class=
                   7283:         "refentrytitle">make</span>(1)</span></a> system as a
                   7284:         programming language for a big system like pkgsrc requires
                   7285:         some discipline to keep the code correct and
                   7286:         understandable.</p>
                   7287: 
1.45      wiz      7288:         <p>The basic ingredients for <code xmlns=
                   7289:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7290:         "filename">Makefile</code> programming are variables (which
                   7291:         are actually macros) and shell commands. Among these shell
                   7292:         commands may even be more complex ones like <a href=
                   7293:         "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
                   7294:         <span class="citerefentry"><span class=
                   7295:         "refentrytitle">awk</span>(1)</span></a> programs. To make
                   7296:         sure that every shell command runs as intended it is
                   7297:         necessary to quote all variables correctly when they are
                   7298:         used.</p>
                   7299: 
                   7300:         <p>This chapter describes some patterns, that appear quite
1.45      wiz      7301:         often in <code xmlns=
                   7302:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   7303:         "filename">Makefile</code>s, including the pitfalls that
                   7304:         come along with them.</p>
1.27      rillig   7305: 
1.67    ! hubertf  7306:         <div class="sect1" lang="en">
1.27      rillig   7307:           <div class="titlepage">
                   7308:             <div>
                   7309:               <div>
                   7310:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      7311:                 "makefile.variables"></a>9.1.&nbsp;<code xmlns=
                   7312:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7313:                 "filename">Makefile</code> variables</h2>
                   7314:               </div>
                   7315:             </div>
                   7316:           </div>
                   7317: 
1.45      wiz      7318:           <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7319:           class="filename">Makefile</code> variables contain
                   7320:           strings that can be processed using the five operators
                   7321:           ``='', ``+='', ``?='', ``:='', and ``!='', which are
                   7322:           described in the <a href=
1.27      rillig   7323:           "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7324:           <span class="citerefentry"><span class=
                   7325:           "refentrytitle">make</span>(1)</span></a> man page.</p>
                   7326: 
1.45      wiz      7327:           <p>When a variable's value is parsed from a <code xmlns=
                   7328:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7329:           "filename">Makefile</code>, the hash character ``#'' and
                   7330:           the backslash character ``\'' are handled specially. If a
                   7331:           backslash is followed by a newline, any whitespace
                   7332:           immediately in front of the backslash, the backslash, the
                   7333:           newline, and any whitespace immediately behind the
                   7334:           newline are replaced with a single space. A backspace
                   7335:           character and an immediately following hash character are
1.47      reed     7336:           replaced with a single hash character. Otherwise, the
1.27      rillig   7337:           backslash is passed as is. In a variable assignment, any
                   7338:           hash character that is not preceded by a backslash starts
                   7339:           a comment that continues upto the end of the logical
                   7340:           line.</p>
                   7341: 
                   7342:           <p><span class="emphasis"><em>Note:</em></span> Because
                   7343:           of this parsing algorithm the only way to create a
                   7344:           variable consisting of a single backslash is using the
                   7345:           ``!='' operator, for example: <code class=
                   7346:           "varname">BACKSLASH!=echo "\\"</code>.</p>
                   7347: 
                   7348:           <p>So far for defining variables. The other thing you can
                   7349:           do with variables is evaluating them. A variable is
                   7350:           evaluated when it is part of the right side of the ``:=''
                   7351:           or the ``!='' operator, or directly before executing a
                   7352:           shell command which the variable is part of. In all other
1.47      reed     7353:           cases, <a href=
1.27      rillig   7354:           "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7355:           <span class="citerefentry"><span class=
                   7356:           "refentrytitle">make</span>(1)</span></a> performs lazy
                   7357:           evaluation, that is, variables are not evaluated until
                   7358:           there's no other way. The ``modifiers'' mentioned in the
                   7359:           man page also evaluate the variable.</p>
                   7360: 
                   7361:           <p>Some of the modifiers split the string into words and
                   7362:           then operate on the words, others operate on the string
1.47      reed     7363:           as a whole. When a string is split into words, it is
                   7364:           split as you would expect it from <a href=
1.27      rillig   7365:           "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
                   7366:           <span class="citerefentry"><span class=
                   7367:           "refentrytitle">sh</span>(1)</span></a>.</p>
                   7368: 
                   7369:           <p>No rule without exception&#8212;the
                   7370:           <span><strong class="command">.for</strong></span> loop
                   7371:           does not follow the shell quoting rules but splits at
                   7372:           sequences of whitespace.</p>
                   7373: 
                   7374:           <p>There are several types of variables that should be
                   7375:           handled differently. Strings and two types of lists.</p>
                   7376: 
                   7377:           <div class="itemizedlist">
                   7378:             <ul type="disc">
                   7379:               <li>
                   7380:                 <p><span class="emphasis"><em>Strings</em></span>
1.47      reed     7381:                 can contain arbitrary characters. Nevertheless, you
1.27      rillig   7382:                 should restrict yourself to only using printable
                   7383:                 characters. Examples are <code class=
                   7384:                 "varname">PREFIX</code> and <code class=
                   7385:                 "varname">COMMENT</code>.</p>
                   7386:               </li>
                   7387: 
                   7388:               <li>
                   7389:                 <p><span class="emphasis"><em>Internal
                   7390:                 lists</em></span> are lists that are never exported
                   7391:                 to any shell command. Their elements are separated
1.47      reed     7392:                 by whitespace. Therefore, the elements themselves
1.27      rillig   7393:                 cannot have embedded whitespace. Any other
                   7394:                 characters are allowed. Internal lists can be used
                   7395:                 in <span><strong class=
                   7396:                 "command">.for</strong></span> loops. Examples are
                   7397:                 <code class="varname">DEPENDS</code> and
                   7398:                 <code class="varname">BUILD_DEPENDS</code>.</p>
                   7399:               </li>
                   7400: 
                   7401:               <li>
                   7402:                 <p><span class="emphasis"><em>External
                   7403:                 lists</em></span> are lists that may be exported to
                   7404:                 a shell command. Their elements can contain any
                   7405:                 characters, including whitespace. That's why they
                   7406:                 cannot be used in <span><strong class=
                   7407:                 "command">.for</strong></span> loops. Examples are
                   7408:                 <code class="varname">DISTFILES</code> and
                   7409:                 <code class="varname">MASTER_SITES</code>.</p>
                   7410:               </li>
                   7411:             </ul>
                   7412:           </div>
                   7413: 
1.67    ! hubertf  7414:           <div class="sect2" lang="en">
1.27      rillig   7415:             <div class="titlepage">
                   7416:               <div>
                   7417:                 <div>
                   7418:                   <h3 class="title"><a name=
1.38      dillo    7419:                   "makefile.variables.names"></a>9.1.1.&nbsp;Naming
1.27      rillig   7420:                   conventions</h3>
                   7421:                 </div>
                   7422:               </div>
                   7423:             </div>
                   7424: 
                   7425:             <div class="itemizedlist">
                   7426:               <ul type="disc">
                   7427:                 <li>
                   7428:                   <p>All variable names starting with an underscore
                   7429:                   are reserved for use by the pkgsrc
                   7430:                   infrastructure. They shall not be used by package
1.45      wiz      7431:                   <code xmlns=
                   7432:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   7433:                   "filename">Makefile</code>s.</p>
1.27      rillig   7434:                 </li>
                   7435: 
                   7436:                 <li>
                   7437:                   <p>In <span><strong class=
                   7438:                   "command">.for</strong></span> loops you should
                   7439:                   use lowercase variable names for the iteration
                   7440:                   variables.</p>
                   7441:                 </li>
                   7442: 
                   7443:                 <li>
                   7444:                   <p>All list variables should have a ``plural''
                   7445:                   name, e.g. <code class=
                   7446:                   "varname">PKG_OPTIONS</code> or <code class=
                   7447:                   "varname">DISTFILES</code>.</p>
                   7448:                 </li>
                   7449:               </ul>
                   7450:             </div>
                   7451:           </div>
                   7452:         </div>
                   7453: 
1.67    ! hubertf  7454:         <div class="sect1" lang="en">
1.27      rillig   7455:           <div class="titlepage">
                   7456:             <div>
                   7457:               <div>
                   7458:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7459:                 "makefile.code"></a>9.2.&nbsp;Code snippets</h2>
1.27      rillig   7460:               </div>
                   7461:             </div>
                   7462:           </div>
                   7463: 
                   7464:           <p>This section presents you with some code snippets you
                   7465:           should use in your own code. If you don't find anything
                   7466:           appropriate here, you should test your code and add it
                   7467:           here.</p>
                   7468: 
1.67    ! hubertf  7469:           <div class="sect2" lang="en">
1.27      rillig   7470:             <div class="titlepage">
                   7471:               <div>
                   7472:                 <div>
1.67    ! hubertf  7473:                   <h3 class="title"><a name=
1.38      dillo    7474:                   "adding-to-list"></a>9.2.1.&nbsp;Adding things to
1.30      wiz      7475:                   a list</h3>
1.27      rillig   7476:                 </div>
                   7477:               </div>
                   7478:             </div>
                   7479:             <pre class="programlisting">
1.51      rillig   7480:     STRING=                 foo * bar `date`
                   7481:     INT_LIST=               # empty
                   7482:     ANOTHER_INT_LIST=       apache-[0-9]*:../../www/apache
                   7483:     EXT_LIST=               # empty
                   7484:     ANOTHER_EXT_LIST=       a=b c=d
                   7485: 
                   7486:     INT_LIST+=              ${STRING}               # 1
                   7487:     INT_LIST+=              ${ANOTHER_INT_LIST}     # 2
                   7488:     EXT_LIST+=              ${STRING:Q}             # 3
                   7489:     EXT_LIST+=              ${ANOTHER_EXT_LIST}     # 4
1.27      rillig   7490: </pre>
                   7491: 
                   7492:             <p>When you add a string to an external list (example
                   7493:             3), it must be quoted. In all other cases, you must not
                   7494:             add a quoting level. You must not merge internal and
                   7495:             external lists, unless you are sure that all entries
                   7496:             are correctly interpreted in both lists.</p>
                   7497:           </div>
                   7498: 
1.67    ! hubertf  7499:           <div class="sect2" lang="en">
1.27      rillig   7500:             <div class="titlepage">
                   7501:               <div>
                   7502:                 <div>
1.30      wiz      7503:                   <h3 class="title"><a name=
1.38      dillo    7504:                   "converting-internal-to-external"></a>9.2.2.&nbsp;Converting
1.30      wiz      7505:                   an internal list into an external list</h3>
1.27      rillig   7506:                 </div>
                   7507:               </div>
                   7508:             </div>
                   7509:             <pre class="programlisting">
1.51      rillig   7510:     EXT_LIST=       # empty
                   7511:     .for i in ${INT_LIST}
                   7512:     EXT_LIST+=      ${i:Q}""
                   7513:     .endfor
1.27      rillig   7514: </pre>
                   7515: 
                   7516:             <p>This code converts the internal list <code class=
                   7517:             "varname">INT_LIST</code> into the external list
                   7518:             <code class="varname">EXT_LIST</code>. As the elements
                   7519:             of an internal list are unquoted they must be quoted
                   7520:             here. The reason for appending <code class=
                   7521:             "varname">""</code> is explained below.</p>
                   7522:           </div>
1.1       grant    7523: 
1.67    ! hubertf  7524:           <div class="sect2" lang="en">
1.27      rillig   7525:             <div class="titlepage">
1.1       grant    7526:               <div>
1.27      rillig   7527:                 <div>
1.30      wiz      7528:                   <h3 class="title"><a name=
1.38      dillo    7529:                   "passing-variable-to-shell"></a>9.2.3.&nbsp;Passing
1.30      wiz      7530:                   variables to a shell command</h3>
1.27      rillig   7531:                 </div>
1.1       grant    7532:               </div>
                   7533:             </div>
1.27      rillig   7534:             <pre class="programlisting">
1.51      rillig   7535:     STRING=         foo bar &lt;    &gt; * `date` $$HOME ' "
                   7536:     EXT_LIST=       string=${STRING:Q} x=second\ item
1.27      rillig   7537: 
1.51      rillig   7538:     all:
                   7539:             echo ${STRING}                  # 1
                   7540:             echo "${STRING}"                # 2
                   7541:             echo "${STRING:Q}"              # 3
                   7542:             echo ${STRING:Q}                # 4
                   7543:             echo x${STRING:Q} | sed 1s,.,,  # 5
                   7544:             env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
1.27      rillig   7545: </pre>
                   7546: 
                   7547:             <p>Example 1 leads to a syntax error in the shell, as
                   7548:             the characters are just copied.</p>
                   7549: 
                   7550:             <p>Example 2 leads to a syntax error too, and if you
                   7551:             leave out the last " character from <code class=
                   7552:             "varname">${STRING}</code>, <a href=
                   7553:             "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
                   7554:             <span class="citerefentry"><span class=
                   7555:             "refentrytitle">date</span>(1)</span></a> will be
                   7556:             executed. The <code class="varname">$HOME</code> shell
                   7557:             variable would be evaluated, too.</p>
                   7558: 
                   7559:             <p>Example 3 outputs each space character preceded by a
                   7560:             backslash (or not), depending on the implementation of
                   7561:             the <a href=
                   7562:             "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   7563:             <span class="citerefentry"><span class=
                   7564:             "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1       grant    7565: 
1.27      rillig   7566:             <p>Example 4 handles correctly every string that does
                   7567:             not start with a dash. In that case, the result depends
                   7568:             on the implementation of the <a href=
                   7569:             "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   7570:             <span class="citerefentry"><span class=
                   7571:             "refentrytitle">echo</span>(1)</span></a> command. As
                   7572:             long as you can guarantee that your input does not
1.47      reed     7573:             start with a dash, this form is appropriate.</p>
1.1       grant    7574: 
1.27      rillig   7575:             <p>Example 5 handles even the case of a leading dash
                   7576:             correctly.</p>
1.1       grant    7577: 
1.27      rillig   7578:             <p>The <code class="varname">EXT_LIST</code> does not
1.47      reed     7579:             need to be quoted because the quoting has already been
1.27      rillig   7580:             done when adding elements to the list.</p>
1.1       grant    7581: 
1.27      rillig   7582:             <p>As internal lists shall not be passed to the shell,
                   7583:             there is no example for it.</p>
1.1       grant    7584:           </div>
                   7585: 
1.67    ! hubertf  7586:           <div class="sect2" lang="en">
1.27      rillig   7587:             <div class="titlepage">
1.1       grant    7588:               <div>
1.27      rillig   7589:                 <div>
1.67    ! hubertf  7590:                   <h3 class="title"><a name=
1.38      dillo    7591:                   "quoting-guideline"></a>9.2.4.&nbsp;Quoting
1.27      rillig   7592:                   guideline</h3>
                   7593:                 </div>
1.1       grant    7594:               </div>
                   7595:             </div>
                   7596: 
1.27      rillig   7597:             <p>There are many possible sources of wrongly quoted
                   7598:             variables. This section lists some of the commonly
                   7599:             known ones.</p>
1.1       grant    7600: 
1.27      rillig   7601:             <div class="itemizedlist">
                   7602:               <ul type="disc">
                   7603:                 <li>
                   7604:                   <p>Whenever you use the value of a list, think
                   7605:                   about what happens to leading or trailing
                   7606:                   whitespace. If the list is a well-formed shell
1.47      reed     7607:                   expression, you can apply the <code class=
1.27      rillig   7608:                   "varname">:M*</code> modifier to strip leading
                   7609:                   and trailing whitespace from each word. The
                   7610:                   <code class="varname">:M</code> operator first
                   7611:                   splits its argument according to the rules of the
                   7612:                   shell, and then creates a new list consisting of
                   7613:                   all words that match the shell glob expression
                   7614:                   <code class="varname">*</code>, that is: all. One
                   7615:                   class of situations where this is needed is when
                   7616:                   adding a variable like <code class=
                   7617:                   "varname">CPPFLAGS</code> to <code class=
                   7618:                   "varname">CONFIGURE_ARGS</code>. If the configure
1.47      reed     7619:                   script invokes other configure scripts, it strips
1.27      rillig   7620:                   the leading and trailing whitespace from the
                   7621:                   variable and then passes it to the other
                   7622:                   configure scripts. But these configure scripts
                   7623:                   expect the (child) <code class=
                   7624:                   "varname">CPPFLAGS</code> variable to be the same
                   7625:                   as the parent <code class=
                   7626:                   "varname">CPPFLAGS</code>. That's why we better
                   7627:                   pass the <code class="varname">CPPFLAGS</code>
                   7628:                   value properly trimmed. And here is how we do
                   7629:                   it:</p>
                   7630:                   <pre class="programlisting">
1.51      rillig   7631:     CPPFLAGS=               # empty
                   7632:     CPPFLAGS+=              -Wundef -DPREFIX=\"${PREFIX:Q}\"
                   7633:     CPPFLAGS+=              ${MY_CPPFLAGS}
                   7634: 
                   7635:     CONFIGURE_ARGS+=        CPPFLAGS=${CPPFLAGS:M*:Q}
                   7636: 
                   7637:     all:
                   7638:             echo x${CPPFLAGS:Q}x            # leading and trailing whitespace
                   7639:             echo x${CONFIGURE_ARGS}x        # properly trimmed
1.27      rillig   7640: </pre>
                   7641:                 </li>
1.1       grant    7642: 
1.27      rillig   7643:                 <li>
                   7644:                   <p>The example above contains one bug: The
                   7645:                   <code class="varname">${PREFIX}</code> is a
                   7646:                   properly quoted shell expression, but there is
                   7647:                   the C compiler after it, which also expects a
                   7648:                   properly quoted string (this time in C syntax).
                   7649:                   The version above is therefore only correct if
                   7650:                   <code class="varname">${PREFIX}</code> does not
                   7651:                   have embedded backslashes or double quotes. If
                   7652:                   you want to allow these, you have to add another
                   7653:                   layer of quoting to each variable that is used as
                   7654:                   a C string literal. You cannot use the
                   7655:                   <code class="varname">:Q</code> operator for it,
                   7656:                   as this operator only works for the shell.</p>
                   7657:                 </li>
1.1       grant    7658: 
1.27      rillig   7659:                 <li>
1.47      reed     7660:                   <p>Whenever a variable can be empty, the
1.27      rillig   7661:                   <code class="varname">:Q</code> operator can have
                   7662:                   surprising results. Here are two completely
                   7663:                   different cases which can be solved with the same
                   7664:                   trick.</p>
                   7665:                   <pre class="programlisting">
1.51      rillig   7666:     EMPTY=                  # empty
                   7667:     empty_test:
                   7668:             for i in a ${EMPTY:Q} c; do \
                   7669:                     echo "$$i"; \
                   7670:             done
                   7671: 
                   7672:     for_test:
                   7673:     .for i in a:\ a:\test.txt
                   7674:             echo ${i:Q}
                   7675:             echo "foo"
                   7676:     .endfor
1.1       grant    7677: </pre>
                   7678: 
1.27      rillig   7679:                   <p>The first example will only print two of the
                   7680:                   three lines we might have expected. This is
                   7681:                   because <code class="varname">${EMPTY:Q}</code>
                   7682:                   expands to the empty string, which the shell
                   7683:                   cannot see. The workaround is to write
                   7684:                   <code class="varname">${EMPTY:Q}""</code>. This
                   7685:                   pattern can be often found as <code class=
                   7686:                   "varname">${TEST} -z ${VAR:Q}</code> or as
                   7687:                   <code class="varname">${TEST} -f
                   7688:                   ${FNAME:Q}</code> (both of these are wrong).</p>
                   7689: 
                   7690:                   <p>The second example will only print three lines
                   7691:                   instead of four. The first line looks like
                   7692:                   <code class="varname">a:\ echo foo</code>. This
                   7693:                   is because the backslash of the value
                   7694:                   <code class="varname">a:\</code> is interpreted
                   7695:                   as a line-continuation by <a href=
                   7696:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7697:                   <span class="citerefentry"><span class=
                   7698:                   "refentrytitle">make</span>(1)</span></a>, which
                   7699:                   makes the second line the arguments of the
                   7700:                   <a href=
                   7701:                   "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   7702:                   <span class="citerefentry"><span class=
                   7703:                   "refentrytitle">echo</span>(1)</span></a> command
                   7704:                   from the first line. To avoid this, write
                   7705:                   <code class="varname">${i:Q}""</code>.</p>
                   7706:                 </li>
                   7707:               </ul>
                   7708:             </div>
1.1       grant    7709:           </div>
                   7710: 
1.67    ! hubertf  7711:           <div class="sect2" lang="en">
1.27      rillig   7712:             <div class="titlepage">
1.1       grant    7713:               <div>
1.27      rillig   7714:                 <div>
1.30      wiz      7715:                   <h3 class="title"><a name=
1.38      dillo    7716:                   "bsd-make-bug-workaround"></a>9.2.5.&nbsp;Workaround
1.30      wiz      7717:                   for a bug in BSD Make</h3>
1.27      rillig   7718:                 </div>
1.1       grant    7719:               </div>
                   7720:             </div>
                   7721: 
1.27      rillig   7722:             <p>The pkgsrc bmake program does not handle the
                   7723:             following assignment correctly. In case <code class=
                   7724:             "varname">_othervar_</code> contains a ``-'' character,
                   7725:             one of the closing braces is included in <code class=
                   7726:             "varname">${VAR}</code> after this code executes.</p>
                   7727:             <pre class="programlisting">
1.51      rillig   7728:     VAR:=   ${VAR:N${_othervar_:C/-//}}
1.1       grant    7729: </pre>
                   7730: 
1.27      rillig   7731:             <p>For a more complex code snippet and a workaround,
                   7732:             see the package <a xmlns=
                   7733:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   7734:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
1.45      wiz      7735:             target="_top"><code xmlns="" class=
                   7736:             "filename">regress/make-quoting</code></a>, testcase
1.27      rillig   7737:             <code class="varname">bug1</code>.</p>
1.1       grant    7738:           </div>
                   7739:         </div>
                   7740:       </div>
                   7741: 
1.67    ! hubertf  7742:       <div class="chapter" lang="en">
1.1       grant    7743:         <div class="titlepage">
                   7744:           <div>
                   7745:             <div>
1.67    ! hubertf  7746:               <h2 class="title"><a name=
1.38      dillo    7747:               "plist"></a>Chapter&nbsp;10.&nbsp;PLIST issues</h2>
1.1       grant    7748:             </div>
                   7749:           </div>
                   7750:         </div>
                   7751: 
                   7752:         <div class="toc">
                   7753:           <p><b>Table of Contents</b></p>
                   7754: 
                   7755:           <dl>
1.38      dillo    7756:             <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1       grant    7757:             ID</a></span></dt>
                   7758: 
1.30      wiz      7759:             <dt><span class="sect1"><a href=
1.38      dillo    7760:             "#automatic-plist-generation">10.2. Semi-automatic
1.45      wiz      7761:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7762:             class="filename">PLIST</code>
1.14      xtraeme  7763:             generation</a></span></dt>
1.1       grant    7764: 
1.38      dillo    7765:             <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14      xtraeme  7766:             Tweaking output of <span><strong class="command">make
                   7767:             print-PLIST</strong></span></a></span></dt>
1.1       grant    7768: 
1.38      dillo    7769:             <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1       grant    7770:             Variable substitution in PLIST</a></span></dt>
                   7771: 
1.30      wiz      7772:             <dt><span class="sect1"><a href=
1.48      dillo    7773:             "#manpage-compression">10.5. Man page
                   7774:             compression</a></span></dt>
1.1       grant    7775: 
1.38      dillo    7776:             <dt><span class="sect1"><a href=
                   7777:             "#using-PLIST_SRC">10.6. Changing PLIST source with
                   7778:             <code class="varname">PLIST_SRC</code></a></span></dt>
1.1       grant    7779: 
1.30      wiz      7780:             <dt><span class="sect1"><a href=
1.47      reed     7781:             "#platform-specific-plist">10.7. Platform-specific and
1.30      wiz      7782:             differing PLISTs</a></span></dt>
1.1       grant    7783: 
1.38      dillo    7784:             <dt><span class="sect1"><a href=
                   7785:             "#faq.common-dirs">10.8. Sharing directories between
                   7786:             packages</a></span></dt>
1.1       grant    7787:           </dl>
                   7788:         </div>
                   7789: 
1.45      wiz      7790:         <p>The <code xmlns=
                   7791:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   7792:         "filename">PLIST</code> file contains a package's
                   7793:         &#8220;<span class="quote">packing list</span>&#8221;, i.e.
                   7794:         a list of files that belong to the package (relative to the
                   7795:         <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7796:         class="filename">${PREFIX}</code> directory it's been
                   7797:         installed in) plus some additional statements - see the
                   7798:         <a href=
1.1       grant    7799:         "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   7800:         <span class="citerefentry"><span class=
1.47      reed     7801:         "refentrytitle">pkg_create</span>(1)</span></a> man page
                   7802:         for a full list. This chapter addresses some issues that
                   7803:         need attention when dealing with the <code xmlns=
1.45      wiz      7804:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7805:         "filename">PLIST</code> file (or files, see below!).</p>
1.1       grant    7806: 
1.67    ! hubertf  7807:         <div class="sect1" lang="en">
1.1       grant    7808:           <div class="titlepage">
                   7809:             <div>
                   7810:               <div>
                   7811:                 <h2 class="title" style="clear: both"><a name=
1.67    ! hubertf  7812:                 "rcs-id"></a>10.1.&nbsp;RCS ID</h2>
1.1       grant    7813:               </div>
                   7814:             </div>
                   7815:           </div>
                   7816: 
                   7817:           <p>Be sure to add a RCS ID line as the first thing in any
1.45      wiz      7818:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7819:           class="filename">PLIST</code> file you write:</p>
1.1       grant    7820:           <pre class="programlisting">
1.51      rillig   7821:     @comment $NetBSD$
1.1       grant    7822: </pre>
                   7823:         </div>
                   7824: 
1.67    ! hubertf  7825:         <div class="sect1" lang="en">
1.1       grant    7826:           <div class="titlepage">
                   7827:             <div>
                   7828:               <div>
                   7829:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7830:                 "automatic-plist-generation"></a>10.2.&nbsp;Semi-automatic
1.45      wiz      7831:                 <code xmlns=
                   7832:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7833:                 "filename">PLIST</code> generation</h2>
1.1       grant    7834:               </div>
                   7835:             </div>
                   7836:           </div>
                   7837: 
1.14      xtraeme  7838:           <p>You can use the <span><strong class="command">make
                   7839:           print-PLIST</strong></span> command to output a PLIST
                   7840:           that matches any new files since the package was
                   7841:           extracted. See <a href="#build.helpful-targets" title=
1.56      rillig   7842:           "14.16.&nbsp;Other helpful targets">Section&nbsp;14.16,
1.1       grant    7843:           &#8220;Other helpful targets&#8221;</a> for more
                   7844:           information on this target.</p>
                   7845:         </div>
                   7846: 
1.67    ! hubertf  7847:         <div class="sect1" lang="en">
1.1       grant    7848:           <div class="titlepage">
                   7849:             <div>
                   7850:               <div>
                   7851:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7852:                 "print-PLIST"></a>10.3.&nbsp;Tweaking output of
1.14      xtraeme  7853:                 <span><strong class="command">make
                   7854:                 print-PLIST</strong></span></h2>
1.1       grant    7855:               </div>
                   7856:             </div>
                   7857:           </div>
                   7858: 
                   7859:           <p>If you have used any of the *-dirs packages, as
                   7860:           explained in <a href="#faq.common-dirs" title=
1.38      dillo    7861:           "10.8.&nbsp;Sharing directories between packages">Section&nbsp;10.8,
1.1       grant    7862:           &#8220;Sharing directories between packages&#8221;</a>,
1.14      xtraeme  7863:           you may have noticed that <span><strong class=
                   7864:           "command">make print-PLIST</strong></span> outputs a set
                   7865:           of <code class="varname">@comment</code>s instead of real
                   7866:           <code class="varname">@dirrm</code> lines. You can also
                   7867:           do this for specific directories and files, so that the
                   7868:           results of that command are very close to reality. This
                   7869:           helps <span class="emphasis"><em>a lot</em></span> during
                   7870:           the update of packages.</p>
                   7871: 
                   7872:           <p>The <code class="varname">PRINT_PLIST_AWK</code>
                   7873:           variable takes a set of AWK patterns and actions that are
                   7874:           used to filter the output of print-PLIST. You can
                   7875:           <span class="emphasis"><em>append</em></span> any chunk
                   7876:           of AWK scripting you like to it, but be careful with
1.1       grant    7877:           quoting.</p>
                   7878: 
1.45      wiz      7879:           <p>For example, to get all files inside the <code xmlns=
                   7880:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7881:           "filename">libdata/foo</code> directory removed from the
1.1       grant    7882:           resulting PLIST:</p>
                   7883:           <pre class="programlisting">
1.51      rillig   7884:     PRINT_PLIST_AWK+=       /^libdata\/foo/ { next; }
1.1       grant    7885: </pre>
                   7886: 
1.14      xtraeme  7887:           <p>And to get all the <code class="varname">@dirrm</code>
1.1       grant    7888:           lines referring to a specific (shared) directory
1.14      xtraeme  7889:           converted to <code class="varname">@comment</code>s:</p>
1.1       grant    7890:           <pre class="programlisting">
1.51      rillig   7891:     PRINT_PLIST_AWK+=       /^@dirrm share\/specific/ { print "@comment " $$0; next; }
1.1       grant    7892: </pre>
                   7893:         </div>
                   7894: 
1.67    ! hubertf  7895:         <div class="sect1" lang="en">
1.1       grant    7896:           <div class="titlepage">
                   7897:             <div>
                   7898:               <div>
                   7899:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7900:                 "plist.misc"></a>10.4.&nbsp;Variable substitution
                   7901:                 in PLIST</h2>
1.1       grant    7902:               </div>
                   7903:             </div>
                   7904:           </div>
                   7905: 
                   7906:           <p>A number of variables are substituted automatically in
                   7907:           PLISTs when a package is installed on a system. This
                   7908:           includes the following variables:</p>
                   7909: 
                   7910:           <div class="variablelist">
                   7911:             <dl>
1.14      xtraeme  7912:               <dt><span class="term"><code class=
                   7913:               "varname">${MACHINE_ARCH}</code>, <code class=
                   7914:               "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1       grant    7915: 
                   7916:               <dd>
                   7917:                 <p>Some packages like emacs and perl embed
                   7918:                 information about which architecture they were
                   7919:                 built on into the pathnames where they install
1.47      reed     7920:                 their files. To handle this case, PLIST will be
1.1       grant    7921:                 preprocessed before actually used, and the symbol
1.14      xtraeme  7922:                 &#8220;<span class="quote"><code class=
                   7923:                 "varname">${MACHINE_ARCH}</code></span>&#8221; will
                   7924:                 be replaced by what <span><strong class=
                   7925:                 "command">uname -p</strong></span> gives. The same
                   7926:                 is done if the string <code class=
                   7927:                 "varname">${MACHINE_GNU_ARCH}</code> is embedded in
                   7928:                 PLIST somewhere - use this on packages that have
1.47      reed     7929:                 GNU autoconf-created configure scripts.</p>
1.1       grant    7930: 
                   7931:                 <div class="note" style=
                   7932:                 "margin-left: 0.5in; margin-right: 0.5in;">
                   7933:                   <h3 class="title">Legacy note</h3>
                   7934: 
                   7935:                   <p>There used to be a symbol &#8220;<span class=
1.14      xtraeme  7936:                   "quote"><code class=
                   7937:                   "varname">$ARCH</code></span>&#8221; that was
                   7938:                   replaced by the output of <span><strong class=
                   7939:                   "command">uname -m</strong></span>, but that's no
1.1       grant    7940:                   longer supported and has been removed.</p>
                   7941:                 </div>
                   7942:               </dd>
                   7943: 
1.14      xtraeme  7944:               <dt><span class="term"><code class=
                   7945:               "varname">${OPSYS}</code>, <code class=
                   7946:               "varname">${LOWER_OPSYS}</code>, <code class=
                   7947:               "varname">${OS_VERSION}</code></span></dt>
1.1       grant    7948: 
                   7949:               <dd>
                   7950:                 <p>Some packages want to embed the OS name and
                   7951:                 version into some paths. To do this, use these
1.45      wiz      7952:                 variables in the <code xmlns=
                   7953:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7954:                 "filename">PLIST</code>:</p>
1.1       grant    7955: 
                   7956:                 <div class="itemizedlist">
                   7957:                   <ul type="disc">
                   7958:                     <li>
1.14      xtraeme  7959:                       <p><code class="varname">${OPSYS}</code> -
                   7960:                       output of &#8220;<span class=
                   7961:                       "quote"><span><strong class="command">uname
                   7962:                       -s</strong></span></span>&#8221;</p>
1.1       grant    7963:                     </li>
                   7964: 
                   7965:                     <li>
1.14      xtraeme  7966:                       <p><code class=
                   7967:                       "varname">${LOWER_OPSYS}</code> - lowercase
                   7968:                       common name (eg. &#8220;<span class=
                   7969:                       "quote">solaris</span>&#8221;)</p>
1.1       grant    7970:                     </li>
                   7971: 
                   7972:                     <li>
1.14      xtraeme  7973:                       <p><code class="varname">${OS_VERSION}</code>
                   7974:                       - &#8220;<span class=
                   7975:                       "quote"><span><strong class="command">uname
                   7976:                       -r</strong></span></span>&#8221;</p>
1.1       grant    7977:                     </li>
                   7978:                   </ul>
                   7979:                 </div>
                   7980:               </dd>
                   7981: 
1.14      xtraeme  7982:               <dt><span class="term"><code class=
                   7983:               "varname">${PKGLOCALEDIR}</code></span></dt>
1.1       grant    7984: 
                   7985:               <dd>
                   7986:                 <p>Packages that install locale files should list
                   7987:                 them in the PLIST as &#8220;<span class=
                   7988:                 "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>&#8221;
                   7989:                 instead of &#8220;<span class=
                   7990:                 "quote">share/locale/de/LC_MESSAGES/...</span>&#8221;.
                   7991:                 This properly handles the fact that different
                   7992:                 operating systems expect locale files to be either
1.45      wiz      7993:                 in <code xmlns=
                   7994:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7995:                 "filename">share</code> or <code xmlns=
                   7996:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7997:                 "filename">lib</code> by default.</p>
1.1       grant    7998:               </dd>
                   7999:             </dl>
                   8000:           </div>
                   8001: 
                   8002:           <p>For a complete list of values which are replaced by
1.45      wiz      8003:           default, please look in <code xmlns=
                   8004:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8005:           "filename">bsd.pkg.mk</code> (and search for <span class=
1.1       grant    8006:           "emphasis"><em>PLIST_SUBST</em></span>).</p>
                   8007: 
                   8008:           <p>If you want to change other variables not listed
                   8009:           above, you can add variables and their expansions to this
1.14      xtraeme  8010:           variable in the following way, similar to <code class=
                   8011:           "varname">MESSAGE_SUBST</code> (see <a href=
1.1       grant    8012:           "#components.optional" title=
1.38      dillo    8013:           "8.5.&nbsp;Optional files">Section&nbsp;8.5,
1.1       grant    8014:           &#8220;Optional files&#8221;</a>):</p>
                   8015:           <pre class="programlisting">
1.51      rillig   8016:     PLIST_SUBST+=   SOMEVAR="somevalue"
1.1       grant    8017: </pre>
                   8018: 
                   8019:           <p>This replaces all occurrences of &#8220;<span class=
                   8020:           "quote">${SOMEVAR}</span>&#8221; in the PLIST with
                   8021:           &#8220;<span class="quote">somevalue</span>&#8221;.</p>
                   8022:         </div>
                   8023: 
1.67    ! hubertf  8024:         <div class="sect1" lang="en">
1.1       grant    8025:           <div class="titlepage">
                   8026:             <div>
                   8027:               <div>
                   8028:                 <h2 class="title" style="clear: both"><a name=
1.48      dillo    8029:                 "manpage-compression"></a>10.5.&nbsp;Man page
                   8030:                 compression</h2>
1.1       grant    8031:               </div>
                   8032:             </div>
                   8033:           </div>
                   8034: 
1.47      reed     8035:           <p>Man pages should be installed in compressed form if
1.45      wiz      8036:           <code class="varname">MANZ</code> is set (in <code xmlns=
                   8037:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8038:           "filename">bsd.own.mk</code>), and uncompressed
1.45      wiz      8039:           otherwise. To handle this in the <code xmlns=
                   8040:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8041:           "filename">PLIST</code> file, the suffix
                   8042:           &#8220;<span class="quote">.gz</span>&#8221; is
1.47      reed     8043:           appended/removed automatically for man pages according to
1.14      xtraeme  8044:           <code class="varname">MANZ</code> and <code class=
                   8045:           "varname">MANCOMPRESSED</code> being set or not, see
1.45      wiz      8046:           above for details. This modification of the <code xmlns=
                   8047:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8048:           "filename">PLIST</code> file is done on a copy of it, not
1.45      wiz      8049:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8050:           class="filename">PLIST</code> itself.</p>
1.1       grant    8051:         </div>
                   8052: 
1.67    ! hubertf  8053:         <div class="sect1" lang="en">
1.1       grant    8054:           <div class="titlepage">
                   8055:             <div>
                   8056:               <div>
                   8057:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8058:                 "using-PLIST_SRC"></a>10.6.&nbsp;Changing PLIST
1.30      wiz      8059:                 source with <code class=
1.14      xtraeme  8060:                 "varname">PLIST_SRC</code></h2>
1.1       grant    8061:               </div>
                   8062:             </div>
                   8063:           </div>
                   8064: 
1.14      xtraeme  8065:           <p>To use one or more files as source for the
1.45      wiz      8066:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8067:           class="filename">PLIST</code> used in generating the
                   8068:           binary package, set the variable <code class=
1.14      xtraeme  8069:           "varname">PLIST_SRC</code> to the names of that file(s).
1.24      wiz      8070:           The files are later concatenated using <a href=
                   8071:           "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
                   8072:           <span class="citerefentry"><span class=
                   8073:           "refentrytitle">cat</span>(1)</span></a>, and order of
                   8074:           things is important.</p>
1.1       grant    8075:         </div>
                   8076: 
1.67    ! hubertf  8077:         <div class="sect1" lang="en">
1.1       grant    8078:           <div class="titlepage">
                   8079:             <div>
                   8080:               <div>
                   8081:                 <h2 class="title" style="clear: both"><a name=
1.47      reed     8082:                 "platform-specific-plist"></a>10.7.&nbsp;Platform-specific
                   8083:                 and differing PLISTs</h2>
1.1       grant    8084:               </div>
                   8085:             </div>
                   8086:           </div>
                   8087: 
                   8088:           <p>Some packages decide to install a different set of
                   8089:           files based on the operating system being used. These
                   8090:           differences can be automatically handled by using the
                   8091:           following files:</p>
                   8092: 
                   8093:           <div class="itemizedlist">
                   8094:             <ul type="disc">
                   8095:               <li>
1.45      wiz      8096:                 <p><code xmlns=
                   8097:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8098:                 "filename">PLIST.common</code></p>
1.1       grant    8099:               </li>
                   8100: 
                   8101:               <li>
1.45      wiz      8102:                 <p><code xmlns=
                   8103:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8104:                 "filename">PLIST.${OPSYS}</code></p>
1.1       grant    8105:               </li>
                   8106: 
                   8107:               <li>
1.45      wiz      8108:                 <p><code xmlns=
                   8109:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.21      ben      8110:                 "filename">PLIST.${MACHINE_ARCH}</code></p>
                   8111:               </li>
                   8112: 
                   8113:               <li>
1.45      wiz      8114:                 <p><code xmlns=
                   8115:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.21      ben      8116:                 "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
                   8117:               </li>
                   8118: 
                   8119:               <li>
1.45      wiz      8120:                 <p><code xmlns=
                   8121:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8122:                 "filename">PLIST.common_end</code></p>
1.1       grant    8123:               </li>
                   8124:             </ul>
                   8125:           </div>
                   8126:         </div>
                   8127: 
1.67    ! hubertf  8128:         <div class="sect1" lang="en">
1.1       grant    8129:           <div class="titlepage">
                   8130:             <div>
                   8131:               <div>
                   8132:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8133:                 "faq.common-dirs"></a>10.8.&nbsp;Sharing
                   8134:                 directories between packages</h2>
1.1       grant    8135:               </div>
                   8136:             </div>
                   8137:           </div>
                   8138: 
                   8139:           <p>A &#8220;<span class="quote">shared
                   8140:           directory</span>&#8221; is a directory where multiple
                   8141:           (and unrelated) packages install files. These directories
                   8142:           are problematic because you have to add special tricks in
                   8143:           the PLIST to conditionally remove them, or have some
                   8144:           centralized package handle them.</p>
                   8145: 
                   8146:           <p>Within pkgsrc, you'll find both approaches. If a
                   8147:           directory is shared by a few unrelated packages, it's
                   8148:           often not worth to add an extra package to remove it.
                   8149:           Therefore, one simply does:</p>
                   8150:           <pre class="programlisting">
1.51      rillig   8151:     @unexec ${RMDIR} %D/path/to/shared/directory 2&gt;/dev/null || ${TRUE}
1.1       grant    8152: </pre>
                   8153: 
                   8154:           <p>in the PLISTs of all affected packages, instead of the
                   8155:           regular "@dirrm" line.</p>
                   8156: 
                   8157:           <p>However, if the directory is shared across many
                   8158:           packages, two different solutions are available:</p>
                   8159: 
                   8160:           <div class="orderedlist">
                   8161:             <ol type="1">
                   8162:               <li>
                   8163:                 <p>If the packages have a common dependency, the
                   8164:                 directory can be removed in that. For example, see
                   8165:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8166:                 href=
                   8167:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.45      wiz      8168:                 target="_top"><code xmlns="" class=
                   8169:                 "filename">textproc/scrollkeeper</code></a>, which
                   8170:                 removes the shared directory <code xmlns=
                   8171:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      8172:                 "filename">share/omf</code>.</p>
1.1       grant    8173:               </li>
                   8174: 
                   8175:               <li>
                   8176:                 <p>If the packages using the directory are not
                   8177:                 related at all (they have no common dependencies),
                   8178:                 a *-dirs package is used.</p>
                   8179:               </li>
                   8180:             </ol>
                   8181:           </div>
                   8182: 
                   8183:           <p>From now on, we'll discuss the second solution. To get
                   8184:           an idea of the *-dirs packages available, issue:</p>
                   8185:           <pre class="programlisting">
1.51      rillig   8186:     <code class="prompt">%</code> cd .../pkgsrc
                   8187:     <code class="prompt">%</code> ls -d */*-dirs
1.1       grant    8188: </pre>
                   8189: 
                   8190:           <p>Their use from other packages is very simple. The
1.14      xtraeme  8191:           <code class="varname">USE_DIRS</code> variable takes a
                   8192:           list of package names (without the &#8220;<span class=
1.1       grant    8193:           "quote">-dirs</span>&#8221; part) together with the
                   8194:           required version number (always pick the latest one when
1.34      wiz      8195:           writing new packages).</p>
1.1       grant    8196: 
                   8197:           <p>For example, if a package installs files under
1.45      wiz      8198:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8199:           class="filename">share/applications</code>, it should
                   8200:           have the following line in it:</p>
1.1       grant    8201:           <pre class="programlisting">
1.51      rillig   8202:     USE_DIRS+=      xdg-1.1
1.1       grant    8203: </pre>
                   8204: 
1.14      xtraeme  8205:           <p>After regenerating the PLIST using
                   8206:           <span><strong class="command">make
                   8207:           print-PLIST</strong></span>, you should get the right
                   8208:           (commented out) lines.</p>
1.1       grant    8209: 
1.47      reed     8210:           <p>Note that even if your package is using <code xmlns=
1.45      wiz      8211:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8212:           "filename">$X11BASE</code>, it must not depend on the
1.1       grant    8213:           *-x11-dirs packages. Just specify the name without that
1.45      wiz      8214:           part and pkgsrc (in particular, <code xmlns=
                   8215:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8216:           "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1       grant    8217:         </div>
                   8218:       </div>
                   8219: 
1.67    ! hubertf  8220:       <div class="chapter" lang="en">
1.1       grant    8221:         <div class="titlepage">
                   8222:           <div>
                   8223:             <div>
1.67    ! hubertf  8224:               <h2 class="title"><a name=
1.38      dillo    8225:               "buildlink"></a>Chapter&nbsp;11.&nbsp;Buildlink
1.1       grant    8226:               methodology</h2>
                   8227:             </div>
                   8228:           </div>
                   8229:         </div>
                   8230: 
                   8231:         <div class="toc">
                   8232:           <p><b>Table of Contents</b></p>
                   8233: 
                   8234:           <dl>
1.30      wiz      8235:             <dt><span class="sect1"><a href=
1.38      dillo    8236:             "#converting-to-buildlink3">11.1. Converting packages
1.30      wiz      8237:             to use buildlink3</a></span></dt>
1.1       grant    8238: 
1.30      wiz      8239:             <dt><span class="sect1"><a href=
1.45      wiz      8240:             "#creating-buildlink3.mk">11.2. Writing <code xmlns=
                   8241:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      8242:             "filename">buildlink3.mk</code> files</a></span></dt>
1.1       grant    8243: 
                   8244:             <dd>
                   8245:               <dl>
1.25      rillig   8246:                 <dt><span class="sect2"><a href=
1.38      dillo    8247:                 "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30      wiz      8248:                 buildlink3.mk file</a></span></dt>
1.1       grant    8249: 
1.25      rillig   8250:                 <dt><span class="sect2"><a href=
1.38      dillo    8251:                 "#updating-buildlink-depends">11.2.2. Updating
1.30      wiz      8252:                 <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14      xtraeme  8253:                 "replaceable"><code>pkg</code></em></code> in
1.45      wiz      8254:                 <code xmlns=
                   8255:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8256:                 "filename">buildlink3.mk</code>
1.1       grant    8257:                 files</a></span></dt>
                   8258:               </dl>
                   8259:             </dd>
                   8260: 
1.30      wiz      8261:             <dt><span class="sect1"><a href=
1.45      wiz      8262:             "#writing-builtin.mk">11.3. Writing <code xmlns=
                   8263:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      8264:             "filename">builtin.mk</code> files</a></span></dt>
1.1       grant    8265: 
                   8266:             <dd>
                   8267:               <dl>
1.25      rillig   8268:                 <dt><span class="sect2"><a href=
1.38      dillo    8269:                 "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45      wiz      8270:                 <code xmlns=
                   8271:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8272:                 "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    8273: 
1.25      rillig   8274:                 <dt><span class="sect2"><a href=
1.38      dillo    8275:                 "#native-or-pkgsrc-preference">11.3.2. Global
1.30      wiz      8276:                 preferences for native or pkgsrc
                   8277:                 software</a></span></dt>
1.1       grant    8278:               </dl>
                   8279:             </dd>
                   8280:           </dl>
                   8281:         </div>
                   8282: 
                   8283:         <p>Buildlink is a framework in pkgsrc that controls what
                   8284:         headers and libraries are seen by a package's configure and
                   8285:         build processes. This is implemented in a two step
                   8286:         process:</p>
                   8287: 
                   8288:         <div class="orderedlist">
                   8289:           <ol type="1">
                   8290:             <li>
                   8291:               <p>Symlink headers and libraries for dependencies
1.14      xtraeme  8292:               into <code class="varname">BUILDLINK_DIR</code>,
                   8293:               which by default is a subdirectory of <code class=
                   8294:               "varname">WRKDIR</code>.</p>
1.1       grant    8295:             </li>
                   8296: 
                   8297:             <li>
                   8298:               <p>Create wrapper scripts that are used in place of
1.14      xtraeme  8299:               the normal compiler tools that translate <code class=
                   8300:               "option">-I${LOCALBASE}/include</code> and
                   8301:               <code class="option">-L${LOCALBASE}/lib</code> into
                   8302:               references to <code class=
                   8303:               "varname">BUILDLINK_DIR</code>. The wrapper scripts
                   8304:               also make native compiler on some operating systems
                   8305:               look like GCC, so that packages that expect GCC won't
                   8306:               require modifications to build with those native
                   8307:               compilers.</p>
1.1       grant    8308:             </li>
                   8309:           </ol>
                   8310:         </div>
                   8311: 
                   8312:         <p>This normalizes the environment in which a package is
                   8313:         built so that the package may be built consistently despite
                   8314:         what other software may be installed. Please note that the
1.45      wiz      8315:         normal system header and library paths, e.g. <code xmlns=
                   8316:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   8317:         "filename">/usr/include</code>, <code xmlns=
                   8318:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8319:         "filename">/usr/lib</code>, etc., are always searched --
1.1       grant    8320:         buildlink3 is designed to insulate the package build from
                   8321:         non-system-supplied software.</p>
                   8322: 
1.67    ! hubertf  8323:         <div class="sect1" lang="en">
1.1       grant    8324:           <div class="titlepage">
                   8325:             <div>
                   8326:               <div>
                   8327:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8328:                 "converting-to-buildlink3"></a>11.1.&nbsp;Converting
1.30      wiz      8329:                 packages to use buildlink3</h2>
1.1       grant    8330:               </div>
                   8331:             </div>
                   8332:           </div>
                   8333: 
                   8334:           <p>The process of converting packages to use the
                   8335:           buildlink3 framework (&#8220;<span class=
                   8336:           "quote">bl3ifying</span>&#8221;) is fairly
                   8337:           straightforward. The things to keep in mind are:</p>
                   8338: 
                   8339:           <div class="orderedlist">
                   8340:             <ol type="1">
                   8341:               <li>
                   8342:                 <p>Ensure that the build always calls the wrapper
                   8343:                 scripts instead of the actual toolchain. Some
                   8344:                 packages are tricky, and the only way to know for
1.45      wiz      8345:                 sure is the check <code xmlns=
                   8346:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8347:                 "filename">${WRKDIR}/.work.log</code> to see if the
1.1       grant    8348:                 wrappers are being invoked.</p>
                   8349:               </li>
                   8350: 
                   8351:               <li>
1.14      xtraeme  8352:                 <p>Don't override <code class=
                   8353:                 "varname">PREFIX</code> from within the package
                   8354:                 Makefile, e.g. Java VMs, standalone shells, etc.,
1.45      wiz      8355:                 because the code to symlink files into <code xmlns=
                   8356:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8357:                 "filename">${BUILDLINK_DIR}</code> looks for files
1.1       grant    8358:                 relative to &#8220;<span class="quote">pkg_info -qp
1.14      xtraeme  8359:                 <em class=
                   8360:                 "replaceable"><code>pkgname</code></em></span>&#8221;.</p>
1.1       grant    8361:               </li>
                   8362: 
                   8363:               <li>
                   8364:                 <p>Remember that <span class=
1.45      wiz      8365:                 "emphasis"><em>only</em></span> the <code xmlns=
                   8366:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8367:                 "filename">buildlink3.mk</code> files that you list
1.1       grant    8368:                 in a package's Makefile are added as dependencies
                   8369:                 for that package.</p>
                   8370:               </li>
                   8371:             </ol>
                   8372:           </div>
                   8373: 
                   8374:           <p>If a dependency on a particular package is required
                   8375:           for its libraries and headers, then we replace:</p>
                   8376:           <pre class="programlisting">
1.51      rillig   8377:     DEPENDS+=   foo&gt;=1.1.0:../../category/foo
1.1       grant    8378: </pre>
                   8379: 
                   8380:           <p>with</p>
                   8381:           <pre class="programlisting">
1.51      rillig   8382:     .include "../../category/foo/buildlink3.mk"
1.1       grant    8383: </pre>
                   8384: 
1.47      reed     8385:           <p>The buildlink3.mk files usually define the required
                   8386:           dependencies. If you need a newer version of the
                   8387:           dependency when using buildlink3.mk files, then you can
                   8388:           define it in your Makefile; for example:</p>
                   8389:           <pre class="programlisting">
1.51      rillig   8390:     BUILDLINK_DEPENDS.foo+=   foo&gt;=1.1.0
                   8391:     .include "../../category/foo/buildlink3.mk"
1.47      reed     8392: </pre>
                   8393: 
1.45      wiz      8394:           <p>There are several <code xmlns=
                   8395:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   8396:           "filename">buildlink3.mk</code> files in <code xmlns=
                   8397:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8398:           "filename">pkgsrc/mk</code> that handle special package
1.1       grant    8399:           issues:</p>
                   8400: 
                   8401:           <div class="itemizedlist">
                   8402:             <ul type="disc">
                   8403:               <li>
1.45      wiz      8404:                 <p><code xmlns=
                   8405:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8406:                 "filename">bdb.buildlink3.mk</code> chooses either
                   8407:                 the native or a pkgsrc Berkeley DB implementation
                   8408:                 based on the values of <code class=
1.14      xtraeme  8409:                 "varname">BDB_ACCEPTED</code> and <code class=
                   8410:                 "varname">BDB_DEFAULT</code>.</p>
1.1       grant    8411:               </li>
                   8412: 
                   8413:               <li>
1.45      wiz      8414:                 <p><code xmlns=
                   8415:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     8416:                 "filename">curses.buildlink3.mk</code>: If the
1.14      xtraeme  8417:                 system comes with neither Curses nor NCurses, this
                   8418:                 will take care to install the <a xmlns=
                   8419:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    8420:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.45      wiz      8421:                 target="_top"><code xmlns="" class=
                   8422:                 "filename">devel/ncurses</code></a> package.</p>
1.1       grant    8423:               </li>
                   8424: 
                   8425:               <li>
1.45      wiz      8426:                 <p><code xmlns=
                   8427:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8428:                 "filename">krb5.buildlink3.mk</code> uses the value
                   8429:                 of <code class="varname">KRB5_ACCEPTED</code> to
                   8430:                 choose between adding a dependency on Heimdal or
                   8431:                 MIT-krb5 for packages that require a Kerberos 5
1.1       grant    8432:                 implementation.</p>
                   8433:               </li>
                   8434: 
                   8435:               <li>
1.45      wiz      8436:                 <p><code xmlns=
                   8437:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8438:                 "filename">motif.buildlink3.mk</code> checks for a
                   8439:                 system-provided Motif installation or adds a
                   8440:                 dependency on <a xmlns=
1.1       grant    8441:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8442:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.45      wiz      8443:                 target="_top"><code xmlns="" class=
                   8444:                 "filename">x11/lesstif</code></a> or <a xmlns=
1.20      ben      8445:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8446:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
1.45      wiz      8447:                 target="_top"><code xmlns="" class=
1.47      reed     8448:                 "filename">x11/openmotif</code></a>.</p>
1.1       grant    8449:               </li>
                   8450: 
                   8451:               <li>
1.45      wiz      8452:                 <p><code xmlns=
                   8453:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8454:                 "filename">ossaudio.buildlink3.mk</code> defines
                   8455:                 several variables that may be used by packages that
1.47      reed     8456:                 use the Open Sound System (OSS) API.</p>
1.1       grant    8457:               </li>
                   8458: 
                   8459:               <li>
1.45      wiz      8460:                 <p><code xmlns=
                   8461:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8462:                 "filename">pgsql.buildlink3.mk</code> will accept
                   8463:                 either Postgres 7.3 or 7.4, whichever is found
                   8464:                 installed. See the file for more information.</p>
1.1       grant    8465:               </li>
                   8466: 
                   8467:               <li>
1.45      wiz      8468:                 <p><code xmlns=
                   8469:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8470:                 "filename">pthread.buildlink3.mk</code> uses the
                   8471:                 value of <code class="varname">PTHREAD_OPTS</code>
                   8472:                 and checks for native pthreads or adds a dependency
                   8473:                 on <a xmlns=
1.1       grant    8474:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8475:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.45      wiz      8476:                 target="_top"><code xmlns="" class=
1.47      reed     8477:                 "filename">devel/pth</code></a> as needed.</p>
1.1       grant    8478:               </li>
                   8479: 
                   8480:               <li>
1.45      wiz      8481:                 <p><code xmlns=
                   8482:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8483:                 "filename">xaw.buildlink3.mk</code> uses the value
                   8484:                 of <code class="varname">XAW_TYPE</code> to choose
                   8485:                 a particular Athena widgets library.</p>
1.1       grant    8486:               </li>
                   8487:             </ul>
                   8488:           </div>
                   8489: 
1.45      wiz      8490:           <p>The comments in those <code xmlns=
                   8491:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8492:           "filename">buildlink3.mk</code> files provide a more
1.1       grant    8493:           complete description of how to use them properly.</p>
                   8494:         </div>
                   8495: 
1.67    ! hubertf  8496:         <div class="sect1" lang="en">
1.1       grant    8497:           <div class="titlepage">
                   8498:             <div>
                   8499:               <div>
                   8500:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8501:                 "creating-buildlink3.mk"></a>11.2.&nbsp;Writing
1.45      wiz      8502:                 <code xmlns=
                   8503:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8504:                 "filename">buildlink3.mk</code> files</h2>
1.1       grant    8505:               </div>
                   8506:             </div>
                   8507:           </div>
                   8508: 
1.45      wiz      8509:           <p>A package's <code xmlns=
                   8510:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8511:           "filename">buildlink3.mk</code> file is included by
                   8512:           Makefiles to indicate the need to compile and link
                   8513:           against header files and libraries provided by the
1.45      wiz      8514:           package. A <code xmlns=
                   8515:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   8516:           "filename">buildlink3.mk</code> file should always
                   8517:           provide enough information to add the correct type of
                   8518:           dependency relationship and include any other
                   8519:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8520:           class="filename">buildlink3.mk</code> files that it needs
                   8521:           to find headers and libraries that it needs in turn.</p>
1.1       grant    8522: 
1.45      wiz      8523:           <p>To generate an initial <code xmlns=
                   8524:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8525:           "filename">buildlink3.mk</code> file for further editing,
1.1       grant    8526:           Rene Hexel's <a xmlns=
                   8527:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   8528:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.45      wiz      8529:           target="_top"><code xmlns="" class=
                   8530:           "filename">pkgtools/createbuildlink</code></a> package is
1.20      ben      8531:           highly recommended. For most packages, the following
                   8532:           command will generate a good starting point for
1.45      wiz      8533:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8534:           class="filename">buildlink3.mk</code> files:</p>
1.1       grant    8535:           <pre class="screen">
1.14      xtraeme  8536: <code class="prompt">%</code> <strong class=
                   8537: "userinput"><code>cd pkgsrc/<em class=
                   8538: "replaceable"><code>category</code></em>/<em class=
                   8539: "replaceable"><code>pkgdir</code></em>
                   8540: <code class=
1.49      rillig   8541: "prompt">%</code> createbuildlink &gt;buildlink3.mk</code></strong>
1.1       grant    8542: </pre>
                   8543: 
1.67    ! hubertf  8544:           <div class="sect2" lang="en">
1.1       grant    8545:             <div class="titlepage">
                   8546:               <div>
                   8547:                 <div>
1.67    ! hubertf  8548:                   <h3 class="title"><a name=
        !          8549:                   "anatomy-of-bl3"></a>11.2.1.&nbsp;Anatomy of a
1.25      rillig   8550:                   buildlink3.mk file</h3>
1.1       grant    8551:                 </div>
                   8552:               </div>
                   8553:             </div>
                   8554: 
1.45      wiz      8555:             <p>The following real-life example <code xmlns=
                   8556:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8557:             "filename">buildlink3.mk</code> is taken from
1.45      wiz      8558:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8559:             class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1       grant    8560:             <pre class="programlisting">
1.51      rillig   8561:     # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1       grant    8562: 
1.51      rillig   8563:     BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH}+
                   8564:     TIFF_BUILDLINK3_MK:=    ${TIFF_BUILDLINK3_MK}+
1.1       grant    8565: 
1.51      rillig   8566:     .if !empty(BUILDLINK_DEPTH:M+)
                   8567:     BUILDLINK_DEPENDS+=     tiff
                   8568:     .endif
1.1       grant    8569: 
1.51      rillig   8570:     BUILDLINK_PACKAGES:=    ${BUILDLINK_PACKAGES:Ntiff}
                   8571:     BUILDLINK_PACKAGES+=    tiff
1.1       grant    8572: 
1.51      rillig   8573:     .if !empty(TIFF_BUILDLINK3_MK:M+)
                   8574:     BUILDLINK_DEPENDS.tiff+=        tiff&gt;=3.6.1
                   8575:     BUILDLINK_PKGSRCDIR.tiff?=      ../../graphics/tiff
                   8576:     .endif  # TIFF_BUILDLINK3_MK
1.1       grant    8577: 
1.51      rillig   8578:     .include "../../devel/zlib/buildlink3.mk"
                   8579:     .include "../../graphics/jpeg/buildlink3.mk"
1.1       grant    8580: 
1.51      rillig   8581:     BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH:S/+$//}
1.1       grant    8582: </pre>
                   8583: 
1.14      xtraeme  8584:             <p>The header and footer manipulate <code class=
                   8585:             "varname">BUILDLINK_DEPTH</code>, which is common
1.45      wiz      8586:             across all <code xmlns=
                   8587:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8588:             "filename">buildlink3.mk</code> files and is used to
                   8589:             track at what depth we are including <code xmlns=
                   8590:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8591:             "filename">buildlink3.mk</code> files.</p>
1.1       grant    8592: 
                   8593:             <p>The first section controls if the dependency on
1.14      xtraeme  8594:             <em class="replaceable"><code>pkg</code></em> is added.
                   8595:             <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1       grant    8596:             global list of packages for which dependencies are
                   8597:             added by buildlink3.</p>
                   8598: 
                   8599:             <p>The second section advises pkgsrc that the
1.45      wiz      8600:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8601:             class="filename">buildlink3.mk</code> file for
1.14      xtraeme  8602:             <em class="replaceable"><code>pkg</code></em> has been
                   8603:             included at some point. <code class=
                   8604:             "varname">BUILDLINK_PACKAGES</code> is the global list
1.45      wiz      8605:             of packages for which <code xmlns=
                   8606:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8607:             "filename">buildlink3.mk</code> files have been
                   8608:             included. It must <span class=
                   8609:             "emphasis"><em>always</em></span> be appended to within
1.45      wiz      8610:             a <code xmlns=
                   8611:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8612:             "filename">buildlink3.mk</code> file.</p>
1.1       grant    8613: 
                   8614:             <p>The third section is protected from multiple
1.14      xtraeme  8615:             inclusion and controls how the dependency on <em class=
                   8616:             "replaceable"><code>pkg</code></em> is added. Several
1.1       grant    8617:             important variables are set in the section:</p>
                   8618: 
                   8619:             <div class="itemizedlist">
                   8620:               <ul type="disc">
                   8621:                 <li>
1.14      xtraeme  8622:                   <p><code class=
                   8623:                   "varname">BUILDLINK_DEPENDS.<em class=
                   8624:                   "replaceable"><code>pkg</code></em></code> is the
                   8625:                   actual dependency recorded in the installed
                   8626:                   package; this should always be set using
                   8627:                   <span><strong class="command">+=</strong></span>
                   8628:                   to ensure that we're appending to any
                   8629:                   pre-existing list of values. This variable should
                   8630:                   be set to the first version of the package that
                   8631:                   had the last change in the major number of a
                   8632:                   shared library or that had a major API
                   8633:                   change.</p>
1.1       grant    8634:                 </li>
                   8635: 
                   8636:                 <li>
1.14      xtraeme  8637:                   <p><code class=
                   8638:                   "varname">BUILDLINK_PKGSRCDIR.<em class=
                   8639:                   "replaceable"><code>pkg</code></em></code> is the
                   8640:                   location of the <em class=
                   8641:                   "replaceable"><code>pkg</code></em> pkgsrc
1.47      reed     8642:                   directory.</p>
1.1       grant    8643:                 </li>
                   8644: 
                   8645:                 <li>
1.14      xtraeme  8646:                   <p><code class=
                   8647:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   8648:                   "replaceable"><code>pkg</code></em></code> (not
                   8649:                   shown above) controls whether we use <code class=
                   8650:                   "varname">BUILD_DEPENDS</code> or <code class=
                   8651:                   "varname">DEPENDS</code> to add the dependency on
                   8652:                   <em class="replaceable"><code>pkg</code></em>.
                   8653:                   The build dependency is selected by setting
                   8654:                   <code class=
                   8655:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   8656:                   "replaceable"><code>pkg</code></em></code> to
1.1       grant    8657:                   &#8220;<span class="quote">build</span>&#8221;.
                   8658:                   By default, the full dependency is used.</p>
                   8659:                 </li>
                   8660: 
                   8661:                 <li>
1.14      xtraeme  8662:                   <p><code class=
                   8663:                   "varname">BUILDLINK_INCDIRS.<em class=
                   8664:                   "replaceable"><code>pkg</code></em></code> and
                   8665:                   <code class=
1.67    ! hubertf  8666:                   "varname">BUILDLINK_LIBDIRS.<em class="replaceable"><code>pkg</code></em></code>
        !          8667:                   (not shown above) are lists of subdirectories of
        !          8668:                   <code xmlns=
1.45      wiz      8669:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8670:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8671:                   "replaceable"><code>pkg</code></em>}</code> to
                   8672:                   add to the header and library search paths. These
1.1       grant    8673:                   default to &#8220;<span class=
                   8674:                   "quote">include</span>&#8221; and
                   8675:                   &#8220;<span class="quote">lib</span>&#8221;
                   8676:                   respectively.</p>
                   8677:                 </li>
                   8678: 
                   8679:                 <li>
1.14      xtraeme  8680:                   <p><code class=
                   8681:                   "varname">BUILDLINK_CPPFLAGS.<em class=
                   8682:                   "replaceable"><code>pkg</code></em></code> (not
                   8683:                   shown above) is the list of preprocessor flags to
                   8684:                   add to <code class="varname">CPPFLAGS</code>,
                   8685:                   which are passed on to the configure and build
                   8686:                   phases. The &#8220;<span class=
                   8687:                   "quote">-I</span>&#8221; option should be avoided
                   8688:                   and instead be handled using <code class=
                   8689:                   "varname">BUILDLINK_INCDIRS.<em class=
                   8690:                   "replaceable"><code>pkg</code></em></code> as
                   8691:                   above.</p>
1.1       grant    8692:                 </li>
                   8693:               </ul>
                   8694:             </div>
                   8695: 
                   8696:             <p>The following variables are all optionally defined
                   8697:             within this second section (protected against multiple
                   8698:             inclusion) and control which package files are
1.45      wiz      8699:             symlinked into <code xmlns=
                   8700:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8701:             "filename">${BUILDLINK_DIR}</code> and how their names
1.1       grant    8702:             are transformed during the symlinking:</p>
                   8703: 
                   8704:             <div class="itemizedlist">
                   8705:               <ul type="disc">
                   8706:                 <li>
1.14      xtraeme  8707:                   <p><code class=
                   8708:                   "varname">BUILDLINK_FILES.<em class=
                   8709:                   "replaceable"><code>pkg</code></em></code> (not
                   8710:                   shown above) is a shell glob pattern relative to
1.45      wiz      8711:                   <code xmlns=
                   8712:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8713:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8714:                   "replaceable"><code>pkg</code></em>}</code> to be
1.45      wiz      8715:                   symlinked into <code xmlns=
                   8716:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8717:                   "filename">${BUILDLINK_DIR}</code>, e.g.
1.45      wiz      8718:                   <code xmlns=
                   8719:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8720:                   "filename">include/*.h</code>.</p>
1.1       grant    8721:                 </li>
                   8722: 
                   8723:                 <li>
1.14      xtraeme  8724:                   <p><code class=
                   8725:                   "varname">BUILDLINK_FILES_CMD.<em class=
                   8726:                   "replaceable"><code>pkg</code></em></code> (not
                   8727:                   shown above) is a shell pipeline that outputs to
1.45      wiz      8728:                   stdout a list of files relative to <code xmlns=
                   8729:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8730:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8731:                   "replaceable"><code>pkg</code></em>}</code>. The
1.1       grant    8732:                   resulting files are to be symlinked into
1.45      wiz      8733:                   <code xmlns=
                   8734:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8735:                   "filename">${BUILDLINK_DIR}</code>. By default,
                   8736:                   this takes the <code xmlns=
                   8737:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8738:                   "filename">+CONTENTS</code> of a <em class=
                   8739:                   "replaceable"><code>pkg</code></em> and filters
                   8740:                   it through <code class=
                   8741:                   "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
                   8742:                   "replaceable"><code>pkg</code></em>}</code>.</p>
1.1       grant    8743:                 </li>
                   8744: 
                   8745:                 <li>
1.14      xtraeme  8746:                   <p><code class=
                   8747:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   8748:                   "replaceable"><code>pkg</code></em></code> (not
                   8749:                   shown above) is a filter command that filters
1.45      wiz      8750:                   <code xmlns=
                   8751:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8752:                   "filename">+CONTENTS</code> input into a list of
                   8753:                   files relative to <code xmlns=
                   8754:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8755:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8756:                   "replaceable"><code>pkg</code></em>}</code> on
                   8757:                   stdout. By default for overwrite packages,
                   8758:                   <code class=
                   8759:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   8760:                   "replaceable"><code>pkg</code></em></code>
1.45      wiz      8761:                   outputs the contents of the <code xmlns=
                   8762:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8763:                   "filename">include</code> and <code xmlns=
                   8764:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8765:                   "filename">lib</code> directories in the package
1.45      wiz      8766:                   <code xmlns=
                   8767:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8768:                   "filename">+CONTENTS</code>, and for pkgviews
                   8769:                   packages, it outputs any libtool archives in
                   8770:                   <code xmlns=
                   8771:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8772:                   "filename">lib</code> directories.</p>
1.1       grant    8773:                 </li>
                   8774: 
                   8775:                 <li>
1.14      xtraeme  8776:                   <p><code class=
                   8777:                   "varname">BUILDLINK_TRANSFORM.<em class=
                   8778:                   "replaceable"><code>pkg</code></em></code> (not
                   8779:                   shown above) is a list of sed arguments used to
1.1       grant    8780:                   transform the name of the source filename into a
1.14      xtraeme  8781:                   destination filename, e.g. <span><strong class=
1.1       grant    8782:                   "command">-e
1.14      xtraeme  8783:                   "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1       grant    8784:                 </li>
                   8785:               </ul>
                   8786:             </div>
                   8787: 
1.45      wiz      8788:             <p>The last section includes any <code xmlns=
                   8789:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8790:             "filename">buildlink3.mk</code> needed for <em class=
                   8791:             "replaceable"><code>pkg</code></em>'s library
1.45      wiz      8792:             dependencies. Including these <code xmlns=
                   8793:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8794:             "filename">buildlink3.mk</code> files means that the
                   8795:             headers and libraries for these dependencies are also
1.45      wiz      8796:             symlinked into <code xmlns=
                   8797:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8798:             "filename">${BUILDLINK_DIR}</code> whenever the
                   8799:             <em class="replaceable"><code>pkg</code></em>
1.45      wiz      8800:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8801:             class="filename">buildlink3.mk</code> file is
1.14      xtraeme  8802:             included.</p>
1.1       grant    8803:           </div>
                   8804: 
1.67    ! hubertf  8805:           <div class="sect2" lang="en">
1.1       grant    8806:             <div class="titlepage">
                   8807:               <div>
                   8808:                 <div>
1.30      wiz      8809:                   <h3 class="title"><a name=
1.67    ! hubertf  8810:                   "updating-buildlink-depends"></a>11.2.2.&nbsp;Updating
1.30      wiz      8811:                   <code class=
1.67    ! hubertf  8812:                   "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
        !          8813:                   in <code xmlns=
1.45      wiz      8814:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      8815:                   "filename">buildlink3.mk</code> files</h3>
1.1       grant    8816:                 </div>
                   8817:               </div>
                   8818:             </div>
                   8819: 
                   8820:             <p>There are two situations that require increasing the
1.14      xtraeme  8821:             dependency listed in <code class=
                   8822:             "varname">BUILDLINK_DEPENDS.<em class=
                   8823:             "replaceable"><code>pkg</code></em></code> after a
                   8824:             package update:</p>
1.1       grant    8825: 
                   8826:             <div class="orderedlist">
                   8827:               <ol type="1">
                   8828:                 <li>
                   8829:                   <p>if the sonames (major number of the library
                   8830:                   version) of any installed shared libraries
1.47      reed     8831:                   change.</p>
1.1       grant    8832:                 </li>
                   8833: 
                   8834:                 <li>
                   8835:                   <p>if the API or interface to the header files
                   8836:                   change.</p>
                   8837:                 </li>
                   8838:               </ol>
                   8839:             </div>
                   8840: 
1.14      xtraeme  8841:             <p>In these cases, <code class=
                   8842:             "varname">BUILDLINK_DEPENDS.<em class=
                   8843:             "replaceable"><code>pkg</code></em></code> should be
                   8844:             adjusted to require at least the new package version.
                   8845:             In some cases, the packages that depend on this new
                   8846:             version may need their <code class=
                   8847:             "varname">PKGREVISION</code>s increased and, if they
1.45      wiz      8848:             have <code xmlns=
                   8849:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8850:             "filename">buildlink3.mk</code> files, their
                   8851:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   8852:             "replaceable"><code>pkg</code></em></code> adjusted,
                   8853:             too. This is needed so that binary packages made using
                   8854:             it will require the correct package dependency and not
                   8855:             settle for an older one which will not contain the
                   8856:             necessary shared libraries.</p>
1.1       grant    8857: 
                   8858:             <p>Please take careful consideration before adjusting
1.14      xtraeme  8859:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   8860:             "replaceable"><code>pkg</code></em></code> as we don't
                   8861:             want to cause unneeded package deletions and rebuilds.
                   8862:             In many cases, new versions of packages work just fine
                   8863:             with older dependencies. See <a href="#dependencies"
1.67    ! hubertf  8864:             title=
        !          8865:             "15.1.4.&nbsp;Handling dependencies">Section&nbsp;15.1.4,
        !          8866:             &#8220;Handling dependencies&#8221;</a> for more
        !          8867:             information about dependencies on other packages,
1.25      rillig   8868:             including the <code class=
                   8869:             "varname">BUILDLINK_RECOMMENDED</code> and <code class=
                   8870:             "varname">RECOMMENDED</code> definitions.</p>
1.1       grant    8871:           </div>
                   8872:         </div>
                   8873: 
1.67    ! hubertf  8874:         <div class="sect1" lang="en">
1.1       grant    8875:           <div class="titlepage">
                   8876:             <div>
                   8877:               <div>
                   8878:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8879:                 "writing-builtin.mk"></a>11.3.&nbsp;Writing
1.45      wiz      8880:                 <code xmlns=
                   8881:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8882:                 "filename">builtin.mk</code> files</h2>
1.1       grant    8883:               </div>
                   8884:             </div>
                   8885:           </div>
                   8886: 
                   8887:           <p>Some packages in pkgsrc install headers and libraries
                   8888:           that coincide with headers and libraries present in the
1.45      wiz      8889:           base system. Aside from a <code xmlns=
                   8890:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8891:           "filename">buildlink3.mk</code> file, these packages
1.45      wiz      8892:           should also include a <code xmlns=
                   8893:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8894:           "filename">builtin.mk</code> file that includes the
                   8895:           necessary checks to decide whether using the built-in
                   8896:           software or the pkgsrc software is appropriate.</p>
1.1       grant    8897: 
                   8898:           <p>The only requirements of a builtin.mk file for
1.14      xtraeme  8899:           <em class="replaceable"><code>pkg</code></em> are:</p>
1.1       grant    8900: 
                   8901:           <div class="orderedlist">
                   8902:             <ol type="1">
                   8903:               <li>
1.14      xtraeme  8904:                 <p>It should set <code class=
                   8905:                 "varname">USE_BUILTIN.<em class=
                   8906:                 "replaceable"><code>pkg</code></em></code> to
                   8907:                 either &#8220;<span class="quote">yes</span>&#8221;
                   8908:                 or &#8220;<span class="quote">no</span>&#8221;
                   8909:                 after it is included.</p>
1.1       grant    8910:               </li>
                   8911: 
                   8912:               <li>
                   8913:                 <p>It should <span class=
                   8914:                 "emphasis"><em>not</em></span> override any
1.14      xtraeme  8915:                 <code class="varname">USE_BUILTIN.<em class=
                   8916:                 "replaceable"><code>pkg</code></em></code> which is
1.45      wiz      8917:                 already set before the <code xmlns=
                   8918:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8919:                 "filename">builtin.mk</code> file is included.</p>
1.1       grant    8920:               </li>
                   8921: 
                   8922:               <li>
                   8923:                 <p>It should be written to allow multiple
                   8924:                 inclusion. This is <span class=
                   8925:                 "emphasis"><em>very</em></span> important and takes
1.45      wiz      8926:                 careful attention to <code xmlns=
                   8927:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8928:                 "filename">Makefile</code> coding.</p>
1.1       grant    8929:               </li>
                   8930:             </ol>
                   8931:           </div>
                   8932: 
1.67    ! hubertf  8933:           <div class="sect2" lang="en">
1.1       grant    8934:             <div class="titlepage">
                   8935:               <div>
                   8936:                 <div>
1.67    ! hubertf  8937:                   <h3 class="title"><a name=
1.38      dillo    8938:                   "anatomy-of-builtin.mk"></a>11.3.1.&nbsp;Anatomy
1.45      wiz      8939:                   of a <code xmlns=
                   8940:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8941:                   "filename">builtin.mk</code> file</h3>
1.1       grant    8942:                 </div>
                   8943:               </div>
                   8944:             </div>
                   8945: 
                   8946:             <p>The following is the recommended template for
                   8947:             builtin.mk files:</p>
                   8948:             <pre class="programlisting">
1.51      rillig   8949:     .if !defined(IS_BUILTIN.foo)
                   8950:     #
                   8951:     # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
                   8952:     # genuinely exists in the system or not.
                   8953:     #
                   8954:     IS_BUILTIN.foo?=        no
                   8955: 
                   8956:     # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
                   8957:     # version can be determined.
                   8958:     #
                   8959:     .  if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
                   8960:     BUILTIN_PKG.foo?=       foo-1.0
                   8961:     .  endif
                   8962:     .endif  # IS_BUILTIN.foo
                   8963: 
                   8964:     .if !defined(USE_BUILTIN.foo)
                   8965:     USE_BUILTIN.foo?=       ${IS_BUILTIN.foo}
                   8966:     .  if defined(BUILTIN_PKG.foo)
                   8967:     .    for _depend_ in ${BUILDLINK_DEPENDS.foo}
                   8968:     .      if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
                   8969:     USE_BUILTIN.foo!=                                                       \
                   8970:           if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then     \
                   8971:                   ${ECHO} "yes";                                            \
                   8972:           else                                                              \
                   8973:                   ${ECHO} "no";                                             \
                   8974:           fi
                   8975:     .      endif
                   8976:     .    endfor
                   8977:     .  endif
                   8978:     .endif  # USE_BUILTIN.foo
                   8979: 
                   8980:     CHECK_BUILTIN.foo?=     no
                   8981:     .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
                   8982:     #
                   8983:     # Here we place code that depends on whether USE_BUILTIN.foo is set to
                   8984:     # "yes" or "no".
                   8985:     #
                   8986:     .endif  # CHECK_BUILTIN.foo
1.1       grant    8987: </pre>
                   8988: 
1.14      xtraeme  8989:             <p>The first section sets <code class=
                   8990:             "varname">IS_BUILTIN.<em class=
                   8991:             "replaceable"><code>pkg</code></em></code> depending on
                   8992:             if <em class="replaceable"><code>pkg</code></em> really
                   8993:             exists in the base system. This should not be a base
                   8994:             system software with similar functionality to
                   8995:             <em class="replaceable"><code>pkg</code></em>; it
                   8996:             should only be &#8220;<span class=
                   8997:             "quote">yes</span>&#8221; if the actual package is
                   8998:             included as part of the base system. This variable is
1.45      wiz      8999:             only used internally within the <code xmlns=
                   9000:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9001:             "filename">builtin.mk</code> file.</p>
                   9002: 
                   9003:             <p>The second section sets <code class=
                   9004:             "varname">BUILTIN_PKG.<em class=
                   9005:             "replaceable"><code>pkg</code></em></code> to the
                   9006:             version of <em class=
                   9007:             "replaceable"><code>pkg</code></em> in the base system
                   9008:             if it exists (if <code class=
                   9009:             "varname">IS_BUILTIN.<em class=
                   9010:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    9011:             &#8220;<span class="quote">yes</span>&#8221;). This
1.14      xtraeme  9012:             variable is only used internally within the
1.45      wiz      9013:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9014:             class="filename">builtin.mk</code> file.</p>
1.1       grant    9015: 
1.14      xtraeme  9016:             <p>The third section sets <code class=
                   9017:             "varname">USE_BUILTIN.<em class=
                   9018:             "replaceable"><code>pkg</code></em></code> and is
                   9019:             <span class="emphasis"><em>required</em></span> in all
1.45      wiz      9020:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9021:             class="filename">builtin.mk</code> files. The code in
                   9022:             this section must make the determination whether the
                   9023:             built-in software is adequate to satisfy the
                   9024:             dependencies listed in <code class=
1.14      xtraeme  9025:             "varname">BUILDLINK_DEPENDS.<em class=
                   9026:             "replaceable"><code>pkg</code></em></code>. This is
                   9027:             typically done by comparing <code class=
                   9028:             "varname">BUILTIN_PKG.<em class=
                   9029:             "replaceable"><code>pkg</code></em></code> against each
                   9030:             of the dependencies in <code class=
                   9031:             "varname">BUILDLINK_DEPENDS.<em class=
                   9032:             "replaceable"><code>pkg</code></em></code>.
                   9033:             <code class="varname">USE_BUILTIN.<em class=
                   9034:             "replaceable"><code>pkg</code></em></code> <span class=
1.1       grant    9035:             "emphasis"><em>must</em></span> be set to the correct
1.45      wiz      9036:             value by the end of the <code xmlns=
                   9037:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9038:             "filename">builtin.mk</code> file. Note that
                   9039:             <code class="varname">USE_BUILTIN.<em class=
                   9040:             "replaceable"><code>pkg</code></em></code> may be
1.1       grant    9041:             &#8220;<span class="quote">yes</span>&#8221; even if
1.14      xtraeme  9042:             <code class="varname">IS_BUILTIN.<em class=
                   9043:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    9044:             &#8220;<span class="quote">no</span>&#8221; because we
                   9045:             may make the determination that the built-in version of
                   9046:             the software is similar enough to be used as a
                   9047:             replacement.</p>
                   9048: 
1.14      xtraeme  9049:             <p>The last section is guarded by <code class=
                   9050:             "varname">CHECK_BUILTIN.<em class=
                   9051:             "replaceable"><code>pkg</code></em></code>, and
                   9052:             includes code that uses the value of <code class=
                   9053:             "varname">USE_BUILTIN.<em class=
                   9054:             "replaceable"><code>pkg</code></em></code> set in the
                   9055:             previous section. This typically includes, e.g., adding
1.1       grant    9056:             additional dependency restrictions and listing
1.45      wiz      9057:             additional files to symlink into <code xmlns=
                   9058:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9059:             "filename">${BUILDLINK_DIR}</code> (via <code class=
                   9060:             "varname">BUILDLINK_FILES.<em class=
                   9061:             "replaceable"><code>pkg</code></em></code>).</p>
1.1       grant    9062:           </div>
                   9063: 
1.67    ! hubertf  9064:           <div class="sect2" lang="en">
1.1       grant    9065:             <div class="titlepage">
                   9066:               <div>
                   9067:                 <div>
1.30      wiz      9068:                   <h3 class="title"><a name=
1.38      dillo    9069:                   "native-or-pkgsrc-preference"></a>11.3.2.&nbsp;Global
1.30      wiz      9070:                   preferences for native or pkgsrc software</h3>
1.1       grant    9071:                 </div>
                   9072:               </div>
                   9073:             </div>
                   9074: 
                   9075:             <p>When building packages, it's possible to choose
                   9076:             whether to set a global preference for using either the
                   9077:             built-in (native) version or the pkgsrc version of
                   9078:             software to satisfy a dependency. This is controlled by
1.14      xtraeme  9079:             setting <code class="varname">PREFER_PKGSRC</code> and
                   9080:             <code class="varname">PREFER_NATIVE</code>. These
                   9081:             variables take values of either &#8220;<span class=
1.1       grant    9082:             "quote">yes</span>&#8221;, &#8220;<span class=
                   9083:             "quote">no</span>&#8221;, or a list of packages.
1.14      xtraeme  9084:             <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
                   9085:             to use the pkgsrc versions of software, while
                   9086:             <code class="varname">PREFER_NATIVE</code> tells pkgsrc
                   9087:             to use the built-in versions. Preferences are
                   9088:             determined by the most specific instance of the package
                   9089:             in either <code class="varname">PREFER_PKGSRC</code> or
                   9090:             <code class="varname">PREFER_NATIVE</code>. If a
                   9091:             package is specified in neither or in both variables,
                   9092:             then <code class="varname">PREFER_PKGSRC</code> has
                   9093:             precedence over <code class=
                   9094:             "varname">PREFER_NATIVE</code>. For example, to require
                   9095:             using pkgsrc versions of software for all but the most
                   9096:             basic bits on a NetBSD system, you can set:</p>
1.1       grant    9097:             <pre class="programlisting">
1.51      rillig   9098:     PREFER_PKGSRC=  yes
                   9099:     PREFER_NATIVE=  getopt skey tcp_wrappers
1.1       grant    9100: </pre>
                   9101: 
                   9102:             <p>A package <span class=
1.45      wiz      9103:             "emphasis"><em>must</em></span> have a <code xmlns=
                   9104:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9105:             "filename">builtin.mk</code> file to be listed in
                   9106:             <code class="varname">PREFER_NATIVE</code>, otherwise
                   9107:             it is simply ignored in that list.</p>
1.1       grant    9108:           </div>
                   9109:         </div>
                   9110:       </div>
                   9111: 
1.67    ! hubertf  9112:       <div class="chapter" lang="en">
1.1       grant    9113:         <div class="titlepage">
                   9114:           <div>
                   9115:             <div>
1.67    ! hubertf  9116:               <h2 class="title"><a name=
1.38      dillo    9117:               "pkginstall"></a>Chapter&nbsp;12.&nbsp;The pkginstall
1.35      jmmv     9118:               framework</h2>
1.1       grant    9119:             </div>
                   9120:           </div>
                   9121:         </div>
                   9122: 
                   9123:         <div class="toc">
                   9124:           <p><b>Table of Contents</b></p>
                   9125: 
                   9126:           <dl>
1.30      wiz      9127:             <dt><span class="sect1"><a href=
1.38      dillo    9128:             "#files-and-dirs-outside-prefix">12.1. Files and
1.35      jmmv     9129:             directories outside the installation
                   9130:             prefix</a></span></dt>
                   9131: 
                   9132:             <dd>
                   9133:               <dl>
                   9134:                 <dt><span class="sect2"><a href=
1.38      dillo    9135:                 "#dirs-outside-prefix">12.1.1. Directory
1.35      jmmv     9136:                 manipulation</a></span></dt>
                   9137: 
                   9138:                 <dt><span class="sect2"><a href=
1.38      dillo    9139:                 "#files-outside-prefix">12.1.2. File
1.35      jmmv     9140:                 manipulation</a></span></dt>
                   9141:               </dl>
                   9142:             </dd>
                   9143: 
1.38      dillo    9144:             <dt><span class="sect1"><a href="#conf-files">12.2.
1.35      jmmv     9145:             Configuration files</a></span></dt>
                   9146: 
                   9147:             <dd>
                   9148:               <dl>
                   9149:                 <dt><span class="sect2"><a href=
1.38      dillo    9150:                 "#conf-files-sysconfdir">12.2.1. How <code class=
1.35      jmmv     9151:                 "varname">PKG_SYSCONFDIR</code> is
                   9152:                 set</a></span></dt>
                   9153: 
                   9154:                 <dt><span class="sect2"><a href=
1.38      dillo    9155:                 "#conf-files-configure">12.2.2. Telling the
1.47      reed     9156:                 software where configuration files
1.35      jmmv     9157:                 are</a></span></dt>
                   9158: 
                   9159:                 <dt><span class="sect2"><a href=
1.38      dillo    9160:                 "#conf-files-patching">12.2.3. Patching
1.35      jmmv     9161:                 installations</a></span></dt>
                   9162: 
                   9163:                 <dt><span class="sect2"><a href=
1.38      dillo    9164:                 "#conf-files-disable">12.2.4. Disabling handling of
1.35      jmmv     9165:                 configuration files</a></span></dt>
                   9166:               </dl>
                   9167:             </dd>
                   9168: 
1.38      dillo    9169:             <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35      jmmv     9170:             System startup scripts</a></span></dt>
                   9171: 
                   9172:             <dd>
                   9173:               <dl>
                   9174:                 <dt><span class="sect2"><a href=
1.38      dillo    9175:                 "#rcd-scripts-disable">12.3.1. Disabling handling
1.35      jmmv     9176:                 of system startup scripts</a></span></dt>
                   9177:               </dl>
                   9178:             </dd>
1.1       grant    9179: 
1.30      wiz      9180:             <dt><span class="sect1"><a href=
1.38      dillo    9181:             "#users-and-groups">12.4. System users and
1.35      jmmv     9182:             groups</a></span></dt>
                   9183: 
1.38      dillo    9184:             <dt><span class="sect1"><a href="#shells">12.5. System
1.35      jmmv     9185:             shells</a></span></dt>
                   9186: 
                   9187:             <dd>
                   9188:               <dl>
                   9189:                 <dt><span class="sect2"><a href=
1.65      hubertf  9190:                 "#shells-disable">12.5.1. Disabling shell
                   9191:                 registration</a></span></dt>
                   9192:               </dl>
                   9193:             </dd>
                   9194: 
                   9195:             <dt><span class="sect1"><a href="#fonts">12.6.
                   9196:             Fonts</a></span></dt>
                   9197: 
                   9198:             <dd>
                   9199:               <dl>
                   9200:                 <dt><span class="sect2"><a href=
                   9201:                 "#fonts-disable">12.6.1. Disabling automatic update
                   9202:                 of the fonts databases</a></span></dt>
1.35      jmmv     9203:               </dl>
                   9204:             </dd>
1.1       grant    9205:           </dl>
                   9206:         </div>
                   9207: 
1.35      jmmv     9208:         <p>This chapter describes the framework known as
                   9209:         <code class="literal">pkginstall</code>, whose key features
                   9210:         are:</p>
                   9211: 
                   9212:         <div class="itemizedlist">
                   9213:           <ul type="disc">
                   9214:             <li>
                   9215:               <p>Generic installation and manipulation of
                   9216:               directories and files outside the pkgsrc-handled
                   9217:               tree, <code class="varname">LOCALBASE</code>.</p>
                   9218:             </li>
                   9219: 
                   9220:             <li>
                   9221:               <p>Automatic handling of configuration files during
                   9222:               installation, provided that packages are correctly
                   9223:               designed.</p>
                   9224:             </li>
                   9225: 
                   9226:             <li>
                   9227:               <p>Generation and installation of system startup
                   9228:               scripts.</p>
                   9229:             </li>
                   9230: 
                   9231:             <li>
                   9232:               <p>Registration of system users and groups.</p>
                   9233:             </li>
                   9234: 
                   9235:             <li>
                   9236:               <p>Registration of system shells.</p>
                   9237:             </li>
1.65      hubertf  9238: 
                   9239:             <li>
                   9240:               <p>Automatic updating of fonts databases.</p>
                   9241:             </li>
1.35      jmmv     9242:           </ul>
                   9243:         </div>
                   9244: 
                   9245:         <p>The following sections inspect each of the above points
1.65      hubertf  9246:         in detail.</p>
1.35      jmmv     9247: 
                   9248:         <p>You may be thinking that many of the things described
                   9249:         here could be easily done with simple code in the package's
                   9250:         post-installation target (<code class=
                   9251:         "literal">post-install</code>). <span class=
                   9252:         "emphasis"><em>This is incorrect</em></span>, as the code
                   9253:         in them is only executed when building from source.
                   9254:         Machines using binary packages could not benefit from it at
                   9255:         all (as the code itself could be unavailable). Therefore,
                   9256:         the only way to achieve any of the items described above is
                   9257:         by means of the installation scripts, which are
                   9258:         automatically generated by pkginstall.</p>
1.1       grant    9259: 
1.67    ! hubertf  9260:         <div class="sect1" lang="en">
1.1       grant    9261:           <div class="titlepage">
                   9262:             <div>
                   9263:               <div>
                   9264:                 <h2 class="title" style="clear: both"><a name=
1.63      dillo    9265:                 "files-and-dirs-outside-prefix"></a>12.1.&nbsp;Files
                   9266:                 and directories outside the installation
                   9267:                 prefix</h2>
1.1       grant    9268:               </div>
                   9269:             </div>
                   9270:           </div>
                   9271: 
1.45      wiz      9272:           <p>As you already know, the <code xmlns=
                   9273:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9274:           "filename">PLIST</code> file holds a list of files and
                   9275:           directories that belong to a package. The names used in
1.45      wiz      9276:           it are relative to the installation prefix (<code xmlns=
                   9277:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9278:           "filename">${PREFIX}</code>), which means that it cannot
                   9279:           register files outside this directory (absolute path
                   9280:           names are not allowed). Despite this restriction, some
                   9281:           packages need to install files outside this location;
1.45      wiz      9282:           e.g., under <code xmlns=
                   9283:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   9284:           "filename">${VARBASE}</code> or <code xmlns=
                   9285:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   9286:           "filename">${PKG_SYSCONFDIR}</code>.</p>
1.35      jmmv     9287: 
                   9288:           <p>The only way to achieve this is to create such files
                   9289:           during installation time by using the installation
                   9290:           scripts. These scripts can run arbitrary commands, so
                   9291:           they have the potential to create and manage files
1.47      reed     9292:           anywhere in the file system. Here is where pkginstall
1.35      jmmv     9293:           comes into play: it provides generic scripts to abstract
                   9294:           the manipulation of such files and directories based on
1.45      wiz      9295:           variables set in the package's <code xmlns=
                   9296:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9297:           "filename">Makefile</code>. The rest of this section
1.47      reed     9298:           describes these variables.</p>
1.1       grant    9299: 
1.67    ! hubertf  9300:           <div class="sect2" lang="en">
1.35      jmmv     9301:             <div class="titlepage">
1.1       grant    9302:               <div>
1.35      jmmv     9303:                 <div>
1.67    ! hubertf  9304:                   <h3 class="title"><a name=
1.63      dillo    9305:                   "dirs-outside-prefix"></a>12.1.1.&nbsp;Directory
1.35      jmmv     9306:                   manipulation</h3>
                   9307:                 </div>
1.1       grant    9308:               </div>
                   9309:             </div>
                   9310: 
1.35      jmmv     9311:             <p>The following variables can be set to request the
1.47      reed     9312:             creation of directories anywhere in the file
                   9313:             system:</p>
1.27      rillig   9314: 
1.35      jmmv     9315:             <div class="itemizedlist">
                   9316:               <ul type="disc">
                   9317:                 <li>
                   9318:                   <p><code class="varname">MAKE_DIRS</code> and
                   9319:                   <code class="varname">OWN_DIRS</code> contain a
                   9320:                   list of directories that should be created and
                   9321:                   should attempt to be destroyed by the
                   9322:                   installation scripts. The difference between the
                   9323:                   two is that the latter prompts the administrator
                   9324:                   to remove any directories that may be left after
                   9325:                   deinstallation (because they were not empty),
                   9326:                   while the former does not.</p>
                   9327:                 </li>
1.1       grant    9328: 
1.35      jmmv     9329:                 <li>
                   9330:                   <p><code class="varname">MAKE_DIRS_PERMS</code>
                   9331:                   and <code class="varname">OWN_DIRS_PERMS</code>
                   9332:                   contain a list of tuples describing which
                   9333:                   directories should be created and should attempt
                   9334:                   to be destroyed by the installation scripts. Each
                   9335:                   tuple holds the following values, separated by
                   9336:                   spaces: the directory name, its owner, its group
                   9337:                   and its numerical mode. For example:</p>
                   9338:                   <pre class="programlisting">
1.51      rillig   9339:     MAKE_DIRS_PERMS+=         ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
1.35      jmmv     9340: </pre>
1.1       grant    9341: 
1.35      jmmv     9342:                   <p>The difference between the two is exactly the
                   9343:                   same as their non-<code class=
                   9344:                   "varname">PERMS</code> counterparts.</p>
                   9345:                 </li>
                   9346:               </ul>
                   9347:             </div>
                   9348:           </div>
                   9349: 
1.67    ! hubertf  9350:           <div class="sect2" lang="en">
1.35      jmmv     9351:             <div class="titlepage">
                   9352:               <div>
                   9353:                 <div>
1.67    ! hubertf  9354:                   <h3 class="title"><a name=
        !          9355:                   "files-outside-prefix"></a>12.1.2.&nbsp;File
1.35      jmmv     9356:                   manipulation</h3>
                   9357:                 </div>
                   9358:               </div>
                   9359:             </div>
                   9360: 
                   9361:             <p>Creating non-empty files outside the installation
1.45      wiz      9362:             prefix is tricky because the <code xmlns=
                   9363:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9364:             "filename">PLIST</code> forces all files to be inside
                   9365:             it. To overcome this problem, the only solution is to
                   9366:             extract the file in the known place (i.e., inside the
                   9367:             installation prefix) and copy it to the appropriate
                   9368:             location during installation (done by the installation
                   9369:             scripts generated by pkginstall). We will call the
                   9370:             former the <span class="emphasis"><em>master
                   9371:             file</em></span> in the following paragraphs, which
                   9372:             describe the variables that can be used to
                   9373:             automatically and consistently handle files outside the
                   9374:             installation prefix:</p>
                   9375: 
                   9376:             <div class="itemizedlist">
                   9377:               <ul type="disc">
                   9378:                 <li>
                   9379:                   <p><code class="varname">CONF_FILES</code> and
                   9380:                   <code class="varname">SUPPORT_FILES</code> are
                   9381:                   pairs of master and target files. During
                   9382:                   installation time, the master file is copied to
                   9383:                   the target one if and only if the latter does not
                   9384:                   exist. Upon deinstallation, the target file is
                   9385:                   removed provided that it was not modified by the
                   9386:                   installation.</p>
                   9387: 
                   9388:                   <p>The difference between the two is that the
                   9389:                   latter prompts the administrator to remove any
                   9390:                   files that may be left after deinstallation
                   9391:                   (because they were not empty), while the former
                   9392:                   does not.</p>
                   9393:                 </li>
                   9394: 
                   9395:                 <li>
                   9396:                   <p><code class="varname">CONF_FILES_PERMS</code>
                   9397:                   and <code class=
                   9398:                   "varname">SUPPORT_FILES_PERMS</code> contain
                   9399:                   tuples describing master files as well as their
                   9400:                   target locations. For each of them, it also
                   9401:                   specifies their owner, their group and their
                   9402:                   numeric permissions, in this order. For
                   9403:                   example:</p>
                   9404:                   <pre class="programlisting">
1.51      rillig   9405:     SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
1.35      jmmv     9406: </pre>
                   9407: 
                   9408:                   <p>The difference between the two is exactly the
                   9409:                   same as their non-<code class=
                   9410:                   "varname">PERMS</code> counterparts.</p>
                   9411:                 </li>
                   9412:               </ul>
                   9413:             </div>
                   9414:           </div>
                   9415:         </div>
                   9416: 
1.67    ! hubertf  9417:         <div class="sect1" lang="en">
1.35      jmmv     9418:           <div class="titlepage">
                   9419:             <div>
                   9420:               <div>
                   9421:                 <h2 class="title" style="clear: both"><a name=
1.63      dillo    9422:                 "conf-files"></a>12.2.&nbsp;Configuration
                   9423:                 files</h2>
1.35      jmmv     9424:               </div>
                   9425:             </div>
                   9426:           </div>
                   9427: 
                   9428:           <p>Configuration files are special in the sense that they
                   9429:           are installed in their own specific directory,
                   9430:           <code class="varname">PKG_SYSCONFDIR</code>, and need
                   9431:           special treatment during installation (most of which is
                   9432:           automated by pkginstall). The main concept you must bear
1.36      wiz      9433:           in mind is that files marked as configuration files are
1.35      jmmv     9434:           automatically copied to the right place (somewhere inside
                   9435:           <code class="varname">PKG_SYSCONFDIR</code>) during
                   9436:           installation <span class="emphasis"><em>if and only
                   9437:           if</em></span> they didn't exist before. Similarly, they
                   9438:           will not be removed if they have local modifications.
1.36      wiz      9439:           This ensures that administrators never lose any custom
1.35      jmmv     9440:           changes they may have made.</p>
                   9441: 
1.67    ! hubertf  9442:           <div class="sect2" lang="en">
1.35      jmmv     9443:             <div class="titlepage">
                   9444:               <div>
                   9445:                 <div>
1.67    ! hubertf  9446:                   <h3 class="title"><a name=
        !          9447:                   "conf-files-sysconfdir"></a>12.2.1.&nbsp;How
1.35      jmmv     9448:                   <code class="varname">PKG_SYSCONFDIR</code> is
                   9449:                   set</h3>
                   9450:                 </div>
                   9451:               </div>
                   9452:             </div>
                   9453: 
                   9454:             <p>As said before, the <code class=
                   9455:             "varname">PKG_SYSCONFDIR</code> variable specifies
                   9456:             where configuration files shall be installed. Its
                   9457:             contents are set based upon the following
                   9458:             variables:</p>
                   9459: 
                   9460:             <div class="itemizedlist">
                   9461:               <ul type="disc">
                   9462:                 <li>
                   9463:                   <p><code class="varname">PKG_SYSCONFBASE</code>:
                   9464:                   The configuration's root directory. Defaults to
1.45      wiz      9465:                   <code xmlns=
                   9466:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9467:                   "filename">${PREFIX}/etc</code> although it may
                   9468:                   be overridden by the user to point to his
                   9469:                   preferred location (e.g., <code xmlns=
                   9470:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9471:                   "filename">/etc</code>, <code xmlns=
                   9472:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9473:                   "filename">/etc/pkg</code>, etc.). Packages must
                   9474:                   not use it directly.</p>
                   9475:                 </li>
                   9476: 
                   9477:                 <li>
                   9478:                   <p><code class=
                   9479:                   "varname">PKG_SYSCONFSUBDIR</code>: A
                   9480:                   subdirectory of <code class=
                   9481:                   "varname">PKG_SYSCONFBASE</code> under which the
                   9482:                   configuration files for the package being built
                   9483:                   shall be installed. The definition of this
                   9484:                   variable only makes sense in the package's
1.45      wiz      9485:                   <code xmlns=
                   9486:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     9487:                   "filename">Makefile</code> (i.e., it is not
                   9488:                   user-customizable).</p>
1.35      jmmv     9489: 
                   9490:                   <p>As an example, consider the Apache package,
                   9491:                   <a xmlns=
                   9492:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   9493:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
1.45      wiz      9494:                   target="_top"><code xmlns="" class=
                   9495:                   "filename">www/apache2</code></a>, which places
                   9496:                   its configuration files under the <code xmlns=
                   9497:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9498:                   "filename">httpd/</code> subdirectory of
                   9499:                   <code class="varname">PKG_SYSCONFBASE</code>.
                   9500:                   This should be set in the package Makefile.</p>
                   9501:                 </li>
                   9502: 
                   9503:                 <li>
                   9504:                   <p><code class="varname">PKG_SYSCONFVAR</code>:
                   9505:                   Specifies the name of the variable that holds
                   9506:                   this package's configuration directory (if
                   9507:                   different from <code class=
                   9508:                   "varname">PKG_SYSCONFBASE</code>). It defaults to
                   9509:                   <code class="varname">PKGBASE</code>'s value, and
                   9510:                   is always prefixed with <code class=
                   9511:                   "literal">PKG_SYSCONFDIR</code>.</p>
                   9512:                 </li>
                   9513: 
                   9514:                 <li>
                   9515:                   <p><code class=
                   9516:                   "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
                   9517:                   Holds the directory where the configuration files
                   9518:                   for the package identified by <code class=
                   9519:                   "varname">PKG_SYSCONFVAR</code>'s shall be
                   9520:                   placed.</p>
                   9521:                 </li>
                   9522:               </ul>
                   9523:             </div>
                   9524: 
                   9525:             <p>Based on the above variables, pkginstall determines
                   9526:             the value of <code class=
                   9527:             "varname">PKG_SYSCONFDIR</code>, which is the
                   9528:             <span class="emphasis"><em>only</em></span> variable
                   9529:             that can be used within a package to refer to its
                   9530:             configuration directory. The algorithm used to set its
                   9531:             value is basically the following:</p>
                   9532: 
                   9533:             <div class="orderedlist">
                   9534:               <ol type="1">
                   9535:                 <li>
                   9536:                   <p>If <code class=
                   9537:                   "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   9538:                   is set, its value is used.</p>
                   9539:                 </li>
                   9540: 
                   9541:                 <li>
                   9542:                   <p>If the previous variable is not defined but
                   9543:                   <code class="varname">PKG_SYSCONFSUBDIR</code> is
1.45      wiz      9544:                   set in the package's <code xmlns=
                   9545:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9546:                   "filename">Makefile</code>, the resulting value
1.45      wiz      9547:                   is <code xmlns=
                   9548:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9549:                   "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
                   9550:                 </li>
                   9551: 
                   9552:                 <li>
1.45      wiz      9553:                   <p>Otherwise, it is set to <code xmlns=
                   9554:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9555:                   "filename">${PKG_SYSCONFBASE}</code>.</p>
                   9556:                 </li>
                   9557:               </ol>
                   9558:             </div>
                   9559: 
1.45      wiz      9560:             <p>It is worth mentioning that <code xmlns=
                   9561:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9562:             "filename">${PKG_SYSCONFDIR}</code> is automatically
1.45      wiz      9563:             added to <code xmlns=
                   9564:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   9565:             "filename">OWN_DIRS</code>. See <a href=
                   9566:             "#dirs-outside-prefix" title=
1.63      dillo    9567:             "12.1.1.&nbsp;Directory manipulation">Section&nbsp;12.1.1,
1.35      jmmv     9568:             &#8220;Directory manipulation&#8221;</a> what this
                   9569:             means.</p>
                   9570:           </div>
                   9571: 
1.67    ! hubertf  9572:           <div class="sect2" lang="en">
1.35      jmmv     9573:             <div class="titlepage">
                   9574:               <div>
                   9575:                 <div>
1.67    ! hubertf  9576:                   <h3 class="title"><a name=
1.63      dillo    9577:                   "conf-files-configure"></a>12.2.2.&nbsp;Telling
                   9578:                   the software where configuration files are</h3>
1.35      jmmv     9579:                 </div>
                   9580:               </div>
                   9581:             </div>
                   9582: 
                   9583:             <p>Given that pkgsrc (and users!) expect configuration
                   9584:             files to be in a known place, you need to teach each
1.36      wiz      9585:             package where it shall install its files. In some cases
1.35      jmmv     9586:             you will have to patch the package Makefiles to achieve
                   9587:             it. If you are lucky, though, it may be as easy as
                   9588:             passing an extra flag to the configuration script; this
1.47      reed     9589:             is the case of GNU Autoconf- generated files:</p>
1.35      jmmv     9590:             <pre class="programlisting">
1.51      rillig   9591:     CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.35      jmmv     9592: </pre>
                   9593: 
                   9594:             <p>Note that this specifies where the package has to
                   9595:             <span class="emphasis"><em>look for</em></span> its
                   9596:             configuration files, not where they will be originally
                   9597:             installed (although the difference is never explicit,
                   9598:             unfortunately).</p>
                   9599:           </div>
                   9600: 
1.67    ! hubertf  9601:           <div class="sect2" lang="en">
1.35      jmmv     9602:             <div class="titlepage">
                   9603:               <div>
                   9604:                 <div>
1.67    ! hubertf  9605:                   <h3 class="title"><a name=
1.63      dillo    9606:                   "conf-files-patching"></a>12.2.3.&nbsp;Patching
1.35      jmmv     9607:                   installations</h3>
                   9608:                 </div>
                   9609:               </div>
                   9610:             </div>
                   9611: 
                   9612:             <p>As said before, pkginstall automatically handles
                   9613:             configuration files. This means that <span class=
                   9614:             "strong"><strong>the packages themselves must not touch
1.45      wiz      9615:             the contents of <code xmlns=
                   9616:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9617:             "filename">${PKG_SYSCONFDIR}</code>
1.36      wiz      9618:             directly</strong></span>. Bad news is that many
                   9619:             software installation scripts will, out of the box,
                   9620:             mess with the contents of that directory. So what is
                   9621:             the correct procedure to fix this issue?</p>
1.35      jmmv     9622: 
                   9623:             <p>You must teach the package (usually by manually
                   9624:             patching it) to install any configuration files under
1.45      wiz      9625:             the examples hierarchy, <code xmlns=
                   9626:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9627:             "filename">share/examples/${PKGBASE}/</code>. This way,
1.45      wiz      9628:             the <code xmlns=
                   9629:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   9630:             "filename">PLIST</code> registers them and the
                   9631:             administrator always has the original copies
1.35      jmmv     9632:             available.</p>
                   9633: 
                   9634:             <p>Once the required configuration files are in place
                   9635:             (i.e., under the examples hierarchy), the pkginstall
                   9636:             framework can use them as master copies during the
1.45      wiz      9637:             package installation to update what is in <code xmlns=
                   9638:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9639:             "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
                   9640:             the variables <code class="varname">CONF_FILES</code>
                   9641:             and <code class="varname">CONF_FILES_PERMS</code> are
                   9642:             used. Check out <a href="#files-outside-prefix" title=
1.63      dillo    9643:             "12.1.2.&nbsp;File manipulation">Section&nbsp;12.1.2,
1.35      jmmv     9644:             &#8220;File manipulation&#8221;</a> for information
                   9645:             about their syntax and their purpose. Here is an
                   9646:             example, taken from the <a xmlns=
                   9647:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9648:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
1.45      wiz      9649:             target="_top"><code xmlns="" class=
                   9650:             "filename">mail/mutt</code></a> package:</p>
1.35      jmmv     9651:             <pre class="programlisting">
1.51      rillig   9652:     EGDIR=        ${PREFIX}/share/doc/mutt/samples
                   9653:     CONF_FILES=   ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
1.35      jmmv     9654: </pre>
                   9655: 
                   9656:             <p>Note that the <code class="varname">EGDIR</code>
                   9657:             variable is specific to that package and has no meaning
                   9658:             outside it.</p>
                   9659:           </div>
                   9660: 
1.67    ! hubertf  9661:           <div class="sect2" lang="en">
1.35      jmmv     9662:             <div class="titlepage">
                   9663:               <div>
                   9664:                 <div>
1.67    ! hubertf  9665:                   <h3 class="title"><a name=
        !          9666:                   "conf-files-disable"></a>12.2.4.&nbsp;Disabling
1.35      jmmv     9667:                   handling of configuration files</h3>
                   9668:                 </div>
                   9669:               </div>
                   9670:             </div>
                   9671: 
                   9672:             <p>The automatic copying of config files can be toggled
                   9673:             by setting the environment variable <code class=
                   9674:             "varname">PKG_CONFIG</code> prior to package
                   9675:             installation.</p>
                   9676:           </div>
                   9677:         </div>
                   9678: 
1.67    ! hubertf  9679:         <div class="sect1" lang="en">
1.35      jmmv     9680:           <div class="titlepage">
                   9681:             <div>
                   9682:               <div>
                   9683:                 <h2 class="title" style="clear: both"><a name=
1.63      dillo    9684:                 "rcd-scripts"></a>12.3.&nbsp;System startup
                   9685:                 scripts</h2>
1.35      jmmv     9686:               </div>
                   9687:             </div>
                   9688:           </div>
                   9689: 
                   9690:           <p>System startup scripts are special files because they
                   9691:           must be installed in a place known by the underlying OS,
                   9692:           usually outside the installation prefix. Therefore, the
                   9693:           same rules described in <a href=
                   9694:           "#files-and-dirs-outside-prefix" title=
1.38      dillo    9695:           "12.1.&nbsp;Files and directories outside the installation prefix">
1.63      dillo    9696:           Section&nbsp;12.1, &#8220;Files and directories outside
                   9697:           the installation prefix&#8221;</a> apply, and the same
1.35      jmmv     9698:           solutions can be used. However, pkginstall provides a
1.36      wiz      9699:           special mechanism to handle these files.</p>
1.35      jmmv     9700: 
                   9701:           <p>In order to provide system startup scripts, the
                   9702:           package has to:</p>
                   9703: 
                   9704:           <div class="orderedlist">
                   9705:             <ol type="1">
                   9706:               <li>
1.45      wiz      9707:                 <p>Store the script inside <code xmlns=
                   9708:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9709:                 "filename">${FILESDIR}</code>, with the
                   9710:                 <code class="literal">.sh</code> suffix appended.
                   9711:                 Considering the <a xmlns=
                   9712:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   9713:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
1.45      wiz      9714:                 target="_top"><code xmlns="" class=
                   9715:                 "filename">print/cups</code></a> package as an
                   9716:                 example, it has a <code xmlns=
                   9717:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9718:                 "filename">cupsd.sh</code> in its files
                   9719:                 directory.</p>
                   9720:               </li>
                   9721: 
                   9722:               <li>
                   9723:                 <p>Tell pkginstall to handle it, appending the name
                   9724:                 of the script, without its extension, to the
                   9725:                 <code class="varname">RCD_SCRIPTS</code> variable.
                   9726:                 Continuing the previous example:</p>
                   9727:                 <pre class="programlisting">
1.51      rillig   9728:     RCD_SCRIPTS+=   cupsd
1.35      jmmv     9729: </pre>
                   9730:               </li>
                   9731:             </ol>
                   9732:           </div>
                   9733: 
                   9734:           <p>Once this is done, pkginstall will do the following
                   9735:           steps for each script in an automated fashion:</p>
                   9736: 
                   9737:           <div class="orderedlist">
                   9738:             <ol type="1">
                   9739:               <li>
                   9740:                 <p>Process the file found in the files directory
                   9741:                 applying all the substitutions described in the
1.45      wiz      9742:                 <code xmlns=
                   9743:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   9744:                 "filename">FILES_SUBST</code> variable.</p>
1.35      jmmv     9745:               </li>
                   9746: 
                   9747:               <li>
                   9748:                 <p>Copy the script from the files directory to the
1.45      wiz      9749:                 examples hierarchy, <code xmlns=
                   9750:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9751:                 "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36      wiz      9752:                 Note that this master file must be explicitly
1.45      wiz      9753:                 registered in the <code xmlns=
                   9754:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9755:                 "filename">PLIST</code>.</p>
                   9756:               </li>
                   9757: 
                   9758:               <li>
                   9759:                 <p>Add code to the installation scripts to copy the
                   9760:                 startup script from the examples hierarchy into the
                   9761:                 system-wide startup scripts directory.</p>
                   9762:               </li>
                   9763:             </ol>
                   9764:           </div>
                   9765: 
1.67    ! hubertf  9766:           <div class="sect2" lang="en">
1.35      jmmv     9767:             <div class="titlepage">
                   9768:               <div>
                   9769:                 <div>
1.67    ! hubertf  9770:                   <h3 class="title"><a name=
1.63      dillo    9771:                   "rcd-scripts-disable"></a>12.3.1.&nbsp;Disabling
1.35      jmmv     9772:                   handling of system startup scripts</h3>
                   9773:                 </div>
                   9774:               </div>
                   9775:             </div>
                   9776: 
                   9777:             <p>The automatic copying of config files can be toggled
                   9778:             by setting the environment variable <code class=
                   9779:             "varname">PKG_RCD_SCRIPTS</code> prior to package
                   9780:             installation. Note that the scripts will be always
1.45      wiz      9781:             copied inside the examples hierarchy, <code xmlns=
                   9782:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9783:             "filename">${PREFIX}/share/examples/rc.d/</code>, no
                   9784:             matter what the value of this variable is.</p>
                   9785:           </div>
                   9786:         </div>
                   9787: 
1.67    ! hubertf  9788:         <div class="sect1" lang="en">
1.35      jmmv     9789:           <div class="titlepage">
                   9790:             <div>
                   9791:               <div>
                   9792:                 <h2 class="title" style="clear: both"><a name=
1.63      dillo    9793:                 "users-and-groups"></a>12.4.&nbsp;System users and
                   9794:                 groups</h2>
1.35      jmmv     9795:               </div>
                   9796:             </div>
                   9797:           </div>
                   9798: 
                   9799:           <p>If a package needs to create special users and/or
                   9800:           groups during installation, it can do so by using the
                   9801:           pkginstall framework.</p>
                   9802: 
                   9803:           <p>Users can be created by adding entries to the
                   9804:           <code class="varname">PKG_USERS</code> variable. Each
1.45      wiz      9805:           entry has the following syntax, which mimics <code xmlns=
                   9806:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9807:           "filename">/etc/passwd</code>:</p>
                   9808:           <pre class="programlisting">
1.51      rillig   9809:     user:group[:[userid][:[descr][:[home][:shell]]]]
1.35      jmmv     9810: </pre>
                   9811: 
                   9812:           <p>Only the user and group are required; everything else
                   9813:           is optional, but the colons must be in the right places
                   9814:           when specifying optional bits. By default, a new user
1.45      wiz      9815:           will have home directory <code xmlns=
                   9816:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9817:           "filename">/nonexistent</code>, and login shell
1.45      wiz      9818:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9819:           class="filename">/sbin/nologin</code> unless they are
                   9820:           specified as part of the user element. Note that if the
1.51      rillig   9821:           description contains spaces, then spaces should be
1.45      wiz      9822:           backslash-escaped, as in:</p>
1.35      jmmv     9823:           <pre class="programlisting">
1.51      rillig   9824:     foo:foogrp::The\ Foomister
1.35      jmmv     9825: </pre>
                   9826: 
                   9827:           <p>Similarly, groups can be created using the
                   9828:           <code class="varname">PKG_GROUPS</code> variable, whose
                   9829:           syntax is:</p>
                   9830:           <pre class="programlisting">
1.51      rillig   9831:     group[:groupid]
1.35      jmmv     9832: </pre>
                   9833: 
                   9834:           <p>As before, only the group name is required; the
                   9835:           numeric identifier is optional.</p>
                   9836:         </div>
                   9837: 
1.67    ! hubertf  9838:         <div class="sect1" lang="en">
1.35      jmmv     9839:           <div class="titlepage">
                   9840:             <div>
                   9841:               <div>
                   9842:                 <h2 class="title" style="clear: both"><a name=
1.67    ! hubertf  9843:                 "shells"></a>12.5.&nbsp;System shells</h2>
1.35      jmmv     9844:               </div>
                   9845:             </div>
                   9846:           </div>
                   9847: 
                   9848:           <p>Packages that install system shells should register
1.45      wiz      9849:           them in the shell database, <code xmlns=
                   9850:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9851:           "filename">/etc/shells</code>, to make things easier to
                   9852:           the administrator. This must be done from the
                   9853:           installation scripts to keep binary packages working on
                   9854:           any system. pkginstall provides an easy way to accomplish
                   9855:           this task.</p>
                   9856: 
                   9857:           <p>When a package provides a shell interpreter, it has to
                   9858:           set the <code class="varname">PKG_SHELL</code> variable
                   9859:           to its absolute file name. This will add some hooks to
                   9860:           the installation scripts to handle it. Consider the
                   9861:           following example, taken from <a xmlns=
                   9862:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   9863:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
1.45      wiz      9864:           target="_top"><code xmlns="" class=
                   9865:           "filename">shells/zsh</code></a>:</p>
1.35      jmmv     9866:           <pre class="programlisting">
1.51      rillig   9867:     PKG_SHELL=      ${PREFIX}/bin/zsh
1.35      jmmv     9868: </pre>
                   9869: 
1.67    ! hubertf  9870:           <div class="sect2" lang="en">
1.35      jmmv     9871:             <div class="titlepage">
                   9872:               <div>
                   9873:                 <div>
1.67    ! hubertf  9874:                   <h3 class="title"><a name=
        !          9875:                   "shells-disable"></a>12.5.1.&nbsp;Disabling shell
1.65      hubertf  9876:                   registration</h3>
1.35      jmmv     9877:                 </div>
                   9878:               </div>
                   9879:             </div>
                   9880: 
                   9881:             <p>The automatic registration of shell interpreters can
                   9882:             be disabled by the administrator by setting the
1.45      wiz      9883:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9884:             class="filename">PKG_REGISTER_SHELLS</code> environment
                   9885:             variable to <code class="literal">NO</code>.</p>
1.35      jmmv     9886:           </div>
                   9887:         </div>
1.65      hubertf  9888: 
1.67    ! hubertf  9889:         <div class="sect1" lang="en">
1.65      hubertf  9890:           <div class="titlepage">
                   9891:             <div>
                   9892:               <div>
                   9893:                 <h2 class="title" style="clear: both"><a name=
1.67    ! hubertf  9894:                 "fonts"></a>12.6.&nbsp;Fonts</h2>
1.65      hubertf  9895:               </div>
                   9896:             </div>
                   9897:           </div>
                   9898: 
                   9899:           <p>Packages that install X11 fonts should update the
                   9900:           database files that index the fonts within each fonts
                   9901:           directory. This can easily be accomplished within the
                   9902:           pkginstall framework.</p>
                   9903: 
                   9904:           <p>When a package installs X11 fonts, it must list the
                   9905:           directories in which fonts are installed in the
                   9906:           <code class="varname">FONTS_DIRS.<em class=
                   9907:           "replaceable"><code>type</code></em></code> variables,
                   9908:           where <em class="replaceable"><code>type</code></em> can
                   9909:           be one of &#8220;<span class="quote">ttf</span>&#8221;,
                   9910:           &#8220;<span class="quote">type1</span>&#8221; or
                   9911:           &#8220;<span class="quote">x11</span>&#8221;. This will
                   9912:           add hooks to the installation scripts to run the
                   9913:           appropriate commands to update the fonts database files
                   9914:           within each of those directories. For convenience, if the
                   9915:           directory path is relative, it is taken to be relative to
                   9916:           the package's installation prefix. Consider the following
                   9917:           example, taken from <a xmlns=
                   9918:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   9919:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/dbz-ttf/README.html"
                   9920:           target="_top"><code xmlns="" class=
                   9921:           "filename">fonts/dbz-ttf</code></a>:</p>
                   9922:           <pre class="programlisting">
                   9923:     FONTS_DIRS.ttf= ${PREFIX}/lib/X11/fonts/TTF
                   9924: </pre>
                   9925: 
1.67    ! hubertf  9926:           <div class="sect2" lang="en">
1.65      hubertf  9927:             <div class="titlepage">
                   9928:               <div>
                   9929:                 <div>
1.67    ! hubertf  9930:                   <h3 class="title"><a name=
        !          9931:                   "fonts-disable"></a>12.6.1.&nbsp;Disabling
        !          9932:                   automatic update of the fonts databases</h3>
1.65      hubertf  9933:                 </div>
                   9934:               </div>
                   9935:             </div>
                   9936: 
                   9937:             <p>The automatic update of fonts databases can be
                   9938:             disabled by the administrator by setting the
                   9939:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9940:             class="filename">PKG_UPDATE_FONTS_DB</code> environment
                   9941:             variable to <code class="literal">NO</code>.</p>
                   9942:           </div>
                   9943:         </div>
1.35      jmmv     9944:       </div>
                   9945: 
1.67    ! hubertf  9946:       <div class="chapter" lang="en">
1.35      jmmv     9947:         <div class="titlepage">
                   9948:           <div>
                   9949:             <div>
1.67    ! hubertf  9950:               <h2 class="title"><a name=
1.38      dillo    9951:               "options"></a>Chapter&nbsp;13.&nbsp;Options
1.35      jmmv     9952:               handling</h2>
                   9953:             </div>
                   9954:           </div>
                   9955:         </div>
                   9956: 
                   9957:         <div class="toc">
                   9958:           <p><b>Table of Contents</b></p>
                   9959: 
                   9960:           <dl>
                   9961:             <dt><span class="sect1"><a href=
1.38      dillo    9962:             "#global-default-options">13.1. Global default
1.35      jmmv     9963:             options</a></span></dt>
                   9964: 
                   9965:             <dt><span class="sect1"><a href=
1.38      dillo    9966:             "#converting-to-options">13.2. Converting packages to
1.45      wiz      9967:             use <code xmlns=
                   9968:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9969:             "filename">bsd.options.mk</code></a></span></dt>
1.48      dillo    9970: 
                   9971:             <dt><span class="sect1"><a href="#option-names">13.3.
                   9972:             Option Names</a></span></dt>
1.35      jmmv     9973:           </dl>
                   9974:         </div>
                   9975: 
                   9976:         <p>Many packages have the ability to be built to support
1.45      wiz      9977:         different sets of features. <code xmlns=
                   9978:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9979:         "filename">bsd.options.mk</code> is a framework in pkgsrc
                   9980:         that provides generic handling of those options that
                   9981:         determine different ways in which the packages can be
                   9982:         built. It's possible for the user to specify exactly which
                   9983:         sets of options will be built into a package or to allow a
                   9984:         set of global default options apply.</p>
                   9985: 
1.67    ! hubertf  9986:         <div class="sect1" lang="en">
1.35      jmmv     9987:           <div class="titlepage">
                   9988:             <div>
                   9989:               <div>
                   9990:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    9991:                 "global-default-options"></a>13.1.&nbsp;Global
1.35      jmmv     9992:                 default options</h2>
                   9993:               </div>
                   9994:             </div>
                   9995:           </div>
                   9996: 
                   9997:           <p>Global default options are listed in <code class=
                   9998:           "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
                   9999:           the options that should be built into every package if
                   10000:           that option is supported. This variable should be set in
1.45      wiz      10001:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10002:           class="filename">/etc/mk.conf</code>.</p>
1.35      jmmv     10003:         </div>
                   10004: 
1.67    ! hubertf  10005:         <div class="sect1" lang="en">
1.35      jmmv     10006:           <div class="titlepage">
                   10007:             <div>
                   10008:               <div>
                   10009:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    10010:                 "converting-to-options"></a>13.2.&nbsp;Converting
1.45      wiz      10011:                 packages to use <code xmlns=
                   10012:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     10013:                 "filename">bsd.options.mk</code></h2>
                   10014:               </div>
                   10015:             </div>
                   10016:           </div>
                   10017: 
1.45      wiz      10018:           <p>The following example shows how <code xmlns=
                   10019:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     10020:           "filename">bsd.options.mk</code> should be used by the
                   10021:           hypothetical ``wibble'' package, either in the package
1.45      wiz      10022:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10023:           class="filename">Makefile</code>, or in a file, e.g.
                   10024:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10025:           class="filename">options.mk</code>, that is included by
                   10026:           the main package <code xmlns=
                   10027:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     10028:           "filename">Makefile</code>.</p>
                   10029:           <pre class="programlisting">
1.51      rillig   10030:     PKG_OPTIONS_VAR=            PKG_OPTIONS.wibble
                   10031:     PKG_SUPPORTED_OPTIONS=              wibble-foo ldap
                   10032:     PKG_OPTIONS_OPTIONAL_GROUPS=        database
                   10033:     PKG_OPTIONS_GROUP.database= mysql pgsql
                   10034:     PKG_SUGGESTED_OPTIONS=              wibble-foo
                   10035:     PKG_OPTIONS_LEGACY_VARS+=   WIBBLE_USE_OPENLDAP:ldap
                   10036:     PKG_OPTIONS_LEGACY_OPTS+=   foo:wibble-foo
                   10037: 
                   10038:     .include "../../mk/bsd.prefs.mk"
                   10039: 
                   10040:     # this package was previously named wibble2
                   10041:     .if defined(PKG_OPTIONS.wibble2)
                   10042:     PKG_LEGACY_OPTIONS+=  ${PKG_OPTIONS.wibble2}
                   10043:     PKG_OPTIONS_DEPRECATED_WARNINGS+= \
                   10044:             "Deprecated variable PKG_OPTIONS.wibble2 used, use "${PKG_OPTIONS_VAR:Q}" instead."
                   10045:     .endif
                   10046: 
                   10047:     .include "../../mk/bsd.options.mk"
                   10048: 
                   10049:     # Package-specific option-handling
                   10050: 
                   10051:     ###
                   10052:     ### FOO support
                   10053:     ###
                   10054:     .if !empty(PKG_OPTIONS:Mwibble-foo)
                   10055:     CONFIGURE_ARGS+=    --enable-foo
                   10056:     .endif
                   10057: 
                   10058:     ###
                   10059:     ### LDAP support
                   10060:     ###
                   10061:     .if !empty(PKG_OPTIONS:Mldap)
                   10062:     .  include "../../databases/openldap/buildlink3.mk"
                   10063:     CONFIGURE_ARGS+=    --enable-ldap=${BUILDLINK_PREFIX.openldap}
                   10064:     .endif
                   10065: 
                   10066:     ###
                   10067:     ### database support
                   10068:     ###
                   10069:     .if !empty(PKG_OPTIONS:Mmysql)
                   10070:     .  include "../../mk/mysql.buildlink3.mk"
                   10071:     .endif
                   10072:     .if !empty(PKG_OPTIONS:Mpgsql)
                   10073:     .  include "../../mk/pgsql.buildlink3.mk"
                   10074:     .endif
1.1       grant    10075: </pre>
                   10076: 
1.28      rillig   10077:           <p>The first section contains the information about which
                   10078:           build options are supported by the package, and any
1.1       grant    10079:           default options settings if needed.</p>
                   10080: 
                   10081:           <div class="orderedlist">
                   10082:             <ol type="1">
                   10083:               <li>
1.14      xtraeme  10084:                 <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27      rillig   10085:                 the name of the <a href=
1.1       grant    10086:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   10087:                 <span class="citerefentry"><span class=
1.27      rillig   10088:                 "refentrytitle">make</span>(1)</span></a> variable
1.37      dillo    10089:                 that the user can set to override the default
1.57      minskim  10090:                 options. It should be set to PKG_OPTIONS.<em class=
1.63      dillo    10091:                 "replaceable"><code>pkgbase</code></em>. Do not set
                   10092:                 it to PKG_OPTIONS.${PKGBASE}, since <code class=
                   10093:                 "varname">PKGBASE</code> is set after <code class=
                   10094:                 "varname">PKG_OPTIONS_VAR</code> is used.</p>
1.1       grant    10095:               </li>
                   10096: 
                   10097:               <li>
1.14      xtraeme  10098:                 <p><code class=
                   10099:                 "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37      dillo    10100:                 build options supported by the package.</p>
                   10101:               </li>
                   10102: 
                   10103:               <li>
                   10104:                 <p><code class=
                   10105:                 "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
                   10106:                 list of names of groups of mutually exclusive
                   10107:                 options. The options in each group are listed in
                   10108:                 <code class="varname">PKG_OPTIONS_GROUP.<em class=
                   10109:                 "replaceable"><code>groupname</code></em></code>.
                   10110:                 The most specific setting of any option from the
                   10111:                 group takes precedence over all other options in
                   10112:                 the group. Options from the groups will be
                   10113:                 automatically added to <code class=
                   10114:                 "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
                   10115:               </li>
                   10116: 
                   10117:               <li>
                   10118:                 <p><code class=
                   10119:                 "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
                   10120:                 like <code class=
                   10121:                 "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
                   10122:                 building the packages will fail if no option from
                   10123:                 the group is selected.</p>
1.1       grant    10124:               </li>
                   10125: 
                   10126:               <li>
1.27      rillig   10127:                 <p><code class=
1.44      gdt      10128:                 "varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a
                   10129:                 list of names of sets of options. At least one
                   10130:                 option from each set must be selected. The options
                   10131:                 in each set are listed in <code class=
                   10132:                 "varname">PKG_OPTIONS_SET.<em class=
                   10133:                 "replaceable"><code>setname</code></em></code>.
                   10134:                 Options from the sets will be automatically added
                   10135:                 to <code class=
                   10136:                 "varname">PKG_SUPPORTED_OPTIONS</code>. Building
                   10137:                 the package will fail if no option from the set is
                   10138:                 selected.</p>
                   10139:               </li>
                   10140: 
                   10141:               <li>
                   10142:                 <p><code class=
1.27      rillig   10143:                 "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
                   10144:                 build options which are enabled by default.</p>
                   10145:               </li>
                   10146: 
                   10147:               <li>
1.37      dillo    10148:                 <p><code class=
                   10149:                 "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
                   10150:                 of &#8220;<span class="quote"><em class=
1.67    ! hubertf  10151:                 "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable"><code>option</code></em></span>&#8221;
        !          10152:                 pairs that map legacy <code xmlns=
1.45      wiz      10153:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.37      dillo    10154:                 "filename">/etc/mk.conf</code> variables to their
                   10155:                 option counterparts. Pairs should be added with
                   10156:                 &#8220;<span class="quote">+=</span>&#8221; to keep
                   10157:                 the listing of global legacy variables. A warning
                   10158:                 will be issued if the user uses a legacy
                   10159:                 variable.</p>
                   10160:               </li>
1.1       grant    10161: 
1.37      dillo    10162:               <li>
                   10163:                 <p><code class=
                   10164:                 "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
                   10165:                 of &#8220;<span class="quote"><em class=
1.67    ! hubertf  10166:                 "replaceable"><code>old-option</code></em>:<em class="replaceable"><code>new-option</code></em></span>&#8221;
        !          10167:                 pairs that map options that have been renamed to
        !          10168:                 their new counterparts. Pairs should be added with
1.37      dillo    10169:                 &#8220;<span class="quote">+=</span>&#8221; to keep
                   10170:                 the listing of global legacy options. A warning
                   10171:                 will be issued if the user uses a legacy
                   10172:                 option.</p>
                   10173:               </li>
1.1       grant    10174: 
1.37      dillo    10175:               <li>
                   10176:                 <p><code class="varname">PKG_LEGACY_OPTIONS</code>
                   10177:                 is a list of options implied by deprecated
                   10178:                 variables used. This can be used for cases that
                   10179:                 neither <code class=
                   10180:                 "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
                   10181:                 <code class=
                   10182:                 "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
                   10183:                 handle, e. g. when <code class=
                   10184:                 "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1       grant    10185:               </li>
                   10186: 
                   10187:               <li>
1.37      dillo    10188:                 <p><code class=
                   10189:                 "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
                   10190:                 a list of warnings about deprecated variables or
                   10191:                 options used, and what to use instead.</p>
1.1       grant    10192:               </li>
1.28      rillig   10193:             </ol>
1.1       grant    10194:           </div>
                   10195: 
1.37      dillo    10196:           <p>A package should never modify <code class=
                   10197:           "varname">PKG_DEFAULT_OPTIONS</code> or the variable
                   10198:           named in <code class="varname">PKG_OPTIONS_VAR</code>.
                   10199:           These are strictly user-settable. To suggest a default
                   10200:           set of options, use <code class=
                   10201:           "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
                   10202: 
1.42      dillo    10203:           <p><code class="varname">PKG_OPTIONS_VAR</code> must be
1.45      wiz      10204:           defined before including <code xmlns=
                   10205:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.42      dillo    10206:           "filename">bsd.options.mk</code>. If none of <code class=
1.37      dillo    10207:           "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
                   10208:           "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
                   10209:           <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
1.47      reed     10210:           are defined (as can happen with platform-specific options
1.42      dillo    10211:           if none of them is supported on the current platform),
                   10212:           <code class="varname">PKG_OPTIONS</code> is set to the
                   10213:           empty list and the package is otherwise treated as not
                   10214:           using the options framework.</p>
1.37      dillo    10215: 
1.45      wiz      10216:           <p>After the inclusion of <code xmlns=
                   10217:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.37      dillo    10218:           "filename">bsd.options.mk</code>, the variable
1.28      rillig   10219:           <code class="varname">PKG_OPTIONS</code> contains the
1.37      dillo    10220:           list of selected build options, properly filtered to
1.28      rillig   10221:           remove unsupported and duplicate options.</p>
                   10222: 
1.1       grant    10223:           <p>The remaining sections contain the logic that is
1.37      dillo    10224:           specific to each option. The correct way to check for an
                   10225:           option is to check whether it is listed in <code class=
                   10226:           "varname">PKG_OPTIONS</code>:</p>
                   10227:           <pre class="programlisting">
1.51      rillig   10228:     .if !empty(PKG_OPTIONS:M<em class=
1.37      dillo    10229: "replaceable"><code>option</code></em>)
                   10230: </pre>
1.48      dillo    10231:         </div>
1.37      dillo    10232: 
1.67    ! hubertf  10233:         <div class="sect1" lang="en">
1.48      dillo    10234:           <div class="titlepage">
                   10235:             <div>
                   10236:               <div>
                   10237:                 <h2 class="title" style="clear: both"><a name=
                   10238:                 "option-names"></a>13.3.&nbsp;Option Names</h2>
                   10239:               </div>
                   10240:             </div>
                   10241:           </div>
                   10242: 
                   10243:           <p>Options that enable similar features in different
                   10244:           packages (like optional support for a library) should use
                   10245:           a common name in all packages that support it (like the
                   10246:           name of the library). If another package already has an
                   10247:           option with the same meaning, use the same name.</p>
                   10248: 
                   10249:           <p>Options that enable features specific to one package,
                   10250:           where it's unlikely that another (unrelated) package has
                   10251:           the same (or a similar) optional feature, should use a
                   10252:           name prefixed with <code class="varname"><em class=
                   10253:           "replaceable"><code>pkgname</code></em>-</code>.</p>
                   10254: 
                   10255:           <p>If a group of related packages share an optional
                   10256:           feature specific to that group, prefix it with the name
                   10257:           of the &#8220;<span class="quote">main</span>&#8221;
                   10258:           package (e. g. <code class=
                   10259:           "varname">djbware-errno-hack</code>).</p>
                   10260: 
                   10261:           <p>For new options, add a line to <code xmlns=
                   10262:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10263:           "filename">mk/defaults/options.description</code>. Lines
                   10264:           have two fields, separated by tab. The first field is the
                   10265:           option name, the second its description. The description
                   10266:           should be a whole sentence (starting with an uppercase
                   10267:           letter and ending with a period) that describes what
                   10268:           enabling the option does. E. g. &#8220;<span class=
                   10269:           "quote">Enable ispell support.</span>&#8221; The file is
                   10270:           sorted by option names.</p>
1.1       grant    10271:         </div>
                   10272:       </div>
                   10273: 
1.67    ! hubertf  10274:       <div class="chapter" lang="en">
1.1       grant    10275:         <div class="titlepage">
                   10276:           <div>
                   10277:             <div>
1.67    ! hubertf  10278:               <h2 class="title"><a name=
1.38      dillo    10279:               "build"></a>Chapter&nbsp;14.&nbsp;The build
1.1       grant    10280:               process</h2>
                   10281:             </div>
                   10282:           </div>
                   10283:         </div>
                   10284: 
                   10285:         <div class="toc">
                   10286:           <p><b>Table of Contents</b></p>
                   10287: 
                   10288:           <dl>
1.56      rillig   10289:             <dt><span class="sect1"><a href="#build.intro">14.1.
                   10290:             Introduction</a></span></dt>
                   10291: 
                   10292:             <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1       grant    10293:             Program location</a></span></dt>
                   10294: 
1.56      rillig   10295:             <dt><span class="sect1"><a href=
                   10296:             "#build.builddirs">14.3. Directories used during the
                   10297:             build process</a></span></dt>
                   10298: 
                   10299:             <dt><span class="sect1"><a href="#build.running">14.4.
                   10300:             Running a phase</a></span></dt>
                   10301: 
                   10302:             <dt><span class="sect1"><a href="#build.fetch">14.5.
                   10303:             The <span class="emphasis"><em>fetch</em></span>
                   10304:             phase</a></span></dt>
                   10305: 
                   10306:             <dt><span class="sect1"><a href="#build.checksum">14.6.
                   10307:             The <span class="emphasis"><em>checksum</em></span>
                   10308:             phase</a></span></dt>
                   10309: 
                   10310:             <dt><span class="sect1"><a href="#build.extract">14.7.
                   10311:             The <span class="emphasis"><em>extract</em></span>
                   10312:             phase</a></span></dt>
                   10313: 
                   10314:             <dt><span class="sect1"><a href="#build.patch">14.8.
                   10315:             The <span class="emphasis"><em>patch</em></span>
                   10316:             phase</a></span></dt>
                   10317: 
                   10318:             <dt><span class="sect1"><a href="#build.tools">14.9.
                   10319:             The <span class="emphasis"><em>tools</em></span>
                   10320:             phase</a></span></dt>
                   10321: 
                   10322:             <dt><span class="sect1"><a href="#build.wrapper">14.10.
                   10323:             The <span class="emphasis"><em>wrapper</em></span>
                   10324:             phase</a></span></dt>
1.1       grant    10325: 
                   10326:             <dt><span class="sect1"><a href=
1.56      rillig   10327:             "#build.configure">14.11. The <span class=
                   10328:             "emphasis"><em>configure</em></span>
                   10329:             phase</a></span></dt>
                   10330: 
                   10331:             <dt><span class="sect1"><a href="#build.build">14.12.
                   10332:             The <span class="emphasis"><em>build</em></span>
                   10333:             phase</a></span></dt>
                   10334: 
                   10335:             <dt><span class="sect1"><a href="#build.test">14.13.
                   10336:             The <span class="emphasis"><em>test</em></span>
                   10337:             phase</a></span></dt>
                   10338: 
                   10339:             <dt><span class="sect1"><a href="#build.install">14.14.
                   10340:             The <span class="emphasis"><em>install</em></span>
                   10341:             phase</a></span></dt>
                   10342: 
                   10343:             <dt><span class="sect1"><a href="#build.package">14.15.
                   10344:             The <span class="emphasis"><em>package</em></span>
                   10345:             phase</a></span></dt>
                   10346: 
                   10347:             <dt><span class="sect1"><a href=
                   10348:             "#build.helpful-targets">14.16. Other helpful
1.1       grant    10349:             targets</a></span></dt>
                   10350:           </dl>
                   10351:         </div>
                   10352: 
1.67    ! hubertf  10353:         <div class="sect1" lang="en">
1.56      rillig   10354:           <div class="titlepage">
                   10355:             <div>
                   10356:               <div>
                   10357:                 <h2 class="title" style="clear: both"><a name=
                   10358:                 "build.intro"></a>14.1.&nbsp;Introduction</h2>
                   10359:               </div>
                   10360:             </div>
                   10361:           </div>
                   10362: 
                   10363:           <p>This chapter gives a detailed description on how a
                   10364:           package is built. Building a package is separated into
                   10365:           different <span class="emphasis"><em>phases</em></span>
                   10366:           (for example <code class="varname">fetch</code>,
                   10367:           <code class="varname">build</code>, <code class=
                   10368:           "varname">install</code>), all of which are described in
                   10369:           the following sections. Each phase is splitted into
                   10370:           so-called <span class="emphasis"><em>stages</em></span>,
1.66      rillig   10371:           which take the name of the containing phase, prefixed by
1.56      rillig   10372:           one of <code class="varname">pre-</code>, <code class=
                   10373:           "varname">do-</code> or <code class=
                   10374:           "varname">post-</code>. (Examples are <code class=
                   10375:           "varname">pre-configure</code>, <code class=
                   10376:           "varname">post-build</code>.) Most of the actual work is
                   10377:           done in the <code class="varname">do-*</code> stages.</p>
                   10378: 
                   10379:           <p>The basic steps for building a program are always the
                   10380:           same. First the program's source (<span class=
                   10381:           "emphasis"><em>distfile</em></span>) must be brought to
1.66      rillig   10382:           the local system and then extracted. After any
                   10383:           pkgsrc-specific patches to compile properly are applied,
                   10384:           the software can be configured, then built (usually by
                   10385:           compiling), and finally the generated binaries, etc. can
                   10386:           be put into place on the system.</p>
1.56      rillig   10387:         </div>
1.1       grant    10388: 
1.67    ! hubertf  10389:         <div class="sect1" lang="en">
1.1       grant    10390:           <div class="titlepage">
                   10391:             <div>
                   10392:               <div>
                   10393:                 <h2 class="title" style="clear: both"><a name=
1.56      rillig   10394:                 "build.prefix"></a>14.2.&nbsp;Program location</h2>
1.1       grant    10395:               </div>
                   10396:             </div>
                   10397:           </div>
                   10398: 
                   10399:           <p>Before outlining the process performed by the NetBSD
                   10400:           package system in the next section, here's a brief
                   10401:           discussion on where programs are installed, and which
                   10402:           variables influence this.</p>
                   10403: 
1.14      xtraeme  10404:           <p>The automatic variable <code class=
                   10405:           "varname">PREFIX</code> indicates where all files of the
                   10406:           final program shall be installed. It is usually set to
1.45      wiz      10407:           <code class="varname">LOCALBASE</code> (<code xmlns=
                   10408:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10409:           "filename">/usr/pkg</code>), or <code class=
                   10410:           "varname">CROSSBASE</code> for pkgs in the
1.1       grant    10411:           &#8220;<span class="quote">cross</span>&#8221; category.
1.14      xtraeme  10412:           The value of <code class="varname">PREFIX</code> needs to
                   10413:           be put into the various places in the program's source
                   10414:           where paths to these files are encoded. See <a href=
1.1       grant    10415:           "#components.patches" title=
1.38      dillo    10416:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
1.1       grant    10417:           &#8220;patches/*&#8221;</a> and <a href="#fixes.libtool"
                   10418:           title=
1.38      dillo    10419:           "15.3.1.&nbsp;Shared libraries - libtool">Section&nbsp;15.3.1,
1.1       grant    10420:           &#8220;Shared libraries - libtool&#8221;</a> for more
                   10421:           details.</p>
                   10422: 
                   10423:           <p>When choosing which of these variables to use, follow
                   10424:           the following rules:</p>
                   10425: 
                   10426:           <div class="itemizedlist">
                   10427:             <ul type="disc">
                   10428:               <li>
1.14      xtraeme  10429:                 <p><code class="varname">PREFIX</code> always
                   10430:                 points to the location where the current pkg will
                   10431:                 be installed. When referring to a pkg's own
1.1       grant    10432:                 installation path, use &#8220;<span class=
                   10433:                 "quote">${PREFIX}</span>&#8221;.</p>
                   10434:               </li>
                   10435: 
                   10436:               <li>
1.14      xtraeme  10437:                 <p><code class="varname">LOCALBASE</code> is where
                   10438:                 all non-X11 pkgs are installed. If you need to
1.1       grant    10439:                 construct a -I or -L argument to the compiler to
                   10440:                 find includes and libraries installed by another
                   10441:                 non-X11 pkg, use &#8220;<span class=
                   10442:                 "quote">${LOCALBASE}</span>&#8221;.</p>
                   10443:               </li>
                   10444: 
                   10445:               <li>
1.14      xtraeme  10446:                 <p><code class="varname">X11BASE</code> is where
                   10447:                 the actual X11 distribution (from xsrc, etc.) is
1.1       grant    10448:                 installed. When looking for <span class=
                   10449:                 "emphasis"><em>standard</em></span> X11 includes
                   10450:                 (not those installed by a pkg), use
                   10451:                 &#8220;<span class=
                   10452:                 "quote">${X11BASE}</span>&#8221;.</p>
                   10453:               </li>
                   10454: 
                   10455:               <li>
1.47      reed     10456:                 <p>X11-based packages are special in that they may
                   10457:                 be installed in either <code class=
1.14      xtraeme  10458:                 "varname">X11BASE</code> or <code class=
                   10459:                 "varname">LOCALBASE</code>.</p>
1.1       grant    10460: 
                   10461:                 <p>Usually, X11 packages should be installed under
1.14      xtraeme  10462:                 <code class="varname">LOCALBASE</code> whenever
1.34      wiz      10463:                 possible. Note that you will need to include
1.45      wiz      10464:                 <code xmlns=
                   10465:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.34      wiz      10466:                 "filename">../../mk/x11.buildlink3.mk</code> in
                   10467:                 them to request the presence of X11 and to get the
                   10468:                 right compilation flags.</p>
1.1       grant    10469: 
                   10470:                 <p>Even though, there are some packages that cannot
1.14      xtraeme  10471:                 be installed under <code class=
                   10472:                 "varname">LOCALBASE</code>: those that come with
1.1       grant    10473:                 app-defaults files. These packages are special and
1.14      xtraeme  10474:                 they must be placed under <code class=
                   10475:                 "varname">X11BASE</code>. To accomplish this, set
                   10476:                 either <code class="varname">USE_X11BASE</code> or
                   10477:                 <code class="varname">USE_IMAKE</code> in your
1.1       grant    10478:                 package.</p>
                   10479: 
1.34      wiz      10480:                 <p>Some notes: If you need to find includes or
1.14      xtraeme  10481:                 libraries installed by a pkg that has <code class=
                   10482:                 "varname">USE_IMAKE</code> or <code class=
                   10483:                 "varname">USE_X11BASE</code> in its pkg
1.45      wiz      10484:                 <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10485:                 class="filename">Makefile</code>, you need to look
                   10486:                 in <span class="emphasis"><em>both</em></span>
                   10487:                 <code xmlns=
                   10488:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10489:                 "filename">${X11BASE}</code> and <code xmlns=
                   10490:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10491:                 "filename">${LOCALBASE}</code>. To force
                   10492:                 installation of all X11 packages in <code class=
                   10493:                 "varname">LOCALBASE</code>, the <a xmlns=
                   10494:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    10495:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45      wiz      10496:                 target="_top"><code xmlns="" class=
                   10497:                 "filename">pkgtools/xpkgwedge</code></a> package is
1.34      wiz      10498:                 enabled by default.</p>
1.1       grant    10499:               </li>
                   10500: 
                   10501:               <li>
1.14      xtraeme  10502:                 <p><code class="varname">X11PREFIX</code> should be
1.1       grant    10503:                 used to refer to the installed location of an X11
1.14      xtraeme  10504:                 package. <code class="varname">X11PREFIX</code>
                   10505:                 will be set to <code class="varname">X11BASE</code>
                   10506:                 if xpkgwedge is not installed, and to <code class=
                   10507:                 "varname">LOCALBASE</code> if xpkgwedge is
1.1       grant    10508:                 installed.</p>
                   10509:               </li>
                   10510: 
                   10511:               <li>
                   10512:                 <p>If xpkgwedge is installed, it is possible to
1.14      xtraeme  10513:                 have some packages installed in <code class=
                   10514:                 "varname">X11BASE</code> and some in <code class=
                   10515:                 "varname">LOCALBASE</code>. To determine the prefix
                   10516:                 of an installed package, the <code class=
                   10517:                 "varname">EVAL_PREFIX</code> definition can be
                   10518:                 used. It takes pairs in the format
                   10519:                 &#8220;<span class=
1.1       grant    10520:                 "quote">DIRNAME=&lt;package&gt;</span>&#8221;, and
1.24      wiz      10521:                 the <a href=
                   10522:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   10523:                 <span class="citerefentry"><span class=
                   10524:                 "refentrytitle">make</span>(1)</span></a> variable
                   10525:                 <code class="varname">DIRNAME</code> will be set to
                   10526:                 the prefix of the installed package
                   10527:                 &lt;package&gt;, or &#8220;<span class=
1.1       grant    10528:                 "quote">${X11PREFIX}</span>&#8221; if the package
                   10529:                 is not installed.</p>
                   10530: 
                   10531:                 <p>This is best illustrated by example.</p>
                   10532: 
1.45      wiz      10533:                 <p>The following lines are taken from <code xmlns=
                   10534:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10535:                 "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1       grant    10536:                 <pre class="programlisting">
1.51      rillig   10537:     EVAL_PREFIX+=           GTKDIR=gtk+
                   10538:     CONFIGURE_ARGS+=        --with-guile-prefix=${LOCALBASE}        \
                   10539:                             --with-gtk-prefix="${GTKDIR}"           \
                   10540:                             --enable-multibyte
1.1       grant    10541: </pre>
                   10542: 
                   10543:                 <p>Specific defaults can be defined for the
1.14      xtraeme  10544:                 packages evaluated using <code class=
                   10545:                 "varname">EVAL_PREFIX</code>, by using a definition
1.1       grant    10546:                 of the form:</p>
                   10547:                 <pre class="programlisting">
1.51      rillig   10548:     GTKDIR_DEFAULT= ${LOCALBASE}
1.1       grant    10549: </pre>
                   10550: 
1.14      xtraeme  10551:                 <p>where <code class="varname">GTKDIR</code>
1.1       grant    10552:                 corresponds to the first definition in the
1.14      xtraeme  10553:                 <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1       grant    10554:               </li>
                   10555: 
                   10556:               <li>
1.45      wiz      10557:                 <p>Within <code xmlns=
                   10558:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10559:                 "filename">${PREFIX}</code>, packages should
                   10560:                 install files according to <a href=
1.24      wiz      10561:                 "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
                   10562:                 <span class="citerefentry"><span class=
                   10563:                 "refentrytitle">hier</span>(7)</span></a>, with the
1.45      wiz      10564:                 exception that manual pages go into <code xmlns=
                   10565:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10566:                 "filename">${PREFIX}/man</code>, not <code xmlns=
                   10567:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10568:                 "filename">${PREFIX}/share/man</code>.</p>
1.1       grant    10569:               </li>
                   10570:             </ul>
                   10571:           </div>
                   10572:         </div>
                   10573: 
1.67    ! hubertf  10574:         <div class="sect1" lang="en">
1.1       grant    10575:           <div class="titlepage">
                   10576:             <div>
                   10577:               <div>
                   10578:                 <h2 class="title" style="clear: both"><a name=
1.56      rillig   10579:                 "build.builddirs"></a>14.3.&nbsp;Directories used
                   10580:                 during the build process</h2>
1.1       grant    10581:               </div>
                   10582:             </div>
                   10583:           </div>
                   10584: 
1.56      rillig   10585:           <p>When building a package, a number of directories is
                   10586:           used to store source files, temporary files,
                   10587:           pkgsrc-internal files, and so on. These directories are
                   10588:           explained here.</p>
                   10589: 
                   10590:           <p>Some of the directory variables contain relative
                   10591:           pathnames. There are two common base directories for
                   10592:           these relative directories: <code class=
                   10593:           "varname">PKGSRCDIR/PKGPATH</code> is used for
                   10594:           directories that are pkgsrc-specific. <code class=
                   10595:           "varname">WRKSRC</code> is used for directories inside
1.66      rillig   10596:           the package itself.</p>
1.1       grant    10597: 
                   10598:           <div class="variablelist">
                   10599:             <dl>
1.56      rillig   10600:               <dt><span class="term"><code class=
1.66      rillig   10601:               "varname">PKGSRCDIR</code></span></dt>
1.56      rillig   10602: 
                   10603:               <dd>
                   10604:                 <p>This is an absolute pathname that points to the
                   10605:                 pkgsrc root directory. Generally, you don't need
                   10606:                 it.</p>
                   10607:               </dd>
                   10608: 
                   10609:               <dt><span class="term"><code class=
1.66      rillig   10610:               "varname">PKGPATH</code></span></dt>
1.1       grant    10611: 
                   10612:               <dd>
1.56      rillig   10613:                 <p>This is a pathname relative to <code class=
                   10614:                 "varname">PKGSRCDIR</code> that points to the
                   10615:                 current package.</p>
                   10616:               </dd>
                   10617: 
                   10618:               <dt><span class="term"><code class=
1.66      rillig   10619:               "varname">WRKDIR</code></span></dt>
1.56      rillig   10620: 
                   10621:               <dd>
                   10622:                 <p>This is an absolute pathname pointing to the
1.57      minskim  10623:                 directory where all work takes place. The distfiles
                   10624:                 are extraced to this directory. It also contains
                   10625:                 temporary directories and log files used by the
                   10626:                 various pkgsrc frameworks, like <span class=
                   10627:                 "emphasis"><em>buildlink</em></span> or the
                   10628:                 <span class=
1.56      rillig   10629:                 "emphasis"><em>wrappers</em></span>.</p>
                   10630:               </dd>
                   10631: 
                   10632:               <dt><span class="term"><code class=
1.66      rillig   10633:               "varname">WRKSRC</code></span></dt>
1.56      rillig   10634: 
                   10635:               <dd>
                   10636:                 <p>This is an absolute pathname pointing to the
                   10637:                 directory where the distfiles are extracted. It is
                   10638:                 usually a direct subdirectory of <code class=
                   10639:                 "varname">WRKDIR</code>, and often it's the only
1.66      rillig   10640:                 directory entry that isn't hidden. This variable
                   10641:                 may be changed by a package <code xmlns=
                   10642:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10643:                 "filename">Makefile</code>.</p>
1.56      rillig   10644:               </dd>
                   10645:             </dl>
                   10646:           </div>
                   10647:         </div>
                   10648: 
1.67    ! hubertf  10649:         <div class="sect1" lang="en">
1.56      rillig   10650:           <div class="titlepage">
                   10651:             <div>
                   10652:               <div>
                   10653:                 <h2 class="title" style="clear: both"><a name=
                   10654:                 "build.running"></a>14.4.&nbsp;Running a phase</h2>
                   10655:               </div>
                   10656:             </div>
                   10657:           </div>
                   10658: 
                   10659:           <p>You can run a particular phase by typing
                   10660:           <span><strong class="command">make phase</strong></span>,
                   10661:           where <span class="emphasis"><em>phase</em></span> is the
                   10662:           name of the phase. This will automatically run all phases
                   10663:           that are required for this phase. The default phase is
                   10664:           <code class="varname">build</code>, that is, when you run
                   10665:           <span><strong class="command">make</strong></span>
                   10666:           without parameters in a package directory, the package
                   10667:           will be built, but not installed.</p>
                   10668:         </div>
                   10669: 
1.67    ! hubertf  10670:         <div class="sect1" lang="en">
1.56      rillig   10671:           <div class="titlepage">
                   10672:             <div>
                   10673:               <div>
                   10674:                 <h2 class="title" style="clear: both"><a name=
1.67    ! hubertf  10675:                 "build.fetch"></a>14.5.&nbsp;The <span class=
        !          10676:                 "emphasis"><em>fetch</em></span> phase</h2>
1.56      rillig   10677:               </div>
                   10678:             </div>
                   10679:           </div>
                   10680: 
                   10681:           <p>This will check if the file(s) given in the variables
                   10682:           <code class="varname">DISTFILES</code> and <code class=
                   10683:           "varname">PATCHFILES</code> (as defined in the package's
                   10684:           Makefile) are present on the local system in <code xmlns=
                   10685:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10686:           "filename">/usr/pkgsrc/distfiles</code>. If they are not
                   10687:           present, an attempt will be made to fetch them using
                   10688:           commands of the form:</p>
                   10689:           <pre class="programlisting">
1.51      rillig   10690:     ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
1.1       grant    10691: </pre>
                   10692: 
1.56      rillig   10693:           <p>where ${site} varies through several possibilities in
                   10694:           turn: first, <code class=
                   10695:           "varname">MASTER_SITE_OVERRIDE</code> is tried, then the
                   10696:           sites specified in either <code class=
                   10697:           "varname">SITES_file</code> if defined, else <code class=
                   10698:           "varname">MASTER_SITES</code> or <code class=
                   10699:           "varname">PATCH_SITES</code>, as applies, then finally
                   10700:           the value of <code class=
                   10701:           "varname">MASTER_SITE_BACKUP</code>. The order of all
                   10702:           except the first can be optionally sorted by the user,
                   10703:           via setting either <code class=
                   10704:           "varname">MASTER_SORT_AWK</code> or <code class=
                   10705:           "varname">MASTER_SORT_REGEX</code>.</p>
                   10706:         </div>
                   10707: 
1.67    ! hubertf  10708:         <div class="sect1" lang="en">
1.56      rillig   10709:           <div class="titlepage">
                   10710:             <div>
                   10711:               <div>
                   10712:                 <h2 class="title" style="clear: both"><a name=
                   10713:                 "build.checksum"></a>14.6.&nbsp;The <span class=
                   10714:                 "emphasis"><em>checksum</em></span> phase</h2>
                   10715:               </div>
                   10716:             </div>
                   10717:           </div>
                   10718: 
                   10719:           <p>After the distfile(s) are fetched, their checksum is
                   10720:           generated and compared with the checksums stored in the
                   10721:           distinfo file. If the checksums don't match, the build is
                   10722:           aborted. This is to ensure the same distfile is used for
                   10723:           building, and that the distfile wasn't changed, e.g. by
                   10724:           some malign force, deliberately changed distfiles on the
                   10725:           master distribution site or network lossage.</p>
                   10726:         </div>
                   10727: 
1.67    ! hubertf  10728:         <div class="sect1" lang="en">
1.56      rillig   10729:           <div class="titlepage">
                   10730:             <div>
                   10731:               <div>
                   10732:                 <h2 class="title" style="clear: both"><a name=
                   10733:                 "build.extract"></a>14.7.&nbsp;The <span class=
                   10734:                 "emphasis"><em>extract</em></span> phase</h2>
                   10735:               </div>
                   10736:             </div>
                   10737:           </div>
                   10738: 
                   10739:           <p>When the distfiles are present on the local system,
                   10740:           they need to be extracted, as they are usually in the
                   10741:           form of some compressed archive format, most commonly
                   10742:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10743:           class="filename">.tar.gz</code>.</p>
1.1       grant    10744: 
1.56      rillig   10745:           <p>If only some of the distfiles need to be uncompressed,
                   10746:           the files to be uncompressed should be put into
                   10747:           <code class="varname">EXTRACT_ONLY</code>.</p>
1.1       grant    10748: 
1.56      rillig   10749:           <p>If the distfiles are not in <code xmlns=
                   10750:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10751:           "filename">.tar.gz</code> format, they can be extracted
                   10752:           by setting either <code class=
                   10753:           "varname">EXTRACT_SUFX</code>, or <code class=
                   10754:           "varname">EXTRACT_CMD</code>, <code class=
                   10755:           "varname">EXTRACT_BEFORE_ARGS</code> and <code class=
                   10756:           "varname">EXTRACT_AFTER_ARGS</code>. In the former case,
                   10757:           pkgsrc knows how to extract a number of suffixes
                   10758:           (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10759:           class="filename">.tar.gz</code>, <code xmlns=
                   10760:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10761:           "filename">.tgz</code>, <code xmlns=
                   10762:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10763:           "filename">.tar.gz2</code>, <code xmlns=
                   10764:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10765:           "filename">.tbz</code>, <code xmlns=
                   10766:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10767:           "filename">.tar.Z</code>, <code xmlns=
                   10768:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10769:           "filename">.tar</code>, <code xmlns=
                   10770:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10771:           "filename">.shar.gz</code>, <code xmlns=
                   10772:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10773:           "filename">.shar.bz2</code>, <code xmlns=
                   10774:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10775:           "filename">.shar.Z</code>, <code xmlns=
                   10776:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10777:           "filename">.shar</code>, <code xmlns=
                   10778:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10779:           "filename">.Z</code>, <code xmlns=
                   10780:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10781:           "filename">.bz2</code> and <code xmlns=
                   10782:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10783:           "filename">.gz</code>; see the definition of the various
                   10784:           <code class="varname">DECOMPRESS_CMD</code> variables in
                   10785:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10786:           class="filename">bsd.pkg.extract.mk</code> for a complete
                   10787:           list). Here's an example on how to use the other
                   10788:           variables for a program that comes with a compressed
                   10789:           shell archive whose name ends in <code xmlns=
                   10790:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10791:           "filename">.msg.gz</code>:</p>
                   10792:           <pre class="programlisting">
1.51      rillig   10793:     EXTRACT_SUFX=           .msg.gz
                   10794:     EXTRACT_CMD=            zcat
                   10795:     EXTRACT_BEFORE_ARGS=
                   10796:     EXTRACT_AFTER_ARGS=     |sh
1.1       grant    10797: </pre>
1.56      rillig   10798:         </div>
                   10799: 
1.67    ! hubertf  10800:         <div class="sect1" lang="en">
1.56      rillig   10801:           <div class="titlepage">
                   10802:             <div>
                   10803:               <div>
                   10804:                 <h2 class="title" style="clear: both"><a name=
1.67    ! hubertf  10805:                 "build.patch"></a>14.8.&nbsp;The <span class=
        !          10806:                 "emphasis"><em>patch</em></span> phase</h2>
1.56      rillig   10807:               </div>
                   10808:             </div>
                   10809:           </div>
                   10810: 
                   10811:           <p>After extraction, all the patches named by the
                   10812:           <code class="varname">PATCHFILES</code>, those present in
                   10813:           the patches subdirectory of the package as well as in
                   10814:           $LOCALPATCHES/$PKGPATH (e.g. <code xmlns=
                   10815:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10816:           "filename">/usr/local/patches/graphics/png</code>) are
                   10817:           applied. Patchfiles ending in <code xmlns=
                   10818:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10819:           "filename">.Z</code> or <code xmlns=
                   10820:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10821:           "filename">.gz</code> are uncompressed before they are
                   10822:           applied, files ending in <code xmlns=
                   10823:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10824:           "filename">.orig</code> or <code xmlns=
                   10825:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10826:           "filename">.rej</code> are ignored. Any special options
                   10827:           to <a href=
                   10828:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   10829:           <span class="citerefentry"><span class=
                   10830:           "refentrytitle">patch</span>(1)</span></a> can be handed
                   10831:           in <code class="varname">PATCH_DIST_ARGS</code>. See
                   10832:           <a href="#components.patches" title=
                   10833:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
                   10834:           &#8220;patches/*&#8221;</a> for more details.</p>
                   10835: 
                   10836:           <p>By default <a href=
                   10837:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   10838:           <span class="citerefentry"><span class=
                   10839:           "refentrytitle">patch</span>(1)</span></a> is given
                   10840:           special args to make it fail if the patches apply with
                   10841:           some lines of fuzz. Please fix (regen) the patches so
                   10842:           that they apply cleanly. The rationale behind this is
                   10843:           that patches that don't apply cleanly may end up being
                   10844:           applied in the wrong place, and cause severe harm
                   10845:           there.</p>
                   10846:         </div>
                   10847: 
1.67    ! hubertf  10848:         <div class="sect1" lang="en">
1.56      rillig   10849:           <div class="titlepage">
                   10850:             <div>
                   10851:               <div>
                   10852:                 <h2 class="title" style="clear: both"><a name=
1.67    ! hubertf  10853:                 "build.tools"></a>14.9.&nbsp;The <span class=
        !          10854:                 "emphasis"><em>tools</em></span> phase</h2>
1.56      rillig   10855:               </div>
                   10856:             </div>
                   10857:           </div>
                   10858: 
                   10859:           <p>[TODO]</p>
                   10860:         </div>
                   10861: 
1.67    ! hubertf  10862:         <div class="sect1" lang="en">
1.56      rillig   10863:           <div class="titlepage">
                   10864:             <div>
                   10865:               <div>
                   10866:                 <h2 class="title" style="clear: both"><a name=
                   10867:                 "build.wrapper"></a>14.10.&nbsp;The <span class=
                   10868:                 "emphasis"><em>wrapper</em></span> phase</h2>
                   10869:               </div>
                   10870:             </div>
                   10871:           </div>
                   10872: 
                   10873:           <p>[TODO]</p>
                   10874:         </div>
                   10875: 
1.67    ! hubertf  10876:         <div class="sect1" lang="en">
1.56      rillig   10877:           <div class="titlepage">
                   10878:             <div>
                   10879:               <div>
                   10880:                 <h2 class="title" style="clear: both"><a name=
                   10881:                 "build.configure"></a>14.11.&nbsp;The <span class=
                   10882:                 "emphasis"><em>configure</em></span> phase</h2>
                   10883:               </div>
                   10884:             </div>
                   10885:           </div>
                   10886: 
                   10887:           <p>Most pieces of software need information on the header
                   10888:           files, system calls, and library routines which are
                   10889:           available on the platform they run on. The process of
                   10890:           determining this information is known as configuration,
                   10891:           and is usually automated. In most cases, a script is
                   10892:           supplied with the distfiles, and its invocation results
                   10893:           in generation of header files, Makefiles, etc.</p>
                   10894: 
                   10895:           <p>If the package contains a configure script, this can
                   10896:           be invoked by setting <code class=
                   10897:           "varname">HAS_CONFIGURE</code> to &#8220;<span class=
                   10898:           "quote">yes</span>&#8221;. If the configure script is a
                   10899:           GNU autoconf script, you should set <code class=
                   10900:           "varname">GNU_CONFIGURE</code> to &#8220;<span class=
                   10901:           "quote">yes</span>&#8221; instead. What happens in the
                   10902:           <span class="emphasis"><em>configure</em></span> phase is
                   10903:           roughly:</p>
                   10904:           <pre class="programlisting">
                   10905:     .for d in ${CONFIGURE_DIRS}
                   10906:             cd ${WRKSRC} &amp;&amp; cd ${d} &amp;&amp; env ${CONFIGURE_ENV} \
                   10907:                 ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
                   10908:     .endfor
                   10909: </pre>
1.1       grant    10910: 
1.56      rillig   10911:           <p><code class="varname">CONFIGURE_DIRS</code> (default:
                   10912:           &#8220;<span class="quote">.</span>&#8221;) is a list of
                   10913:           pathnames relative to <code class=
                   10914:           "varname">WRKSRC</code>. In each of these directories,
                   10915:           the configure script is run with the environment
                   10916:           <code class="varname">CONFIGURE_ENV</code> and arguments
                   10917:           <code class="varname">CONFIGURE_ARGS</code>. The
                   10918:           variables <code class="varname">CONFIGURE_ENV</code>,
                   10919:           <code class="varname">CONFIGURE_SCRIPT</code> (default:
                   10920:           &#8220;<span class="quote">./configure</span>&#8221;) and
                   10921:           <code class="varname">CONFIGURE_ARGS</code> may all be
                   10922:           changed by the package.</p>
1.1       grant    10923: 
1.56      rillig   10924:           <p>If the program uses an <code xmlns=
                   10925:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10926:           "filename">Imakefile</code> for configuration, the
                   10927:           appropriate steps can be invoked by setting <code class=
                   10928:           "varname">USE_IMAKE</code> to &#8220;<span class=
                   10929:           "quote">yes</span>&#8221;. (If you only want the package
                   10930:           installed in <code class="varname">${X11PREFIX}</code>
                   10931:           but xmkmf not being run, set <code class=
                   10932:           "varname">USE_X11BASE</code> instead.)</p>
                   10933:         </div>
1.1       grant    10934: 
1.67    ! hubertf  10935:         <div class="sect1" lang="en">
1.56      rillig   10936:           <div class="titlepage">
                   10937:             <div>
                   10938:               <div>
                   10939:                 <h2 class="title" style="clear: both"><a name=
1.67    ! hubertf  10940:                 "build.build"></a>14.12.&nbsp;The <span class=
        !          10941:                 "emphasis"><em>build</em></span> phase</h2>
1.56      rillig   10942:               </div>
                   10943:             </div>
1.1       grant    10944:           </div>
                   10945: 
1.56      rillig   10946:           <p>For building a package, a rough equivalent of the
                   10947:           following code is executed.</p>
1.1       grant    10948:           <pre class="programlisting">
1.56      rillig   10949:     .for d in ${BUILD_DIRS}
                   10950:             cd ${WRKSRC} &amp;&amp; cd ${d} &amp;&amp; env ${MAKE_ENV} \
                   10951:                 ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} \
                   10952:                     -f ${MAKEFILE} ${BUILD_TARGET}
                   10953:     .endfor
1.1       grant    10954: </pre>
1.56      rillig   10955: 
                   10956:           <p><code class="varname">BUILD_DIRS</code> (default:
                   10957:           &#8220;<span class="quote">.</span>&#8221;) is a list of
                   10958:           pathnames relative to <code class=
                   10959:           "varname">WRKSRC</code>. In each of these directories,
                   10960:           <code class="varname">MAKE_PROGRAM</code> is run with the
                   10961:           environment <code class="varname">MAKE_ENV</code> and
                   10962:           arguments <code class="varname">BUILD_MAKE_FLAGS</code>.
                   10963:           The variables <code class="varname">MAKE_ENV</code>,
                   10964:           <code class="varname">BUILD_MAKE_FLAGS</code>,
                   10965:           <code class="varname">MAKEFILE</code> and <code class=
                   10966:           "varname">BUILD_TARGET</code> may all be changed by the
                   10967:           package.</p>
                   10968: 
                   10969:           <p>The default value of <code class=
                   10970:           "varname">MAKE_PROGRAM</code> is &#8220;<span class=
                   10971:           "quote">gmake</span>&#8221; if <code class=
                   10972:           "varname">USE_TOOLS</code> contains &#8220;<span class=
                   10973:           "quote">gmake</span>&#8221;, &#8220;<span class=
                   10974:           "quote">make</span>&#8221; otherwise. The default value
                   10975:           of <code class="varname">MAKEFILE</code> is
                   10976:           &#8220;<span class="quote">Makefile</span>&#8221;, and
                   10977:           <code class="varname">BUILD_TARGET</code> defaults to
                   10978:           &#8220;<span class="quote">all</span>&#8221;.</p>
                   10979:         </div>
                   10980: 
1.67    ! hubertf  10981:         <div class="sect1" lang="en">
1.56      rillig   10982:           <div class="titlepage">
                   10983:             <div>
                   10984:               <div>
                   10985:                 <h2 class="title" style="clear: both"><a name=
1.67    ! hubertf  10986:                 "build.test"></a>14.13.&nbsp;The <span class=
        !          10987:                 "emphasis"><em>test</em></span> phase</h2>
1.56      rillig   10988:               </div>
                   10989:             </div>
                   10990:           </div>
                   10991: 
                   10992:           <p>[TODO]</p>
                   10993:         </div>
                   10994: 
1.67    ! hubertf  10995:         <div class="sect1" lang="en">
1.56      rillig   10996:           <div class="titlepage">
                   10997:             <div>
                   10998:               <div>
                   10999:                 <h2 class="title" style="clear: both"><a name=
                   11000:                 "build.install"></a>14.14.&nbsp;The <span class=
                   11001:                 "emphasis"><em>install</em></span> phase</h2>
                   11002:               </div>
                   11003:             </div>
                   11004:           </div>
                   11005: 
                   11006:           <p>Once the build stage has completed, the final step is
                   11007:           to install the software in public directories, so users
                   11008:           can access the programs and files. As in the
1.67    ! hubertf  11009:           build-target, <code class="varname">$MAKE_PROGRAM</code>
        !          11010:           is invoked on <code class="varname">$MAKEFILE</code>
        !          11011:           here, but with the <code class=
        !          11012:           "varname">$INSTALL_TARGET</code> instead, the latter
        !          11013:           defaulting to &#8220;<span class=
1.56      rillig   11014:           "quote">install</span>&#8221; (plus &#8220;<span class=
                   11015:           "quote">install.man</span>&#8221;, if <code class=
                   11016:           "varname">USE_IMAKE</code> is set).</p>
                   11017:         </div>
                   11018: 
1.67    ! hubertf  11019:         <div class="sect1" lang="en">
1.56      rillig   11020:           <div class="titlepage">
                   11021:             <div>
                   11022:               <div>
                   11023:                 <h2 class="title" style="clear: both"><a name=
                   11024:                 "build.package"></a>14.15.&nbsp;The <span class=
                   11025:                 "emphasis"><em>package</em></span> phase</h2>
                   11026:               </div>
                   11027:             </div>
                   11028:           </div>
                   11029: 
                   11030:           <p>[TODO]</p>
1.1       grant    11031:         </div>
                   11032: 
1.67    ! hubertf  11033:         <div class="sect1" lang="en">
1.1       grant    11034:           <div class="titlepage">
                   11035:             <div>
                   11036:               <div>
                   11037:                 <h2 class="title" style="clear: both"><a name=
1.56      rillig   11038:                 "build.helpful-targets"></a>14.16.&nbsp;Other
1.1       grant    11039:                 helpful targets</h2>
                   11040:               </div>
                   11041:             </div>
                   11042:           </div>
                   11043: 
                   11044:           <div class="variablelist">
                   11045:             <dl>
                   11046:               <dt><span class="term">pre/post-*</span></dt>
                   11047: 
                   11048:               <dd>
                   11049:                 <p>For any of the main targets described in the
                   11050:                 previous section, two auxiliary targets exist with
                   11051:                 &#8220;<span class="quote">pre-</span>&#8221; and
                   11052:                 &#8220;<span class="quote">post-</span>&#8221; used
                   11053:                 as a prefix for the main target's name. These
                   11054:                 targets are invoked before and after the main
                   11055:                 target is called, allowing extra configuration or
                   11056:                 installation steps be performed from a package's
                   11057:                 Makefile, for example, which a program's configure
                   11058:                 script or install target omitted.</p>
                   11059:               </dd>
                   11060: 
                   11061:               <dt><span class="term">do-*</span></dt>
                   11062: 
                   11063:               <dd>
                   11064:                 <p>Should one of the main targets do the wrong
                   11065:                 thing, and should there be no variable to fix this,
                   11066:                 you can redefine it with the do-* target. (Note
                   11067:                 that redefining the target itself instead of the
                   11068:                 do-* target is a bad idea, as the pre-* and post-*
                   11069:                 targets won't be called anymore, etc.) You will not
                   11070:                 usually need to do this.</p>
                   11071:               </dd>
                   11072: 
                   11073:               <dt><span class="term">reinstall</span></dt>
                   11074: 
                   11075:               <dd>
1.14      xtraeme  11076:                 <p>If you did a <span><strong class="command">make
                   11077:                 install</strong></span> and you noticed some file
                   11078:                 was not installed properly, you can repeat the
1.1       grant    11079:                 installation with this target, which will ignore
                   11080:                 the &#8220;<span class="quote">already
                   11081:                 installed</span>&#8221; flag.</p>
                   11082:               </dd>
                   11083: 
                   11084:               <dt><span class="term">deinstall</span></dt>
                   11085: 
                   11086:               <dd>
1.24      wiz      11087:                 <p>This target does a <a href=
                   11088:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   11089:                 <span class="citerefentry"><span class=
                   11090:                 "refentrytitle">pkg_delete</span>(1)</span></a> in
                   11091:                 the current directory, effectively de-installing
                   11092:                 the package. The following variables can be used to
                   11093:                 tune the behaviour:</p>
1.1       grant    11094: 
                   11095:                 <div class="variablelist">
                   11096:                   <dl>
1.14      xtraeme  11097:                     <dt><span class="term"><code class=
                   11098:                     "varname">PKG_VERBOSE</code></span></dt>
1.1       grant    11099: 
                   11100:                     <dd>
                   11101:                       <p>Add a "-v" to the <a href=
                   11102:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   11103:                       <span class="citerefentry"><span class=
                   11104:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   11105:                       command.</p>
                   11106:                     </dd>
                   11107: 
1.14      xtraeme  11108:                     <dt><span class="term"><code class=
                   11109:                     "varname">DEINSTALLDEPENDS</code></span></dt>
1.1       grant    11110: 
                   11111:                     <dd>
                   11112:                       <p>Remove all packages that require (depend
                   11113:                       on) the given package. This can be used to
                   11114:                       remove any packages that may have been pulled
                   11115:                       in by a given package, e.g. if
1.14      xtraeme  11116:                       <span><strong class="command">make deinstall
                   11117:                       DEINSTALLDEPENDS=1</strong></span> is done in
1.45      wiz      11118:                       <code xmlns=
                   11119:                       "http://www.w3.org/TR/xhtml1/transitional"
                   11120:                       class="filename">pkgsrc/x11/kde</code>, this
                   11121:                       is likely to remove whole KDE. Works by
1.1       grant    11122:                       adding &#8220;<span class=
                   11123:                       "quote">-R</span>&#8221; to the <a href=
                   11124:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   11125:                       <span class="citerefentry"><span class=
                   11126:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   11127:                       command line.</p>
                   11128:                     </dd>
                   11129:                   </dl>
                   11130:                 </div>
                   11131:               </dd>
                   11132: 
                   11133:               <dt><span class="term">update</span></dt>
                   11134: 
                   11135:               <dd>
                   11136:                 <p>This target causes the current package to be
                   11137:                 updated to the latest version. The package and all
                   11138:                 depending packages first get de-installed, then
                   11139:                 current versions of the corresponding packages get
                   11140:                 compiled and installed. This is similar to manually
                   11141:                 noting which packages are currently installed, then
1.14      xtraeme  11142:                 performing a series of <span><strong class=
                   11143:                 "command">make deinstall</strong></span> and
                   11144:                 <span><strong class="command">make
                   11145:                 install</strong></span> (or whatever <code class=
                   11146:                 "varname">UPDATE_TARGET</code> is set to) for these
                   11147:                 packages.</p>
1.1       grant    11148: 
                   11149:                 <p>You can use the &#8220;<span class=
                   11150:                 "quote">update</span>&#8221; target to resume
1.14      xtraeme  11151:                 package updating in case a previous
                   11152:                 <span><strong class="command">make
                   11153:                 update</strong></span> was interrupted for some
                   11154:                 reason. However, in this case, make sure you don't
                   11155:                 call <span><strong class="command">make
                   11156:                 clean</strong></span> or otherwise remove the list
                   11157:                 of dependent packages in <code class=
1.47      reed     11158:                 "varname">WRKDIR</code>. Otherwise, you lose the
1.1       grant    11159:                 ability to automatically update the current package
                   11160:                 along with the dependent packages you have
                   11161:                 installed.</p>
                   11162: 
1.14      xtraeme  11163:                 <p>Resuming an interrupted <span><strong class=
                   11164:                 "command">make update</strong></span> will only
                   11165:                 work as long as the package tree remains unchanged.
                   11166:                 If the source code for one of the packages to be
                   11167:                 updated has been changed, resuming
                   11168:                 <span><strong class="command">make
                   11169:                 update</strong></span> will most certainly
                   11170:                 fail!</p>
1.1       grant    11171: 
                   11172:                 <p>The following variables can be used either on
1.45      wiz      11173:                 the command line or in <code xmlns=
                   11174:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11175:                 "filename">/etc/mk.conf</code> to alter the
                   11176:                 behaviour of <span><strong class="command">make
                   11177:                 update</strong></span>:</p>
1.1       grant    11178: 
                   11179:                 <div class="variablelist">
                   11180:                   <dl>
1.14      xtraeme  11181:                     <dt><span class="term"><code class=
                   11182:                     "varname">UPDATE_TARGET</code></span></dt>
1.1       grant    11183: 
                   11184:                     <dd>
                   11185:                       <p>Install target to recursively use for the
                   11186:                       updated package and the dependent packages.
1.14      xtraeme  11187:                       Defaults to <code class=
                   11188:                       "varname">DEPENDS_TARGET</code> if set,
1.1       grant    11189:                       &#8220;<span class=
                   11190:                       "quote">install</span>&#8221; otherwise for
1.14      xtraeme  11191:                       <span><strong class="command">make
                   11192:                       update</strong></span>. e.g.
                   11193:                       <span><strong class="command">make update
                   11194:                       UPDATE_TARGET=package</strong></span></p>
1.1       grant    11195:                     </dd>
                   11196: 
1.14      xtraeme  11197:                     <dt><span class="term"><code class=
                   11198:                     "varname">NOCLEAN</code></span></dt>
1.1       grant    11199: 
                   11200:                     <dd>
                   11201:                       <p>Don't clean up after updating. Useful if
                   11202:                       you want to leave the work sources of the
                   11203:                       updated packages around for inspection or
                   11204:                       other purposes. Be sure you eventually clean
                   11205:                       up the source tree (see the
                   11206:                       &#8220;<span class=
                   11207:                       "quote">clean-update</span>&#8221; target
                   11208:                       below) or you may run into troubles with old
                   11209:                       source code still lying around on your next
1.14      xtraeme  11210:                       <span><strong class=
                   11211:                       "command">make</strong></span> or
                   11212:                       <span><strong class="command">make
                   11213:                       update</strong></span>.</p>
1.1       grant    11214:                     </dd>
                   11215: 
1.14      xtraeme  11216:                     <dt><span class="term"><code class=
                   11217:                     "varname">REINSTALL</code></span></dt>
1.1       grant    11218: 
                   11219:                     <dd>
                   11220:                       <p>Deinstall each package before installing
1.14      xtraeme  11221:                       (making <code class=
                   11222:                       "varname">DEPENDS_TARGET</code>). This may be
1.1       grant    11223:                       necessary if the &#8220;<span class=
                   11224:                       "quote">clean-update</span>&#8221; target
                   11225:                       (see below) was called after interrupting a
1.14      xtraeme  11226:                       running <span><strong class="command">make
                   11227:                       update</strong></span>.</p>
1.1       grant    11228:                     </dd>
                   11229: 
1.14      xtraeme  11230:                     <dt><span class="term"><code class=
                   11231:                     "varname">DEPENDS_TARGET</code></span></dt>
1.1       grant    11232: 
                   11233:                     <dd>
                   11234:                       <p>Allows you to disable recursion and
                   11235:                       hardcode the target for packages. The default
                   11236:                       is &#8220;<span class=
                   11237:                       "quote">update</span>&#8221; for the update
                   11238:                       target, facilitating a recursive update of
1.14      xtraeme  11239:                       prerequisite packages. Only set <code class=
                   11240:                       "varname">DEPENDS_TARGET</code> if you want
                   11241:                       to disable recursive updates. Use
                   11242:                       <code class="varname">UPDATE_TARGET</code>
                   11243:                       instead to just set a specific target for
                   11244:                       each package to be installed during
                   11245:                       <span><strong class="command">make
                   11246:                       update</strong></span> (see above).</p>
1.1       grant    11247:                     </dd>
                   11248:                   </dl>
                   11249:                 </div>
                   11250:               </dd>
                   11251: 
                   11252:               <dt><span class="term">clean-update</span></dt>
                   11253: 
                   11254:               <dd>
                   11255:                 <p>Clean the source tree for all packages that
1.14      xtraeme  11256:                 would get updated if <span><strong class=
                   11257:                 "command">make update</strong></span> was called
                   11258:                 from the current directory. This target should not
                   11259:                 be used if the current package (or any of its
                   11260:                 depending packages) have already been de-installed
                   11261:                 (e.g., after calling <span><strong class=
                   11262:                 "command">make update</strong></span>) or you may
                   11263:                 lose some packages you intended to update. As a
                   11264:                 rule of thumb: only use this target <span class=
                   11265:                 "emphasis"><em>before</em></span> the first time
                   11266:                 you run <span><strong class="command">make
                   11267:                 update</strong></span> and only if you have a dirty
                   11268:                 package tree (e.g., if you used <code class=
                   11269:                 "varname">NOCLEAN</code>).</p>
1.1       grant    11270: 
1.47      reed     11271:                 <p>If you are unsure about whether your tree is
                   11272:                 clean, you can either perform a
1.14      xtraeme  11273:                 <span><strong class="command">make
1.47      reed     11274:                 clean</strong></span> at the top of the tree, or
                   11275:                 use the following sequence of commands from the
                   11276:                 directory of the package you want to update
                   11277:                 (<span class="emphasis"><em>before</em></span>
                   11278:                 running <span><strong class="command">make
1.14      xtraeme  11279:                 update</strong></span> for the first time,
                   11280:                 otherwise you lose all the packages you wanted to
                   11281:                 update!):</p>
1.1       grant    11282:                 <pre class="screen">
1.14      xtraeme  11283: <code class="prompt">#</code> <strong class=
                   11284: "userinput"><code>make clean-update</code></strong>
                   11285: <code class="prompt">#</code> <strong class=
                   11286: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
                   11287: <code class="prompt">#</code> <strong class=
                   11288: "userinput"><code>make update</code></strong>
1.1       grant    11289: </pre>
                   11290: 
                   11291:                 <p>The following variables can be used either on
1.45      wiz      11292:                 the command line or in <code xmlns=
                   11293:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11294:                 "filename">/etc/mk.conf</code> to alter the
                   11295:                 behaviour of <span><strong class="command">make
                   11296:                 clean-update</strong></span>:</p>
1.1       grant    11297: 
                   11298:                 <div class="variablelist">
                   11299:                   <dl>
1.14      xtraeme  11300:                     <dt><span class="term"><code class=
                   11301:                     "varname">CLEAR_DIRLIST</code></span></dt>
1.1       grant    11302: 
                   11303:                     <dd>
1.14      xtraeme  11304:                       <p>After <span><strong class="command">make
                   11305:                       clean</strong></span>, do not reconstruct the
                   11306:                       list of directories to update for this
                   11307:                       package. Only use this if
                   11308:                       <span><strong class="command">make
                   11309:                       update</strong></span> successfully installed
                   11310:                       all packages you wanted to update. Normally,
                   11311:                       this is done automatically on
                   11312:                       <span><strong class="command">make
                   11313:                       update</strong></span>, but may have been
                   11314:                       suppressed by the <code class=
                   11315:                       "varname">NOCLEAN</code> variable (see
1.1       grant    11316:                       above).</p>
                   11317:                     </dd>
                   11318:                   </dl>
                   11319:                 </div>
                   11320:               </dd>
                   11321: 
                   11322:               <dt><span class="term">info</span></dt>
                   11323: 
                   11324:               <dd>
                   11325:                 <p>This target invokes <a href=
                   11326:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   11327:                 <span class="citerefentry"><span class=
                   11328:                 "refentrytitle">pkg_info</span>(1)</span></a> for
                   11329:                 the current package. You can use this to check
                   11330:                 which version of a package is installed.</p>
                   11331:               </dd>
                   11332: 
                   11333:               <dt><span class="term">readme</span></dt>
                   11334: 
                   11335:               <dd>
1.45      wiz      11336:                 <p>This target generates a <code xmlns=
                   11337:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11338:                 "filename">README.html</code> file, which can be
1.1       grant    11339:                 viewed using a browser such as <a xmlns=
                   11340:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   11341:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45      wiz      11342:                 target="_top"><code xmlns="" class=
                   11343:                 "filename">www/mozilla</code></a> or <a xmlns=
1.20      ben      11344:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   11345:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
1.45      wiz      11346:                 target="_top"><code xmlns="" class=
                   11347:                 "filename">www/links</code></a>. The generated
                   11348:                 files contain references to any packages which are
                   11349:                 in the <code class="varname">PACKAGES</code>
                   11350:                 directory on the local host. The generated files
                   11351:                 can be made to refer to URLs based on <code class=
1.20      ben      11352:                 "varname">FTP_PKG_URL_HOST</code> and <code class=
                   11353:                 "varname">FTP_PKG_URL_DIR</code>. For example, if I
1.45      wiz      11354:                 wanted to generate <code xmlns=
                   11355:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      11356:                 "filename">README.html</code> files which pointed
                   11357:                 to binary packages on the local machine, in the
1.45      wiz      11358:                 directory <code xmlns=
                   11359:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      11360:                 "filename">/usr/packages</code>, set <code class=
                   11361:                 "varname">FTP_PKG_URL_HOST=file://localhost</code>
                   11362:                 and <code class=
                   11363:                 "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
                   11364:                 <code class="varname">${PACKAGES}</code> directory
                   11365:                 and its subdirectories will be searched for all the
                   11366:                 binary packages.</p>
1.1       grant    11367:               </dd>
                   11368: 
                   11369:               <dt><span class="term">readme-all</span></dt>
                   11370: 
                   11371:               <dd>
1.45      wiz      11372:                 <p>Use this target to create a file <code xmlns=
                   11373:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11374:                 "filename">README-all.html</code> which contains a
1.1       grant    11375:                 list of all packages currently available in the
                   11376:                 NetBSD Packages Collection, together with the
                   11377:                 category they belong to and a short description.
1.45      wiz      11378:                 This file is compiled from the <code xmlns=
                   11379:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11380:                 "filename">pkgsrc/*/README.html</code> files, so be
1.1       grant    11381:                 sure to run this <span class=
1.14      xtraeme  11382:                 "emphasis"><em>after</em></span> a
                   11383:                 <span><strong class="command">make
                   11384:                 readme</strong></span>.</p>
1.1       grant    11385:               </dd>
                   11386: 
                   11387:               <dt><span class="term">cdrom-readme</span></dt>
                   11388: 
                   11389:               <dd>
                   11390:                 <p>This is very much the same as the
                   11391:                 &#8220;<span class="quote">readme</span>&#8221;
                   11392:                 target (see above), but is to be used when
                   11393:                 generating a pkgsrc tree to be written to a CD-ROM.
1.45      wiz      11394:                 This target also produces <code xmlns=
                   11395:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11396:                 "filename">README.html</code> files, and can be
                   11397:                 made to refer to URLs based on <code class=
                   11398:                 "varname">CDROM_PKG_URL_HOST</code> and
                   11399:                 <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1       grant    11400:               </dd>
                   11401: 
                   11402:               <dt><span class="term">show-distfiles</span></dt>
                   11403: 
                   11404:               <dd>
                   11405:                 <p>This target shows which distfiles and patchfiles
1.14      xtraeme  11406:                 are needed to build the package. (<code class=
                   11407:                 "varname">DISTFILES</code> and <code class=
1.45      wiz      11408:                 "varname">PATCHFILES</code>, but not <code xmlns=
                   11409:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11410:                 "filename">patches/*</code>)</p>
1.1       grant    11411:               </dd>
                   11412: 
                   11413:               <dt><span class="term">show-downlevel</span></dt>
                   11414: 
                   11415:               <dd>
                   11416:                 <p>This target shows nothing if the package is not
                   11417:                 installed. If a version of this package is
                   11418:                 installed, but is not the version provided in this
                   11419:                 version of pkgsrc, then a warning message is
                   11420:                 displayed. This target can be used to show which of
                   11421:                 your installed packages are downlevel, and so the
                   11422:                 old versions can be deleted, and the current ones
                   11423:                 added.</p>
                   11424:               </dd>
                   11425: 
                   11426:               <dt><span class="term">show-pkgsrc-dir</span></dt>
                   11427: 
                   11428:               <dd>
                   11429:                 <p>This target shows the directory in the pkgsrc
                   11430:                 hierarchy from which the package can be built and
                   11431:                 installed. This may not be the same directory as
                   11432:                 the one from which the package was installed. This
                   11433:                 target is intended to be used by people who may
                   11434:                 wish to upgrade many packages on a single host, and
                   11435:                 can be invoked from the top-level pkgsrc Makefile
                   11436:                 by using the &#8220;<span class=
                   11437:                 "quote">show-host-specific-pkgs</span>&#8221;
                   11438:                 target.</p>
                   11439:               </dd>
                   11440: 
                   11441:               <dt><span class=
                   11442:               "term">show-installed-depends</span></dt>
                   11443: 
                   11444:               <dd>
                   11445:                 <p>This target shows which installed packages match
1.14      xtraeme  11446:                 the current package's <code class=
                   11447:                 "varname">DEPENDS</code>. Useful if out of date
1.1       grant    11448:                 dependencies are causing build problems.</p>
                   11449:               </dd>
                   11450: 
                   11451:               <dt><span class="term">check-shlibs</span></dt>
                   11452: 
                   11453:               <dd>
                   11454:                 <p>After a package is installed, check all its
                   11455:                 binaries and (on ELF platforms) shared libraries to
                   11456:                 see if they find the shared libs they need. Run by
1.14      xtraeme  11457:                 default if <code class=
                   11458:                 "varname">PKG_DEVELOPER</code> is set in
1.45      wiz      11459:                 <code xmlns=
                   11460:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11461:                 "filename">/etc/mk.conf</code>.</p>
1.1       grant    11462:               </dd>
                   11463: 
                   11464:               <dt><span class="term">print-PLIST</span></dt>
                   11465: 
                   11466:               <dd>
                   11467:                 <p>After a &#8220;<span class="quote">make
                   11468:                 install</span>&#8221; from a new or upgraded pkg,
                   11469:                 this prints out an attempt to generate a new
1.45      wiz      11470:                 <code xmlns=
                   11471:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11472:                 "filename">PLIST</code> from a <span><strong class=
                   11473:                 "command">find -newer
1.14      xtraeme  11474:                 work/.extract_done</strong></span>. An attempt is
                   11475:                 made to care for shared libs etc., but it is
1.1       grant    11476:                 <span class="emphasis"><em>strongly</em></span>
                   11477:                 recommended to review the result before putting it
1.45      wiz      11478:                 into <code xmlns=
                   11479:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11480:                 "filename">PLIST</code>. On upgrades, it's useful
                   11481:                 to diff the output of this command against an
                   11482:                 already existing <code xmlns=
                   11483:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11484:                 "filename">PLIST</code> file.</p>
1.1       grant    11485: 
1.24      wiz      11486:                 <p>If the package installs files via <a href=
                   11487:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   11488:                 <span class="citerefentry"><span class=
                   11489:                 "refentrytitle">tar</span>(1)</span></a> or other
                   11490:                 methods that don't update file access times, be
                   11491:                 sure to add these files manually to your
1.45      wiz      11492:                 <code xmlns=
                   11493:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11494:                 "filename">PLIST</code>, as the &#8220;<span class=
                   11495:                 "quote">find -newer</span>&#8221; command used by
                   11496:                 this target won't catch them!</p>
1.1       grant    11497: 
                   11498:                 <p>See <a href="#print-PLIST" title=
1.38      dillo    11499:                 "10.3.&nbsp;Tweaking output of make print-PLIST">Section&nbsp;10.3,
1.14      xtraeme  11500:                 &#8220;Tweaking output of <span><strong class=
                   11501:                 "command">make
                   11502:                 print-PLIST</strong></span>&#8221;</a> for more
                   11503:                 information on this target.</p>
1.1       grant    11504:               </dd>
                   11505: 
                   11506:               <dt><span class="term">bulk-package</span></dt>
                   11507: 
                   11508:               <dd>
                   11509:                 <p>Used to do bulk builds. If an appropriate binary
                   11510:                 package already exists, no action is taken. If not,
                   11511:                 this target will compile, install and package it
1.47      reed     11512:                 (and its depends, if <code class=
1.14      xtraeme  11513:                 "varname">PKG_DEPENDS</code> is set properly. See
1.1       grant    11514:                 <a href="#binary.configuration" title=
1.38      dillo    11515:                 "6.3.1.&nbsp;Configuration">Section&nbsp;6.3.1,
1.47      reed     11516:                 &#8220;Configuration&#8221;</a>). After creating
                   11517:                 the binary package, the sources, the just-installed
                   11518:                 package and its required packages are removed,
1.1       grant    11519:                 preserving free disk space.</p>
                   11520: 
                   11521:                 <p><span class="emphasis"><em>Beware that this
                   11522:                 target may deinstall all packages installed on a
                   11523:                 system!</em></span></p>
                   11524:               </dd>
                   11525: 
                   11526:               <dt><span class="term">bulk-install</span></dt>
                   11527: 
                   11528:               <dd>
                   11529:                 <p>Used during bulk-installs to install required
1.47      reed     11530:                 packages. If an up-to-date binary package is
1.1       grant    11531:                 available, it will be installed via <a href=
                   11532:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   11533:                 <span class="citerefentry"><span class=
                   11534:                 "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14      xtraeme  11535:                 not, <span><strong class="command">make
                   11536:                 bulk-package</strong></span> will be executed, but
1.47      reed     11537:                 the installed binary won't be removed.</p>
1.1       grant    11538: 
                   11539:                 <p>A binary package is considered
1.47      reed     11540:                 &#8220;<span class="quote">up-to-date</span>&#8221;
1.1       grant    11541:                 to be installed via <a href=
                   11542:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   11543:                 <span class="citerefentry"><span class=
                   11544:                 "refentrytitle">pkg_add</span>(1)</span></a>
                   11545:                 if:</p>
                   11546: 
                   11547:                 <div class="itemizedlist">
                   11548:                   <ul type="disc">
                   11549:                     <li>
1.45      wiz      11550:                       <p>None of the package's files (<code xmlns=
                   11551:                       "http://www.w3.org/TR/xhtml1/transitional"
                   11552:                       class="filename">Makefile</code>, ...) were
1.14      xtraeme  11553:                       modified since it was built.</p>
1.1       grant    11554:                     </li>
                   11555: 
                   11556:                     <li>
                   11557:                       <p>None of the package's required (binary)
                   11558:                       packages were modified since it was
                   11559:                       built.</p>
                   11560:                     </li>
                   11561:                   </ul>
                   11562:                 </div>
                   11563: 
                   11564:                 <p><span class="emphasis"><em>Beware that this
                   11565:                 target may deinstall all packages installed on a
                   11566:                 system!</em></span></p>
                   11567:               </dd>
                   11568:             </dl>
                   11569:           </div>
                   11570:         </div>
                   11571:       </div>
                   11572: 
1.67    ! hubertf  11573:       <div class="chapter" lang="en">
1.1       grant    11574:         <div class="titlepage">
                   11575:           <div>
                   11576:             <div>
1.67    ! hubertf  11577:               <h2 class="title"><a name=
1.55      rillig   11578:               "fixes"></a>Chapter&nbsp;15.&nbsp;Making your package
                   11579:               work</h2>
1.1       grant    11580:             </div>
                   11581:           </div>
                   11582:         </div>
                   11583: 
                   11584:         <div class="toc">
                   11585:           <p><b>Table of Contents</b></p>
                   11586: 
                   11587:           <dl>
1.30      wiz      11588:             <dt><span class="sect1"><a href=
1.38      dillo    11589:             "#general-operation">15.1. General
1.30      wiz      11590:             operation</a></span></dt>
1.1       grant    11591: 
                   11592:             <dd>
                   11593:               <dl>
                   11594:                 <dt><span class="sect2"><a href=
1.38      dillo    11595:                 "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30      wiz      11596:                 pull in variables from /etc/mk.conf</a></span></dt>
1.1       grant    11597: 
                   11598:                 <dt><span class="sect2"><a href=
1.38      dillo    11599:                 "#where-to-install-documentation">15.1.2. Where to
1.31      wiz      11600:                 install documentation</a></span></dt>
                   11601: 
                   11602:                 <dt><span class="sect2"><a href=
1.38      dillo    11603:                 "#restricted-packages">15.1.3. Restricted
1.1       grant    11604:                 packages</a></span></dt>
                   11605: 
                   11606:                 <dt><span class="sect2"><a href=
1.38      dillo    11607:                 "#dependencies">15.1.4. Handling
1.1       grant    11608:                 dependencies</a></span></dt>
                   11609: 
                   11610:                 <dt><span class="sect2"><a href=
1.38      dillo    11611:                 "#conflicts">15.1.5. Handling conflicts with other
1.1       grant    11612:                 packages</a></span></dt>
                   11613: 
                   11614:                 <dt><span class="sect2"><a href=
1.38      dillo    11615:                 "#not-building-packages">15.1.6. Packages that
1.30      wiz      11616:                 cannot or should not be built</a></span></dt>
1.1       grant    11617: 
                   11618:                 <dt><span class="sect2"><a href=
1.38      dillo    11619:                 "#undeletable-packages">15.1.7. Packages which
1.30      wiz      11620:                 should not be deleted, once
                   11621:                 installed</a></span></dt>
1.1       grant    11622: 
                   11623:                 <dt><span class="sect2"><a href=
1.38      dillo    11624:                 "#security-handling">15.1.8. Handling packages with
1.1       grant    11625:                 security problems</a></span></dt>
                   11626: 
                   11627:                 <dt><span class="sect2"><a href=
1.38      dillo    11628:                 "#compiler-bugs">15.1.9. How to handle compiler
1.1       grant    11629:                 bugs</a></span></dt>
                   11630: 
                   11631:                 <dt><span class="sect2"><a href=
1.38      dillo    11632:                 "#bumping-pkgrevision">15.1.10. How to handle
1.30      wiz      11633:                 incrementing versions when fixing an existing
1.1       grant    11634:                 package</a></span></dt>
                   11635: 
                   11636:                 <dt><span class="sect2"><a href=
1.38      dillo    11637:                 "#portability-of-packages">15.1.11. Portability of
1.1       grant    11638:                 packages</a></span></dt>
                   11639:               </dl>
                   11640:             </dd>
                   11641: 
1.30      wiz      11642:             <dt><span class="sect1"><a href=
1.38      dillo    11643:             "#downloading-issues">15.2. Possible downloading
1.30      wiz      11644:             issues</a></span></dt>
1.1       grant    11645: 
                   11646:             <dd>
                   11647:               <dl>
                   11648:                 <dt><span class="sect2"><a href=
1.38      dillo    11649:                 "#no-plain-download">15.2.1. Packages whose
1.30      wiz      11650:                 distfiles aren't available for plain
1.1       grant    11651:                 downloading</a></span></dt>
                   11652: 
                   11653:                 <dt><span class="sect2"><a href=
1.38      dillo    11654:                 "#modified-distfiles-same-name">15.2.2. How to
1.30      wiz      11655:                 handle modified distfiles with the 'old'
                   11656:                 name</a></span></dt>
1.1       grant    11657:               </dl>
                   11658:             </dd>
                   11659: 
1.30      wiz      11660:             <dt><span class="sect1"><a href=
1.38      dillo    11661:             "#configuration-gotchas">15.3. Configuration
1.30      wiz      11662:             gotchas</a></span></dt>
1.1       grant    11663: 
                   11664:             <dd>
                   11665:               <dl>
                   11666:                 <dt><span class="sect2"><a href=
1.38      dillo    11667:                 "#fixes.libtool">15.3.1. Shared libraries -
1.1       grant    11668:                 libtool</a></span></dt>
                   11669: 
                   11670:                 <dt><span class="sect2"><a href=
1.38      dillo    11671:                 "#using-libtool">15.3.2. Using libtool on GNU
1.30      wiz      11672:                 packages that already support
                   11673:                 libtool</a></span></dt>
1.1       grant    11674: 
                   11675:                 <dt><span class="sect2"><a href=
1.38      dillo    11676:                 "#autoconf-automake">15.3.3. GNU
1.1       grant    11677:                 Autoconf/Automake</a></span></dt>
                   11678:               </dl>
                   11679:             </dd>
                   11680: 
1.55      rillig   11681:             <dt><span class="sect1"><a href="#fixes-build">15.4.
                   11682:             Building the package</a></span></dt>
1.1       grant    11683: 
                   11684:             <dd>
                   11685:               <dl>
                   11686:                 <dt><span class="sect2"><a href=
1.38      dillo    11687:                 "#cpp-defines">15.4.1. CPP defines</a></span></dt>
1.51      rillig   11688: 
1.60      rillig   11689:                 <dt><span class="sect2"><a href=
                   11690:                 "#cpp-list-examples">15.4.2. Examples of CPP
                   11691:                 defines for some platforms</a></span></dt>
                   11692: 
                   11693:                 <dt><span class="sect2"><a href="#cpp-list">15.4.3.
1.51      rillig   11694:                 Getting a list of CPP defines</a></span></dt>
1.1       grant    11695:               </dl>
                   11696:             </dd>
                   11697: 
1.30      wiz      11698:             <dt><span class="sect1"><a href=
1.38      dillo    11699:             "#package-specific-actions">15.5. Package specific
1.30      wiz      11700:             actions</a></span></dt>
1.1       grant    11701: 
                   11702:             <dd>
                   11703:               <dl>
                   11704:                 <dt><span class="sect2"><a href=
1.38      dillo    11705:                 "#user-interaction">15.5.1. User
1.2       hubertf  11706:                 interaction</a></span></dt>
1.1       grant    11707: 
                   11708:                 <dt><span class="sect2"><a href=
1.38      dillo    11709:                 "#handling-licenses">15.5.2. Handling
1.1       grant    11710:                 licenses</a></span></dt>
                   11711: 
                   11712:                 <dt><span class="sect2"><a href=
1.38      dillo    11713:                 "#installing-score-files">15.5.3. Installing score
1.1       grant    11714:                 files</a></span></dt>
                   11715: 
                   11716:                 <dt><span class="sect2"><a href=
1.38      dillo    11717:                 "#perl-scripts">15.5.4. Packages containing perl
1.1       grant    11718:                 scripts</a></span></dt>
                   11719: 
                   11720:                 <dt><span class="sect2"><a href=
1.38      dillo    11721:                 "#hardcoded-paths">15.5.5. Packages with hardcoded
1.30      wiz      11722:                 paths to other interpreters</a></span></dt>
1.1       grant    11723: 
                   11724:                 <dt><span class="sect2"><a href=
1.38      dillo    11725:                 "#perl-modules">15.5.6. Packages installing perl
1.1       grant    11726:                 modules</a></span></dt>
                   11727: 
                   11728:                 <dt><span class="sect2"><a href=
1.38      dillo    11729:                 "#faq.info-files">15.5.7. Packages installing info
1.1       grant    11730:                 files</a></span></dt>
                   11731: 
1.57      minskim  11732:                 <dt><span class="sect2"><a href="#manpages">15.5.8.
                   11733:                 Packages installing man pages</a></span></dt>
                   11734: 
1.1       grant    11735:                 <dt><span class="sect2"><a href=
1.57      minskim  11736:                 "#gconf2-data-files">15.5.9. Packages installing
1.30      wiz      11737:                 GConf2 data files</a></span></dt>
1.1       grant    11738: 
                   11739:                 <dt><span class="sect2"><a href=
1.57      minskim  11740:                 "#scrollkeeper-data-files">15.5.10. Packages
1.30      wiz      11741:                 installing scrollkeeper data files</a></span></dt>
1.1       grant    11742: 
                   11743:                 <dt><span class="sect2"><a href=
1.57      minskim  11744:                 "#x11-fonts">15.5.11. Packages installing X11
1.1       grant    11745:                 fonts</a></span></dt>
                   11746: 
                   11747:                 <dt><span class="sect2"><a href=
1.57      minskim  11748:                 "#gtk2-modules">15.5.12. Packages installing GTK2
1.1       grant    11749:                 modules</a></span></dt>
                   11750: 
                   11751:                 <dt><span class="sect2"><a href=
1.57      minskim  11752:                 "#sgml-xml-data">15.5.13. Packages installing SGML
1.30      wiz      11753:                 or XML data</a></span></dt>
1.1       grant    11754: 
                   11755:                 <dt><span class="sect2"><a href=
1.57      minskim  11756:                 "#mime-database">15.5.14. Packages installing
1.1       grant    11757:                 extensions to the MIME database</a></span></dt>
                   11758: 
                   11759:                 <dt><span class="sect2"><a href=
1.57      minskim  11760:                 "#intltool">15.5.15. Packages using
1.1       grant    11761:                 intltool</a></span></dt>
1.18      xtraeme  11762: 
                   11763:                 <dt><span class="sect2"><a href=
1.57      minskim  11764:                 "#startup-scripts">15.5.16. Packages installing
1.30      wiz      11765:                 startup scripts</a></span></dt>
1.57      minskim  11766: 
                   11767:                 <dt><span class="sect2"><a href=
                   11768:                 "#tex-packages">15.5.17. Packages installing TeX
                   11769:                 modules</a></span></dt>
1.1       grant    11770:               </dl>
                   11771:             </dd>
                   11772: 
1.30      wiz      11773:             <dt><span class="sect1"><a href=
1.38      dillo    11774:             "#feedback-to-author">15.6. Feedback to the
1.30      wiz      11775:             author</a></span></dt>
1.1       grant    11776:           </dl>
                   11777:         </div>
                   11778: 
1.67    ! hubertf  11779:         <div class="sect1" lang="en">
1.1       grant    11780:           <div class="titlepage">
                   11781:             <div>
                   11782:               <div>
                   11783:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    11784:                 "general-operation"></a>15.1.&nbsp;General
1.1       grant    11785:                 operation</h2>
                   11786:               </div>
                   11787:             </div>
                   11788:           </div>
                   11789: 
1.67    ! hubertf  11790:           <div class="sect2" lang="en">
1.1       grant    11791:             <div class="titlepage">
                   11792:               <div>
                   11793:                 <div>
1.30      wiz      11794:                   <h3 class="title"><a name=
1.38      dillo    11795:                   "pulling-vars-from-etc-mk.conf"></a>15.1.1.&nbsp;How
1.30      wiz      11796:                   to pull in variables from /etc/mk.conf</h3>
1.1       grant    11797:                 </div>
                   11798:               </div>
                   11799:             </div>
                   11800: 
                   11801:             <p>The problem with package-defined variables that can
1.14      xtraeme  11802:             be overridden via <code class="varname">MAKECONF</code>
1.45      wiz      11803:             or <code xmlns=
                   11804:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   11805:             "filename">/etc/mk.conf</code> is that <a href=
1.1       grant    11806:             "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   11807:             <span class="citerefentry"><span class=
                   11808:             "refentrytitle">make</span>(1)</span></a> expands a
1.47      reed     11809:             variable as it is used, but evaluates preprocessor-like
1.1       grant    11810:             statements (.if, .ifdef and .ifndef) as they are read.
1.14      xtraeme  11811:             So, to use any variable (which may be set in
1.45      wiz      11812:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   11813:             class="filename">/etc/mk.conf</code>) in one of the
                   11814:             .if* statements, the file <code xmlns=
                   11815:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11816:             "filename">/etc/mk.conf</code> must be included before
1.1       grant    11817:             that .if* statement.</p>
                   11818: 
1.47      reed     11819:             <p>Rather than having a number of ad-hoc ways of
1.45      wiz      11820:             including <code xmlns=
                   11821:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   11822:             "filename">/etc/mk.conf</code>, should it exist, or
                   11823:             <code class="varname">MAKECONF</code>, should it exist,
                   11824:             include the <code xmlns=
                   11825:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   11826:             "filename">pkgsrc/mk/bsd.prefs.mk</code> file in the
                   11827:             package Makefile before any preprocessor-like .if,
                   11828:             .ifdef, or .ifndef statements:</p>
1.1       grant    11829:             <pre class="programlisting">
1.51      rillig   11830:     .include "../../mk/bsd.prefs.mk"
                   11831: 
1.1       grant    11832:     .if defined(USE_MENUS)
1.51      rillig   11833:     # ...
1.1       grant    11834:     .endif
                   11835: </pre>
                   11836: 
1.14      xtraeme  11837:             <p>If you wish to set the <code class=
1.45      wiz      11838:             "varname">CFLAGS</code> variable in <code xmlns=
                   11839:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     11840:             "filename">/etc/mk.conf</code>, please make sure to
1.1       grant    11841:             use:</p>
                   11842:             <pre class="programlisting">
1.51      rillig   11843:     CFLAGS+=  -your -flags
1.1       grant    11844: </pre>
                   11845: 
1.14      xtraeme  11846:             <p>Using <code class="varname">CFLAGS=</code> (i.e.
                   11847:             without the &#8220;<span class="quote">+</span>&#8221;)
                   11848:             may lead to problems with packages that need to add
                   11849:             their own flags. Also, you may want to take a look at
                   11850:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1       grant    11851:             href=
                   11852:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45      wiz      11853:             target="_top"><code xmlns="" class=
                   11854:             "filename">devel/cpuflags</code></a> package if you're
1.20      ben      11855:             interested in optimization for the current CPU.</p>
1.1       grant    11856:           </div>
                   11857: 
1.67    ! hubertf  11858:           <div class="sect2" lang="en">
1.1       grant    11859:             <div class="titlepage">
                   11860:               <div>
                   11861:                 <div>
1.31      wiz      11862:                   <h3 class="title"><a name=
1.38      dillo    11863:                   "where-to-install-documentation"></a>15.1.2.&nbsp;Where
1.31      wiz      11864:                   to install documentation</h3>
                   11865:                 </div>
                   11866:               </div>
                   11867:             </div>
                   11868: 
1.45      wiz      11869:             <p>Documentation should be installed into <code xmlns=
                   11870:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.31      wiz      11871:             "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
1.45      wiz      11872:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   11873:             class="filename">${PREFIX}/share/doc/${PKGNAME}</code>
                   11874:             (the latter includes the version number of the
                   11875:             package).</p>
1.31      wiz      11876:           </div>
                   11877: 
1.67    ! hubertf  11878:           <div class="sect2" lang="en">
1.31      wiz      11879:             <div class="titlepage">
                   11880:               <div>
                   11881:                 <div>
1.67    ! hubertf  11882:                   <h3 class="title"><a name=
1.38      dillo    11883:                   "restricted-packages"></a>15.1.3.&nbsp;Restricted
1.1       grant    11884:                   packages</h3>
                   11885:                 </div>
                   11886:               </div>
                   11887:             </div>
                   11888: 
                   11889:             <p>Some licenses restrict how software may be
                   11890:             re-distributed. In order to satisfy these restrictions,
                   11891:             the package system defines five make variables that can
                   11892:             be set to note these restrictions:</p>
                   11893: 
                   11894:             <div class="itemizedlist">
                   11895:               <ul type="disc">
                   11896:                 <li>
1.14      xtraeme  11897:                   <p><code class="varname">RESTRICTED</code></p>
1.1       grant    11898: 
                   11899:                   <p>This variable should be set whenever a
                   11900:                   restriction exists (regardless of its kind). Set
                   11901:                   this variable to a string containing the reason
                   11902:                   for the restriction.</p>
                   11903:                 </li>
                   11904: 
                   11905:                 <li>
1.14      xtraeme  11906:                   <p><code class=
                   11907:                   "varname">NO_BIN_ON_CDROM</code></p>
1.1       grant    11908: 
                   11909:                   <p>Binaries may not be placed on CD-ROM. Set this
1.14      xtraeme  11910:                   variable to <code class=
                   11911:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    11912:                   package may not be included on a CD-ROM.</p>
                   11913:                 </li>
                   11914: 
                   11915:                 <li>
1.14      xtraeme  11916:                   <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1       grant    11917: 
                   11918:                   <p>Binaries may not be placed on an FTP server.
1.14      xtraeme  11919:                   Set this variable to <code class=
                   11920:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    11921:                   package may not not be made available on the
                   11922:                   Internet.</p>
                   11923:                 </li>
                   11924: 
                   11925:                 <li>
1.14      xtraeme  11926:                   <p><code class=
                   11927:                   "varname">NO_SRC_ON_CDROM</code></p>
1.1       grant    11928: 
                   11929:                   <p>Distfiles may not be placed on CD-ROM. Set
1.14      xtraeme  11930:                   this variable to <code class=
                   11931:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    11932:                   of the source code or other distfile(s) is not
                   11933:                   allowed on CD-ROMs.</p>
                   11934:                 </li>
                   11935: 
                   11936:                 <li>
1.14      xtraeme  11937:                   <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1       grant    11938: 
                   11939:                   <p>Distfiles may not be placed on FTP. Set this
1.14      xtraeme  11940:                   variable to <code class=
                   11941:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    11942:                   of the source code or other distfile(s) via the
                   11943:                   Internet is not allowed.</p>
                   11944:                 </li>
                   11945:               </ul>
                   11946:             </div>
                   11947: 
1.14      xtraeme  11948:             <p>Please note that the use of <code class=
                   11949:             "varname">NO_PACKAGE</code>, <code class=
                   11950:             "varname">IGNORE</code>, <code class=
                   11951:             "varname">NO_CDROM</code>, or other generic make
1.1       grant    11952:             variables to denote restrictions is deprecated, because
                   11953:             they unconditionally prevent users from generating
                   11954:             binary packages!</p>
                   11955:           </div>
                   11956: 
1.67    ! hubertf  11957:           <div class="sect2" lang="en">
1.1       grant    11958:             <div class="titlepage">
                   11959:               <div>
                   11960:                 <div>
1.67    ! hubertf  11961:                   <h3 class="title"><a name=
1.38      dillo    11962:                   "dependencies"></a>15.1.4.&nbsp;Handling
1.1       grant    11963:                   dependencies</h3>
                   11964:                 </div>
                   11965:               </div>
                   11966:             </div>
                   11967: 
                   11968:             <p>Your package may depend on some other package being
                   11969:             present - and there are various ways of expressing this
1.14      xtraeme  11970:             dependency. pkgsrc supports the <code class=
                   11971:             "varname">BUILD_DEPENDS</code> and <code class=
1.47      reed     11972:             "varname">DEPENDS</code> definitions, the <code class=
                   11973:             "varname">USE_TOOLS</code> definition, as well as
1.45      wiz      11974:             dependencies via <code xmlns=
                   11975:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11976:             "filename">buildlink3.mk</code>, which is the preferred
1.1       grant    11977:             way to handle dependencies, and which uses the
                   11978:             variables named above. See <a href="#buildlink" title=
1.38      dillo    11979:             "Chapter&nbsp;11.&nbsp;Buildlink methodology">Chapter&nbsp;11,
1.1       grant    11980:             <i>Buildlink methodology</i></a> for more
                   11981:             information.</p>
                   11982: 
                   11983:             <p>The basic difference between the two variables is as
1.14      xtraeme  11984:             follows: The <code class="varname">DEPENDS</code>
1.1       grant    11985:             definition registers that pre-requisite in the binary
                   11986:             package so it will be pulled in when the binary package
1.14      xtraeme  11987:             is later installed, whilst the <code class=
                   11988:             "varname">BUILD_DEPENDS</code> definition does not,
1.1       grant    11989:             marking a dependency that is only needed for building
                   11990:             the package.</p>
                   11991: 
                   11992:             <p>This means that if you only need a package present
                   11993:             whilst you are building, it should be noted as a
1.14      xtraeme  11994:             <code class="varname">BUILD_DEPENDS</code>.</p>
1.1       grant    11995: 
1.14      xtraeme  11996:             <p>The format for a <code class=
                   11997:             "varname">BUILD_DEPENDS</code> and a <code class=
                   11998:             "varname">DEPENDS</code> definition is:</p>
1.1       grant    11999:             <pre class="programlisting">
1.51      rillig   12000:     &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
1.1       grant    12001: </pre>
                   12002: 
                   12003:             <p>Please note that the &#8220;<span class=
                   12004:             "quote">pre-req-package-name</span>&#8221; may include
1.18      xtraeme  12005:             any of the wildcard version numbers recognized by
1.1       grant    12006:             <a href=
                   12007:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   12008:             <span class="citerefentry"><span class=
                   12009:             "refentrytitle">pkg_info</span>(1)</span></a>.</p>
                   12010: 
                   12011:             <div class="orderedlist">
                   12012:               <ol type="1">
                   12013:                 <li>
                   12014:                   <p>If your package needs another package's
                   12015:                   binaries or libraries to build or run, and if
1.45      wiz      12016:                   that package has a <code xmlns=
                   12017:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12018:                   "filename">buildlink3.mk</code> file available,
                   12019:                   use it:</p>
1.1       grant    12020:                   <pre class="programlisting">
                   12021:     .include "../../graphics/jpeg/buildlink3.mk"
                   12022: </pre>
                   12023:                 </li>
                   12024: 
                   12025:                 <li>
                   12026:                   <p>If your package needs to use another package
1.45      wiz      12027:                   to build itself and there is no <code xmlns=
                   12028:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12029:                   "filename">buildlink3.mk</code> file available,
                   12030:                   use the <code class=
                   12031:                   "varname">BUILD_DEPENDS</code> definition:</p>
1.1       grant    12032:                   <pre class="programlisting">
1.51      rillig   12033:     BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
1.1       grant    12034: </pre>
                   12035:                 </li>
                   12036: 
                   12037:                 <li>
                   12038:                   <p>If your package needs a library with which to
1.45      wiz      12039:                   link and again there is no <code xmlns=
                   12040:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12041:                   "filename">buildlink3.mk</code> file available,
                   12042:                   this is specified using the <code class=
                   12043:                   "varname">DEPENDS</code> definition. An example
                   12044:                   of this is the <a xmlns=
1.1       grant    12045:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   12046:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45      wiz      12047:                   target="_top"><code xmlns="" class=
                   12048:                   "filename">print/lyx</code></a> package, which
                   12049:                   uses the xpm library, version 3.4j to build:</p>
1.1       grant    12050:                   <pre class="programlisting">
1.51      rillig   12051:     DEPENDS+=       xpm-3.4j:../../graphics/xpm
1.1       grant    12052: </pre>
                   12053: 
                   12054:                   <p>You can also use wildcards in package
                   12055:                   dependences:</p>
                   12056:                   <pre class="programlisting">
1.51      rillig   12057:     DEPENDS+=       xpm-[0-9]*:../../graphics/xpm
1.1       grant    12058: </pre>
                   12059: 
                   12060:                   <p>Note that such wildcard dependencies are
                   12061:                   retained when creating binary packages. The
                   12062:                   dependency is checked when installing the binary
                   12063:                   package and any package which matches the pattern
                   12064:                   will be used. Wildcard dependencies should be
                   12065:                   used with care.</p>
                   12066: 
                   12067:                   <p>The &#8220;<span class=
                   12068:                   "quote">-[0-9]*</span>&#8221; should be used
                   12069:                   instead of &#8220;<span class=
                   12070:                   "quote">-*</span>&#8221; to avoid potentially
                   12071:                   ambiguous matches such as &#8220;<span class=
                   12072:                   "quote">tk-postgresql</span>&#8221; matching a
                   12073:                   &#8220;<span class="quote">tk-*</span>&#8221;
1.14      xtraeme  12074:                   <code class="varname">DEPENDS</code>.</p>
1.1       grant    12075: 
                   12076:                   <p>Wildcards can also be used to specify that a
                   12077:                   package will only build against a certain minimum
                   12078:                   version of a pre-requisite:</p>
                   12079:                   <pre class="programlisting">
1.51      rillig   12080:     DEPENDS+=       tiff&gt;=3.5.4:../../graphics/tiff
1.1       grant    12081: </pre>
                   12082: 
                   12083:                   <p>This means that the package will build against
                   12084:                   version 3.5.4 of the tiff library or newer. Such
                   12085:                   a dependency may be warranted if, for example,
                   12086:                   the API of the library has changed with version
                   12087:                   3.5.4 and a package would not compile against an
                   12088:                   earlier version of tiff.</p>
                   12089: 
                   12090:                   <p>Please note that such dependencies should only
                   12091:                   be updated if a package requires a newer
                   12092:                   pre-requisite, but not to denote recommendations
                   12093:                   such as security updates or ABI changes that do
                   12094:                   not prevent a package from building correctly.
                   12095:                   Such recommendations can be expressed using
1.14      xtraeme  12096:                   <code class="varname">RECOMMENDED</code>:</p>
1.1       grant    12097:                   <pre class="programlisting">
1.51      rillig   12098:     RECOMMENDED+=   tiff&gt;=3.6.1:../../graphics/tiff
1.1       grant    12099: </pre>
                   12100: 
1.14      xtraeme  12101:                   <p>In addition to the above <code class=
                   12102:                   "varname">DEPENDS</code> line, this denotes that
1.1       grant    12103:                   while a package will build against
                   12104:                   tiff&gt;=3.5.4, at least version 3.6.1 is
1.14      xtraeme  12105:                   recommended. <code class=
                   12106:                   "varname">RECOMMENDED</code> entries will be
                   12107:                   turned into dependencies unless explicitly
                   12108:                   ignored (in which case a warning will be
1.36      wiz      12109:                   printed).</p>
                   12110: 
                   12111:                   <p>To ignore these dependency recommendations and
                   12112:                   just use the required <code class=
                   12113:                   "varname">DEPENDS</code>, set <code class=
                   12114:                   "varname">IGNORE_RECOMMENDED=YES</code>. This may
                   12115:                   make it easier and faster to update packages
                   12116:                   built using pkgsrc, since older compatible
                   12117:                   dependencies can continue to be used. This is
                   12118:                   useful for people who watch their rebuilds very
                   12119:                   carefully; it is not very good as a
                   12120:                   general-purpose hammer. If you use it, you need
                   12121:                   to be mindful of possible ABI changes, including
                   12122:                   those from the underlying OS.</p>
                   12123: 
                   12124:                   <p>Packages that are built with recommendations
                   12125:                   ignored may not be uploaded to ftp.NetBSD.org by
                   12126:                   developers and should not be used across
                   12127:                   different systems that may have different
                   12128:                   versions of binary packages installed.</p>
1.1       grant    12129: 
                   12130:                   <p>For security fixes, please update the package
                   12131:                   vulnerabilities file as well as setting
1.14      xtraeme  12132:                   <code class="varname">RECOMMENDED</code>, see
1.1       grant    12133:                   <a href="#security-handling" title=
1.38      dillo    12134:                   "15.1.8.&nbsp;Handling packages with security problems">
1.67    ! hubertf  12135:                   Section&nbsp;15.1.8, &#8220;Handling packages
        !          12136:                   with security problems&#8221;</a> for more
1.1       grant    12137:                   information.</p>
                   12138:                 </li>
                   12139: 
                   12140:                 <li>
                   12141:                   <p>If your package needs some executable to be
1.17      sketch   12142:                   able to run correctly and if there's no
1.45      wiz      12143:                   <code xmlns=
                   12144:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12145:                   "filename">buildlink3.mk</code> file, this is
                   12146:                   specified using the <code class=
1.14      xtraeme  12147:                   "varname">DEPENDS</code> variable. The <a xmlns=
1.1       grant    12148:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   12149:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45      wiz      12150:                   target="_top"><code xmlns="" class=
                   12151:                   "filename">print/lyx</code></a> package needs to
                   12152:                   be able to execute the latex binary from the
                   12153:                   teTeX package when it runs, and that is
                   12154:                   specified:</p>
1.1       grant    12155:                   <pre class="programlisting">
1.51      rillig   12156:     DEPENDS+=        teTeX-[0-9]*:../../print/teTeX
1.1       grant    12157: </pre>
                   12158: 
                   12159:                   <p>The comment about wildcard dependencies from
                   12160:                   previous paragraph applies here, too.</p>
                   12161:                 </li>
                   12162:               </ol>
                   12163:             </div>
                   12164: 
                   12165:             <p>If your package needs files from another package to
                   12166:             build, see the first part of the &#8220;<span class=
                   12167:             "quote">do-configure</span>&#8221; target <a xmlns=
                   12168:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12169:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.45      wiz      12170:             target="_top"><code xmlns="" class=
                   12171:             "filename">print/ghostscript5</code></a> package (it
1.20      ben      12172:             relies on the jpeg sources being present in source form
                   12173:             during the build):</p>
1.1       grant    12174:             <pre class="programlisting">
1.51      rillig   12175:     if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then    \
                   12176:         cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} extract; \
1.1       grant    12177:     fi
                   12178: </pre>
                   12179: 
                   12180:             <p>If you build any other packages that way, please
                   12181:             make sure the working files are deleted too when this
                   12182:             package's working files are cleaned up. The easiest way
                   12183:             to do so is by adding a pre-clean target:</p>
                   12184:             <pre class="programlisting">
1.51      rillig   12185:     pre-clean:
                   12186:             cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} clean
1.1       grant    12187: </pre>
                   12188: 
1.14      xtraeme  12189:             <p>Please also note the <code class=
                   12190:             "varname">BUILD_USES_MSGFMT</code> and <code class=
                   12191:             "varname">BUILD_USES_GETTEXT_M4</code> definitions,
                   12192:             which are provided as convenience definitions. The
1.24      wiz      12193:             former works out whether <a href=
                   12194:             "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
                   12195:             <span class="citerefentry"><span class=
                   12196:             "refentrytitle">msgfmt</span>(1)</span></a> is part of
                   12197:             the base system, and, if it isn't, installs the
                   12198:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12199:             href=
1.1       grant    12200:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.45      wiz      12201:             target="_top"><code xmlns="" class=
                   12202:             "filename">devel/gettext</code></a> package. The latter
1.20      ben      12203:             adds a build dependency on either an installed version
                   12204:             of an older gettext package, or if it isn't, installs
                   12205:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12206:             href=
                   12207:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
1.45      wiz      12208:             target="_top"><code xmlns="" class=
                   12209:             "filename">devel/gettext-m4</code></a> package.</p>
1.1       grant    12210:           </div>
                   12211: 
1.67    ! hubertf  12212:           <div class="sect2" lang="en">
1.1       grant    12213:             <div class="titlepage">
                   12214:               <div>
                   12215:                 <div>
1.67    ! hubertf  12216:                   <h3 class="title"><a name=
1.38      dillo    12217:                   "conflicts"></a>15.1.5.&nbsp;Handling conflicts
1.1       grant    12218:                   with other packages</h3>
                   12219:                 </div>
                   12220:               </div>
                   12221:             </div>
                   12222: 
                   12223:             <p>Your package may conflict with other packages a user
                   12224:             might already have installed on his system, e.g. if
                   12225:             your package installs the same set of files like
                   12226:             another package in our pkgsrc tree.</p>
                   12227: 
1.14      xtraeme  12228:             <p>In this case you can set <code class=
1.47      reed     12229:             "varname">CONFLICTS</code> to a space-separated list of
1.1       grant    12230:             packages (including version string) your package
                   12231:             conflicts with.</p>
                   12232: 
1.47      reed     12233:             <p>For example, <a xmlns=
1.1       grant    12234:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12235:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.45      wiz      12236:             target="_top"><code xmlns="" class=
                   12237:             "filename">x11/Xaw3d</code></a> and <a xmlns=
1.20      ben      12238:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12239:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
1.45      wiz      12240:             target="_top"><code xmlns="" class=
1.47      reed     12241:             "filename">x11/Xaw-Xpm</code></a> install the same
                   12242:             shared library, thus you set in <code xmlns=
1.45      wiz      12243:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      12244:             "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1       grant    12245:             <pre class="programlisting">
1.51      rillig   12246:     CONFLICTS=      Xaw-Xpm-[0-9]*
1.1       grant    12247: </pre>
                   12248: 
1.45      wiz      12249:             <p>and in <code xmlns=
                   12250:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12251:             "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1       grant    12252:             <pre class="programlisting">
1.51      rillig   12253:     CONFLICTS=      Xaw3d-[0-9]*
1.1       grant    12254: </pre>
                   12255: 
                   12256:             <p>Packages will automatically conflict with other
                   12257:             packages with the name prefix and a different version
                   12258:             string. &#8220;<span class=
                   12259:             "quote">Xaw3d-1.5</span>&#8221; e.g. will automatically
                   12260:             conflict with the older version &#8220;<span class=
                   12261:             "quote">Xaw3d-1.3</span>&#8221;.</p>
                   12262:           </div>
                   12263: 
1.67    ! hubertf  12264:           <div class="sect2" lang="en">
1.1       grant    12265:             <div class="titlepage">
                   12266:               <div>
                   12267:                 <div>
1.67    ! hubertf  12268:                   <h3 class="title"><a name=
1.38      dillo    12269:                   "not-building-packages"></a>15.1.6.&nbsp;Packages
1.30      wiz      12270:                   that cannot or should not be built</h3>
1.1       grant    12271:                 </div>
                   12272:               </div>
                   12273:             </div>
                   12274: 
                   12275:             <p>There are several reasons why a package might be
                   12276:             instructed to not build under certain circumstances. If
                   12277:             the package builds and runs on most platforms, the
1.14      xtraeme  12278:             exceptions should be noted with <code class=
                   12279:             "varname">NOT_FOR_PLATFORM</code>. If the package
                   12280:             builds and runs on a small handful of platforms, set
                   12281:             <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.45      wiz      12282:             Both <code class="varname">ONLY_FOR_PLATFORM</code> and
                   12283:             <code class="varname">NOT_FOR_PLATFORM</code> are OS
                   12284:             triples (OS-version-platform) that can use glob-style
                   12285:             wildcards.</p>
                   12286: 
                   12287:             <p>If the package should be skipped (for example,
                   12288:             because it provides functionality already provided by
                   12289:             the system), set <code class=
1.14      xtraeme  12290:             "varname">PKG_SKIP_REASON</code> to a descriptive
                   12291:             message. If the package should fail because some
                   12292:             preconditions are not met, set <code class=
                   12293:             "varname">PKG_FAIL_REASON</code> to a descriptive
1.1       grant    12294:             message.</p>
                   12295:           </div>
                   12296: 
1.67    ! hubertf  12297:           <div class="sect2" lang="en">
1.1       grant    12298:             <div class="titlepage">
                   12299:               <div>
                   12300:                 <div>
1.67    ! hubertf  12301:                   <h3 class="title"><a name=
1.38      dillo    12302:                   "undeletable-packages"></a>15.1.7.&nbsp;Packages
1.30      wiz      12303:                   which should not be deleted, once installed</h3>
1.1       grant    12304:                 </div>
                   12305:               </div>
                   12306:             </div>
                   12307: 
                   12308:             <p>To ensure that a package may not be deleted, once it
1.14      xtraeme  12309:             has been installed, the <code class=
                   12310:             "varname">PKG_PRESERVE</code> definition should be set
                   12311:             in the package Makefile. This will be carried into any
1.1       grant    12312:             binary package that is made from this pkgsrc entry. A
                   12313:             &#8220;<span class="quote">preserved</span>&#8221;
                   12314:             package will not be deleted using <a href=
                   12315:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   12316:             <span class="citerefentry"><span class=
                   12317:             "refentrytitle">pkg_delete</span>(1)</span></a> unless
                   12318:             the &#8220;<span class="quote">-f</span>&#8221; option
                   12319:             is used.</p>
                   12320:           </div>
                   12321: 
1.67    ! hubertf  12322:           <div class="sect2" lang="en">
1.1       grant    12323:             <div class="titlepage">
                   12324:               <div>
                   12325:                 <div>
1.67    ! hubertf  12326:                   <h3 class="title"><a name=
1.38      dillo    12327:                   "security-handling"></a>15.1.8.&nbsp;Handling
1.1       grant    12328:                   packages with security problems</h3>
                   12329:                 </div>
                   12330:               </div>
                   12331:             </div>
                   12332: 
                   12333:             <p>When a vulnerability is found, this should be noted
1.45      wiz      12334:             in <code xmlns=
                   12335:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12336:             "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.43      wiz      12337:             and after committing that file, use
                   12338:             <span><strong class="command">make
                   12339:             upload</strong></span> in the same directory to update
                   12340:             the file on ftp.NetBSD.org.</p>
                   12341: 
                   12342:             <p>After fixing the vulnerability by a patch, its
                   12343:             <code class="varname">PKGREVISION</code> should be
                   12344:             increased (this is of course not necessary if the
                   12345:             problem is fixed by using a newer release of the
1.45      wiz      12346:             software). In addition, if a <code xmlns=
                   12347:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12348:             "filename">buildlink3.mk</code> file exists for an
1.43      wiz      12349:             affected package, a corresponding <code class=
1.14      xtraeme  12350:             "varname">BUILDLINK_RECOMMENDED.<em class=
                   12351:             "replaceable"><code>pkg</code></em></code> entry should
1.43      wiz      12352:             be added or updated in it.</p>
1.1       grant    12353: 
                   12354:             <p>Also, if the fix should be applied to the stable
                   12355:             pkgsrc branch, be sure to submit a pullup request!</p>
1.43      wiz      12356: 
                   12357:             <p>Binary packages already on ftp.NetBSD.org will be
                   12358:             handled semi-automatically by a weekly cron job.</p>
1.1       grant    12359:           </div>
                   12360: 
1.67    ! hubertf  12361:           <div class="sect2" lang="en">
1.1       grant    12362:             <div class="titlepage">
                   12363:               <div>
                   12364:                 <div>
1.67    ! hubertf  12365:                   <h3 class="title"><a name=
1.38      dillo    12366:                   "compiler-bugs"></a>15.1.9.&nbsp;How to handle
1.1       grant    12367:                   compiler bugs</h3>
                   12368:                 </div>
                   12369:               </div>
                   12370:             </div>
                   12371: 
                   12372:             <p>Some source files trigger bugs in the compiler,
                   12373:             based on combinations of compiler version and
                   12374:             architecture and almost always relation to optimisation
                   12375:             being enabled. Common symptoms are gcc internal errors
                   12376:             or never finishing compiling a file.</p>
                   12377: 
1.47      reed     12378:             <p>Typically, a workaround involves testing the
1.14      xtraeme  12379:             <code class="varname">MACHINE_ARCH</code> and compiler
1.1       grant    12380:             version, disabling optimisation for that
1.14      xtraeme  12381:             file/<code class="varname">MACHINE_ARCH</code>/compiler
1.45      wiz      12382:             combination, and documenting it in <code xmlns=
                   12383:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12384:             "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1       grant    12385:             number of examples!</p>
                   12386:           </div>
                   12387: 
1.67    ! hubertf  12388:           <div class="sect2" lang="en">
1.1       grant    12389:             <div class="titlepage">
                   12390:               <div>
                   12391:                 <div>
1.67    ! hubertf  12392:                   <h3 class="title"><a name=
        !          12393:                   "bumping-pkgrevision"></a>15.1.10.&nbsp;How to
1.30      wiz      12394:                   handle incrementing versions when fixing an
                   12395:                   existing package</h3>
1.1       grant    12396:                 </div>
                   12397:               </div>
                   12398:             </div>
                   12399: 
                   12400:             <p>When making fixes to an existing package it can be
1.14      xtraeme  12401:             useful to change the version number in <code class=
                   12402:             "varname">PKGNAME</code>. To avoid conflicting with
1.1       grant    12403:             future versions by the original author, a
                   12404:             &#8220;<span class="quote">nb1</span>&#8221;,
                   12405:             &#8220;<span class="quote">nb2</span>&#8221;, ...
                   12406:             suffix can be used on package versions by setting
1.14      xtraeme  12407:             <code class="varname">PKGREVISION=1</code> (2, ...).
                   12408:             The &#8220;<span class="quote">nb</span>&#8221; is
                   12409:             treated like a &#8220;<span class=
                   12410:             "quote">.</span>&#8221; by the pkg tools. e.g.</p>
1.1       grant    12411:             <pre class="programlisting">
1.51      rillig   12412:     DISTNAME=       foo-17.42
                   12413:     PKGREVISION=    9
1.1       grant    12414: </pre>
                   12415: 
1.14      xtraeme  12416:             <p>will result in a <code class=
                   12417:             "varname">PKGNAME</code> of &#8220;<span class=
1.1       grant    12418:             "quote">foo-17.42nb9</span>&#8221;.</p>
                   12419: 
                   12420:             <p>When a new release of the package is released, the
1.14      xtraeme  12421:             <code class="varname">PKGREVISION</code> should be
1.47      reed     12422:             removed, e.g. on a new minor release of the above
1.14      xtraeme  12423:             package, things should be like:</p>
1.1       grant    12424:             <pre class="programlisting">
1.51      rillig   12425:     DISTNAME=       foo-17.43
1.1       grant    12426: </pre>
                   12427:           </div>
                   12428: 
1.67    ! hubertf  12429:           <div class="sect2" lang="en">
1.1       grant    12430:             <div class="titlepage">
                   12431:               <div>
                   12432:                 <div>
1.30      wiz      12433:                   <h3 class="title"><a name=
1.38      dillo    12434:                   "portability-of-packages"></a>15.1.11.&nbsp;Portability
1.30      wiz      12435:                   of packages</h3>
1.1       grant    12436:                 </div>
                   12437:               </div>
                   12438:             </div>
                   12439: 
                   12440:             <p>One appealing feature of pkgsrc is that it runs on
                   12441:             many different platforms. As a result, it is important
                   12442:             to ensure, where possible, that packages in pkgsrc are
                   12443:             portable. There are some particular details you should
                   12444:             pay attention to while working on pkgsrc.</p>
                   12445: 
1.67    ! hubertf  12446:             <div class="sect3" lang="en">
1.1       grant    12447:               <div class="titlepage">
                   12448:                 <div>
                   12449:                   <div>
1.67    ! hubertf  12450:                     <h4 class="title"><a name=
1.38      dillo    12451:                     "install-scripts"></a>15.1.11.1.&nbsp;${INSTALL},
1.1       grant    12452:                     ${INSTALL_DATA_DIR}, ...</h4>
                   12453:                   </div>
                   12454:                 </div>
                   12455:               </div>
                   12456: 
1.14      xtraeme  12457:               <p>The BSD-compatible <span><strong class=
                   12458:               "command">install</strong></span> supplied with some
1.1       grant    12459:               operating systems will not perform more than one
                   12460:               operation at a time. As such, you should call
                   12461:               &#8220;<span class="quote">${INSTALL}</span>&#8221;,
                   12462:               etc. like this:</p>
                   12463:               <pre class="programlisting">
1.51      rillig   12464:     ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   12465:     ${INSTALL_DATA_DIR} ${PREFIX}/dir2
1.1       grant    12466: </pre>
                   12467:             </div>
                   12468:           </div>
                   12469:         </div>
                   12470: 
1.67    ! hubertf  12471:         <div class="sect1" lang="en">
1.1       grant    12472:           <div class="titlepage">
                   12473:             <div>
                   12474:               <div>
                   12475:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    12476:                 "downloading-issues"></a>15.2.&nbsp;Possible
1.1       grant    12477:                 downloading issues</h2>
                   12478:               </div>
                   12479:             </div>
                   12480:           </div>
                   12481: 
1.67    ! hubertf  12482:           <div class="sect2" lang="en">
1.1       grant    12483:             <div class="titlepage">
                   12484:               <div>
                   12485:                 <div>
1.67    ! hubertf  12486:                   <h3 class="title"><a name=
1.38      dillo    12487:                   "no-plain-download"></a>15.2.1.&nbsp;Packages
1.30      wiz      12488:                   whose distfiles aren't available for plain
1.1       grant    12489:                   downloading</h3>
                   12490:                 </div>
                   12491:               </div>
                   12492:             </div>
                   12493: 
                   12494:             <p>If you need to download from a dynamic URL you can
1.14      xtraeme  12495:             set <code class="varname">DYNAMIC_MASTER_SITES</code>
                   12496:             and a <span><strong class="command">make
1.45      wiz      12497:             fetch</strong></span> will call <code xmlns=
                   12498:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12499:             "filename">files/getsite.sh</code> with the name of
                   12500:             each file to download as an argument, expecting it to
                   12501:             output the URL of the directory from which to download
                   12502:             it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12503:             href=
1.1       grant    12504:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.45      wiz      12505:             target="_top"><code xmlns="" class=
                   12506:             "filename">graphics/ns-cult3d</code></a> is an example
                   12507:             of this usage.</p>
1.1       grant    12508: 
                   12509:             <p>If the download can't be automated, because the user
                   12510:             must submit personal information to apply for a
                   12511:             password, or must pay for the source, or whatever, you
1.14      xtraeme  12512:             can set <code class="varname">_FETCH_MESSAGE</code> to
                   12513:             a macro which displays a message explaining the
                   12514:             situation. <code class="varname">_FETCH_MESSAGE</code>
                   12515:             must be executable shell commands, not just a message.
                   12516:             (Generally, it executes <code class=
                   12517:             "varname">${ECHO}</code>). As of this writing, the
1.1       grant    12518:             following packages use this: <a xmlns=
                   12519:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.20      ben      12520:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
1.45      wiz      12521:             target="_top"><code xmlns="" class=
                   12522:             "filename">cad/simian</code></a>, <a xmlns=
1.20      ben      12523:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12524:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
1.45      wiz      12525:             target="_top"><code xmlns="" class=
                   12526:             "filename">devel/ipv6socket</code></a>, <a xmlns=
1.20      ben      12527:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12528:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
1.45      wiz      12529:             target="_top"><code xmlns="" class=
                   12530:             "filename">emulators/vmware-module</code></a>,
                   12531:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12532:             href=
1.20      ben      12533:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
1.45      wiz      12534:             target="_top"><code xmlns="" class=
                   12535:             "filename">fonts/acroread-jpnfont</code></a>, <a xmlns=
1.20      ben      12536:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.43      wiz      12537:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/multimedia/realplayer/README.html"
1.45      wiz      12538:             target="_top"><code xmlns="" class=
                   12539:             "filename">multimedia/realplayer</code></a>, <a xmlns=
1.43      wiz      12540:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.20      ben      12541:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
1.45      wiz      12542:             target="_top"><code xmlns="" class=
                   12543:             "filename">sysutils/storage-manager</code></a>,
                   12544:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12545:             href=
1.20      ben      12546:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
1.45      wiz      12547:             target="_top"><code xmlns="" class=
                   12548:             "filename">www/ap-aolserver</code></a>, <a xmlns=
1.20      ben      12549:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12550:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
1.45      wiz      12551:             target="_top"><code xmlns="" class=
                   12552:             "filename">www/openacs</code></a>. Try to be consistent
1.20      ben      12553:             with them.</p>
1.1       grant    12554:           </div>
                   12555: 
1.67    ! hubertf  12556:           <div class="sect2" lang="en">
1.1       grant    12557:             <div class="titlepage">
                   12558:               <div>
                   12559:                 <div>
1.30      wiz      12560:                   <h3 class="title"><a name=
1.38      dillo    12561:                   "modified-distfiles-same-name"></a>15.2.2.&nbsp;How
1.30      wiz      12562:                   to handle modified distfiles with the 'old'
                   12563:                   name</h3>
1.1       grant    12564:                 </div>
                   12565:               </div>
                   12566:             </div>
                   12567: 
                   12568:             <p>Sometimes authors of a software package make some
                   12569:             modifications after the software was released, and they
                   12570:             put up a new distfile without changing the package's
                   12571:             version number. If a package is already in pkgsrc at
1.32      wiz      12572:             that time, the checksum will no longer match. The
                   12573:             contents of the new distfile should be compared against
                   12574:             the old one before changing anything, to make sure the
                   12575:             distfile was really updated on purpose, and that no
                   12576:             trojan horse or so crept in. Then, the correct way to
                   12577:             work around this is to set <code class=
                   12578:             "varname">DIST_SUBDIR</code> to a unique directory
                   12579:             name, usually based on <code class=
                   12580:             "varname">PKGNAME_NOREV</code>. In case this happens
                   12581:             more often, <code class="varname">PKGNAME</code> can be
1.45      wiz      12582:             used (thus including the <code xmlns=
                   12583:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.32      wiz      12584:             "filename">nbX</code> suffix) or a date stamp can be
                   12585:             appended, like <code class=
                   12586:             "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
1.45      wiz      12587:             forget regenerating the <code xmlns=
                   12588:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.32      wiz      12589:             "filename">distinfo</code> file after that, since it
                   12590:             contains the <code class="varname">DIST_SUBDIR</code>
                   12591:             path in the filenames. Furthermore, a mail to the
                   12592:             package's authors seems appropriate telling them that
                   12593:             changing distfiles after releases without changing the
                   12594:             file names is not good practice.</p>
1.1       grant    12595:           </div>
                   12596:         </div>
                   12597: 
1.67    ! hubertf  12598:         <div class="sect1" lang="en">
1.1       grant    12599:           <div class="titlepage">
                   12600:             <div>
                   12601:               <div>
                   12602:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    12603:                 "configuration-gotchas"></a>15.3.&nbsp;Configuration
1.1       grant    12604:                 gotchas</h2>
                   12605:               </div>
                   12606:             </div>
                   12607:           </div>
                   12608: 
1.67    ! hubertf  12609:           <div class="sect2" lang="en">
1.1       grant    12610:             <div class="titlepage">
                   12611:               <div>
                   12612:                 <div>
1.67    ! hubertf  12613:                   <h3 class="title"><a name=
1.38      dillo    12614:                   "fixes.libtool"></a>15.3.1.&nbsp;Shared libraries
1.1       grant    12615:                   - libtool</h3>
                   12616:                 </div>
                   12617:               </div>
                   12618:             </div>
                   12619: 
                   12620:             <p>pkgsrc supports many different machines, with
                   12621:             different object formats like a.out and ELF, and
                   12622:             varying abilities to do shared library and dynamic
                   12623:             loading at all. To accompany this, varying commands and
                   12624:             options have to be passed to the compiler, linker, etc.
                   12625:             to get the Right Thing, which can be pretty annoying
                   12626:             especially if you don't have all the machines at your
                   12627:             hand to test things. The <a xmlns=
                   12628:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12629:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.45      wiz      12630:             target="_top"><code xmlns="" class=
                   12631:             "filename">devel/libtool</code></a> pkg can help here,
                   12632:             as it just &#8220;<span class=
                   12633:             "quote">knows</span>&#8221; how to build both static
                   12634:             and dynamic libraries from a set of source files, thus
1.47      reed     12635:             being platform-independent.</p>
1.1       grant    12636: 
                   12637:             <p>Here's how to use libtool in a pkg in seven simple
                   12638:             steps:</p>
                   12639: 
                   12640:             <div class="orderedlist">
                   12641:               <ol type="1">
                   12642:                 <li>
1.14      xtraeme  12643:                   <p>Add <code class=
                   12644:                   "varname">USE_LIBTOOL=yes</code> to the package
                   12645:                   Makefile.</p>
1.1       grant    12646:                 </li>
                   12647: 
                   12648:                 <li>
                   12649:                   <p>For library objects, use &#8220;<span class=
                   12650:                   "quote">${LIBTOOL} --mode=compile
                   12651:                   ${CC}</span>&#8221; in place of
                   12652:                   &#8220;<span class="quote">${CC}</span>&#8221;.
                   12653:                   You could even add it to the definition of
1.14      xtraeme  12654:                   <code class="varname">CC</code>, if only
                   12655:                   libraries are being built in a given Makefile.
                   12656:                   This one command will build both PIC and non-PIC
                   12657:                   library objects, so you need not have separate
                   12658:                   shared and non-shared library rules.</p>
1.1       grant    12659:                 </li>
                   12660: 
                   12661:                 <li>
                   12662:                   <p>For the linking of the library, remove any
                   12663:                   &#8220;<span class="quote">ar</span>&#8221;,
                   12664:                   &#8220;<span class="quote">ranlib</span>&#8221;,
                   12665:                   and &#8220;<span class="quote">ld
                   12666:                   -Bshareable</span>&#8221; commands, and instead
                   12667:                   use:</p>
                   12668:                   <pre class="programlisting">
1.51      rillig   12669:     ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} \
                   12670:         -rpath ${PREFIX}/lib -version-info major:minor
1.1       grant    12671: </pre>
                   12672: 
                   12673:                   <p>Note that the library is changed to have a
1.45      wiz      12674:                   <code xmlns=
                   12675:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12676:                   "filename">.la</code> extension, and the objects
                   12677:                   are changed to have a <code xmlns=
                   12678:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12679:                   "filename">.lo</code> extension. Change
                   12680:                   <code class="varname">OBJS</code> as necessary.
                   12681:                   This automatically creates all of the
1.45      wiz      12682:                   <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12683:                   class="filename">.a</code>, <code xmlns=
                   12684:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12685:                   "filename">.so.major.minor</code>, and ELF
                   12686:                   symlinks (if necessary) in the build directory.
                   12687:                   Be sure to include &#8220;<span class=
1.1       grant    12688:                   "quote">-version-info</span>&#8221;, especially
                   12689:                   when major and minor are zero, as libtool will
                   12690:                   otherwise strip off the shared library
                   12691:                   version.</p>
                   12692: 
                   12693:                   <p>From the libtool manual:</p>
                   12694:                   <pre class="programlisting">
1.51      rillig   12695:     So, libtool library versions are described by three integers:
1.1       grant    12696: 
1.51      rillig   12697:     CURRENT
                   12698:         The most recent interface number that this library implements.
1.1       grant    12699: 
1.51      rillig   12700:     REVISION
                   12701:         The implementation number of the CURRENT interface.
1.1       grant    12702: 
1.51      rillig   12703:     AGE
                   12704:         The difference between the newest and oldest interfaces that
                   12705:         this library implements.  In other words, the library implements
                   12706:         all the interface numbers in the range from number `CURRENT -
                   12707:         AGE' to `CURRENT'.
1.1       grant    12708:        
1.51      rillig   12709:     If two libraries have identical CURRENT and AGE numbers, then the
                   12710:     dynamic linker chooses the library with the greater REVISION number.
1.1       grant    12711: </pre>
                   12712: 
                   12713:                   <p>The &#8220;<span class=
                   12714:                   "quote">-release</span>&#8221; option will
                   12715:                   produce different results for a.out and ELF
                   12716:                   (excluding symlinks) in only one case. An ELF
                   12717:                   library of the form &#8220;<span class=
                   12718:                   "quote">libfoo-release.so.<span class=
                   12719:                   "emphasis"><em>x</em></span>.<span class=
                   12720:                   "emphasis"><em>y</em></span></span>&#8221; will
                   12721:                   have a symlink of &#8220;<span class=
                   12722:                   "quote">libfoo.so.<span class=
                   12723:                   "emphasis"><em>x</em></span>.<span class=
                   12724:                   "emphasis"><em>y</em></span></span>&#8221; on an
                   12725:                   a.out platform. This is handled
                   12726:                   automatically.</p>
                   12727: 
                   12728:                   <p>The &#8220;<span class="quote">-rpath
                   12729:                   argument</span>&#8221; is the install directory
                   12730:                   of the library being built.</p>
                   12731: 
1.45      wiz      12732:                   <p>In the <code xmlns=
                   12733:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12734:                   "filename">PLIST</code>, include only the
                   12735:                   <code xmlns=
                   12736:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.19      hubertf  12737:                   "filename">.la</code> file, the other files will
                   12738:                   be added automatically.</p>
1.1       grant    12739:                 </li>
                   12740: 
                   12741:                 <li>
1.45      wiz      12742:                   <p>When linking shared object (<code xmlns=
                   12743:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12744:                   "filename">.so</code>) files, i.e. files that are
1.24      wiz      12745:                   loaded via <a href=
                   12746:                   "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
                   12747:                   <span class="citerefentry"><span class=
                   12748:                   "refentrytitle">dlopen</span>(3)</span></a>, NOT
                   12749:                   shared libraries, use &#8220;<span class=
                   12750:                   "quote">-module -avoid-version</span>&#8221; to
                   12751:                   prevent them getting version tacked on.</p>
1.1       grant    12752: 
1.45      wiz      12753:                   <p>The <code xmlns=
                   12754:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12755:                   "filename">PLIST</code> file gets the
                   12756:                   <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12757:                   class="filename">foo.so</code> entry.</p>
1.1       grant    12758:                 </li>
                   12759: 
                   12760:                 <li>
                   12761:                   <p>When linking programs that depend on these
                   12762:                   libraries <span class=
                   12763:                   "emphasis"><em>before</em></span> they are
                   12764:                   installed, preface the <a href=
                   12765:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
                   12766:                   <span class="citerefentry"><span class=
                   12767:                   "refentrytitle">cc</span>(1)</span></a> or
                   12768:                   <a href=
                   12769:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   12770:                   <span class="citerefentry"><span class=
                   12771:                   "refentrytitle">ld</span>(1)</span></a> line with
                   12772:                   &#8220;<span class="quote">${LIBTOOL}
                   12773:                   --mode=link</span>&#8221;, and it will find the
                   12774:                   correct libraries (static or shared), but please
                   12775:                   be aware that libtool will not allow you to
                   12776:                   specify a relative path in -L (such as
                   12777:                   &#8220;<span class=
                   12778:                   "quote">-L../somelib</span>&#8221;), because it
                   12779:                   expects you to change that argument to be the
1.45      wiz      12780:                   <code xmlns=
                   12781:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12782:                   "filename">.la</code> file. e.g.</p>
1.1       grant    12783:                   <pre class="programlisting">
1.51      rillig   12784:     ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
1.1       grant    12785: </pre>
                   12786: 
                   12787:                   <p>should be changed to:</p>
                   12788:                   <pre class="programlisting">
1.51      rillig   12789:     ${LIBTOOL} --mode=link ${CC} -o <em class=
1.14      xtraeme  12790: "replaceable"><code>someprog</code></em> <em class=
                   12791: "replaceable"><code>../somelib/somelib.la</code></em>
1.1       grant    12792: </pre>
                   12793: 
                   12794:                   <p>and it will do the right thing with the
                   12795:                   libraries.</p>
                   12796:                 </li>
                   12797: 
                   12798:                 <li>
                   12799:                   <p>When installing libraries, preface the
                   12800:                   <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   12801:                   <span class="citerefentry"><span class=
                   12802:                   "refentrytitle">install</span>(1)</span></a> or
                   12803:                   <a href=
                   12804:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
                   12805:                   <span class="citerefentry"><span class=
                   12806:                   "refentrytitle">cp</span>(1)</span></a> command
                   12807:                   with &#8220;<span class="quote">${LIBTOOL}
                   12808:                   --mode=install</span>&#8221;, and change the
1.45      wiz      12809:                   library name to <code xmlns=
                   12810:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12811:                   "filename">.la</code>. e.g.</p>
1.1       grant    12812:                   <pre class="programlisting">
1.51      rillig   12813:     ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1       grant    12814: </pre>
                   12815: 
1.45      wiz      12816:                   <p>This will install the static <code xmlns=
                   12817:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12818:                   "filename">.a</code>, shared library, any needed
1.1       grant    12819:                   symlinks, and run <a href=
                   12820:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
                   12821:                   <span class="citerefentry"><span class=
                   12822:                   "refentrytitle">ldconfig</span>(8)</span></a>.</p>
                   12823:                 </li>
                   12824: 
                   12825:                 <li>
1.45      wiz      12826:                   <p>In your <code xmlns=
                   12827:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12828:                   "filename">PLIST</code>, include only the
                   12829:                   <code xmlns=
                   12830:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.23      wiz      12831:                   "filename">.la</code> file (this is a change from
                   12832:                   previous behaviour).</p>
1.1       grant    12833:                 </li>
                   12834:               </ol>
                   12835:             </div>
                   12836:           </div>
                   12837: 
1.67    ! hubertf  12838:           <div class="sect2" lang="en">
1.1       grant    12839:             <div class="titlepage">
                   12840:               <div>
                   12841:                 <div>
1.67    ! hubertf  12842:                   <h3 class="title"><a name=
1.38      dillo    12843:                   "using-libtool"></a>15.3.2.&nbsp;Using libtool on
1.30      wiz      12844:                   GNU packages that already support libtool</h3>
1.1       grant    12845:                 </div>
                   12846:               </div>
                   12847:             </div>
                   12848: 
1.14      xtraeme  12849:             <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
                   12850:             the package Makefile. This will override the package's
                   12851:             own libtool in most cases. For older libtool using
1.1       grant    12852:             packages, libtool is made by ltconfig script during the
                   12853:             do-configure step; you can check the libtool script
1.14      xtraeme  12854:             location by doing <span><strong class="command">make
                   12855:             configure; find work*/ -name
                   12856:             libtool</strong></span>.</p>
                   12857: 
                   12858:             <p><code class="varname">LIBTOOL_OVERRIDE</code>
                   12859:             specifies which libtool scripts, relative to
                   12860:             <code class="varname">WRKSRC</code>, to override. By
                   12861:             default, it is set to &#8220;<span class=
                   12862:             "quote">libtool */libtool */*/libtool</span>&#8221;. If
                   12863:             this does not match the location of the package's
                   12864:             libtool script(s), set it as appropriate.</p>
1.13      hubertf  12865: 
1.45      wiz      12866:             <p>If you do not need <code xmlns=
                   12867:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12868:             "filename">*.a</code> static libraries built and
                   12869:             installed, then use <code class=
                   12870:             "varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.1       grant    12871: 
1.47      reed     12872:             <p>If your package makes use of the
                   12873:             platform-independent library for loading dynamic shared
                   12874:             objects, that comes with libtool (libltdl), you should
                   12875:             include devel/libltdl/buildlink3.mk.</p>
1.1       grant    12876: 
                   12877:             <p>Some packages use libtool incorrectly so that the
                   12878:             package may not work or build in some circumstances.
                   12879:             Some of the more common errors are:</p>
                   12880: 
                   12881:             <div class="itemizedlist">
                   12882:               <ul type="disc">
                   12883:                 <li>
                   12884:                   <p>The inclusion of a shared object (-module) as
                   12885:                   a dependent library in an executable or library.
                   12886:                   This in itself isn't a problem if one of two
                   12887:                   things has been done:</p>
                   12888: 
                   12889:                   <div class="orderedlist">
                   12890:                     <ol type="1">
                   12891:                       <li>
                   12892:                         <p>The shared object is named correctly,
1.45      wiz      12893:                         i.e. <code xmlns=
                   12894:                         "http://www.w3.org/TR/xhtml1/transitional"
                   12895:                         class="filename">libfoo.la</code>, not
                   12896:                         <code xmlns=
                   12897:                         "http://www.w3.org/TR/xhtml1/transitional"
                   12898:                         class="filename">foo.la</code></p>
1.1       grant    12899:                       </li>
                   12900: 
                   12901:                       <li>
                   12902:                         <p>The -dlopen option is used when linking
                   12903:                         an executable.</p>
                   12904:                       </li>
                   12905:                     </ol>
                   12906:                   </div>
                   12907:                 </li>
                   12908: 
                   12909:                 <li>
                   12910:                   <p>The use of libltdl without the correct calls
                   12911:                   to initialisation routines. The function
                   12912:                   lt_dlinit() should be called and the macro
1.14      xtraeme  12913:                   <code class=
                   12914:                   "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1       grant    12915:                   included in executables.</p>
                   12916:                 </li>
                   12917:               </ul>
                   12918:             </div>
                   12919:           </div>
                   12920: 
1.67    ! hubertf  12921:           <div class="sect2" lang="en">
1.1       grant    12922:             <div class="titlepage">
                   12923:               <div>
                   12924:                 <div>
1.67    ! hubertf  12925:                   <h3 class="title"><a name=
1.38      dillo    12926:                   "autoconf-automake"></a>15.3.3.&nbsp;GNU
1.1       grant    12927:                   Autoconf/Automake</h3>
                   12928:                 </div>
                   12929:               </div>
                   12930:             </div>
                   12931: 
                   12932:             <p>If a package needs GNU autoconf or automake to be
                   12933:             executed to regenerate the configure script and
                   12934:             Makefile.in makefile templates, then they should be
1.35      jmmv     12935:             executed in a pre-configure target.</p>
1.1       grant    12936: 
                   12937:             <p>For packages that need only autoconf:</p>
                   12938:             <pre class="programlisting">
1.51      rillig   12939:     AUTOCONF_REQD=  2.50            # if default version is not good enough
                   12940:     USE_TOOLS+=     autoconf        # use "autoconf213" for autoconf-2.13
                   12941:     ...
1.1       grant    12942: 
1.51      rillig   12943:     pre-configure:
                   12944:             cd ${WRKSRC}; autoconf
1.1       grant    12945: 
1.51      rillig   12946:     ...
1.1       grant    12947: </pre>
                   12948: 
                   12949:             <p>and for packages that need automake and
                   12950:             autoconf:</p>
                   12951:             <pre class="programlisting">
1.51      rillig   12952:     AUTOMAKE_REQD=  1.7.1           # if default version is not good enough
                   12953:     USE_TOOLS+=     automake        # use "automake14" for automake-1.4
                   12954:     ...
1.1       grant    12955: 
1.51      rillig   12956:     pre-configure:
                   12957:             cd ${WRKSRC};                          \
                   12958:             aclocal; autoheader;                   \
                   12959:             automake -a --foreign -i; autoconf
                   12960: 
                   12961:     ...
1.1       grant    12962: </pre>
                   12963: 
                   12964:             <p>Packages which use GNU Automake will almost
1.35      jmmv     12965:             certainly require GNU Make.</p>
1.1       grant    12966: 
                   12967:             <p>There are times when the configure process makes
                   12968:             additional changes to the generated files, which then
                   12969:             causes the build process to try to re-execute the
                   12970:             automake sequence. This is prevented by touching
                   12971:             various files in the configure stage. If this causes
1.14      xtraeme  12972:             problems with your package you can set <code class=
                   12973:             "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1       grant    12974:             Makefile.</p>
                   12975:           </div>
                   12976:         </div>
                   12977: 
1.67    ! hubertf  12978:         <div class="sect1" lang="en">
1.1       grant    12979:           <div class="titlepage">
                   12980:             <div>
                   12981:               <div>
                   12982:                 <h2 class="title" style="clear: both"><a name=
1.55      rillig   12983:                 "fixes-build"></a>15.4.&nbsp;Building the
                   12984:                 package</h2>
1.1       grant    12985:               </div>
                   12986:             </div>
                   12987:           </div>
                   12988: 
1.67    ! hubertf  12989:           <div class="sect2" lang="en">
1.1       grant    12990:             <div class="titlepage">
                   12991:               <div>
                   12992:                 <div>
1.67    ! hubertf  12993:                   <h3 class="title"><a name=
1.38      dillo    12994:                   "cpp-defines"></a>15.4.1.&nbsp;CPP defines</h3>
1.1       grant    12995:                 </div>
                   12996:               </div>
                   12997:             </div>
                   12998: 
1.55      rillig   12999:             <p>Sometimes you need to compile different code
                   13000:             depending on the target platform. The C preprocessor
                   13001:             has a set of predefined macros that can be queried by
                   13002:             using <code class="varname">#ifdef FOO</code> or
                   13003:             <code class="varname">#if defined(FOO)</code>. Among
                   13004:             these macros are usually ones that describe the target
                   13005:             CPU and operating system. Depending of which of the
                   13006:             macros are defined, you can write code that uses
1.61      rillig   13007:             features unique to a specific platform. Generally you
                   13008:             should rather use the GNU autotools (automake,
                   13009:             autoconf, etc.) to check for specific features (like
                   13010:             the existence of a header file, a function or a
                   13011:             library), but sometimes this is not possible or
                   13012:             desired.</p>
                   13013: 
                   13014:             <p>In that case you can use the predefined macros below
                   13015:             to configure your code to the platform it runs on.
                   13016:             Almost every operating system, hardware architecture
                   13017:             and compiler has its own macro. For example, if the
                   13018:             macros <code class="varname">__GNUC__</code>,
                   13019:             <code class="varname">__i386__</code> and <code class=
1.55      rillig   13020:             "varname">__NetBSD__</code> are all defined, you know
1.61      rillig   13021:             that you are using NetBSD on an i386 compatible CPU,
                   13022:             and your compiler is GCC.</p>
1.55      rillig   13023: 
1.67    ! hubertf  13024:             <div class="sect3" lang="en">
1.55      rillig   13025:               <div class="titlepage">
                   13026:                 <div>
                   13027:                   <div>
                   13028:                     <h4 class="title"><a name=
                   13029:                     "fixes-build-cpp-opsys"></a>15.4.1.1.&nbsp;CPP
                   13030:                     defines for operating systems</h4>
                   13031:                   </div>
                   13032:                 </div>
                   13033:               </div>
                   13034: 
                   13035:               <p>To distinguish between 4.4 BSD-derived systems and
                   13036:               the rest of the world, you should use the following
                   13037:               code.</p>
                   13038:               <pre class="programlisting">
1.51      rillig   13039:     #include &lt;sys/param.h&gt;
1.55      rillig   13040:     #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
1.60      rillig   13041:       /* BSD-specific code goes here */
1.55      rillig   13042:     #else
1.60      rillig   13043:       /* non-BSD-specific code goes here */
1.55      rillig   13044:     #endif
1.1       grant    13045: </pre>
                   13046: 
1.55      rillig   13047:               <p>If this distinction is not fine enough, you can
                   13048:               also use the following defines.</p>
                   13049:               <pre class="programlisting">
                   13050:     FreeBSD     __FreeBSD__
1.56      rillig   13051:     DragonFly   __DragonFly__
1.57      minskim  13052:     Interix     __INTERIX
1.55      rillig   13053:     Linux       linux, __linux, __linux__
                   13054:     NetBSD      __NetBSD__
                   13055:     OpenBSD     __OpenBSD__
1.60      rillig   13056:     Solaris     sun, __sun
1.1       grant    13057: </pre>
1.55      rillig   13058:             </div>
1.1       grant    13059: 
1.67    ! hubertf  13060:             <div class="sect3" lang="en">
1.55      rillig   13061:               <div class="titlepage">
                   13062:                 <div>
                   13063:                   <div>
1.67    ! hubertf  13064:                     <h4 class="title"><a name=
        !          13065:                     "fixes-build-cpp-cpu"></a>15.4.1.2.&nbsp;CPP
1.55      rillig   13066:                     defines for CPUs</h4>
                   13067:                   </div>
                   13068:                 </div>
                   13069:               </div>
                   13070:               <pre class="programlisting">
                   13071:     i386        i386, __i386, __i386__
                   13072:     MIPS        __mips
                   13073:     SPARC       sparc, __sparc
                   13074: </pre>
                   13075:             </div>
                   13076: 
1.67    ! hubertf  13077:             <div class="sect3" lang="en">
1.55      rillig   13078:               <div class="titlepage">
                   13079:                 <div>
                   13080:                   <div>
                   13081:                     <h4 class="title"><a name=
                   13082:                     "fixes-build-cpp-compiler"></a>15.4.1.3.&nbsp;CPP
                   13083:                     defines for compilers</h4>
                   13084:                   </div>
                   13085:                 </div>
                   13086:               </div>
                   13087:               <pre class="programlisting">
                   13088:     GCC         __GNUC__ (major version), __GNUC_MINOR__
1.60      rillig   13089:     SunPro      __SUNPRO_C (0x570 for version 5.7)
1.55      rillig   13090: </pre>
                   13091:             </div>
1.1       grant    13092:           </div>
1.51      rillig   13093: 
1.67    ! hubertf  13094:           <div class="sect2" lang="en">
1.51      rillig   13095:             <div class="titlepage">
                   13096:               <div>
                   13097:                 <div>
1.67    ! hubertf  13098:                   <h3 class="title"><a name=
1.60      rillig   13099:                   "cpp-list-examples"></a>15.4.2.&nbsp;Examples of
                   13100:                   CPP defines for some platforms</h3>
                   13101:                 </div>
                   13102:               </div>
                   13103:             </div>
                   13104: 
                   13105:             <p>The list of the CPP identification macros for
                   13106:             hardware and operating system may depend on the
                   13107:             compiler that is used. The following list contains some
                   13108:             examples that may help you to choose the right ones.
                   13109:             For example, if you want to conditionally compile code
                   13110:             on Solaris, don't use <code class=
                   13111:             "varname">__sun__</code>, as the SunPro compiler does
                   13112:             not define it. Use <code class="varname">__sun</code>
                   13113:             instead.</p>
                   13114: 
                   13115:             <div class="variablelist">
                   13116:               <dl>
1.61      rillig   13117:                 <dt><span class="term">GCC 3.3.3 + SuSE Linux 9.1 +
                   13118:                 i386</span></dt>
                   13119: 
                   13120:                 <dd>
1.62      rillig   13121:                   <p>__ELF__, __gnu_linux__, __i386, __i386__,
1.61      rillig   13122:                   __linux, __linux__, __unix, __unix__, i386,
                   13123:                   linux, unix.</p>
                   13124:                 </dd>
                   13125: 
                   13126:                 <dt><span class="term">GCC 2.95 + NetBSD 1.6.2 +
                   13127:                 i386</span></dt>
                   13128: 
                   13129:                 <dd>
1.62      rillig   13130:                   <p>__ELF__, __NetBSD__, __i386, __i386__,
1.61      rillig   13131:                   i386.</p>
                   13132:                 </dd>
                   13133: 
                   13134:                 <dt><span class="term">GCC 3.3.3 + NetBSD 2.0 +
                   13135:                 i386</span></dt>
1.60      rillig   13136: 
                   13137:                 <dd>
1.62      rillig   13138:                   <p>__ELF__, __NetBSD__, __i386, __i386__,
1.61      rillig   13139:                   i386.</p>
1.60      rillig   13140:                 </dd>
                   13141: 
                   13142:                 <dt><span class="term">GCC 4 + Solaris 8 +
                   13143:                 SPARC</span></dt>
                   13144: 
                   13145:                 <dd>
                   13146:                   <p>__ELF__, __sparc, __sparc__, __sun, __sun__,
                   13147:                   __SVR4, __svr4__, __unix, __unix__, sparc, sun,
                   13148:                   unix.</p>
                   13149:                 </dd>
1.61      rillig   13150: 
                   13151:                 <dt><span class="term">SunPro 5.7 + Solaris 8 +
                   13152:                 SPARC</span></dt>
                   13153: 
                   13154:                 <dd>
                   13155:                   <p>__SVR4, __sparc, __sun, __unix, sparc, sun,
                   13156:                   unix.</p>
                   13157:                 </dd>
1.60      rillig   13158:               </dl>
                   13159:             </div>
                   13160:           </div>
                   13161: 
1.67    ! hubertf  13162:           <div class="sect2" lang="en">
1.60      rillig   13163:             <div class="titlepage">
                   13164:               <div>
                   13165:                 <div>
1.67    ! hubertf  13166:                   <h3 class="title"><a name=
1.60      rillig   13167:                   "cpp-list"></a>15.4.3.&nbsp;Getting a list of CPP
1.51      rillig   13168:                   defines</h3>
                   13169:                 </div>
                   13170:               </div>
                   13171:             </div>
                   13172: 
1.60      rillig   13173:             <p>If your system uses the GNU C Compiler, you can get
                   13174:             a list of symbols that are defined by default, e.g. to
                   13175:             identify the platform, with the following command:</p>
1.51      rillig   13176:             <pre class="programlisting">
                   13177:     gcc -E -dM - &lt; /dev/null 
                   13178: </pre>
1.60      rillig   13179: 
                   13180:             <p>On other systems you may get the list by using the
                   13181:             system's syscall trace utility (ktrace, truss, strace)
                   13182:             to have a look which arguments are passed to the actual
                   13183:             compiler.</p>
1.51      rillig   13184:           </div>
1.1       grant    13185:         </div>
                   13186: 
1.67    ! hubertf  13187:         <div class="sect1" lang="en">
1.1       grant    13188:           <div class="titlepage">
                   13189:             <div>
                   13190:               <div>
                   13191:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    13192:                 "package-specific-actions"></a>15.5.&nbsp;Package
1.1       grant    13193:                 specific actions</h2>
                   13194:               </div>
                   13195:             </div>
                   13196:           </div>
                   13197: 
1.67    ! hubertf  13198:           <div class="sect2" lang="en">
1.1       grant    13199:             <div class="titlepage">
                   13200:               <div>
                   13201:                 <div>
1.67    ! hubertf  13202:                   <h3 class="title"><a name=
1.38      dillo    13203:                   "user-interaction"></a>15.5.1.&nbsp;User
1.2       hubertf  13204:                   interaction</h3>
1.1       grant    13205:                 </div>
                   13206:               </div>
                   13207:             </div>
                   13208: 
                   13209:             <p>Occasionally, packages require interaction from the
                   13210:             user, and this can be in a number of ways:</p>
                   13211: 
                   13212:             <div class="itemizedlist">
                   13213:               <ul type="disc">
                   13214:                 <li>
                   13215:                   <p>help in fetching the distfiles</p>
                   13216:                 </li>
                   13217: 
                   13218:                 <li>
                   13219:                   <p>help to configure the package before it is
                   13220:                   built</p>
                   13221:                 </li>
                   13222: 
                   13223:                 <li>
                   13224:                   <p>help during the build process</p>
                   13225:                 </li>
                   13226: 
                   13227:                 <li>
                   13228:                   <p>help during the installation of a package</p>
                   13229:                 </li>
                   13230:               </ul>
                   13231:             </div>
                   13232: 
1.14      xtraeme  13233:             <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1       grant    13234:             definition is provided to notify the pkgsrc mechanism
                   13235:             of an interactive stage which will be needed, and this
1.45      wiz      13236:             should be set in the package's <code xmlns=
                   13237:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     13238:             "filename">Makefile</code>, e.g.:</p>
1.1       grant    13239:             <pre class="programlisting">
1.51      rillig   13240:     INTERACTIVE_STAGE=      build
1.1       grant    13241: </pre>
                   13242: 
                   13243:             <p>Multiple interactive stages can be specified:</p>
                   13244:             <pre class="programlisting">
1.51      rillig   13245:     INTERACTIVE_STAGE=      configure install
1.1       grant    13246: </pre>
                   13247:           </div>
                   13248: 
1.67    ! hubertf  13249:           <div class="sect2" lang="en">
1.1       grant    13250:             <div class="titlepage">
                   13251:               <div>
                   13252:                 <div>
1.67    ! hubertf  13253:                   <h3 class="title"><a name=
1.38      dillo    13254:                   "handling-licenses"></a>15.5.2.&nbsp;Handling
1.1       grant    13255:                   licenses</h3>
                   13256:                 </div>
                   13257:               </div>
                   13258:             </div>
                   13259: 
1.44      gdt      13260:             <p>A package may be covered by a license which the user
                   13261:             has or has not agreed to accept. For these cases,
                   13262:             pkgsrc contains a mechanism to note that a package is
                   13263:             covered by a particular license, and the package cannot
                   13264:             be built unless the user has accepted the license.
                   13265:             (Installation of binary packages are not currently
                   13266:             subject to this mechanism.) Packages with licenses that
                   13267:             are either Open Source according to the Open Source
                   13268:             Initiative or Free according to the Free Software
                   13269:             Foundation will not be marked with a license tag.
                   13270:             Packages with licenses that have not been determined to
                   13271:             meet either definition will be marked with a license
                   13272:             tag referring to the license. This will prevent
                   13273:             building unless pkgsrc is informed that the license is
                   13274:             acceptable, and enables displaying the license.</p>
                   13275: 
                   13276:             <p>The license tag mechanism is intended to address
                   13277:             copyright-related issues surrounding building,
                   13278:             installing and using a package, and not to address
                   13279:             redistribution issues (see <code class=
                   13280:             "varname">RESTRICTED</code> and <code class=
                   13281:             "varname">NO_SRC_ON_FTP</code>, etc.). However, the
                   13282:             above definition of licenses for which tags are not
                   13283:             needed implies that packages with redistribution
                   13284:             restrictions should have tags.</p>
                   13285: 
                   13286:             <p>Denoting that a package is covered by a particular
1.45      wiz      13287:             license is done by placing the license in <code xmlns=
                   13288:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.44      gdt      13289:             "filename">pkgsrc/licenses</code> and setting the
                   13290:             <code class="varname">LICENSE</code> variable to a
                   13291:             string identifying the license, e.g. in <a xmlns=
1.14      xtraeme  13292:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.44      gdt      13293:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/xv/README.html"
1.45      wiz      13294:             target="_top"><code xmlns="" class=
                   13295:             "filename">graphics/xv</code></a>:</p>
1.1       grant    13296:             <pre class="programlisting">
1.51      rillig   13297:     LICENSE=        xv-license
1.1       grant    13298: </pre>
                   13299: 
                   13300:             <p>When trying to build, the user will get a notice
1.44      gdt      13301:             that the package is covered by a license which has not
                   13302:             been accepted:</p>
1.1       grant    13303:             <pre class="programlisting">
1.51      rillig   13304:     <code class="prompt">%</code> <strong class=
1.14      xtraeme  13305: "userinput"><code>make</code></strong>
1.51      rillig   13306:     ===&gt; xv-3.10anb9 has an unacceptable license: xv-license.
                   13307:     ===&gt;     To view the license, enter "/usr/bin/make show-license".
                   13308:     ===&gt;     To indicate acceptance, add this line to your /etc/mk.conf:
                   13309:     ===&gt;     ACCEPTABLE_LICENSES+=xv-license
                   13310:     *** Error code 1
1.1       grant    13311: </pre>
                   13312: 
1.14      xtraeme  13313:             <p>The license can be viewed with <span><strong class=
                   13314:             "command">make show-license</strong></span>, and if it
                   13315:             is considered appropriate, the line printed above can
1.45      wiz      13316:             be added to <code xmlns=
                   13317:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13318:             "filename">/etc/mk.conf</code> to indicate acceptance
                   13319:             of the particular license:</p>
1.1       grant    13320:             <pre class="programlisting">
1.51      rillig   13321:     ACCEPTABLE_LICENSES+=xv-license
1.1       grant    13322: </pre>
                   13323: 
                   13324:             <p>When adding a package with a new license, the
1.45      wiz      13325:             license text should be added to <code xmlns=
                   13326:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13327:             "filename">pkgsrc/licenses</code> for displaying. A
                   13328:             list of known licenses can be seen in this directory as
                   13329:             well as by looking at the list of (commented out)
                   13330:             <code class="varname">ACCEPTABLE_LICENSES</code>
1.45      wiz      13331:             variable settings in <code xmlns=
                   13332:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13333:             "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1       grant    13334: 
1.44      gdt      13335:             <p>The use of <code class=
                   13336:             "varname">LICENSE=shareware</code>, <code class=
                   13337:             "varname">LICENSE=no-commercial-use</code>, and similar
                   13338:             language is deprecated because it does not crisply
                   13339:             refer to a particular license text. Another problem
                   13340:             with such usage is that it does not enable a user to
                   13341:             denote acceptance of the license for a single package
                   13342:             without accepting the same license text for another
                   13343:             package. In particular, this can be inappropriate when
                   13344:             e.g. one accepts a particular license to indicate to
                   13345:             pkgsrc that a fee has been paid.</p>
1.1       grant    13346:           </div>
                   13347: 
1.67    ! hubertf  13348:           <div class="sect2" lang="en">
1.1       grant    13349:             <div class="titlepage">
                   13350:               <div>
                   13351:                 <div>
1.30      wiz      13352:                   <h3 class="title"><a name=
1.38      dillo    13353:                   "installing-score-files"></a>15.5.3.&nbsp;Installing
1.30      wiz      13354:                   score files</h3>
1.1       grant    13355:                 </div>
                   13356:               </div>
                   13357:             </div>
                   13358: 
                   13359:             <p>Certain packages, most of them in the games
                   13360:             category, install a score file that allows all users on
                   13361:             the system to record their highscores. In order for
                   13362:             this to work, the binaries need to be installed setgid
                   13363:             and the score files owned by the appropriate group
                   13364:             and/or owner (traditionally the "games" user/group).
                   13365:             The following variables, documented in more detail in
1.45      wiz      13366:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13367:             class="filename">mk/defaults/mk.conf</code>, control
                   13368:             this behaviour: <code class=
1.14      xtraeme  13369:             "varname">SETGIDGAME</code>, <code class=
                   13370:             "varname">GAMEDATAMODE</code>, <code class=
                   13371:             "varname">GAMEGRP</code>, <code class=
                   13372:             "varname">GAMEMODE</code>, <code class=
                   13373:             "varname">GAMEOWN</code>.</p>
1.1       grant    13374: 
                   13375:             <p>Note that per default, setgid installation of games
1.14      xtraeme  13376:             is disabled; setting <code class=
                   13377:             "varname">SETGIDGAME=YES</code> will set all the other
1.1       grant    13378:             variables accordingly.</p>
                   13379: 
                   13380:             <p>A package should therefor never hard code file
1.14      xtraeme  13381:             ownership or access permissions but rely on
                   13382:             <code class="varname">INSTALL_GAME</code> and
                   13383:             <code class="varname">INSTALL_GAME_DATA</code> to set
                   13384:             these correctly.</p>
1.1       grant    13385:           </div>
                   13386: 
1.67    ! hubertf  13387:           <div class="sect2" lang="en">
1.1       grant    13388:             <div class="titlepage">
                   13389:               <div>
                   13390:                 <div>
1.67    ! hubertf  13391:                   <h3 class="title"><a name=
1.38      dillo    13392:                   "perl-scripts"></a>15.5.4.&nbsp;Packages
1.30      wiz      13393:                   containing perl scripts</h3>
1.1       grant    13394:                 </div>
                   13395:               </div>
                   13396:             </div>
                   13397: 
                   13398:             <p>If your package contains interpreted perl scripts,
1.14      xtraeme  13399:             set <code class="varname">REPLACE_PERL</code> to ensure
                   13400:             that the proper interpreter path is set. <code class=
                   13401:             "varname">REPLACE_PERL</code> should contain a list of
                   13402:             scripts, relative to <code class=
                   13403:             "varname">WRKSRC</code>, that you want adjusted.</p>
1.1       grant    13404:           </div>
                   13405: 
1.67    ! hubertf  13406:           <div class="sect2" lang="en">
1.1       grant    13407:             <div class="titlepage">
                   13408:               <div>
                   13409:                 <div>
1.67    ! hubertf  13410:                   <h3 class="title"><a name=
1.38      dillo    13411:                   "hardcoded-paths"></a>15.5.5.&nbsp;Packages with
1.1       grant    13412:                   hardcoded paths to other interpreters</h3>
                   13413:                 </div>
                   13414:               </div>
                   13415:             </div>
                   13416: 
                   13417:             <p>Your package may also contain scripts with hardcoded
                   13418:             paths to other interpreters besides (or as well as)
                   13419:             perl. To correct the full pathname to the script
                   13420:             interpreter, you need to set the following definitions
1.45      wiz      13421:             in your <code xmlns=
                   13422:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13423:             "filename">Makefile</code> (we shall use
                   13424:             <span><strong class="command">tclsh</strong></span> in
                   13425:             this example):</p>
1.1       grant    13426:             <pre class="programlisting">
1.51      rillig   13427:     REPLACE_INTERPRETER+=   tcl
                   13428:     _REPLACE.tcl.old=       .*/bin/tclsh
                   13429:     _REPLACE.tcl.new=       ${PREFIX}/bin/tclsh
                   13430:     _REPLACE_FILES.tcl=     # list of tcl scripts which need to be fixed,
                   13431:                             # relative to ${WRKSRC}, just as in REPLACE_PERL
1.1       grant    13432: </pre>
                   13433:           </div>
                   13434: 
1.67    ! hubertf  13435:           <div class="sect2" lang="en">
1.1       grant    13436:             <div class="titlepage">
                   13437:               <div>
                   13438:                 <div>
1.67    ! hubertf  13439:                   <h3 class="title"><a name=
1.38      dillo    13440:                   "perl-modules"></a>15.5.6.&nbsp;Packages
1.30      wiz      13441:                   installing perl modules</h3>
1.1       grant    13442:                 </div>
                   13443:               </div>
                   13444:             </div>
                   13445: 
                   13446:             <p>Makefiles of packages providing perl5 modules should
1.45      wiz      13447:             include the Makefile fragment <code xmlns=
                   13448:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13449:             "filename">../../lang/perl5/module.mk</code>. It
                   13450:             provides a <span><strong class=
                   13451:             "command">do-configure</strong></span> target for the
                   13452:             standard perl configuration for such modules as well as
                   13453:             various hooks to tune this configuration. See comments
                   13454:             in this file for details.</p>
1.1       grant    13455: 
                   13456:             <p>Perl5 modules will install into different places
                   13457:             depending on the version of perl used during the build
                   13458:             process. To address this, pkgsrc will append lines to
1.45      wiz      13459:             the <code xmlns=
                   13460:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13461:             "filename">PLIST</code> corresponding to the files
                   13462:             listed in the installed <code xmlns=
                   13463:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13464:             "filename">.packlist</code> file generated by most
                   13465:             perl5 modules. This is invoked by defining <code class=
                   13466:             "varname">PERL5_PACKLIST</code> to a space-separated
                   13467:             list of paths to packlist files, e.g.:</p>
1.1       grant    13468:             <pre class="programlisting">
1.51      rillig   13469:     PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
1.1       grant    13470: </pre>
                   13471: 
1.14      xtraeme  13472:             <p>The variables <code class=
                   13473:             "varname">PERL5_SITELIB</code>, <code class=
                   13474:             "varname">PERL5_SITEARCH</code>, and <code class=
                   13475:             "varname">PERL5_ARCHLIB</code> represent the three
1.1       grant    13476:             locations in which perl5 modules may be installed, and
                   13477:             may be used by perl5 packages that don't have a
                   13478:             packlist. These three variables are also substituted
1.45      wiz      13479:             for in the <code xmlns=
                   13480:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13481:             "filename">PLIST</code>.</p>
1.1       grant    13482:           </div>
                   13483: 
1.67    ! hubertf  13484:           <div class="sect2" lang="en">
1.1       grant    13485:             <div class="titlepage">
                   13486:               <div>
                   13487:                 <div>
1.67    ! hubertf  13488:                   <h3 class="title"><a name=
1.38      dillo    13489:                   "faq.info-files"></a>15.5.7.&nbsp;Packages
1.1       grant    13490:                   installing info files</h3>
                   13491:                 </div>
                   13492:               </div>
                   13493:             </div>
                   13494: 
                   13495:             <p>Some packages install info files or use the
                   13496:             &#8220;<span class="quote">makeinfo</span>&#8221; or
                   13497:             &#8220;<span class="quote">install-info</span>&#8221;
                   13498:             commands. Each of the info files:</p>
                   13499: 
                   13500:             <div class="itemizedlist">
                   13501:               <ul type="disc">
                   13502:                 <li>
                   13503:                   <p>is considered to be installed in the directory
1.45      wiz      13504:                   <code xmlns=
                   13505:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13506:                   "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1       grant    13507:                 </li>
                   13508: 
                   13509:                 <li>
                   13510:                   <p>is registered in the Info directory file
1.45      wiz      13511:                   <code xmlns=
                   13512:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13513:                   "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1       grant    13514:                 </li>
                   13515: 
                   13516:                 <li>
                   13517:                   <p>and must be listed as a filename in the
1.14      xtraeme  13518:                   <code class="varname">INFO_FILES</code> variable
                   13519:                   in the package Makefile.</p>
1.1       grant    13520:                 </li>
                   13521:               </ul>
                   13522:             </div>
                   13523: 
1.14      xtraeme  13524:             <p><code class="varname">INFO_DIR</code> defaults to
1.1       grant    13525:             &#8220;<span class="quote">info</span>&#8221; and can
1.45      wiz      13526:             be overridden in the package Makefile. <code xmlns=
                   13527:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13528:             "filename">INSTALL</code> and <code xmlns=
                   13529:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13530:             "filename">DEINSTALL</code> scripts will be generated
                   13531:             to handle registration of the info files in the Info
1.1       grant    13532:             directory file. The &#8220;<span class=
                   13533:             "quote">install-info</span>&#8221; command used for the
                   13534:             info files registration is either provided by the
                   13535:             system, or by a special purpose package automatically
                   13536:             added as dependency if needed.</p>
                   13537: 
                   13538:             <p>A package which needs the &#8220;<span class=
                   13539:             "quote">makeinfo</span>&#8221; command at build time
1.14      xtraeme  13540:             must define the variable <code class=
                   13541:             "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1       grant    13542:             minimum version of the &#8220;<span class=
                   13543:             "quote">makeinfo</span>&#8221; command is needed it
1.14      xtraeme  13544:             should be noted with the <code class=
                   13545:             "varname">TEXINFO_REQD</code> variable in the package
1.45      wiz      13546:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13547:             class="filename">Makefile</code>. By default, a minimum
                   13548:             version of 3.12 is required. If the system does not
                   13549:             provide a <span><strong class=
1.14      xtraeme  13550:             "command">makeinfo</strong></span> command or if it
                   13551:             does not match the required minimum, a build dependency
                   13552:             on the <a xmlns=
                   13553:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    13554:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.45      wiz      13555:             target="_top"><code xmlns="" class=
                   13556:             "filename">devel/gtexinfo</code></a> package will be
1.20      ben      13557:             added automatically.</p>
1.1       grant    13558: 
                   13559:             <p>The build and installation process of the software
                   13560:             provided by the package should not use the
1.14      xtraeme  13561:             <span><strong class=
                   13562:             "command">install-info</strong></span> command as the
                   13563:             registration of info files is the task of the package
1.45      wiz      13564:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13565:             class="filename">INSTALL</code> script, and it must use
                   13566:             the appropriate <span><strong class=
1.14      xtraeme  13567:             "command">makeinfo</strong></span> command.</p>
1.1       grant    13568: 
1.47      reed     13569:             <p>To achieve this goal, the pkgsrc infrastructure
1.14      xtraeme  13570:             creates overriding scripts for the <span><strong class=
                   13571:             "command">install-info</strong></span> and
                   13572:             <span><strong class="command">makeinfo</strong></span>
                   13573:             commands in a directory listed early in <code class=
                   13574:             "varname">PATH</code>.</p>
1.1       grant    13575: 
1.14      xtraeme  13576:             <p>The script overriding <span><strong class=
                   13577:             "command">install-info</strong></span> has no effect
                   13578:             except the logging of a message. The script overriding
                   13579:             <span><strong class="command">makeinfo</strong></span>
                   13580:             logs a message and according to the value of
                   13581:             <code class="varname">USE_MAKEINFO</code> and
                   13582:             <code class="varname">TEXINFO_REQD</code> either run
                   13583:             the appropriate <span><strong class=
                   13584:             "command">makeinfo</strong></span> command or exit on
                   13585:             error.</p>
1.1       grant    13586:           </div>
                   13587: 
1.67    ! hubertf  13588:           <div class="sect2" lang="en">
1.57      minskim  13589:             <div class="titlepage">
                   13590:               <div>
                   13591:                 <div>
1.67    ! hubertf  13592:                   <h3 class="title"><a name=
1.57      minskim  13593:                   "manpages"></a>15.5.8.&nbsp;Packages installing
                   13594:                   man pages</h3>
                   13595:                 </div>
                   13596:               </div>
                   13597:             </div>
                   13598: 
                   13599:             <p>Many packages install manual pages. The man pages
                   13600:             are installed under <code class=
                   13601:             "varname">${PREFIX}/${PKGMANDIR}</code> which is
                   13602:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13603:             class="filename">/usr/pkg/man</code> by default.
                   13604:             <code class="varname">PKGMANDIR</code> defaults to
                   13605:             &#8220;<span class="quote">man</span>&#8221;. For
                   13606:             example, you can set <code class=
                   13607:             "varname">PKGMANDIR</code> to &#8220;<span class=
                   13608:             "quote">share/man</span>&#8221; to have man pages
                   13609:             install under <code xmlns=
                   13610:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13611:             "filename">/usr/pkg/share/man/</code> by default.</p>
                   13612: 
                   13613:             <div class="note" style=
                   13614:             "margin-left: 0.5in; margin-right: 0.5in;">
                   13615:               <h3 class="title">Note</h3>
                   13616: 
                   13617:               <p>The support for a custom <code class=
                   13618:               "varname">PKGMANDIR</code> is not complete.</p>
                   13619:             </div>
                   13620: 
                   13621:             <p>The <code xmlns=
                   13622:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13623:             "filename">PLIST</code> files can just use <code xmlns=
                   13624:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13625:             "filename">man/</code> as the top level directory for
                   13626:             the man page file entries and the pkgsrc framework will
                   13627:             convert as needed.</p>
                   13628: 
                   13629:             <p>Packages that are configured with <code class=
                   13630:             "varname">GNU_CONFIGURE</code> set as
                   13631:             &#8220;<span class="quote">yes</span>&#8221;, by
                   13632:             default will use the <code xmlns=
                   13633:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13634:             "filename">./configure</code> --mandir switch to set
                   13635:             where the man pages should be installed. The path is
                   13636:             <code class="varname">GNU_CONFIGURE_MANDIR</code> which
                   13637:             defaults to <code class=
                   13638:             "varname">${PREFIX}/${PKGMANDIR}</code>.</p>
                   13639: 
                   13640:             <p>Packages that use <code class=
                   13641:             "varname">GNU_CONFIGURE</code> but do not use --mandir,
                   13642:             can set <code class=
                   13643:             "varname">CONFIGURE_HAS_MANDIR</code> to
                   13644:             &#8220;<span class="quote">no</span>&#8221;. Or if the
                   13645:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13646:             class="filename">./configure</code> script uses a
                   13647:             non-standard use of --mandir, you can set <code class=
                   13648:             "varname">GNU_CONFIGURE_MANDIR</code> as needed.</p>
                   13649: 
                   13650:             <p>See <a href="#manpage-compression" title=
                   13651:             "10.5.&nbsp;Man page compression">Section&nbsp;10.5,
                   13652:             &#8220;Man page compression&#8221;</a> for information
                   13653:             on installation of compressed manual pages.</p>
                   13654:           </div>
                   13655: 
1.67    ! hubertf  13656:           <div class="sect2" lang="en">
1.1       grant    13657:             <div class="titlepage">
                   13658:               <div>
                   13659:                 <div>
1.67    ! hubertf  13660:                   <h3 class="title"><a name=
1.57      minskim  13661:                   "gconf2-data-files"></a>15.5.9.&nbsp;Packages
1.30      wiz      13662:                   installing GConf2 data files</h3>
1.1       grant    13663:                 </div>
                   13664:               </div>
                   13665:             </div>
                   13666: 
1.45      wiz      13667:             <p>If a package installs <code xmlns=
                   13668:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13669:             "filename">.schemas</code> or <code xmlns=
                   13670:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13671:             "filename">.entries</code> files, used by GConf2, you
1.1       grant    13672:             need to take some extra steps to make sure they get
                   13673:             registered in the database:</p>
                   13674: 
                   13675:             <div class="orderedlist">
                   13676:               <ol type="1">
                   13677:                 <li>
1.45      wiz      13678:                   <p>Include <code xmlns=
                   13679:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13680:                   "filename">../../devel/GConf2/schemas.mk</code>
1.45      wiz      13681:                   instead of its <code xmlns=
                   13682:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13683:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    13684:                   care of rebuilding the GConf2 database at
                   13685:                   installation and deinstallation time, and tells
                   13686:                   the package where to install GConf2 data files
                   13687:                   using some standard configure arguments. It also
                   13688:                   disallows any access to the database directly
                   13689:                   from the package.</p>
                   13690:                 </li>
                   13691: 
                   13692:                 <li>
                   13693:                   <p>Ensure that the package installs its
1.45      wiz      13694:                   <code xmlns=
                   13695:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13696:                   "filename">.schemas</code> files under
                   13697:                   <code xmlns=
                   13698:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13699:                   "filename">${PREFIX}/share/gconf/schemas</code>.
1.45      wiz      13700:                   If they get installed under <code xmlns=
                   13701:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13702:                   "filename">${PREFIX}/etc</code>, you will need to
1.1       grant    13703:                   manually patch the package.</p>
                   13704:                 </li>
                   13705: 
                   13706:                 <li>
                   13707:                   <p>Check the PLIST and remove any entries under
                   13708:                   the etc/gconf directory, as they will be handled
                   13709:                   automatically. See <a href="#faq.conf" title=
1.38      dillo    13710:                   "7.14.&nbsp;How do I change the location of configuration files?">
                   13711:                   Section&nbsp;7.14, &#8220;How do I change the
1.35      jmmv     13712:                   location of configuration files?&#8221;</a> for
                   13713:                   more information.</p>
1.1       grant    13714:                 </li>
                   13715: 
                   13716:                 <li>
1.14      xtraeme  13717:                   <p>Define the <code class=
                   13718:                   "varname">GCONF2_SCHEMAS</code> variable in your
1.45      wiz      13719:                   <code xmlns=
                   13720:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13721:                   "filename">Makefile</code> with a list of all
                   13722:                   <code xmlns=
                   13723:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13724:                   "filename">.schemas</code> files installed by the
                   13725:                   package, if any. Names must not contain any
                   13726:                   directories in them.</p>
1.1       grant    13727:                 </li>
                   13728: 
                   13729:                 <li>
1.14      xtraeme  13730:                   <p>Define the <code class=
                   13731:                   "varname">GCONF2_ENTRIES</code> variable in your
1.45      wiz      13732:                   <code xmlns=
                   13733:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13734:                   "filename">Makefile</code> with a list of all
                   13735:                   <code xmlns=
                   13736:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13737:                   "filename">.entries</code> files installed by the
                   13738:                   package, if any. Names must not contain any
                   13739:                   directories in them.</p>
1.1       grant    13740:                 </li>
                   13741:               </ol>
                   13742:             </div>
                   13743:           </div>
                   13744: 
1.67    ! hubertf  13745:           <div class="sect2" lang="en">
1.1       grant    13746:             <div class="titlepage">
                   13747:               <div>
                   13748:                 <div>
1.30      wiz      13749:                   <h3 class="title"><a name=
1.57      minskim  13750:                   "scrollkeeper-data-files"></a>15.5.10.&nbsp;Packages
1.30      wiz      13751:                   installing scrollkeeper data files</h3>
1.1       grant    13752:                 </div>
                   13753:               </div>
                   13754:             </div>
                   13755: 
1.45      wiz      13756:             <p>If a package installs <code xmlns=
                   13757:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13758:             "filename">.omf</code> files, used by scrollkeeper, you
                   13759:             need to take some extra steps to make sure they get
                   13760:             registered in the database:</p>
1.1       grant    13761: 
                   13762:             <div class="orderedlist">
                   13763:               <ol type="1">
                   13764:                 <li>
1.45      wiz      13765:                   <p>Include <code xmlns=
                   13766:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13767:                   "filename">../../textproc/scrollkeeper/omf.mk</code>
1.45      wiz      13768:                   instead of its <code xmlns=
                   13769:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13770:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    13771:                   care of rebuilding the scrollkeeper database at
                   13772:                   installation and deinstallation time, and
                   13773:                   disallows any access to it directly from the
                   13774:                   package.</p>
                   13775:                 </li>
                   13776: 
                   13777:                 <li>
                   13778:                   <p>Check the PLIST and remove any entries under
1.45      wiz      13779:                   the <code xmlns=
                   13780:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13781:                   "filename">libdata/scrollkeeper</code> directory,
1.1       grant    13782:                   as they will be handled automatically.</p>
                   13783:                 </li>
                   13784: 
                   13785:                 <li>
1.45      wiz      13786:                   <p>Remove the <code xmlns=
                   13787:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13788:                   "filename">share/omf</code> directory from the
                   13789:                   PLIST. It will be handled by scrollkeeper.</p>
1.1       grant    13790:                 </li>
                   13791:               </ol>
                   13792:             </div>
                   13793:           </div>
                   13794: 
1.67    ! hubertf  13795:           <div class="sect2" lang="en">
1.1       grant    13796:             <div class="titlepage">
                   13797:               <div>
                   13798:                 <div>
1.67    ! hubertf  13799:                   <h3 class="title"><a name=
1.57      minskim  13800:                   "x11-fonts"></a>15.5.11.&nbsp;Packages installing
1.1       grant    13801:                   X11 fonts</h3>
                   13802:                 </div>
                   13803:               </div>
                   13804:             </div>
                   13805: 
                   13806:             <p>If a package installs font files, you will need to
                   13807:             rebuild the fonts database in the directory where they
                   13808:             get installed at installation and deinstallation time.
1.65      hubertf  13809:             This can be automatically done by using the pkginstall
                   13810:             framework.</p>
1.1       grant    13811: 
1.65      hubertf  13812:             <p>You can list the directories where fonts are
                   13813:             installed in the <code class=
                   13814:             "varname">FONTS_DIRS.<em class=
                   13815:             "replaceable"><code>type</code></em></code> variables,
                   13816:             where <em class="replaceable"><code>type</code></em>
                   13817:             can be one of &#8220;<span class=
                   13818:             "quote">ttf</span>&#8221;, &#8220;<span class=
                   13819:             "quote">type1</span>&#8221; or &#8220;<span class=
                   13820:             "quote">x11</span>&#8221;. Also make sure that the
                   13821:             database file <code xmlns=
1.45      wiz      13822:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13823:             "filename">fonts.dir</code> is not listed in the
1.1       grant    13824:             PLIST.</p>
                   13825: 
                   13826:             <p>Note that you should not create new directories for
                   13827:             fonts; instead use the standard ones to avoid that the
                   13828:             user needs to manually configure his X server to find
                   13829:             them.</p>
                   13830:           </div>
                   13831: 
1.67    ! hubertf  13832:           <div class="sect2" lang="en">
1.1       grant    13833:             <div class="titlepage">
                   13834:               <div>
                   13835:                 <div>
1.67    ! hubertf  13836:                   <h3 class="title"><a name=
1.57      minskim  13837:                   "gtk2-modules"></a>15.5.12.&nbsp;Packages
1.30      wiz      13838:                   installing GTK2 modules</h3>
1.1       grant    13839:                 </div>
                   13840:               </div>
                   13841:             </div>
                   13842: 
1.47      reed     13843:             <p>If a package installs GTK2 immodules or loaders, you
1.1       grant    13844:             need to take some extra steps to get them registered in
                   13845:             the GTK2 database properly:</p>
                   13846: 
                   13847:             <div class="orderedlist">
                   13848:               <ol type="1">
                   13849:                 <li>
1.45      wiz      13850:                   <p>Include <code xmlns=
                   13851:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13852:                   "filename">../../x11/gtk2/modules.mk</code>
1.45      wiz      13853:                   instead of its <code xmlns=
                   13854:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13855:                   "filename">buildlink3.mk</code> file. This takes
                   13856:                   care of rebuilding the database at installation
                   13857:                   and deinstallation time.</p>
1.1       grant    13858:                 </li>
                   13859: 
                   13860:                 <li>
1.14      xtraeme  13861:                   <p>Set <code class=
                   13862:                   "varname">GTK2_IMMODULES=YES</code> if your
                   13863:                   package installs GTK2 immodules.</p>
1.1       grant    13864:                 </li>
                   13865: 
                   13866:                 <li>
1.14      xtraeme  13867:                   <p>Set <code class=
                   13868:                   "varname">GTK2_LOADERS=YES</code> if your package
                   13869:                   installs GTK2 loaders.</p>
1.1       grant    13870:                 </li>
                   13871: 
                   13872:                 <li>
1.47      reed     13873:                   <p>Patch the package to not touch any of the GTK2
1.1       grant    13874:                   databases directly. These are:</p>
                   13875: 
                   13876:                   <div class="itemizedlist">
                   13877:                     <ul type="disc">
                   13878:                       <li>
1.45      wiz      13879:                         <p><code xmlns=
                   13880:                         "http://www.w3.org/TR/xhtml1/transitional"
                   13881:                         class=
1.14      xtraeme  13882:                         "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1       grant    13883:                       </li>
                   13884: 
                   13885:                       <li>
1.45      wiz      13886:                         <p><code xmlns=
                   13887:                         "http://www.w3.org/TR/xhtml1/transitional"
                   13888:                         class=
1.14      xtraeme  13889:                         "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1       grant    13890:                       </li>
                   13891:                     </ul>
                   13892:                   </div>
                   13893:                 </li>
                   13894: 
                   13895:                 <li>
                   13896:                   <p>Check the PLIST and remove any entries under
1.45      wiz      13897:                   the <code xmlns=
                   13898:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13899:                   "filename">libdata/gtk-2.0</code> directory, as
                   13900:                   they will be handled automatically.</p>
1.1       grant    13901:                 </li>
                   13902:               </ol>
                   13903:             </div>
                   13904:           </div>
                   13905: 
1.67    ! hubertf  13906:           <div class="sect2" lang="en">
1.1       grant    13907:             <div class="titlepage">
                   13908:               <div>
                   13909:                 <div>
1.67    ! hubertf  13910:                   <h3 class="title"><a name=
1.57      minskim  13911:                   "sgml-xml-data"></a>15.5.13.&nbsp;Packages
1.30      wiz      13912:                   installing SGML or XML data</h3>
1.1       grant    13913:                 </div>
                   13914:               </div>
                   13915:             </div>
                   13916: 
                   13917:             <p>If a package installs SGML or XML data files that
                   13918:             need to be registered in system-wide catalogs (like
                   13919:             DTDs, sub-catalogs, etc.), you need to take some extra
                   13920:             steps:</p>
                   13921: 
                   13922:             <div class="orderedlist">
                   13923:               <ol type="1">
                   13924:                 <li>
1.45      wiz      13925:                   <p>Include <code xmlns=
                   13926:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13927:                   "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
1.45      wiz      13928:                   in your <code xmlns=
                   13929:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13930:                   "filename">Makefile</code>, which takes care of
                   13931:                   registering those files in system-wide catalogs
                   13932:                   at installation and deinstallation time.</p>
1.1       grant    13933:                 </li>
                   13934: 
                   13935:                 <li>
1.14      xtraeme  13936:                   <p>Set <code class="varname">SGML_CATALOGS</code>
                   13937:                   to the full path of any SGML catalogs installed
                   13938:                   by the package.</p>
1.1       grant    13939:                 </li>
                   13940: 
                   13941:                 <li>
1.14      xtraeme  13942:                   <p>Set <code class="varname">XML_CATALOGS</code>
                   13943:                   to the full path of any XML catalogs installed by
1.1       grant    13944:                   the package.</p>
                   13945:                 </li>
                   13946: 
                   13947:                 <li>
1.14      xtraeme  13948:                   <p>Set <code class="varname">SGML_ENTRIES</code>
                   13949:                   to individual entries to be added to the SGML
1.1       grant    13950:                   catalog. These come in groups of three strings;
                   13951:                   see xmlcatmgr(1) for more information
                   13952:                   (specifically, arguments recognized by the 'add'
                   13953:                   action). Note that you will normally not use this
                   13954:                   variable.</p>
                   13955:                 </li>
                   13956: 
                   13957:                 <li>
1.14      xtraeme  13958:                   <p>Set <code class="varname">XML_ENTRIES</code>
                   13959:                   to individual entries to be added to the XML
1.1       grant    13960:                   catalog. These come in groups of three strings;
                   13961:                   see xmlcatmgr(1) for more information
                   13962:                   (specifically, arguments recognized by the 'add'
                   13963:                   action). Note that you will normally not use this
                   13964:                   variable.</p>
                   13965:                 </li>
                   13966:               </ol>
                   13967:             </div>
                   13968:           </div>
                   13969: 
1.67    ! hubertf  13970:           <div class="sect2" lang="en">
1.1       grant    13971:             <div class="titlepage">
                   13972:               <div>
                   13973:                 <div>
1.67    ! hubertf  13974:                   <h3 class="title"><a name=
1.57      minskim  13975:                   "mime-database"></a>15.5.14.&nbsp;Packages
1.30      wiz      13976:                   installing extensions to the MIME database</h3>
1.1       grant    13977:                 </div>
                   13978:               </div>
                   13979:             </div>
                   13980: 
                   13981:             <p>If a package provides extensions to the MIME
1.45      wiz      13982:             database by installing <code xmlns=
                   13983:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13984:             "filename">.xml</code> files inside <code xmlns=
                   13985:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13986:             "filename">${PREFIX}/share/mime/packages</code>, you
                   13987:             need to take some extra steps to ensure that the
                   13988:             database is kept consistent with respect to these new
                   13989:             files:</p>
1.1       grant    13990: 
                   13991:             <div class="orderedlist">
                   13992:               <ol type="1">
                   13993:                 <li>
1.45      wiz      13994:                   <p>Include <code xmlns=
                   13995:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13996:                   "filename">../../databases/shared-mime-info/mimedb.mk</code>
1.45      wiz      13997:                   (avoid using the <code xmlns=
                   13998:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13999:                   "filename">buildlink3.mk</code> file from this
                   14000:                   same directory, which is reserved for inclusion
1.45      wiz      14001:                   from other <code xmlns=
                   14002:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14003:                   "filename">buildlink3.mk</code> files). It takes
                   14004:                   care of rebuilding the MIME database at
                   14005:                   installation and deinstallation time, and
                   14006:                   disallows any access to it directly from the
1.1       grant    14007:                   package.</p>
                   14008:                 </li>
                   14009: 
                   14010:                 <li>
                   14011:                   <p>Check the PLIST and remove any entries under
1.45      wiz      14012:                   the <code xmlns=
                   14013:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14014:                   "filename">share/mime</code> directory,
                   14015:                   <span class="emphasis"><em>except</em></span> for
                   14016:                   files saved under <code xmlns=
                   14017:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14018:                   "filename">share/mime/packages</code>. The former
1.1       grant    14019:                   are handled automatically by the
1.47      reed     14020:                   update-mime-database program, but the latter are
1.1       grant    14021:                   package-dependent and must be removed by the
                   14022:                   package that installed them in the first
                   14023:                   place.</p>
                   14024:                 </li>
                   14025: 
                   14026:                 <li>
1.45      wiz      14027:                   <p>Remove any <code xmlns=
                   14028:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14029:                   "filename">share/mime/*</code> directories from
                   14030:                   the PLIST. They will be handled by the
1.1       grant    14031:                   shared-mime-info package.</p>
                   14032:                 </li>
                   14033:               </ol>
                   14034:             </div>
                   14035:           </div>
                   14036: 
1.67    ! hubertf  14037:           <div class="sect2" lang="en">
1.1       grant    14038:             <div class="titlepage">
                   14039:               <div>
                   14040:                 <div>
1.67    ! hubertf  14041:                   <h3 class="title"><a name=
1.57      minskim  14042:                   "intltool"></a>15.5.15.&nbsp;Packages using
1.1       grant    14043:                   intltool</h3>
                   14044:                 </div>
                   14045:               </div>
                   14046:             </div>
                   14047: 
                   14048:             <p>If a package uses intltool during its build, include
1.45      wiz      14049:             the <code xmlns=
                   14050:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14051:             "filename">../../textproc/intltool/buildlink3.mk</code>
1.1       grant    14052:             file, which forces it to use the intltool package
                   14053:             provided by pkgsrc, instead of the one bundled with the
                   14054:             distribution file.</p>
                   14055: 
                   14056:             <p>This tracks intltool's build-time dependencies and
                   14057:             uses the latest available version; this way, the
                   14058:             package benefits of any bug fixes that may have
                   14059:             appeared since it was released.</p>
                   14060:           </div>
1.18      xtraeme  14061: 
1.67    ! hubertf  14062:           <div class="sect2" lang="en">
1.18      xtraeme  14063:             <div class="titlepage">
                   14064:               <div>
                   14065:                 <div>
1.67    ! hubertf  14066:                   <h3 class="title"><a name=
1.57      minskim  14067:                   "startup-scripts"></a>15.5.16.&nbsp;Packages
1.30      wiz      14068:                   installing startup scripts</h3>
1.18      xtraeme  14069:                 </div>
                   14070:               </div>
                   14071:             </div>
                   14072: 
                   14073:             <p>If a package contains a rc.d script, it won't be
                   14074:             copied into the startup directory by default, but you
                   14075:             can enable it, by adding the option <code class=
1.45      wiz      14076:             "varname">PKG_RCD_SCRIPTS=YES</code> in <code xmlns=
                   14077:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.18      xtraeme  14078:             "filename">/etc/mk.conf</code>. This option will copy
1.45      wiz      14079:             the scripts into <code xmlns=
                   14080:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.18      xtraeme  14081:             "filename">/etc/rc.d</code> when a package is
                   14082:             installed, and it will automatically remove the scripts
                   14083:             when the package is deinstalled.</p>
                   14084:           </div>
1.57      minskim  14085: 
1.67    ! hubertf  14086:           <div class="sect2" lang="en">
1.57      minskim  14087:             <div class="titlepage">
                   14088:               <div>
                   14089:                 <div>
1.67    ! hubertf  14090:                   <h3 class="title"><a name=
1.57      minskim  14091:                   "tex-packages"></a>15.5.17.&nbsp;Packages
                   14092:                   installing TeX modules</h3>
                   14093:                 </div>
                   14094:               </div>
                   14095:             </div>
                   14096: 
                   14097:             <p>If a package installs TeX packages into the texmf
                   14098:             tree, the <code xmlns=
                   14099:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   14100:             "filename">ls-R</code> database of the tree needs to be
                   14101:             updated.</p>
                   14102: 
                   14103:             <div class="note" style=
                   14104:             "margin-left: 0.5in; margin-right: 0.5in;">
                   14105:               <h3 class="title">Note</h3>
                   14106: 
                   14107:               <p>Except the main TeX packages such as teTeX-texmf,
                   14108:               packages should install files into <code class=
                   14109:               "varname">PKG_LOCALTEXMFPREFIX</code>, not
                   14110:               <code class="varname">PKG_TEXMFPREFIX</code>.</p>
                   14111:             </div>
                   14112: 
                   14113:             <div class="orderedlist">
                   14114:               <ol type="1">
                   14115:                 <li>
                   14116:                   <p>Include <code xmlns=
                   14117:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14118:                   "filename">../../print/teTeX/module.mk</code>
                   14119:                   instead of <code xmlns=
                   14120:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14121:                   "filename">../../mk/tex.buildlink3.mk</code>.
                   14122:                   This takes care of rebuilding the <code xmlns=
                   14123:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14124:                   "filename">ls-R</code> database at installation
                   14125:                   and deinstallation time.</p>
                   14126:                 </li>
                   14127: 
                   14128:                 <li>
                   14129:                   <p>If your package installs files into a texmf
                   14130:                   tree other than the one at <code class=
                   14131:                   "varname">PKG_LOCALTEXMFPREFIX</code>, set
                   14132:                   <code class="varname">TEXMFDIRS</code> to the
                   14133:                   list of all texmf trees that need database
                   14134:                   update.</p>
1.64      kim      14135: 
                   14136:                   <p>If your package also installs font map files
                   14137:                   that need to be registered using
                   14138:                   <span><strong class=
                   14139:                   "command">updmap</strong></span>, set
                   14140:                   <code class="varname">TEX_FONTMAPS</code> to the
                   14141:                   list of all such font map files. Then
                   14142:                   <span><strong class=
                   14143:                   "command">updmap</strong></span> will be run
                   14144:                   automatically at installation/deinstallation to
                   14145:                   enable/disable font map files for TeX output
                   14146:                   drivers.</p>
1.57      minskim  14147:                 </li>
                   14148: 
                   14149:                 <li>
                   14150:                   <p>Make sure that none of <code xmlns=
                   14151:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14152:                   "filename">ls-R</code> databases are included in
                   14153:                   <code xmlns=
                   14154:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14155:                   "filename">PLIST</code>, as they will be removed
                   14156:                   only by the teTeX-bin package.</p>
                   14157:                 </li>
                   14158:               </ol>
                   14159:             </div>
                   14160:           </div>
1.1       grant    14161:         </div>
                   14162: 
1.67    ! hubertf  14163:         <div class="sect1" lang="en">
1.1       grant    14164:           <div class="titlepage">
                   14165:             <div>
                   14166:               <div>
                   14167:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    14168:                 "feedback-to-author"></a>15.6.&nbsp;Feedback to the
1.30      wiz      14169:                 author</h2>
1.1       grant    14170:               </div>
                   14171:             </div>
                   14172:           </div>
                   14173: 
                   14174:           <p>If you have found any bugs in the package you make
                   14175:           available, if you had to do special steps to make it run
                   14176:           under NetBSD or if you enhanced the software in various
                   14177:           other ways, be sure to report these changes back to the
                   14178:           original author of the program! With that kind of
                   14179:           support, the next release of the program can incorporate
                   14180:           these fixes, and people not using the NetBSD packages
                   14181:           system can win from your efforts.</p>
                   14182: 
                   14183:           <p>Support the idea of free software!</p>
                   14184:         </div>
                   14185:       </div>
                   14186: 
1.67    ! hubertf  14187:       <div class="chapter" lang="en">
1.1       grant    14188:         <div class="titlepage">
                   14189:           <div>
                   14190:             <div>
1.67    ! hubertf  14191:               <h2 class="title"><a name=
1.38      dillo    14192:               "debug"></a>Chapter&nbsp;16.&nbsp;Debugging</h2>
1.1       grant    14193:             </div>
                   14194:           </div>
                   14195:         </div>
                   14196: 
                   14197:         <p>To check out all the gotchas when building a package,
                   14198:         here are the steps that I do in order to get a package
                   14199:         working. Please note this is basically the same as what was
                   14200:         explained in the previous sections, only with some
                   14201:         debugging aids.</p>
                   14202: 
                   14203:         <div class="itemizedlist">
                   14204:           <ul type="disc">
                   14205:             <li>
1.14      xtraeme  14206:               <p>Be sure to set <code class=
1.45      wiz      14207:               "varname">PKG_DEVELOPER=1</code> in <code xmlns=
                   14208:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14209:               "filename">/etc/mk.conf</code></p>
1.1       grant    14210:             </li>
                   14211: 
                   14212:             <li>
                   14213:               <p>Install <a xmlns=
                   14214:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   14215:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45      wiz      14216:               target="_top"><code xmlns="" class=
                   14217:               "filename">pkgtools/url2pkg</code></a>, create a
1.20      ben      14218:               directory for a new package, change into it, then run
                   14219:               <span><strong class=
                   14220:               "command">url2pkg</strong></span>:</p>
1.1       grant    14221:               <pre class="screen">
1.14      xtraeme  14222: <code class="prompt">%</code> <strong class=
                   14223: "userinput"><code>mkdir /usr/pkgsrc/<em class=
                   14224: "replaceable"><code>category</code></em>/<em class=
                   14225: "replaceable"><code>examplepkg</code></em></code></strong>
                   14226: <code class="prompt">%</code> <strong class=
                   14227: "userinput"><code>cd /usr/pkgsrc/<em class=
                   14228: "replaceable"><code>category</code></em>/<em class=
                   14229: "replaceable"><code>examplepkg</code></em></code></strong>
                   14230: <code class="prompt">%</code> <strong class=
                   14231: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1       grant    14232: </pre>
                   14233:             </li>
                   14234: 
                   14235:             <li>
1.45      wiz      14236:               <p>Edit the <code xmlns=
                   14237:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14238:               "filename">Makefile</code> as requested.</p>
1.1       grant    14239:             </li>
                   14240: 
                   14241:             <li>
1.45      wiz      14242:               <p>Fill in the <code xmlns=
                   14243:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14244:               "filename">DESCR</code> file</p>
1.1       grant    14245:             </li>
                   14246: 
                   14247:             <li>
1.14      xtraeme  14248:               <p>Run <span><strong class="command">make
                   14249:               configure</strong></span></p>
1.1       grant    14250:             </li>
                   14251: 
                   14252:             <li>
                   14253:               <p>Add any dependencies glimpsed from documentation
1.45      wiz      14254:               and the configure step to the package's <code xmlns=
                   14255:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14256:               "filename">Makefile</code>.</p>
1.1       grant    14257:             </li>
                   14258: 
                   14259:             <li>
                   14260:               <p>Make the package compile, doing multiple rounds
                   14261:               of</p>
                   14262:               <pre class="screen">
1.14      xtraeme  14263: <code class="prompt">%</code> <strong class=
                   14264: "userinput"><code>make</code></strong>
                   14265: <code class="prompt">%</code> <strong class=
                   14266: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
                   14267: <code class="prompt">%</code> <strong class=
                   14268: "userinput"><code>mkpatches</code></strong>
                   14269: <code class="prompt">%</code> <strong class=
                   14270: "userinput"><code>patchdiff</code></strong>
                   14271: <code class="prompt">%</code> <strong class=
                   14272: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
                   14273: <code class="prompt">%</code> <strong class=
                   14274: "userinput"><code>make mps</code></strong>
                   14275: <code class="prompt">%</code> <strong class=
                   14276: "userinput"><code>make clean</code></strong>
1.1       grant    14277: </pre>
                   14278: 
                   14279:               <p>Doing as non-root user will ensure that no files
                   14280:               are modified that shouldn't be, especially during the
1.14      xtraeme  14281:               build phase. <span><strong class=
                   14282:               "command">mkpatches</strong></span>,
                   14283:               <span><strong class=
                   14284:               "command">patchdiff</strong></span> and
                   14285:               <span><strong class="command">pkgvi</strong></span>
                   14286:               are from the <a xmlns=
1.1       grant    14287:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   14288:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45      wiz      14289:               target="_top"><code xmlns="" class=
                   14290:               "filename">pkgtools/pkgdiff</code></a> package.</p>
1.1       grant    14291:             </li>
                   14292: 
                   14293:             <li>
1.45      wiz      14294:               <p>Look at the <code xmlns=
                   14295:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14296:               "filename">Makefile</code>, fix if necessary; see
                   14297:               <a href="#components.Makefile" title=
1.38      dillo    14298:               "8.1.&nbsp;Makefile">Section&nbsp;8.1,
1.45      wiz      14299:               &#8220;<code xmlns=
                   14300:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14301:               "filename">Makefile</code>&#8221;</a>.</p>
1.1       grant    14302:             </li>
                   14303: 
                   14304:             <li>
1.45      wiz      14305:               <p>Generate a <code xmlns=
                   14306:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14307:               "filename">PLIST</code>:</p>
1.1       grant    14308:               <pre class="screen">
1.14      xtraeme  14309: <code class="prompt">#</code> <strong class=
                   14310: "userinput"><code>make install</code></strong>
                   14311: <code class="prompt">#</code> <strong class=
                   14312: "userinput"><code>make print-PLIST &gt;PLIST</code></strong>
                   14313: <code class="prompt">#</code> <strong class=
                   14314: "userinput"><code>make deinstall</code></strong>
                   14315: <code class="prompt">#</code> <strong class=
                   14316: "userinput"><code>make install</code></strong>
                   14317: <code class="prompt">#</code> <strong class=
                   14318: "userinput"><code>make deinstall</code></strong>
1.1       grant    14319: </pre>
                   14320: 
1.45      wiz      14321:               <p>You usually need to be <code xmlns=
                   14322:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14323:               "username">root</code> to do this. Look if there are
1.1       grant    14324:               any files left:</p>
                   14325:               <pre class="screen">
1.14      xtraeme  14326: <code class="prompt">#</code> <strong class=
                   14327: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    14328: </pre>
                   14329: 
                   14330:               <p>If this reveals any files that are missing in
1.45      wiz      14331:               <code xmlns=
                   14332:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14333:               "filename">PLIST</code>, add them.</p>
1.1       grant    14334:             </li>
                   14335: 
                   14336:             <li>
1.45      wiz      14337:               <p>Now that the <code xmlns=
                   14338:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14339:               "filename">PLIST</code> is OK, install the package
                   14340:               again and make a binary package:</p>
1.1       grant    14341:               <pre class="screen">
1.14      xtraeme  14342: <code class="prompt">#</code> <strong class=
                   14343: "userinput"><code>make reinstall</code></strong>
                   14344: <code class="prompt">#</code> <strong class=
                   14345: "userinput"><code>make package</code></strong>
1.1       grant    14346: </pre>
                   14347:             </li>
                   14348: 
                   14349:             <li>
                   14350:               <p>Delete the installed package:</p>
                   14351:               <pre class="screen">
1.14      xtraeme  14352: <code class="prompt">#</code> <strong class=
                   14353: "userinput"><code>pkg_delete blub</code></strong>
1.1       grant    14354: </pre>
                   14355:             </li>
                   14356: 
                   14357:             <li>
1.14      xtraeme  14358:               <p>Repeat the above <span><strong class=
                   14359:               "command">make print-PLIST</strong></span> command,
                   14360:               which shouldn't find anything now:</p>
1.1       grant    14361:               <pre class="screen">
1.14      xtraeme  14362: <code class="prompt">#</code> <strong class=
                   14363: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    14364: </pre>
                   14365:             </li>
                   14366: 
                   14367:             <li>
                   14368:               <p>Reinstall the binary package:</p>
                   14369:               <pre class="screen">
1.14      xtraeme  14370: <code class="prompt">#</code> <strong class=
                   14371: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1       grant    14372: </pre>
                   14373:             </li>
                   14374: 
                   14375:             <li>
                   14376:               <p>Play with it. Make sure everything works.</p>
                   14377:             </li>
                   14378: 
                   14379:             <li>
1.14      xtraeme  14380:               <p>Run <span><strong class=
                   14381:               "command">pkglint</strong></span> from <a xmlns=
1.1       grant    14382:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   14383:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45      wiz      14384:               target="_top"><code xmlns="" class=
                   14385:               "filename">pkgtools/pkglint</code></a>, and fix the
1.20      ben      14386:               problems it reports:</p>
1.1       grant    14387:               <pre class="screen">
1.14      xtraeme  14388: <code class="prompt">#</code> <strong class=
                   14389: "userinput"><code>pkglint</code></strong>
1.1       grant    14390: </pre>
                   14391:             </li>
                   14392: 
                   14393:             <li>
                   14394:               <p>Submit (or commit, if you have cvs access); see
                   14395:               <a href="#submit" title=
1.38      dillo    14396:               "Chapter&nbsp;17.&nbsp;Submitting and Committing">Chapter&nbsp;17,
1.1       grant    14397:               <i>Submitting and Committing</i></a>.</p>
                   14398:             </li>
                   14399:           </ul>
                   14400:         </div>
                   14401:       </div>
                   14402: 
1.67    ! hubertf  14403:       <div class="chapter" lang="en">
1.1       grant    14404:         <div class="titlepage">
                   14405:           <div>
                   14406:             <div>
1.67    ! hubertf  14407:               <h2 class="title"><a name=
1.38      dillo    14408:               "submit"></a>Chapter&nbsp;17.&nbsp;Submitting and
1.1       grant    14409:               Committing</h2>
                   14410:             </div>
                   14411:           </div>
                   14412:         </div>
                   14413: 
                   14414:         <div class="toc">
                   14415:           <p><b>Table of Contents</b></p>
                   14416: 
                   14417:           <dl>
1.30      wiz      14418:             <dt><span class="sect1"><a href=
1.38      dillo    14419:             "#submitting-your-package">17.1. Submitting your
1.30      wiz      14420:             packages</a></span></dt>
1.1       grant    14421: 
1.30      wiz      14422:             <dt><span class="sect1"><a href=
1.41      wiz      14423:             "#general-notes-for-changes">17.2. General notes when
                   14424:             adding, updating, or removing packages</a></span></dt>
                   14425: 
                   14426:             <dt><span class="sect1"><a href=
                   14427:             "#committing-importing">17.3. Committing: Importing a
1.30      wiz      14428:             package into CVS</a></span></dt>
1.1       grant    14429: 
1.30      wiz      14430:             <dt><span class="sect1"><a href=
1.41      wiz      14431:             "#updating-package">17.4. Updating a package to a newer
1.30      wiz      14432:             version</a></span></dt>
1.1       grant    14433: 
1.41      wiz      14434:             <dt><span class="sect1"><a href="#moving-package">17.5.
1.2       hubertf  14435:             Moving a package in pkgsrc</a></span></dt>
1.1       grant    14436:           </dl>
                   14437:         </div>
                   14438: 
1.67    ! hubertf  14439:         <div class="sect1" lang="en">
1.1       grant    14440:           <div class="titlepage">
                   14441:             <div>
                   14442:               <div>
                   14443:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    14444:                 "submitting-your-package"></a>17.1.&nbsp;Submitting
1.30      wiz      14445:                 your packages</h2>
1.1       grant    14446:               </div>
                   14447:             </div>
                   14448:           </div>
                   14449: 
                   14450:           <p>You have to separate between binary and
                   14451:           &#8220;<span class="quote">normal</span>&#8221; (source)
                   14452:           packages here:</p>
                   14453: 
                   14454:           <div class="itemizedlist">
                   14455:             <ul type="disc">
                   14456:               <li>
                   14457:                 <p>precompiled binary packages</p>
                   14458: 
                   14459:                 <p>Our policy is that we accept binaries only from
                   14460:                 pkgsrc developers to guarantee that the packages
                   14461:                 don't contain any trojan horses etc. This is not to
1.13      hubertf  14462:                 annoy anyone but rather to protect our users!
1.1       grant    14463:                 You're still free to put up your home-made binary
1.13      hubertf  14464:                 packages and tell the world where to get them.
                   14465:                 NetBSD developers doing bulk builds and wanting to
                   14466:                 upload them please see <a href="#bulk-upload"
1.38      dillo    14467:                 title="6.3.8.&nbsp;Uploading results of a bulk build">
                   14468:                 Section&nbsp;6.3.8, &#8220;Uploading results of a
1.13      hubertf  14469:                 bulk build&#8221;</a>.</p>
1.1       grant    14470:               </li>
                   14471: 
                   14472:               <li>
                   14473:                 <p>packages</p>
                   14474: 
                   14475:                 <p>First, check that your package is complete,
                   14476:                 compiles and runs well; see <a href="#debug" title=
1.38      dillo    14477:                 "Chapter&nbsp;16.&nbsp;Debugging">Chapter&nbsp;16,
1.1       grant    14478:                 <i>Debugging</i></a> and the rest of this document.
1.24      wiz      14479:                 Next, generate an uuencoded gzipped <a href=
                   14480:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   14481:                 <span class="citerefentry"><span class=
                   14482:                 "refentrytitle">tar</span>(1)</span></a> archive,
1.1       grant    14483:                 preferably with all files in a single directory.
1.14      xtraeme  14484:                 Finally, <span><strong class=
                   14485:                 "command">send-pr</strong></span> with category
1.1       grant    14486:                 &#8220;<span class="quote">pkg</span>&#8221;, a
                   14487:                 synopsis which includes the package name and
                   14488:                 version number, a short description of your package
                   14489:                 (contents of the COMMENT variable or DESCR file are
                   14490:                 OK) and attach the archive to your PR.</p>
                   14491: 
                   14492:                 <p>If you want to submit several packages, please
                   14493:                 send a separate PR for each one, it's easier for us
                   14494:                 to track things that way.</p>
                   14495: 
                   14496:                 <p>Alternatively, you can also import new packages
                   14497:                 into pkgsrc-wip (&#8220;<span class="quote">pkgsrc
                   14498:                 work-in-progress</span>&#8221;); see the homepage
                   14499:                 at <a href="http://pkgsrc-wip.sourceforge.net/"
                   14500:                 target=
                   14501:                 "_top">http://pkgsrc-wip.sourceforge.net/</a> for
                   14502:                 details.</p>
                   14503:               </li>
                   14504:             </ul>
                   14505:           </div>
                   14506:         </div>
                   14507: 
1.67    ! hubertf  14508:         <div class="sect1" lang="en">
1.1       grant    14509:           <div class="titlepage">
                   14510:             <div>
                   14511:               <div>
                   14512:                 <h2 class="title" style="clear: both"><a name=
1.41      wiz      14513:                 "general-notes-for-changes"></a>17.2.&nbsp;General
                   14514:                 notes when adding, updating, or removing
                   14515:                 packages</h2>
                   14516:               </div>
                   14517:             </div>
                   14518:           </div>
                   14519: 
                   14520:           <p>Please note all package additions, updates, moves, and
1.45      wiz      14521:           removals in <code xmlns=
                   14522:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      14523:           "filename">pkgsrc/doc/CHANGES</code>. It's very important
                   14524:           to keep this file up to date and conforming to the
                   14525:           existing format, because it will be used by scripts to
                   14526:           automatically update pages on <a href=
                   14527:           "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
1.45      wiz      14528:           and other sites. Additionally, check the <code xmlns=
                   14529:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      14530:           "filename">pkgsrc/doc/TODO</code> file and remove the
                   14531:           entry for the package you updated or removed, in case it
                   14532:           was mentioned there.</p>
                   14533: 
                   14534:           <p>There is a make target that helps in creating proper
1.45      wiz      14535:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   14536:           class="filename">CHANGES</code> entries:
1.41      wiz      14537:           <span><strong class="command">make
                   14538:           changes-entry</strong></span>. It uses the optional
                   14539:           <code class="varname">CTYPE</code> and <code class=
                   14540:           "varname">NETBSD_LOGIN_NAME</code> variables. The general
1.45      wiz      14541:           usage is to first make sure that your <code xmlns=
                   14542:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      14543:           "filename">CHANGES</code> file is up-to-date (to avoid
                   14544:           having to resolve conflicts later-on) and then to
                   14545:           <span><strong class="command">cd</strong></span> to the
                   14546:           package directory. For package updates,
                   14547:           <span><strong class="command">make
                   14548:           changes-entry</strong></span> is enough. For new
                   14549:           packages, or package moves or removals, set the
                   14550:           <code class="varname">CTYPE</code> variable on the
                   14551:           command line to "Added", "Moved", or "Removed". You can
                   14552:           set <code class="varname">NETBSD_LOGIN_NAME</code> in
1.45      wiz      14553:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   14554:           class="filename">/etc/mk.conf</code> if your local login
                   14555:           name is not the same as your NetBSD login name. Don't
                   14556:           forget to commit the changes to <code xmlns=
                   14557:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      14558:           "filename">pkgsrc/doc/CHANGES</code>!</p>
                   14559:         </div>
                   14560: 
1.67    ! hubertf  14561:         <div class="sect1" lang="en">
1.41      wiz      14562:           <div class="titlepage">
                   14563:             <div>
                   14564:               <div>
                   14565:                 <h2 class="title" style="clear: both"><a name=
                   14566:                 "committing-importing"></a>17.3.&nbsp;Committing:
1.30      wiz      14567:                 Importing a package into CVS</h2>
1.1       grant    14568:               </div>
                   14569:             </div>
                   14570:           </div>
                   14571: 
                   14572:           <p>This section is only of interest for pkgsrc developers
                   14573:           with write access to the pkgsrc repository. Please
                   14574:           remember that cvs imports files relative to the current
                   14575:           working directory, and that the pathname that you give
1.14      xtraeme  14576:           the <span><strong class="command">cvs
                   14577:           import</strong></span> command is so that it knows where
                   14578:           to place the files in the repository. Newly created
                   14579:           packages should be imported with a vendor tag of
                   14580:           &#8220;<span class="quote">TNF</span>&#8221; and a
                   14581:           release tag of &#8220;<span class=
                   14582:           "quote">pkgsrc-base</span>&#8221;, e.g:</p>
1.1       grant    14583:           <pre class="programlisting">
1.51      rillig   14584:     <code class="prompt">$</code> cd .../pkgsrc/category/pkgname
                   14585:     <code class=
                   14586: "prompt">$</code> cvs import pkgsrc/category/pkgname TNF pkgsrc-base
1.1       grant    14587: </pre>
                   14588: 
                   14589:           <p>Remember to move the directory from which you imported
                   14590:           out of the way, or cvs will complain the next time you
                   14591:           &#8220;<span class="quote">cvs update</span>&#8221; your
                   14592:           source tree. Also don't forget to add the new package to
1.45      wiz      14593:           the category's <code xmlns=
                   14594:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14595:           "filename">Makefile</code>.</p>
1.1       grant    14596: 
                   14597:           <p>The commit message of the initial import should
1.45      wiz      14598:           include part of the <code xmlns=
                   14599:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   14600:           "filename">DESCR</code> file, so people reading the
                   14601:           mailing lists know what the package is/does.</p>
1.1       grant    14602: 
                   14603:           <p>For new packages, &#8220;<span class="quote">cvs
                   14604:           import</span>&#8221; is preferred to &#8220;<span class=
                   14605:           "quote">cvs add</span>&#8221; because the former gets
                   14606:           everything with a single command, and provides a
                   14607:           consistent tag.</p>
                   14608:         </div>
                   14609: 
1.67    ! hubertf  14610:         <div class="sect1" lang="en">
1.1       grant    14611:           <div class="titlepage">
                   14612:             <div>
                   14613:               <div>
                   14614:                 <h2 class="title" style="clear: both"><a name=
1.41      wiz      14615:                 "updating-package"></a>17.4.&nbsp;Updating a
1.30      wiz      14616:                 package to a newer version</h2>
1.1       grant    14617:               </div>
                   14618:             </div>
                   14619:           </div>
                   14620: 
                   14621:           <p>Please always put a concise, appropriate and relevant
                   14622:           summary of the changes between old and new versions into
                   14623:           the commit log when updating a package. There are various
                   14624:           reasons for this:</p>
                   14625: 
                   14626:           <div class="itemizedlist">
                   14627:             <ul type="disc">
                   14628:               <li>
                   14629:                 <p>A URL is volatile, and can change over time. It
                   14630:                 may go away completely or its information may be
                   14631:                 overwritten by newer information.</p>
                   14632:               </li>
                   14633: 
                   14634:               <li>
                   14635:                 <p>Having the change information between old and
                   14636:                 new versions in our CVS repository is very useful
                   14637:                 for people who use either cvs or anoncvs.</p>
                   14638:               </li>
                   14639: 
                   14640:               <li>
                   14641:                 <p>Having the change information between old and
                   14642:                 new versions in our CVS repository is very useful
                   14643:                 for people who read the pkgsrc-changes mailing
                   14644:                 list, so that they can make tactical decisions
                   14645:                 about when to upgrade the package.</p>
                   14646:               </li>
                   14647:             </ul>
                   14648:           </div>
                   14649: 
1.18      xtraeme  14650:           <p>Please also recognize that, just because a new version
1.1       grant    14651:           of a package has been released, it should not
                   14652:           automatically be upgraded in the CVS repository. We
                   14653:           prefer to be conservative in the packages that are
                   14654:           included in pkgsrc - development or beta packages are not
                   14655:           really the best thing for most places in which pkgsrc is
                   14656:           used. Please use your judgement about what should go into
                   14657:           pkgsrc, and bear in mind that stability is to be
                   14658:           preferred above new and possibly untested features.</p>
                   14659:         </div>
                   14660: 
1.67    ! hubertf  14661:         <div class="sect1" lang="en">
1.1       grant    14662:           <div class="titlepage">
                   14663:             <div>
                   14664:               <div>
                   14665:                 <h2 class="title" style="clear: both"><a name=
1.41      wiz      14666:                 "moving-package"></a>17.5.&nbsp;Moving a package in
1.30      wiz      14667:                 pkgsrc</h2>
1.1       grant    14668:               </div>
                   14669:             </div>
                   14670:           </div>
                   14671: 
                   14672:           <div class="orderedlist">
                   14673:             <ol type="1">
                   14674:               <li>
                   14675:                 <p>Make a copy of the directory somewhere else.</p>
                   14676:               </li>
                   14677: 
                   14678:               <li>
                   14679:                 <p>Remove all CVS dirs.</p>
                   14680: 
                   14681:                 <p>Alternatively to the first two steps you can
                   14682:                 also do:</p>
                   14683:                 <pre class="screen">
1.14      xtraeme  14684: <code class="prompt">%</code> <strong class=
                   14685: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1       grant    14686: </pre>
                   14687: 
                   14688:                 <p>and use that for further work.</p>
                   14689:               </li>
                   14690: 
                   14691:               <li>
1.14      xtraeme  14692:                 <p>Fix <code class="varname">CATEGORIES</code> and
                   14693:                 any <code class="varname">DEPENDS</code> paths that
                   14694:                 just did &#8220;<span class=
1.1       grant    14695:                 "quote">../package</span>&#8221; instead of
                   14696:                 &#8220;<span class=
                   14697:                 "quote">../../category/package</span>&#8221;.</p>
                   14698:               </li>
                   14699: 
                   14700:               <li>
1.14      xtraeme  14701:                 <p><span><strong class="command">cvs
                   14702:                 import</strong></span> the modified package in the
                   14703:                 new place.</p>
1.1       grant    14704:               </li>
                   14705: 
                   14706:               <li>
                   14707:                 <p>Check if any package depends on it:</p>
                   14708:                 <pre class="screen">
1.14      xtraeme  14709: <code class="prompt">%</code> <strong class=
                   14710: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   14711: <code class="prompt">%</code> <strong class=
                   14712: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1       grant    14713: </pre>
                   14714:               </li>
                   14715: 
                   14716:               <li>
                   14717:                 <p>Fix paths in packages from step 5 to point to
                   14718:                 new location.</p>
                   14719:               </li>
                   14720: 
                   14721:               <li>
1.14      xtraeme  14722:                 <p><span><strong class="command">cvs rm
                   14723:                 (-f)</strong></span> the package at the old
                   14724:                 location.</p>
1.1       grant    14725:               </li>
                   14726: 
                   14727:               <li>
1.45      wiz      14728:                 <p>Remove from <code xmlns=
                   14729:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14730:                 "filename">oldcategory/Makefile</code>.</p>
1.1       grant    14731:               </li>
                   14732: 
                   14733:               <li>
1.45      wiz      14734:                 <p>Add to <code xmlns=
                   14735:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14736:                 "filename">newcategory/Makefile</code>.</p>
1.1       grant    14737:               </li>
                   14738: 
                   14739:               <li>
                   14740:                 <p>Commit the changed and removed files:</p>
                   14741:                 <pre class="screen">
1.14      xtraeme  14742: <code class="prompt">%</code> <strong class=
                   14743: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1       grant    14744: </pre>
                   14745: 
                   14746:                 <p>(and any packages from step 5, of course).</p>
                   14747:               </li>
                   14748:             </ol>
                   14749:           </div>
                   14750:         </div>
                   14751:       </div>
                   14752:     </div>
                   14753: 
1.67    ! hubertf  14754:     <div class="appendix" lang="en">
1.1       grant    14755:       <div class="titlepage">
                   14756:         <div>
                   14757:           <div>
1.67    ! hubertf  14758:             <h2 class="title"><a name=
1.46      gdt      14759:             "examples"></a>Appendix&nbsp;A.&nbsp;A simple example
1.1       grant    14760:             package: bison</h2>
                   14761:           </div>
                   14762:         </div>
                   14763:       </div>
                   14764: 
                   14765:       <div class="toc">
                   14766:         <p><b>Table of Contents</b></p>
                   14767: 
                   14768:         <dl>
1.46      gdt      14769:           <dt><span class="sect1"><a href="#example-files">A.1.
1.1       grant    14770:           files</a></span></dt>
                   14771: 
                   14772:           <dd>
                   14773:             <dl>
1.30      wiz      14774:               <dt><span class="sect2"><a href=
1.46      gdt      14775:               "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1       grant    14776: 
1.30      wiz      14777:               <dt><span class="sect2"><a href=
1.46      gdt      14778:               "#example-descr">A.1.2. DESCR</a></span></dt>
1.1       grant    14779: 
1.30      wiz      14780:               <dt><span class="sect2"><a href=
1.46      gdt      14781:               "#example-plist">A.1.3. PLIST</a></span></dt>
1.1       grant    14782: 
1.30      wiz      14783:               <dt><span class="sect2"><a href=
1.46      gdt      14784:               "#checking-package-with-pkglint">A.1.4. Checking a
1.30      wiz      14785:               package with <span><strong class=
1.14      xtraeme  14786:               "command">pkglint</strong></span></a></span></dt>
1.1       grant    14787:             </dl>
                   14788:           </dd>
                   14789: 
1.46      gdt      14790:           <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30      wiz      14791:           Steps for building, installing, packaging</a></span></dt>
1.1       grant    14792:         </dl>
                   14793:       </div>
                   14794: 
                   14795:       <p>We checked to find a piece of software that wasn't in the
                   14796:       packages collection, and picked GNU bison. Quite why someone
1.14      xtraeme  14797:       would want to have <span><strong class=
                   14798:       "command">bison</strong></span> when Berkeley
                   14799:       <span><strong class="command">yacc</strong></span> is already
                   14800:       present in the tree is beyond us, but it's useful for the
                   14801:       purposes of this exercise.</p>
1.1       grant    14802: 
1.67    ! hubertf  14803:       <div class="sect1" lang="en">
1.1       grant    14804:         <div class="titlepage">
                   14805:           <div>
                   14806:             <div>
                   14807:               <h2 class="title" style="clear: both"><a name=
1.46      gdt      14808:               "example-files"></a>A.1.&nbsp;files</h2>
1.1       grant    14809:             </div>
                   14810:           </div>
                   14811:         </div>
                   14812: 
1.67    ! hubertf  14813:         <div class="sect2" lang="en">
1.1       grant    14814:           <div class="titlepage">
                   14815:             <div>
                   14816:               <div>
1.67    ! hubertf  14817:                 <h3 class="title"><a name=
1.46      gdt      14818:                 "example-Makefile"></a>A.1.1.&nbsp;Makefile</h3>
1.1       grant    14819:               </div>
                   14820:             </div>
                   14821:           </div>
                   14822:           <pre class="programlisting">
1.51      rillig   14823:     # $NetBSD$
                   14824:     #
1.1       grant    14825: 
1.51      rillig   14826:     DISTNAME=       bison-1.25
                   14827:     CATEGORIES=     devel
                   14828:     MASTER_SITES=   ${MASTER_SITE_GNU}
1.1       grant    14829: 
1.51      rillig   14830:     MAINTAINER=     thorpej@NetBSD.org
                   14831:     HOMEPAGE=       http://www.gnu.org/software/bison/bison.html
                   14832:     COMMENT=        GNU yacc clone
1.1       grant    14833: 
1.51      rillig   14834:     GNU_CONFIGURE=  yes
                   14835:     INFO_FILES=     bison.info
1.1       grant    14836: 
1.51      rillig   14837:     .include "../../mk/bsd.pkg.mk"
1.1       grant    14838: </pre>
                   14839:         </div>
                   14840: 
1.67    ! hubertf  14841:         <div class="sect2" lang="en">
1.1       grant    14842:           <div class="titlepage">
                   14843:             <div>
                   14844:               <div>
1.67    ! hubertf  14845:                 <h3 class="title"><a name=
1.46      gdt      14846:                 "example-descr"></a>A.1.2.&nbsp;DESCR</h3>
1.1       grant    14847:               </div>
                   14848:             </div>
                   14849:           </div>
                   14850:           <pre class="programlisting">
1.51      rillig   14851:     GNU version of yacc.  Can make re-entrant parsers, and numerous other
                   14852:     improvements.  Why you would want this when Berkeley <a href=
1.1       grant    14853: "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   14854:     of the NetBSD source tree is beyond me.
1.1       grant    14855: </pre>
                   14856:         </div>
                   14857: 
1.67    ! hubertf  14858:         <div class="sect2" lang="en">
1.1       grant    14859:           <div class="titlepage">
                   14860:             <div>
                   14861:               <div>
1.67    ! hubertf  14862:                 <h3 class="title"><a name=
1.46      gdt      14863:                 "example-plist"></a>A.1.3.&nbsp;PLIST</h3>
1.1       grant    14864:               </div>
                   14865:             </div>
                   14866:           </div>
                   14867:           <pre class="programlisting">
1.51      rillig   14868:     @comment $NetBSD$
                   14869:     bin/bison
                   14870:     man/man1/bison.1.gz
                   14871:     share/bison.simple
                   14872:     share/bison.hairy
1.1       grant    14873: </pre>
                   14874:         </div>
                   14875: 
1.67    ! hubertf  14876:         <div class="sect2" lang="en">
1.1       grant    14877:           <div class="titlepage">
                   14878:             <div>
                   14879:               <div>
1.30      wiz      14880:                 <h3 class="title"><a name=
1.46      gdt      14881:                 "checking-package-with-pkglint"></a>A.1.4.&nbsp;Checking
1.30      wiz      14882:                 a package with <span><strong class=
1.14      xtraeme  14883:                 "command">pkglint</strong></span></h3>
1.1       grant    14884:               </div>
                   14885:             </div>
                   14886:           </div>
                   14887: 
                   14888:           <p>The NetBSD package system comes with <a xmlns=
                   14889:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   14890:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45      wiz      14891:           target="_top"><code xmlns="" class=
                   14892:           "filename">pkgtools/pkglint</code></a> which helps to
                   14893:           check the contents of these files. After installation it
                   14894:           is quite easy to use, just change to the directory of the
1.20      ben      14895:           package you wish to examine and execute
                   14896:           <span><strong class=
                   14897:           "command">pkglint</strong></span>:</p>
1.1       grant    14898:           <pre class="screen">
1.14      xtraeme  14899: <code class="prompt">$</code> <strong class=
                   14900: "userinput"><code>pkglint</code></strong>
1.1       grant    14901: looks fine.
                   14902: </pre>
                   14903: 
                   14904:           <p>Depending on the supplied command line arguments (see
1.60      rillig   14905:           pkglint(1)), more checks will be performed. Use e.g.
                   14906:           <span><strong class="command">pkglint -Call
                   14907:           -Wall</strong></span> for a very thorough check.</p>
1.1       grant    14908:         </div>
                   14909:       </div>
                   14910: 
1.67    ! hubertf  14911:       <div class="sect1" lang="en">
1.1       grant    14912:         <div class="titlepage">
                   14913:           <div>
                   14914:             <div>
                   14915:               <h2 class="title" style="clear: both"><a name=
1.46      gdt      14916:               "steps-for-b-i-p"></a>A.2.&nbsp;Steps for building,
1.30      wiz      14917:               installing, packaging</h2>
1.1       grant    14918:             </div>
                   14919:           </div>
                   14920:         </div>
                   14921: 
                   14922:         <p>Create the directory where the package lives, plus any
                   14923:         auxiliary directories:</p>
                   14924:         <pre class="screen">
1.14      xtraeme  14925: <code class="prompt">#</code> <strong class=
                   14926: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
                   14927: <code class="prompt">#</code> <strong class=
                   14928: "userinput"><code>mkdir bison</code></strong>
                   14929: <code class="prompt">#</code> <strong class=
                   14930: "userinput"><code>cd bison</code></strong>
                   14931: <code class="prompt">#</code> <strong class=
                   14932: "userinput"><code>mkdir patches</code></strong>
1.1       grant    14933: </pre>
                   14934: 
1.45      wiz      14935:         <p>Create <code xmlns=
                   14936:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   14937:         "filename">Makefile</code>, <code xmlns=
                   14938:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   14939:         "filename">DESCR</code> and <code xmlns=
                   14940:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14941:         "filename">PLIST</code> (see <a href="#components" title=
1.38      dillo    14942:         "Chapter&nbsp;8.&nbsp;Package components - files, directories and contents">
1.67    ! hubertf  14943:         Chapter&nbsp;8, <i>Package components - files, directories
        !          14944:         and contents</i></a>) then continue with fetching the
1.1       grant    14945:         distfile:</p>
                   14946:         <pre class="screen">
1.14      xtraeme  14947: <code class="prompt">#</code> <strong class=
                   14948: "userinput"><code>make fetch</code></strong>
1.1       grant    14949: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   14950: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   14951: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   14952: ftp: Error retrieving file: 500 Internal error
                   14953: 
                   14954: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   14955: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   14956: ftp: Error retrieving file: 500 Internal error
                   14957: 
                   14958: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   14959: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   14960: Successfully retrieved file.
                   14961: </pre>
                   14962: 
1.45      wiz      14963:         <p>Generate the checksum of the distfile into <code xmlns=
                   14964:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14965:         "filename">distinfo</code>:</p>
1.1       grant    14966:         <pre class="screen">
1.14      xtraeme  14967: <code class="prompt">#</code> <strong class=
                   14968: "userinput"><code>make makesum</code></strong>
1.1       grant    14969: </pre>
                   14970: 
                   14971:         <p>Now compile:</p>
                   14972:         <pre class="screen">
1.14      xtraeme  14973: <code class="prompt">#</code> <strong class=
                   14974: "userinput"><code>make</code></strong>
1.1       grant    14975: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   14976: ===&gt;  Extracting for bison-1.25
                   14977: ===&gt;  Patching for bison-1.25
                   14978: ===&gt;   Ignoring empty patch directory
                   14979: ===&gt;  Configuring for bison-1.25
                   14980: creating cache ./config.cache
                   14981: checking for gcc... cc
                   14982: checking whether we are using GNU C... yes
                   14983: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   14984: checking how to run the C preprocessor... cc -E
                   14985: checking for minix/config.h... no
                   14986: checking for POSIXized ISC... no
                   14987: checking whether cross-compiling... no
                   14988: checking for ANSI C header files... yes
                   14989: checking for string.h... yes
                   14990: checking for stdlib.h... yes
                   14991: checking for memory.h... yes
                   14992: checking for working const... yes
                   14993: checking for working alloca.h... no
                   14994: checking for alloca... yes
                   14995: checking for strerror... yes
                   14996: updating cache ./config.cache
                   14997: creating ./config.status
                   14998: creating Makefile
                   14999: ===&gt;  Building for bison-1.25
                   15000: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g LR0.c
                   15001: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g allocate.c
                   15002: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g closure.c
                   15003: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g conflicts.c
                   15004: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g derives.c
                   15005: 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 
                   15006: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g getargs.c
                   15007: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g gram.c
                   15008: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g lalr.c
                   15009: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g lex.c
                   15010: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g main.c
                   15011: 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
                   15012: 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
                   15013: 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
                   15014: 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
                   15015: 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
                   15016: 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
                   15017: 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
                   15018: 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
                   15019: 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
                   15020: 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
                   15021: 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
                   15022: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   15023: rm -f bison.s1
                   15024: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1
                   15025: </pre>
                   15026: 
                   15027:         <p>Everything seems OK, so install the files:</p>
                   15028:         <pre class="screen">
1.14      xtraeme  15029: <code class="prompt">#</code> <strong class=
                   15030: "userinput"><code>make install</code></strong>
1.1       grant    15031: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   15032: ===&gt;  Installing for bison-1.25
                   15033: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   15034: rm -f /usr/pkg/bin/bison
                   15035: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   15036: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   15037: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   15038: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   15039: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   15040: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   15041: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
                   15042: ===&gt;  Registering installation for bison-1.25
                   15043: </pre>
                   15044: 
                   15045:         <p>You can now use bison, and also - if you decide so -
1.14      xtraeme  15046:         remove it with <span><strong class="command">pkg_delete
                   15047:         bison</strong></span>. Should you decide that you want a
                   15048:         binary package, do this now:</p>
1.1       grant    15049:         <pre class="screen">
1.14      xtraeme  15050: <code class="prompt">#</code> <strong class=
                   15051: "userinput"><code>make package</code></strong>
1.1       grant    15052: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   15053: ===&gt;  Building package for bison-1.25
                   15054: Creating package bison-1.25.tgz
                   15055: Registering depends:.
                   15056: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
                   15057: </pre>
                   15058: 
                   15059:         <p>Now that you don't need the source and object files any
                   15060:         more, clean up:</p>
                   15061:         <pre class="screen">
1.14      xtraeme  15062: <code class="prompt">#</code> <strong class=
                   15063: "userinput"><code>make clean</code></strong>
1.1       grant    15064: ===&gt;  Cleaning for bison-1.25
                   15065: </pre>
                   15066:       </div>
                   15067:     </div>
                   15068: 
1.67    ! hubertf  15069:     <div class="appendix" lang="en">
1.1       grant    15070:       <div class="titlepage">
                   15071:         <div>
                   15072:           <div>
1.67    ! hubertf  15073:             <h2 class="title"><a name=
1.46      gdt      15074:             "logs"></a>Appendix&nbsp;B.&nbsp;Build logs</h2>
1.1       grant    15075:           </div>
                   15076:         </div>
                   15077:       </div>
                   15078: 
                   15079:       <div class="toc">
                   15080:         <p><b>Table of Contents</b></p>
                   15081: 
                   15082:         <dl>
1.46      gdt      15083:           <dt><span class="sect1"><a href="#logs.building">B.1.
1.1       grant    15084:           Building figlet</a></span></dt>
                   15085: 
1.46      gdt      15086:           <dt><span class="sect1"><a href="#logs.package">B.2.
1.1       grant    15087:           Packaging figlet</a></span></dt>
                   15088:         </dl>
                   15089:       </div>
                   15090: 
1.67    ! hubertf  15091:       <div class="sect1" lang="en">
1.1       grant    15092:         <div class="titlepage">
                   15093:           <div>
                   15094:             <div>
                   15095:               <h2 class="title" style="clear: both"><a name=
1.46      gdt      15096:               "logs.building"></a>B.1.&nbsp;Building figlet</h2>
1.1       grant    15097:             </div>
                   15098:           </div>
                   15099:         </div>
                   15100:         <pre class="screen">
1.14      xtraeme  15101: <code class="prompt">#</code> <strong class=
                   15102: "userinput"><code>make</code></strong>
1.1       grant    15103: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   15104: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   15105: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   15106: =&gt; [172219 bytes]
                   15107: Connected to ftp.plig.net.
                   15108: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   15109: 331 Guest login ok, send your complete e-mail address as password.
                   15110: 230-You are user #5 of 500 simultaneous users allowed.
                   15111: 230-
                   15112: 230-  ___ _             _ _                   
                   15113: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___ 
                   15114: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   15115: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   15116: 230-         |_|   |_|     |___|         |___|
                   15117: 230-
                   15118: 230-** Welcome to ftp.plig.org **
                   15119: 230-
                   15120: 230-Please note that all transfers from this FTP site are logged. If you
                   15121: 230-do not like this, please disconnect now.
                   15122: 230-
                   15123: 230-This arhive is available via
                   15124: 230-
                   15125: 230-HTTP:  http://ftp.plig.org/
                   15126: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   15127: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   15128: 230-
                   15129: 230-Please email comments, bug reports and requests for packages to be
                   15130: 230-mirrored to ftp-admin@plig.org.   
                   15131: 230-
                   15132: 230-
                   15133: 230 Logged in anonymously.
                   15134: Remote system type is UNIX.
                   15135: Using binary mode to transfer files.
                   15136: 200 Type okay.
                   15137: 250 "/pub" is new cwd.
                   15138: 250-"/pub/figlet" is new cwd.
                   15139: 250-
                   15140: 250-Welcome to the figlet archive at ftp.figlet.org
                   15141: 250-    
                   15142: 250-    ftp://ftp.figlet.org/pub/figlet/
                   15143: 250-
                   15144: 250-The official FIGlet web page is:
                   15145: 250-    http://www.figlet.org/
                   15146: 250-
                   15147: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   15148: 250-contribute a font or something else, you can email us.
                   15149: 250 
                   15150: 250 "/pub/figlet/program" is new cwd.
                   15151: 250 "/pub/figlet/program/unix" is new cwd.
                   15152: local: figlet221.tar.gz remote: figlet221.tar.gz
                   15153: 502 Unimplemented command.
                   15154: 227 Entering Passive Mode (195,40,6,41,246,104)
                   15155: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   15156: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   15157: 226 Transfer completed.
                   15158: 172219 bytes received in 00:02 (75.99 KB/s)
                   15159: 221 Goodbye.
                   15160: =&gt; Checksum OK for figlet221.tar.gz.
                   15161: ===&gt; Extracting for figlet-2.2.1nb2
                   15162: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   15163: ===&gt; Patching for figlet-2.2.1nb2
                   15164: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   15165: ===&gt; Overriding tools for figlet-2.2.1nb2
                   15166: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   15167: ===&gt; Configuring for figlet-2.2.1nb2
                   15168: ===&gt; Building for figlet-2.2.1nb2
                   15169: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   15170: chmod a+x figlet
                   15171: gcc -O2 -o chkfont chkfont.c
                   15172: =&gt; Unwrapping files-to-be-installed.
1.14      xtraeme  15173: <code class="prompt">#</code>
                   15174: <code class="prompt">#</code> <strong class=
                   15175: "userinput"><code>make install</code></strong>
1.1       grant    15176: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   15177: ===&gt; Installing for figlet-2.2.1nb2
                   15178: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   15179: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   15180: mkdir -p /usr/pkg/share/figlet
                   15181: cp figlet /usr/pkg/bin
                   15182: cp chkfont /usr/pkg/bin
                   15183: chmod 555 figlist showfigfonts
                   15184: cp figlist /usr/pkg/bin
                   15185: cp showfigfonts /usr/pkg/bin
                   15186: cp fonts/*.flf /usr/pkg/share/figlet
                   15187: cp fonts/*.flc /usr/pkg/share/figlet
                   15188: cp figlet.6 /usr/pkg/man/man6
                   15189: ===&gt; Registering installation for figlet-2.2.1nb2
1.14      xtraeme  15190: <code class="prompt">#</code>
1.1       grant    15191: </pre>
                   15192:       </div>
                   15193: 
1.67    ! hubertf  15194:       <div class="sect1" lang="en">
1.1       grant    15195:         <div class="titlepage">
                   15196:           <div>
                   15197:             <div>
                   15198:               <h2 class="title" style="clear: both"><a name=
1.46      gdt      15199:               "logs.package"></a>B.2.&nbsp;Packaging figlet</h2>
1.1       grant    15200:             </div>
                   15201:           </div>
                   15202:         </div>
                   15203:         <pre class="screen">
1.14      xtraeme  15204: <code class="prompt">#</code> <strong class=
                   15205: "userinput"><code>make package</code></strong>
1.1       grant    15206: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   15207: ===&gt; Packaging figlet-2.2.1nb2
                   15208: ===&gt; Building binary package for figlet-2.2.1nb2
                   15209: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   15210: Using SrcDir value of /usr/pkg
                   15211: Registering depends:.  
1.14      xtraeme  15212: <code class="prompt">#</code>
1.1       grant    15213: </pre>
                   15214:       </div>
                   15215:     </div>
                   15216: 
1.67    ! hubertf  15217:     <div class="appendix" lang="en">
1.1       grant    15218:       <div class="titlepage">
                   15219:         <div>
                   15220:           <div>
1.67    ! hubertf  15221:             <h2 class="title"><a name=
1.46      gdt      15222:             "ftp-layout"></a>Appendix&nbsp;C.&nbsp;Layout of the
1.1       grant    15223:             FTP server's package archive</h2>
                   15224:           </div>
                   15225:         </div>
                   15226:       </div>
                   15227: 
                   15228:       <p>Layout for precompiled binary packages on
                   15229:       ftp.NetBSD.org:</p>
                   15230:       <pre class="programlisting">
1.51      rillig   15231:     /pub/NetBSD/packages/
                   15232:         distfiles/
1.1       grant    15233: 
1.51      rillig   15234:         # Unpacked pkgsrc trees
                   15235:         pkgsrc-current -&gt; /pub/NetBSD/NetBSD-current/pkgsrc
                   15236:         pkgsrc-2003Q4 -&gt; N/A
                   15237:         pkgsrc-2004Q1/pkgsrc
                   15238: 
                   15239:         # pkgsrc archives
                   15240:         pkgsrc-current.tar.gz -&gt; ../NetBSD-current/tar_files/pkgsrc.tar.gz
                   15241:         pkgsrc-2003Q4.tar.gz -&gt; N/A
                   15242:         pkgsrc-2004Q1.tar.gz -&gt; N/A
                   15243: 
                   15244:         # Per pkgsrc-release/OS-release/arch package archives
                   15245:         pkgsrc-2003Q4/
                   15246:             NetBSD-1.6.2/
                   15247:                 i386/
                   15248:                     All/
                   15249:                     archivers/
                   15250:                         foo -&gt; ../All/foo
                   15251:                     ...
                   15252:         pkgsrc-2004Q1/
                   15253:             NetBSD-1.6.2/
                   15254:                 i386/
                   15255:                     All/
                   15256:                     ...
                   15257:             NetBSD-2.0/
                   15258:                 i386/
                   15259:                     All/
                   15260:                     ...
                   15261:             SunOS-5.9/
                   15262:                 sparc/
                   15263:                     All/
                   15264:                     ...
                   15265:                 x86/
                   15266:                     All/
                   15267:                     ...
                   15268: 
                   15269:         # Per os-release package archive convenience links
                   15270:         NetBSD-1.6.2 -&gt; 1.6.2
                   15271:         1.6.2/
                   15272:             i386 -&gt; ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
                   15273:             m68k/
                   15274:                 All/
                   15275:                 archivers/
                   15276:                     foo -&gt; ../All/foo
                   15277:                 ...
                   15278:             amiga -&gt; m68k
                   15279:             atari -&gt; m68k
                   15280:             ...
                   15281: 
                   15282:         2.0 -&gt; NetBSD-2.0       # backward compat, historic
                   15283:         NetBSD-2.0/
                   15284:             i386 -&gt; ../pkgsrc-2004Q1/NetBSD-2.0/i386
                   15285:         SunOS-5.9/
                   15286:             sparc -&gt; ../pkgsrc-2004Q1/SunOS-5.9/sparc
                   15287:             x86 -&gt; ../pkgsrc-2004Q1/SunOS-5.9/x86
1.1       grant    15288: </pre>
                   15289: 
                   15290:       <p>To create:</p>
                   15291: 
                   15292:       <div class="orderedlist">
                   15293:         <ol type="1">
                   15294:           <li>
                   15295:             <p>Run bulk build, see <a href="#bulkbuild" title=
1.67    ! hubertf  15296:             "6.3.&nbsp;Doing a bulk build of all packages">Section&nbsp;6.3,
        !          15297:             &#8220;Doing a bulk build of all
1.1       grant    15298:             packages&#8221;</a></p>
                   15299:           </li>
                   15300: 
                   15301:           <li>
                   15302:             <p>Upload /usr/pkgsrc/packages to</p>
                   15303:             <pre class="programlisting">
                   15304:     ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.51      rillig   15305:         pkgsrc-2004Q4/\             # pkgsrc-branch
                   15306:         `uname -s`-`uname -r`/\     # OS &amp; version
                   15307:         `uname -p`                  # architecture
1.1       grant    15308: </pre>
                   15309:           </li>
                   15310: 
                   15311:           <li>
1.14      xtraeme  15312:             <p>If necessary, create a symlink <span><strong class=
                   15313:             "command">ln -s `uname -m` `uname -p`</strong></span>
                   15314:             (amiga -&gt; m68k, ...)</p>
1.1       grant    15315:           </li>
                   15316:         </ol>
                   15317:       </div>
                   15318:     </div>
1.2       hubertf  15319: 
1.67    ! hubertf  15320:     <div class="appendix" lang="en">
1.2       hubertf  15321:       <div class="titlepage">
                   15322:         <div>
                   15323:           <div>
1.67    ! hubertf  15324:             <h2 class="title"><a name=
1.46      gdt      15325:             "editing"></a>Appendix&nbsp;D.&nbsp;Editing guidelines
1.2       hubertf  15326:             for the pkgsrc guide</h2>
                   15327:           </div>
                   15328:         </div>
                   15329:       </div>
                   15330: 
                   15331:       <div class="toc">
                   15332:         <p><b>Table of Contents</b></p>
                   15333: 
                   15334:         <dl>
1.46      gdt      15335:           <dt><span class="sect1"><a href="#targets">D.1.
1.2       hubertf  15336:           Targets</a></span></dt>
                   15337: 
1.46      gdt      15338:           <dt><span class="sect1"><a href="#procedure">D.2.
1.2       hubertf  15339:           Procedure</a></span></dt>
                   15340:         </dl>
                   15341:       </div>
                   15342: 
                   15343:       <p>This section contains information on editing the pkgsrc
                   15344:       guide itself.</p>
                   15345: 
1.67    ! hubertf  15346:       <div class="sect1" lang="en">
1.2       hubertf  15347:         <div class="titlepage">
                   15348:           <div>
                   15349:             <div>
                   15350:               <h2 class="title" style="clear: both"><a name=
1.67    ! hubertf  15351:               "targets"></a>D.1.&nbsp;Targets</h2>
1.2       hubertf  15352:             </div>
                   15353:           </div>
                   15354:         </div>
                   15355: 
1.45      wiz      15356:         <p>The pkgsrc guide's source code is stored in <code xmlns=
                   15357:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15358:         "filename">pkgsrc/doc/guide/files</code>, and several files
1.2       hubertf  15359:         are created from it:</p>
                   15360: 
                   15361:         <div class="itemizedlist">
                   15362:           <ul type="disc">
                   15363:             <li>
1.45      wiz      15364:               <p><code xmlns=
                   15365:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.23      wiz      15366:               "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2       hubertf  15367:             </li>
                   15368: 
                   15369:             <li>
1.45      wiz      15370:               <p><code xmlns=
                   15371:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15372:               "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2       hubertf  15373:             </li>
                   15374: 
                   15375:             <li>
1.45      wiz      15376:               <p><code xmlns=
                   15377:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15378:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2       hubertf  15379:               the documentation on the NetBSD website will be built
                   15380:               from pkgsrc and kept up to date on the web server
                   15381:               itself. This means you <span class=
                   15382:               "emphasis"><em>must</em></span> make sure that your
                   15383:               changes haven't broken the build!</p>
                   15384:             </li>
1.6       hubertf  15385: 
                   15386:             <li>
1.45      wiz      15387:               <p><code xmlns=
                   15388:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15389:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6       hubertf  15390:               PDF version of the pkgsrc guide.</p>
                   15391:             </li>
                   15392: 
                   15393:             <li>
1.45      wiz      15394:               <p><code xmlns=
                   15395:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15396:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6       hubertf  15397:               PostScript version of the pkgsrc guide.</p>
                   15398:             </li>
1.2       hubertf  15399:           </ul>
                   15400:         </div>
                   15401:       </div>
                   15402: 
1.67    ! hubertf  15403:       <div class="sect1" lang="en">
1.2       hubertf  15404:         <div class="titlepage">
                   15405:           <div>
                   15406:             <div>
                   15407:               <h2 class="title" style="clear: both"><a name=
1.46      gdt      15408:               "procedure"></a>D.2.&nbsp;Procedure</h2>
1.2       hubertf  15409:             </div>
                   15410:           </div>
                   15411:         </div>
                   15412: 
                   15413:         <p>The procedure to edit the pkgsrc guide is:</p>
                   15414: 
                   15415:         <div class="itemizedlist">
                   15416:           <ul type="disc">
                   15417:             <li>
1.6       hubertf  15418:               <p>Make sure you have the packages needed to
                   15419:               re-generate the pkgsrc guide (and other XML-based
                   15420:               NetBSD documentation) installed. These are
1.11      ben      15421:               &#8220;<span class="quote">netbsd-doc</span>&#8221;
1.47      reed     15422:               for creating the ASCII and HTML versions, and
1.6       hubertf  15423:               &#8220;<span class=
1.47      reed     15424:               "quote">netbsd-doc-print</span>&#8221; for the
                   15425:               PostScript and PDF versions. You will need both
1.6       hubertf  15426:               packages installed, to make sure documentation is
                   15427:               consistent across all formats. The packages can be
1.45      wiz      15428:               found in <code xmlns=
                   15429:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15430:               "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
1.45      wiz      15431:               <code xmlns=
                   15432:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15433:               "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6       hubertf  15434:             </li>
                   15435: 
                   15436:             <li>
1.45      wiz      15437:               <p>Edit the XML file(s) in <code xmlns=
                   15438:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15439:               "filename">pkgsrc/doc/guide/files</code>.</p>
1.2       hubertf  15440:             </li>
                   15441: 
                   15442:             <li>
1.14      xtraeme  15443:               <p>Run <span><strong class="command">make extract
                   15444:               &amp;&amp; make do-lint</strong></span> in
1.45      wiz      15445:               <code xmlns=
                   15446:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   15447:               "filename">pkgsrc/doc/guide</code> to check the XML
                   15448:               syntax, and fix it if needed.</p>
1.4       hubertf  15449:             </li>
                   15450: 
                   15451:             <li>
1.14      xtraeme  15452:               <p>Run <span><strong class=
1.45      wiz      15453:               "command">make</strong></span> in <code xmlns=
                   15454:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15455:               "filename">pkgsrc/doc/guide</code> to build the HTML
                   15456:               and ASCII version.</p>
1.2       hubertf  15457:             </li>
                   15458: 
                   15459:             <li>
1.14      xtraeme  15460:               <p>If all is well, run <span><strong class=
                   15461:               "command">make install-doc</strong></span> to put the
1.45      wiz      15462:               generated files into <code xmlns=
                   15463:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15464:               "filename">pkgsrc/doc</code>.</p>
1.2       hubertf  15465:             </li>
                   15466: 
                   15467:             <li>
1.14      xtraeme  15468:               <p><span><strong class="command">cvs commit
                   15469:               pkgsrc/doc/guide/files</strong></span></p>
1.2       hubertf  15470:             </li>
                   15471: 
                   15472:             <li>
1.14      xtraeme  15473:               <p><span><strong class="command">cvs commit -m
                   15474:               re-generate
                   15475:               pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2       hubertf  15476:             </li>
1.4       hubertf  15477: 
                   15478:             <li>
                   15479:               <p>Until the webserver on www.NetBSD.org is really
                   15480:               updated automatically to pick up changes to the
1.14      xtraeme  15481:               pkgsrc guide automatically, also run
1.18      xtraeme  15482:               <span><strong class="command">make install-htdocs
1.14      xtraeme  15483:               HTDOCSDIR=../../../htdocs</strong></span> (or
                   15484:               similar, adjust <code class=
                   15485:               "varname">HTDOCSDIR</code>!).</p>
1.4       hubertf  15486:             </li>
                   15487: 
                   15488:             <li>
1.14      xtraeme  15489:               <p><span><strong class="command">cvs commit
                   15490:               htdocs/Documentation/pkgsrc</strong></span></p>
1.4       hubertf  15491:             </li>
1.2       hubertf  15492:           </ul>
                   15493:         </div>
                   15494:       </div>
                   15495:     </div>
1.1       grant    15496:   </div>
                   15497: </body>
                   15498: </html>

CVSweb <webmaster@jp.NetBSD.org>