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

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.69    ! rillig     69:           <p xmlns="" class="pubdate">$NetBSD: pkgsrc.xml,v 1.12
        !            70:           2006/02/18 01:46:43 rillig 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.68      rillig    774:             <dt><span class="chapter"><a href="#tools">15. Tools
                    775:             needed for building or running</a></span></dt>
                    776: 
                    777:             <dd>
                    778:               <dl>
                    779:                 <dt><span class="sect1"><a href=
                    780:                 "#pkgsrc-tools">15.1. Tools for pkgsrc
                    781:                 builds</a></span></dt>
                    782: 
                    783:                 <dt><span class="sect1"><a href=
                    784:                 "#package-tools">15.2. Tools needed by
                    785:                 packages</a></span></dt>
                    786: 
                    787:                 <dt><span class="sect1"><a href=
                    788:                 "#platform-tools">15.3. Tools provided by
                    789:                 platforms</a></span></dt>
                    790:               </dl>
                    791:             </dd>
                    792: 
                    793:             <dt><span class="chapter"><a href="#fixes">16. Making
1.55      rillig    794:             your package work</a></span></dt>
1.1       grant     795: 
                    796:             <dd>
                    797:               <dl>
1.30      wiz       798:                 <dt><span class="sect1"><a href=
1.68      rillig    799:                 "#general-operation">16.1. General
1.30      wiz       800:                 operation</a></span></dt>
1.1       grant     801: 
                    802:                 <dd>
                    803:                   <dl>
                    804:                     <dt><span class="sect2"><a href=
1.68      rillig    805:                     "#pulling-vars-from-etc-mk.conf">16.1.1. How to
1.30      wiz       806:                     pull in variables from
                    807:                     /etc/mk.conf</a></span></dt>
1.1       grant     808: 
                    809:                     <dt><span class="sect2"><a href=
1.68      rillig    810:                     "#where-to-install-documentation">16.1.2. Where
1.31      wiz       811:                     to install documentation</a></span></dt>
                    812: 
                    813:                     <dt><span class="sect2"><a href=
1.68      rillig    814:                     "#restricted-packages">16.1.3. Restricted
1.1       grant     815:                     packages</a></span></dt>
                    816: 
                    817:                     <dt><span class="sect2"><a href=
1.68      rillig    818:                     "#dependencies">16.1.4. Handling
1.1       grant     819:                     dependencies</a></span></dt>
                    820: 
                    821:                     <dt><span class="sect2"><a href=
1.68      rillig    822:                     "#conflicts">16.1.5. Handling conflicts with
1.1       grant     823:                     other packages</a></span></dt>
                    824: 
                    825:                     <dt><span class="sect2"><a href=
1.68      rillig    826:                     "#not-building-packages">16.1.6. Packages that
1.30      wiz       827:                     cannot or should not be built</a></span></dt>
1.1       grant     828: 
                    829:                     <dt><span class="sect2"><a href=
1.68      rillig    830:                     "#undeletable-packages">16.1.7. Packages which
1.30      wiz       831:                     should not be deleted, once
                    832:                     installed</a></span></dt>
1.1       grant     833: 
                    834:                     <dt><span class="sect2"><a href=
1.68      rillig    835:                     "#security-handling">16.1.8. Handling packages
1.1       grant     836:                     with security problems</a></span></dt>
                    837: 
                    838:                     <dt><span class="sect2"><a href=
1.68      rillig    839:                     "#compiler-bugs">16.1.9. How to handle compiler
1.1       grant     840:                     bugs</a></span></dt>
                    841: 
                    842:                     <dt><span class="sect2"><a href=
1.68      rillig    843:                     "#bumping-pkgrevision">16.1.10. How to handle
1.30      wiz       844:                     incrementing versions when fixing an existing
1.1       grant     845:                     package</a></span></dt>
                    846: 
                    847:                     <dt><span class="sect2"><a href=
1.68      rillig    848:                     "#portability-of-packages">16.1.11. Portability
1.30      wiz       849:                     of packages</a></span></dt>
1.1       grant     850:                   </dl>
                    851:                 </dd>
                    852: 
1.30      wiz       853:                 <dt><span class="sect1"><a href=
1.68      rillig    854:                 "#downloading-issues">16.2. Possible downloading
1.30      wiz       855:                 issues</a></span></dt>
1.1       grant     856: 
                    857:                 <dd>
                    858:                   <dl>
                    859:                     <dt><span class="sect2"><a href=
1.68      rillig    860:                     "#no-plain-download">16.2.1. Packages whose
1.30      wiz       861:                     distfiles aren't available for plain
1.1       grant     862:                     downloading</a></span></dt>
                    863: 
                    864:                     <dt><span class="sect2"><a href=
1.68      rillig    865:                     "#modified-distfiles-same-name">16.2.2. How to
1.30      wiz       866:                     handle modified distfiles with the 'old'
                    867:                     name</a></span></dt>
1.1       grant     868:                   </dl>
                    869:                 </dd>
                    870: 
1.30      wiz       871:                 <dt><span class="sect1"><a href=
1.68      rillig    872:                 "#configuration-gotchas">16.3. Configuration
1.30      wiz       873:                 gotchas</a></span></dt>
1.1       grant     874: 
                    875:                 <dd>
                    876:                   <dl>
                    877:                     <dt><span class="sect2"><a href=
1.68      rillig    878:                     "#fixes.libtool">16.3.1. Shared libraries -
1.1       grant     879:                     libtool</a></span></dt>
                    880: 
                    881:                     <dt><span class="sect2"><a href=
1.68      rillig    882:                     "#using-libtool">16.3.2. Using libtool on GNU
1.1       grant     883:                     packages that already support
                    884:                     libtool</a></span></dt>
                    885: 
                    886:                     <dt><span class="sect2"><a href=
1.68      rillig    887:                     "#autoconf-automake">16.3.3. GNU
1.1       grant     888:                     Autoconf/Automake</a></span></dt>
                    889:                   </dl>
                    890:                 </dd>
                    891: 
1.30      wiz       892:                 <dt><span class="sect1"><a href=
1.68      rillig    893:                 "#fixes-build">16.4. Building the
1.55      rillig    894:                 package</a></span></dt>
1.1       grant     895: 
                    896:                 <dd>
                    897:                   <dl>
                    898:                     <dt><span class="sect2"><a href=
1.68      rillig    899:                     "#cpp-defines">16.4.1. CPP
1.1       grant     900:                     defines</a></span></dt>
1.51      rillig    901: 
                    902:                     <dt><span class="sect2"><a href=
1.68      rillig    903:                     "#cpp-list-examples">16.4.2. Examples of CPP
1.60      rillig    904:                     defines for some platforms</a></span></dt>
                    905: 
                    906:                     <dt><span class="sect2"><a href=
1.68      rillig    907:                     "#cpp-list">16.4.3. Getting a list of CPP
1.51      rillig    908:                     defines</a></span></dt>
1.1       grant     909:                   </dl>
                    910:                 </dd>
                    911: 
1.30      wiz       912:                 <dt><span class="sect1"><a href=
1.68      rillig    913:                 "#package-specific-actions">16.5. Package specific
1.30      wiz       914:                 actions</a></span></dt>
1.1       grant     915: 
                    916:                 <dd>
                    917:                   <dl>
                    918:                     <dt><span class="sect2"><a href=
1.68      rillig    919:                     "#user-interaction">16.5.1. User
1.2       hubertf   920:                     interaction</a></span></dt>
1.1       grant     921: 
                    922:                     <dt><span class="sect2"><a href=
1.68      rillig    923:                     "#handling-licenses">16.5.2. Handling
1.1       grant     924:                     licenses</a></span></dt>
                    925: 
                    926:                     <dt><span class="sect2"><a href=
1.68      rillig    927:                     "#installing-score-files">16.5.3. Installing
1.30      wiz       928:                     score files</a></span></dt>
1.1       grant     929: 
                    930:                     <dt><span class="sect2"><a href=
1.68      rillig    931:                     "#perl-scripts">16.5.4. Packages containing
1.30      wiz       932:                     perl scripts</a></span></dt>
1.1       grant     933: 
                    934:                     <dt><span class="sect2"><a href=
1.68      rillig    935:                     "#hardcoded-paths">16.5.5. Packages with
1.30      wiz       936:                     hardcoded paths to other
                    937:                     interpreters</a></span></dt>
1.1       grant     938: 
                    939:                     <dt><span class="sect2"><a href=
1.68      rillig    940:                     "#perl-modules">16.5.6. Packages installing
1.30      wiz       941:                     perl modules</a></span></dt>
1.1       grant     942: 
                    943:                     <dt><span class="sect2"><a href=
1.68      rillig    944:                     "#faq.info-files">16.5.7. Packages installing
1.1       grant     945:                     info files</a></span></dt>
                    946: 
                    947:                     <dt><span class="sect2"><a href=
1.68      rillig    948:                     "#manpages">16.5.8. Packages installing man
1.57      minskim   949:                     pages</a></span></dt>
                    950: 
                    951:                     <dt><span class="sect2"><a href=
1.68      rillig    952:                     "#gconf2-data-files">16.5.9. Packages
1.30      wiz       953:                     installing GConf2 data files</a></span></dt>
1.1       grant     954: 
                    955:                     <dt><span class="sect2"><a href=
1.68      rillig    956:                     "#scrollkeeper-data-files">16.5.10. Packages
1.30      wiz       957:                     installing scrollkeeper data
                    958:                     files</a></span></dt>
1.1       grant     959: 
                    960:                     <dt><span class="sect2"><a href=
1.68      rillig    961:                     "#x11-fonts">16.5.11. Packages installing X11
1.1       grant     962:                     fonts</a></span></dt>
                    963: 
                    964:                     <dt><span class="sect2"><a href=
1.68      rillig    965:                     "#gtk2-modules">16.5.12. Packages installing
1.30      wiz       966:                     GTK2 modules</a></span></dt>
1.1       grant     967: 
                    968:                     <dt><span class="sect2"><a href=
1.68      rillig    969:                     "#sgml-xml-data">16.5.13. Packages installing
1.30      wiz       970:                     SGML or XML data</a></span></dt>
1.1       grant     971: 
                    972:                     <dt><span class="sect2"><a href=
1.68      rillig    973:                     "#mime-database">16.5.14. Packages installing
1.1       grant     974:                     extensions to the MIME database</a></span></dt>
                    975: 
                    976:                     <dt><span class="sect2"><a href=
1.68      rillig    977:                     "#intltool">16.5.15. Packages using
1.1       grant     978:                     intltool</a></span></dt>
1.18      xtraeme   979: 
                    980:                     <dt><span class="sect2"><a href=
1.68      rillig    981:                     "#startup-scripts">16.5.16. Packages installing
1.18      xtraeme   982:                     startup scripts</a></span></dt>
1.57      minskim   983: 
                    984:                     <dt><span class="sect2"><a href=
1.68      rillig    985:                     "#tex-packages">16.5.17. Packages installing
1.57      minskim   986:                     TeX modules</a></span></dt>
1.1       grant     987:                   </dl>
                    988:                 </dd>
                    989: 
1.30      wiz       990:                 <dt><span class="sect1"><a href=
1.68      rillig    991:                 "#feedback-to-author">16.6. Feedback to the
1.30      wiz       992:                 author</a></span></dt>
1.1       grant     993:               </dl>
                    994:             </dd>
                    995: 
1.68      rillig    996:             <dt><span class="chapter"><a href="#debug">17.
1.1       grant     997:             Debugging</a></span></dt>
                    998: 
1.68      rillig    999:             <dt><span class="chapter"><a href="#submit">18.
1.1       grant    1000:             Submitting and Committing</a></span></dt>
                   1001: 
                   1002:             <dd>
                   1003:               <dl>
1.30      wiz      1004:                 <dt><span class="sect1"><a href=
1.68      rillig   1005:                 "#submitting-your-package">18.1. Submitting your
1.30      wiz      1006:                 packages</a></span></dt>
1.1       grant    1007: 
1.30      wiz      1008:                 <dt><span class="sect1"><a href=
1.68      rillig   1009:                 "#general-notes-for-changes">18.2. General notes
1.41      wiz      1010:                 when adding, updating, or removing
                   1011:                 packages</a></span></dt>
                   1012: 
                   1013:                 <dt><span class="sect1"><a href=
1.68      rillig   1014:                 "#committing-importing">18.3. Committing: Importing
1.30      wiz      1015:                 a package into CVS</a></span></dt>
1.1       grant    1016: 
1.30      wiz      1017:                 <dt><span class="sect1"><a href=
1.68      rillig   1018:                 "#updating-package">18.4. Updating a package to a
1.30      wiz      1019:                 newer version</a></span></dt>
1.1       grant    1020: 
1.30      wiz      1021:                 <dt><span class="sect1"><a href=
1.68      rillig   1022:                 "#moving-package">18.5. Moving a package in
1.30      wiz      1023:                 pkgsrc</a></span></dt>
1.1       grant    1024:               </dl>
                   1025:             </dd>
1.69    ! rillig   1026: 
        !          1027:             <dt><span class="chapter"><a href="#porting">19.
        !          1028:             Porting pkgsrc</a></span></dt>
        !          1029: 
        !          1030:             <dd>
        !          1031:               <dl>
        !          1032:                 <dt><span class="sect1"><a href=
        !          1033:                 "#porting.opsys">19.1. Porting pkgsrc to a new
        !          1034:                 operating system</a></span></dt>
        !          1035: 
        !          1036:                 <dt><span class="sect1"><a href=
        !          1037:                 "#porting.compiler">19.2. Adding support for a new
        !          1038:                 compiler</a></span></dt>
        !          1039:               </dl>
        !          1040:             </dd>
1.1       grant    1041:           </dl>
                   1042:         </dd>
                   1043: 
1.46      gdt      1044:         <dt><span class="appendix"><a href="#examples">A. A simple
1.1       grant    1045:         example package: bison</a></span></dt>
                   1046: 
                   1047:         <dd>
                   1048:           <dl>
1.46      gdt      1049:             <dt><span class="sect1"><a href="#example-files">A.1.
1.1       grant    1050:             files</a></span></dt>
                   1051: 
                   1052:             <dd>
                   1053:               <dl>
1.30      wiz      1054:                 <dt><span class="sect2"><a href=
1.46      gdt      1055:                 "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1       grant    1056: 
1.30      wiz      1057:                 <dt><span class="sect2"><a href=
1.46      gdt      1058:                 "#example-descr">A.1.2. DESCR</a></span></dt>
1.1       grant    1059: 
1.30      wiz      1060:                 <dt><span class="sect2"><a href=
1.46      gdt      1061:                 "#example-plist">A.1.3. PLIST</a></span></dt>
1.1       grant    1062: 
1.30      wiz      1063:                 <dt><span class="sect2"><a href=
1.46      gdt      1064:                 "#checking-package-with-pkglint">A.1.4. Checking a
1.30      wiz      1065:                 package with <span><strong class=
1.14      xtraeme  1066:                 "command">pkglint</strong></span></a></span></dt>
1.1       grant    1067:               </dl>
                   1068:             </dd>
                   1069: 
1.46      gdt      1070:             <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30      wiz      1071:             Steps for building, installing,
                   1072:             packaging</a></span></dt>
1.1       grant    1073:           </dl>
                   1074:         </dd>
                   1075: 
1.46      gdt      1076:         <dt><span class="appendix"><a href="#logs">B. Build
1.1       grant    1077:         logs</a></span></dt>
                   1078: 
                   1079:         <dd>
                   1080:           <dl>
1.46      gdt      1081:             <dt><span class="sect1"><a href="#logs.building">B.1.
1.1       grant    1082:             Building figlet</a></span></dt>
                   1083: 
1.46      gdt      1084:             <dt><span class="sect1"><a href="#logs.package">B.2.
1.1       grant    1085:             Packaging figlet</a></span></dt>
                   1086:           </dl>
                   1087:         </dd>
                   1088: 
1.46      gdt      1089:         <dt><span class="appendix"><a href="#ftp-layout">C. Layout
1.1       grant    1090:         of the FTP server's package archive</a></span></dt>
1.2       hubertf  1091: 
1.46      gdt      1092:         <dt><span class="appendix"><a href="#editing">D. Editing
1.2       hubertf  1093:         guidelines for the pkgsrc guide</a></span></dt>
                   1094: 
                   1095:         <dd>
                   1096:           <dl>
1.46      gdt      1097:             <dt><span class="sect1"><a href="#targets">D.1.
1.2       hubertf  1098:             Targets</a></span></dt>
                   1099: 
1.46      gdt      1100:             <dt><span class="sect1"><a href="#procedure">D.2.
1.2       hubertf  1101:             Procedure</a></span></dt>
                   1102:           </dl>
                   1103:         </dd>
1.1       grant    1104:       </dl>
                   1105:     </div>
                   1106: 
1.67      hubertf  1107:     <div class="chapter" lang="en">
1.1       grant    1108:       <div class="titlepage">
                   1109:         <div>
                   1110:           <div>
1.67      hubertf  1111:             <h2 class="title"><a name=
1.51      rillig   1112:             "introduction"></a>Chapter&nbsp;1.&nbsp;What is
                   1113:             pkgsrc?</h2>
1.1       grant    1114:           </div>
                   1115:         </div>
                   1116:       </div>
                   1117: 
                   1118:       <div class="toc">
                   1119:         <p><b>Table of Contents</b></p>
                   1120: 
                   1121:         <dl>
1.30      wiz      1122:           <dt><span class="sect1"><a href=
                   1123:           "#introduction-section">1.1. Introduction</a></span></dt>
1.1       grant    1124: 
                   1125:           <dt><span class="sect1"><a href="#overview">1.2.
                   1126:           Overview</a></span></dt>
                   1127: 
                   1128:           <dt><span class="sect1"><a href="#terminology">1.3.
                   1129:           Terminology</a></span></dt>
                   1130: 
                   1131:           <dt><span class="sect1"><a href="#typography">1.4.
                   1132:           Typography</a></span></dt>
                   1133:         </dl>
                   1134:       </div>
                   1135: 
1.67      hubertf  1136:       <div class="sect1" lang="en">
1.1       grant    1137:         <div class="titlepage">
                   1138:           <div>
                   1139:             <div>
                   1140:               <h2 class="title" style="clear: both"><a name=
1.30      wiz      1141:               "introduction-section"></a>1.1.&nbsp;Introduction</h2>
1.1       grant    1142:             </div>
                   1143:           </div>
                   1144:         </div>
                   1145: 
1.47      reed     1146:         <p>There is a lot of software freely available for
                   1147:         Unix-based systems, which usually runs on NetBSD and other
1.1       grant    1148:         Unix-flavoured systems, too, sometimes with some
                   1149:         modifications. The NetBSD Packages Collection (pkgsrc)
                   1150:         incorporates any such changes necessary to make that
                   1151:         software run, and makes the installation (and
                   1152:         de-installation) of the software package easy by means of a
                   1153:         single command.</p>
                   1154: 
                   1155:         <p>Once the software has been built, it is manipulated with
1.14      xtraeme  1156:         the <span><strong class="command">pkg_*</strong></span>
                   1157:         tools so that installation and de-installation, printing of
                   1158:         an inventory of all installed packages and retrieval of
                   1159:         one-line comments or more verbose descriptions are all
                   1160:         simple.</p>
1.1       grant    1161: 
                   1162:         <p>pkgsrc currently contains several thousand packages,
                   1163:         including:</p>
                   1164: 
                   1165:         <div class="itemizedlist">
                   1166:           <ul type="disc">
                   1167:             <li>
                   1168:               <p><a xmlns=
                   1169:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1170:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.45      wiz      1171:               target="_top"><code xmlns="" class=
                   1172:               "filename">www/apache</code></a> - The Apache web
1.20      ben      1173:               server</p>
1.1       grant    1174:             </li>
                   1175: 
                   1176:             <li>
                   1177:               <p><a xmlns=
                   1178:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1179:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45      wiz      1180:               target="_top"><code xmlns="" class=
                   1181:               "filename">www/mozilla</code></a> - The Mozilla web
1.20      ben      1182:               browser</p>
1.1       grant    1183:             </li>
                   1184: 
                   1185:             <li>
                   1186:               <p><a xmlns=
                   1187:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1188:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.45      wiz      1189:               target="_top"><code xmlns="" class=
                   1190:               "filename">meta-pkgs/gnome</code></a> - The GNOME
1.20      ben      1191:               Desktop Environment</p>
1.1       grant    1192:             </li>
                   1193: 
                   1194:             <li>
                   1195:               <p><a xmlns=
                   1196:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1197:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.45      wiz      1198:               target="_top"><code xmlns="" class=
                   1199:               "filename">meta-pkgs/kde3</code></a> - The K Desktop
1.20      ben      1200:               Environment</p>
1.1       grant    1201:             </li>
                   1202:           </ul>
                   1203:         </div>
                   1204: 
                   1205:         <p>...just to name a few.</p>
                   1206: 
                   1207:         <p>pkgsrc has built-in support for handling varying
                   1208:         dependencies, such as pthreads and X11, and extended
                   1209:         features such as IPv6 support on a range of platforms.</p>
                   1210: 
                   1211:         <p>pkgsrc was derived from FreeBSD's ports system, and
                   1212:         initially developed for NetBSD only. Since then, pkgsrc has
                   1213:         grown a lot, and now supports the following platforms:</p>
                   1214: 
                   1215:         <div class="itemizedlist">
                   1216:           <ul type="disc">
                   1217:             <li>
                   1218:               <p><a href="http://developer.apple.com/darwin/"
                   1219:               target="_top">Darwin</a> (<a href=
                   1220:               "http://www.apple.com/macosx/" target="_top">Mac OS
                   1221:               X</a>)</p>
                   1222:             </li>
                   1223: 
                   1224:             <li>
1.3       hubertf  1225:               <p><a href="http://www.DragonFlyBSD.org/" target=
                   1226:               "_top">DragonFlyBSD</a></p>
                   1227:             </li>
                   1228: 
                   1229:             <li>
1.1       grant    1230:               <p><a href="http://www.FreeBSD.org/" target=
                   1231:               "_top">FreeBSD</a></p>
                   1232:             </li>
                   1233: 
                   1234:             <li>
1.3       hubertf  1235:               <p>Microsoft Windows, via <a href=
                   1236:               "http://www.microsoft.com/windows/sfu/" target=
                   1237:               "_top">Interix</a></p>
1.1       grant    1238:             </li>
                   1239: 
                   1240:             <li>
                   1241:               <p><a href="http://www.sgi.com/software/irix6.5/"
                   1242:               target="_top">IRIX</a></p>
                   1243:             </li>
                   1244: 
                   1245:             <li>
                   1246:               <p><a href="http://www.linux.org/" target=
                   1247:               "_top">Linux</a></p>
                   1248:             </li>
                   1249: 
                   1250:             <li>
                   1251:               <p><a href="http://www.NetBSD.org/" target=
                   1252:               "_top">NetBSD</a> (of course)</p>
                   1253:             </li>
                   1254: 
                   1255:             <li>
1.17      sketch   1256:               <p><a href="http://h30097.www3.hp.com/" target=
                   1257:               "_top">Tru64</a> (Digital UNIX, OSF1)</p>
                   1258:             </li>
                   1259: 
                   1260:             <li>
1.1       grant    1261:               <p><a href="http://www.openbsd.org/" target=
                   1262:               "_top">OpenBSD</a></p>
                   1263:             </li>
                   1264: 
                   1265:             <li>
                   1266:               <p><a href="http://www.sun.com/solaris/" target=
                   1267:               "_top">Solaris</a></p>
                   1268:             </li>
                   1269:           </ul>
                   1270:         </div>
                   1271:       </div>
                   1272: 
1.67      hubertf  1273:       <div class="sect1" lang="en">
1.1       grant    1274:         <div class="titlepage">
                   1275:           <div>
                   1276:             <div>
                   1277:               <h2 class="title" style="clear: both"><a name=
1.67      hubertf  1278:               "overview"></a>1.2.&nbsp;Overview</h2>
1.1       grant    1279:             </div>
                   1280:           </div>
                   1281:         </div>
                   1282: 
                   1283:         <p>This document is divided into two parts. The first,
                   1284:         <a href="#users-guide" title=
1.46      gdt      1285:         "Part&nbsp;I.&nbsp;The pkgsrc user's guide">The pkgsrc
1.2       hubertf  1286:         user's guide</a>, describes how one can use one of the
                   1287:         packages in the Package Collection, either by installing a
                   1288:         precompiled binary package, or by building one's own copy
                   1289:         using the NetBSD package system. The second part, <a href=
1.1       grant    1290:         "#developers-guide" title=
1.46      gdt      1291:         "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">The
                   1292:         pkgsrc developer's guide</a>, explains how to prepare a
                   1293:         package so it can be easily built by other NetBSD users
                   1294:         without knowing about the package's building details.</p>
1.1       grant    1295: 
                   1296:         <p>This document is available in various formats:</p>
                   1297: 
                   1298:         <div class="itemizedlist">
                   1299:           <ul type="disc">
                   1300:             <li>
                   1301:               <p><a href="index.html" target="_top">HTML</a></p>
                   1302:             </li>
                   1303: 
                   1304:             <li>
                   1305:               <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
                   1306:             </li>
                   1307: 
                   1308:             <li>
                   1309:               <p><a href="pkgsrc.ps" target="_top">PS</a></p>
                   1310:             </li>
                   1311: 
                   1312:             <li>
                   1313:               <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
                   1314:             </li>
                   1315:           </ul>
                   1316:         </div>
                   1317:       </div>
                   1318: 
1.67      hubertf  1319:       <div class="sect1" lang="en">
1.1       grant    1320:         <div class="titlepage">
                   1321:           <div>
                   1322:             <div>
                   1323:               <h2 class="title" style="clear: both"><a name=
                   1324:               "terminology"></a>1.3.&nbsp;Terminology</h2>
                   1325:             </div>
                   1326:           </div>
                   1327:         </div>
                   1328: 
                   1329:         <p>There has been a lot of talk about &#8220;<span class=
                   1330:         "quote">ports</span>&#8221;, &#8220;<span class=
                   1331:         "quote">packages</span>&#8221;, etc. so far. Here is a
                   1332:         description of all the terminology used within this
                   1333:         document.</p>
                   1334: 
                   1335:         <div class="variablelist">
                   1336:           <dl>
                   1337:             <dt><span class="term">Package</span></dt>
                   1338: 
                   1339:             <dd>
                   1340:               <p>A set of files and building instructions that
                   1341:               describe what's necessary to build a certain piece of
                   1342:               software using pkgsrc. Packages are traditionally
1.45      wiz      1343:               stored under <code xmlns=
                   1344:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1345:               "filename">/usr/pkgsrc</code>.</p>
1.1       grant    1346:             </dd>
                   1347: 
                   1348:             <dt><span class="term">The NetBSD package
                   1349:             system</span></dt>
                   1350: 
                   1351:             <dd>
                   1352:               <p>This is the former name of &#8220;<span class=
                   1353:               "quote">pkgsrc</span>&#8221;. It is part of the
1.27      rillig   1354:               NetBSD operating system and can be bootstrapped to
                   1355:               run on non-NetBSD operating systems as well. It
                   1356:               handles building (compiling), installing, and
                   1357:               removing of packages.</p>
1.1       grant    1358:             </dd>
                   1359: 
                   1360:             <dt><span class="term">Distfile</span></dt>
                   1361: 
                   1362:             <dd>
                   1363:               <p>This term describes the file or files that are
                   1364:               provided by the author of the piece of software to
                   1365:               distribute his work. All the changes necessary to
                   1366:               build on NetBSD are reflected in the corresponding
                   1367:               package. Usually the distfile is in the form of a
                   1368:               compressed tar-archive, but other types are possible,
1.45      wiz      1369:               too. Distfiles are usually stored below <code xmlns=
                   1370:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1371:               "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    1372:             </dd>
                   1373: 
                   1374:             <dt><span class="term">Port</span></dt>
                   1375: 
                   1376:             <dd>
                   1377:               <p>This is the term used by FreeBSD and OpenBSD
                   1378:               people for what we call a package. In NetBSD
                   1379:               terminology, &#8220;<span class=
                   1380:               "quote">port</span>&#8221; refers to a different
                   1381:               architecture.</p>
                   1382:             </dd>
                   1383: 
                   1384:             <dt><span class="term">Precompiled/binary
                   1385:             package</span></dt>
                   1386: 
                   1387:             <dd>
                   1388:               <p>A set of binaries built with pkgsrc from a
1.14      xtraeme  1389:               distfile and stuffed together in a single
1.45      wiz      1390:               <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   1391:               class="filename">.tgz</code> file so it can be
1.14      xtraeme  1392:               installed on machines of the same machine
                   1393:               architecture without the need to recompile. Packages
1.45      wiz      1394:               are usually generated in <code xmlns=
                   1395:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1396:               "filename">/usr/pkgsrc/packages</code>; there is also
                   1397:               an archive on <a href=
1.1       grant    1398:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
                   1399:               "_top">ftp.NetBSD.org</a>.</p>
                   1400: 
                   1401:               <p>Sometimes, this is referred to by the term
                   1402:               &#8220;<span class="quote">package</span>&#8221; too,
                   1403:               especially in the context of precompiled
                   1404:               packages.</p>
                   1405:             </dd>
                   1406: 
                   1407:             <dt><span class="term">Program</span></dt>
                   1408: 
                   1409:             <dd>
                   1410:               <p>The piece of software to be installed which will
1.47      reed     1411:               be constructed from all the files in the distfile by
1.1       grant    1412:               the actions defined in the corresponding package.</p>
                   1413:             </dd>
                   1414:           </dl>
                   1415:         </div>
                   1416:       </div>
                   1417: 
1.67      hubertf  1418:       <div class="sect1" lang="en">
1.1       grant    1419:         <div class="titlepage">
                   1420:           <div>
                   1421:             <div>
                   1422:               <h2 class="title" style="clear: both"><a name=
                   1423:               "typography"></a>1.4.&nbsp;Typography</h2>
                   1424:             </div>
                   1425:           </div>
                   1426:         </div>
                   1427: 
                   1428:         <p>When giving examples for commands, shell prompts are
                   1429:         used to show if the command should/can be issued as root,
                   1430:         or if &#8220;<span class="quote">normal</span>&#8221; user
1.14      xtraeme  1431:         privileges are sufficient. We use a <code class=
                   1432:         "prompt">#</code> for root's shell prompt, and a
1.27      rillig   1433:         <code class="prompt">%</code> for users' shell prompt,
1.14      xtraeme  1434:         assuming they use the C-shell or tcsh.</p>
1.1       grant    1435:       </div>
                   1436:     </div>
                   1437: 
1.67      hubertf  1438:     <div class="part" lang="en">
1.1       grant    1439:       <div class="titlepage">
                   1440:         <div>
                   1441:           <div>
1.67      hubertf  1442:             <h1 class="title"><a name=
1.48      dillo    1443:             "users-guide"></a>Part&nbsp;I.&nbsp;The pkgsrc user's
                   1444:             guide</h1>
1.1       grant    1445:           </div>
                   1446:         </div>
                   1447:       </div>
                   1448: 
                   1449:       <div class="toc">
                   1450:         <p><b>Table of Contents</b></p>
                   1451: 
                   1452:         <dl>
                   1453:           <dt><span class="chapter"><a href="#getting">2. Where to
1.59      rillig   1454:           get pkgsrc and how to keep it up-to-date</a></span></dt>
1.1       grant    1455: 
                   1456:           <dd>
                   1457:             <dl>
1.30      wiz      1458:               <dt><span class="sect1"><a href="#as-tar-file">2.1.
                   1459:               As tar file</a></span></dt>
1.1       grant    1460: 
1.30      wiz      1461:               <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1       grant    1462:               SUP</a></span></dt>
                   1463: 
1.30      wiz      1464:               <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1       grant    1465:               CVS</a></span></dt>
1.59      rillig   1466: 
                   1467:               <dt><span class="sect1"><a href="#uptodate-cvs">2.4.
                   1468:               Keeping pkgsrc up-to-date via CVS</a></span></dt>
1.1       grant    1469:             </dl>
                   1470:           </dd>
                   1471: 
                   1472:           <dt><span class="chapter"><a href="#platforms">3. Using
                   1473:           pkgsrc on systems other than NetBSD</a></span></dt>
                   1474: 
                   1475:           <dd>
                   1476:             <dl>
1.30      wiz      1477:               <dt><span class="sect1"><a href=
                   1478:               "#bootstrapping-pkgsrc">3.1. Bootstrapping
                   1479:               pkgsrc</a></span></dt>
1.1       grant    1480: 
1.30      wiz      1481:               <dt><span class="sect1"><a href=
1.47      reed     1482:               "#platform-specific-notes">3.2. Platform-specific
1.30      wiz      1483:               notes</a></span></dt>
1.1       grant    1484: 
                   1485:               <dd>
                   1486:                 <dl>
1.30      wiz      1487:                   <dt><span class="sect2"><a href="#darwin">3.2.1.
                   1488:                   Darwin (Mac OS X)</a></span></dt>
1.1       grant    1489: 
1.30      wiz      1490:                   <dt><span class="sect2"><a href="#freebsd">3.2.2.
                   1491:                   FreeBSD</a></span></dt>
1.22      tv       1492: 
1.30      wiz      1493:                   <dt><span class="sect2"><a href="#interix">3.2.3.
                   1494:                   Interix</a></span></dt>
1.1       grant    1495: 
1.30      wiz      1496:                   <dt><span class="sect2"><a href="#irix">3.2.4.
                   1497:                   IRIX</a></span></dt>
1.1       grant    1498: 
1.30      wiz      1499:                   <dt><span class="sect2"><a href="#linux">3.2.5.
                   1500:                   Linux</a></span></dt>
1.1       grant    1501: 
1.30      wiz      1502:                   <dt><span class="sect2"><a href="#openbsd">3.2.6.
                   1503:                   OpenBSD</a></span></dt>
1.1       grant    1504: 
1.30      wiz      1505:                   <dt><span class="sect2"><a href="#solaris">3.2.7.
                   1506:                   Solaris</a></span></dt>
1.1       grant    1507:                 </dl>
                   1508:               </dd>
                   1509:             </dl>
                   1510:           </dd>
                   1511: 
                   1512:           <dt><span class="chapter"><a href="#using">4. Using
                   1513:           pkgsrc</a></span></dt>
                   1514: 
                   1515:           <dd>
                   1516:             <dl>
                   1517:               <dt><span class="sect1"><a href=
                   1518:               "#getting-started">4.1. Working with binary
                   1519:               packages</a></span></dt>
                   1520: 
                   1521:               <dd>
                   1522:                 <dl>
                   1523:                   <dt><span class="sect2"><a href=
1.30      wiz      1524:                   "#where-to-get-binary-packages">4.1.1. Where to
                   1525:                   get binary packages</a></span></dt>
1.1       grant    1526: 
                   1527:                   <dt><span class="sect2"><a href=
1.30      wiz      1528:                   "#how-to-use-binary-packages">4.1.2. How to use
                   1529:                   binary packages</a></span></dt>
1.1       grant    1530: 
                   1531:                   <dt><span class="sect2"><a href=
1.30      wiz      1532:                   "#a-word-of-warning">4.1.3. A word of
1.1       grant    1533:                   warning</a></span></dt>
                   1534:                 </dl>
                   1535:               </dd>
                   1536: 
1.30      wiz      1537:               <dt><span class="sect1"><a href=
                   1538:               "#building-packages-from-source">4.2. Building
                   1539:               packages from source</a></span></dt>
1.1       grant    1540: 
                   1541:               <dd>
                   1542:                 <dl>
                   1543:                   <dt><span class="sect2"><a href=
1.30      wiz      1544:                   "#requirements">4.2.1.
                   1545:                   Requirements</a></span></dt>
1.1       grant    1546: 
                   1547:                   <dt><span class="sect2"><a href=
1.30      wiz      1548:                   "#fetching-distfiles">4.2.2. Fetching
1.1       grant    1549:                   distfiles</a></span></dt>
                   1550: 
                   1551:                   <dt><span class="sect2"><a href=
1.30      wiz      1552:                   "#how-to-build-and-install">4.2.3. How to build
                   1553:                   and install</a></span></dt>
1.1       grant    1554: 
                   1555:                   <dt><span class="sect2"><a href=
1.30      wiz      1556:                   "#selecting-the-compiler">4.2.4. Selecting the
1.1       grant    1557:                   compiler</a></span></dt>
                   1558:                 </dl>
                   1559:               </dd>
                   1560:             </dl>
                   1561:           </dd>
                   1562: 
1.38      dillo    1563:           <dt><span class="chapter"><a href="#configuring">5.
                   1564:           Configuring pkgsrc</a></span></dt>
                   1565: 
                   1566:           <dd>
                   1567:             <dl>
                   1568:               <dt><span class="sect1"><a href=
1.45      wiz      1569:               "#general-configuration">5.1. General
                   1570:               configuration</a></span></dt>
                   1571: 
                   1572:               <dt><span class="sect1"><a href=
                   1573:               "#variables-affecting-build">5.2. Variables affecting
                   1574:               the build process</a></span></dt>
                   1575: 
                   1576:               <dt><span class="sect1"><a href=
                   1577:               "#developer-advanced-settings">5.3.
                   1578:               Developer/advanced settings</a></span></dt>
                   1579: 
                   1580:               <dt><span class="sect1"><a href=
                   1581:               "#selecting-build-options">5.4. Selecting Build
1.42      dillo    1582:               Options</a></span></dt>
1.38      dillo    1583:             </dl>
                   1584:           </dd>
                   1585: 
                   1586:           <dt><span class="chapter"><a href="#binary">6. Creating
1.1       grant    1587:           binary packages</a></span></dt>
                   1588: 
                   1589:           <dd>
                   1590:             <dl>
1.30      wiz      1591:               <dt><span class="sect1"><a href=
1.38      dillo    1592:               "#building-a-single-binary-package">6.1. Building a
1.30      wiz      1593:               single binary package</a></span></dt>
1.1       grant    1594: 
1.30      wiz      1595:               <dt><span class="sect1"><a href=
1.38      dillo    1596:               "#settings-for-creationg-of-binary-packages">6.2.
1.1       grant    1597:               Settings for creation of binary
                   1598:               packages</a></span></dt>
                   1599: 
1.38      dillo    1600:               <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1       grant    1601:               Doing a bulk build of all packages</a></span></dt>
                   1602: 
                   1603:               <dd>
                   1604:                 <dl>
                   1605:                   <dt><span class="sect2"><a href=
1.38      dillo    1606:                   "#binary.configuration">6.3.1.
1.1       grant    1607:                   Configuration</a></span></dt>
                   1608: 
                   1609:                   <dt><span class="sect2"><a href=
1.38      dillo    1610:                   "#other-environmental-considerations">6.3.2.
1.30      wiz      1611:                   Other environmental
1.1       grant    1612:                   considerations</a></span></dt>
                   1613: 
                   1614:                   <dt><span class="sect2"><a href=
1.38      dillo    1615:                   "#operation">6.3.3. Operation</a></span></dt>
1.1       grant    1616: 
                   1617:                   <dt><span class="sect2"><a href=
1.38      dillo    1618:                   "#what-it-does">6.3.4. What it
1.30      wiz      1619:                   does</a></span></dt>
1.1       grant    1620: 
                   1621:                   <dt><span class="sect2"><a href=
1.38      dillo    1622:                   "#disk-space-requirements">6.3.5. Disk space
1.1       grant    1623:                   requirements</a></span></dt>
                   1624: 
                   1625:                   <dt><span class="sect2"><a href=
1.38      dillo    1626:                   "#setting-up-a-sandbox">6.3.6. Setting up a
1.47      reed     1627:                   sandbox for chrooted builds</a></span></dt>
1.1       grant    1628: 
                   1629:                   <dt><span class="sect2"><a href=
1.38      dillo    1630:                   "#building-a-partial-set">6.3.7. Building a
1.30      wiz      1631:                   partial set of packages</a></span></dt>
1.13      hubertf  1632: 
                   1633:                   <dt><span class="sect2"><a href=
1.38      dillo    1634:                   "#bulk-upload">6.3.8. Uploading results of a bulk
1.13      hubertf  1635:                   build</a></span></dt>
1.1       grant    1636:                 </dl>
                   1637:               </dd>
                   1638: 
1.30      wiz      1639:               <dt><span class="sect1"><a href=
1.38      dillo    1640:               "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30      wiz      1641:               packages collection</a></span></dt>
1.1       grant    1642: 
                   1643:               <dd>
                   1644:                 <dl>
                   1645:                   <dt><span class="sect2"><a href=
1.38      dillo    1646:                   "#cdpack-example">6.4.1. Example of
1.1       grant    1647:                   cdpack</a></span></dt>
                   1648:                 </dl>
                   1649:               </dd>
                   1650:             </dl>
                   1651:           </dd>
                   1652: 
1.38      dillo    1653:           <dt><span class="chapter"><a href="#faq">7. Frequently
1.1       grant    1654:           Asked Questions</a></span></dt>
                   1655: 
                   1656:           <dd>
                   1657:             <dl>
1.30      wiz      1658:               <dt><span class="sect1"><a href=
1.38      dillo    1659:               "#mailing-list-pointers">7.1. Are there any mailing
1.30      wiz      1660:               lists for pkg-related discussion?</a></span></dt>
1.1       grant    1661: 
1.38      dillo    1662:               <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1       grant    1663:               Where's the pkgviews documentation?</a></span></dt>
                   1664: 
1.38      dillo    1665:               <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1       grant    1666:               Utilities for package management
                   1667:               (pkgtools)</a></span></dt>
                   1668: 
1.30      wiz      1669:               <dt><span class="sect1"><a href=
1.38      dillo    1670:               "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30      wiz      1671:               non-root</a></span></dt>
1.1       grant    1672: 
1.30      wiz      1673:               <dt><span class="sect1"><a href=
1.38      dillo    1674:               "#resume-transfers">7.5. How to resume transfers when
1.30      wiz      1675:               fetching distfiles?</a></span></dt>
1.14      xtraeme  1676: 
1.30      wiz      1677:               <dt><span class="sect1"><a href=
1.38      dillo    1678:               "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30      wiz      1679:               XFree86 from pkgsrc?</a></span></dt>
1.1       grant    1680: 
1.30      wiz      1681:               <dt><span class="sect1"><a href=
1.38      dillo    1682:               "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30      wiz      1683:               from pkgsrc?</a></span></dt>
1.1       grant    1684: 
1.30      wiz      1685:               <dt><span class="sect1"><a href=
1.38      dillo    1686:               "#fetch-behind-firewall">7.8. How to fetch files from
1.30      wiz      1687:               behind a firewall</a></span></dt>
1.1       grant    1688: 
1.38      dillo    1689:               <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.30      wiz      1690:               How do I tell <span><strong class="command">make
1.14      xtraeme  1691:               fetch</strong></span> to do passive
1.1       grant    1692:               FTP?</a></span></dt>
                   1693: 
1.30      wiz      1694:               <dt><span class="sect1"><a href=
1.38      dillo    1695:               "#fetching-all-distfiles">7.10. How to fetch all
1.30      wiz      1696:               distfiles at once</a></span></dt>
1.1       grant    1697: 
1.30      wiz      1698:               <dt><span class="sect1"><a href=
1.38      dillo    1699:               "#tmac.andoc-missing">7.11. What does
1.30      wiz      1700:               &#8220;<span class="quote">Don't know how to make
                   1701:               /usr/share/tmac/tmac.andoc</span>&#8221;
1.14      xtraeme  1702:               mean?</a></span></dt>
1.13      hubertf  1703: 
1.30      wiz      1704:               <dt><span class="sect1"><a href=
1.38      dillo    1705:               "#bsd.own.mk-missing">7.12. What does
1.30      wiz      1706:               &#8220;<span class="quote">Could not find
1.14      xtraeme  1707:               bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    1708: 
1.30      wiz      1709:               <dt><span class="sect1"><a href=
1.38      dillo    1710:               "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30      wiz      1711:               pkgsrc</a></span></dt>
1.1       grant    1712: 
1.38      dillo    1713:               <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35      jmmv     1714:               do I change the location of configuration
                   1715:               files?</a></span></dt>
1.1       grant    1716: 
                   1717:               <dt><span class="sect1"><a href=
1.38      dillo    1718:               "#audit-packages">7.15. Automated security
1.1       grant    1719:               checks</a></span></dt>
                   1720:             </dl>
                   1721:           </dd>
                   1722:         </dl>
                   1723:       </div>
                   1724: 
1.67      hubertf  1725:       <div class="chapter" lang="en">
1.1       grant    1726:         <div class="titlepage">
                   1727:           <div>
                   1728:             <div>
1.67      hubertf  1729:               <h2 class="title"><a name=
1.1       grant    1730:               "getting"></a>Chapter&nbsp;2.&nbsp;Where to get
1.59      rillig   1731:               pkgsrc and how to keep it up-to-date</h2>
1.1       grant    1732:             </div>
                   1733:           </div>
                   1734:         </div>
                   1735: 
                   1736:         <div class="toc">
                   1737:           <p><b>Table of Contents</b></p>
                   1738: 
                   1739:           <dl>
1.30      wiz      1740:             <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1       grant    1741:             tar file</a></span></dt>
                   1742: 
1.30      wiz      1743:             <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1       grant    1744:             SUP</a></span></dt>
                   1745: 
1.30      wiz      1746:             <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1       grant    1747:             CVS</a></span></dt>
1.59      rillig   1748: 
                   1749:             <dt><span class="sect1"><a href="#uptodate-cvs">2.4.
                   1750:             Keeping pkgsrc up-to-date via CVS</a></span></dt>
1.1       grant    1751:           </dl>
                   1752:         </div>
                   1753: 
                   1754:         <p>There are three ways to get pkgsrc. Either as a tar
                   1755:         file, via SUP, or via CVS. All three ways are described
                   1756:         here.</p>
                   1757: 
1.67      hubertf  1758:         <div class="sect1" lang="en">
1.1       grant    1759:           <div class="titlepage">
                   1760:             <div>
                   1761:               <div>
                   1762:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  1763:                 "as-tar-file"></a>2.1.&nbsp;As tar file</h2>
1.1       grant    1764:               </div>
                   1765:             </div>
                   1766:           </div>
                   1767: 
                   1768:           <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
                   1769:           file from <a href=
1.11      ben      1770:           "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20      ben      1771:           target="_top">ftp.NetBSD.org</a> and unpack it into
1.45      wiz      1772:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   1773:           class="filename">/usr/pkgsrc</code>.</p>
1.1       grant    1774:         </div>
                   1775: 
1.67      hubertf  1776:         <div class="sect1" lang="en">
1.1       grant    1777:           <div class="titlepage">
                   1778:             <div>
                   1779:               <div>
                   1780:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  1781:                 "via-sup"></a>2.2.&nbsp;Via SUP</h2>
1.1       grant    1782:               </div>
                   1783:             </div>
                   1784:           </div>
                   1785: 
                   1786:           <p>As an alternative to the tar file, you can get pkgsrc
                   1787:           via the Software Update Protocol, SUP. To do so, make
                   1788:           sure your supfile has a line</p>
                   1789:           <pre class="programlisting">
1.51      rillig   1790:     release=pkgsrc
1.1       grant    1791: </pre>
                   1792: 
1.45      wiz      1793:           <p>in it, see the examples in <code xmlns=
                   1794:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1795:           "filename">/usr/share/examples/supfiles</code>, and that
1.45      wiz      1796:           the <code xmlns=
                   1797:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1798:           "filename">/usr/pkgsrc</code> directory exists. Then,
                   1799:           simply run <span><strong class="command">sup -v
                   1800:           <em class="replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1       grant    1801:         </div>
                   1802: 
1.67      hubertf  1803:         <div class="sect1" lang="en">
1.1       grant    1804:           <div class="titlepage">
                   1805:             <div>
                   1806:               <div>
                   1807:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  1808:                 "via-cvs"></a>2.3.&nbsp;Via CVS</h2>
1.1       grant    1809:               </div>
                   1810:             </div>
                   1811:           </div>
                   1812: 
                   1813:           <p>To get pkgsrc via CVS, make sure you have
                   1814:           &#8220;<span class="quote">cvs</span>&#8221; installed.
1.27      rillig   1815:           To do an initial (full) checkout of pkgsrc, do the
                   1816:           following steps:</p>
1.1       grant    1817:           <pre class="screen">
1.14      xtraeme  1818: <code class="prompt">%</code> <strong class=
                   1819: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
                   1820: <code class="prompt">%</code> <strong class=
                   1821: "userinput"><code>setenv CVS_RSH ssh</code></strong>
                   1822: <code class="prompt">%</code> <strong class=
                   1823: "userinput"><code>cd /usr</code></strong>
                   1824: <code class="prompt">%</code> <strong class=
                   1825: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
                   1826: </pre>
                   1827: 
1.45      wiz      1828:           <p>This will create the <code xmlns=
                   1829:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1830:           "filename">pkgsrc</code> directory in your <code xmlns=
                   1831:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1832:           "filename">/usr</code>, and all the package source will
1.45      wiz      1833:           be stored under <code xmlns=
                   1834:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1835:           "filename">/usr/pkgsrc</code>. To update pkgsrc after the
                   1836:           initial checkout, make sure you have <code class=
                   1837:           "varname">CVS_RSH</code> set as above, then do:</p>
1.1       grant    1838:           <pre class="screen">
1.14      xtraeme  1839: <code class="prompt">%</code> <strong class=
                   1840: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   1841: <code class="prompt">%</code> <strong class=
                   1842: "userinput"><code>cvs -q update -dP</code></strong>
1.1       grant    1843: </pre>
                   1844: 
                   1845:           <p>Please also note that it is possible to have multiple
                   1846:           copies of the pkgsrc hierarchy in use at any one time -
                   1847:           all work is done relatively within the pkgsrc tree.</p>
                   1848:         </div>
1.59      rillig   1849: 
1.67      hubertf  1850:         <div class="sect1" lang="en">
1.59      rillig   1851:           <div class="titlepage">
                   1852:             <div>
                   1853:               <div>
                   1854:                 <h2 class="title" style="clear: both"><a name=
                   1855:                 "uptodate-cvs"></a>2.4.&nbsp;Keeping pkgsrc
                   1856:                 up-to-date via CVS</h2>
                   1857:               </div>
                   1858:             </div>
                   1859:           </div>
                   1860: 
                   1861:           <p>If your copy of pkgsrc contains a lot of <code xmlns=
                   1862:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1863:           "filename">CVS</code> directories, you can update it
                   1864:           using the <a href=
                   1865:           "http://netbsd.gw.com/cgi-bin/man-cgi?cvs+1+NetBSD-current">
                   1866:           <span class="citerefentry"><span class=
                   1867:           "refentrytitle">cvs</span>(1)</span></a> program. First,
                   1868:           <span><strong class="command">cd</strong></span> to the
                   1869:           top level directory of pkgsrc. Then run
                   1870:           <span><strong class="command">cvs -q update
                   1871:           -dP</strong></span>, and you're done.</p>
                   1872: 
                   1873:           <p>If that doesn't work and the file <code xmlns=
                   1874:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1875:           "filename">CVS/Root</code> contains the string
                   1876:           &#8220;<span class="quote">:pserver:</span>&#8221;, you
                   1877:           have to run <span><strong class="command">cvs
                   1878:           login</strong></span> once to get known to the NetBSD CVS
                   1879:           server. The <span><strong class=
                   1880:           "command">cvs</strong></span> utility will then ask you
                   1881:           for a password. Just enter &#8220;<span class=
                   1882:           "quote">anoncvs</span>&#8221;. Then try again to
                   1883:           update.</p>
                   1884:         </div>
1.1       grant    1885:       </div>
                   1886: 
1.67      hubertf  1887:       <div class="chapter" lang="en">
1.1       grant    1888:         <div class="titlepage">
                   1889:           <div>
                   1890:             <div>
1.67      hubertf  1891:               <h2 class="title"><a name=
1.1       grant    1892:               "platforms"></a>Chapter&nbsp;3.&nbsp;Using pkgsrc on
                   1893:               systems other than NetBSD</h2>
                   1894:             </div>
                   1895:           </div>
                   1896:         </div>
                   1897: 
                   1898:         <div class="toc">
                   1899:           <p><b>Table of Contents</b></p>
                   1900: 
                   1901:           <dl>
1.30      wiz      1902:             <dt><span class="sect1"><a href=
                   1903:             "#bootstrapping-pkgsrc">3.1. Bootstrapping
                   1904:             pkgsrc</a></span></dt>
1.1       grant    1905: 
1.30      wiz      1906:             <dt><span class="sect1"><a href=
1.47      reed     1907:             "#platform-specific-notes">3.2. Platform-specific
1.30      wiz      1908:             notes</a></span></dt>
1.1       grant    1909: 
                   1910:             <dd>
                   1911:               <dl>
1.30      wiz      1912:                 <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1       grant    1913:                 Darwin (Mac OS X)</a></span></dt>
                   1914: 
1.30      wiz      1915:                 <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1       grant    1916:                 FreeBSD</a></span></dt>
                   1917: 
1.30      wiz      1918:                 <dt><span class="sect2"><a href="#interix">3.2.3.
1.1       grant    1919:                 Interix</a></span></dt>
                   1920: 
1.30      wiz      1921:                 <dt><span class="sect2"><a href="#irix">3.2.4.
1.1       grant    1922:                 IRIX</a></span></dt>
                   1923: 
1.30      wiz      1924:                 <dt><span class="sect2"><a href="#linux">3.2.5.
1.22      tv       1925:                 Linux</a></span></dt>
                   1926: 
1.30      wiz      1927:                 <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1       grant    1928:                 OpenBSD</a></span></dt>
                   1929: 
1.30      wiz      1930:                 <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1       grant    1931:                 Solaris</a></span></dt>
                   1932:               </dl>
                   1933:             </dd>
                   1934:           </dl>
                   1935:         </div>
                   1936: 
1.67      hubertf  1937:         <div class="sect1" lang="en">
1.1       grant    1938:           <div class="titlepage">
                   1939:             <div>
                   1940:               <div>
                   1941:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      1942:                 "bootstrapping-pkgsrc"></a>3.1.&nbsp;Bootstrapping
                   1943:                 pkgsrc</h2>
1.1       grant    1944:               </div>
                   1945:             </div>
                   1946:           </div>
                   1947: 
1.27      rillig   1948:           <p>For operating systems other than NetBSD, we provide a
1.1       grant    1949:           bootstrap kit to build the required tools to use pkgsrc
                   1950:           on your platform. Besides support for native NetBSD,
                   1951:           pkgsrc and the bootstrap kit have support for the
                   1952:           following operating systems:</p>
                   1953: 
                   1954:           <div class="itemizedlist">
                   1955:             <ul type="disc">
                   1956:               <li>
                   1957:                 <p>Darwin (Mac OS X)</p>
                   1958:               </li>
                   1959: 
                   1960:               <li>
1.16      grant    1961:                 <p>DragonFlyBSD</p>
                   1962:               </li>
                   1963: 
                   1964:               <li>
1.1       grant    1965:                 <p>FreeBSD</p>
                   1966:               </li>
                   1967: 
                   1968:               <li>
                   1969:                 <p>Interix (Windows 2000, XP, 2003)</p>
                   1970:               </li>
                   1971: 
                   1972:               <li>
                   1973:                 <p>IRIX</p>
                   1974:               </li>
                   1975: 
                   1976:               <li>
                   1977:                 <p>Linux</p>
                   1978:               </li>
                   1979: 
                   1980:               <li>
                   1981:                 <p>OpenBSD</p>
                   1982:               </li>
                   1983: 
                   1984:               <li>
                   1985:                 <p>Solaris</p>
                   1986:               </li>
1.16      grant    1987: 
                   1988:               <li>
                   1989:                 <p>Tru64 (Digital UNIX/OSF1)</p>
                   1990:               </li>
1.1       grant    1991:             </ul>
                   1992:           </div>
                   1993: 
                   1994:           <p>Support for other platforms is under development.</p>
                   1995: 
                   1996:           <p>Installing the bootstrap kit should be as simple
                   1997:           as:</p>
                   1998:           <pre class="screen">
1.14      xtraeme  1999: <code class="prompt">#</code> <strong class=
                   2000: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
                   2001: <code class="prompt">#</code> <strong class=
                   2002: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   2003: <code class="prompt">#</code> <strong class=
                   2004: "userinput"><code>./bootstrap</code></strong>
1.1       grant    2005: </pre>
                   2006: 
                   2007:           <p>See <a href="#getting" title=
1.59      rillig   2008:           "Chapter&nbsp;2.&nbsp;Where to get pkgsrc and how to keep it up-to-date">
1.67      hubertf  2009:           Chapter&nbsp;2, <i>Where to get pkgsrc and how to keep it
1.59      rillig   2010:           up-to-date</i></a> for other ways to get pkgsrc before
                   2011:           bootstrapping. The given <span><strong class=
                   2012:           "command">bootstrap</strong></span> command will use the
                   2013:           defaults of <code xmlns=
1.45      wiz      2014:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2015:           "filename">/usr/pkg</code> for the <span class=
                   2016:           "emphasis"><em>prefix</em></span> where programs will be
1.45      wiz      2017:           installed in, and <code xmlns=
                   2018:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2019:           "filename">/var/db/pkg</code> for the package database
1.27      rillig   2020:           directory where pkgsrc will do its internal bookkeeping.
1.1       grant    2021:           However, these can also be set using command-line
1.27      rillig   2022:           arguments.</p>
1.1       grant    2023: 
                   2024:           <p>Binary packages for the pkgsrc tools and an initial
                   2025:           set of packages is available for supported platforms. An
                   2026:           up-to-date list of these can be found on <a href=
                   2027:           "http://www.pkgsrc.org/" target=
1.63      dillo    2028:           "_top">www.pkgsrc.org</a>. Note that this only works for
                   2029:           privileged builds that install into <code xmlns=
                   2030:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   2031:           "filename">/usr/pkg</code>.</p>
1.47      reed     2032: 
                   2033:           <div class="note" style=
                   2034:           "margin-left: 0.5in; margin-right: 0.5in;">
                   2035:             <h3 class="title">Note</h3>
                   2036: 
                   2037:             <p>The bootstrap installs a <span><strong class=
                   2038:             "command">bmake</strong></span> tool. Use this
                   2039:             <span><strong class="command">bmake</strong></span>
                   2040:             when building via pkgsrc. For examples in this guide,
                   2041:             use <span><strong class="command">bmake</strong></span>
                   2042:             instead of &#8220;<span class=
                   2043:             "quote">make</span>&#8221;.</p>
                   2044:           </div>
1.1       grant    2045:         </div>
                   2046: 
1.67      hubertf  2047:         <div class="sect1" lang="en">
1.1       grant    2048:           <div class="titlepage">
                   2049:             <div>
                   2050:               <div>
                   2051:                 <h2 class="title" style="clear: both"><a name=
1.47      reed     2052:                 "platform-specific-notes"></a>3.2.&nbsp;Platform-specific
                   2053:                 notes</h2>
1.1       grant    2054:               </div>
                   2055:             </div>
                   2056:           </div>
                   2057: 
                   2058:           <p>Here are some platform-specific notes you should be
                   2059:           aware of.</p>
                   2060: 
1.67      hubertf  2061:           <div class="sect2" lang="en">
1.1       grant    2062:             <div class="titlepage">
                   2063:               <div>
                   2064:                 <div>
1.67      hubertf  2065:                   <h3 class="title"><a name=
1.30      wiz      2066:                   "darwin"></a>3.2.1.&nbsp;Darwin (Mac OS X)</h3>
1.1       grant    2067:                 </div>
                   2068:               </div>
                   2069:             </div>
                   2070: 
                   2071:             <p>Darwin 5.x and 6.x are supported. There are two
                   2072:             methods of using pkgsrc on Mac OS X, by using a
                   2073:             <a href="#platform.osx-image" title=
                   2074:             "3.2.1.1.&nbsp;Using a disk image">disk image</a>, or a
                   2075:             <a href="#platform.osx-ufs" title=
                   2076:             "3.2.1.2.&nbsp;Using a UFS partition">UFS
                   2077:             partition</a>.</p>
                   2078: 
                   2079:             <p>Before you start, you will need to download and
                   2080:             install the Mac OS X Developer Tools from Apple's
                   2081:             Developer Connection. See <a href=
                   2082:             "http://developer.apple.com/macosx/" target=
                   2083:             "_top">http://developer.apple.com/macosx/</a> for
                   2084:             details. Also, make sure you install X11 for Mac OS X
                   2085:             and the X11 SDK from <a href=
                   2086:             "http://www.apple.com/macosx/x11/download/" target=
                   2087:             "_top">http://www.apple.com/macosx/x11/download/</a> if
                   2088:             you intend to build packages that use the X11 Window
                   2089:             System.</p>
                   2090: 
                   2091:             <p>If you already have a UFS partition, or have a spare
                   2092:             partition that you can format as UFS, it is recommended
                   2093:             to use that instead of the disk image. It'll be
                   2094:             somewhat faster and will mount automatically at boot
                   2095:             time, where you must manually mount a disk image.</p>
                   2096: 
                   2097:             <div class="note" style=
                   2098:             "margin-left: 0.5in; margin-right: 0.5in;">
                   2099:               <h3 class="title">Note</h3>
                   2100: 
                   2101:               <p>You cannot use a HFS+ file system for pkgsrc,
1.47      reed     2102:               because pkgsrc currently requires the file system to
1.1       grant    2103:               be case-sensitive, and HFS+ is not.</p>
                   2104:             </div>
                   2105: 
1.67      hubertf  2106:             <div class="sect3" lang="en">
1.1       grant    2107:               <div class="titlepage">
                   2108:                 <div>
                   2109:                   <div>
1.67      hubertf  2110:                     <h4 class="title"><a name=
                   2111:                     "platform.osx-image"></a>3.2.1.1.&nbsp;Using a
                   2112:                     disk image</h4>
1.1       grant    2113:                   </div>
                   2114:                 </div>
                   2115:               </div>
                   2116: 
                   2117:               <p>Create the disk image:</p>
                   2118:               <pre class="screen">
1.14      xtraeme  2119: <code class="prompt">#</code> <strong class=
                   2120: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   2121: <code class="prompt">#</code> <strong class=
                   2122: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
                   2123: <code class="prompt">#</code> <strong class=
                   2124: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
                   2125: <code class="prompt">#</code> <strong class=
                   2126: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1       grant    2127: </pre>
                   2128: 
                   2129:               <p>That's it!</p>
                   2130:             </div>
                   2131: 
1.67      hubertf  2132:             <div class="sect3" lang="en">
1.1       grant    2133:               <div class="titlepage">
                   2134:                 <div>
                   2135:                   <div>
1.67      hubertf  2136:                     <h4 class="title"><a name=
                   2137:                     "platform.osx-ufs"></a>3.2.1.2.&nbsp;Using a
1.1       grant    2138:                     UFS partition</h4>
                   2139:                   </div>
                   2140:                 </div>
                   2141:               </div>
                   2142: 
1.45      wiz      2143:               <p>By default, <code xmlns=
                   2144:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   2145:               "filename">/usr</code> will be on your root file
                   2146:               system, normally HFS+. It is possible to use the
                   2147:               default <span class="emphasis"><em>prefix</em></span>
                   2148:               of <code xmlns=
                   2149:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   2150:               "filename">/usr/pkg</code> by symlinking <code xmlns=
                   2151:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2152:               "filename">/usr/pkg</code> to a directory on a UFS
                   2153:               file system. Obviously, another symlink is required
                   2154:               if you want to place the package database directory
                   2155:               outside the <span class=
                   2156:               "emphasis"><em>prefix</em></span>. e.g.</p>
1.1       grant    2157:               <pre class="screen">
1.14      xtraeme  2158: <code class="prompt">#</code> <strong class=
1.59      rillig   2159: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb</code></strong>
1.1       grant    2160: </pre>
                   2161: 
                   2162:               <p>If you created your partitions at the time of
                   2163:               installing Mac OS X and formatted the target
                   2164:               partition as UFS, it should automatically mount on
1.45      wiz      2165:               <code xmlns=
                   2166:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   2167:               "filename">/Volumes/&lt;volume name&gt;</code> when
                   2168:               the machine boots. If you are (re)formatting a
                   2169:               partition as UFS, you need to ensure that the
                   2170:               partition map correctly reflects &#8220;<span class=
                   2171:               "quote">Apple_UFS</span>&#8221; and not
                   2172:               &#8220;<span class=
1.1       grant    2173:               "quote">Apple_HFS</span>&#8221;.</p>
                   2174: 
                   2175:               <p>The problem is that none of the disk tools will
                   2176:               let you touch a disk that is booted from. You can
                   2177:               unmount the partition, but even if you newfs it, the
                   2178:               partition type will be incorrect and the automounter
                   2179:               won't mount it. It can be mounted manually, but it
                   2180:               won't appear in Finder.</p>
                   2181: 
                   2182:               <p>You'll need to boot off of the OS X Installation
                   2183:               (User) CD. When the Installation program starts, go
                   2184:               up to the menu and select Disk Utility. Now, you will
                   2185:               be able to select the partition you want to be UFS,
                   2186:               and Format it Apple UFS. Quit the Disk Utility, quit
                   2187:               the installer which will reboot your machine. The new
                   2188:               UFS file system will appear in Finder.</p>
                   2189: 
                   2190:               <p>Be aware that the permissions on the new file
                   2191:               system will be writable by root only.</p>
                   2192: 
                   2193:               <p>This note is as of 10.2 (Jaguar) and applies to
                   2194:               earlier versions. Hopefully Apple will fix Disk
                   2195:               Utility in 10.3 (Panther).</p>
                   2196:             </div>
                   2197:           </div>
                   2198: 
1.67      hubertf  2199:           <div class="sect2" lang="en">
1.1       grant    2200:             <div class="titlepage">
                   2201:               <div>
                   2202:                 <div>
1.67      hubertf  2203:                   <h3 class="title"><a name=
1.30      wiz      2204:                   "freebsd"></a>3.2.2.&nbsp;FreeBSD</h3>
1.1       grant    2205:                 </div>
                   2206:               </div>
                   2207:             </div>
                   2208: 
                   2209:             <p>FreeBSD 4.7 and 5.0 have been tested and are
                   2210:             supported, other versions may work.</p>
                   2211: 
                   2212:             <p>Care should be taken so that the tools that this kit
                   2213:             installs do not conflict with the FreeBSD userland
                   2214:             tools. There are several steps:</p>
                   2215: 
                   2216:             <div class="orderedlist">
                   2217:               <ol type="1">
                   2218:                 <li>
                   2219:                   <p>FreeBSD stores its ports pkg database in
1.45      wiz      2220:                   <code xmlns=
                   2221:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   2222:                   "filename">/var/db/pkg</code>. It is therefore
                   2223:                   recommended that you choose a different location
                   2224:                   (e.g. <code xmlns=
                   2225:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2226:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2227:                   --pkgdbdir option to the bootstrap script.</p>
                   2228:                 </li>
                   2229: 
                   2230:                 <li>
                   2231:                   <p>If you do not intend to use the FreeBSD ports
                   2232:                   tools, it's probably a good idea to move them out
                   2233:                   of the way to avoid confusion, e.g.</p>
                   2234:                   <pre class="screen">
1.14      xtraeme  2235: <code class="prompt">#</code> <strong class=
                   2236: "userinput"><code>cd /usr/sbin</code></strong>
                   2237: <code class="prompt">#</code> <strong class=
                   2238: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2239: <code class="prompt">#</code> <strong class=
                   2240: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2241: <code class="prompt">#</code> <strong class=
                   2242: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2243: <code class="prompt">#</code> <strong class=
                   2244: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2245: </pre>
                   2246:                 </li>
                   2247: 
                   2248:                 <li>
1.45      wiz      2249:                   <p>An example <code xmlns=
                   2250:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2251:                   "filename">/etc/mk.conf</code> file will be
1.45      wiz      2252:                   placed in <code xmlns=
                   2253:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2254:                   "filename">/etc/mk.conf.example</code> file when
                   2255:                   you use the bootstrap script.</p>
1.1       grant    2256:                 </li>
                   2257:               </ol>
                   2258:             </div>
                   2259:           </div>
                   2260: 
1.67      hubertf  2261:           <div class="sect2" lang="en">
1.1       grant    2262:             <div class="titlepage">
                   2263:               <div>
                   2264:                 <div>
1.67      hubertf  2265:                   <h3 class="title"><a name=
1.30      wiz      2266:                   "interix"></a>3.2.3.&nbsp;Interix</h3>
1.1       grant    2267:                 </div>
                   2268:               </div>
                   2269:             </div>
                   2270: 
1.47      reed     2271:             <p>Interix is a POSIX-compatible subsystem for the
1.1       grant    2272:             Windows NT kernel, providing a Unix-like environment
                   2273:             with a tighter kernel integration than available with
                   2274:             Cygwin. It is part of the Windows Services for Unix
                   2275:             package, available for free for any licensed copy of
1.22      tv       2276:             Windows 2000, XP (not including XP Home), or 2003. SFU
                   2277:             can be downloaded from <a href=
                   2278:             "http://www.microsoft.com/windows/sfu/" target=
1.1       grant    2279:             "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
                   2280: 
                   2281:             <p>Services for Unix 3.5, current as of this writing,
                   2282:             has been tested. 3.0 or 3.1 may work, but are not
                   2283:             officially supported. (The main difference in 3.0/3.1
                   2284:             is lack of pthreads.)</p>
                   2285: 
1.67      hubertf  2286:             <div class="sect3" lang="en">
1.1       grant    2287:               <div class="titlepage">
                   2288:                 <div>
                   2289:                   <div>
                   2290:                     <h4 class="title"><a name=
                   2291:                     "platform.interix-sfu-install"></a>3.2.3.1.&nbsp;When
1.2       hubertf  2292:                     installing Interix/SFU</h4>
1.1       grant    2293:                   </div>
                   2294:                 </div>
                   2295:               </div>
                   2296: 
                   2297:               <p>At an absolute minimum, the following packages
                   2298:               must be installed from the Windows Services for Unix
                   2299:               3.5 distribution in order to use pkgsrc:</p>
                   2300: 
                   2301:               <div class="itemizedlist">
                   2302:                 <ul type="disc">
                   2303:                   <li>
                   2304:                     <p>Utilities -&gt; Base Utilities</p>
                   2305:                   </li>
                   2306: 
                   2307:                   <li>
                   2308:                     <p>Interix GNU Components -&gt; (all)</p>
                   2309:                   </li>
                   2310: 
                   2311:                   <li>
                   2312:                     <p>Remote Connectivity</p>
                   2313:                   </li>
                   2314: 
                   2315:                   <li>
                   2316:                     <p>Interix SDK</p>
                   2317:                   </li>
                   2318:                 </ul>
                   2319:               </div>
                   2320: 
                   2321:               <p>When using pkgsrc on Interix, DO NOT install the
                   2322:               Utilities subcomponent "UNIX Perl". That is Perl 5.6
                   2323:               without shared module support, installed to
                   2324:               /usr/local, and will only cause confusion. Instead,
                   2325:               install Perl 5.8 from pkgsrc (or from a binary
                   2326:               package).</p>
                   2327: 
                   2328:               <p>The Remote Connectivity subcomponent "Windows
                   2329:               Remote Shell Service" does not need to be installed,
                   2330:               but Remote Connectivity itself should be installed in
                   2331:               order to have a working inetd.</p>
                   2332: 
1.52      tv       2333:               <p>During installation you may be asked whether to
                   2334:               enable setuid behavior for Interix programs, and
                   2335:               whether to make pathnames default to case-sensitive.
                   2336:               Setuid should be enabled, and case-sensitivity MUST
                   2337:               be enabled. (Without case-sensitivity, a large number
                   2338:               of packages including perl will not build.)</p>
                   2339: 
                   2340:               <p>NOTE: Newer Windows service packs change the way
                   2341:               binary execution works (via the Data Execution
                   2342:               Prevention feature). In order to use pkgsrc and other
                   2343:               gcc-compiled binaries reliably, a hotfix containing
                   2344:               POSIX.EXE, PSXDLL.DLL, PSXRUN.EXE, and PSXSS.EXE
                   2345:               (899522 or newer) must be installed. Hotfixes are
                   2346:               available from Microsoft through a support contract;
                   2347:               however, a NetBSD developer has made most Interix
                   2348:               hotfixes available for personal use from <a href=
                   2349:               "http://www.duh.org/interix/hotfixes.php" target=
                   2350:               "_top">http://www.duh.org/interix/hotfixes.php</a>.</p>
1.1       grant    2351:             </div>
                   2352: 
1.67      hubertf  2353:             <div class="sect3" lang="en">
1.1       grant    2354:               <div class="titlepage">
                   2355:                 <div>
                   2356:                   <div>
                   2357:                     <h4 class="title"><a name=
                   2358:                     "platform.interix-sfu-postinstall"></a>3.2.3.2.&nbsp;What
                   2359:                     to do if Interix/SFU is already installed</h4>
                   2360:                   </div>
                   2361:                 </div>
                   2362:               </div>
                   2363: 
                   2364:               <p>If SFU is already installed and you wish to alter
                   2365:               these settings to work with pkgsrc, note the
                   2366:               following things.</p>
                   2367: 
                   2368:               <div class="itemizedlist">
                   2369:                 <ul type="disc">
                   2370:                   <li>
                   2371:                     <p>To uninstall UNIX Perl, use Add/Remove
                   2372:                     Programs, select Microsoft Windows Services for
                   2373:                     UNIX, then click Change. In the installer,
                   2374:                     choose Add or Remove, then uncheck
                   2375:                     Utilities-&gt;UNIX Perl.</p>
                   2376:                   </li>
                   2377: 
                   2378:                   <li>
1.47      reed     2379:                     <p>To enable case-sensitivity for the file
                   2380:                     system, run REGEDIT.EXE, and change the
1.1       grant    2381:                     following registry key:</p>
                   2382: 
                   2383:                     <p>
                   2384:                     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
                   2385:                     Manager\kernel</p>
                   2386: 
                   2387:                     <p>Set the DWORD value "obcaseinsensitive" to
                   2388:                     0; then reboot.</p>
                   2389:                   </li>
                   2390: 
                   2391:                   <li>
                   2392:                     <p>To enable setuid binaries (optional), run
                   2393:                     REGEDIT.EXE, and change the following registry
                   2394:                     key:</p>
                   2395: 
                   2396:                     <p>
                   2397:                     HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
                   2398:                     for UNIX</p>
                   2399: 
                   2400:                     <p>Set the DWORD value "EnableSetuidBinaries"
                   2401:                     to 1; then reboot.</p>
                   2402:                   </li>
                   2403:                 </ul>
                   2404:               </div>
                   2405:             </div>
                   2406: 
1.67      hubertf  2407:             <div class="sect3" lang="en">
1.1       grant    2408:               <div class="titlepage">
                   2409:                 <div>
                   2410:                   <div>
                   2411:                     <h4 class="title"><a name=
                   2412:                     "platform.interix-notes"></a>3.2.3.3.&nbsp;Important
                   2413:                     notes for using pkgsrc</h4>
                   2414:                   </div>
                   2415:                 </div>
                   2416:               </div>
                   2417: 
1.52      tv       2418:               <p>The package manager (either the pkgsrc "su" user,
1.1       grant    2419:               or the user running "pkg_add") must be a member of
                   2420:               the local Administrators group. Such a user must also
                   2421:               be used to run the bootstrap. This is slightly
                   2422:               relaxed from the normal pkgsrc requirement of
                   2423:               "root".</p>
                   2424: 
                   2425:               <p>The package manager should use a umask of 002.
                   2426:               "make install" will automatically complain if this is
                   2427:               not the case. This ensures that directories written
                   2428:               in /var/db/pkg are Administrators-group
                   2429:               writeable.</p>
                   2430: 
                   2431:               <p>The popular Interix binary packages from
                   2432:               http://www.interopsystems.com/ use an older version
                   2433:               of pkgsrc's pkg_* tools. Ideally, these should NOT be
                   2434:               used in conjunction with pkgsrc. If you choose to use
                   2435:               them at the same time as the pkgsrc packages, ensure
                   2436:               that you use the proper pkg_* tools for each type of
                   2437:               binary package.</p>
1.22      tv       2438: 
                   2439:               <p>The TERM setting used for DOS-type console windows
                   2440:               (including those invoked by the csh and ksh startup
                   2441:               shortcuts) is "interix". Most systems don't have a
                   2442:               termcap/terminfo entry for it, but the following
                   2443:               .termcap entry provides adequate emulation in most
                   2444:               cases:</p>
                   2445:               <pre class="programlisting">
1.51      rillig   2446:     interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
1.22      tv       2447: </pre>
1.1       grant    2448:             </div>
1.52      tv       2449: 
1.67      hubertf  2450:             <div class="sect3" lang="en">
1.52      tv       2451:               <div class="titlepage">
                   2452:                 <div>
                   2453:                   <div>
                   2454:                     <h4 class="title"><a name=
                   2455:                     "platform.interix-limits"></a>3.2.3.4.&nbsp;Limitations
                   2456:                     of the Interix platform</h4>
                   2457:                   </div>
                   2458:                 </div>
                   2459:               </div>
                   2460: 
                   2461:               <p>Though Interix suffices as a familiar and flexible
                   2462:               substitute for a full Unix-like platform, it has some
                   2463:               drawbacks that should be noted for those desiring to
                   2464:               make the most of Interix.</p>
                   2465: 
                   2466:               <div class="itemizedlist">
                   2467:                 <ul type="disc">
                   2468:                   <li>
1.54      tv       2469:                     <p><span class=
1.57      minskim  2470:                     "strong"><strong>X11:</strong></span></p>
1.52      tv       2471: 
                   2472:                     <p>Interix comes with the standard set of X11R6
1.57      minskim  2473:                     client libraries, and can run X11 based
1.52      tv       2474:                     applications, but it does <span class=
                   2475:                     "emphasis"><em>not</em></span> come with an X
                   2476:                     server. Some options are <a href=
                   2477:                     "http://www.starnet.com/products/xwin32/"
                   2478:                     target="_top">StarNet X-Win32</a>, <a href=
                   2479:                     "http://connectivity.hummingbird.com/products/nc/exceed/"
1.57      minskim  2480:                     target="_top">Hummingbird Exceed</a> (available
                   2481:                     in a trimmed version for Interix from Interop
                   2482:                     Systems as the <a href=
                   2483:                     "http://www.interopsystems.com/InteropXserver.htm"
                   2484:                     target="_top">Interop X Server</a>), and the
                   2485:                     free X11 server included with <a href=
1.52      tv       2486:                     "http://x.cygwin.com/" target=
                   2487:                     "_top">Cygwin</a>.</p>
                   2488: 
                   2489:                     <p>Also, StarNet Communications has graciously
                   2490:                     provided a free version of their X-Win32
                   2491:                     product that accepts connections only from
                   2492:                     localhost: <a href=
                   2493:                     "http://www.starnet.com/xwin32LX/get_xwin32LX.htm"
                   2494:                     target="_top">X-Win32 LX</a>, recommended by
                   2495:                     the maintainer of Interix pkgsrc support.</p>
                   2496:                   </li>
                   2497: 
                   2498:                   <li>
1.57      minskim  2499:                     <p><span class="strong"><strong>X11
1.54      tv       2500:                     acceleration:</strong></span></p>
1.52      tv       2501: 
                   2502:                     <p>Because Interix runs in a completely
                   2503:                     different NT subsystem from Win32 applications,
                   2504:                     it does not currently support various X11
                   2505:                     protocol extensions for acceleration (such as
                   2506:                     MIT-SHM or DGA). Most interactive applications
                   2507:                     to a local X server will run reasonably fast,
                   2508:                     but full motion video and other graphics
                   2509:                     intensive applications may require a
                   2510:                     faster-than-expected CPU.</p>
                   2511:                   </li>
                   2512: 
                   2513:                   <li>
1.54      tv       2514:                     <p><span class=
                   2515:                     "strong"><strong>Audio:</strong></span></p>
1.52      tv       2516: 
                   2517:                     <p>Interix has no native support for audio
1.53      tv       2518:                     output. For audio support, pkgsrc uses the
                   2519:                     <span><strong class=
1.52      tv       2520:                     "command">esound</strong></span> client/server
                   2521:                     audio system on Interix. Unlike on most
                   2522:                     platforms, the <a xmlns=
                   2523:                     "http://www.w3.org/TR/xhtml1/transitional"
                   2524:                     href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/esound/README.html"
                   2525:                     target="_top"><code xmlns="" class=
                   2526:                     "filename">audio/esound</code></a> package does
                   2527:                     <span class="emphasis"><em>not</em></span>
                   2528:                     contain the <span><strong class=
1.53      tv       2529:                     "command">esd</strong></span> server component.
                   2530:                     To output audio via an Interix host, the
                   2531:                     <a xmlns=
1.52      tv       2532:                     "http://www.w3.org/TR/xhtml1/transitional"
                   2533:                     href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/cygwin_esound/README.html"
                   2534:                     target="_top"><code xmlns="" class=
                   2535:                     "filename">emulators/cygwin_esound</code></a>
                   2536:                     package must also be installed.</p>
                   2537:                   </li>
                   2538: 
                   2539:                   <li>
1.54      tv       2540:                     <p><span class="strong"><strong>CD/DVDs, USB,
                   2541:                     and SCSI:</strong></span></p>
1.52      tv       2542: 
                   2543:                     <p>Direct device access is not currently
                   2544:                     supported in Interix, so it is not currently
                   2545:                     possible to access CD/DVD drives, USB devices,
                   2546:                     or SCSI devices through non-filesystem means.
                   2547:                     Among other things, this makes it impossible to
                   2548:                     use Interix directly for CD/DVD burning.</p>
                   2549:                   </li>
                   2550: 
                   2551:                   <li>
1.54      tv       2552:                     <p><span class="strong"><strong>Tape
                   2553:                     drives:</strong></span></p>
1.52      tv       2554: 
                   2555:                     <p>Due to the same limitations as for CD-ROMs
                   2556:                     and SCSI devices, tape drives are also not
                   2557:                     directly accessible in Interix. However,
                   2558:                     support is in work to make tape drive access
                   2559:                     possible by using Cygwin as a bridge (similarly
                   2560:                     to audio bridged via Cygwin's esound
                   2561:                     server).</p>
                   2562:                   </li>
                   2563:                 </ul>
                   2564:               </div>
                   2565:             </div>
                   2566: 
1.67      hubertf  2567:             <div class="sect3" lang="en">
1.52      tv       2568:               <div class="titlepage">
                   2569:                 <div>
                   2570:                   <div>
                   2571:                     <h4 class="title"><a name=
                   2572:                     "platform.interix-knownissues"></a>3.2.3.5.&nbsp;Known
                   2573:                     issues for pkgsrc on Interix</h4>
                   2574:                   </div>
                   2575:                 </div>
                   2576:               </div>
                   2577: 
                   2578:               <p>It is not necessary, in general, to have a "root"
                   2579:               user on the Windows system; any member of the local
                   2580:               Administrators group will suffice. However, some
                   2581:               packages currently assume that the user named "root"
                   2582:               is the privileged user. To accommodate these, you may
                   2583:               create such a user; make sure it is in the local
                   2584:               group Administrators (or your language
                   2585:               equivalent).</p>
                   2586: 
                   2587:               <p>"pkg_add" creates directories of mode 0755, not
                   2588:               0775, in $PKG_DBDIR. For the time being, install
                   2589:               packages as the local Administrator (or your language
                   2590:               equivalent), or run the following command after
                   2591:               installing a package to work around the issue:</p>
                   2592:               <pre class="screen">
                   2593: <code class="prompt">#</code> <strong class=
                   2594: "userinput"><code>chmod -R g+w $PKG_DBDIR</code></strong>
                   2595: </pre>
                   2596:             </div>
1.1       grant    2597:           </div>
                   2598: 
1.67      hubertf  2599:           <div class="sect2" lang="en">
1.1       grant    2600:             <div class="titlepage">
                   2601:               <div>
                   2602:                 <div>
1.67      hubertf  2603:                   <h3 class="title"><a name=
1.30      wiz      2604:                   "irix"></a>3.2.4.&nbsp;IRIX</h3>
1.1       grant    2605:                 </div>
                   2606:               </div>
                   2607:             </div>
                   2608: 
                   2609:             <p>You will need a working C compiler, either gcc or
                   2610:             SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14      xtraeme  2611:             the <code class="varname">CC</code> environment
                   2612:             variable according to your preference. If you do not
                   2613:             have a license for the MIPSpro compiler suite, you can
1.1       grant    2614:             download a gcc tardist file from <a href=
                   2615:             "http://freeware.sgi.com/" target=
                   2616:             "_top">http://freeware.sgi.com/</a>.</p>
                   2617: 
                   2618:             <p>Please note that you will need IRIX 6.5.17 or
                   2619:             higher, as this is the earliest version of IRIX
1.24      wiz      2620:             providing support for <a href=
                   2621:             "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
                   2622:             <span class="citerefentry"><span class=
                   2623:             "refentrytitle">if_indextoname</span>(3)</span></a>,
                   2624:             <a href=
                   2625:             "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
                   2626:             <span class="citerefentry"><span class=
                   2627:             "refentrytitle">if_nametoindex</span>(3)</span></a>,
                   2628:             etc.</p>
1.1       grant    2629: 
1.27      rillig   2630:             <p>At this point in time, pkgsrc only supports one ABI
                   2631:             at a time. That is, you can not switch between the old
                   2632:             32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
                   2633:             you start out using "abi=n32", that's what all your
                   2634:             packages will be built with.</p>
1.1       grant    2635: 
                   2636:             <p>Therefore, please make sure that you have no
1.14      xtraeme  2637:             conflicting <code class="varname">CFLAGS</code> in your
1.45      wiz      2638:             environment or the <code xmlns=
                   2639:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2640:             "filename">/etc/mk.conf</code>. Particularly, make sure
1.1       grant    2641:             that you do not try to link n32 object files with lib64
1.45      wiz      2642:             or vice versa. Check your <code xmlns=
                   2643:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2644:             "filename">/etc/compiler.defaults</code>!</p>
1.1       grant    2645: 
                   2646:             <p>If you have the actual pkgsrc tree mounted via NFS
                   2647:             from a different host, please make sure to set
1.14      xtraeme  2648:             <code class="varname">WRKOBJDIR</code> to a local
1.1       grant    2649:             directory, as it appears that IRIX linker occasionally
1.47      reed     2650:             runs into issues when trying to link over a
                   2651:             network-mounted file system.</p>
1.1       grant    2652: 
                   2653:             <p>The bootstrapping process should set all the right
                   2654:             options for programs such as imake(1), but you may want
                   2655:             to set some options depending on your local setup.
1.45      wiz      2656:             Please see <code xmlns=
                   2657:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2658:             "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27      rillig   2659:             course, your compiler's man pages for details.</p>
1.22      tv       2660: 
                   2661:             <p>If you are using SGI's MIPSPro compiler, please
                   2662:             set</p>
                   2663:             <pre class="programlisting">
1.51      rillig   2664:     PKGSRC_COMPILER=        mipspro
1.22      tv       2665: </pre>
                   2666: 
1.45      wiz      2667:             <p>in <code xmlns=
                   2668:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   2669:             "filename">/etc/mk.conf</code>. Otherwise, pkgsrc will
                   2670:             assume you are using gcc and may end up passing invalid
                   2671:             flags to the compiler. Note that bootstrap should
                   2672:             create an appropriate <code xmlns=
                   2673:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2674:             "filename">mk.conf.example</code> by default.</p>
                   2675: 
                   2676:             <p>If you have both the MIPSPro compiler chain
                   2677:             installed as well as gcc, but want to make sure that
                   2678:             MIPRPro is used, please set your <code class=
                   2679:             "varname">PATH</code> to <span class=
                   2680:             "emphasis"><em>not</em></span> include the location of
1.45      wiz      2681:             gcc (often <code xmlns=
                   2682:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2683:             "filename">/usr/freeware/bin</code>), and (important)
                   2684:             pass the '--preserve-path' flag.</p>
1.1       grant    2685:           </div>
                   2686: 
1.67      hubertf  2687:           <div class="sect2" lang="en">
1.1       grant    2688:             <div class="titlepage">
                   2689:               <div>
                   2690:                 <div>
1.67      hubertf  2691:                   <h3 class="title"><a name=
1.30      wiz      2692:                   "linux"></a>3.2.5.&nbsp;Linux</h3>
1.22      tv       2693:                 </div>
                   2694:               </div>
                   2695:             </div>
                   2696: 
                   2697:             <p>Some versions of Linux (for example Debian
                   2698:             GNU/Linux) need either libtermcap or libcurses
                   2699:             (libncurses). Installing the distributions
                   2700:             libncurses-dev package (or equivalent) should fix the
                   2701:             problem.</p>
                   2702: 
                   2703:             <p>pkgsrc supports both gcc (GNU Compiler Collection)
                   2704:             and icc (Intel C++ Compiler). gcc is the default. icc
                   2705:             8.0 and 8.1 on i386 have been tested.</p>
                   2706: 
                   2707:             <p>To bootstrap using icc, assuming the default icc
                   2708:             installation directory:</p>
                   2709:             <pre class="programlisting">
1.51      rillig   2710:     env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
                   2711:             ac_cv___attribute__=yes ./bootstrap
1.22      tv       2712: </pre>
                   2713: 
                   2714:             <div class="note" style=
                   2715:             "margin-left: 0.5in; margin-right: 0.5in;">
                   2716:               <h3 class="title">Note</h3>
                   2717: 
                   2718:               <p>icc 8.1 needs the `-i-static' argument instead of
                   2719:               -static-libcxa.</p>
                   2720:             </div>
                   2721: 
                   2722:             <p>icc supports __attribute__, but the GNU configure
                   2723:             test uses a nested function, which icc does not
                   2724:             support. #undef'ing __attribute__ has the unfortunate
                   2725:             side-effect of breaking many of the Linux header files,
                   2726:             which cannot be compiled properly without
                   2727:             __attribute__. The test must be overridden so that
                   2728:             __attribute__ is assumed supported by the compiler.</p>
                   2729: 
                   2730:             <p>After bootstrapping, you should set <code class=
1.45      wiz      2731:             "varname">PKGSRC_COMPILER</code> in <code xmlns=
                   2732:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2733:             "filename">/etc/mk.conf</code>:</p>
                   2734:             <pre class="programlisting">
1.51      rillig   2735:     PKGSRC_COMPILER=        icc
1.22      tv       2736: </pre>
                   2737: 
                   2738:             <p>The default installation directory for icc is
1.45      wiz      2739:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2740:             class="filename">/opt/intel_cc_80</code>, which is also
                   2741:             the pkgsrc default. If you have installed it into a
                   2742:             different directory, set <code class=
                   2743:             "varname">ICCBASE</code> in <code xmlns=
                   2744:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2745:             "filename">/etc/mk.conf</code>:</p>
                   2746:             <pre class="programlisting">
1.51      rillig   2747:     ICCBASE=                /opt/icc
1.22      tv       2748: </pre>
                   2749: 
                   2750:             <p>pkgsrc uses the static linking method of the runtime
                   2751:             libraries provided by icc, so binaries can be run on
                   2752:             other systems which do not have the shared libraries
                   2753:             installed.</p>
                   2754: 
                   2755:             <p>Libtool, however, extracts a list of libraries from
1.24      wiz      2756:             the <a href=
                   2757:             "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   2758:             <span class="citerefentry"><span class=
                   2759:             "refentrytitle">ld</span>(1)</span></a> command run
                   2760:             when linking a C++ shared library and records it,
                   2761:             throwing away the -Bstatic and -Bdynamic options
                   2762:             interspersed between the libraries. This means that
                   2763:             libtool-linked C++ shared libraries will have a runtime
                   2764:             dependency on the icc libraries until this is fixed in
                   2765:             libtool.</p>
1.22      tv       2766:           </div>
                   2767: 
1.67      hubertf  2768:           <div class="sect2" lang="en">
1.22      tv       2769:             <div class="titlepage">
                   2770:               <div>
                   2771:                 <div>
1.67      hubertf  2772:                   <h3 class="title"><a name=
1.30      wiz      2773:                   "openbsd"></a>3.2.6.&nbsp;OpenBSD</h3>
1.1       grant    2774:                 </div>
                   2775:               </div>
                   2776:             </div>
                   2777: 
                   2778:             <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
                   2779: 
                   2780:             <p>Care should be taken so that the tools that this kit
                   2781:             installs do not conflict with the OpenBSD userland
                   2782:             tools. There are several steps:</p>
                   2783: 
                   2784:             <div class="orderedlist">
                   2785:               <ol type="1">
                   2786:                 <li>
                   2787:                   <p>OpenBSD stores its ports pkg database in
1.45      wiz      2788:                   <code xmlns=
                   2789:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   2790:                   "filename">/var/db/pkg</code>. It is therefore
                   2791:                   recommended that you choose a different location
                   2792:                   (e.g. <code xmlns=
                   2793:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2794:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2795:                   --pkgdbdir option to the bootstrap script.</p>
                   2796:                 </li>
                   2797: 
                   2798:                 <li>
                   2799:                   <p>If you do not intend to use the OpenBSD ports
                   2800:                   tools, it's probably a good idea to move them out
                   2801:                   of the way to avoid confusion, e.g.</p>
                   2802:                   <pre class="screen">
1.14      xtraeme  2803: <code class="prompt">#</code> <strong class=
                   2804: "userinput"><code>cd /usr/sbin</code></strong>
                   2805: <code class="prompt">#</code> <strong class=
                   2806: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2807: <code class="prompt">#</code> <strong class=
                   2808: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2809: <code class="prompt">#</code> <strong class=
                   2810: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2811: <code class="prompt">#</code> <strong class=
                   2812: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2813: </pre>
                   2814:                 </li>
                   2815: 
                   2816:                 <li>
1.45      wiz      2817:                   <p>An example <code xmlns=
                   2818:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2819:                   "filename">/etc/mk.conf</code> file will be
1.45      wiz      2820:                   placed in <code xmlns=
                   2821:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2822:                   "filename">/etc/mk.conf.example</code> file when
                   2823:                   you use the bootstrap script. OpenBSD's make
1.45      wiz      2824:                   program uses <code xmlns=
                   2825:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2826:                   "filename">/etc/mk.conf</code> as well. You can
1.47      reed     2827:                   work around this by enclosing all the
                   2828:                   pkgsrc-specific parts of the file with:</p>
1.1       grant    2829:                   <pre class="programlisting">
1.51      rillig   2830:     .ifdef BSD_PKG_MK
                   2831:     # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
                   2832:     .else
                   2833:     # OpenBSD stuff
                   2834:     .endif
1.1       grant    2835: </pre>
                   2836:                 </li>
                   2837:               </ol>
                   2838:             </div>
                   2839:           </div>
                   2840: 
1.67      hubertf  2841:           <div class="sect2" lang="en">
1.1       grant    2842:             <div class="titlepage">
                   2843:               <div>
                   2844:                 <div>
1.67      hubertf  2845:                   <h3 class="title"><a name=
1.30      wiz      2846:                   "solaris"></a>3.2.7.&nbsp;Solaris</h3>
1.1       grant    2847:                 </div>
                   2848:               </div>
                   2849:             </div>
                   2850: 
                   2851:             <p>Solaris 2.6 through 9 are supported on both x86 and
                   2852:             sparc. You will need a working C compiler. Both gcc
                   2853:             2.95.3 and Sun WorkShop 5 have been tested.</p>
                   2854: 
                   2855:             <p>The following packages are required on Solaris 8 for
                   2856:             the bootstrap process and to build packages.</p>
                   2857: 
                   2858:             <div class="itemizedlist">
                   2859:               <ul type="disc">
                   2860:                 <li>
                   2861:                   <p>SUNWsprot</p>
                   2862:                 </li>
                   2863: 
                   2864:                 <li>
                   2865:                   <p>SUNWarc</p>
                   2866:                 </li>
                   2867: 
                   2868:                 <li>
                   2869:                   <p>SUNWbtool</p>
                   2870:                 </li>
                   2871: 
                   2872:                 <li>
                   2873:                   <p>SUNWtoo</p>
                   2874:                 </li>
                   2875: 
                   2876:                 <li>
                   2877:                   <p>SUNWlibm</p>
                   2878:                 </li>
                   2879:               </ul>
                   2880:             </div>
                   2881: 
                   2882:             <p>Please note the use of GNU binutils on Solaris is
                   2883:             <span class="emphasis"><em>not</em></span>
                   2884:             supported.</p>
                   2885: 
1.67      hubertf  2886:             <div class="sect3" lang="en">
1.1       grant    2887:               <div class="titlepage">
                   2888:                 <div>
                   2889:                   <div>
1.67      hubertf  2890:                     <h4 class="title"><a name=
                   2891:                     "solaris-gcc-note"></a>3.2.7.1.&nbsp;If you are
                   2892:                     using gcc</h4>
1.1       grant    2893:                   </div>
                   2894:                 </div>
                   2895:               </div>
                   2896: 
                   2897:               <p>It makes life much simpler if you only use the
                   2898:               same gcc consistently for building all packages.</p>
                   2899: 
                   2900:               <p>It is recommended that an external gcc be used
                   2901:               only for bootstrapping, then either build gcc from
                   2902:               <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2903:               href=
                   2904:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.45      wiz      2905:               target="_top"><code xmlns="" class=
                   2906:               "filename">lang/gcc</code></a> or install a binary
                   2907:               gcc package, then remove gcc used during
1.20      ben      2908:               bootstrapping.</p>
1.1       grant    2909: 
                   2910:               <p>Binary packages of gcc can be found through
                   2911:               <a href=
                   2912:               "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20      ben      2913:               target=
                   2914:               "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1       grant    2915:             </div>
                   2916: 
1.67      hubertf  2917:             <div class="sect3" lang="en">
1.1       grant    2918:               <div class="titlepage">
                   2919:                 <div>
                   2920:                   <div>
1.30      wiz      2921:                     <h4 class="title"><a name=
                   2922:                     "solaris-sun-workshop-note"></a>3.2.7.2.&nbsp;If
                   2923:                     you are using Sun WorkShop</h4>
1.1       grant    2924:                   </div>
                   2925:                 </div>
                   2926:               </div>
                   2927: 
                   2928:               <p>You will need at least the following packages
                   2929:               installed (from WorkShop 5.0)</p>
                   2930: 
                   2931:               <div class="itemizedlist">
                   2932:                 <ul type="disc">
                   2933:                   <li>
                   2934:                     <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
                   2935:                   </li>
                   2936: 
                   2937:                   <li>
                   2938:                     <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
                   2939:                   </li>
                   2940: 
                   2941:                   <li>
                   2942:                     <p>SPROild - Sun WorkShop Incremental
                   2943:                     Linker</p>
                   2944:                   </li>
                   2945: 
                   2946:                   <li>
                   2947:                     <p>SPROlang - Sun WorkShop Compilers common
                   2948:                     components</p>
                   2949:                   </li>
                   2950:                 </ul>
                   2951:               </div>
                   2952: 
1.14      xtraeme  2953:               <p>You should set <code class="varname">CC</code>,
                   2954:               <code class="varname">CXX</code> and optionally,
1.45      wiz      2955:               <code class="varname">CPP</code> in <code xmlns=
                   2956:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     2957:               "filename">/etc/mk.conf</code>, e.g.:</p>
1.1       grant    2958:               <pre class="programlisting">
1.51      rillig   2959:     CC=     cc
                   2960:     CXX=    CC
                   2961:     CPP=    /usr/ccs/lib/cpp
1.1       grant    2962: </pre>
                   2963: 
                   2964:               <p>You may also want to build 64-bit binaries,
1.47      reed     2965:               e.g.:</p>
1.1       grant    2966:               <pre class="programlisting">
1.51      rillig   2967:     CFLAGS= -xtarget=ultra -xarch=v9
1.1       grant    2968: </pre>
                   2969: 
                   2970:               <p>Whichever compiler you use, please ensure the
                   2971:               compiler tools and your $prefix are in your
1.14      xtraeme  2972:               <code class="varname">PATH</code>. This includes
1.45      wiz      2973:               <code xmlns=
                   2974:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     2975:               "filename">/usr/ccs/{bin,lib}</code> and e.g.
1.45      wiz      2976:               <code xmlns=
                   2977:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2978:               "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1       grant    2979:             </div>
1.68      rillig   2980: 
                   2981:             <div class="sect3" lang="en">
                   2982:               <div class="titlepage">
                   2983:                 <div>
                   2984:                   <div>
                   2985:                     <h4 class="title"><a name=
                   2986:                     "plat.sunos.problems"></a>3.2.7.3.&nbsp;Common
                   2987:                     problems</h4>
                   2988:                   </div>
                   2989:                 </div>
                   2990:               </div>
                   2991: 
                   2992:               <p>Sometimes, when using <span><strong class=
                   2993:               "command">libtool</strong></span>, <code xmlns=
                   2994:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   2995:               "filename">/bin/ksh</code> crashes with a
                   2996:               segmentation fault. The workaround is to use another
                   2997:               shell for the configure scripts, for example by
                   2998:               installing <a xmlns=
                   2999:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   3000:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/bash/README.html"
                   3001:               target="_top"><code xmlns="" class=
                   3002:               "filename">shells/bash</code></a> and adding the
1.69    ! rillig   3003:               following lines to your <code xmlns=
1.68      rillig   3004:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   3005:               "filename">mk.conf</code>:</p>
                   3006:               <pre class="programlisting">
                   3007:     CONFIG_SHELL=   ${LOCALBASE}/bin/bash
1.69    ! rillig   3008:     WRAPPER_SHELL=  ${LOCALBASE}/bin/bash
1.68      rillig   3009: </pre>
                   3010:             </div>
1.1       grant    3011:           </div>
                   3012:         </div>
                   3013:       </div>
                   3014: 
1.67      hubertf  3015:       <div class="chapter" lang="en">
1.1       grant    3016:         <div class="titlepage">
                   3017:           <div>
                   3018:             <div>
1.67      hubertf  3019:               <h2 class="title"><a name=
1.1       grant    3020:               "using"></a>Chapter&nbsp;4.&nbsp;Using pkgsrc</h2>
                   3021:             </div>
                   3022:           </div>
                   3023:         </div>
                   3024: 
                   3025:         <div class="toc">
                   3026:           <p><b>Table of Contents</b></p>
                   3027: 
                   3028:           <dl>
                   3029:             <dt><span class="sect1"><a href="#getting-started">4.1.
                   3030:             Working with binary packages</a></span></dt>
                   3031: 
                   3032:             <dd>
                   3033:               <dl>
1.30      wiz      3034:                 <dt><span class="sect2"><a href=
                   3035:                 "#where-to-get-binary-packages">4.1.1. Where to get
                   3036:                 binary packages</a></span></dt>
1.1       grant    3037: 
1.30      wiz      3038:                 <dt><span class="sect2"><a href=
                   3039:                 "#how-to-use-binary-packages">4.1.2. How to use
                   3040:                 binary packages</a></span></dt>
1.1       grant    3041: 
1.30      wiz      3042:                 <dt><span class="sect2"><a href=
                   3043:                 "#a-word-of-warning">4.1.3. A word of
                   3044:                 warning</a></span></dt>
1.1       grant    3045:               </dl>
                   3046:             </dd>
                   3047: 
1.30      wiz      3048:             <dt><span class="sect1"><a href=
                   3049:             "#building-packages-from-source">4.2. Building packages
                   3050:             from source</a></span></dt>
1.1       grant    3051: 
                   3052:             <dd>
                   3053:               <dl>
1.30      wiz      3054:                 <dt><span class="sect2"><a href=
                   3055:                 "#requirements">4.2.1. Requirements</a></span></dt>
1.1       grant    3056: 
1.30      wiz      3057:                 <dt><span class="sect2"><a href=
                   3058:                 "#fetching-distfiles">4.2.2. Fetching
                   3059:                 distfiles</a></span></dt>
1.1       grant    3060: 
1.30      wiz      3061:                 <dt><span class="sect2"><a href=
                   3062:                 "#how-to-build-and-install">4.2.3. How to build and
                   3063:                 install</a></span></dt>
1.1       grant    3064: 
1.30      wiz      3065:                 <dt><span class="sect2"><a href=
                   3066:                 "#selecting-the-compiler">4.2.4. Selecting the
                   3067:                 compiler</a></span></dt>
1.1       grant    3068:               </dl>
                   3069:             </dd>
                   3070:           </dl>
                   3071:         </div>
                   3072: 
1.67      hubertf  3073:         <div class="sect1" lang="en">
1.1       grant    3074:           <div class="titlepage">
                   3075:             <div>
                   3076:               <div>
                   3077:                 <h2 class="title" style="clear: both"><a name=
                   3078:                 "getting-started"></a>4.1.&nbsp;Working with binary
                   3079:                 packages</h2>
                   3080:               </div>
                   3081:             </div>
                   3082:           </div>
                   3083: 
                   3084:           <p>This section describes how to find, retrieve and
                   3085:           install a precompiled binary package that someone else
                   3086:           already prepared for your type of machine.</p>
                   3087: 
1.67      hubertf  3088:           <div class="sect2" lang="en">
1.1       grant    3089:             <div class="titlepage">
                   3090:               <div>
                   3091:                 <div>
1.30      wiz      3092:                   <h3 class="title"><a name=
                   3093:                   "where-to-get-binary-packages"></a>4.1.1.&nbsp;Where
                   3094:                   to get binary packages</h3>
1.1       grant    3095:                 </div>
                   3096:               </div>
                   3097:             </div>
                   3098: 
                   3099:             <p>Precompiled packages are stored on ftp.NetBSD.org
1.45      wiz      3100:             and its mirrors in the directory <code xmlns=
                   3101:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   3102:             "filename">/pub/NetBSD/packages/&lt;OSVERSION&gt;/&lt;ARCH&gt;/</code>
                   3103:             for anonymous FTP access. <code class=
                   3104:             "varname">OSVERSION</code> is the NetBSD version
                   3105:             (<span><strong class="command">uname
                   3106:             -r</strong></span>), <code class="varname">ARCH</code>
                   3107:             is the architecture (<span><strong class=
                   3108:             "command">uname -p</strong></span>). In that directory,
                   3109:             there is a subdirectory for each category plus a
1.45      wiz      3110:             subdirectory <code xmlns=
                   3111:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3112:             "filename">All</code> which includes the actual
                   3113:             binaries in <code xmlns=
                   3114:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   3115:             "filename">.tgz</code> files. The category
                   3116:             subdirectories use symbolic links to those files (this
1.45      wiz      3117:             is the same directory layout as in <code xmlns=
                   3118:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3119:             "filename">/usr/pkgsrc/packages</code>).</p>
1.1       grant    3120: 
1.47      reed     3121:             <p>This same directory layout applies for CD-ROM
1.1       grant    3122:             distributions, only that the directory may be rooted
1.45      wiz      3123:             somewhere else, probably somewhere below <code xmlns=
                   3124:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     3125:             "filename">/cdrom</code>. Please consult your CD-ROMs
1.1       grant    3126:             documentation for the exact location.</p>
                   3127:           </div>
                   3128: 
1.67      hubertf  3129:           <div class="sect2" lang="en">
1.1       grant    3130:             <div class="titlepage">
                   3131:               <div>
                   3132:                 <div>
1.30      wiz      3133:                   <h3 class="title"><a name=
                   3134:                   "how-to-use-binary-packages"></a>4.1.2.&nbsp;How
                   3135:                   to use binary packages</h3>
1.1       grant    3136:                 </div>
                   3137:               </div>
                   3138:             </div>
                   3139: 
1.47      reed     3140:             <p>If you have the files on a CD-ROM or downloaded them
1.23      wiz      3141:             to your hard disk, you can install them with the
1.27      rillig   3142:             following command (be sure to <span><strong class=
1.14      xtraeme  3143:             "command">su</strong></span> to root first):</p>
1.1       grant    3144:             <pre class="screen">
1.14      xtraeme  3145: <code class="prompt">#</code> <strong class=
                   3146: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1       grant    3147: </pre>
                   3148: 
                   3149:             <p>If you have FTP access and you don't want to
                   3150:             download the packages via FTP prior to installation,
1.14      xtraeme  3151:             you can do this automatically by giving
                   3152:             <span><strong class="command">pkg_add</strong></span>
                   3153:             an FTP URL:</p>
1.1       grant    3154:             <pre class="screen">
1.14      xtraeme  3155: <code class="prompt">#</code> <strong class=
1.27      rillig   3156: "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    3157: </pre>
                   3158: 
1.27      rillig   3159:             <p>Note that any prerequisite packages needed to run
                   3160:             the package in question will be installed, too,
1.1       grant    3161:             assuming they are present where you install from.</p>
                   3162: 
1.23      wiz      3163:             <p>To save some typing, you can set the <code class=
                   3164:             "varname">PKG_PATH</code> environment variable to a
1.47      reed     3165:             semicolon-separated list of paths (including remote
1.23      wiz      3166:             URLs); trailing slashes are not allowed.</p>
                   3167: 
1.45      wiz      3168:             <p>Additionally to the <code xmlns=
                   3169:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.23      wiz      3170:             "filename">All</code> directory there exists a
1.45      wiz      3171:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3172:             class="filename">vulnerable</code> directory to which
                   3173:             binary packages with known vulnerabilities are moved,
                   3174:             since removing them could cause missing dependencies.
                   3175:             To use these packages, add the <code xmlns=
                   3176:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3177:             "filename">vulnerable</code> directory to your
                   3178:             <code class="varname">PKG_PATH</code>. However, you
                   3179:             should run <a xmlns=
1.23      wiz      3180:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   3181:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45      wiz      3182:             target="_top"><code xmlns="" class=
                   3183:             "filename">security/audit-packages</code></a>
1.47      reed     3184:             regularly, especially after installing new packages,
                   3185:             and verify that the vulnerabilities are acceptable for
                   3186:             your configuration. An example <code class=
                   3187:             "varname">PKG_PATH</code> would be: <code xmlns=
                   3188:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   3189:             "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      3190:             Please note that semicolon (';') is a shell
                   3191:             meta-character, so you'll probably have to quote
                   3192:             it.</p>
                   3193: 
1.1       grant    3194:             <p>After you've installed packages, be sure to have
1.45      wiz      3195:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3196:             class="filename">/usr/pkg/bin</code> and <code xmlns=
                   3197:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3198:             "filename">/usr/pkg/sbin</code> in your <code class=
                   3199:             "varname">PATH</code> so you can actually start the
                   3200:             just installed program.</p>
1.1       grant    3201:           </div>
                   3202: 
1.67      hubertf  3203:           <div class="sect2" lang="en">
1.1       grant    3204:             <div class="titlepage">
                   3205:               <div>
                   3206:                 <div>
1.67      hubertf  3207:                   <h3 class="title"><a name=
1.30      wiz      3208:                   "a-word-of-warning"></a>4.1.3.&nbsp;A word of
1.1       grant    3209:                   warning</h3>
                   3210:                 </div>
                   3211:               </div>
                   3212:             </div>
                   3213: 
                   3214:             <p>Please pay very careful attention to the warnings
                   3215:             expressed in the <a href=
                   3216:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3217:             <span class="citerefentry"><span class=
                   3218:             "refentrytitle">pkg_add</span>(1)</span></a> manual
                   3219:             page about the inherent dangers of installing binary
                   3220:             packages which you did not create yourself, and the
                   3221:             security holes that can be introduced onto your system
                   3222:             by indiscriminate adding of such files.</p>
1.66      rillig   3223: 
                   3224:             <p>The same warning of course applies to every package
                   3225:             you install from source when you haven't completely
                   3226:             read and understood the source code of the package, the
                   3227:             compiler that is used to build the package and all the
                   3228:             other tools that are involved.</p>
1.1       grant    3229:           </div>
                   3230:         </div>
                   3231: 
1.67      hubertf  3232:         <div class="sect1" lang="en">
1.1       grant    3233:           <div class="titlepage">
                   3234:             <div>
                   3235:               <div>
                   3236:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      3237:                 "building-packages-from-source"></a>4.2.&nbsp;Building
1.1       grant    3238:                 packages from source</h2>
                   3239:               </div>
                   3240:             </div>
                   3241:           </div>
                   3242: 
                   3243:           <p>This assumes that the package is already in pkgsrc. If
                   3244:           it is not, see <a href="#developers-guide" title=
1.46      gdt      3245:           "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">Part&nbsp;II,
1.27      rillig   3246:           &#8220;The pkgsrc developer's guide&#8221;</a> for
                   3247:           instructions how to create your own packages.</p>
1.1       grant    3248: 
1.67      hubertf  3249:           <div class="sect2" lang="en">
1.1       grant    3250:             <div class="titlepage">
                   3251:               <div>
                   3252:                 <div>
1.67      hubertf  3253:                   <h3 class="title"><a name=
1.30      wiz      3254:                   "requirements"></a>4.2.1.&nbsp;Requirements</h3>
1.1       grant    3255:                 </div>
                   3256:               </div>
                   3257:             </div>
                   3258: 
                   3259:             <p>To build packages from source on a NetBSD system the
                   3260:             &#8220;<span class="quote">comp</span>&#8221; and the
                   3261:             &#8220;<span class="quote">text</span>&#8221;
                   3262:             distribution sets must be installed. If you want to
1.47      reed     3263:             build X11-related packages the &#8220;<span class=
1.1       grant    3264:             "quote">xbase</span>&#8221; and &#8220;<span class=
                   3265:             "quote">xcomp</span>&#8221; distribution sets are
                   3266:             required, too.</p>
                   3267:           </div>
                   3268: 
1.67      hubertf  3269:           <div class="sect2" lang="en">
1.1       grant    3270:             <div class="titlepage">
                   3271:               <div>
                   3272:                 <div>
1.67      hubertf  3273:                   <h3 class="title"><a name=
                   3274:                   "fetching-distfiles"></a>4.2.2.&nbsp;Fetching
1.1       grant    3275:                   distfiles</h3>
                   3276:                 </div>
                   3277:               </div>
                   3278:             </div>
                   3279: 
1.27      rillig   3280:             <p>The first step for building a package is downloading
                   3281:             the distfiles (i.e. the unmodified source). If they
                   3282:             have not yet been downloaded, pkgsrc will fetch them
1.1       grant    3283:             automatically.</p>
                   3284: 
                   3285:             <p>You can overwrite some of the major distribution
                   3286:             sites to fit to sites that are close to your own. Have
1.45      wiz      3287:             a look at <code xmlns=
                   3288:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3289:             "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27      rillig   3290:             some examples &#8212; in particular, look for the
1.14      xtraeme  3291:             <code class="varname">MASTER_SORT</code>, <code class=
                   3292:             "varname">MASTER_SORT_REGEX</code> and <code class=
                   3293:             "varname">INET_COUNTRY</code> definitions. This may
                   3294:             save some of your bandwidth and time.</p>
1.1       grant    3295: 
                   3296:             <p>You can change these settings either in your shell's
                   3297:             environment, or, if you want to keep the settings, by
1.45      wiz      3298:             editing the <code xmlns=
                   3299:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3300:             "filename">/etc/mk.conf</code> file, and adding the
                   3301:             definitions there.</p>
1.1       grant    3302: 
                   3303:             <p>If you don't have a permanent Internet connection
                   3304:             and you want to know which files to download,
1.14      xtraeme  3305:             <span><strong class="command">make
                   3306:             fetch-list</strong></span> will tell you what you'll
1.45      wiz      3307:             need. Put these distfiles into <code xmlns=
                   3308:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3309:             "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    3310:           </div>
                   3311: 
1.67      hubertf  3312:           <div class="sect2" lang="en">
1.1       grant    3313:             <div class="titlepage">
                   3314:               <div>
                   3315:                 <div>
1.30      wiz      3316:                   <h3 class="title"><a name=
                   3317:                   "how-to-build-and-install"></a>4.2.3.&nbsp;How to
                   3318:                   build and install</h3>
1.1       grant    3319:                 </div>
                   3320:               </div>
                   3321:             </div>
                   3322: 
                   3323:             <p>Assuming that the distfile has been fetched (see
                   3324:             previous section), become root and change into the
1.47      reed     3325:             relevant directory and run <span><strong class=
                   3326:             "command">make</strong></span>.</p>
                   3327: 
                   3328:             <div class="note" style=
                   3329:             "margin-left: 0.5in; margin-right: 0.5in;">
                   3330:               <h3 class="title">Note</h3>
                   3331: 
                   3332:               <p>If using bootstrap or pkgsrc on a non-NetBSD
                   3333:               system, use the pkgsrc <span><strong class=
                   3334:               "command">bmake</strong></span> command instead of
                   3335:               &#8220;<span class="quote">make</span>&#8221; in the
                   3336:               examples in this guide.</p>
                   3337:             </div>
                   3338: 
                   3339:             <p>For example, type</p>
1.1       grant    3340:             <pre class="screen">
1.14      xtraeme  3341: <code class="prompt">%</code> <strong class=
                   3342: "userinput"><code>cd misc/figlet</code></strong>
                   3343: <code class="prompt">%</code> <strong class=
                   3344: "userinput"><code>make</code></strong>
1.1       grant    3345: </pre>
                   3346: 
                   3347:             <p>at the shell prompt to build the various components
                   3348:             of the package, and</p>
                   3349:             <pre class="screen">
1.14      xtraeme  3350: <code class="prompt">#</code> <strong class=
                   3351: "userinput"><code>make install</code></strong>
1.1       grant    3352: </pre>
                   3353: 
                   3354:             <p>to install the various components into the correct
                   3355:             places on your system. Installing the package on your
                   3356:             system requires you to be root. However, pkgsrc has a
                   3357:             <span class="emphasis"><em>just-in-time-su</em></span>
                   3358:             feature, which allows you to only become root for the
                   3359:             actual installation step</p>
                   3360: 
                   3361:             <p>Taking the figlet utility as an example, we can
                   3362:             install it on our system by building as shown in
                   3363:             <a href="#logs" title=
1.67      hubertf  3364:             "Appendix&nbsp;B.&nbsp;Build logs">Appendix&nbsp;B,
                   3365:             <i>Build logs</i></a>.</p>
1.1       grant    3366: 
                   3367:             <p>The program is installed under the default root of
1.45      wiz      3368:             the packages tree - <code xmlns=
                   3369:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3370:             "filename">/usr/pkg</code>. Should this not conform to
                   3371:             your tastes, set the <code class=
                   3372:             "varname">LOCALBASE</code> variable in your
1.1       grant    3373:             environment, and it will use that value as the root of
1.45      wiz      3374:             your packages tree. So, to use <code xmlns=
                   3375:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3376:             "filename">/usr/local</code>, set <code class=
                   3377:             "varname">LOCALBASE=/usr/local</code> in your
1.1       grant    3378:             environment. Please note that you should use a
                   3379:             directory which is dedicated to packages and not shared
1.47      reed     3380:             with other programs (i.e., do not try and use
1.14      xtraeme  3381:             <code class="varname">LOCALBASE=/usr</code>). Also, you
                   3382:             should not try to add any of your own files or
1.45      wiz      3383:             directories (such as <code xmlns=
                   3384:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3385:             "filename">src/</code>, <code xmlns=
                   3386:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3387:             "filename">obj/</code>, or <code xmlns=
                   3388:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3389:             "filename">pkgsrc/</code>) below the <code class=
                   3390:             "varname">LOCALBASE</code> tree. This is to prevent
1.1       grant    3391:             possible conflicts between programs and other files
                   3392:             installed by the package system and whatever else may
                   3393:             have been installed there.</p>
                   3394: 
1.45      wiz      3395:             <p>Some packages look in <code xmlns=
                   3396:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3397:             "filename">/etc/mk.conf</code> to alter some
1.1       grant    3398:             configuration options at build time. Have a look at
1.45      wiz      3399:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3400:             class="filename">pkgsrc/mk/defaults/mk.conf</code> to
                   3401:             get an overview of what will be set there by default.
1.14      xtraeme  3402:             Environment variables such as <code class=
1.45      wiz      3403:             "varname">LOCALBASE</code> can be set in <code xmlns=
                   3404:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3405:             "filename">/etc/mk.conf</code> to save having to
                   3406:             remember to set them each time you want to use
                   3407:             pkgsrc.</p>
1.1       grant    3408: 
                   3409:             <p>Occasionally, people want to &#8220;<span class=
                   3410:             "quote">look under the covers</span>&#8221; to see what
                   3411:             is going on when a package is building or being
                   3412:             installed. This may be for debugging purposes, or out
                   3413:             of simple curiosity. A number of utility values have
                   3414:             been added to help with this.</p>
                   3415: 
                   3416:             <div class="orderedlist">
                   3417:               <ol type="1">
                   3418:                 <li>
                   3419:                   <p>If you invoke the <a href=
                   3420:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   3421:                   <span class="citerefentry"><span class=
                   3422:                   "refentrytitle">make</span>(1)</span></a> command
1.14      xtraeme  3423:                   with <code class=
                   3424:                   "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
                   3425:                   amount of information will be displayed. For
                   3426:                   example,</p>
1.1       grant    3427:                   <pre class="screen">
1.14      xtraeme  3428: <strong class=
                   3429: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1       grant    3430: </pre>
                   3431: 
                   3432:                   <p>will show all the commands that are invoked,
                   3433:                   up to and including the &#8220;<span class=
                   3434:                   "quote">patch</span>&#8221; stage.</p>
                   3435:                 </li>
                   3436: 
                   3437:                 <li>
                   3438:                   <p>If you want to know the value of a certain
1.22      tv       3439:                   <a href=
                   3440:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   3441:                   <span class="citerefentry"><span class=
                   3442:                   "refentrytitle">make</span>(1)</span></a>
                   3443:                   definition, then the <code class=
1.14      xtraeme  3444:                   "varname">VARNAME</code> definition should be
                   3445:                   used, in conjunction with the show-var target.
                   3446:                   e.g. to show the expansion of the <a href=
1.1       grant    3447:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   3448:                   <span class="citerefentry"><span class=
                   3449:                   "refentrytitle">make</span>(1)</span></a>
1.14      xtraeme  3450:                   variable <code class=
1.22      tv       3451:                   "varname">LOCALBASE</code>:</p>
1.1       grant    3452:                   <pre class="screen">
1.14      xtraeme  3453: <code class="prompt">%</code> <strong class=
                   3454: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1       grant    3455: /usr/pkg
1.14      xtraeme  3456: <code class="prompt">%</code>
1.1       grant    3457:           
                   3458: </pre>
                   3459:                 </li>
                   3460:               </ol>
                   3461:             </div>
                   3462: 
                   3463:             <p>If you want to install a binary package that you've
                   3464:             either created yourself (see next section), that you
                   3465:             put into pkgsrc/packages manually or that is located on
1.8       wiz      3466:             a remote FTP server, you can use the "bin-install"
1.1       grant    3467:             target. This target will install a binary package - if
                   3468:             available - via <a href=
                   3469:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3470:             <span class="citerefentry"><span class=
                   3471:             "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14      xtraeme  3472:             <span><strong class="command">make
                   3473:             package</strong></span>. The list of remote FTP sites
                   3474:             searched is kept in the variable <code class=
                   3475:             "varname">BINPKG_SITES</code>, which defaults to
                   3476:             ftp.NetBSD.org. Any flags that should be added to
                   3477:             <a href=
1.1       grant    3478:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3479:             <span class="citerefentry"><span class=
                   3480:             "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14      xtraeme  3481:             into <code class="varname">BIN_INSTALL_FLAGS</code>.
1.45      wiz      3482:             See <code xmlns=
                   3483:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3484:             "filename">pkgsrc/mk/defaults/mk.conf</code> for more
                   3485:             details.</p>
1.1       grant    3486: 
1.47      reed     3487:             <p>A final word of warning: If you set up a system that
1.14      xtraeme  3488:             has a non-standard setting for <code class=
                   3489:             "varname">LOCALBASE</code>, be sure to set that before
1.1       grant    3490:             any packages are installed, as you can not use several
                   3491:             directories for the same purpose. Doing so will result
                   3492:             in pkgsrc not being able to properly detect your
                   3493:             installed packages, and fail miserably. Note also that
                   3494:             precompiled binary packages are usually built with the
1.14      xtraeme  3495:             default <code class="varname">LOCALBASE</code> of
1.45      wiz      3496:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3497:             class="filename">/usr/pkg</code>, and that you should
                   3498:             <span class="emphasis"><em>not</em></span> install any
                   3499:             if you use a non-standard <code class=
1.14      xtraeme  3500:             "varname">LOCALBASE</code>.</p>
1.1       grant    3501:           </div>
                   3502: 
1.67      hubertf  3503:           <div class="sect2" lang="en">
1.1       grant    3504:             <div class="titlepage">
                   3505:               <div>
                   3506:                 <div>
1.30      wiz      3507:                   <h3 class="title"><a name=
                   3508:                   "selecting-the-compiler"></a>4.2.4.&nbsp;Selecting
                   3509:                   the compiler</h3>
1.1       grant    3510:                 </div>
                   3511:               </div>
                   3512:             </div>
                   3513: 
                   3514:             <p>By default, pkgsrc will use GCC to build packages.
                   3515:             This may be overridden by setting the following
                   3516:             variables in /etc/mk.conf:</p>
                   3517: 
                   3518:             <div class="variablelist">
                   3519:               <dl>
1.14      xtraeme  3520:                 <dt><span class="term"><code class=
                   3521:                 "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1       grant    3522: 
                   3523:                 <dd>
                   3524:                   <p>This is a list of values specifying the chain
                   3525:                   of compilers to invoke when building packages.
                   3526:                   Valid values are:</p>
                   3527: 
                   3528:                   <div class="itemizedlist">
                   3529:                     <ul type="disc">
                   3530:                       <li>
1.14      xtraeme  3531:                         <p><code class="varname">distcc</code>:
1.1       grant    3532:                         distributed C/C++ (chainable)</p>
                   3533:                       </li>
                   3534: 
                   3535:                       <li>
1.14      xtraeme  3536:                         <p><code class="varname">ccache</code>:
1.1       grant    3537:                         compiler cache (chainable)</p>
                   3538:                       </li>
                   3539: 
                   3540:                       <li>
1.14      xtraeme  3541:                         <p><code class="varname">gcc</code>: GNU
                   3542:                         C/C++ Compiler</p>
1.1       grant    3543:                       </li>
                   3544: 
                   3545:                       <li>
1.14      xtraeme  3546:                         <p><code class="varname">mipspro</code>:
1.1       grant    3547:                         Silicon Graphics, Inc. MIPSpro
                   3548:                         (n32/n64)</p>
                   3549:                       </li>
                   3550: 
                   3551:                       <li>
1.14      xtraeme  3552:                         <p><code class="varname">mipspro</code>:
1.1       grant    3553:                         Silicon Graphics, Inc. MIPSpro (o32)</p>
                   3554:                       </li>
                   3555: 
                   3556:                       <li>
1.64      kim      3557:                         <p><code class="varname">sunpro</code>: Sun
1.1       grant    3558:                         Microsystems, Inc. WorkShip/Forte/Sun ONE
                   3559:                         Studio</p>
                   3560:                       </li>
                   3561:                     </ul>
                   3562:                   </div>
                   3563: 
                   3564:                   <p>The default is &#8220;<span class=
1.14      xtraeme  3565:                   "quote"><code class=
                   3566:                   "varname">gcc</code></span>&#8221;. You can use
                   3567:                   <code class="varname">ccache</code> and/or
                   3568:                   <code class="varname">distcc</code> with an
                   3569:                   appropriate <code class=
                   3570:                   "varname">PKGSRC_COMPILER</code> setting, e.g.
                   3571:                   &#8220;<span class="quote"><code class=
                   3572:                   "varname">ccache gcc</code></span>&#8221;. This
1.1       grant    3573:                   variable should always be terminated with a value
                   3574:                   for a real compiler.</p>
                   3575:                 </dd>
                   3576: 
1.14      xtraeme  3577:                 <dt><span class="term"><code class=
                   3578:                 "varname">GCC_REQD</code>:</span></dt>
1.1       grant    3579: 
                   3580:                 <dd>
                   3581:                   <p>This specifies the minimum version of GCC to
                   3582:                   use when building packages. If the system GCC
                   3583:                   doesn't satisfy this requirement, then pkgsrc
                   3584:                   will build and install one of the GCC packages to
                   3585:                   use instead.</p>
                   3586:                 </dd>
                   3587:               </dl>
                   3588:             </div>
                   3589:           </div>
                   3590:         </div>
                   3591:       </div>
                   3592: 
1.67      hubertf  3593:       <div class="chapter" lang="en">
1.1       grant    3594:         <div class="titlepage">
                   3595:           <div>
                   3596:             <div>
1.67      hubertf  3597:               <h2 class="title"><a name=
1.38      dillo    3598:               "configuring"></a>Chapter&nbsp;5.&nbsp;Configuring
                   3599:               pkgsrc</h2>
                   3600:             </div>
                   3601:           </div>
                   3602:         </div>
                   3603: 
                   3604:         <div class="toc">
                   3605:           <p><b>Table of Contents</b></p>
                   3606: 
                   3607:           <dl>
                   3608:             <dt><span class="sect1"><a href=
1.45      wiz      3609:             "#general-configuration">5.1. General
                   3610:             configuration</a></span></dt>
                   3611: 
                   3612:             <dt><span class="sect1"><a href=
                   3613:             "#variables-affecting-build">5.2. Variables affecting
                   3614:             the build process</a></span></dt>
                   3615: 
                   3616:             <dt><span class="sect1"><a href=
                   3617:             "#developer-advanced-settings">5.3. Developer/advanced
                   3618:             settings</a></span></dt>
                   3619: 
                   3620:             <dt><span class="sect1"><a href=
                   3621:             "#selecting-build-options">5.4. Selecting Build
1.42      dillo    3622:             Options</a></span></dt>
1.38      dillo    3623:           </dl>
                   3624:         </div>
                   3625: 
1.67      hubertf  3626:         <div class="sect1" lang="en">
1.38      dillo    3627:           <div class="titlepage">
                   3628:             <div>
                   3629:               <div>
                   3630:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      3631:                 "general-configuration"></a>5.1.&nbsp;General
                   3632:                 configuration</h2>
                   3633:               </div>
                   3634:             </div>
                   3635:           </div>
                   3636: 
1.47      reed     3637:           <p>In this section, you can find some variables that
                   3638:           apply to all pkgsrc packages. The preferred method of
                   3639:           setting these variables is by setting them in
                   3640:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3641:           class="filename">/etc/mk.conf</code>.</p>
1.45      wiz      3642: 
                   3643:           <div class="itemizedlist">
                   3644:             <ul type="disc">
                   3645:               <li>
                   3646:                 <p><code class="varname">LOCALBASE</code>: Where
                   3647:                 packages will be installed. The default is
                   3648:                 <code xmlns=
                   3649:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3650:                 "filename">/usr/pkg</code>. Do not mix binary
                   3651:                 packages with different <code class=
                   3652:                 "varname">LOCALBASE</code>s!</p>
                   3653:               </li>
                   3654: 
                   3655:               <li>
                   3656:                 <p><code class="varname">CROSSBASE</code>: Where
                   3657:                 &#8220;<span class="quote">cross</span>&#8221;
                   3658:                 category packages will be installed. The default is
                   3659:                 <code xmlns=
                   3660:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3661:                 "filename">${LOCALBASE}/cross</code>.</p>
                   3662:               </li>
                   3663: 
                   3664:               <li>
                   3665:                 <p><code class="varname">X11BASE</code>: Where X11
                   3666:                 is installed on the system. The default is
                   3667:                 <code xmlns=
                   3668:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3669:                 "filename">/usr/X11R6</code>.</p>
                   3670:               </li>
                   3671: 
                   3672:               <li>
                   3673:                 <p><code class="varname">DISTDIR</code>: Where to
                   3674:                 store the downloaded copies of the original source
                   3675:                 distributions used for building pkgsrc packages.
                   3676:                 The default is <code xmlns=
                   3677:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3678:                 "filename">${PKGSRCDIR}/distfiles</code>.</p>
                   3679:               </li>
                   3680: 
                   3681:               <li>
                   3682:                 <p><code class=
                   3683:                 "varname">MASTER_SITE_OVERRIDE</code>: If set,
                   3684:                 override the packages' <code class=
                   3685:                 "varname">MASTER_SITES</code> with this value.</p>
                   3686:               </li>
                   3687: 
                   3688:               <li>
                   3689:                 <p><code class="varname">MASTER_SITE_BACKUP</code>:
                   3690:                 Backup location(s) for distribution files and patch
                   3691:                 files if not found locally or in <code xmlns=
                   3692:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3693:                 "filename">${MASTER_SITES}</code> or <code xmlns=
                   3694:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3695:                 "filename">${PATCH_SITES}</code> respectively. The
                   3696:                 defaults are <code xmlns=
                   3697:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3698:                 "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/${DIST_SUBDIR}/</code>
                   3699:                 and <code xmlns=
                   3700:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3701:                 "filename">ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/</code>.</p>
                   3702:               </li>
                   3703: 
                   3704:               <li>
                   3705:                 <p><code class="varname">BINPKG_SITES</code>: List
                   3706:                 of sites carrying binary pkgs.</p>
                   3707:               </li>
                   3708:             </ul>
                   3709:           </div>
                   3710:         </div>
                   3711: 
1.67      hubertf  3712:         <div class="sect1" lang="en">
1.45      wiz      3713:           <div class="titlepage">
                   3714:             <div>
                   3715:               <div>
                   3716:                 <h2 class="title" style="clear: both"><a name=
                   3717:                 "variables-affecting-build"></a>5.2.&nbsp;Variables
                   3718:                 affecting the build process</h2>
                   3719:               </div>
                   3720:             </div>
                   3721:           </div>
                   3722: 
                   3723:           <p>XXX</p>
                   3724: 
                   3725:           <div class="itemizedlist">
                   3726:             <ul type="disc">
                   3727:               <li>
                   3728:                 <p><code class="varname">PACKAGES</code>: The top
                   3729:                 level directory for the binary packages. The
                   3730:                 default is <code xmlns=
                   3731:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3732:                 "filename">${PKGSRCDIR}/packages</code>.</p>
                   3733:               </li>
                   3734: 
                   3735:               <li>
                   3736:                 <p><code class="varname">WRKOBJDIR</code>: The top
                   3737:                 level directory where, if defined, the separate
                   3738:                 working directories will get created, and
                   3739:                 symbolically linked to from <code xmlns=
                   3740:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3741:                 "filename">${WRKDIR}</code> (see below). This is
                   3742:                 useful for building packages on several
                   3743:                 architectures, then <code xmlns=
                   3744:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3745:                 "filename">${PKGSRCDIR}</code> can be NFS-mounted
                   3746:                 while <code xmlns=
                   3747:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3748:                 "filename">${WRKOBJDIR}</code> is local to every
                   3749:                 architecture. (It should be noted that <code class=
                   3750:                 "varname">PKGSRCDIR</code> should not be set by the
                   3751:                 user &#8212; it is an internal definition which
                   3752:                 refers to the root of the pkgsrc tree. It is
                   3753:                 possible to have many pkgsrc tree instances.)</p>
                   3754:               </li>
                   3755: 
                   3756:               <li>
                   3757:                 <p><code class="varname">LOCALPATCHES</code>:
                   3758:                 Directory for local patches that aren't part of
                   3759:                 pkgsrc. See <a href="#components.patches" title=
                   3760:                 "8.3.&nbsp;patches/*">Section&nbsp;8.3,
                   3761:                 &#8220;patches/*&#8221;</a> for more information.
                   3762:                 <em class="replaceable"><code>rel</code></em> and
                   3763:                 <em class="replaceable"><code>arch</code></em> are
                   3764:                 replaced with OS release (&#8220;<span class=
                   3765:                 "quote">2.0</span>&#8221;, etc.) and architecture
                   3766:                 (&#8220;<span class="quote">mipsel</span>&#8221;,
                   3767:                 etc.).</p>
                   3768:               </li>
                   3769: 
                   3770:               <li>
                   3771:                 <p><code class="varname">PKGMAKECONF</code>:
                   3772:                 Location of the <code xmlns=
                   3773:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3774:                 "filename">mk.conf</code> file used by a package's
                   3775:                 BSD-style Makefile. If this is not set,
                   3776:                 <code class="varname">MAKECONF</code> is set to
                   3777:                 <code xmlns=
                   3778:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3779:                 "filename">/dev/null</code> to avoid picking up
                   3780:                 settings used by builds in <code xmlns=
                   3781:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3782:                 "filename">/usr/src</code>.</p>
                   3783:               </li>
                   3784:             </ul>
                   3785:           </div>
                   3786:         </div>
                   3787: 
1.67      hubertf  3788:         <div class="sect1" lang="en">
1.45      wiz      3789:           <div class="titlepage">
                   3790:             <div>
                   3791:               <div>
                   3792:                 <h2 class="title" style="clear: both"><a name=
                   3793:                 "developer-advanced-settings"></a>5.3.&nbsp;Developer/advanced
                   3794:                 settings</h2>
                   3795:               </div>
                   3796:             </div>
                   3797:           </div>
                   3798: 
                   3799:           <p>XXX</p>
                   3800: 
                   3801:           <div class="itemizedlist">
                   3802:             <ul type="disc">
                   3803:               <li>
                   3804:                 <p><code class="varname">PKG_DEVELOPER</code>: Run
                   3805:                 some sanity checks that package developers
                   3806:                 want:</p>
                   3807: 
                   3808:                 <div class="itemizedlist">
                   3809:                   <ul type="circle">
                   3810:                     <li>
                   3811:                       <p>make sure patches apply with zero fuzz</p>
                   3812:                     </li>
                   3813: 
                   3814:                     <li>
                   3815:                       <p>run check-shlibs to see that all binaries
                   3816:                       will find their shared libs.</p>
                   3817:                     </li>
                   3818:                   </ul>
                   3819:                 </div>
                   3820:               </li>
                   3821: 
                   3822:               <li>
                   3823:                 <p><code class="varname">PKG_DEBUG_LEVEL</code>:
                   3824:                 The level of debugging output which is displayed
                   3825:                 whilst making and installing the package. The
                   3826:                 default value for this is 0, which will not display
                   3827:                 the commands as they are executed (normal, default,
                   3828:                 quiet operation); the value 1 will display all
                   3829:                 shell commands before their invocation, and the
                   3830:                 value 2 will display both the shell commands before
                   3831:                 their invocation, and their actual execution
                   3832:                 progress with <span><strong class="command">set
                   3833:                 -x</strong></span> will be displayed.</p>
                   3834:               </li>
1.58      erh      3835: 
                   3836:               <li>
                   3837:                 <p><code class=
                   3838:                 "varname">ALLOW_VULNERABILITIES.<em class=
                   3839:                 "replaceable"><code>pkgbase</code></em></code>: A
                   3840:                 space separated list of vulnerability IDs that may
                   3841:                 be ignored when performing the automated security
                   3842:                 checks. These IDs are listed in the
                   3843:                 pkg-vulnerabilities file and are displayed by
                   3844:                 <span><strong class=
                   3845:                 "command">audit-packages</strong></span> when it
                   3846:                 finds a vulnerable package.</p>
                   3847:               </li>
                   3848: 
                   3849:               <li>
                   3850:                 <p><code class=
                   3851:                 "varname">SKIP_AUDIT_PACKAGES</code>: If this is
                   3852:                 set to &#8220;<span class=
                   3853:                 "quote">yes</span>&#8221;, the automated security
                   3854:                 checks (which use the <a xmlns=
                   3855:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3856:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
                   3857:                 target="_top"><code xmlns="" class=
                   3858:                 "filename">security/audit-packages</code></a>
                   3859:                 package) will be <span class=
                   3860:                 "strong"><strong>entirely</strong></span> skipped
                   3861:                 for <span class=
                   3862:                 "strong"><strong>all</strong></span> packages
                   3863:                 built. Normally you'll want to use
                   3864:                 ALLOW_VULNERABILITIES instead of this.</p>
                   3865:               </li>
1.45      wiz      3866:             </ul>
                   3867:           </div>
                   3868:         </div>
                   3869: 
1.67      hubertf  3870:         <div class="sect1" lang="en">
1.45      wiz      3871:           <div class="titlepage">
                   3872:             <div>
                   3873:               <div>
                   3874:                 <h2 class="title" style="clear: both"><a name=
                   3875:                 "selecting-build-options"></a>5.4.&nbsp;Selecting
                   3876:                 Build Options</h2>
1.38      dillo    3877:               </div>
                   3878:             </div>
                   3879:           </div>
                   3880: 
                   3881:           <p>Some packages have build time options, usually to
                   3882:           select between different dependencies, enable optional
                   3883:           support for big dependencies or enable experimental
                   3884:           features.</p>
                   3885: 
                   3886:           <p>To see which options, if any, a package supports, and
                   3887:           which options are mutually exclusive, run
                   3888:           <span><strong class="command">make
                   3889:           show-options</strong></span>, for example:</p>
                   3890:           <pre class="programlisting">
1.51      rillig   3891:     The following options are supported by this package:
                   3892:     ssl      Enable SSL support.
                   3893:     Exactly one of the following gecko options is required:
                   3894:     firefox  Use firefox as gecko rendering engine.
                   3895:     mozilla  Use mozilla as gecko rendering engine.
                   3896:     At most one of the following database options may be selected:
                   3897:     mysql    Enable support for MySQL database.
                   3898:     pgsql    Enable support for PostgreSQL database.
                   3899: 
                   3900:     These options are enabled by default: firefox
                   3901:     These options are currently enabled: mozilla ssl
1.38      dillo    3902: </pre>
                   3903: 
1.45      wiz      3904:           <p>The following variables can be defined in <code xmlns=
                   3905:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.38      dillo    3906:           "filename">/etc/mk.conf</code> to select which options to
                   3907:           enable for a package: <code class=
                   3908:           "varname">PKG_DEFAULT_OPTIONS</code>, which can be used
                   3909:           to select or disable options for all packages that
                   3910:           support them, and <code class=
                   3911:           "varname">PKG_OPTIONS.<em class=
                   3912:           "replaceable"><code>pkgbase</code></em></code>, which can
                   3913:           be used to select or disable options specifically for
                   3914:           package <em class=
                   3915:           "replaceable"><code>pkgbase</code></em>. Options listed
                   3916:           in these variables are selected, options preceded by
1.67      hubertf  3917:           &#8220;<span class="quote">-</span>&#8221; are disabled.
                   3918:           A few examples:</p>
                   3919:           <pre class="screen">
                   3920: <code class="prompt">$</code> <span><strong class=
                   3921: "command">grep "PKG.*OPTION" /etc/mk.conf</strong></span>
1.68      rillig   3922: PKG_DEFAULT_OPTIONS=    -arts -dvdread -esound
1.67      hubertf  3923: PKG_OPTIONS.kdebase=    debug -sasl
                   3924: PKG_OPTIONS.apache=     suexec 
                   3925: </pre>
1.38      dillo    3926: 
1.39      dillo    3927:           <p>The following settings are consulted in the order
                   3928:           given, and the last setting that selects or disables an
                   3929:           option is used:</p>
1.38      dillo    3930: 
                   3931:           <div class="orderedlist">
                   3932:             <ol type="1">
                   3933:               <li>
                   3934:                 <p>the default options as suggested by the package
                   3935:                 maintainer</p>
                   3936:               </li>
                   3937: 
                   3938:               <li>
                   3939:                 <p>the options implied by the settings of legacy
                   3940:                 variables (see below)</p>
                   3941:               </li>
                   3942: 
                   3943:               <li>
                   3944:                 <p><code class=
                   3945:                 "varname">PKG_DEFAULT_OPTIONS</code></p>
                   3946:               </li>
                   3947: 
                   3948:               <li>
                   3949:                 <p><code class="varname">PKG_OPTIONS.<em class=
                   3950:                 "replaceable"><code>pkgbase</code></em></code></p>
                   3951:               </li>
                   3952:             </ol>
                   3953:           </div>
                   3954: 
                   3955:           <p>For groups of mutually exclusive options, the last
                   3956:           option selected is used, all others are automatically
                   3957:           disabled. If an option of the group is explicitly
                   3958:           disabled, the previously selected option, if any, is
                   3959:           used. It is an error if no option from a required group
                   3960:           of options is selected, and building the package will
                   3961:           fail.</p>
                   3962: 
                   3963:           <p>Before the options framework was introduced, build
1.65      hubertf  3964:           options were selected by setting a variable (often named
                   3965:           <code class="varname">USE_<em class=
                   3966:           "replaceable"><code>FOO</code></em></code>) in
1.45      wiz      3967:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3968:           class="filename">/etc/mk.conf</code> for each option. To
                   3969:           ease transition to the options framework for the user,
                   3970:           these legacy variables are converted to the appropriate
1.65      hubertf  3971:           options setting (<code class=
                   3972:           "varname">PKG_OPTIONS.<em class=
                   3973:           "replaceable"><code>pkgbase</code></em></code>)
                   3974:           automatically. A warning is issued to prompt the user to
                   3975:           update <code xmlns=
1.45      wiz      3976:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.38      dillo    3977:           "filename">/etc/mk.conf</code> to use the options
1.65      hubertf  3978:           framework directly. Support for the legacy variables will
                   3979:           be removed eventually.</p>
1.38      dillo    3980:         </div>
                   3981:       </div>
                   3982: 
1.67      hubertf  3983:       <div class="chapter" lang="en">
1.38      dillo    3984:         <div class="titlepage">
                   3985:           <div>
                   3986:             <div>
1.67      hubertf  3987:               <h2 class="title"><a name=
1.38      dillo    3988:               "binary"></a>Chapter&nbsp;6.&nbsp;Creating binary
1.1       grant    3989:               packages</h2>
                   3990:             </div>
                   3991:           </div>
                   3992:         </div>
                   3993: 
                   3994:         <div class="toc">
                   3995:           <p><b>Table of Contents</b></p>
                   3996: 
                   3997:           <dl>
1.30      wiz      3998:             <dt><span class="sect1"><a href=
1.38      dillo    3999:             "#building-a-single-binary-package">6.1. Building a
1.30      wiz      4000:             single binary package</a></span></dt>
1.1       grant    4001: 
1.30      wiz      4002:             <dt><span class="sect1"><a href=
1.38      dillo    4003:             "#settings-for-creationg-of-binary-packages">6.2.
1.1       grant    4004:             Settings for creation of binary
                   4005:             packages</a></span></dt>
                   4006: 
1.38      dillo    4007:             <dt><span class="sect1"><a href="#bulkbuild">6.3. Doing
1.1       grant    4008:             a bulk build of all packages</a></span></dt>
                   4009: 
                   4010:             <dd>
                   4011:               <dl>
                   4012:                 <dt><span class="sect2"><a href=
1.38      dillo    4013:                 "#binary.configuration">6.3.1.
1.1       grant    4014:                 Configuration</a></span></dt>
                   4015: 
1.30      wiz      4016:                 <dt><span class="sect2"><a href=
1.38      dillo    4017:                 "#other-environmental-considerations">6.3.2. Other
1.30      wiz      4018:                 environmental considerations</a></span></dt>
1.1       grant    4019: 
1.38      dillo    4020:                 <dt><span class="sect2"><a href="#operation">6.3.3.
1.1       grant    4021:                 Operation</a></span></dt>
                   4022: 
1.30      wiz      4023:                 <dt><span class="sect2"><a href=
1.38      dillo    4024:                 "#what-it-does">6.3.4. What it does</a></span></dt>
1.1       grant    4025: 
1.30      wiz      4026:                 <dt><span class="sect2"><a href=
1.38      dillo    4027:                 "#disk-space-requirements">6.3.5. Disk space
1.30      wiz      4028:                 requirements</a></span></dt>
1.1       grant    4029: 
1.30      wiz      4030:                 <dt><span class="sect2"><a href=
1.38      dillo    4031:                 "#setting-up-a-sandbox">6.3.6. Setting up a sandbox
1.47      reed     4032:                 for chrooted builds</a></span></dt>
1.1       grant    4033: 
1.30      wiz      4034:                 <dt><span class="sect2"><a href=
1.38      dillo    4035:                 "#building-a-partial-set">6.3.7. Building a partial
1.30      wiz      4036:                 set of packages</a></span></dt>
1.13      hubertf  4037: 
                   4038:                 <dt><span class="sect2"><a href=
1.38      dillo    4039:                 "#bulk-upload">6.3.8. Uploading results of a bulk
1.13      hubertf  4040:                 build</a></span></dt>
1.1       grant    4041:               </dl>
                   4042:             </dd>
                   4043: 
1.38      dillo    4044:             <dt><span class="sect1"><a href="#creating-cdroms">6.4.
1.1       grant    4045:             Creating a multiple CD-ROM packages
                   4046:             collection</a></span></dt>
                   4047: 
                   4048:             <dd>
                   4049:               <dl>
1.30      wiz      4050:                 <dt><span class="sect2"><a href=
1.38      dillo    4051:                 "#cdpack-example">6.4.1. Example of
1.30      wiz      4052:                 cdpack</a></span></dt>
1.1       grant    4053:               </dl>
                   4054:             </dd>
                   4055:           </dl>
                   4056:         </div>
                   4057: 
1.67      hubertf  4058:         <div class="sect1" lang="en">
1.1       grant    4059:           <div class="titlepage">
                   4060:             <div>
                   4061:               <div>
                   4062:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    4063:                 "building-a-single-binary-package"></a>6.1.&nbsp;Building
1.30      wiz      4064:                 a single binary package</h2>
1.1       grant    4065:               </div>
                   4066:             </div>
                   4067:           </div>
                   4068: 
                   4069:           <p>Once you have built and installed a package, you can
                   4070:           create a <span class="emphasis"><em>binary
                   4071:           package</em></span> which can be installed on another
                   4072:           system with <a href=
                   4073:           "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   4074:           <span class="citerefentry"><span class=
1.47      reed     4075:           "refentrytitle">pkg_add</span>(1)</span></a>. This saves
1.1       grant    4076:           having to build the same package on a group of hosts and
                   4077:           wasting CPU time. It also provides a simple means for
                   4078:           others to install your package, should you distribute
                   4079:           it.</p>
                   4080: 
                   4081:           <p>To create a binary package, change into the
1.14      xtraeme  4082:           appropriate directory in pkgsrc, and run
                   4083:           <span><strong class="command">make
                   4084:           package</strong></span>:</p>
1.1       grant    4085:           <pre class="screen">
1.14      xtraeme  4086: <code class="prompt">#</code> <strong class=
                   4087: "userinput"><code>cd misc/figlet</code></strong>
                   4088: <code class="prompt">#</code> <strong class=
                   4089: "userinput"><code>make package</code></strong>
1.1       grant    4090: </pre>
                   4091: 
                   4092:           <p>This will build and install your package (if not
                   4093:           already done), and then build a binary package from what
1.14      xtraeme  4094:           was installed. You can then use the <span><strong class=
                   4095:           "command">pkg_*</strong></span> tools to manipulate it.
1.45      wiz      4096:           Binary packages are created by default in <code xmlns=
                   4097:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4098:           "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1       grant    4099:           gzipped tar file. See <a href="#logs.package" title=
1.67      hubertf  4100:           "B.2.&nbsp;Packaging figlet">Section&nbsp;B.2,
1.1       grant    4101:           &#8220;Packaging figlet&#8221;</a> for a continuation of
                   4102:           the above <a xmlns=
                   4103:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4104:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.45      wiz      4105:           target="_top"><code xmlns="" class=
                   4106:           "filename">misc/figlet</code></a> example.</p>
1.1       grant    4107: 
                   4108:           <p>See <a href="#submit" title=
1.68      rillig   4109:           "Chapter&nbsp;18.&nbsp;Submitting and Committing">Chapter&nbsp;18,
1.67      hubertf  4110:           <i>Submitting and Committing</i></a> for information on
                   4111:           how to submit such a binary package.</p>
1.1       grant    4112:         </div>
                   4113: 
1.67      hubertf  4114:         <div class="sect1" lang="en">
1.1       grant    4115:           <div class="titlepage">
                   4116:             <div>
                   4117:               <div>
                   4118:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    4119:                 "settings-for-creationg-of-binary-packages"></a>6.2.&nbsp;Settings
1.1       grant    4120:                 for creation of binary packages</h2>
                   4121:               </div>
                   4122:             </div>
                   4123:           </div>
                   4124: 
                   4125:           <p>See <a href="#build.helpful-targets" title=
1.56      rillig   4126:           "14.16.&nbsp;Other helpful targets">Section&nbsp;14.16,
1.1       grant    4127:           &#8220;Other helpful targets&#8221;</a>.</p>
                   4128:         </div>
                   4129: 
1.67      hubertf  4130:         <div class="sect1" lang="en">
1.1       grant    4131:           <div class="titlepage">
                   4132:             <div>
                   4133:               <div>
                   4134:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  4135:                 "bulkbuild"></a>6.3.&nbsp;Doing a bulk build of all
                   4136:                 packages</h2>
1.1       grant    4137:               </div>
                   4138:             </div>
                   4139:           </div>
                   4140: 
                   4141:           <p>If you want to get a full set of precompiled binary
                   4142:           packages, this section describes how to get them. Beware
                   4143:           that the bulk build will remove all currently installed
1.63      dillo    4144:           packages from your system!</p>
                   4145: 
                   4146:           <p>Having an FTP server configured either on the machine
                   4147:           doing the bulk builds or on a nearby NFS server can help
                   4148:           to make the packages available to other machines that can
                   4149:           then save time by installing only the binary packages.
                   4150:           See <a href=
1.1       grant    4151:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
                   4152:           <span class="citerefentry"><span class=
                   4153:           "refentrytitle">ftpd</span>(8)</span></a> for more
                   4154:           information. If you use a remote NFS server's storage, be
                   4155:           sure to not actually compile on NFS storage, as this
                   4156:           slows things down a lot.</p>
                   4157: 
1.67      hubertf  4158:           <div class="sect2" lang="en">
1.1       grant    4159:             <div class="titlepage">
                   4160:               <div>
                   4161:                 <div>
1.67      hubertf  4162:                   <h3 class="title"><a name=
1.38      dillo    4163:                   "binary.configuration"></a>6.3.1.&nbsp;Configuration</h3>
1.1       grant    4164:                 </div>
                   4165:               </div>
                   4166:             </div>
                   4167: 
1.67      hubertf  4168:             <div class="sect3" lang="en">
1.1       grant    4169:               <div class="titlepage">
                   4170:                 <div>
                   4171:                   <div>
1.63      dillo    4172:                     <h4 class="title"><a name=
                   4173:                     "binary.bulk.build.conf"></a>6.3.1.1.&nbsp;<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4174:                     class="filename">build.conf</code></h4>
                   4175:                   </div>
                   4176:                 </div>
                   4177:               </div>
                   4178: 
                   4179:               <p>The <code xmlns=
                   4180:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4181:               "filename">build.conf</code> file is the main
                   4182:               configuration file for bulk builds. You can configure
                   4183:               how your copy of pkgsrc is kept up to date, how the
                   4184:               distfiles are downloaded, how the packages are built
                   4185:               and how the report is generated. You can find an
                   4186:               annotated example file in <code xmlns=
                   4187:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4188:               "filename">pkgsrc/mk/bulk/build.conf-example</code>.
                   4189:               To use it, copy <code xmlns=
                   4190:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4191:               "filename">build.conf-example</code> to <code xmlns=
                   4192:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4193:               "filename">build.conf</code> and edit it, following
                   4194:               the comments in that file.</p>
                   4195:             </div>
                   4196: 
1.67      hubertf  4197:             <div class="sect3" lang="en">
1.63      dillo    4198:               <div class="titlepage">
                   4199:                 <div>
                   4200:                   <div>
1.67      hubertf  4201:                     <h4 class="title"><a name=
1.63      dillo    4202:                     "binary.mk.conf"></a>6.3.1.2.&nbsp;/etc/mk.conf</h4>
1.1       grant    4203:                   </div>
                   4204:                 </div>
                   4205:               </div>
                   4206: 
1.45      wiz      4207:               <p>You may want to set variables in <code xmlns=
                   4208:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4209:               "filename">/etc/mk.conf</code>. Look at <code xmlns=
                   4210:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4211:               "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1       grant    4212:               details of the default settings. You will want to
1.14      xtraeme  4213:               ensure that <code class=
                   4214:               "varname">ACCEPTABLE_LICENSES</code> meet your local
                   4215:               policy. As used in this example, <code class=
                   4216:               "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1       grant    4217:               "emphasis"><em>all</em></span> licenses.</p>
                   4218:               <pre class="programlisting">
1.51      rillig   4219:     PACKAGES?=      ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
                   4220:     WRKOBJDIR?=     /usr/tmp/pkgsrc   # build here instead of in pkgsrc
                   4221:     BSDSRCDIR=      /usr/src
                   4222:     BSDXSRCDIR=     /usr/xsrc         # for x11/xservers
                   4223:     OBJHOSTNAME?=   yes               # use work.`hostname`
                   4224:     FAILOVER_FETCH= yes               # insist on the correct checksum
                   4225:     PKG_DEVELOPER?= yes
                   4226:     _ACCEPTABLE=    yes
1.1       grant    4227: </pre>
                   4228: 
1.63      dillo    4229:               <p>Some options that are especially useful for bulk
                   4230:               builds can be found at the top lines of the file
                   4231:               <code xmlns=
                   4232:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4233:               "filename">mk/bulk/bsd.bulk-pkg.mk</code>. The most
                   4234:               useful options of these are briefly described
                   4235:               here.</p>
                   4236: 
                   4237:               <div class="itemizedlist">
                   4238:                 <ul type="disc">
                   4239:                   <li>
                   4240:                     <p>If you are on a slow machine, you may want
                   4241:                     to set <code class=
                   4242:                     "varname">USE_BULK_BROKEN_CHECK</code> to
                   4243:                     &#8220;<span class=
                   4244:                     "quote">no</span>&#8221;.</p>
                   4245:                   </li>
                   4246: 
                   4247:                   <li>
                   4248:                     <p>If you are doing bulk builds from a
                   4249:                     read-only copy of pkgsrc, you have to set
                   4250:                     <code class="varname">BULKFILESDIR</code> to
                   4251:                     the directory where all log files are created.
                   4252:                     Otherwise the log files are created in the
                   4253:                     pkgsrc directory.</p>
                   4254:                   </li>
                   4255: 
                   4256:                   <li>
                   4257:                     <p>Another important variable is <code class=
                   4258:                     "varname">BULK_PREREQ</code>, which is a list
                   4259:                     of packages that should be always available
                   4260:                     while building other packages.</p>
                   4261:                   </li>
                   4262:                 </ul>
1.1       grant    4263:               </div>
1.68      rillig   4264: 
                   4265:               <p>Some other options are scattered in the pkgsrc
                   4266:               infrastructure:</p>
                   4267: 
                   4268:               <div class="itemizedlist">
                   4269:                 <ul type="disc">
                   4270:                   <li>
1.69    ! rillig   4271:                     <p><code class=
        !          4272:                     "varname">ALLOW_VULNERABLE_PACKAGES</code>
        !          4273:                     should be set to <code class=
        !          4274:                     "literal">yes</code>. The purpose of the bulk
        !          4275:                     builds is creating binary packages, no matter
        !          4276:                     if they are vulnerable or not. When uploading
        !          4277:                     the packages to a public server, the vulnerable
        !          4278:                     packages will be put into a directory of their
        !          4279:                     own. Leaving this variable unset would prevent
        !          4280:                     the bulk build system from even trying to build
        !          4281:                     them, so possible building errors would not
        !          4282:                     show up.</p>
        !          4283:                   </li>
        !          4284: 
        !          4285:                   <li>
1.68      rillig   4286:                     <p><code class="varname">CHECK_FILES</code>
                   4287:                     (<code xmlns=
                   4288:                     "http://www.w3.org/TR/xhtml1/transitional"
                   4289:                     class=
                   4290:                     "filename">pkgsrc/mk/bsd.pkg.check.mk</code>)
                   4291:                     can be set to &#8220;<span class=
                   4292:                     "quote">yes</span>&#8221; to check that the
                   4293:                     installed set of files matches the <code xmlns=
                   4294:                     "http://www.w3.org/TR/xhtml1/transitional"
                   4295:                     class="filename">PLIST</code>.</p>
                   4296:                   </li>
                   4297: 
                   4298:                   <li>
                   4299:                     <p><code class=
                   4300:                     "varname">CHECK_INTERPRETER</code>
                   4301:                     (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4302:                     class=
                   4303:                     "filename">pkgsrc/mk/bsd.pkg.check.mk</code>)
                   4304:                     can be set to &#8220;<span class=
                   4305:                     "quote">yes</span>&#8221; to check that the
                   4306:                     installed &#8220;<span class=
                   4307:                     "quote">#!</span>&#8221;-scripts will find
                   4308:                     their interpreter.</p>
                   4309:                   </li>
                   4310:                 </ul>
                   4311:               </div>
1.1       grant    4312:             </div>
                   4313: 
1.67      hubertf  4314:             <div class="sect3" lang="en">
1.1       grant    4315:               <div class="titlepage">
                   4316:                 <div>
                   4317:                   <div>
1.67      hubertf  4318:                     <h4 class="title"><a name=
1.45      wiz      4319:                     "pre-build.local"></a>6.3.1.3.&nbsp;<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4320:                     class="filename">pre-build.local</code></h4>
1.1       grant    4321:                   </div>
                   4322:                 </div>
                   4323:               </div>
                   4324: 
                   4325:               <p>It is possible to configure the bulk build to
1.47      reed     4326:               perform certain site-specific tasks at the end of the
1.45      wiz      4327:               pre-build stage. If the file <code xmlns=
                   4328:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4329:               "filename">pre-build.local</code> exists in
1.45      wiz      4330:               <code xmlns=
                   4331:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4332:               "filename">/usr/pkgsrc/mk/bulk</code>, it will be
                   4333:               executed (as a <a href=
1.24      wiz      4334:               "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
                   4335:               <span class="citerefentry"><span class=
                   4336:               "refentrytitle">sh</span>(1)</span></a> script) at
                   4337:               the end of the usual pre-build stage. An example use
1.45      wiz      4338:               of <code xmlns=
                   4339:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4340:               "filename">pre-build.local</code> is to have the
                   4341:               line:</p>
1.1       grant    4342:               <pre class="screen">
1.14      xtraeme  4343: <code class="prompt">#</code> <strong class=
                   4344: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23      wiz      4345:     &gt; pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1       grant    4346: </pre>
                   4347: 
                   4348:               <p>to prevent the system from trying to build a
                   4349:               particular package which requires nearly 3 GB of disk
                   4350:               space.</p>
                   4351:             </div>
                   4352:           </div>
                   4353: 
1.67      hubertf  4354:           <div class="sect2" lang="en">
1.1       grant    4355:             <div class="titlepage">
                   4356:               <div>
                   4357:                 <div>
1.30      wiz      4358:                   <h3 class="title"><a name=
1.38      dillo    4359:                   "other-environmental-considerations"></a>6.3.2.&nbsp;Other
1.30      wiz      4360:                   environmental considerations</h3>
1.1       grant    4361:                 </div>
                   4362:               </div>
                   4363:             </div>
                   4364: 
1.45      wiz      4365:             <p>As <code xmlns=
                   4366:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4367:             "filename">/usr/pkg</code> will be completely deleted
                   4368:             at the start of bulk builds, make sure your login shell
                   4369:             is placed somewhere else. Either drop it into
                   4370:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4371:             class="filename">/usr/local/bin</code> (and adjust your
                   4372:             login shell in the passwd file), or (re-)install it via
1.14      xtraeme  4373:             <a href=
1.1       grant    4374:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   4375:             <span class="citerefentry"><span class=
                   4376:             "refentrytitle">pkg_add</span>(1)</span></a> from
1.45      wiz      4377:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4378:             class="filename">/etc/rc.local</code>, so you can login
                   4379:             after a reboot (remember that your current process
                   4380:             won't die if the package is removed, you just can't
                   4381:             start any new instances of the shell any more). Also,
                   4382:             if you use NetBSD earlier than 1.5, or you still want
                   4383:             to use the pkgsrc version of ssh for some reason, be
                   4384:             sure to install ssh before starting it from
                   4385:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4386:             class="filename">rc.local</code>:</p>
1.1       grant    4387:             <pre class="programlisting">
1.51      rillig   4388:     ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
                   4389:     if [ -f /usr/pkg/etc/rc.d/sshd ]; then
                   4390:         /usr/pkg/etc/rc.d/sshd
                   4391:     fi
1.1       grant    4392: </pre>
                   4393: 
                   4394:             <p>Not doing so will result in you being not able to
                   4395:             log in via ssh after the bulk build is finished or if
                   4396:             the machine gets rebooted or crashes. You have been
                   4397:             warned! :)</p>
                   4398:           </div>
                   4399: 
1.67      hubertf  4400:           <div class="sect2" lang="en">
1.1       grant    4401:             <div class="titlepage">
                   4402:               <div>
                   4403:                 <div>
1.67      hubertf  4404:                   <h3 class="title"><a name=
1.38      dillo    4405:                   "operation"></a>6.3.3.&nbsp;Operation</h3>
1.1       grant    4406:                 </div>
                   4407:               </div>
                   4408:             </div>
                   4409: 
                   4410:             <p>Make sure you don't need any of the packages still
                   4411:             installed.</p>
                   4412: 
                   4413:             <div class="warning" style=
                   4414:             "margin-left: 0.5in; margin-right: 0.5in;">
                   4415:               <h3 class="title">Warning</h3>
                   4416: 
                   4417:               <p>During the bulk build, <span class=
                   4418:               "emphasis"><em>all packages will be
                   4419:               removed!</em></span></p>
                   4420:             </div>
                   4421: 
                   4422:             <p>Be sure to remove all other things that might
                   4423:             interfere with builds, like some libs installed in
1.45      wiz      4424:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4425:             class="filename">/usr/local</code>, etc. then become
                   4426:             root and type:</p>
1.1       grant    4427:             <pre class="screen">
1.14      xtraeme  4428: <code class="prompt">#</code> <strong class=
                   4429: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   4430: <code class="prompt">#</code> <strong class=
                   4431: "userinput"><code>sh mk/bulk/build</code></strong>
1.1       grant    4432: </pre>
                   4433: 
                   4434:             <p>If for some reason your last build didn't complete
                   4435:             (power failure, system panic, ...), you can continue it
                   4436:             by running:</p>
                   4437:             <pre class="screen">
1.14      xtraeme  4438: <code class="prompt">#</code> <strong class=
                   4439: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1       grant    4440: </pre>
                   4441: 
                   4442:             <p>At the end of the bulk build, you will get a summary
                   4443:             via mail, and find build logs in the directory
1.14      xtraeme  4444:             specified by <code class="varname">FTP</code> in the
1.45      wiz      4445:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4446:             class="filename">build.conf</code> file.</p>
1.1       grant    4447:           </div>
                   4448: 
1.67      hubertf  4449:           <div class="sect2" lang="en">
1.1       grant    4450:             <div class="titlepage">
                   4451:               <div>
                   4452:                 <div>
1.67      hubertf  4453:                   <h3 class="title"><a name=
1.38      dillo    4454:                   "what-it-does"></a>6.3.4.&nbsp;What it does</h3>
1.1       grant    4455:                 </div>
                   4456:               </div>
                   4457:             </div>
                   4458: 
                   4459:             <p>The bulk builds consist of three steps:</p>
                   4460: 
                   4461:             <div class="variablelist">
                   4462:               <dl>
                   4463:                 <dt><span class="term">1. pre-build</span></dt>
                   4464: 
                   4465:                 <dd>
                   4466:                   <p>The script updates your pkgsrc tree via
                   4467:                   (anon)cvs, then cleans out any broken distfiles,
                   4468:                   and removes all packages installed.</p>
                   4469:                 </dd>
                   4470: 
                   4471:                 <dt><span class="term">2. the bulk
                   4472:                 build</span></dt>
                   4473: 
                   4474:                 <dd>
                   4475:                   <p>This is basically &#8220;<span class=
                   4476:                   "quote">make bulk-package</span>&#8221; with an
                   4477:                   optimised order in which packages will be built.
                   4478:                   Packages that don't require other packages will
                   4479:                   be built first, and packages with many
                   4480:                   dependencies will be built later.</p>
                   4481:                 </dd>
                   4482: 
                   4483:                 <dt><span class="term">3. post-build</span></dt>
                   4484: 
                   4485:                 <dd>
                   4486:                   <p>Generates a report that's placed in the
1.45      wiz      4487:                   directory specified in the <code xmlns=
                   4488:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4489:                   "filename">build.conf</code> file named
1.45      wiz      4490:                   <code xmlns=
                   4491:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4492:                   "filename">broken.html</code>, a short version of
                   4493:                   that report will also be mailed to the build's
                   4494:                   admin.</p>
1.1       grant    4495:                 </dd>
                   4496:               </dl>
                   4497:             </div>
                   4498: 
                   4499:             <p>During the build, a list of broken packages will be
1.45      wiz      4500:             compiled in <code xmlns=
                   4501:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4502:             "filename">/usr/pkgsrc/.broken</code> (or <code xmlns=
                   4503:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4504:             "filename">.../.broken.${MACHINE}</code> if
                   4505:             <code class="varname">OBJMACHINE</code> is set),
                   4506:             individual build logs of broken builds can be found in
                   4507:             the package's directory. These files are used by the
                   4508:             bulk-targets to mark broken builds to not waste time
                   4509:             trying to rebuild them, and they can be used to debug
                   4510:             these broken package builds later.</p>
1.1       grant    4511:           </div>
                   4512: 
1.67      hubertf  4513:           <div class="sect2" lang="en">
1.1       grant    4514:             <div class="titlepage">
                   4515:               <div>
                   4516:                 <div>
1.30      wiz      4517:                   <h3 class="title"><a name=
1.38      dillo    4518:                   "disk-space-requirements"></a>6.3.5.&nbsp;Disk
1.30      wiz      4519:                   space requirements</h3>
1.1       grant    4520:                 </div>
                   4521:               </div>
                   4522:             </div>
                   4523: 
                   4524:             <p>Currently, roughly the following requirements are
                   4525:             valid for NetBSD 2.0/i386:</p>
                   4526: 
                   4527:             <div class="itemizedlist">
                   4528:               <ul type="disc">
                   4529:                 <li>
                   4530:                   <p>10 GB - distfiles (NFS ok)</p>
                   4531:                 </li>
                   4532: 
                   4533:                 <li>
                   4534:                   <p>8 GB - full set of all binaries (NFS ok)</p>
                   4535:                 </li>
                   4536: 
                   4537:                 <li>
                   4538:                   <p>5 GB - temp space for compiling (local disk
                   4539:                   recommended)</p>
                   4540:                 </li>
                   4541:               </ul>
                   4542:             </div>
                   4543: 
                   4544:             <p>Note that all pkgs will be de-installed as soon as
                   4545:             they are turned into a binary package, and that sources
                   4546:             are removed, so there is no excessively huge demand to
                   4547:             disk space. Afterwards, if the package is needed again,
                   4548:             it will be installed via <a href=
                   4549:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   4550:             <span class="citerefentry"><span class=
                   4551:             "refentrytitle">pkg_add</span>(1)</span></a> instead of
                   4552:             building again, so there are no cycles wasted by
                   4553:             recompiling.</p>
                   4554:           </div>
                   4555: 
1.67      hubertf  4556:           <div class="sect2" lang="en">
1.1       grant    4557:             <div class="titlepage">
                   4558:               <div>
                   4559:                 <div>
1.67      hubertf  4560:                   <h3 class="title"><a name=
                   4561:                   "setting-up-a-sandbox"></a>6.3.6.&nbsp;Setting up
                   4562:                   a sandbox for chrooted builds</h3>
1.1       grant    4563:                 </div>
                   4564:               </div>
                   4565:             </div>
                   4566: 
1.12      agc      4567:             <p>If you don't want all the packages nuked from a
                   4568:             machine (rendering it useless for anything but pkg
1.23      wiz      4569:             compiling), there is the possibility of doing the
                   4570:             package bulk build inside a chroot environment.</p>
1.12      agc      4571: 
                   4572:             <p>The first step is to set up a chroot sandbox, e.g.
1.45      wiz      4573:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4574:             class="filename">/usr/sandbox</code>. This can be done
                   4575:             by using null mounts, or manually.</p>
1.12      agc      4576: 
1.45      wiz      4577:             <p>There is a shell script called <code xmlns=
                   4578:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4579:             "filename">pkgsrc/mk/bulk/mksandbox</code> which will
                   4580:             set up the sandbox environment using null mounts. It
1.45      wiz      4581:             will also create a script called <code xmlns=
                   4582:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4583:             "filename">sandbox</code> in the root of the sandbox
1.12      agc      4584:             environment, which will allow the null mounts to be
1.14      xtraeme  4585:             activated using the <span><strong class=
                   4586:             "command">sandbox mount</strong></span> command and
                   4587:             deactivated using the <span><strong class=
                   4588:             "command">sandbox umount</strong></span> command.</p>
1.12      agc      4589: 
                   4590:             <p>To set up a sandbox environment by hand, after
                   4591:             extracting all the sets from a NetBSD installation or
1.14      xtraeme  4592:             doing a <span><strong class="command">make distribution
1.45      wiz      4593:             DESTDIR=/usr/sandbox</strong></span> in <code xmlns=
                   4594:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4595:             "filename">/usr/src/etc</code>, be sure the following
1.7       wiz      4596:             items are present and properly configured:</p>
1.1       grant    4597: 
                   4598:             <div class="procedure">
                   4599:               <ol type="1">
                   4600:                 <li>
                   4601:                   <p>Kernel</p>
                   4602:                   <pre class="screen">
1.14      xtraeme  4603: <code class="prompt">#</code> <strong class=
                   4604: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1       grant    4605: </pre>
                   4606:                 </li>
                   4607: 
                   4608:                 <li>
1.45      wiz      4609:                   <p><code xmlns=
                   4610:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4611:                   "filename">/dev/*</code></p>
1.1       grant    4612:                   <pre class="screen">
1.14      xtraeme  4613: <code class="prompt">#</code> <strong class=
                   4614: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1       grant    4615: </pre>
                   4616:                 </li>
                   4617: 
                   4618:                 <li>
1.45      wiz      4619:                   <p><code xmlns=
                   4620:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4621:                   "filename">/etc/resolv.conf</code> (for <a xmlns=
1.1       grant    4622:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   4623:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45      wiz      4624:                   target="_top"><code xmlns="" class=
                   4625:                   "filename">security/smtpd</code></a> and
                   4626:                   mail):</p>
1.1       grant    4627:                   <pre class="screen">
1.14      xtraeme  4628: <code class="prompt">#</code> <strong class=
                   4629: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1       grant    4630: </pre>
                   4631:                 </li>
                   4632: 
                   4633:                 <li>
                   4634:                   <p>Working(!) mail config (hostname,
                   4635:                   sendmail.cf):</p>
                   4636:                   <pre class="screen">
1.14      xtraeme  4637: <code class="prompt">#</code> <strong class=
                   4638: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1       grant    4639: </pre>
                   4640:                 </li>
                   4641: 
                   4642:                 <li>
1.45      wiz      4643:                   <p><code xmlns=
                   4644:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4645:                   "filename">/etc/localtime</code> (for <a xmlns=
1.1       grant    4646:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   4647:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45      wiz      4648:                   target="_top"><code xmlns="" class=
                   4649:                   "filename">security/smtpd</code></a>):</p>
1.1       grant    4650:                   <pre class="screen">
1.14      xtraeme  4651: <code class="prompt">#</code> <strong class=
                   4652: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1       grant    4653: </pre>
                   4654:                 </li>
                   4655: 
                   4656:                 <li>
1.45      wiz      4657:                   <p><code xmlns=
                   4658:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4659:                   "filename">/usr/src</code> (system sources, for
                   4660:                   <a xmlns=
1.1       grant    4661:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   4662:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.45      wiz      4663:                   target="_top"><code xmlns="" class=
                   4664:                   "filename">sysutils/aperture</code></a>,
                   4665:                   <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4666:                   href=
1.20      ben      4667:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
1.45      wiz      4668:                   target="_top"><code xmlns="" class=
                   4669:                   "filename">net/ppp-mppe</code></a>):</p>
1.1       grant    4670:                   <pre class="screen">
1.14      xtraeme  4671: <code class="prompt">#</code> <strong class=
                   4672: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
                   4673: <code class="prompt">#</code> <strong class=
1.23      wiz      4674: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1       grant    4675: </pre>
                   4676:                 </li>
                   4677: 
                   4678:                 <li>
1.45      wiz      4679:                   <p>Create <code xmlns=
                   4680:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4681:                   "filename">/var/db/pkg</code> (not part of
                   4682:                   default install):</p>
1.1       grant    4683:                   <pre class="screen">
1.14      xtraeme  4684: <code class="prompt">#</code> <strong class=
                   4685: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1       grant    4686: </pre>
                   4687:                 </li>
                   4688: 
                   4689:                 <li>
1.45      wiz      4690:                   <p>Create <code xmlns=
                   4691:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4692:                   "filename">/usr/pkg</code> (not part of default
                   4693:                   install):</p>
1.1       grant    4694:                   <pre class="screen">
1.14      xtraeme  4695: <code class="prompt">#</code> <strong class=
                   4696: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1       grant    4697: </pre>
                   4698:                 </li>
                   4699: 
                   4700:                 <li>
1.45      wiz      4701:                   <p>Checkout pkgsrc via cvs into <code xmlns=
                   4702:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4703:                   "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1       grant    4704:                   <pre class="screen">
1.14      xtraeme  4705: <code class="prompt">#</code> <strong class=
                   4706: "userinput"><code>cd /usr/sandbox/usr</code></strong>
                   4707: <code class="prompt">#</code> <strong class=
                   4708: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1       grant    4709: </pre>
                   4710: 
                   4711:                   <p>Do not mount/link this to the copy of your
                   4712:                   pkgsrc tree you do development in, as this will
                   4713:                   likely cause problems!</p>
                   4714:                 </li>
                   4715: 
                   4716:                 <li>
1.45      wiz      4717:                   <p>Make <code xmlns=
                   4718:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4719:                   "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.45      wiz      4720:                   and <code xmlns=
                   4721:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4722:                   "filename">.../distfiles</code> point somewhere
                   4723:                   appropriate. NFS- and/or nullfs-mounts may come
                   4724:                   in handy!</p>
1.1       grant    4725:                 </li>
                   4726: 
                   4727:                 <li>
1.45      wiz      4728:                   <p>Edit <code xmlns=
                   4729:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4730:                   "filename">/etc/mk.conf</code>, see <a href=
                   4731:                   "#binary.mk.conf" title=
1.63      dillo    4732:                   "6.3.1.2.&nbsp;/etc/mk.conf">Section&nbsp;6.3.1.2,
1.1       grant    4733:                   &#8220;/etc/mk.conf&#8221;</a>.</p>
                   4734:                 </li>
                   4735: 
                   4736:                 <li>
1.45      wiz      4737:                   <p>Adjust <code xmlns=
                   4738:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4739:                   "filename">mk/bulk/build.conf</code> to suit your
1.1       grant    4740:                   needs.</p>
                   4741:                 </li>
                   4742:               </ol>
                   4743:             </div>
                   4744: 
1.47      reed     4745:             <p>When the chroot sandbox is set up, you can start the
1.1       grant    4746:             build with the following steps:</p>
                   4747:             <pre class="screen">
1.14      xtraeme  4748: <code class="prompt">#</code> <strong class=
                   4749: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
                   4750: <code class="prompt">#</code> <strong class=
                   4751: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1       grant    4752: </pre>
                   4753: 
                   4754:             <p>This will just jump inside the sandbox and start
                   4755:             building. At the end of the build, mail will be sent
                   4756:             with the results of the build. Created binary pkgs will
1.45      wiz      4757:             be in <code xmlns=
                   4758:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4759:             "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1       grant    4760:             (wherever that points/mounts to/from).</p>
                   4761:           </div>
                   4762: 
1.67      hubertf  4763:           <div class="sect2" lang="en">
1.1       grant    4764:             <div class="titlepage">
                   4765:               <div>
                   4766:                 <div>
1.30      wiz      4767:                   <h3 class="title"><a name=
1.38      dillo    4768:                   "building-a-partial-set"></a>6.3.7.&nbsp;Building
1.30      wiz      4769:                   a partial set of packages</h3>
1.1       grant    4770:                 </div>
                   4771:               </div>
                   4772:             </div>
                   4773: 
                   4774:             <p>In addition to building a complete set of all
1.45      wiz      4775:             packages in pkgsrc, the <code xmlns=
                   4776:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4777:             "filename">pkgsrc/mk/bulk/build</code> script may be
                   4778:             used to build a subset of the packages contained in
1.47      reed     4779:             pkgsrc. By setting <code class=
1.45      wiz      4780:             "varname">SPECIFIC_PKGS</code> in <code xmlns=
                   4781:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4782:             "filename">/etc/mk.conf</code>, the variables</p>
1.1       grant    4783: 
                   4784:             <div class="itemizedlist">
                   4785:               <ul type="disc">
                   4786:                 <li>
                   4787:                   <p>SITE_SPECIFIC_PKGS</p>
                   4788:                 </li>
                   4789: 
                   4790:                 <li>
                   4791:                   <p>HOST_SPECIFIC_PKGS</p>
                   4792:                 </li>
                   4793: 
                   4794:                 <li>
                   4795:                   <p>GROUP_SPECIFIC_PKGS</p>
                   4796:                 </li>
                   4797: 
                   4798:                 <li>
                   4799:                   <p>USER_SPECIFIC_PKGS</p>
                   4800:                 </li>
                   4801:               </ul>
                   4802:             </div>
                   4803: 
                   4804:             <p>will define the set of packages which should be
                   4805:             built. The bulk build code will also include any
                   4806:             packages which are needed as dependencies for the
                   4807:             explicitly listed packages.</p>
                   4808: 
                   4809:             <p>One use of this is to do a bulk build with
1.14      xtraeme  4810:             <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1       grant    4811:             sandbox periodically to have a complete set of the
                   4812:             binary packages needed for your site available without
                   4813:             the overhead of building extra packages that are not
                   4814:             needed.</p>
                   4815:           </div>
1.13      hubertf  4816: 
1.67      hubertf  4817:           <div class="sect2" lang="en">
1.13      hubertf  4818:             <div class="titlepage">
                   4819:               <div>
                   4820:                 <div>
1.67      hubertf  4821:                   <h3 class="title"><a name=
1.38      dillo    4822:                   "bulk-upload"></a>6.3.8.&nbsp;Uploading results
1.13      hubertf  4823:                   of a bulk build</h3>
                   4824:                 </div>
                   4825:               </div>
                   4826:             </div>
                   4827: 
                   4828:             <p>This section describes how pkgsrc developers can
                   4829:             upload binary pkgs built by bulk builds to
                   4830:             ftp.NetBSD.org.</p>
                   4831: 
1.17      sketch   4832:             <p>If you would like to automatically create checksum
                   4833:             files for the binary packages you intend to upload,
                   4834:             remember to set <code class="varname">MKSUMS=yes</code>
1.45      wiz      4835:             in your <code xmlns=
                   4836:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.17      sketch   4837:             "filename">mk/bulk/build.conf</code>.</p>
                   4838: 
                   4839:             <p>If you would like to PGP sign the checksum files
                   4840:             (highly recommended!), remember to set <code class=
                   4841:             "varname">SIGN_AS=username@NetBSD.org</code> in your
1.45      wiz      4842:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4843:             class="filename">mk/bulk/build.conf</code>. This will
                   4844:             prompt you for your GPG password to sign the files
1.17      sketch   4845:             before uploading everything.</p>
                   4846: 
                   4847:             <p>Then, make sure that you have <code class=
1.14      xtraeme  4848:             "varname">RSYNC_DST</code> set properly in your
1.45      wiz      4849:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4850:             class="filename">mk/bulk/build.conf</code> file, i.e.
                   4851:             adjust it to something like one of the following:</p>
1.13      hubertf  4852:             <pre class="screen">
1.68      rillig   4853: RSYNC_DST=ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
1.13      hubertf  4854: </pre>
                   4855: 
1.47      reed     4856:             <p>Please use appropriate values for "pkgsrc-200xQy",
1.13      hubertf  4857:             "NetBSD-a.b.c" and "arch" here. If your login on
1.68      rillig   4858:             ftp.NetBSD.org is different from your local login,
                   4859:             write your login directly into the variable, e.g. my
                   4860:             local account is "feyrer", but for my login "hubertf",
                   4861:             I use:</p>
1.13      hubertf  4862:             <pre class="screen">
                   4863: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   4864: </pre>
                   4865: 
1.45      wiz      4866:             <p>A separate <code xmlns=
                   4867:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4868:             "filename">upload</code> directory is used here to
                   4869:             allow "closing" the directory during upload. To do so,
                   4870:             run the following command on ftp.NetBSD.org next:</p>
1.13      hubertf  4871:             <pre class="screen">
1.14      xtraeme  4872: nbftp% <strong class=
                   4873: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13      hubertf  4874: </pre>
                   4875: 
1.45      wiz      4876:             <p>Please note that <code xmlns=
                   4877:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4878:             "filename">/pub/NetBSD/packages</code> is only
1.13      hubertf  4879:             appropriate for packages for the NetBSD operating
                   4880:             system. Binary packages for other operating systems
1.45      wiz      4881:             should go into <code xmlns=
                   4882:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4883:             "filename">/pub/pkgsrc</code>.</p>
1.13      hubertf  4884: 
                   4885:             <p>Before uploading the binary pkgs, ssh authentication
1.47      reed     4886:             needs to be set up. This example shows how to set up
1.13      hubertf  4887:             temporary keys for the root account <span class=
                   4888:             "emphasis"><em>inside the sandbox</em></span> (assuming
                   4889:             that no keys should be present there usually):</p>
                   4890:             <pre class="screen">
1.14      xtraeme  4891: <code class="prompt">#</code> <strong class=
1.68      rillig   4892: "userinput"><code>chroot /usr/sandbox</code></strong>
1.14      xtraeme  4893: chroot-<code class="prompt">#</code> <strong class=
1.68      rillig   4894: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>
1.14      xtraeme  4895: chroot-<code class="prompt">#</code> <strong class=
1.68      rillig   4896: "userinput"><code>ssh-keygen -t dsa</code></strong>
1.14      xtraeme  4897: chroot-<code class="prompt">#</code> <strong class=
                   4898: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong> 
1.13      hubertf  4899: </pre>
                   4900: 
1.45      wiz      4901:             <p>Now take the output of <code xmlns=
                   4902:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4903:             "filename">id-dsa.pub</code> and append it to your
1.45      wiz      4904:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4905:             class="filename">~/.ssh/authorized_keys</code> file on
                   4906:             ftp.NetBSD.org. You can remove the key after the upload
                   4907:             is done!</p>
1.13      hubertf  4908: 
                   4909:             <p>Next, test if your ssh connection really works:</p>
                   4910:             <pre class="screen">
1.14      xtraeme  4911: chroot-<code class="prompt">#</code> <strong class=
                   4912: "userinput"><code>ssh ftp.NetBSD.org date</code></strong> 
1.13      hubertf  4913: </pre>
                   4914: 
                   4915:             <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
                   4916: 
                   4917:             <p>Now after all this works, you can exit the sandbox
                   4918:             and start the upload:</p>
                   4919:             <pre class="screen">
1.14      xtraeme  4920: chroot-<code class="prompt">#</code> <strong class=
1.68      rillig   4921: "userinput"><code>exit</code></strong>
1.14      xtraeme  4922: <code class="prompt">#</code> <strong class=
1.68      rillig   4923: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
1.14      xtraeme  4924: <code class="prompt">#</code> <strong class=
                   4925: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong> 
1.13      hubertf  4926: </pre>
                   4927: 
                   4928:             <p>The upload process may take quite some time. Use
1.24      wiz      4929:             <a href=
                   4930:             "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
                   4931:             <span class="citerefentry"><span class=
                   4932:             "refentrytitle">ls</span>(1)</span></a> or <a href=
                   4933:             "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
                   4934:             <span class="citerefentry"><span class=
                   4935:             "refentrytitle">du</span>(1)</span></a> on the FTP
                   4936:             server to monitor progress of the upload. The upload
                   4937:             script will take care of not uploading restricted
                   4938:             packages and putting vulnerable packages into the
1.45      wiz      4939:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4940:             class="filename">vulnerable</code> subdirectory.</p>
1.13      hubertf  4941: 
                   4942:             <p>After the upload has ended, first thing is to revoke
                   4943:             ssh access:</p>
                   4944:             <pre class="screen">
1.14      xtraeme  4945: nbftp% <strong class=
                   4946: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13      hubertf  4947: Gdd:x! 
                   4948: </pre>
                   4949: 
                   4950:             <p>Use whatever is needed to remove the key you've
                   4951:             entered before! Last, move the uploaded packages out of
1.45      wiz      4952:             the <code xmlns=
                   4953:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4954:             "filename">upload</code> directory to have them
                   4955:             accessible to everyone:</p>
1.13      hubertf  4956:             <pre class="screen">
1.14      xtraeme  4957: nbftp% <strong class=
                   4958: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
                   4959: nbftp% <strong class=
                   4960: "userinput"><code>mv upload/* .</code></strong>
                   4961: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
                   4962: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong> 
1.13      hubertf  4963: </pre>
                   4964:           </div>
1.1       grant    4965:         </div>
                   4966: 
1.67      hubertf  4967:         <div class="sect1" lang="en">
1.1       grant    4968:           <div class="titlepage">
                   4969:             <div>
                   4970:               <div>
                   4971:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    4972:                 "creating-cdroms"></a>6.4.&nbsp;Creating a multiple
1.30      wiz      4973:                 CD-ROM packages collection</h2>
1.1       grant    4974:               </div>
                   4975:             </div>
                   4976:           </div>
                   4977: 
                   4978:           <p>After your pkgsrc bulk-build has completed, you may
                   4979:           wish to create a CD-ROM set of the resulting binary
                   4980:           packages to assist in installing packages on other
                   4981:           machines. The <a xmlns=
                   4982:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4983:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.45      wiz      4984:           target="_top"><code xmlns="" class=
                   4985:           "filename">pkgtools/cdpack</code></a> package provides a
1.20      ben      4986:           simple tool for creating the ISO 9660 images.
                   4987:           <span><strong class="command">cdpack</strong></span>
                   4988:           arranges the packages on the CD-ROMs in a way that keeps
1.47      reed     4989:           all the dependencies for a given package on the same CD
                   4990:           as that package.</p>
1.1       grant    4991: 
1.67      hubertf  4992:           <div class="sect2" lang="en">
1.1       grant    4993:             <div class="titlepage">
                   4994:               <div>
                   4995:                 <div>
1.67      hubertf  4996:                   <h3 class="title"><a name=
1.38      dillo    4997:                   "cdpack-example"></a>6.4.1.&nbsp;Example of
1.1       grant    4998:                   cdpack</h3>
                   4999:                 </div>
                   5000:               </div>
                   5001:             </div>
                   5002: 
                   5003:             <p>Complete documentation for cdpack is found in the
1.47      reed     5004:             cdpack(1) man page. The following short example assumes
1.45      wiz      5005:             that the binary packages are left in <code xmlns=
                   5006:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5007:             "filename">/usr/pkgsrc/packages/All</code> and that
1.45      wiz      5008:             sufficient disk space exists in <code xmlns=
                   5009:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5010:             "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1       grant    5011:             <pre class="screen">
1.14      xtraeme  5012: <code class="prompt">#</code> <strong class=
                   5013: "userinput"><code>mkdir /u2/images</code></strong>
                   5014: <code class="prompt">#</code> <strong class=
                   5015: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
                   5016: <code class="prompt">#</code> <strong class=
                   5017: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    5018: </pre>
                   5019: 
                   5020:             <p>If you wish to include a common set of files
1.45      wiz      5021:             (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5022:             class="filename">COPYRIGHT</code>, <code xmlns=
                   5023:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5024:             "filename">README</code>, etc.) on each CD in the
1.1       grant    5025:             collection, then you need to create a directory which
                   5026:             contains these files. e.g.</p>
                   5027:             <pre class="screen">
1.14      xtraeme  5028: <code class="prompt">#</code> <strong class=
                   5029: "userinput"><code>mkdir /tmp/common</code></strong>
                   5030: <code class="prompt">#</code> <strong class=
                   5031: "userinput"><code>echo "This is a README" &gt; /tmp/common/README</code></strong>
                   5032: <code class="prompt">#</code> <strong class=
                   5033: "userinput"><code>echo "Another file" &gt; /tmp/common/COPYING</code></strong>
                   5034: <code class="prompt">#</code> <strong class=
                   5035: "userinput"><code>mkdir /tmp/common/bin</code></strong>
                   5036: <code class="prompt">#</code> <strong class=
                   5037: "userinput"><code>echo "#!/bin/sh" &gt; /tmp/common/bin/myscript</code></strong>
                   5038: <code class="prompt">#</code> <strong class=
                   5039: "userinput"><code>echo "echo Hello world" &gt;&gt; /tmp/common/bin/myscript</code></strong>
                   5040: <code class="prompt">#</code> <strong class=
                   5041: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1       grant    5042: </pre>
                   5043: 
                   5044:             <p>Now create the images:</p>
                   5045:             <pre class="screen">
1.14      xtraeme  5046: <code class="prompt">#</code> <strong class=
                   5047: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    5048: </pre>
                   5049: 
1.45      wiz      5050:             <p>Each image will contain <code xmlns=
                   5051:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   5052:             "filename">README</code>, <code xmlns=
                   5053:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   5054:             "filename">COPYING</code>, and <code xmlns=
                   5055:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5056:             "filename">bin/myscript</code> in their root
1.1       grant    5057:             directories.</p>
                   5058:           </div>
                   5059:         </div>
                   5060:       </div>
                   5061: 
1.67      hubertf  5062:       <div class="chapter" lang="en">
1.1       grant    5063:         <div class="titlepage">
                   5064:           <div>
                   5065:             <div>
1.67      hubertf  5066:               <h2 class="title"><a name=
1.38      dillo    5067:               "faq"></a>Chapter&nbsp;7.&nbsp;Frequently Asked
1.1       grant    5068:               Questions</h2>
                   5069:             </div>
                   5070:           </div>
                   5071:         </div>
                   5072: 
                   5073:         <div class="toc">
                   5074:           <p><b>Table of Contents</b></p>
                   5075: 
                   5076:           <dl>
1.30      wiz      5077:             <dt><span class="sect1"><a href=
1.38      dillo    5078:             "#mailing-list-pointers">7.1. Are there any mailing
1.30      wiz      5079:             lists for pkg-related discussion?</a></span></dt>
1.1       grant    5080: 
1.38      dillo    5081:             <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1       grant    5082:             Where's the pkgviews documentation?</a></span></dt>
                   5083: 
1.38      dillo    5084:             <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1       grant    5085:             Utilities for package management
                   5086:             (pkgtools)</a></span></dt>
                   5087: 
1.38      dillo    5088:             <dt><span class="sect1"><a href="#non-root-pkgsrc">7.4.
1.30      wiz      5089:             How to use pkgsrc as non-root</a></span></dt>
1.1       grant    5090: 
1.30      wiz      5091:             <dt><span class="sect1"><a href=
1.38      dillo    5092:             "#resume-transfers">7.5. How to resume transfers when
1.30      wiz      5093:             fetching distfiles?</a></span></dt>
1.14      xtraeme  5094: 
1.30      wiz      5095:             <dt><span class="sect1"><a href=
1.38      dillo    5096:             "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30      wiz      5097:             XFree86 from pkgsrc?</a></span></dt>
1.1       grant    5098: 
1.30      wiz      5099:             <dt><span class="sect1"><a href=
1.38      dillo    5100:             "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30      wiz      5101:             from pkgsrc?</a></span></dt>
1.1       grant    5102: 
1.30      wiz      5103:             <dt><span class="sect1"><a href=
1.38      dillo    5104:             "#fetch-behind-firewall">7.8. How to fetch files from
1.30      wiz      5105:             behind a firewall</a></span></dt>
1.1       grant    5106: 
1.38      dillo    5107:             <dt><span class="sect1"><a href="#passive-ftp">7.9. How
1.14      xtraeme  5108:             do I tell <span><strong class="command">make
                   5109:             fetch</strong></span> to do passive
                   5110:             FTP?</a></span></dt>
1.1       grant    5111: 
1.30      wiz      5112:             <dt><span class="sect1"><a href=
1.38      dillo    5113:             "#fetching-all-distfiles">7.10. How to fetch all
1.30      wiz      5114:             distfiles at once</a></span></dt>
1.1       grant    5115: 
1.30      wiz      5116:             <dt><span class="sect1"><a href=
1.38      dillo    5117:             "#tmac.andoc-missing">7.11. What does
1.30      wiz      5118:             &#8220;<span class="quote">Don't know how to make
1.14      xtraeme  5119:             /usr/share/tmac/tmac.andoc</span>&#8221;
1.1       grant    5120:             mean?</a></span></dt>
                   5121: 
1.30      wiz      5122:             <dt><span class="sect1"><a href=
1.38      dillo    5123:             "#bsd.own.mk-missing">7.12. What does
1.30      wiz      5124:             &#8220;<span class="quote">Could not find
1.14      xtraeme  5125:             bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    5126: 
1.30      wiz      5127:             <dt><span class="sect1"><a href=
1.38      dillo    5128:             "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30      wiz      5129:             pkgsrc</a></span></dt>
1.1       grant    5130: 
1.38      dillo    5131:             <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35      jmmv     5132:             do I change the location of configuration
                   5133:             files?</a></span></dt>
1.1       grant    5134: 
1.38      dillo    5135:             <dt><span class="sect1"><a href="#audit-packages">7.15.
1.1       grant    5136:             Automated security checks</a></span></dt>
                   5137:           </dl>
                   5138:         </div>
                   5139: 
                   5140:         <p>This section contains hints, tips &amp; tricks on
                   5141:         special things in pkgsrc that we didn't find a better place
                   5142:         for in the previous chapters, and it contains items for
                   5143:         both pkgsrc users and developers.</p>
                   5144: 
1.67      hubertf  5145:         <div class="sect1" lang="en">
1.1       grant    5146:           <div class="titlepage">
                   5147:             <div>
                   5148:               <div>
                   5149:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5150:                 "mailing-list-pointers"></a>7.1.&nbsp;Are there any
1.30      wiz      5151:                 mailing lists for pkg-related discussion?</h2>
1.1       grant    5152:               </div>
                   5153:             </div>
                   5154:           </div>
                   5155: 
1.18      xtraeme  5156:           <p>The following mailing lists may be of interest to
                   5157:           pkgsrc users:</p>
                   5158: 
                   5159:           <div class="itemizedlist">
                   5160:             <ul type="disc">
                   5161:               <li>
                   5162:                 <p><a href=
                   5163:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.34      wiz      5164:                 target="_top">pkgsrc-bugs</a>: A list where problem
                   5165:                 reports related to pkgsrc are sent and
                   5166:                 discussed.</p>
1.18      xtraeme  5167:               </li>
                   5168: 
                   5169:               <li>
                   5170:                 <p><a href=
                   5171:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34      wiz      5172:                 target="_top">pkgsrc-bulk</a>: A list where the
1.20      ben      5173:                 results of pkgsrc bulk builds are sent and
1.34      wiz      5174:                 discussed.</p>
1.18      xtraeme  5175:               </li>
                   5176: 
                   5177:               <li>
                   5178:                 <p><a href=
                   5179:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.34      wiz      5180:                 target="_top">pkgsrc-changes</a>: A list where all
                   5181:                 commit messages to pkgsrc are sent.</p>
1.18      xtraeme  5182:               </li>
                   5183: 
                   5184:               <li>
                   5185:                 <p><a href=
                   5186:                 "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.34      wiz      5187:                 target="_top">tech-pkg</a>: A general discussion
                   5188:                 list for all things related to pkgsrc.</p>
1.18      xtraeme  5189:               </li>
                   5190:             </ul>
                   5191:           </div>
                   5192: 
                   5193:           <p>To subscribe, do:</p>
1.1       grant    5194:           <pre class="programlisting">
1.51      rillig   5195:     <code class="prompt">%</code> echo subscribe <em class=
1.18      xtraeme  5196: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1       grant    5197: </pre>
                   5198: 
1.18      xtraeme  5199:           <p>Archives for all these mailing lists are available
                   5200:           from <a href="http://mail-index.NetBSD.org/" target=
                   5201:           "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1       grant    5202:         </div>
                   5203: 
1.67      hubertf  5204:         <div class="sect1" lang="en">
1.1       grant    5205:           <div class="titlepage">
                   5206:             <div>
                   5207:               <div>
                   5208:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5209:                 "pkgviews-docs"></a>7.2.&nbsp;Where's the pkgviews
1.30      wiz      5210:                 documentation?</h2>
1.1       grant    5211:               </div>
                   5212:             </div>
                   5213:           </div>
                   5214: 
                   5215:           <p>Pkgviews is tightly integrated with buildlink. You can
1.45      wiz      5216:           find a pkgviews User's guide in <code xmlns=
                   5217:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5218:           "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1       grant    5219:         </div>
                   5220: 
1.67      hubertf  5221:         <div class="sect1" lang="en">
1.1       grant    5222:           <div class="titlepage">
                   5223:             <div>
                   5224:               <div>
                   5225:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5226:                 "faq-pkgtools"></a>7.3.&nbsp;Utilities for package
1.5       hubertf  5227:                 management (pkgtools)</h2>
1.1       grant    5228:               </div>
                   5229:             </div>
                   5230:           </div>
                   5231: 
1.45      wiz      5232:           <p>The <code xmlns=
                   5233:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5234:           "filename">pkgsrc/pkgtools</code> directory pkgtools
                   5235:           contains a number of useful utilities for both users and
                   5236:           developers of pkgsrc. This section attempts only to make
                   5237:           the reader aware of the utilities and when they might be
                   5238:           useful, and not to duplicate the documentation that comes
                   5239:           with each package.</p>
1.1       grant    5240: 
                   5241:           <p>Utilities used by pkgsrc (automatically installed when
                   5242:           needed):</p>
                   5243: 
                   5244:           <div class="itemizedlist">
                   5245:             <ul type="disc">
                   5246:               <li>
                   5247:                 <p><a xmlns=
                   5248:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5249:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.45      wiz      5250:                 target="_top"><code xmlns="" class=
                   5251:                 "filename">pkgtools/x11-links</code></a>: Symlinks
1.34      wiz      5252:                 for use by buildlink.</p>
1.1       grant    5253:               </li>
                   5254:             </ul>
                   5255:           </div>
                   5256: 
                   5257:           <p>OS tool augmentation (automatically installed when
                   5258:           needed):</p>
                   5259: 
                   5260:           <div class="itemizedlist">
                   5261:             <ul type="disc">
                   5262:               <li>
                   5263:                 <p><a xmlns=
                   5264:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5265:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.45      wiz      5266:                 target="_top"><code xmlns="" class=
                   5267:                 "filename">pkgtools/digest</code></a>: Calculates
1.34      wiz      5268:                 various kinds of checksums (including SHA1).</p>
1.1       grant    5269:               </li>
                   5270: 
                   5271:               <li>
                   5272:                 <p><a xmlns=
                   5273:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5274:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.45      wiz      5275:                 target="_top"><code xmlns="" class=
                   5276:                 "filename">pkgtools/libnbcompat</code></a>:
1.34      wiz      5277:                 Compatibility library for pkgsrc tools.</p>
1.1       grant    5278:               </li>
                   5279: 
                   5280:               <li>
                   5281:                 <p><a xmlns=
                   5282:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5283:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.45      wiz      5284:                 target="_top"><code xmlns="" class=
                   5285:                 "filename">pkgtools/mtree</code></a>: Installed on
1.34      wiz      5286:                 non-BSD systems due to lack of native mtree.</p>
1.1       grant    5287:               </li>
                   5288: 
                   5289:               <li>
                   5290:                 <p><a xmlns=
                   5291:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5292:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45      wiz      5293:                 target="_top"><code xmlns="" class=
                   5294:                 "filename">pkgtools/pkg_install</code></a>:
                   5295:                 Up-to-date replacement for <code xmlns=
                   5296:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.34      wiz      5297:                 "filename">/usr/sbin/pkg_install</code>, or for use
                   5298:                 on operating systems where pkg_install is not
                   5299:                 present.</p>
1.1       grant    5300:               </li>
                   5301:             </ul>
                   5302:           </div>
                   5303: 
                   5304:           <p>Utilities used by pkgsrc (not automatically
                   5305:           installed):</p>
                   5306: 
                   5307:           <div class="itemizedlist">
                   5308:             <ul type="disc">
                   5309:               <li>
                   5310:                 <p><a xmlns=
                   5311:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5312:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.45      wiz      5313:                 target="_top"><code xmlns="" class=
                   5314:                 "filename">pkgtools/pkg_tarup</code></a>: Create a
1.20      ben      5315:                 binary package from an already-installed package.
1.34      wiz      5316:                 Used by <span><strong class="command">make
                   5317:                 replace</strong></span> to save the old
                   5318:                 package.</p>
1.1       grant    5319:               </li>
                   5320: 
                   5321:               <li>
                   5322:                 <p><a xmlns=
                   5323:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.5       hubertf  5324:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.45      wiz      5325:                 target="_top"><code xmlns="" class=
                   5326:                 "filename">pkgtools/dfdisk</code></a>: Adds extra
1.20      ben      5327:                 functionality to pkgsrc, allowing it to fetch
                   5328:                 distfiles from multiple locations. It currently
                   5329:                 supports the following methods: multiple CD-ROMs
                   5330:                 and network FTP/HTTP connections.</p>
1.5       hubertf  5331:               </li>
                   5332: 
                   5333:               <li>
                   5334:                 <p><a xmlns=
                   5335:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    5336:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45      wiz      5337:                 target="_top"><code xmlns="" class=
                   5338:                 "filename">pkgtools/xpkgwedge</code></a>: Put X11
1.34      wiz      5339:                 packages someplace else (enabled by default).</p>
1.1       grant    5340:               </li>
1.5       hubertf  5341: 
                   5342:               <li>
                   5343:                 <p><a xmlns=
                   5344:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5345:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45      wiz      5346:                 target="_top"><code xmlns="" class=
                   5347:                 "filename">devel/cpuflags</code></a>: Determine the
1.34      wiz      5348:                 best compiler flags to optimise code for your
1.20      ben      5349:                 current CPU and compiler.</p>
1.5       hubertf  5350:               </li>
1.1       grant    5351:             </ul>
                   5352:           </div>
                   5353: 
                   5354:           <p>Utilities for keeping track of installed packages,
                   5355:           being up to date, etc:</p>
                   5356: 
                   5357:           <div class="itemizedlist">
                   5358:             <ul type="disc">
                   5359:               <li>
                   5360:                 <p><a xmlns=
                   5361:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5362:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.45      wiz      5363:                 target="_top"><code xmlns="" class=
                   5364:                 "filename">pkgtools/pkg_chk</code></a>: Reports on
1.27      rillig   5365:                 packages whose installed versions do not match the
1.34      wiz      5366:                 latest pkgsrc entries.</p>
1.1       grant    5367:               </li>
                   5368: 
                   5369:               <li>
                   5370:                 <p><a xmlns=
                   5371:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5372:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45      wiz      5373:                 target="_top"><code xmlns="" class=
                   5374:                 "filename">pkgtools/pkgdep</code></a>: Makes
1.20      ben      5375:                 dependency graphs of packages, to aid in choosing a
1.34      wiz      5376:                 strategy for updating.</p>
1.1       grant    5377:               </li>
                   5378: 
                   5379:               <li>
                   5380:                 <p><a xmlns=
                   5381:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5382:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.45      wiz      5383:                 target="_top"><code xmlns="" class=
                   5384:                 "filename">pkgtools/pkgdepgraph</code></a>: Makes
1.27      rillig   5385:                 graphs from the output of <a xmlns=
                   5386:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5387:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45      wiz      5388:                 target="_top"><code xmlns="" class=
                   5389:                 "filename">pkgtools/pkgdep</code></a> (uses
1.34      wiz      5390:                 graphviz).</p>
1.1       grant    5391:               </li>
                   5392: 
                   5393:               <li>
                   5394:                 <p><a xmlns=
                   5395:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5396:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45      wiz      5397:                 target="_top"><code xmlns="" class=
                   5398:                 "filename">pkgtools/pkglint</code></a>: The
1.27      rillig   5399:                 pkglint(1) program checks a pkgsrc entry for
                   5400:                 errors, lintpkgsrc(1) does various checks on the
                   5401:                 complete pkgsrc system.</p>
1.1       grant    5402:               </li>
                   5403: 
                   5404:               <li>
                   5405:                 <p><a xmlns=
                   5406:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5407:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.45      wiz      5408:                 target="_top"><code xmlns="" class=
                   5409:                 "filename">pkgtools/pkgsurvey</code></a>: Report
                   5410:                 what packages you have installed.</p>
1.1       grant    5411:               </li>
                   5412:             </ul>
                   5413:           </div>
                   5414: 
                   5415:           <p>Utilities for people maintaining or creating
                   5416:           individual packages:</p>
                   5417: 
                   5418:           <div class="itemizedlist">
                   5419:             <ul type="disc">
                   5420:               <li>
                   5421:                 <p><a xmlns=
                   5422:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5423:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45      wiz      5424:                 target="_top"><code xmlns="" class=
                   5425:                 "filename">pkgtools/pkgdiff</code></a>: Automate
1.20      ben      5426:                 making and maintaining patches for a package
1.34      wiz      5427:                 (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1       grant    5428:               </li>
                   5429: 
                   5430:               <li>
                   5431:                 <p><a xmlns=
                   5432:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5433:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.45      wiz      5434:                 target="_top"><code xmlns="" class=
                   5435:                 "filename">pkgtools/rpm2pkg</code></a>, <a xmlns=
1.20      ben      5436:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5437:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45      wiz      5438:                 target="_top"><code xmlns="" class=
                   5439:                 "filename">pkgtools/url2pkg</code></a>: Aids in
1.34      wiz      5440:                 converting to pkgsrc.</p>
1.1       grant    5441:               </li>
                   5442: 
                   5443:               <li>
                   5444:                 <p><a xmlns=
                   5445:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5446:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.45      wiz      5447:                 target="_top"><code xmlns="" class=
                   5448:                 "filename">pkgtools/gensolpkg</code></a>: Convert
1.34      wiz      5449:                 pkgsrc to a Solaris package.</p>
1.1       grant    5450:               </li>
                   5451:             </ul>
                   5452:           </div>
                   5453: 
1.47      reed     5454:           <p>Utilities for people maintaining pkgsrc (or: more
1.1       grant    5455:           obscure pkg utilities)</p>
                   5456: 
                   5457:           <div class="itemizedlist">
                   5458:             <ul type="disc">
                   5459:               <li>
                   5460:                 <p><a xmlns=
                   5461:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5462:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.45      wiz      5463:                 target="_top"><code xmlns="" class=
                   5464:                 "filename">pkgtools/pkg_comp</code></a>: Build
1.34      wiz      5465:                 packages in a chrooted area.</p>
1.1       grant    5466:               </li>
                   5467: 
                   5468:               <li>
                   5469:                 <p><a xmlns=
                   5470:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5471:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.45      wiz      5472:                 target="_top"><code xmlns="" class=
                   5473:                 "filename">pkgtools/libkver</code></a>: Spoof
                   5474:                 kernel version for chrooted cross builds.</p>
1.1       grant    5475:               </li>
                   5476:             </ul>
                   5477:           </div>
                   5478:         </div>
                   5479: 
1.67      hubertf  5480:         <div class="sect1" lang="en">
1.1       grant    5481:           <div class="titlepage">
                   5482:             <div>
                   5483:               <div>
                   5484:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5485:                 "non-root-pkgsrc"></a>7.4.&nbsp;How to use pkgsrc
1.30      wiz      5486:                 as non-root</h2>
1.1       grant    5487:               </div>
                   5488:             </div>
                   5489:           </div>
                   5490: 
                   5491:           <p>If you want to use pkgsrc as non-root user, you can
                   5492:           set some variables to make pkgsrc work under these
1.33      jmmv     5493:           conditions. At the very least, you need to set
                   5494:           <code class="varname">UNPRIVILEGED</code> to
                   5495:           &#8220;<span class="quote">yes</span>&#8221;; this will
                   5496:           turn on unprivileged mode and set multiple related
                   5497:           variables to allow installation of packages as
                   5498:           non-root.</p>
                   5499: 
                   5500:           <p>In case the defaults are not enough, you may want to
                   5501:           tune some other variables used. For example, if the
                   5502:           automatic user/group detection leads to incorrect values
                   5503:           (or not the ones you would like to use), you can change
                   5504:           them by setting <code class=
                   5505:           "varname">UNPRIVILEGED_USER</code> and <code class=
                   5506:           "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
                   5507: 
                   5508:           <p>As regards bootstrapping, please note that the
                   5509:           <span><strong class="command">bootstrap</strong></span>
                   5510:           script will ease non-root configuration when given the
                   5511:           &#8220;<span class=
                   5512:           "quote">--ignore-user-check</span>&#8221; flag, as it
                   5513:           will choose and use multiple default directories under
1.45      wiz      5514:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5515:           class="filename">~/pkg</code> as the installation
1.33      jmmv     5516:           targets. These directories can be overriden by the
                   5517:           &#8220;<span class="quote">--prefix</span>&#8221; flag
                   5518:           provided by the script, as well as some others that allow
                   5519:           finer tuning of the tree layout.</p>
1.14      xtraeme  5520:         </div>
                   5521: 
1.67      hubertf  5522:         <div class="sect1" lang="en">
1.14      xtraeme  5523:           <div class="titlepage">
                   5524:             <div>
                   5525:               <div>
                   5526:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5527:                 "resume-transfers"></a>7.5.&nbsp;How to resume
1.30      wiz      5528:                 transfers when fetching distfiles?</h2>
1.14      xtraeme  5529:               </div>
                   5530:             </div>
                   5531:           </div>
                   5532: 
1.47      reed     5533:           <p>By default, resuming transfers in pkgsrc is disabled,
1.15      xtraeme  5534:           but you can enable this feature by adding the option
                   5535:           <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
1.45      wiz      5536:           into <code xmlns=
                   5537:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5538:           "filename">/etc/mk.conf</code>. If, during a fetch step,
                   5539:           an incomplete distfile is found, pkgsrc will try to
                   5540:           resume it.</p>
1.15      xtraeme  5541: 
                   5542:           <p>You can also use a different program than the default
1.24      wiz      5543:           <a href=
                   5544:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   5545:           <span class="citerefentry"><span class=
                   5546:           "refentrytitle">ftp</span>(1)</span></a> by changing the
                   5547:           <code class="varname">FETCH_CMD</code> variable. Don't
                   5548:           forget to set <code class=
                   5549:           "varname">FETCH_RESUME_ARGS</code> and <code class=
                   5550:           "varname">FETCH_OUTPUT_ARGS</code> if you are not using
                   5551:           default values.</p>
1.14      xtraeme  5552: 
1.45      wiz      5553:           <p>For example, if you want to use <code xmlns=
                   5554:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5555:           "filename">wget</code> to resume downloads, you'll have
                   5556:           to use something like:</p>
                   5557:           <pre class="programlisting">
1.51      rillig   5558:     FETCH_CMD=             wget
                   5559:     FETCH_BEFORE_ARGS=     --passive-ftp
                   5560:     FETCH_RESUME_ARGS=     -c
                   5561:     FETCH_OUTPUT_ARGS=     -O
1.14      xtraeme  5562: </pre>
1.1       grant    5563:         </div>
                   5564: 
1.67      hubertf  5565:         <div class="sect1" lang="en">
1.1       grant    5566:           <div class="titlepage">
                   5567:             <div>
                   5568:               <div>
                   5569:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5570:                 "XFree86-from-pkgsrc"></a>7.6.&nbsp;How can I
1.1       grant    5571:                 install/use XFree86 from pkgsrc?</h2>
                   5572:               </div>
                   5573:             </div>
                   5574:           </div>
                   5575: 
                   5576:           <p>If you want to use XFree86 from pkgsrc instead of your
1.45      wiz      5577:           system's own X11 (<code xmlns=
                   5578:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5579:           "filename">/usr/X11R6</code>, <code xmlns=
                   5580:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5581:           "filename">/usr/openwin</code>, ...), you will have to
1.45      wiz      5582:           add the following line into <code xmlns=
                   5583:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.15      xtraeme  5584:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    5585:           <pre class="programlisting">
1.51      rillig   5586:     X11_TYPE=XFree86
1.1       grant    5587: </pre>
                   5588:         </div>
                   5589: 
1.67      hubertf  5590:         <div class="sect1" lang="en">
1.1       grant    5591:           <div class="titlepage">
                   5592:             <div>
                   5593:               <div>
                   5594:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5595:                 "x.org-from-pkgsrc"></a>7.7.&nbsp;How can I
1.1       grant    5596:                 install/use X.org from pkgsrc?</h2>
                   5597:               </div>
                   5598:             </div>
                   5599:           </div>
                   5600: 
                   5601:           <p>If you want to use X.org from pkgsrc instead of your
1.45      wiz      5602:           system's own X11 (<code xmlns=
                   5603:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5604:           "filename">/usr/X11R6</code>, <code xmlns=
                   5605:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5606:           "filename">/usr/openwin</code>, ...) you will have to add
1.45      wiz      5607:           the following line into <code xmlns=
                   5608:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.15      xtraeme  5609:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    5610:           <pre class="programlisting">
1.51      rillig   5611:     X11_TYPE=xorg
1.1       grant    5612: </pre>
                   5613:         </div>
                   5614: 
1.67      hubertf  5615:         <div class="sect1" lang="en">
1.1       grant    5616:           <div class="titlepage">
                   5617:             <div>
                   5618:               <div>
                   5619:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5620:                 "fetch-behind-firewall"></a>7.8.&nbsp;How to fetch
1.30      wiz      5621:                 files from behind a firewall</h2>
1.1       grant    5622:               </div>
                   5623:             </div>
                   5624:           </div>
                   5625: 
                   5626:           <p>If you are sitting behind a firewall which does not
                   5627:           allow direct connections to Internet hosts (i.e.
                   5628:           non-NAT), you may specify the relevant proxy hosts. This
                   5629:           is done using an environment variable in the form of a
1.47      reed     5630:           URL, e.g. in Amdahl, the machine &#8220;<span class=
1.1       grant    5631:           "quote">orpheus.amdahl.com</span>&#8221; is one of the
                   5632:           firewalls, and it uses port 80 as the proxy port number.
                   5633:           So the proxy environment variables are:</p>
                   5634:           <pre class="programlisting">
1.51      rillig   5635:     ftp_proxy=ftp://orpheus.amdahl.com:80/
                   5636:     http_proxy=http://orpheus.amdahl.com:80/
1.1       grant    5637: </pre>
                   5638:         </div>
                   5639: 
1.67      hubertf  5640:         <div class="sect1" lang="en">
1.1       grant    5641:           <div class="titlepage">
                   5642:             <div>
                   5643:               <div>
                   5644:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  5645:                 "passive-ftp"></a>7.9.&nbsp;How do I tell
                   5646:                 <span><strong class="command">make
1.14      xtraeme  5647:                 fetch</strong></span> to do passive FTP?</h2>
1.1       grant    5648:               </div>
                   5649:             </div>
                   5650:           </div>
                   5651: 
                   5652:           <p>This depends on which utility is used to retrieve
1.45      wiz      5653:           distfiles. From <code xmlns=
                   5654:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5655:           "filename">bsd.pkg.mk</code>, <code class=
                   5656:           "varname">FETCH_CMD</code> is assigned the first
                   5657:           available command from the following list:</p>
1.34      wiz      5658: 
                   5659:           <div class="itemizedlist">
                   5660:             <ul type="disc">
                   5661:               <li>
1.45      wiz      5662:                 <p><code xmlns=
                   5663:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.34      wiz      5664:                 "filename">${LOCALBASE}/bin/ftp</code></p>
                   5665:               </li>
                   5666: 
                   5667:               <li>
1.45      wiz      5668:                 <p><code xmlns=
                   5669:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   5670:                 "filename">/usr/bin/ftp</code></p>
1.34      wiz      5671:               </li>
                   5672:             </ul>
                   5673:           </div>
1.1       grant    5674: 
                   5675:           <p>On a default NetBSD installation, this will be
1.45      wiz      5676:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5677:           class="filename">/usr/bin/ftp</code>, which automatically
                   5678:           tries passive connections first, and falls back to active
                   5679:           connections if the server refuses to do passive. For the
                   5680:           other tools, add the following to your <code xmlns=
                   5681:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5682:           "filename">/etc/mk.conf</code> file: <code class=
                   5683:           "varname">PASSIVE_FETCH=1</code>.</p>
1.1       grant    5684: 
1.45      wiz      5685:           <p>Having that option present will prevent <code xmlns=
                   5686:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5687:           "filename">/usr/bin/ftp</code> from falling back to
                   5688:           active transfers.</p>
1.1       grant    5689:         </div>
                   5690: 
1.67      hubertf  5691:         <div class="sect1" lang="en">
1.1       grant    5692:           <div class="titlepage">
                   5693:             <div>
                   5694:               <div>
                   5695:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5696:                 "fetching-all-distfiles"></a>7.10.&nbsp;How to
1.1       grant    5697:                 fetch all distfiles at once</h2>
                   5698:               </div>
                   5699:             </div>
                   5700:           </div>
                   5701: 
                   5702:           <p>You would like to download all the distfiles in a
                   5703:           single batch from work or university, where you can't run
1.14      xtraeme  5704:           a <span><strong class="command">make
                   5705:           fetch</strong></span>. There is an archive of distfiles
                   5706:           on <a href=
1.1       grant    5707:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
                   5708:           target="_top">ftp.NetBSD.org</a>, but downloading the
                   5709:           entire directory may not be appropriate.</p>
                   5710: 
1.14      xtraeme  5711:           <p>The answer here is to do a <span><strong class=
1.45      wiz      5712:           "command">make fetch-list</strong></span> in <code xmlns=
                   5713:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     5714:           "filename">/usr/pkgsrc</code> or one of its
1.1       grant    5715:           subdirectories, carry the resulting list to your machine
1.23      wiz      5716:           at work/school and use it there. If you don't have a
1.24      wiz      5717:           NetBSD-compatible <a href=
                   5718:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   5719:           <span class="citerefentry"><span class=
                   5720:           "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
                   5721:           at work, don't forget to set <code class=
                   5722:           "varname">FETCH_CMD</code> to something that fetches a
                   5723:           URL:</p>
1.1       grant    5724: 
                   5725:           <p>At home:</p>
                   5726:           <pre class="screen">
1.14      xtraeme  5727: <code class="prompt">%</code> <strong class=
                   5728: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   5729: <code class="prompt">%</code> <strong class=
                   5730: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles &gt;/tmp/fetch.sh</code></strong>
                   5731: <code class="prompt">%</code> <strong class=
                   5732: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1       grant    5733: </pre>
                   5734: 
                   5735:           <p>At work:</p>
                   5736:           <pre class="screen">
1.14      xtraeme  5737: <code class="prompt">%</code> <strong class=
                   5738: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1       grant    5739: </pre>
                   5740: 
1.45      wiz      5741:           <p>then tar up <code xmlns=
                   5742:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5743:           "filename">/tmp/distfiles</code> and take it home.</p>
1.1       grant    5744: 
                   5745:           <p>If you have a machine running NetBSD, and you want to
                   5746:           get <span class="emphasis"><em>all</em></span> distfiles
                   5747:           (even ones that aren't for your machine architecture),
                   5748:           you can do so by using the above-mentioned
1.14      xtraeme  5749:           <span><strong class="command">make
                   5750:           fetch-list</strong></span> approach, or fetch the
                   5751:           distfiles directly by running:</p>
1.1       grant    5752:           <pre class="screen">
1.14      xtraeme  5753: <code class="prompt">%</code> <strong class=
                   5754: "userinput"><code>make mirror-distfiles</code></strong>
1.1       grant    5755: </pre>
                   5756: 
1.14      xtraeme  5757:           <p>If you even decide to ignore <code class=
                   5758:           "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
                   5759:           can get everything by running:</p>
1.1       grant    5760:           <pre class="screen">
1.14      xtraeme  5761: <code class="prompt">%</code> <strong class=
                   5762: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1       grant    5763: </pre>
                   5764:         </div>
                   5765: 
1.67      hubertf  5766:         <div class="sect1" lang="en">
1.1       grant    5767:           <div class="titlepage">
                   5768:             <div>
                   5769:               <div>
                   5770:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5771:                 "tmac.andoc-missing"></a>7.11.&nbsp;What does
1.1       grant    5772:                 &#8220;<span class="quote">Don't know how to make
                   5773:                 /usr/share/tmac/tmac.andoc</span>&#8221; mean?</h2>
                   5774:               </div>
                   5775:             </div>
                   5776:           </div>
                   5777: 
                   5778:           <p>When compiling the <a xmlns=
                   5779:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5780:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45      wiz      5781:           target="_top"><code xmlns="" class=
                   5782:           "filename">pkgtools/pkg_install</code></a> package, you
                   5783:           get the error from make that it doesn't know how to make
                   5784:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5785:           class="filename">/usr/share/tmac/tmac.andoc</code>? This
                   5786:           indicates that you don't have installed the
1.23      wiz      5787:           &#8220;<span class="quote">text</span>&#8221; set (nroff,
                   5788:           ...) from the NetBSD base distribution on your machine.
1.47      reed     5789:           It is recommended to do that to format man pages.</p>
1.1       grant    5790: 
                   5791:           <p>In the case of the <a xmlns=
                   5792:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5793:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45      wiz      5794:           target="_top"><code xmlns="" class=
                   5795:           "filename">pkgtools/pkg_install</code></a> package, you
                   5796:           can get away with setting <code class=
1.20      ben      5797:           "varname">NOMAN=YES</code> either in the environment or
1.45      wiz      5798:           in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5799:           class="filename">/etc/mk.conf</code>.</p>
1.1       grant    5800:         </div>
                   5801: 
1.67      hubertf  5802:         <div class="sect1" lang="en">
1.1       grant    5803:           <div class="titlepage">
                   5804:             <div>
                   5805:               <div>
                   5806:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5807:                 "bsd.own.mk-missing"></a>7.12.&nbsp;What does
1.1       grant    5808:                 &#8220;<span class="quote">Could not find
                   5809:                 bsd.own.mk</span>&#8221; mean?</h2>
                   5810:               </div>
                   5811:             </div>
                   5812:           </div>
                   5813: 
1.45      wiz      5814:           <p>You didn't install the compiler set, <code xmlns=
                   5815:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5816:           "filename">comp.tgz</code>, when you installed your
1.47      reed     5817:           NetBSD machine. Please get and install it, by extracting
                   5818:           it in <code xmlns=
1.45      wiz      5819:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5820:           "filename">/</code>:</p>
1.1       grant    5821:           <pre class="screen">
1.14      xtraeme  5822: <code class="prompt">#</code> <strong class=
                   5823: "userinput"><code>cd /</code></strong>
                   5824: <code class="prompt">#</code> <strong class=
                   5825: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1       grant    5826: </pre>
                   5827: 
1.45      wiz      5828:           <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5829:           class="filename">comp.tgz</code> is part of every NetBSD
                   5830:           release. Get the one that corresponds to your release
                   5831:           (determine via <span><strong class="command">uname
                   5832:           -r</strong></span>).</p>
1.1       grant    5833:         </div>
                   5834: 
1.67      hubertf  5835:         <div class="sect1" lang="en">
1.1       grant    5836:           <div class="titlepage">
                   5837:             <div>
                   5838:               <div>
                   5839:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5840:                 "using-sudo-with-pkgsrc"></a>7.13.&nbsp;Using
1.1       grant    5841:                 'sudo' with pkgsrc</h2>
                   5842:               </div>
                   5843:             </div>
                   5844:           </div>
                   5845: 
                   5846:           <p>When installing packages as non-root user and using
1.24      wiz      5847:           the just-in-time <a href=
                   5848:           "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
                   5849:           <span class="citerefentry"><span class=
                   5850:           "refentrytitle">su</span>(1)</span></a> feature of
                   5851:           pkgsrc, it can become annoying to type in the root
                   5852:           password for each required package installed. To avoid
                   5853:           this, the sudo package can be used, which does password
                   5854:           caching over a limited time. To use it, install sudo
                   5855:           (either as binary package or from <a xmlns=
                   5856:           "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    5857:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.45      wiz      5858:           target="_top"><code xmlns="" class=
                   5859:           "filename">security/sudo</code></a>) and then put the
                   5860:           following into your <code xmlns=
                   5861:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      5862:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    5863:           <pre class="programlisting">
1.51      rillig   5864:     .if exists(${LOCALBASE}/bin/sudo)
                   5865:     SU_CMD=        ${LOCALBASE}/bin/sudo /bin/sh -c
                   5866:     .endif
1.1       grant    5867: </pre>
                   5868:         </div>
                   5869: 
1.67      hubertf  5870:         <div class="sect1" lang="en">
1.1       grant    5871:           <div class="titlepage">
                   5872:             <div>
                   5873:               <div>
                   5874:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  5875:                 "faq.conf"></a>7.14.&nbsp;How do I change the
                   5876:                 location of configuration files?</h2>
1.1       grant    5877:               </div>
                   5878:             </div>
                   5879:           </div>
                   5880: 
1.35      jmmv     5881:           <p>As the system administrator, you can choose where
                   5882:           configuration files are installed. The default settings
1.45      wiz      5883:           make all these files go into <code xmlns=
                   5884:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     5885:           "filename">${PREFIX}/etc</code> or some of its
                   5886:           subdirectories; this may be suboptimal depending on your
                   5887:           expectations (e.g., a read-only, NFS-exported
                   5888:           <code class="varname">PREFIX</code> with a need of
                   5889:           per-machine configuration of the provided packages).</p>
                   5890: 
                   5891:           <p>In order to change the defaults, you can modify the
                   5892:           <code class="varname">PKG_SYSCONFBASE</code> variable (in
1.45      wiz      5893:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5894:           class="filename">/etc/mk.conf</code>) to point to your
                   5895:           preferred configuration directory; some common examples
                   5896:           include <code xmlns=
                   5897:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5898:           "filename">/etc</code> or <code xmlns=
                   5899:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5900:           "filename">/etc/pkg</code>.</p>
1.35      jmmv     5901: 
                   5902:           <p>Furthermore, you can change this value on a
                   5903:           per-package basis by setting the <code class=
                   5904:           "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   5905:           variable. <code class="varname">PKG_SYSCONFVAR</code>'s
                   5906:           value usually matches the name of the package you would
                   5907:           like to modify, that is, the contents of <code class=
                   5908:           "varname">PKGBASE</code>.</p>
1.1       grant    5909: 
1.47      reed     5910:           <p>Note that after changing these settings, you must
1.35      jmmv     5911:           rebuild and reinstall any affected packages.</p>
1.1       grant    5912:         </div>
                   5913: 
1.67      hubertf  5914:         <div class="sect1" lang="en">
1.1       grant    5915:           <div class="titlepage">
                   5916:             <div>
                   5917:               <div>
                   5918:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5919:                 "audit-packages"></a>7.15.&nbsp;Automated security
1.1       grant    5920:                 checks</h2>
                   5921:               </div>
                   5922:             </div>
                   5923:           </div>
                   5924: 
                   5925:           <p>Please be aware that there can often be bugs in
                   5926:           third-party software, and some of these bugs can leave a
                   5927:           machine vulnerable to exploitation by attackers. In an
                   5928:           effort to lessen the exposure, the NetBSD packages team
                   5929:           maintains a database of known-exploits to packages which
                   5930:           have at one time been included in pkgsrc. The database
                   5931:           can be downloaded automatically, and a security audit of
                   5932:           all packages installed on a system can take place. To do
                   5933:           this, install the <a xmlns=
                   5934:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5935:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45      wiz      5936:           target="_top"><code xmlns="" class=
                   5937:           "filename">security/audit-packages</code></a> package. It
1.20      ben      5938:           has two components:</p>
1.1       grant    5939: 
                   5940:           <div class="orderedlist">
                   5941:             <ol type="1">
                   5942:               <li>
1.34      wiz      5943:                 <p><span><strong class=
                   5944:                 "command">download-vulnerability-list</strong></span>,
1.1       grant    5945:                 an easy way to download a list of the security
                   5946:                 vulnerabilities information. This list is kept up
                   5947:                 to date by the NetBSD security officer and the
                   5948:                 NetBSD packages team, and is distributed from the
                   5949:                 NetBSD ftp server:</p>
                   5950: 
                   5951:                 <p><a href=
                   5952:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20      ben      5953:                 target=
                   5954:                 "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1       grant    5955:               </li>
                   5956: 
                   5957:               <li>
1.34      wiz      5958:                 <p><span><strong class=
                   5959:                 "command">audit-packages</strong></span>, an easy
                   5960:                 way to audit the current machine, checking each
1.1       grant    5961:                 vulnerability which is known. If a vulnerable
                   5962:                 package is installed, it will be shown by output to
                   5963:                 stdout, including a description of the type of
                   5964:                 vulnerability, and a URL containing more
                   5965:                 information.</p>
                   5966:               </li>
                   5967:             </ol>
                   5968:           </div>
                   5969: 
1.23      wiz      5970:           <p>Use of the <a xmlns=
                   5971:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5972:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45      wiz      5973:           target="_top"><code xmlns="" class=
                   5974:           "filename">security/audit-packages</code></a> package is
1.23      wiz      5975:           strongly recommended! After &#8220;<span class=
                   5976:           "quote">audit-packages</span>&#8221; is installed, please
                   5977:           read the package's message, which you can get by running
                   5978:           <strong class="userinput"><code>pkg_info -D
1.65      hubertf  5979:           audit-packages</code></strong>.</p>
1.58      erh      5980: 
                   5981:           <p>If this package is installed, pkgsrc builds will use
                   5982:           it to perform a security check before building any
                   5983:           package. See <a href="#variables-affecting-build" title=
                   5984:           "5.2.&nbsp;Variables affecting the build process">Section&nbsp;5.2,
                   5985:           &#8220;Variables affecting the build process&#8221;</a>
1.59      rillig   5986:           for ways to control this check.</p>
1.1       grant    5987:         </div>
                   5988:       </div>
                   5989:     </div>
                   5990: 
1.67      hubertf  5991:     <div class="part" lang="en">
1.1       grant    5992:       <div class="titlepage">
                   5993:         <div>
                   5994:           <div>
1.67      hubertf  5995:             <h1 class="title"><a name=
1.48      dillo    5996:             "developers-guide"></a>Part&nbsp;II.&nbsp;The pkgsrc
                   5997:             developer's guide</h1>
1.1       grant    5998:           </div>
                   5999:         </div>
                   6000:       </div>
                   6001: 
                   6002:       <div class="toc">
                   6003:         <p><b>Table of Contents</b></p>
                   6004: 
                   6005:         <dl>
1.38      dillo    6006:           <dt><span class="chapter"><a href="#components">8.
1.27      rillig   6007:           Package components - files, directories and
                   6008:           contents</a></span></dt>
                   6009: 
                   6010:           <dd>
                   6011:             <dl>
                   6012:               <dt><span class="sect1"><a href=
1.45      wiz      6013:               "#components.Makefile">8.1. <code xmlns=
                   6014:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6015:               "filename">Makefile</code></a></span></dt>
                   6016: 
                   6017:               <dt><span class="sect1"><a href=
1.45      wiz      6018:               "#components.distinfo">8.2. <code xmlns=
                   6019:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6020:               "filename">distinfo</code></a></span></dt>
                   6021: 
                   6022:               <dt><span class="sect1"><a href=
1.38      dillo    6023:               "#components.patches">8.3. patches/*</a></span></dt>
1.27      rillig   6024: 
1.30      wiz      6025:               <dt><span class="sect1"><a href=
1.38      dillo    6026:               "#other-mandatory-files">8.4. Other mandatory
1.30      wiz      6027:               files</a></span></dt>
1.27      rillig   6028: 
                   6029:               <dt><span class="sect1"><a href=
1.38      dillo    6030:               "#components.optional">8.5. Optional
1.27      rillig   6031:               files</a></span></dt>
                   6032: 
1.38      dillo    6033:               <dt><span class="sect1"><a href="#work-dir">8.6.
1.45      wiz      6034:               <code xmlns=
                   6035:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   6036:               "filename">work*</code></a></span></dt>
1.27      rillig   6037: 
1.38      dillo    6038:               <dt><span class="sect1"><a href="#files-dir">8.7.
1.45      wiz      6039:               <code xmlns=
                   6040:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   6041:               "filename">files/*</code></a></span></dt>
1.27      rillig   6042:             </dl>
                   6043:           </dd>
                   6044: 
1.38      dillo    6045:           <dt><span class="chapter"><a href="#makefile">9.
1.45      wiz      6046:           Programming in <code xmlns=
                   6047:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.25      rillig   6048:           "filename">Makefile</code>s</a></span></dt>
                   6049: 
                   6050:           <dd>
                   6051:             <dl>
                   6052:               <dt><span class="sect1"><a href=
1.45      wiz      6053:               "#makefile.variables">9.1. <code xmlns=
                   6054:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.25      rillig   6055:               "filename">Makefile</code> variables</a></span></dt>
                   6056: 
1.27      rillig   6057:               <dd>
                   6058:                 <dl>
                   6059:                   <dt><span class="sect2"><a href=
1.38      dillo    6060:                   "#makefile.variables.names">9.1.1. Naming
1.27      rillig   6061:                   conventions</a></span></dt>
                   6062:                 </dl>
                   6063:               </dd>
                   6064: 
1.38      dillo    6065:               <dt><span class="sect1"><a href="#makefile.code">9.2.
1.25      rillig   6066:               Code snippets</a></span></dt>
                   6067: 
                   6068:               <dd>
                   6069:                 <dl>
                   6070:                   <dt><span class="sect2"><a href=
1.38      dillo    6071:                   "#adding-to-list">9.2.1. Adding things to a
1.25      rillig   6072:                   list</a></span></dt>
                   6073: 
                   6074:                   <dt><span class="sect2"><a href=
1.38      dillo    6075:                   "#converting-internal-to-external">9.2.2.
1.30      wiz      6076:                   Converting an internal list into an external
                   6077:                   list</a></span></dt>
1.25      rillig   6078: 
                   6079:                   <dt><span class="sect2"><a href=
1.38      dillo    6080:                   "#passing-variable-to-shell">9.2.3. Passing
1.30      wiz      6081:                   variables to a shell command</a></span></dt>
1.27      rillig   6082: 
                   6083:                   <dt><span class="sect2"><a href=
1.38      dillo    6084:                   "#quoting-guideline">9.2.4. Quoting
1.27      rillig   6085:                   guideline</a></span></dt>
                   6086: 
                   6087:                   <dt><span class="sect2"><a href=
1.38      dillo    6088:                   "#bsd-make-bug-workaround">9.2.5. Workaround for
1.30      wiz      6089:                   a bug in BSD Make</a></span></dt>
1.25      rillig   6090:                 </dl>
                   6091:               </dd>
                   6092:             </dl>
                   6093:           </dd>
                   6094: 
1.38      dillo    6095:           <dt><span class="chapter"><a href="#plist">10. PLIST
1.1       grant    6096:           issues</a></span></dt>
                   6097: 
                   6098:           <dd>
                   6099:             <dl>
1.38      dillo    6100:               <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1       grant    6101:               ID</a></span></dt>
                   6102: 
1.30      wiz      6103:               <dt><span class="sect1"><a href=
1.38      dillo    6104:               "#automatic-plist-generation">10.2. Semi-automatic
1.45      wiz      6105:               <code xmlns=
                   6106:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   6107:               "filename">PLIST</code> generation</a></span></dt>
1.1       grant    6108: 
1.38      dillo    6109:               <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14      xtraeme  6110:               Tweaking output of <span><strong class="command">make
                   6111:               print-PLIST</strong></span></a></span></dt>
1.1       grant    6112: 
1.38      dillo    6113:               <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1       grant    6114:               Variable substitution in PLIST</a></span></dt>
                   6115: 
1.30      wiz      6116:               <dt><span class="sect1"><a href=
1.48      dillo    6117:               "#manpage-compression">10.5. Man page
                   6118:               compression</a></span></dt>
1.1       grant    6119: 
1.30      wiz      6120:               <dt><span class="sect1"><a href=
1.38      dillo    6121:               "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30      wiz      6122:               <code class=
1.14      xtraeme  6123:               "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    6124: 
1.30      wiz      6125:               <dt><span class="sect1"><a href=
1.47      reed     6126:               "#platform-specific-plist">10.7. Platform-specific
1.38      dillo    6127:               and differing PLISTs</a></span></dt>
1.1       grant    6128: 
                   6129:               <dt><span class="sect1"><a href=
1.38      dillo    6130:               "#faq.common-dirs">10.8. Sharing directories between
1.1       grant    6131:               packages</a></span></dt>
                   6132:             </dl>
                   6133:           </dd>
                   6134: 
1.38      dillo    6135:           <dt><span class="chapter"><a href="#buildlink">11.
1.1       grant    6136:           Buildlink methodology</a></span></dt>
                   6137: 
                   6138:           <dd>
                   6139:             <dl>
1.30      wiz      6140:               <dt><span class="sect1"><a href=
1.38      dillo    6141:               "#converting-to-buildlink3">11.1. Converting packages
1.30      wiz      6142:               to use buildlink3</a></span></dt>
1.1       grant    6143: 
1.30      wiz      6144:               <dt><span class="sect1"><a href=
1.45      wiz      6145:               "#creating-buildlink3.mk">11.2. Writing <code xmlns=
                   6146:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      6147:               "filename">buildlink3.mk</code> files</a></span></dt>
1.1       grant    6148: 
                   6149:               <dd>
                   6150:                 <dl>
                   6151:                   <dt><span class="sect2"><a href=
1.38      dillo    6152:                   "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30      wiz      6153:                   buildlink3.mk file</a></span></dt>
1.1       grant    6154: 
                   6155:                   <dt><span class="sect2"><a href=
1.38      dillo    6156:                   "#updating-buildlink-depends">11.2.2. Updating
1.30      wiz      6157:                   <code class=
1.67      hubertf  6158:                   "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                   6159:                   in <code xmlns=
1.45      wiz      6160:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      6161:                   "filename">buildlink3.mk</code>
1.1       grant    6162:                   files</a></span></dt>
                   6163:                 </dl>
                   6164:               </dd>
                   6165: 
1.30      wiz      6166:               <dt><span class="sect1"><a href=
1.45      wiz      6167:               "#writing-builtin.mk">11.3. Writing <code xmlns=
                   6168:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      6169:               "filename">builtin.mk</code> files</a></span></dt>
1.1       grant    6170: 
                   6171:               <dd>
                   6172:                 <dl>
                   6173:                   <dt><span class="sect2"><a href=
1.38      dillo    6174:                   "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45      wiz      6175:                   <code xmlns=
                   6176:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   6177:                   "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    6178: 
                   6179:                   <dt><span class="sect2"><a href=
1.38      dillo    6180:                   "#native-or-pkgsrc-preference">11.3.2. Global
1.30      wiz      6181:                   preferences for native or pkgsrc
                   6182:                   software</a></span></dt>
1.1       grant    6183:                 </dl>
                   6184:               </dd>
                   6185:             </dl>
                   6186:           </dd>
                   6187: 
1.38      dillo    6188:           <dt><span class="chapter"><a href="#pkginstall">12. The
1.35      jmmv     6189:           pkginstall framework</a></span></dt>
                   6190: 
                   6191:           <dd>
                   6192:             <dl>
                   6193:               <dt><span class="sect1"><a href=
1.38      dillo    6194:               "#files-and-dirs-outside-prefix">12.1. Files and
1.35      jmmv     6195:               directories outside the installation
                   6196:               prefix</a></span></dt>
                   6197: 
                   6198:               <dd>
                   6199:                 <dl>
                   6200:                   <dt><span class="sect2"><a href=
1.38      dillo    6201:                   "#dirs-outside-prefix">12.1.1. Directory
1.35      jmmv     6202:                   manipulation</a></span></dt>
                   6203: 
                   6204:                   <dt><span class="sect2"><a href=
1.38      dillo    6205:                   "#files-outside-prefix">12.1.2. File
1.35      jmmv     6206:                   manipulation</a></span></dt>
                   6207:                 </dl>
                   6208:               </dd>
                   6209: 
1.38      dillo    6210:               <dt><span class="sect1"><a href="#conf-files">12.2.
1.35      jmmv     6211:               Configuration files</a></span></dt>
                   6212: 
                   6213:               <dd>
                   6214:                 <dl>
                   6215:                   <dt><span class="sect2"><a href=
1.38      dillo    6216:                   "#conf-files-sysconfdir">12.2.1. How <code class=
1.35      jmmv     6217:                   "varname">PKG_SYSCONFDIR</code> is
                   6218:                   set</a></span></dt>
                   6219: 
                   6220:                   <dt><span class="sect2"><a href=
1.38      dillo    6221:                   "#conf-files-configure">12.2.2. Telling the
1.47      reed     6222:                   software where configuration files
1.35      jmmv     6223:                   are</a></span></dt>
                   6224: 
                   6225:                   <dt><span class="sect2"><a href=
1.38      dillo    6226:                   "#conf-files-patching">12.2.3. Patching
1.35      jmmv     6227:                   installations</a></span></dt>
                   6228: 
                   6229:                   <dt><span class="sect2"><a href=
1.38      dillo    6230:                   "#conf-files-disable">12.2.4. Disabling handling
1.35      jmmv     6231:                   of configuration files</a></span></dt>
                   6232:                 </dl>
                   6233:               </dd>
                   6234: 
1.38      dillo    6235:               <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35      jmmv     6236:               System startup scripts</a></span></dt>
                   6237: 
                   6238:               <dd>
                   6239:                 <dl>
                   6240:                   <dt><span class="sect2"><a href=
1.38      dillo    6241:                   "#rcd-scripts-disable">12.3.1. Disabling handling
1.35      jmmv     6242:                   of system startup scripts</a></span></dt>
                   6243:                 </dl>
                   6244:               </dd>
                   6245: 
                   6246:               <dt><span class="sect1"><a href=
1.38      dillo    6247:               "#users-and-groups">12.4. System users and
1.35      jmmv     6248:               groups</a></span></dt>
                   6249: 
1.38      dillo    6250:               <dt><span class="sect1"><a href="#shells">12.5.
1.35      jmmv     6251:               System shells</a></span></dt>
                   6252: 
                   6253:               <dd>
                   6254:                 <dl>
                   6255:                   <dt><span class="sect2"><a href=
1.65      hubertf  6256:                   "#shells-disable">12.5.1. Disabling shell
                   6257:                   registration</a></span></dt>
                   6258:                 </dl>
                   6259:               </dd>
                   6260: 
                   6261:               <dt><span class="sect1"><a href="#fonts">12.6.
                   6262:               Fonts</a></span></dt>
                   6263: 
                   6264:               <dd>
                   6265:                 <dl>
                   6266:                   <dt><span class="sect2"><a href=
                   6267:                   "#fonts-disable">12.6.1. Disabling automatic
                   6268:                   update of the fonts databases</a></span></dt>
1.35      jmmv     6269:                 </dl>
                   6270:               </dd>
                   6271:             </dl>
                   6272:           </dd>
                   6273: 
1.38      dillo    6274:           <dt><span class="chapter"><a href="#options">13. Options
1.1       grant    6275:           handling</a></span></dt>
                   6276: 
                   6277:           <dd>
                   6278:             <dl>
1.30      wiz      6279:               <dt><span class="sect1"><a href=
1.38      dillo    6280:               "#global-default-options">13.1. Global default
1.30      wiz      6281:               options</a></span></dt>
1.1       grant    6282: 
1.30      wiz      6283:               <dt><span class="sect1"><a href=
1.38      dillo    6284:               "#converting-to-options">13.2. Converting packages to
1.45      wiz      6285:               use <code xmlns=
                   6286:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6287:               "filename">bsd.options.mk</code></a></span></dt>
1.48      dillo    6288: 
                   6289:               <dt><span class="sect1"><a href="#option-names">13.3.
                   6290:               Option Names</a></span></dt>
1.1       grant    6291:             </dl>
                   6292:           </dd>
                   6293: 
1.38      dillo    6294:           <dt><span class="chapter"><a href="#build">14. The build
1.1       grant    6295:           process</a></span></dt>
                   6296: 
                   6297:           <dd>
                   6298:             <dl>
1.56      rillig   6299:               <dt><span class="sect1"><a href="#build.intro">14.1.
                   6300:               Introduction</a></span></dt>
                   6301: 
                   6302:               <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1       grant    6303:               Program location</a></span></dt>
                   6304: 
1.56      rillig   6305:               <dt><span class="sect1"><a href=
                   6306:               "#build.builddirs">14.3. Directories used during the
                   6307:               build process</a></span></dt>
1.1       grant    6308: 
                   6309:               <dt><span class="sect1"><a href=
1.56      rillig   6310:               "#build.running">14.4. Running a
                   6311:               phase</a></span></dt>
                   6312: 
                   6313:               <dt><span class="sect1"><a href="#build.fetch">14.5.
                   6314:               The <span class="emphasis"><em>fetch</em></span>
                   6315:               phase</a></span></dt>
                   6316: 
                   6317:               <dt><span class="sect1"><a href=
                   6318:               "#build.checksum">14.6. The <span class=
                   6319:               "emphasis"><em>checksum</em></span>
                   6320:               phase</a></span></dt>
                   6321: 
                   6322:               <dt><span class="sect1"><a href=
                   6323:               "#build.extract">14.7. The <span class=
                   6324:               "emphasis"><em>extract</em></span>
                   6325:               phase</a></span></dt>
                   6326: 
                   6327:               <dt><span class="sect1"><a href="#build.patch">14.8.
                   6328:               The <span class="emphasis"><em>patch</em></span>
                   6329:               phase</a></span></dt>
                   6330: 
                   6331:               <dt><span class="sect1"><a href="#build.tools">14.9.
                   6332:               The <span class="emphasis"><em>tools</em></span>
                   6333:               phase</a></span></dt>
                   6334: 
                   6335:               <dt><span class="sect1"><a href=
                   6336:               "#build.wrapper">14.10. The <span class=
                   6337:               "emphasis"><em>wrapper</em></span>
                   6338:               phase</a></span></dt>
                   6339: 
                   6340:               <dt><span class="sect1"><a href=
                   6341:               "#build.configure">14.11. The <span class=
                   6342:               "emphasis"><em>configure</em></span>
                   6343:               phase</a></span></dt>
                   6344: 
                   6345:               <dt><span class="sect1"><a href="#build.build">14.12.
                   6346:               The <span class="emphasis"><em>build</em></span>
                   6347:               phase</a></span></dt>
                   6348: 
                   6349:               <dt><span class="sect1"><a href="#build.test">14.13.
                   6350:               The <span class="emphasis"><em>test</em></span>
                   6351:               phase</a></span></dt>
                   6352: 
                   6353:               <dt><span class="sect1"><a href=
                   6354:               "#build.install">14.14. The <span class=
                   6355:               "emphasis"><em>install</em></span>
                   6356:               phase</a></span></dt>
                   6357: 
                   6358:               <dt><span class="sect1"><a href=
                   6359:               "#build.package">14.15. The <span class=
                   6360:               "emphasis"><em>package</em></span>
                   6361:               phase</a></span></dt>
                   6362: 
                   6363:               <dt><span class="sect1"><a href=
                   6364:               "#build.helpful-targets">14.16. Other helpful
1.1       grant    6365:               targets</a></span></dt>
                   6366:             </dl>
                   6367:           </dd>
                   6368: 
1.68      rillig   6369:           <dt><span class="chapter"><a href="#tools">15. Tools
                   6370:           needed for building or running</a></span></dt>
                   6371: 
                   6372:           <dd>
                   6373:             <dl>
                   6374:               <dt><span class="sect1"><a href="#pkgsrc-tools">15.1.
                   6375:               Tools for pkgsrc builds</a></span></dt>
                   6376: 
                   6377:               <dt><span class="sect1"><a href=
                   6378:               "#package-tools">15.2. Tools needed by
                   6379:               packages</a></span></dt>
                   6380: 
                   6381:               <dt><span class="sect1"><a href=
                   6382:               "#platform-tools">15.3. Tools provided by
                   6383:               platforms</a></span></dt>
                   6384:             </dl>
                   6385:           </dd>
                   6386: 
                   6387:           <dt><span class="chapter"><a href="#fixes">16. Making
1.55      rillig   6388:           your package work</a></span></dt>
1.1       grant    6389: 
                   6390:           <dd>
                   6391:             <dl>
1.30      wiz      6392:               <dt><span class="sect1"><a href=
1.68      rillig   6393:               "#general-operation">16.1. General
1.30      wiz      6394:               operation</a></span></dt>
1.1       grant    6395: 
                   6396:               <dd>
                   6397:                 <dl>
                   6398:                   <dt><span class="sect2"><a href=
1.68      rillig   6399:                   "#pulling-vars-from-etc-mk.conf">16.1.1. How to
1.30      wiz      6400:                   pull in variables from
                   6401:                   /etc/mk.conf</a></span></dt>
1.1       grant    6402: 
                   6403:                   <dt><span class="sect2"><a href=
1.68      rillig   6404:                   "#where-to-install-documentation">16.1.2. Where
1.31      wiz      6405:                   to install documentation</a></span></dt>
                   6406: 
                   6407:                   <dt><span class="sect2"><a href=
1.68      rillig   6408:                   "#restricted-packages">16.1.3. Restricted
1.1       grant    6409:                   packages</a></span></dt>
                   6410: 
                   6411:                   <dt><span class="sect2"><a href=
1.68      rillig   6412:                   "#dependencies">16.1.4. Handling
1.1       grant    6413:                   dependencies</a></span></dt>
                   6414: 
                   6415:                   <dt><span class="sect2"><a href=
1.68      rillig   6416:                   "#conflicts">16.1.5. Handling conflicts with
1.1       grant    6417:                   other packages</a></span></dt>
                   6418: 
                   6419:                   <dt><span class="sect2"><a href=
1.68      rillig   6420:                   "#not-building-packages">16.1.6. Packages that
1.30      wiz      6421:                   cannot or should not be built</a></span></dt>
1.1       grant    6422: 
                   6423:                   <dt><span class="sect2"><a href=
1.68      rillig   6424:                   "#undeletable-packages">16.1.7. Packages which
1.30      wiz      6425:                   should not be deleted, once
                   6426:                   installed</a></span></dt>
1.1       grant    6427: 
                   6428:                   <dt><span class="sect2"><a href=
1.68      rillig   6429:                   "#security-handling">16.1.8. Handling packages
1.1       grant    6430:                   with security problems</a></span></dt>
                   6431: 
                   6432:                   <dt><span class="sect2"><a href=
1.68      rillig   6433:                   "#compiler-bugs">16.1.9. How to handle compiler
1.1       grant    6434:                   bugs</a></span></dt>
                   6435: 
                   6436:                   <dt><span class="sect2"><a href=
1.68      rillig   6437:                   "#bumping-pkgrevision">16.1.10. How to handle
1.30      wiz      6438:                   incrementing versions when fixing an existing
1.1       grant    6439:                   package</a></span></dt>
                   6440: 
                   6441:                   <dt><span class="sect2"><a href=
1.68      rillig   6442:                   "#portability-of-packages">16.1.11. Portability
1.30      wiz      6443:                   of packages</a></span></dt>
1.1       grant    6444:                 </dl>
                   6445:               </dd>
                   6446: 
1.30      wiz      6447:               <dt><span class="sect1"><a href=
1.68      rillig   6448:               "#downloading-issues">16.2. Possible downloading
1.30      wiz      6449:               issues</a></span></dt>
1.1       grant    6450: 
                   6451:               <dd>
                   6452:                 <dl>
                   6453:                   <dt><span class="sect2"><a href=
1.68      rillig   6454:                   "#no-plain-download">16.2.1. Packages whose
1.30      wiz      6455:                   distfiles aren't available for plain
1.1       grant    6456:                   downloading</a></span></dt>
                   6457: 
                   6458:                   <dt><span class="sect2"><a href=
1.68      rillig   6459:                   "#modified-distfiles-same-name">16.2.2. How to
1.30      wiz      6460:                   handle modified distfiles with the 'old'
                   6461:                   name</a></span></dt>
1.1       grant    6462:                 </dl>
                   6463:               </dd>
                   6464: 
1.30      wiz      6465:               <dt><span class="sect1"><a href=
1.68      rillig   6466:               "#configuration-gotchas">16.3. Configuration
1.30      wiz      6467:               gotchas</a></span></dt>
1.1       grant    6468: 
                   6469:               <dd>
                   6470:                 <dl>
                   6471:                   <dt><span class="sect2"><a href=
1.68      rillig   6472:                   "#fixes.libtool">16.3.1. Shared libraries -
1.1       grant    6473:                   libtool</a></span></dt>
                   6474: 
                   6475:                   <dt><span class="sect2"><a href=
1.68      rillig   6476:                   "#using-libtool">16.3.2. Using libtool on GNU
1.1       grant    6477:                   packages that already support
                   6478:                   libtool</a></span></dt>
                   6479: 
                   6480:                   <dt><span class="sect2"><a href=
1.68      rillig   6481:                   "#autoconf-automake">16.3.3. GNU
1.1       grant    6482:                   Autoconf/Automake</a></span></dt>
                   6483:                 </dl>
                   6484:               </dd>
                   6485: 
1.68      rillig   6486:               <dt><span class="sect1"><a href="#fixes-build">16.4.
1.55      rillig   6487:               Building the package</a></span></dt>
1.1       grant    6488: 
                   6489:               <dd>
                   6490:                 <dl>
                   6491:                   <dt><span class="sect2"><a href=
1.68      rillig   6492:                   "#cpp-defines">16.4.1. CPP
1.30      wiz      6493:                   defines</a></span></dt>
1.51      rillig   6494: 
                   6495:                   <dt><span class="sect2"><a href=
1.68      rillig   6496:                   "#cpp-list-examples">16.4.2. Examples of CPP
1.60      rillig   6497:                   defines for some platforms</a></span></dt>
                   6498: 
                   6499:                   <dt><span class="sect2"><a href=
1.68      rillig   6500:                   "#cpp-list">16.4.3. Getting a list of CPP
1.51      rillig   6501:                   defines</a></span></dt>
1.1       grant    6502:                 </dl>
                   6503:               </dd>
                   6504: 
1.30      wiz      6505:               <dt><span class="sect1"><a href=
1.68      rillig   6506:               "#package-specific-actions">16.5. Package specific
1.30      wiz      6507:               actions</a></span></dt>
1.1       grant    6508: 
                   6509:               <dd>
                   6510:                 <dl>
                   6511:                   <dt><span class="sect2"><a href=
1.68      rillig   6512:                   "#user-interaction">16.5.1. User
1.2       hubertf  6513:                   interaction</a></span></dt>
1.1       grant    6514: 
                   6515:                   <dt><span class="sect2"><a href=
1.68      rillig   6516:                   "#handling-licenses">16.5.2. Handling
1.1       grant    6517:                   licenses</a></span></dt>
                   6518: 
                   6519:                   <dt><span class="sect2"><a href=
1.68      rillig   6520:                   "#installing-score-files">16.5.3. Installing
1.30      wiz      6521:                   score files</a></span></dt>
1.1       grant    6522: 
                   6523:                   <dt><span class="sect2"><a href=
1.68      rillig   6524:                   "#perl-scripts">16.5.4. Packages containing perl
1.1       grant    6525:                   scripts</a></span></dt>
                   6526: 
                   6527:                   <dt><span class="sect2"><a href=
1.68      rillig   6528:                   "#hardcoded-paths">16.5.5. Packages with
1.30      wiz      6529:                   hardcoded paths to other
                   6530:                   interpreters</a></span></dt>
1.1       grant    6531: 
                   6532:                   <dt><span class="sect2"><a href=
1.68      rillig   6533:                   "#perl-modules">16.5.6. Packages installing perl
1.1       grant    6534:                   modules</a></span></dt>
                   6535: 
                   6536:                   <dt><span class="sect2"><a href=
1.68      rillig   6537:                   "#faq.info-files">16.5.7. Packages installing
1.1       grant    6538:                   info files</a></span></dt>
                   6539: 
                   6540:                   <dt><span class="sect2"><a href=
1.68      rillig   6541:                   "#manpages">16.5.8. Packages installing man
1.57      minskim  6542:                   pages</a></span></dt>
                   6543: 
                   6544:                   <dt><span class="sect2"><a href=
1.68      rillig   6545:                   "#gconf2-data-files">16.5.9. Packages installing
1.30      wiz      6546:                   GConf2 data files</a></span></dt>
1.1       grant    6547: 
                   6548:                   <dt><span class="sect2"><a href=
1.68      rillig   6549:                   "#scrollkeeper-data-files">16.5.10. Packages
1.30      wiz      6550:                   installing scrollkeeper data
                   6551:                   files</a></span></dt>
1.1       grant    6552: 
                   6553:                   <dt><span class="sect2"><a href=
1.68      rillig   6554:                   "#x11-fonts">16.5.11. Packages installing X11
1.1       grant    6555:                   fonts</a></span></dt>
                   6556: 
                   6557:                   <dt><span class="sect2"><a href=
1.68      rillig   6558:                   "#gtk2-modules">16.5.12. Packages installing GTK2
1.1       grant    6559:                   modules</a></span></dt>
                   6560: 
                   6561:                   <dt><span class="sect2"><a href=
1.68      rillig   6562:                   "#sgml-xml-data">16.5.13. Packages installing
1.30      wiz      6563:                   SGML or XML data</a></span></dt>
1.1       grant    6564: 
                   6565:                   <dt><span class="sect2"><a href=
1.68      rillig   6566:                   "#mime-database">16.5.14. Packages installing
1.1       grant    6567:                   extensions to the MIME database</a></span></dt>
                   6568: 
                   6569:                   <dt><span class="sect2"><a href=
1.68      rillig   6570:                   "#intltool">16.5.15. Packages using
1.1       grant    6571:                   intltool</a></span></dt>
1.18      xtraeme  6572: 
                   6573:                   <dt><span class="sect2"><a href=
1.68      rillig   6574:                   "#startup-scripts">16.5.16. Packages installing
1.30      wiz      6575:                   startup scripts</a></span></dt>
1.57      minskim  6576: 
                   6577:                   <dt><span class="sect2"><a href=
1.68      rillig   6578:                   "#tex-packages">16.5.17. Packages installing TeX
1.57      minskim  6579:                   modules</a></span></dt>
1.1       grant    6580:                 </dl>
                   6581:               </dd>
                   6582: 
1.30      wiz      6583:               <dt><span class="sect1"><a href=
1.68      rillig   6584:               "#feedback-to-author">16.6. Feedback to the
1.30      wiz      6585:               author</a></span></dt>
1.1       grant    6586:             </dl>
                   6587:           </dd>
                   6588: 
1.68      rillig   6589:           <dt><span class="chapter"><a href="#debug">17.
1.1       grant    6590:           Debugging</a></span></dt>
                   6591: 
1.68      rillig   6592:           <dt><span class="chapter"><a href="#submit">18.
1.1       grant    6593:           Submitting and Committing</a></span></dt>
                   6594: 
                   6595:           <dd>
                   6596:             <dl>
1.30      wiz      6597:               <dt><span class="sect1"><a href=
1.68      rillig   6598:               "#submitting-your-package">18.1. Submitting your
1.30      wiz      6599:               packages</a></span></dt>
1.1       grant    6600: 
1.30      wiz      6601:               <dt><span class="sect1"><a href=
1.68      rillig   6602:               "#general-notes-for-changes">18.2. General notes when
1.41      wiz      6603:               adding, updating, or removing
                   6604:               packages</a></span></dt>
                   6605: 
                   6606:               <dt><span class="sect1"><a href=
1.68      rillig   6607:               "#committing-importing">18.3. Committing: Importing a
1.30      wiz      6608:               package into CVS</a></span></dt>
1.1       grant    6609: 
1.30      wiz      6610:               <dt><span class="sect1"><a href=
1.68      rillig   6611:               "#updating-package">18.4. Updating a package to a
1.30      wiz      6612:               newer version</a></span></dt>
1.1       grant    6613: 
1.30      wiz      6614:               <dt><span class="sect1"><a href=
1.68      rillig   6615:               "#moving-package">18.5. Moving a package in
1.30      wiz      6616:               pkgsrc</a></span></dt>
1.1       grant    6617:             </dl>
                   6618:           </dd>
1.69    ! rillig   6619: 
        !          6620:           <dt><span class="chapter"><a href="#porting">19. Porting
        !          6621:           pkgsrc</a></span></dt>
        !          6622: 
        !          6623:           <dd>
        !          6624:             <dl>
        !          6625:               <dt><span class="sect1"><a href=
        !          6626:               "#porting.opsys">19.1. Porting pkgsrc to a new
        !          6627:               operating system</a></span></dt>
        !          6628: 
        !          6629:               <dt><span class="sect1"><a href=
        !          6630:               "#porting.compiler">19.2. Adding support for a new
        !          6631:               compiler</a></span></dt>
        !          6632:             </dl>
        !          6633:           </dd>
1.1       grant    6634:         </dl>
                   6635:       </div>
                   6636: 
1.67      hubertf  6637:       <div class="chapter" lang="en">
1.1       grant    6638:         <div class="titlepage">
                   6639:           <div>
                   6640:             <div>
1.67      hubertf  6641:               <h2 class="title"><a name=
1.38      dillo    6642:               "components"></a>Chapter&nbsp;8.&nbsp;Package
1.27      rillig   6643:               components - files, directories and contents</h2>
1.25      rillig   6644:             </div>
                   6645:           </div>
                   6646:         </div>
                   6647: 
                   6648:         <div class="toc">
                   6649:           <p><b>Table of Contents</b></p>
                   6650: 
                   6651:           <dl>
                   6652:             <dt><span class="sect1"><a href=
1.45      wiz      6653:             "#components.Makefile">8.1. <code xmlns=
                   6654:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6655:             "filename">Makefile</code></a></span></dt>
                   6656: 
                   6657:             <dt><span class="sect1"><a href=
1.45      wiz      6658:             "#components.distinfo">8.2. <code xmlns=
                   6659:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6660:             "filename">distinfo</code></a></span></dt>
                   6661: 
                   6662:             <dt><span class="sect1"><a href=
1.38      dillo    6663:             "#components.patches">8.3. patches/*</a></span></dt>
1.25      rillig   6664: 
1.30      wiz      6665:             <dt><span class="sect1"><a href=
1.38      dillo    6666:             "#other-mandatory-files">8.4. Other mandatory
1.30      wiz      6667:             files</a></span></dt>
1.25      rillig   6668: 
1.27      rillig   6669:             <dt><span class="sect1"><a href=
1.38      dillo    6670:             "#components.optional">8.5. Optional
1.27      rillig   6671:             files</a></span></dt>
1.25      rillig   6672: 
1.38      dillo    6673:             <dt><span class="sect1"><a href="#work-dir">8.6.
1.45      wiz      6674:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6675:             class="filename">work*</code></a></span></dt>
1.25      rillig   6676: 
1.38      dillo    6677:             <dt><span class="sect1"><a href="#files-dir">8.7.
1.45      wiz      6678:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6679:             class="filename">files/*</code></a></span></dt>
1.25      rillig   6680:           </dl>
                   6681:         </div>
                   6682: 
1.27      rillig   6683:         <p>Whenever you're preparing a package, there are a number
                   6684:         of files involved which are described in the following
                   6685:         sections.</p>
1.25      rillig   6686: 
1.67      hubertf  6687:         <div class="sect1" lang="en">
1.25      rillig   6688:           <div class="titlepage">
                   6689:             <div>
                   6690:               <div>
                   6691:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      6692:                 "components.Makefile"></a>8.1.&nbsp;<code xmlns=
                   6693:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6694:                 "filename">Makefile</code></h2>
1.25      rillig   6695:               </div>
                   6696:             </div>
                   6697:           </div>
                   6698: 
1.27      rillig   6699:           <p>Building, installation and creation of a binary
1.45      wiz      6700:           package are all controlled by the package's <code xmlns=
                   6701:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6702:           "filename">Makefile</code>. The <code xmlns=
                   6703:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6704:           "filename">Makefile</code> describes various things about
                   6705:           a package, for example from where to get it, how to
                   6706:           configure, build, and install it.</p>
                   6707: 
1.45      wiz      6708:           <p>A package <code xmlns=
                   6709:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6710:           "filename">Makefile</code> contains several sections that
                   6711:           describe the package.</p>
1.25      rillig   6712: 
1.27      rillig   6713:           <p>In the first section there are the following
                   6714:           variables, which should appear exactly in the order given
                   6715:           here.</p>
1.25      rillig   6716: 
                   6717:           <div class="itemizedlist">
                   6718:             <ul type="disc">
                   6719:               <li>
1.27      rillig   6720:                 <p><code class="varname">DISTNAME</code> is the
                   6721:                 basename of the distribution file to be downloaded
                   6722:                 from the package's website.</p>
                   6723:               </li>
                   6724: 
                   6725:               <li>
                   6726:                 <p><code class="varname">PKGNAME</code> is the name
                   6727:                 of the package, as used by pkgsrc. You only need to
1.50      rillig   6728:                 provide it if it differs from <code class=
                   6729:                 "varname">DISTNAME</code>. Usually it is the
                   6730:                 directory name together with the version number. It
                   6731:                 must match the regular expression <code class=
1.27      rillig   6732:                 "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
                   6733:                 that is, it starts with a letter or digit, and
                   6734:                 contains only letters, digits, dashes, underscores,
                   6735:                 dots and plus signs.</p>
1.25      rillig   6736:               </li>
                   6737: 
                   6738:               <li>
1.27      rillig   6739:                 <p><code class="varname">CATEGORIES</code> is a
                   6740:                 list of categories which the package fits in. You
                   6741:                 can choose any of the top-level directories of
                   6742:                 pkgsrc for it.</p>
1.45      wiz      6743: 
                   6744:                 <p>Currently the following values are available for
                   6745:                 <code class="varname">CATEGORIES</code>. If more
                   6746:                 than one is used, they need to be separated by
                   6747:                 spaces:</p>
                   6748:                 <pre class="programlisting">
1.51      rillig   6749:     archivers     cross         geography     meta-pkgs     security
                   6750:     audio         databases     graphics      misc          shells
                   6751:     benchmarks    devel         ham           multimedia    sysutils
                   6752:     biology       editors       inputmethod   net           textproc
                   6753:     cad           emulators     lang          news          time
                   6754:     chat          finance       mail          parallel      wm
                   6755:     comms         fonts         math          pkgtools      www
                   6756:     converters    games         mbone         print         x11
1.45      wiz      6757: </pre>
1.25      rillig   6758:               </li>
                   6759: 
                   6760:               <li>
1.27      rillig   6761:                 <p><code class="varname">MASTER_SITES</code> is a
                   6762:                 list of URLs where the distribution files can be
                   6763:                 downloaded. Each URL must end with a slash.</p>
1.45      wiz      6764: 
                   6765:                 <p>The <code class="varname">MASTER_SITES</code>
                   6766:                 may make use of the following predefined sites:</p>
                   6767:                 <pre class="programlisting">
1.51      rillig   6768:     ${MASTER_SITE_APACHE}
                   6769:     ${MASTER_SITE_BACKUP}
                   6770:     ${MASTER_SITE_CYGWIN}
                   6771:     ${MASTER_SITE_DEBIAN}
                   6772:     ${MASTER_SITE_FREEBSD}
                   6773:     ${MASTER_SITE_FREEBSD_LOCAL}
                   6774:     ${MASTER_SITE_GNOME}
                   6775:     ${MASTER_SITE_GNU}
                   6776:     ${MASTER_SITE_GNUSTEP}
                   6777:     ${MASTER_SITE_IFARCHIVE}
                   6778:     ${MASTER_SITE_MOZILLA}
                   6779:     ${MASTER_SITE_OPENOFFICE}
                   6780:     ${MASTER_SITE_PERL_CPAN}
                   6781:     ${MASTER_SITE_R_CRAN}
                   6782:     ${MASTER_SITE_SOURCEFORGE}
                   6783:     ${MASTER_SITE_SUNSITE}
                   6784:     ${MASTER_SITE_SUSE}
                   6785:     ${MASTER_SITE_TEX_CTAN}
                   6786:     ${MASTER_SITE_XCONTRIB}
                   6787:     ${MASTER_SITE_XEMACS}
1.45      wiz      6788: </pre>
                   6789: 
                   6790:                 <p>If one of these predefined sites is chosen, you
                   6791:                 may want to specify a subdirectory of that site.
                   6792:                 Since these macros may expand to more than one
                   6793:                 actual site, you <span class=
                   6794:                 "emphasis"><em>must</em></span> use the following
                   6795:                 construct to specify a subdirectory:</p>
                   6796:                 <pre class="programlisting">
1.51      rillig   6797:     ${MASTER_SITE_GNU:=subdirectory/name/}
                   6798:     ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.45      wiz      6799: </pre>
                   6800: 
                   6801:                 <p>Note the trailing slash after the subdirectory
                   6802:                 name.</p>
                   6803: 
                   6804:                 <p>If the package has multiple <code class=
                   6805:                 "varname">DISTFILES</code> or multiple <code class=
                   6806:                 "varname">PATCHFILES</code> from different sites,
                   6807:                 set <code class="varname">SITES_foo</code> to a
1.47      reed     6808:                 list of URIs where file &#8220;<span class=
1.45      wiz      6809:                 "quote">foo</span>&#8221; may be found.
                   6810:                 &#8220;<span class="quote">foo</span>&#8221;
1.47      reed     6811:                 includes the suffix, e.g.:</p>
1.45      wiz      6812:                 <pre class="programlisting">
1.51      rillig   6813:     DISTFILES=      ${DISTNAME}${EXTRACT_SUFX}
                   6814:     DISTFILES+=     foo-file.tar.gz
1.69    ! rillig   6815:     SITES_foo-file.tar.gz= \
        !          6816:             http://www.somewhere.com/somehow/ \
1.51      rillig   6817:             http://www.somewhereelse.com/mirror/somehow/
1.45      wiz      6818: </pre>
                   6819:               </li>
                   6820: 
                   6821:               <li>
                   6822:                 <p><code class="varname">DISTFILES</code>: Name(s)
                   6823:                 of archive file(s) containing distribution. The
                   6824:                 default is <code xmlns=
                   6825:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6826:                 "filename">${DISTNAME}${EXTRACT_SUFX}</code>.
                   6827:                 Should only be set if you have more than one
                   6828:                 distfile.</p>
                   6829: 
                   6830:                 <p>Note that the normal default setting of
                   6831:                 <code class="varname">DISTFILES</code> must be made
                   6832:                 explicit if you want to add to it (rather than
                   6833:                 replace it), as you usually would.</p>
                   6834:               </li>
                   6835: 
                   6836:               <li>
                   6837:                 <p><code class="varname">EXTRACT_SUFX</code>:
                   6838:                 Suffix of the distribution file, will be appended
                   6839:                 to <code class="varname">DISTNAME</code>. Defaults
                   6840:                 to <code xmlns=
                   6841:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6842:                 "filename">.tar.gz</code>.</p>
                   6843:               </li>
                   6844:             </ul>
                   6845:           </div>
                   6846: 
                   6847:           <p>The second section contains information about
                   6848:           separately downloaded patches, if any.</p>
                   6849: 
                   6850:           <div class="itemizedlist">
                   6851:             <ul type="disc">
                   6852:               <li>
1.47      reed     6853:                 <p><code class="varname">PATCHFILES:</code> Name(s)
1.45      wiz      6854:                 of additional files that contain distribution
                   6855:                 patches. There is no default. pkgsrc will look for
                   6856:                 them at <code class="varname">PATCH_SITES</code>.
                   6857:                 They will automatically be uncompressed before
                   6858:                 patching if the names end with <code xmlns=
                   6859:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6860:                 "filename">.gz</code> or <code xmlns=
                   6861:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6862:                 "filename">.Z</code>.</p>
                   6863:               </li>
                   6864: 
                   6865:               <li>
                   6866:                 <p><code class="varname">PATCH_SITES</code>:
                   6867:                 Primary location(s) for distribution patch files
                   6868:                 (see <code class="varname">PATCHFILES</code> below)
                   6869:                 if not found locally.</p>
1.25      rillig   6870:               </li>
                   6871:             </ul>
                   6872:           </div>
                   6873: 
1.45      wiz      6874:           <p>The third section contains the following
1.27      rillig   6875:           variables.</p>
1.25      rillig   6876: 
1.27      rillig   6877:           <div class="itemizedlist">
                   6878:             <ul type="disc">
                   6879:               <li>
                   6880:                 <p><code class="varname">MAINTAINER</code> is the
1.50      rillig   6881:                 email address of the person who feels responsible
                   6882:                 for this package, and who is most likely to look at
                   6883:                 problems or questions regarding this package which
                   6884:                 have been reported with <a href=
1.45      wiz      6885:                 "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
                   6886:                 <span class="citerefentry"><span class=
1.50      rillig   6887:                 "refentrytitle">send-pr</span>(1)</span></a>. Other
                   6888:                 developers should contact the <code class=
                   6889:                 "varname">MAINTAINER</code> before making major
                   6890:                 changes to the package. When packaging a new
                   6891:                 program, set <code class=
                   6892:                 "varname">MAINTAINER</code> to yourself. If you
                   6893:                 really can't maintain the package for future
                   6894:                 updates, set it to <code class="email">&lt;<a href=
1.45      wiz      6895:                 "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>&gt;</code>.</p>
1.27      rillig   6896:               </li>
1.25      rillig   6897: 
1.27      rillig   6898:               <li>
                   6899:                 <p><code class="varname">HOMEPAGE</code> is a URL
                   6900:                 where users can find more information about the
1.23      wiz      6901:                 package.</p>
                   6902:               </li>
1.1       grant    6903: 
1.23      wiz      6904:               <li>
                   6905:                 <p><code class="varname">COMMENT</code> is a
1.45      wiz      6906:                 one-line description of the package (should not
                   6907:                 include the package name).</p>
1.23      wiz      6908:               </li>
                   6909:             </ul>
                   6910:           </div>
1.1       grant    6911: 
1.45      wiz      6912:           <p>Other variables that affect the build:</p>
1.1       grant    6913: 
1.45      wiz      6914:           <div class="itemizedlist">
                   6915:             <ul type="disc">
                   6916:               <li>
                   6917:                 <p><code class="varname">WRKSRC</code>: The
1.50      rillig   6918:                 directory where the interesting distribution files
                   6919:                 of the package are found. The default is
                   6920:                 <code xmlns=
                   6921:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6922:                 "filename">${WRKDIR}/${DISTNAME}</code>, which
                   6923:                 works for most packages.</p>
                   6924: 
                   6925:                 <p>If a package doesn't create a subdirectory for
                   6926:                 itself (most GNU software does, for instance), but
                   6927:                 extracts itself in the current directory, you
                   6928:                 should set <code class="varname">WRKSRC=
                   6929:                 ${WRKDIR}</code>.</p>
                   6930: 
                   6931:                 <p>If a package doesn't create a subdirectory with
                   6932:                 the name of <code class="varname">DISTNAME</code>
                   6933:                 but some different name, set <code class=
                   6934:                 "varname">WRKSRC</code> to point to the proper name
                   6935:                 in <code xmlns=
                   6936:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6937:                 "filename">${WRKDIR}</code>, for example
                   6938:                 <code class="varname">WRKSRC=
                   6939:                 ${WRKDIR}/${DISTNAME}/unix</code>. See <a xmlns=
                   6940:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6941:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
                   6942:                 target="_top"><code xmlns="" class=
                   6943:                 "filename">lang/tcl</code></a> and <a xmlns=
                   6944:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6945:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
                   6946:                 target="_top"><code xmlns="" class=
                   6947:                 "filename">x11/tk</code></a> for other
                   6948:                 examples.</p>
                   6949: 
                   6950:                 <p>The name of the working directory created by
                   6951:                 pkgsrc is taken from the <code class=
                   6952:                 "varname">WRKDIR_BASENAME</code> variable. By
                   6953:                 default, its value is <code xmlns=
                   6954:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6955:                 "filename">work</code>. If you want to use the same
                   6956:                 pkgsrc tree for building different kinds of binary
                   6957:                 packages, you can change the variable according to
                   6958:                 your needs. Two other variables handle common cases
                   6959:                 of setting <code class=
                   6960:                 "varname">WRKDIR_BASENAME</code> individually. If
                   6961:                 <code class="varname">OBJHOSTNAME</code> is defined
                   6962:                 in <code xmlns=
1.45      wiz      6963:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.50      rillig   6964:                 "filename">/etc/mk.conf</code>, the first component
                   6965:                 of the host's name is attached to the directory
                   6966:                 name. If <code class="varname">OBJMACHINE</code> is
                   6967:                 defined, the platform name is attached, which might
                   6968:                 look like <code xmlns=
                   6969:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6970:                 "filename">work.i386</code> or <code xmlns=
1.45      wiz      6971:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.50      rillig   6972:                 "filename">work.sparc</code>.</p>
1.45      wiz      6973:               </li>
                   6974:             </ul>
1.1       grant    6975:           </div>
                   6976: 
                   6977:           <p>Please pay attention to the following gotchas:</p>
                   6978: 
                   6979:           <div class="itemizedlist">
                   6980:             <ul type="disc">
                   6981:               <li>
1.14      xtraeme  6982:                 <p>Add <code class="varname">MANCOMPRESSED</code>
1.47      reed     6983:                 if man pages are installed in compressed form by
                   6984:                 the package; see comment in <code xmlns=
1.45      wiz      6985:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6986:                 "filename">bsd.pkg.mk</code>.</p>
1.1       grant    6987:               </li>
                   6988: 
                   6989:               <li>
1.45      wiz      6990:                 <p>Replace <code xmlns=
                   6991:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6992:                 "filename">/usr/local</code> with
                   6993:                 &#8220;<span class="quote">${PREFIX}</span>&#8221;
                   6994:                 in all files (see patches, below).</p>
1.1       grant    6995:               </li>
                   6996: 
                   6997:               <li>
                   6998:                 <p>If the package installs any info files, see
                   6999:                 <a href="#faq.info-files" title=
1.68      rillig   7000:                 "16.5.7.&nbsp;Packages installing info files">Section&nbsp;16.5.7,
1.45      wiz      7001:                 &#8220;Packages installing info
1.1       grant    7002:                 files&#8221;</a>.</p>
                   7003:               </li>
                   7004:             </ul>
                   7005:           </div>
                   7006:         </div>
                   7007: 
1.67      hubertf  7008:         <div class="sect1" lang="en">
1.1       grant    7009:           <div class="titlepage">
                   7010:             <div>
                   7011:               <div>
                   7012:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      7013:                 "components.distinfo"></a>8.2.&nbsp;<code xmlns=
                   7014:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7015:                 "filename">distinfo</code></h2>
1.1       grant    7016:               </div>
                   7017:             </div>
                   7018:           </div>
                   7019: 
1.50      rillig   7020:           <p>The <code xmlns=
                   7021:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   7022:           "filename">distinfo</code> file contains the message
                   7023:           digest, or checksum, of each distfile needed for the
                   7024:           package. This ensures that the distfiles retrieved from
                   7025:           the Internet have not been corrupted during transfer or
                   7026:           altered by a malign force to introduce a security hole.
                   7027:           Due to recent rumor about weaknesses of digest
                   7028:           algorithms, all distfiles are protected using both SHA1
                   7029:           and RMD160 message digests, as well as the file size.</p>
                   7030: 
                   7031:           <p>The <code xmlns=
                   7032:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   7033:           "filename">distinfo</code> file also contains the
                   7034:           checksums for all the patches found in the <code xmlns=
                   7035:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   7036:           "filename">patches</code> directory (see <a href=
                   7037:           "#components.patches" title=
                   7038:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
                   7039:           &#8220;patches/*&#8221;</a>).</p>
                   7040: 
                   7041:           <p>To regenerate the <code xmlns=
                   7042:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   7043:           "filename">distinfo</code> file, use the
1.14      xtraeme  7044:           <span><strong class="command">make
1.50      rillig   7045:           makedistinfo</strong></span> or <span><strong class=
                   7046:           "command">make mdi</strong></span> command.</p>
1.1       grant    7047: 
1.50      rillig   7048:           <p>Some packages have different sets of distfiles
                   7049:           depending on the platform, for example <a xmlns=
1.1       grant    7050:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   7051:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.45      wiz      7052:           target="_top"><code xmlns="" class=
                   7053:           "filename">www/navigator</code></a>). These are kept in
1.50      rillig   7054:           the same <code xmlns=
1.45      wiz      7055:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.50      rillig   7056:           "filename">distinfo</code> file and care should be taken
                   7057:           when upgrading such a package to ensure distfile
                   7058:           information is not lost.</p>
1.1       grant    7059:         </div>
                   7060: 
1.67      hubertf  7061:         <div class="sect1" lang="en">
1.1       grant    7062:           <div class="titlepage">
                   7063:             <div>
                   7064:               <div>
                   7065:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7066:                 "components.patches"></a>8.3.&nbsp;patches/*</h2>
1.1       grant    7067:               </div>
                   7068:             </div>
                   7069:           </div>
                   7070: 
                   7071:           <p>This directory contains files that are used by the
                   7072:           <a href=
                   7073:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   7074:           <span class="citerefentry"><span class=
                   7075:           "refentrytitle">patch</span>(1)</span></a> command to
                   7076:           modify the sources as distributed in the distribution
                   7077:           file into a form that will compile and run perfectly on
                   7078:           NetBSD. The files are applied successively in alphabetic
                   7079:           order (as returned by a shell &#8220;<span class=
                   7080:           "quote">patches/patch-*</span>&#8221; glob expansion), so
1.45      wiz      7081:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7082:           class="filename">patch-aa</code> is applied before
                   7083:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7084:           class="filename">patch-ab</code>, etc.</p>
                   7085: 
                   7086:           <p>The <code xmlns=
                   7087:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   7088:           "filename">patch-*</code> files should be in
                   7089:           <span><strong class="command">diff -bu</strong></span>
                   7090:           format, and apply without a fuzz to avoid problems. (To
                   7091:           force patches to apply with fuzz you can set <code class=
1.14      xtraeme  7092:           "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1       grant    7093:           not put changes for more than one file into a single
1.47      reed     7094:           patch file, as this will make future modifications more
1.1       grant    7095:           difficult.</p>
                   7096: 
                   7097:           <p>Similar, a file should be patched at most once, not
                   7098:           several times by several different patches. If a file
                   7099:           needs several patches, they should be combined into one
                   7100:           file.</p>
                   7101: 
                   7102:           <p>One important thing to mention is to pay attention
                   7103:           that no RCS IDs get stored in the patch files, as these
                   7104:           will cause problems when later checked into the NetBSD
1.14      xtraeme  7105:           CVS tree. Use the <span><strong class=
                   7106:           "command">pkgdiff</strong></span> from the <a xmlns=
1.1       grant    7107:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   7108:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45      wiz      7109:           target="_top"><code xmlns="" class=
                   7110:           "filename">pkgtools/pkgdiff</code></a> package to avoid
1.20      ben      7111:           these problems.</p>
1.1       grant    7112: 
                   7113:           <p>For even more automation, we recommend using
1.14      xtraeme  7114:           <span><strong class="command">mkpatches</strong></span>
                   7115:           from the same package to make a whole set of patches. You
                   7116:           just have to backup files before you edit them to
1.45      wiz      7117:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7118:           class="filename">filename.orig</code>, e.g. with
1.14      xtraeme  7119:           <span><strong class="command">cp -p filename
                   7120:           filename.orig</strong></span> or, easier, by using
                   7121:           <span><strong class="command">pkgvi</strong></span> again
                   7122:           from the same package. If you upgrade a package this way,
                   7123:           you can easily compare the new set of patches with the
                   7124:           previously existing one with <span><strong class=
                   7125:           "command">patchdiff</strong></span>.</p>
1.1       grant    7126: 
                   7127:           <p>When you have finished a package, remember to generate
                   7128:           the checksums for the patch files by using the
1.14      xtraeme  7129:           <span><strong class="command">make
                   7130:           makepatchsum</strong></span> command, see <a href=
                   7131:           "#components.distinfo" title=
1.38      dillo    7132:           "8.2.&nbsp;distinfo">Section&nbsp;8.2,
1.45      wiz      7133:           &#8220;<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7134:           class="filename">distinfo</code>&#8221;</a>.</p>
1.1       grant    7135: 
1.46      gdt      7136:           <p>When adding a patch that corrects a problem in the
                   7137:           distfile (rather than e.g. enforcing pkgsrc's view of
                   7138:           where man pages should go), send the patch as a bug
                   7139:           report to the maintainer. This benefits non-pkgsrc users
                   7140:           of the package, and usually enables removing the patch in
                   7141:           future version.</p>
                   7142: 
1.1       grant    7143:           <p>Patch files that are distributed by the author or
1.14      xtraeme  7144:           other maintainers can be listed in <code class=
                   7145:           "varname">$PATCHFILES</code>.</p>
1.1       grant    7146: 
                   7147:           <p>If it is desired to store any patches that should not
                   7148:           be committed into pkgsrc, they can be kept outside the
1.45      wiz      7149:           pkgsrc tree in the <code xmlns=
                   7150:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7151:           "filename">$LOCALPATCHES</code> directory. The directory
1.1       grant    7152:           tree there is expected to have the same
                   7153:           &#8220;<span class="quote">category/package</span>&#8221;
                   7154:           structure as pkgsrc, and patches are expected to be
1.45      wiz      7155:           stored inside these dirs (also known as <code xmlns=
                   7156:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     7157:           "filename">$LOCALPATCHES/$PKGPATH</code>). For example,
                   7158:           if you want to keep a private patch for <code xmlns=
1.45      wiz      7159:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7160:           "filename">pkgsrc/graphics/png</code>, keep it in
1.45      wiz      7161:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7162:           class=
1.14      xtraeme  7163:           "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
                   7164:           files in the named directory are expected to be patch
1.1       grant    7165:           files, and <span class="emphasis"><em>they are applied
                   7166:           after pkgsrc patches are applied</em></span>.</p>
1.27      rillig   7167:         </div>
                   7168: 
1.67      hubertf  7169:         <div class="sect1" lang="en">
1.27      rillig   7170:           <div class="titlepage">
                   7171:             <div>
                   7172:               <div>
                   7173:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7174:                 "other-mandatory-files"></a>8.4.&nbsp;Other
1.27      rillig   7175:                 mandatory files</h2>
                   7176:               </div>
                   7177:             </div>
                   7178:           </div>
                   7179: 
                   7180:           <div class="variablelist">
                   7181:             <dl>
1.45      wiz      7182:               <dt><span class="term"><code xmlns=
                   7183:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7184:               "filename">DESCR</code></span></dt>
                   7185: 
                   7186:               <dd>
                   7187:                 <p>A multi-line description of the piece of
                   7188:                 software. This should include any credits where
                   7189:                 they are due. Please bear in mind that others do
                   7190:                 not share your sense of humour (or spelling
                   7191:                 idiosyncrasies), and that others will read
                   7192:                 everything that you write here.</p>
                   7193:               </dd>
                   7194: 
1.45      wiz      7195:               <dt><span class="term"><code xmlns=
                   7196:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7197:               "filename">PLIST</code></span></dt>
                   7198: 
                   7199:               <dd>
                   7200:                 <p>This file governs the files that are installed
                   7201:                 on your system: all the binaries, manual pages,
                   7202:                 etc. There are other directives which may be
                   7203:                 entered in this file, to control the creation and
                   7204:                 deletion of directories, and the location of
                   7205:                 inserted files. See <a href="#plist" title=
1.38      dillo    7206:                 "Chapter&nbsp;10.&nbsp;PLIST issues">Chapter&nbsp;10,
1.27      rillig   7207:                 <i>PLIST issues</i></a> for more information.</p>
                   7208:               </dd>
                   7209:             </dl>
                   7210:           </div>
                   7211:         </div>
                   7212: 
1.67      hubertf  7213:         <div class="sect1" lang="en">
1.27      rillig   7214:           <div class="titlepage">
                   7215:             <div>
                   7216:               <div>
                   7217:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7218:                 "components.optional"></a>8.5.&nbsp;Optional
1.27      rillig   7219:                 files</h2>
                   7220:               </div>
                   7221:             </div>
                   7222:           </div>
                   7223: 
                   7224:           <div class="variablelist">
                   7225:             <dl>
1.45      wiz      7226:               <dt><span class="term"><code xmlns=
                   7227:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7228:               "filename">INSTALL</code></span></dt>
                   7229: 
                   7230:               <dd>
                   7231:                 <p>This shell script is invoked twice by <a href=
                   7232:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7233:                 <span class="citerefentry"><span class=
                   7234:                 "refentrytitle">pkg_add</span>(1)</span></a>. First
                   7235:                 time after package extraction and before files are
                   7236:                 moved in place, the second time after the files to
                   7237:                 install are moved in place. This can be used to do
                   7238:                 any custom procedures not possible with @exec
1.45      wiz      7239:                 commands in <code xmlns=
                   7240:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7241:                 "filename">PLIST</code>. See <a href=
1.27      rillig   7242:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7243:                 <span class="citerefentry"><span class=
                   7244:                 "refentrytitle">pkg_add</span>(1)</span></a> and
                   7245:                 <a href=
                   7246:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   7247:                 <span class="citerefentry"><span class=
                   7248:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   7249:                 more information.</p>
                   7250:               </dd>
                   7251: 
1.45      wiz      7252:               <dt><span class="term"><code xmlns=
                   7253:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7254:               "filename">DEINSTALL</code></span></dt>
                   7255: 
                   7256:               <dd>
                   7257:                 <p>This script is executed before and after any
                   7258:                 files are removed. It is this script's
                   7259:                 responsibility to clean up any additional messy
                   7260:                 details around the package's installation, since
                   7261:                 all pkg_delete knows is how to delete the files
                   7262:                 created in the original distribution. See <a href=
                   7263:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   7264:                 <span class="citerefentry"><span class=
                   7265:                 "refentrytitle">pkg_delete</span>(1)</span></a> and
                   7266:                 <a href=
                   7267:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   7268:                 <span class="citerefentry"><span class=
                   7269:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   7270:                 more information.</p>
                   7271:               </dd>
                   7272: 
1.45      wiz      7273:               <dt><span class="term"><code xmlns=
                   7274:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7275:               "filename">MESSAGE</code></span></dt>
                   7276: 
                   7277:               <dd>
1.50      rillig   7278:                 <p>This file is displayed after installation of the
1.27      rillig   7279:                 package. Useful for things like legal notices on
                   7280:                 almost-free software and hints for updating config
                   7281:                 files after installing modules for apache, PHP etc.
                   7282:                 Please note that you can modify variables in it
                   7283:                 easily by using <code class=
                   7284:                 "varname">MESSAGE_SUBST</code> in the package's
1.45      wiz      7285:                 <code xmlns=
                   7286:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7287:                 "filename">Makefile</code>:</p>
1.27      rillig   7288:                 <pre class="programlisting">
1.51      rillig   7289:     MESSAGE_SUBST+=  SOMEVAR="somevalue"
1.27      rillig   7290: </pre>
                   7291: 
                   7292:                 <p>replaces "${SOMEVAR}" with &#8220;<span class=
1.45      wiz      7293:                 "quote">somevalue</span>&#8221; in <code xmlns=
                   7294:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7295:                 "filename">MESSAGE</code>.</p>
                   7296:               </dd>
                   7297:             </dl>
                   7298:           </div>
                   7299:         </div>
                   7300: 
1.67      hubertf  7301:         <div class="sect1" lang="en">
1.27      rillig   7302:           <div class="titlepage">
                   7303:             <div>
                   7304:               <div>
                   7305:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  7306:                 "work-dir"></a>8.6.&nbsp;<code xmlns=
1.45      wiz      7307:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7308:                 "filename">work*</code></h2>
                   7309:               </div>
                   7310:             </div>
                   7311:           </div>
                   7312: 
                   7313:           <p>When you type <span><strong class=
1.47      reed     7314:           "command">make</strong></span>, the distribution files
                   7315:           are unpacked into the directory denoted by <code class=
1.45      wiz      7316:           "varname">WRKDIR</code>. It can be removed by running
                   7317:           <span><strong class="command">make clean</strong></span>.
                   7318:           Besides the sources, this directory is also used to keep
                   7319:           various timestamp files. The directory gets <span class=
                   7320:           "emphasis"><em>removed completely</em></span> on clean.
                   7321:           The default is <code xmlns=
                   7322:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   7323:           "filename">${.CURDIR}/work</code> or <code xmlns=
                   7324:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   7325:           "filename">${.CURDIR}/work.${MACHINE_ARCH}</code> if
                   7326:           <code class="varname">OBJMACHINE</code> is set.</p>
1.27      rillig   7327:         </div>
                   7328: 
1.67      hubertf  7329:         <div class="sect1" lang="en">
1.27      rillig   7330:           <div class="titlepage">
                   7331:             <div>
                   7332:               <div>
                   7333:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      7334:                 "files-dir"></a>8.7.&nbsp;<code xmlns=
                   7335:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7336:                 "filename">files/*</code></h2>
                   7337:               </div>
                   7338:             </div>
                   7339:           </div>
                   7340: 
                   7341:           <p>If you have any files that you wish to be placed in
                   7342:           the package prior to configuration or building, you could
                   7343:           place these files here and use a &#8220;<span class=
                   7344:           "quote">${CP}</span>&#8221; command in the
                   7345:           &#8220;<span class="quote">pre-configure</span>&#8221;
                   7346:           target to achieve this. Alternatively, you could simply
1.45      wiz      7347:           diff the file against <code xmlns=
                   7348:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7349:           "filename">/dev/null</code> and use the patch mechanism
                   7350:           to manage the creation of this file.</p>
                   7351:         </div>
                   7352:       </div>
                   7353: 
1.67      hubertf  7354:       <div class="chapter" lang="en">
1.27      rillig   7355:         <div class="titlepage">
                   7356:           <div>
                   7357:             <div>
1.67      hubertf  7358:               <h2 class="title"><a name=
1.38      dillo    7359:               "makefile"></a>Chapter&nbsp;9.&nbsp;Programming in
1.45      wiz      7360:               <code xmlns=
                   7361:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   7362:               "filename">Makefile</code>s</h2>
1.27      rillig   7363:             </div>
                   7364:           </div>
                   7365:         </div>
                   7366: 
                   7367:         <div class="toc">
                   7368:           <p><b>Table of Contents</b></p>
                   7369: 
                   7370:           <dl>
                   7371:             <dt><span class="sect1"><a href=
1.45      wiz      7372:             "#makefile.variables">9.1. <code xmlns=
                   7373:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7374:             "filename">Makefile</code> variables</a></span></dt>
                   7375: 
                   7376:             <dd>
                   7377:               <dl>
                   7378:                 <dt><span class="sect2"><a href=
1.38      dillo    7379:                 "#makefile.variables.names">9.1.1. Naming
1.27      rillig   7380:                 conventions</a></span></dt>
                   7381:               </dl>
                   7382:             </dd>
                   7383: 
1.38      dillo    7384:             <dt><span class="sect1"><a href="#makefile.code">9.2.
1.27      rillig   7385:             Code snippets</a></span></dt>
                   7386: 
                   7387:             <dd>
                   7388:               <dl>
1.30      wiz      7389:                 <dt><span class="sect2"><a href=
1.38      dillo    7390:                 "#adding-to-list">9.2.1. Adding things to a
1.30      wiz      7391:                 list</a></span></dt>
1.27      rillig   7392: 
1.30      wiz      7393:                 <dt><span class="sect2"><a href=
1.38      dillo    7394:                 "#converting-internal-to-external">9.2.2.
1.27      rillig   7395:                 Converting an internal list into an external
                   7396:                 list</a></span></dt>
                   7397: 
1.30      wiz      7398:                 <dt><span class="sect2"><a href=
1.38      dillo    7399:                 "#passing-variable-to-shell">9.2.3. Passing
1.30      wiz      7400:                 variables to a shell command</a></span></dt>
1.27      rillig   7401: 
1.30      wiz      7402:                 <dt><span class="sect2"><a href=
1.38      dillo    7403:                 "#quoting-guideline">9.2.4. Quoting
1.30      wiz      7404:                 guideline</a></span></dt>
1.27      rillig   7405: 
1.30      wiz      7406:                 <dt><span class="sect2"><a href=
1.38      dillo    7407:                 "#bsd-make-bug-workaround">9.2.5. Workaround for a
1.30      wiz      7408:                 bug in BSD Make</a></span></dt>
1.27      rillig   7409:               </dl>
                   7410:             </dd>
                   7411:           </dl>
                   7412:         </div>
                   7413: 
1.45      wiz      7414:         <p>Pkgsrc consists of many <code xmlns=
                   7415:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7416:         "filename">Makefile</code> fragments, each of which forms a
                   7417:         well-defined part of the pkgsrc system. Using the <a href=
                   7418:         "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7419:         <span class="citerefentry"><span class=
                   7420:         "refentrytitle">make</span>(1)</span></a> system as a
                   7421:         programming language for a big system like pkgsrc requires
                   7422:         some discipline to keep the code correct and
                   7423:         understandable.</p>
                   7424: 
1.45      wiz      7425:         <p>The basic ingredients for <code xmlns=
                   7426:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7427:         "filename">Makefile</code> programming are variables (which
                   7428:         are actually macros) and shell commands. Among these shell
                   7429:         commands may even be more complex ones like <a href=
                   7430:         "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
                   7431:         <span class="citerefentry"><span class=
                   7432:         "refentrytitle">awk</span>(1)</span></a> programs. To make
                   7433:         sure that every shell command runs as intended it is
                   7434:         necessary to quote all variables correctly when they are
                   7435:         used.</p>
                   7436: 
                   7437:         <p>This chapter describes some patterns, that appear quite
1.45      wiz      7438:         often in <code xmlns=
                   7439:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   7440:         "filename">Makefile</code>s, including the pitfalls that
                   7441:         come along with them.</p>
1.27      rillig   7442: 
1.67      hubertf  7443:         <div class="sect1" lang="en">
1.27      rillig   7444:           <div class="titlepage">
                   7445:             <div>
                   7446:               <div>
                   7447:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      7448:                 "makefile.variables"></a>9.1.&nbsp;<code xmlns=
                   7449:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7450:                 "filename">Makefile</code> variables</h2>
                   7451:               </div>
                   7452:             </div>
                   7453:           </div>
                   7454: 
1.45      wiz      7455:           <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7456:           class="filename">Makefile</code> variables contain
                   7457:           strings that can be processed using the five operators
                   7458:           ``='', ``+='', ``?='', ``:='', and ``!='', which are
                   7459:           described in the <a href=
1.27      rillig   7460:           "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7461:           <span class="citerefentry"><span class=
                   7462:           "refentrytitle">make</span>(1)</span></a> man page.</p>
                   7463: 
1.45      wiz      7464:           <p>When a variable's value is parsed from a <code xmlns=
                   7465:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7466:           "filename">Makefile</code>, the hash character ``#'' and
                   7467:           the backslash character ``\'' are handled specially. If a
                   7468:           backslash is followed by a newline, any whitespace
                   7469:           immediately in front of the backslash, the backslash, the
                   7470:           newline, and any whitespace immediately behind the
                   7471:           newline are replaced with a single space. A backspace
                   7472:           character and an immediately following hash character are
1.47      reed     7473:           replaced with a single hash character. Otherwise, the
1.27      rillig   7474:           backslash is passed as is. In a variable assignment, any
                   7475:           hash character that is not preceded by a backslash starts
                   7476:           a comment that continues upto the end of the logical
                   7477:           line.</p>
                   7478: 
                   7479:           <p><span class="emphasis"><em>Note:</em></span> Because
                   7480:           of this parsing algorithm the only way to create a
                   7481:           variable consisting of a single backslash is using the
                   7482:           ``!='' operator, for example: <code class=
                   7483:           "varname">BACKSLASH!=echo "\\"</code>.</p>
                   7484: 
                   7485:           <p>So far for defining variables. The other thing you can
                   7486:           do with variables is evaluating them. A variable is
                   7487:           evaluated when it is part of the right side of the ``:=''
                   7488:           or the ``!='' operator, or directly before executing a
                   7489:           shell command which the variable is part of. In all other
1.47      reed     7490:           cases, <a href=
1.27      rillig   7491:           "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7492:           <span class="citerefentry"><span class=
                   7493:           "refentrytitle">make</span>(1)</span></a> performs lazy
                   7494:           evaluation, that is, variables are not evaluated until
                   7495:           there's no other way. The ``modifiers'' mentioned in the
                   7496:           man page also evaluate the variable.</p>
                   7497: 
                   7498:           <p>Some of the modifiers split the string into words and
                   7499:           then operate on the words, others operate on the string
1.47      reed     7500:           as a whole. When a string is split into words, it is
                   7501:           split as you would expect it from <a href=
1.27      rillig   7502:           "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
                   7503:           <span class="citerefentry"><span class=
                   7504:           "refentrytitle">sh</span>(1)</span></a>.</p>
                   7505: 
                   7506:           <p>No rule without exception&#8212;the
                   7507:           <span><strong class="command">.for</strong></span> loop
                   7508:           does not follow the shell quoting rules but splits at
                   7509:           sequences of whitespace.</p>
                   7510: 
                   7511:           <p>There are several types of variables that should be
                   7512:           handled differently. Strings and two types of lists.</p>
                   7513: 
                   7514:           <div class="itemizedlist">
                   7515:             <ul type="disc">
                   7516:               <li>
                   7517:                 <p><span class="emphasis"><em>Strings</em></span>
1.47      reed     7518:                 can contain arbitrary characters. Nevertheless, you
1.27      rillig   7519:                 should restrict yourself to only using printable
                   7520:                 characters. Examples are <code class=
                   7521:                 "varname">PREFIX</code> and <code class=
                   7522:                 "varname">COMMENT</code>.</p>
                   7523:               </li>
                   7524: 
                   7525:               <li>
                   7526:                 <p><span class="emphasis"><em>Internal
                   7527:                 lists</em></span> are lists that are never exported
                   7528:                 to any shell command. Their elements are separated
1.47      reed     7529:                 by whitespace. Therefore, the elements themselves
1.27      rillig   7530:                 cannot have embedded whitespace. Any other
                   7531:                 characters are allowed. Internal lists can be used
                   7532:                 in <span><strong class=
                   7533:                 "command">.for</strong></span> loops. Examples are
                   7534:                 <code class="varname">DEPENDS</code> and
                   7535:                 <code class="varname">BUILD_DEPENDS</code>.</p>
                   7536:               </li>
                   7537: 
                   7538:               <li>
                   7539:                 <p><span class="emphasis"><em>External
                   7540:                 lists</em></span> are lists that may be exported to
                   7541:                 a shell command. Their elements can contain any
                   7542:                 characters, including whitespace. That's why they
                   7543:                 cannot be used in <span><strong class=
                   7544:                 "command">.for</strong></span> loops. Examples are
                   7545:                 <code class="varname">DISTFILES</code> and
                   7546:                 <code class="varname">MASTER_SITES</code>.</p>
                   7547:               </li>
                   7548:             </ul>
                   7549:           </div>
                   7550: 
1.67      hubertf  7551:           <div class="sect2" lang="en">
1.27      rillig   7552:             <div class="titlepage">
                   7553:               <div>
                   7554:                 <div>
                   7555:                   <h3 class="title"><a name=
1.38      dillo    7556:                   "makefile.variables.names"></a>9.1.1.&nbsp;Naming
1.27      rillig   7557:                   conventions</h3>
                   7558:                 </div>
                   7559:               </div>
                   7560:             </div>
                   7561: 
                   7562:             <div class="itemizedlist">
                   7563:               <ul type="disc">
                   7564:                 <li>
                   7565:                   <p>All variable names starting with an underscore
                   7566:                   are reserved for use by the pkgsrc
                   7567:                   infrastructure. They shall not be used by package
1.45      wiz      7568:                   <code xmlns=
                   7569:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   7570:                   "filename">Makefile</code>s.</p>
1.27      rillig   7571:                 </li>
                   7572: 
                   7573:                 <li>
                   7574:                   <p>In <span><strong class=
                   7575:                   "command">.for</strong></span> loops you should
                   7576:                   use lowercase variable names for the iteration
                   7577:                   variables.</p>
                   7578:                 </li>
                   7579: 
                   7580:                 <li>
                   7581:                   <p>All list variables should have a ``plural''
                   7582:                   name, e.g. <code class=
                   7583:                   "varname">PKG_OPTIONS</code> or <code class=
                   7584:                   "varname">DISTFILES</code>.</p>
                   7585:                 </li>
                   7586:               </ul>
                   7587:             </div>
                   7588:           </div>
                   7589:         </div>
                   7590: 
1.67      hubertf  7591:         <div class="sect1" lang="en">
1.27      rillig   7592:           <div class="titlepage">
                   7593:             <div>
                   7594:               <div>
                   7595:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7596:                 "makefile.code"></a>9.2.&nbsp;Code snippets</h2>
1.27      rillig   7597:               </div>
                   7598:             </div>
                   7599:           </div>
                   7600: 
                   7601:           <p>This section presents you with some code snippets you
                   7602:           should use in your own code. If you don't find anything
                   7603:           appropriate here, you should test your code and add it
                   7604:           here.</p>
                   7605: 
1.67      hubertf  7606:           <div class="sect2" lang="en">
1.27      rillig   7607:             <div class="titlepage">
                   7608:               <div>
                   7609:                 <div>
1.67      hubertf  7610:                   <h3 class="title"><a name=
1.38      dillo    7611:                   "adding-to-list"></a>9.2.1.&nbsp;Adding things to
1.30      wiz      7612:                   a list</h3>
1.27      rillig   7613:                 </div>
                   7614:               </div>
                   7615:             </div>
                   7616:             <pre class="programlisting">
1.51      rillig   7617:     STRING=                 foo * bar `date`
                   7618:     INT_LIST=               # empty
                   7619:     ANOTHER_INT_LIST=       apache-[0-9]*:../../www/apache
                   7620:     EXT_LIST=               # empty
                   7621:     ANOTHER_EXT_LIST=       a=b c=d
                   7622: 
                   7623:     INT_LIST+=              ${STRING}               # 1
                   7624:     INT_LIST+=              ${ANOTHER_INT_LIST}     # 2
                   7625:     EXT_LIST+=              ${STRING:Q}             # 3
                   7626:     EXT_LIST+=              ${ANOTHER_EXT_LIST}     # 4
1.27      rillig   7627: </pre>
                   7628: 
                   7629:             <p>When you add a string to an external list (example
                   7630:             3), it must be quoted. In all other cases, you must not
                   7631:             add a quoting level. You must not merge internal and
                   7632:             external lists, unless you are sure that all entries
                   7633:             are correctly interpreted in both lists.</p>
                   7634:           </div>
                   7635: 
1.67      hubertf  7636:           <div class="sect2" lang="en">
1.27      rillig   7637:             <div class="titlepage">
                   7638:               <div>
                   7639:                 <div>
1.30      wiz      7640:                   <h3 class="title"><a name=
1.38      dillo    7641:                   "converting-internal-to-external"></a>9.2.2.&nbsp;Converting
1.30      wiz      7642:                   an internal list into an external list</h3>
1.27      rillig   7643:                 </div>
                   7644:               </div>
                   7645:             </div>
                   7646:             <pre class="programlisting">
1.51      rillig   7647:     EXT_LIST=       # empty
                   7648:     .for i in ${INT_LIST}
                   7649:     EXT_LIST+=      ${i:Q}""
                   7650:     .endfor
1.27      rillig   7651: </pre>
                   7652: 
                   7653:             <p>This code converts the internal list <code class=
                   7654:             "varname">INT_LIST</code> into the external list
                   7655:             <code class="varname">EXT_LIST</code>. As the elements
                   7656:             of an internal list are unquoted they must be quoted
                   7657:             here. The reason for appending <code class=
                   7658:             "varname">""</code> is explained below.</p>
                   7659:           </div>
1.1       grant    7660: 
1.67      hubertf  7661:           <div class="sect2" lang="en">
1.27      rillig   7662:             <div class="titlepage">
1.1       grant    7663:               <div>
1.27      rillig   7664:                 <div>
1.30      wiz      7665:                   <h3 class="title"><a name=
1.38      dillo    7666:                   "passing-variable-to-shell"></a>9.2.3.&nbsp;Passing
1.30      wiz      7667:                   variables to a shell command</h3>
1.27      rillig   7668:                 </div>
1.1       grant    7669:               </div>
                   7670:             </div>
1.27      rillig   7671:             <pre class="programlisting">
1.51      rillig   7672:     STRING=         foo bar &lt;    &gt; * `date` $$HOME ' "
                   7673:     EXT_LIST=       string=${STRING:Q} x=second\ item
1.27      rillig   7674: 
1.51      rillig   7675:     all:
                   7676:             echo ${STRING}                  # 1
                   7677:             echo "${STRING}"                # 2
                   7678:             echo "${STRING:Q}"              # 3
                   7679:             echo ${STRING:Q}                # 4
                   7680:             echo x${STRING:Q} | sed 1s,.,,  # 5
                   7681:             env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
1.27      rillig   7682: </pre>
                   7683: 
                   7684:             <p>Example 1 leads to a syntax error in the shell, as
                   7685:             the characters are just copied.</p>
                   7686: 
                   7687:             <p>Example 2 leads to a syntax error too, and if you
                   7688:             leave out the last " character from <code class=
                   7689:             "varname">${STRING}</code>, <a href=
                   7690:             "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
                   7691:             <span class="citerefentry"><span class=
                   7692:             "refentrytitle">date</span>(1)</span></a> will be
                   7693:             executed. The <code class="varname">$HOME</code> shell
                   7694:             variable would be evaluated, too.</p>
                   7695: 
                   7696:             <p>Example 3 outputs each space character preceded by a
                   7697:             backslash (or not), depending on the implementation of
                   7698:             the <a href=
                   7699:             "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   7700:             <span class="citerefentry"><span class=
                   7701:             "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1       grant    7702: 
1.27      rillig   7703:             <p>Example 4 handles correctly every string that does
                   7704:             not start with a dash. In that case, the result depends
                   7705:             on the implementation of the <a href=
                   7706:             "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   7707:             <span class="citerefentry"><span class=
                   7708:             "refentrytitle">echo</span>(1)</span></a> command. As
                   7709:             long as you can guarantee that your input does not
1.47      reed     7710:             start with a dash, this form is appropriate.</p>
1.1       grant    7711: 
1.27      rillig   7712:             <p>Example 5 handles even the case of a leading dash
                   7713:             correctly.</p>
1.1       grant    7714: 
1.27      rillig   7715:             <p>The <code class="varname">EXT_LIST</code> does not
1.47      reed     7716:             need to be quoted because the quoting has already been
1.27      rillig   7717:             done when adding elements to the list.</p>
1.1       grant    7718: 
1.27      rillig   7719:             <p>As internal lists shall not be passed to the shell,
                   7720:             there is no example for it.</p>
1.1       grant    7721:           </div>
                   7722: 
1.67      hubertf  7723:           <div class="sect2" lang="en">
1.27      rillig   7724:             <div class="titlepage">
1.1       grant    7725:               <div>
1.27      rillig   7726:                 <div>
1.67      hubertf  7727:                   <h3 class="title"><a name=
1.38      dillo    7728:                   "quoting-guideline"></a>9.2.4.&nbsp;Quoting
1.27      rillig   7729:                   guideline</h3>
                   7730:                 </div>
1.1       grant    7731:               </div>
                   7732:             </div>
                   7733: 
1.27      rillig   7734:             <p>There are many possible sources of wrongly quoted
                   7735:             variables. This section lists some of the commonly
                   7736:             known ones.</p>
1.1       grant    7737: 
1.27      rillig   7738:             <div class="itemizedlist">
                   7739:               <ul type="disc">
                   7740:                 <li>
                   7741:                   <p>Whenever you use the value of a list, think
                   7742:                   about what happens to leading or trailing
                   7743:                   whitespace. If the list is a well-formed shell
1.47      reed     7744:                   expression, you can apply the <code class=
1.27      rillig   7745:                   "varname">:M*</code> modifier to strip leading
                   7746:                   and trailing whitespace from each word. The
                   7747:                   <code class="varname">:M</code> operator first
                   7748:                   splits its argument according to the rules of the
                   7749:                   shell, and then creates a new list consisting of
                   7750:                   all words that match the shell glob expression
                   7751:                   <code class="varname">*</code>, that is: all. One
                   7752:                   class of situations where this is needed is when
                   7753:                   adding a variable like <code class=
                   7754:                   "varname">CPPFLAGS</code> to <code class=
                   7755:                   "varname">CONFIGURE_ARGS</code>. If the configure
1.47      reed     7756:                   script invokes other configure scripts, it strips
1.27      rillig   7757:                   the leading and trailing whitespace from the
                   7758:                   variable and then passes it to the other
                   7759:                   configure scripts. But these configure scripts
                   7760:                   expect the (child) <code class=
                   7761:                   "varname">CPPFLAGS</code> variable to be the same
                   7762:                   as the parent <code class=
                   7763:                   "varname">CPPFLAGS</code>. That's why we better
                   7764:                   pass the <code class="varname">CPPFLAGS</code>
                   7765:                   value properly trimmed. And here is how we do
                   7766:                   it:</p>
                   7767:                   <pre class="programlisting">
1.51      rillig   7768:     CPPFLAGS=               # empty
                   7769:     CPPFLAGS+=              -Wundef -DPREFIX=\"${PREFIX:Q}\"
                   7770:     CPPFLAGS+=              ${MY_CPPFLAGS}
                   7771: 
                   7772:     CONFIGURE_ARGS+=        CPPFLAGS=${CPPFLAGS:M*:Q}
                   7773: 
                   7774:     all:
                   7775:             echo x${CPPFLAGS:Q}x            # leading and trailing whitespace
                   7776:             echo x${CONFIGURE_ARGS}x        # properly trimmed
1.27      rillig   7777: </pre>
                   7778:                 </li>
1.1       grant    7779: 
1.27      rillig   7780:                 <li>
                   7781:                   <p>The example above contains one bug: The
                   7782:                   <code class="varname">${PREFIX}</code> is a
                   7783:                   properly quoted shell expression, but there is
                   7784:                   the C compiler after it, which also expects a
                   7785:                   properly quoted string (this time in C syntax).
                   7786:                   The version above is therefore only correct if
                   7787:                   <code class="varname">${PREFIX}</code> does not
                   7788:                   have embedded backslashes or double quotes. If
                   7789:                   you want to allow these, you have to add another
                   7790:                   layer of quoting to each variable that is used as
                   7791:                   a C string literal. You cannot use the
                   7792:                   <code class="varname">:Q</code> operator for it,
                   7793:                   as this operator only works for the shell.</p>
                   7794:                 </li>
1.1       grant    7795: 
1.27      rillig   7796:                 <li>
1.47      reed     7797:                   <p>Whenever a variable can be empty, the
1.27      rillig   7798:                   <code class="varname">:Q</code> operator can have
                   7799:                   surprising results. Here are two completely
                   7800:                   different cases which can be solved with the same
                   7801:                   trick.</p>
                   7802:                   <pre class="programlisting">
1.51      rillig   7803:     EMPTY=                  # empty
                   7804:     empty_test:
                   7805:             for i in a ${EMPTY:Q} c; do \
                   7806:                     echo "$$i"; \
                   7807:             done
                   7808: 
                   7809:     for_test:
                   7810:     .for i in a:\ a:\test.txt
                   7811:             echo ${i:Q}
                   7812:             echo "foo"
                   7813:     .endfor
1.1       grant    7814: </pre>
                   7815: 
1.27      rillig   7816:                   <p>The first example will only print two of the
                   7817:                   three lines we might have expected. This is
                   7818:                   because <code class="varname">${EMPTY:Q}</code>
                   7819:                   expands to the empty string, which the shell
                   7820:                   cannot see. The workaround is to write
                   7821:                   <code class="varname">${EMPTY:Q}""</code>. This
                   7822:                   pattern can be often found as <code class=
                   7823:                   "varname">${TEST} -z ${VAR:Q}</code> or as
                   7824:                   <code class="varname">${TEST} -f
                   7825:                   ${FNAME:Q}</code> (both of these are wrong).</p>
                   7826: 
                   7827:                   <p>The second example will only print three lines
                   7828:                   instead of four. The first line looks like
                   7829:                   <code class="varname">a:\ echo foo</code>. This
                   7830:                   is because the backslash of the value
                   7831:                   <code class="varname">a:\</code> is interpreted
                   7832:                   as a line-continuation by <a href=
                   7833:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7834:                   <span class="citerefentry"><span class=
                   7835:                   "refentrytitle">make</span>(1)</span></a>, which
                   7836:                   makes the second line the arguments of the
                   7837:                   <a href=
                   7838:                   "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   7839:                   <span class="citerefentry"><span class=
                   7840:                   "refentrytitle">echo</span>(1)</span></a> command
                   7841:                   from the first line. To avoid this, write
                   7842:                   <code class="varname">${i:Q}""</code>.</p>
                   7843:                 </li>
                   7844:               </ul>
                   7845:             </div>
1.1       grant    7846:           </div>
                   7847: 
1.67      hubertf  7848:           <div class="sect2" lang="en">
1.27      rillig   7849:             <div class="titlepage">
1.1       grant    7850:               <div>
1.27      rillig   7851:                 <div>
1.30      wiz      7852:                   <h3 class="title"><a name=
1.38      dillo    7853:                   "bsd-make-bug-workaround"></a>9.2.5.&nbsp;Workaround
1.30      wiz      7854:                   for a bug in BSD Make</h3>
1.27      rillig   7855:                 </div>
1.1       grant    7856:               </div>
                   7857:             </div>
                   7858: 
1.27      rillig   7859:             <p>The pkgsrc bmake program does not handle the
                   7860:             following assignment correctly. In case <code class=
                   7861:             "varname">_othervar_</code> contains a ``-'' character,
                   7862:             one of the closing braces is included in <code class=
                   7863:             "varname">${VAR}</code> after this code executes.</p>
                   7864:             <pre class="programlisting">
1.51      rillig   7865:     VAR:=   ${VAR:N${_othervar_:C/-//}}
1.1       grant    7866: </pre>
                   7867: 
1.27      rillig   7868:             <p>For a more complex code snippet and a workaround,
                   7869:             see the package <a xmlns=
                   7870:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   7871:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
1.45      wiz      7872:             target="_top"><code xmlns="" class=
                   7873:             "filename">regress/make-quoting</code></a>, testcase
1.27      rillig   7874:             <code class="varname">bug1</code>.</p>
1.1       grant    7875:           </div>
                   7876:         </div>
                   7877:       </div>
                   7878: 
1.67      hubertf  7879:       <div class="chapter" lang="en">
1.1       grant    7880:         <div class="titlepage">
                   7881:           <div>
                   7882:             <div>
1.67      hubertf  7883:               <h2 class="title"><a name=
1.38      dillo    7884:               "plist"></a>Chapter&nbsp;10.&nbsp;PLIST issues</h2>
1.1       grant    7885:             </div>
                   7886:           </div>
                   7887:         </div>
                   7888: 
                   7889:         <div class="toc">
                   7890:           <p><b>Table of Contents</b></p>
                   7891: 
                   7892:           <dl>
1.38      dillo    7893:             <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1       grant    7894:             ID</a></span></dt>
                   7895: 
1.30      wiz      7896:             <dt><span class="sect1"><a href=
1.38      dillo    7897:             "#automatic-plist-generation">10.2. Semi-automatic
1.45      wiz      7898:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7899:             class="filename">PLIST</code>
1.14      xtraeme  7900:             generation</a></span></dt>
1.1       grant    7901: 
1.38      dillo    7902:             <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14      xtraeme  7903:             Tweaking output of <span><strong class="command">make
                   7904:             print-PLIST</strong></span></a></span></dt>
1.1       grant    7905: 
1.38      dillo    7906:             <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1       grant    7907:             Variable substitution in PLIST</a></span></dt>
                   7908: 
1.30      wiz      7909:             <dt><span class="sect1"><a href=
1.48      dillo    7910:             "#manpage-compression">10.5. Man page
                   7911:             compression</a></span></dt>
1.1       grant    7912: 
1.38      dillo    7913:             <dt><span class="sect1"><a href=
                   7914:             "#using-PLIST_SRC">10.6. Changing PLIST source with
                   7915:             <code class="varname">PLIST_SRC</code></a></span></dt>
1.1       grant    7916: 
1.30      wiz      7917:             <dt><span class="sect1"><a href=
1.47      reed     7918:             "#platform-specific-plist">10.7. Platform-specific and
1.30      wiz      7919:             differing PLISTs</a></span></dt>
1.1       grant    7920: 
1.38      dillo    7921:             <dt><span class="sect1"><a href=
                   7922:             "#faq.common-dirs">10.8. Sharing directories between
                   7923:             packages</a></span></dt>
1.1       grant    7924:           </dl>
                   7925:         </div>
                   7926: 
1.45      wiz      7927:         <p>The <code xmlns=
                   7928:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   7929:         "filename">PLIST</code> file contains a package's
                   7930:         &#8220;<span class="quote">packing list</span>&#8221;, i.e.
                   7931:         a list of files that belong to the package (relative to the
                   7932:         <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7933:         class="filename">${PREFIX}</code> directory it's been
                   7934:         installed in) plus some additional statements - see the
                   7935:         <a href=
1.1       grant    7936:         "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   7937:         <span class="citerefentry"><span class=
1.47      reed     7938:         "refentrytitle">pkg_create</span>(1)</span></a> man page
                   7939:         for a full list. This chapter addresses some issues that
                   7940:         need attention when dealing with the <code xmlns=
1.45      wiz      7941:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7942:         "filename">PLIST</code> file (or files, see below!).</p>
1.1       grant    7943: 
1.67      hubertf  7944:         <div class="sect1" lang="en">
1.1       grant    7945:           <div class="titlepage">
                   7946:             <div>
                   7947:               <div>
                   7948:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  7949:                 "rcs-id"></a>10.1.&nbsp;RCS ID</h2>
1.1       grant    7950:               </div>
                   7951:             </div>
                   7952:           </div>
                   7953: 
                   7954:           <p>Be sure to add a RCS ID line as the first thing in any
1.45      wiz      7955:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7956:           class="filename">PLIST</code> file you write:</p>
1.1       grant    7957:           <pre class="programlisting">
1.51      rillig   7958:     @comment $NetBSD$
1.1       grant    7959: </pre>
                   7960:         </div>
                   7961: 
1.67      hubertf  7962:         <div class="sect1" lang="en">
1.1       grant    7963:           <div class="titlepage">
                   7964:             <div>
                   7965:               <div>
                   7966:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7967:                 "automatic-plist-generation"></a>10.2.&nbsp;Semi-automatic
1.45      wiz      7968:                 <code xmlns=
                   7969:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7970:                 "filename">PLIST</code> generation</h2>
1.1       grant    7971:               </div>
                   7972:             </div>
                   7973:           </div>
                   7974: 
1.14      xtraeme  7975:           <p>You can use the <span><strong class="command">make
                   7976:           print-PLIST</strong></span> command to output a PLIST
                   7977:           that matches any new files since the package was
                   7978:           extracted. See <a href="#build.helpful-targets" title=
1.56      rillig   7979:           "14.16.&nbsp;Other helpful targets">Section&nbsp;14.16,
1.1       grant    7980:           &#8220;Other helpful targets&#8221;</a> for more
                   7981:           information on this target.</p>
                   7982:         </div>
                   7983: 
1.67      hubertf  7984:         <div class="sect1" lang="en">
1.1       grant    7985:           <div class="titlepage">
                   7986:             <div>
                   7987:               <div>
                   7988:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7989:                 "print-PLIST"></a>10.3.&nbsp;Tweaking output of
1.14      xtraeme  7990:                 <span><strong class="command">make
                   7991:                 print-PLIST</strong></span></h2>
1.1       grant    7992:               </div>
                   7993:             </div>
                   7994:           </div>
                   7995: 
                   7996:           <p>If you have used any of the *-dirs packages, as
                   7997:           explained in <a href="#faq.common-dirs" title=
1.38      dillo    7998:           "10.8.&nbsp;Sharing directories between packages">Section&nbsp;10.8,
1.1       grant    7999:           &#8220;Sharing directories between packages&#8221;</a>,
1.14      xtraeme  8000:           you may have noticed that <span><strong class=
                   8001:           "command">make print-PLIST</strong></span> outputs a set
                   8002:           of <code class="varname">@comment</code>s instead of real
                   8003:           <code class="varname">@dirrm</code> lines. You can also
                   8004:           do this for specific directories and files, so that the
                   8005:           results of that command are very close to reality. This
                   8006:           helps <span class="emphasis"><em>a lot</em></span> during
                   8007:           the update of packages.</p>
                   8008: 
                   8009:           <p>The <code class="varname">PRINT_PLIST_AWK</code>
                   8010:           variable takes a set of AWK patterns and actions that are
                   8011:           used to filter the output of print-PLIST. You can
                   8012:           <span class="emphasis"><em>append</em></span> any chunk
                   8013:           of AWK scripting you like to it, but be careful with
1.1       grant    8014:           quoting.</p>
                   8015: 
1.45      wiz      8016:           <p>For example, to get all files inside the <code xmlns=
                   8017:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8018:           "filename">libdata/foo</code> directory removed from the
1.1       grant    8019:           resulting PLIST:</p>
                   8020:           <pre class="programlisting">
1.51      rillig   8021:     PRINT_PLIST_AWK+=       /^libdata\/foo/ { next; }
1.1       grant    8022: </pre>
                   8023: 
1.14      xtraeme  8024:           <p>And to get all the <code class="varname">@dirrm</code>
1.1       grant    8025:           lines referring to a specific (shared) directory
1.14      xtraeme  8026:           converted to <code class="varname">@comment</code>s:</p>
1.1       grant    8027:           <pre class="programlisting">
1.51      rillig   8028:     PRINT_PLIST_AWK+=       /^@dirrm share\/specific/ { print "@comment " $$0; next; }
1.1       grant    8029: </pre>
                   8030:         </div>
                   8031: 
1.67      hubertf  8032:         <div class="sect1" lang="en">
1.1       grant    8033:           <div class="titlepage">
                   8034:             <div>
                   8035:               <div>
                   8036:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8037:                 "plist.misc"></a>10.4.&nbsp;Variable substitution
                   8038:                 in PLIST</h2>
1.1       grant    8039:               </div>
                   8040:             </div>
                   8041:           </div>
                   8042: 
                   8043:           <p>A number of variables are substituted automatically in
                   8044:           PLISTs when a package is installed on a system. This
                   8045:           includes the following variables:</p>
                   8046: 
                   8047:           <div class="variablelist">
                   8048:             <dl>
1.14      xtraeme  8049:               <dt><span class="term"><code class=
                   8050:               "varname">${MACHINE_ARCH}</code>, <code class=
                   8051:               "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1       grant    8052: 
                   8053:               <dd>
                   8054:                 <p>Some packages like emacs and perl embed
                   8055:                 information about which architecture they were
                   8056:                 built on into the pathnames where they install
1.47      reed     8057:                 their files. To handle this case, PLIST will be
1.1       grant    8058:                 preprocessed before actually used, and the symbol
1.14      xtraeme  8059:                 &#8220;<span class="quote"><code class=
                   8060:                 "varname">${MACHINE_ARCH}</code></span>&#8221; will
                   8061:                 be replaced by what <span><strong class=
                   8062:                 "command">uname -p</strong></span> gives. The same
                   8063:                 is done if the string <code class=
                   8064:                 "varname">${MACHINE_GNU_ARCH}</code> is embedded in
                   8065:                 PLIST somewhere - use this on packages that have
1.47      reed     8066:                 GNU autoconf-created configure scripts.</p>
1.1       grant    8067: 
                   8068:                 <div class="note" style=
                   8069:                 "margin-left: 0.5in; margin-right: 0.5in;">
                   8070:                   <h3 class="title">Legacy note</h3>
                   8071: 
                   8072:                   <p>There used to be a symbol &#8220;<span class=
1.14      xtraeme  8073:                   "quote"><code class=
                   8074:                   "varname">$ARCH</code></span>&#8221; that was
                   8075:                   replaced by the output of <span><strong class=
                   8076:                   "command">uname -m</strong></span>, but that's no
1.1       grant    8077:                   longer supported and has been removed.</p>
                   8078:                 </div>
                   8079:               </dd>
                   8080: 
1.14      xtraeme  8081:               <dt><span class="term"><code class=
                   8082:               "varname">${OPSYS}</code>, <code class=
                   8083:               "varname">${LOWER_OPSYS}</code>, <code class=
                   8084:               "varname">${OS_VERSION}</code></span></dt>
1.1       grant    8085: 
                   8086:               <dd>
                   8087:                 <p>Some packages want to embed the OS name and
                   8088:                 version into some paths. To do this, use these
1.45      wiz      8089:                 variables in the <code xmlns=
                   8090:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8091:                 "filename">PLIST</code>:</p>
1.1       grant    8092: 
                   8093:                 <div class="itemizedlist">
                   8094:                   <ul type="disc">
                   8095:                     <li>
1.14      xtraeme  8096:                       <p><code class="varname">${OPSYS}</code> -
                   8097:                       output of &#8220;<span class=
                   8098:                       "quote"><span><strong class="command">uname
                   8099:                       -s</strong></span></span>&#8221;</p>
1.1       grant    8100:                     </li>
                   8101: 
                   8102:                     <li>
1.14      xtraeme  8103:                       <p><code class=
                   8104:                       "varname">${LOWER_OPSYS}</code> - lowercase
                   8105:                       common name (eg. &#8220;<span class=
                   8106:                       "quote">solaris</span>&#8221;)</p>
1.1       grant    8107:                     </li>
                   8108: 
                   8109:                     <li>
1.14      xtraeme  8110:                       <p><code class="varname">${OS_VERSION}</code>
                   8111:                       - &#8220;<span class=
                   8112:                       "quote"><span><strong class="command">uname
                   8113:                       -r</strong></span></span>&#8221;</p>
1.1       grant    8114:                     </li>
                   8115:                   </ul>
                   8116:                 </div>
                   8117:               </dd>
                   8118: 
1.14      xtraeme  8119:               <dt><span class="term"><code class=
                   8120:               "varname">${PKGLOCALEDIR}</code></span></dt>
1.1       grant    8121: 
                   8122:               <dd>
                   8123:                 <p>Packages that install locale files should list
                   8124:                 them in the PLIST as &#8220;<span class=
                   8125:                 "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>&#8221;
                   8126:                 instead of &#8220;<span class=
                   8127:                 "quote">share/locale/de/LC_MESSAGES/...</span>&#8221;.
                   8128:                 This properly handles the fact that different
                   8129:                 operating systems expect locale files to be either
1.45      wiz      8130:                 in <code xmlns=
                   8131:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8132:                 "filename">share</code> or <code xmlns=
                   8133:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8134:                 "filename">lib</code> by default.</p>
1.1       grant    8135:               </dd>
                   8136:             </dl>
                   8137:           </div>
                   8138: 
                   8139:           <p>For a complete list of values which are replaced by
1.45      wiz      8140:           default, please look in <code xmlns=
                   8141:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8142:           "filename">bsd.pkg.mk</code> (and search for <span class=
1.1       grant    8143:           "emphasis"><em>PLIST_SUBST</em></span>).</p>
                   8144: 
                   8145:           <p>If you want to change other variables not listed
                   8146:           above, you can add variables and their expansions to this
1.14      xtraeme  8147:           variable in the following way, similar to <code class=
                   8148:           "varname">MESSAGE_SUBST</code> (see <a href=
1.1       grant    8149:           "#components.optional" title=
1.38      dillo    8150:           "8.5.&nbsp;Optional files">Section&nbsp;8.5,
1.1       grant    8151:           &#8220;Optional files&#8221;</a>):</p>
                   8152:           <pre class="programlisting">
1.51      rillig   8153:     PLIST_SUBST+=   SOMEVAR="somevalue"
1.1       grant    8154: </pre>
                   8155: 
                   8156:           <p>This replaces all occurrences of &#8220;<span class=
                   8157:           "quote">${SOMEVAR}</span>&#8221; in the PLIST with
                   8158:           &#8220;<span class="quote">somevalue</span>&#8221;.</p>
                   8159:         </div>
                   8160: 
1.67      hubertf  8161:         <div class="sect1" lang="en">
1.1       grant    8162:           <div class="titlepage">
                   8163:             <div>
                   8164:               <div>
                   8165:                 <h2 class="title" style="clear: both"><a name=
1.48      dillo    8166:                 "manpage-compression"></a>10.5.&nbsp;Man page
                   8167:                 compression</h2>
1.1       grant    8168:               </div>
                   8169:             </div>
                   8170:           </div>
                   8171: 
1.47      reed     8172:           <p>Man pages should be installed in compressed form if
1.45      wiz      8173:           <code class="varname">MANZ</code> is set (in <code xmlns=
                   8174:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8175:           "filename">bsd.own.mk</code>), and uncompressed
1.45      wiz      8176:           otherwise. To handle this in the <code xmlns=
                   8177:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8178:           "filename">PLIST</code> file, the suffix
                   8179:           &#8220;<span class="quote">.gz</span>&#8221; is
1.47      reed     8180:           appended/removed automatically for man pages according to
1.14      xtraeme  8181:           <code class="varname">MANZ</code> and <code class=
                   8182:           "varname">MANCOMPRESSED</code> being set or not, see
1.45      wiz      8183:           above for details. This modification of the <code xmlns=
                   8184:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8185:           "filename">PLIST</code> file is done on a copy of it, not
1.45      wiz      8186:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8187:           class="filename">PLIST</code> itself.</p>
1.1       grant    8188:         </div>
                   8189: 
1.67      hubertf  8190:         <div class="sect1" lang="en">
1.1       grant    8191:           <div class="titlepage">
                   8192:             <div>
                   8193:               <div>
                   8194:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8195:                 "using-PLIST_SRC"></a>10.6.&nbsp;Changing PLIST
1.30      wiz      8196:                 source with <code class=
1.14      xtraeme  8197:                 "varname">PLIST_SRC</code></h2>
1.1       grant    8198:               </div>
                   8199:             </div>
                   8200:           </div>
                   8201: 
1.14      xtraeme  8202:           <p>To use one or more files as source for the
1.45      wiz      8203:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8204:           class="filename">PLIST</code> used in generating the
                   8205:           binary package, set the variable <code class=
1.14      xtraeme  8206:           "varname">PLIST_SRC</code> to the names of that file(s).
1.24      wiz      8207:           The files are later concatenated using <a href=
                   8208:           "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
                   8209:           <span class="citerefentry"><span class=
                   8210:           "refentrytitle">cat</span>(1)</span></a>, and order of
                   8211:           things is important.</p>
1.1       grant    8212:         </div>
                   8213: 
1.67      hubertf  8214:         <div class="sect1" lang="en">
1.1       grant    8215:           <div class="titlepage">
                   8216:             <div>
                   8217:               <div>
                   8218:                 <h2 class="title" style="clear: both"><a name=
1.47      reed     8219:                 "platform-specific-plist"></a>10.7.&nbsp;Platform-specific
                   8220:                 and differing PLISTs</h2>
1.1       grant    8221:               </div>
                   8222:             </div>
                   8223:           </div>
                   8224: 
                   8225:           <p>Some packages decide to install a different set of
                   8226:           files based on the operating system being used. These
                   8227:           differences can be automatically handled by using the
                   8228:           following files:</p>
                   8229: 
                   8230:           <div class="itemizedlist">
                   8231:             <ul type="disc">
                   8232:               <li>
1.45      wiz      8233:                 <p><code xmlns=
                   8234:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8235:                 "filename">PLIST.common</code></p>
1.1       grant    8236:               </li>
                   8237: 
                   8238:               <li>
1.45      wiz      8239:                 <p><code xmlns=
                   8240:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8241:                 "filename">PLIST.${OPSYS}</code></p>
1.1       grant    8242:               </li>
                   8243: 
                   8244:               <li>
1.45      wiz      8245:                 <p><code xmlns=
                   8246:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.21      ben      8247:                 "filename">PLIST.${MACHINE_ARCH}</code></p>
                   8248:               </li>
                   8249: 
                   8250:               <li>
1.45      wiz      8251:                 <p><code xmlns=
                   8252:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.21      ben      8253:                 "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
                   8254:               </li>
                   8255: 
                   8256:               <li>
1.45      wiz      8257:                 <p><code xmlns=
                   8258:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8259:                 "filename">PLIST.common_end</code></p>
1.1       grant    8260:               </li>
                   8261:             </ul>
                   8262:           </div>
                   8263:         </div>
                   8264: 
1.67      hubertf  8265:         <div class="sect1" lang="en">
1.1       grant    8266:           <div class="titlepage">
                   8267:             <div>
                   8268:               <div>
                   8269:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8270:                 "faq.common-dirs"></a>10.8.&nbsp;Sharing
                   8271:                 directories between packages</h2>
1.1       grant    8272:               </div>
                   8273:             </div>
                   8274:           </div>
                   8275: 
                   8276:           <p>A &#8220;<span class="quote">shared
                   8277:           directory</span>&#8221; is a directory where multiple
                   8278:           (and unrelated) packages install files. These directories
                   8279:           are problematic because you have to add special tricks in
                   8280:           the PLIST to conditionally remove them, or have some
                   8281:           centralized package handle them.</p>
                   8282: 
                   8283:           <p>Within pkgsrc, you'll find both approaches. If a
                   8284:           directory is shared by a few unrelated packages, it's
                   8285:           often not worth to add an extra package to remove it.
                   8286:           Therefore, one simply does:</p>
                   8287:           <pre class="programlisting">
1.51      rillig   8288:     @unexec ${RMDIR} %D/path/to/shared/directory 2&gt;/dev/null || ${TRUE}
1.1       grant    8289: </pre>
                   8290: 
                   8291:           <p>in the PLISTs of all affected packages, instead of the
                   8292:           regular "@dirrm" line.</p>
                   8293: 
                   8294:           <p>However, if the directory is shared across many
                   8295:           packages, two different solutions are available:</p>
                   8296: 
                   8297:           <div class="orderedlist">
                   8298:             <ol type="1">
                   8299:               <li>
                   8300:                 <p>If the packages have a common dependency, the
                   8301:                 directory can be removed in that. For example, see
                   8302:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8303:                 href=
                   8304:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.45      wiz      8305:                 target="_top"><code xmlns="" class=
                   8306:                 "filename">textproc/scrollkeeper</code></a>, which
                   8307:                 removes the shared directory <code xmlns=
                   8308:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      8309:                 "filename">share/omf</code>.</p>
1.1       grant    8310:               </li>
                   8311: 
                   8312:               <li>
                   8313:                 <p>If the packages using the directory are not
                   8314:                 related at all (they have no common dependencies),
                   8315:                 a *-dirs package is used.</p>
                   8316:               </li>
                   8317:             </ol>
                   8318:           </div>
                   8319: 
                   8320:           <p>From now on, we'll discuss the second solution. To get
                   8321:           an idea of the *-dirs packages available, issue:</p>
                   8322:           <pre class="programlisting">
1.51      rillig   8323:     <code class="prompt">%</code> cd .../pkgsrc
                   8324:     <code class="prompt">%</code> ls -d */*-dirs
1.1       grant    8325: </pre>
                   8326: 
                   8327:           <p>Their use from other packages is very simple. The
1.14      xtraeme  8328:           <code class="varname">USE_DIRS</code> variable takes a
                   8329:           list of package names (without the &#8220;<span class=
1.1       grant    8330:           "quote">-dirs</span>&#8221; part) together with the
                   8331:           required version number (always pick the latest one when
1.34      wiz      8332:           writing new packages).</p>
1.1       grant    8333: 
                   8334:           <p>For example, if a package installs files under
1.45      wiz      8335:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8336:           class="filename">share/applications</code>, it should
                   8337:           have the following line in it:</p>
1.1       grant    8338:           <pre class="programlisting">
1.51      rillig   8339:     USE_DIRS+=      xdg-1.1
1.1       grant    8340: </pre>
                   8341: 
1.14      xtraeme  8342:           <p>After regenerating the PLIST using
                   8343:           <span><strong class="command">make
                   8344:           print-PLIST</strong></span>, you should get the right
                   8345:           (commented out) lines.</p>
1.1       grant    8346: 
1.47      reed     8347:           <p>Note that even if your package is using <code xmlns=
1.45      wiz      8348:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8349:           "filename">$X11BASE</code>, it must not depend on the
1.1       grant    8350:           *-x11-dirs packages. Just specify the name without that
1.45      wiz      8351:           part and pkgsrc (in particular, <code xmlns=
                   8352:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8353:           "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1       grant    8354:         </div>
                   8355:       </div>
                   8356: 
1.67      hubertf  8357:       <div class="chapter" lang="en">
1.1       grant    8358:         <div class="titlepage">
                   8359:           <div>
                   8360:             <div>
1.67      hubertf  8361:               <h2 class="title"><a name=
1.38      dillo    8362:               "buildlink"></a>Chapter&nbsp;11.&nbsp;Buildlink
1.1       grant    8363:               methodology</h2>
                   8364:             </div>
                   8365:           </div>
                   8366:         </div>
                   8367: 
                   8368:         <div class="toc">
                   8369:           <p><b>Table of Contents</b></p>
                   8370: 
                   8371:           <dl>
1.30      wiz      8372:             <dt><span class="sect1"><a href=
1.38      dillo    8373:             "#converting-to-buildlink3">11.1. Converting packages
1.30      wiz      8374:             to use buildlink3</a></span></dt>
1.1       grant    8375: 
1.30      wiz      8376:             <dt><span class="sect1"><a href=
1.45      wiz      8377:             "#creating-buildlink3.mk">11.2. Writing <code xmlns=
                   8378:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      8379:             "filename">buildlink3.mk</code> files</a></span></dt>
1.1       grant    8380: 
                   8381:             <dd>
                   8382:               <dl>
1.25      rillig   8383:                 <dt><span class="sect2"><a href=
1.38      dillo    8384:                 "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30      wiz      8385:                 buildlink3.mk file</a></span></dt>
1.1       grant    8386: 
1.25      rillig   8387:                 <dt><span class="sect2"><a href=
1.38      dillo    8388:                 "#updating-buildlink-depends">11.2.2. Updating
1.30      wiz      8389:                 <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14      xtraeme  8390:                 "replaceable"><code>pkg</code></em></code> in
1.45      wiz      8391:                 <code xmlns=
                   8392:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8393:                 "filename">buildlink3.mk</code>
1.1       grant    8394:                 files</a></span></dt>
                   8395:               </dl>
                   8396:             </dd>
                   8397: 
1.30      wiz      8398:             <dt><span class="sect1"><a href=
1.45      wiz      8399:             "#writing-builtin.mk">11.3. Writing <code xmlns=
                   8400:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      8401:             "filename">builtin.mk</code> files</a></span></dt>
1.1       grant    8402: 
                   8403:             <dd>
                   8404:               <dl>
1.25      rillig   8405:                 <dt><span class="sect2"><a href=
1.38      dillo    8406:                 "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45      wiz      8407:                 <code xmlns=
                   8408:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8409:                 "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    8410: 
1.25      rillig   8411:                 <dt><span class="sect2"><a href=
1.38      dillo    8412:                 "#native-or-pkgsrc-preference">11.3.2. Global
1.30      wiz      8413:                 preferences for native or pkgsrc
                   8414:                 software</a></span></dt>
1.1       grant    8415:               </dl>
                   8416:             </dd>
                   8417:           </dl>
                   8418:         </div>
                   8419: 
                   8420:         <p>Buildlink is a framework in pkgsrc that controls what
                   8421:         headers and libraries are seen by a package's configure and
                   8422:         build processes. This is implemented in a two step
                   8423:         process:</p>
                   8424: 
                   8425:         <div class="orderedlist">
                   8426:           <ol type="1">
                   8427:             <li>
                   8428:               <p>Symlink headers and libraries for dependencies
1.14      xtraeme  8429:               into <code class="varname">BUILDLINK_DIR</code>,
                   8430:               which by default is a subdirectory of <code class=
                   8431:               "varname">WRKDIR</code>.</p>
1.1       grant    8432:             </li>
                   8433: 
                   8434:             <li>
                   8435:               <p>Create wrapper scripts that are used in place of
1.14      xtraeme  8436:               the normal compiler tools that translate <code class=
                   8437:               "option">-I${LOCALBASE}/include</code> and
                   8438:               <code class="option">-L${LOCALBASE}/lib</code> into
                   8439:               references to <code class=
                   8440:               "varname">BUILDLINK_DIR</code>. The wrapper scripts
                   8441:               also make native compiler on some operating systems
                   8442:               look like GCC, so that packages that expect GCC won't
                   8443:               require modifications to build with those native
                   8444:               compilers.</p>
1.1       grant    8445:             </li>
                   8446:           </ol>
                   8447:         </div>
                   8448: 
                   8449:         <p>This normalizes the environment in which a package is
                   8450:         built so that the package may be built consistently despite
                   8451:         what other software may be installed. Please note that the
1.45      wiz      8452:         normal system header and library paths, e.g. <code xmlns=
                   8453:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   8454:         "filename">/usr/include</code>, <code xmlns=
                   8455:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8456:         "filename">/usr/lib</code>, etc., are always searched --
1.1       grant    8457:         buildlink3 is designed to insulate the package build from
                   8458:         non-system-supplied software.</p>
                   8459: 
1.67      hubertf  8460:         <div class="sect1" lang="en">
1.1       grant    8461:           <div class="titlepage">
                   8462:             <div>
                   8463:               <div>
                   8464:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8465:                 "converting-to-buildlink3"></a>11.1.&nbsp;Converting
1.30      wiz      8466:                 packages to use buildlink3</h2>
1.1       grant    8467:               </div>
                   8468:             </div>
                   8469:           </div>
                   8470: 
                   8471:           <p>The process of converting packages to use the
                   8472:           buildlink3 framework (&#8220;<span class=
                   8473:           "quote">bl3ifying</span>&#8221;) is fairly
                   8474:           straightforward. The things to keep in mind are:</p>
                   8475: 
                   8476:           <div class="orderedlist">
                   8477:             <ol type="1">
                   8478:               <li>
                   8479:                 <p>Ensure that the build always calls the wrapper
                   8480:                 scripts instead of the actual toolchain. Some
                   8481:                 packages are tricky, and the only way to know for
1.45      wiz      8482:                 sure is the check <code xmlns=
                   8483:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8484:                 "filename">${WRKDIR}/.work.log</code> to see if the
1.1       grant    8485:                 wrappers are being invoked.</p>
                   8486:               </li>
                   8487: 
                   8488:               <li>
1.14      xtraeme  8489:                 <p>Don't override <code class=
                   8490:                 "varname">PREFIX</code> from within the package
                   8491:                 Makefile, e.g. Java VMs, standalone shells, etc.,
1.45      wiz      8492:                 because the code to symlink files into <code xmlns=
                   8493:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8494:                 "filename">${BUILDLINK_DIR}</code> looks for files
1.1       grant    8495:                 relative to &#8220;<span class="quote">pkg_info -qp
1.14      xtraeme  8496:                 <em class=
                   8497:                 "replaceable"><code>pkgname</code></em></span>&#8221;.</p>
1.1       grant    8498:               </li>
                   8499: 
                   8500:               <li>
                   8501:                 <p>Remember that <span class=
1.45      wiz      8502:                 "emphasis"><em>only</em></span> the <code xmlns=
                   8503:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8504:                 "filename">buildlink3.mk</code> files that you list
1.1       grant    8505:                 in a package's Makefile are added as dependencies
                   8506:                 for that package.</p>
                   8507:               </li>
                   8508:             </ol>
                   8509:           </div>
                   8510: 
                   8511:           <p>If a dependency on a particular package is required
                   8512:           for its libraries and headers, then we replace:</p>
                   8513:           <pre class="programlisting">
1.51      rillig   8514:     DEPENDS+=   foo&gt;=1.1.0:../../category/foo
1.1       grant    8515: </pre>
                   8516: 
                   8517:           <p>with</p>
                   8518:           <pre class="programlisting">
1.51      rillig   8519:     .include "../../category/foo/buildlink3.mk"
1.1       grant    8520: </pre>
                   8521: 
1.47      reed     8522:           <p>The buildlink3.mk files usually define the required
                   8523:           dependencies. If you need a newer version of the
                   8524:           dependency when using buildlink3.mk files, then you can
                   8525:           define it in your Makefile; for example:</p>
                   8526:           <pre class="programlisting">
1.51      rillig   8527:     BUILDLINK_DEPENDS.foo+=   foo&gt;=1.1.0
                   8528:     .include "../../category/foo/buildlink3.mk"
1.47      reed     8529: </pre>
                   8530: 
1.45      wiz      8531:           <p>There are several <code xmlns=
                   8532:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   8533:           "filename">buildlink3.mk</code> files in <code xmlns=
                   8534:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8535:           "filename">pkgsrc/mk</code> that handle special package
1.1       grant    8536:           issues:</p>
                   8537: 
                   8538:           <div class="itemizedlist">
                   8539:             <ul type="disc">
                   8540:               <li>
1.45      wiz      8541:                 <p><code xmlns=
                   8542:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8543:                 "filename">bdb.buildlink3.mk</code> chooses either
                   8544:                 the native or a pkgsrc Berkeley DB implementation
                   8545:                 based on the values of <code class=
1.14      xtraeme  8546:                 "varname">BDB_ACCEPTED</code> and <code class=
                   8547:                 "varname">BDB_DEFAULT</code>.</p>
1.1       grant    8548:               </li>
                   8549: 
                   8550:               <li>
1.45      wiz      8551:                 <p><code xmlns=
                   8552:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     8553:                 "filename">curses.buildlink3.mk</code>: If the
1.14      xtraeme  8554:                 system comes with neither Curses nor NCurses, this
                   8555:                 will take care to install the <a xmlns=
                   8556:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    8557:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.45      wiz      8558:                 target="_top"><code xmlns="" class=
                   8559:                 "filename">devel/ncurses</code></a> package.</p>
1.1       grant    8560:               </li>
                   8561: 
                   8562:               <li>
1.45      wiz      8563:                 <p><code xmlns=
                   8564:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8565:                 "filename">krb5.buildlink3.mk</code> uses the value
                   8566:                 of <code class="varname">KRB5_ACCEPTED</code> to
                   8567:                 choose between adding a dependency on Heimdal or
                   8568:                 MIT-krb5 for packages that require a Kerberos 5
1.1       grant    8569:                 implementation.</p>
                   8570:               </li>
                   8571: 
                   8572:               <li>
1.45      wiz      8573:                 <p><code xmlns=
                   8574:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8575:                 "filename">motif.buildlink3.mk</code> checks for a
                   8576:                 system-provided Motif installation or adds a
                   8577:                 dependency on <a xmlns=
1.1       grant    8578:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8579:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.45      wiz      8580:                 target="_top"><code xmlns="" class=
                   8581:                 "filename">x11/lesstif</code></a> or <a xmlns=
1.20      ben      8582:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8583:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
1.45      wiz      8584:                 target="_top"><code xmlns="" class=
1.47      reed     8585:                 "filename">x11/openmotif</code></a>.</p>
1.1       grant    8586:               </li>
                   8587: 
                   8588:               <li>
1.45      wiz      8589:                 <p><code xmlns=
                   8590:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8591:                 "filename">ossaudio.buildlink3.mk</code> defines
                   8592:                 several variables that may be used by packages that
1.47      reed     8593:                 use the Open Sound System (OSS) API.</p>
1.1       grant    8594:               </li>
                   8595: 
                   8596:               <li>
1.45      wiz      8597:                 <p><code xmlns=
                   8598:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8599:                 "filename">pgsql.buildlink3.mk</code> will accept
                   8600:                 either Postgres 7.3 or 7.4, whichever is found
                   8601:                 installed. See the file for more information.</p>
1.1       grant    8602:               </li>
                   8603: 
                   8604:               <li>
1.45      wiz      8605:                 <p><code xmlns=
                   8606:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8607:                 "filename">pthread.buildlink3.mk</code> uses the
                   8608:                 value of <code class="varname">PTHREAD_OPTS</code>
                   8609:                 and checks for native pthreads or adds a dependency
                   8610:                 on <a xmlns=
1.1       grant    8611:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8612:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.45      wiz      8613:                 target="_top"><code xmlns="" class=
1.47      reed     8614:                 "filename">devel/pth</code></a> as needed.</p>
1.1       grant    8615:               </li>
                   8616: 
                   8617:               <li>
1.45      wiz      8618:                 <p><code xmlns=
                   8619:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8620:                 "filename">xaw.buildlink3.mk</code> uses the value
                   8621:                 of <code class="varname">XAW_TYPE</code> to choose
                   8622:                 a particular Athena widgets library.</p>
1.1       grant    8623:               </li>
                   8624:             </ul>
                   8625:           </div>
                   8626: 
1.45      wiz      8627:           <p>The comments in those <code xmlns=
                   8628:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8629:           "filename">buildlink3.mk</code> files provide a more
1.1       grant    8630:           complete description of how to use them properly.</p>
                   8631:         </div>
                   8632: 
1.67      hubertf  8633:         <div class="sect1" lang="en">
1.1       grant    8634:           <div class="titlepage">
                   8635:             <div>
                   8636:               <div>
                   8637:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8638:                 "creating-buildlink3.mk"></a>11.2.&nbsp;Writing
1.45      wiz      8639:                 <code xmlns=
                   8640:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8641:                 "filename">buildlink3.mk</code> files</h2>
1.1       grant    8642:               </div>
                   8643:             </div>
                   8644:           </div>
                   8645: 
1.45      wiz      8646:           <p>A package's <code xmlns=
                   8647:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8648:           "filename">buildlink3.mk</code> file is included by
                   8649:           Makefiles to indicate the need to compile and link
                   8650:           against header files and libraries provided by the
1.45      wiz      8651:           package. A <code xmlns=
                   8652:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   8653:           "filename">buildlink3.mk</code> file should always
                   8654:           provide enough information to add the correct type of
                   8655:           dependency relationship and include any other
                   8656:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8657:           class="filename">buildlink3.mk</code> files that it needs
                   8658:           to find headers and libraries that it needs in turn.</p>
1.1       grant    8659: 
1.45      wiz      8660:           <p>To generate an initial <code xmlns=
                   8661:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8662:           "filename">buildlink3.mk</code> file for further editing,
1.1       grant    8663:           Rene Hexel's <a xmlns=
                   8664:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   8665:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.45      wiz      8666:           target="_top"><code xmlns="" class=
                   8667:           "filename">pkgtools/createbuildlink</code></a> package is
1.20      ben      8668:           highly recommended. For most packages, the following
                   8669:           command will generate a good starting point for
1.45      wiz      8670:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8671:           class="filename">buildlink3.mk</code> files:</p>
1.1       grant    8672:           <pre class="screen">
1.14      xtraeme  8673: <code class="prompt">%</code> <strong class=
                   8674: "userinput"><code>cd pkgsrc/<em class=
                   8675: "replaceable"><code>category</code></em>/<em class=
                   8676: "replaceable"><code>pkgdir</code></em>
                   8677: <code class=
1.49      rillig   8678: "prompt">%</code> createbuildlink &gt;buildlink3.mk</code></strong>
1.1       grant    8679: </pre>
                   8680: 
1.67      hubertf  8681:           <div class="sect2" lang="en">
1.1       grant    8682:             <div class="titlepage">
                   8683:               <div>
                   8684:                 <div>
1.67      hubertf  8685:                   <h3 class="title"><a name=
                   8686:                   "anatomy-of-bl3"></a>11.2.1.&nbsp;Anatomy of a
1.25      rillig   8687:                   buildlink3.mk file</h3>
1.1       grant    8688:                 </div>
                   8689:               </div>
                   8690:             </div>
                   8691: 
1.45      wiz      8692:             <p>The following real-life example <code xmlns=
                   8693:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8694:             "filename">buildlink3.mk</code> is taken from
1.45      wiz      8695:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8696:             class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1       grant    8697:             <pre class="programlisting">
1.51      rillig   8698:     # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1       grant    8699: 
1.51      rillig   8700:     BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH}+
                   8701:     TIFF_BUILDLINK3_MK:=    ${TIFF_BUILDLINK3_MK}+
1.1       grant    8702: 
1.51      rillig   8703:     .if !empty(BUILDLINK_DEPTH:M+)
                   8704:     BUILDLINK_DEPENDS+=     tiff
                   8705:     .endif
1.1       grant    8706: 
1.51      rillig   8707:     BUILDLINK_PACKAGES:=    ${BUILDLINK_PACKAGES:Ntiff}
                   8708:     BUILDLINK_PACKAGES+=    tiff
1.1       grant    8709: 
1.51      rillig   8710:     .if !empty(TIFF_BUILDLINK3_MK:M+)
                   8711:     BUILDLINK_DEPENDS.tiff+=        tiff&gt;=3.6.1
                   8712:     BUILDLINK_PKGSRCDIR.tiff?=      ../../graphics/tiff
                   8713:     .endif  # TIFF_BUILDLINK3_MK
1.1       grant    8714: 
1.51      rillig   8715:     .include "../../devel/zlib/buildlink3.mk"
                   8716:     .include "../../graphics/jpeg/buildlink3.mk"
1.1       grant    8717: 
1.51      rillig   8718:     BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH:S/+$//}
1.1       grant    8719: </pre>
                   8720: 
1.14      xtraeme  8721:             <p>The header and footer manipulate <code class=
                   8722:             "varname">BUILDLINK_DEPTH</code>, which is common
1.45      wiz      8723:             across all <code xmlns=
                   8724:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8725:             "filename">buildlink3.mk</code> files and is used to
                   8726:             track at what depth we are including <code xmlns=
                   8727:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8728:             "filename">buildlink3.mk</code> files.</p>
1.1       grant    8729: 
                   8730:             <p>The first section controls if the dependency on
1.14      xtraeme  8731:             <em class="replaceable"><code>pkg</code></em> is added.
                   8732:             <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1       grant    8733:             global list of packages for which dependencies are
                   8734:             added by buildlink3.</p>
                   8735: 
                   8736:             <p>The second section advises pkgsrc that the
1.45      wiz      8737:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8738:             class="filename">buildlink3.mk</code> file for
1.14      xtraeme  8739:             <em class="replaceable"><code>pkg</code></em> has been
                   8740:             included at some point. <code class=
                   8741:             "varname">BUILDLINK_PACKAGES</code> is the global list
1.45      wiz      8742:             of packages for which <code xmlns=
                   8743:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8744:             "filename">buildlink3.mk</code> files have been
                   8745:             included. It must <span class=
                   8746:             "emphasis"><em>always</em></span> be appended to within
1.45      wiz      8747:             a <code xmlns=
                   8748:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8749:             "filename">buildlink3.mk</code> file.</p>
1.1       grant    8750: 
                   8751:             <p>The third section is protected from multiple
1.14      xtraeme  8752:             inclusion and controls how the dependency on <em class=
                   8753:             "replaceable"><code>pkg</code></em> is added. Several
1.1       grant    8754:             important variables are set in the section:</p>
                   8755: 
                   8756:             <div class="itemizedlist">
                   8757:               <ul type="disc">
                   8758:                 <li>
1.14      xtraeme  8759:                   <p><code class=
                   8760:                   "varname">BUILDLINK_DEPENDS.<em class=
                   8761:                   "replaceable"><code>pkg</code></em></code> is the
                   8762:                   actual dependency recorded in the installed
                   8763:                   package; this should always be set using
                   8764:                   <span><strong class="command">+=</strong></span>
                   8765:                   to ensure that we're appending to any
                   8766:                   pre-existing list of values. This variable should
                   8767:                   be set to the first version of the package that
                   8768:                   had the last change in the major number of a
                   8769:                   shared library or that had a major API
                   8770:                   change.</p>
1.1       grant    8771:                 </li>
                   8772: 
                   8773:                 <li>
1.14      xtraeme  8774:                   <p><code class=
                   8775:                   "varname">BUILDLINK_PKGSRCDIR.<em class=
                   8776:                   "replaceable"><code>pkg</code></em></code> is the
                   8777:                   location of the <em class=
                   8778:                   "replaceable"><code>pkg</code></em> pkgsrc
1.47      reed     8779:                   directory.</p>
1.1       grant    8780:                 </li>
                   8781: 
                   8782:                 <li>
1.14      xtraeme  8783:                   <p><code class=
                   8784:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   8785:                   "replaceable"><code>pkg</code></em></code> (not
                   8786:                   shown above) controls whether we use <code class=
                   8787:                   "varname">BUILD_DEPENDS</code> or <code class=
                   8788:                   "varname">DEPENDS</code> to add the dependency on
                   8789:                   <em class="replaceable"><code>pkg</code></em>.
                   8790:                   The build dependency is selected by setting
                   8791:                   <code class=
                   8792:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   8793:                   "replaceable"><code>pkg</code></em></code> to
1.1       grant    8794:                   &#8220;<span class="quote">build</span>&#8221;.
                   8795:                   By default, the full dependency is used.</p>
                   8796:                 </li>
                   8797: 
                   8798:                 <li>
1.14      xtraeme  8799:                   <p><code class=
                   8800:                   "varname">BUILDLINK_INCDIRS.<em class=
                   8801:                   "replaceable"><code>pkg</code></em></code> and
                   8802:                   <code class=
1.67      hubertf  8803:                   "varname">BUILDLINK_LIBDIRS.<em class="replaceable"><code>pkg</code></em></code>
                   8804:                   (not shown above) are lists of subdirectories of
                   8805:                   <code xmlns=
1.45      wiz      8806:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8807:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8808:                   "replaceable"><code>pkg</code></em>}</code> to
                   8809:                   add to the header and library search paths. These
1.1       grant    8810:                   default to &#8220;<span class=
                   8811:                   "quote">include</span>&#8221; and
                   8812:                   &#8220;<span class="quote">lib</span>&#8221;
                   8813:                   respectively.</p>
                   8814:                 </li>
                   8815: 
                   8816:                 <li>
1.14      xtraeme  8817:                   <p><code class=
                   8818:                   "varname">BUILDLINK_CPPFLAGS.<em class=
                   8819:                   "replaceable"><code>pkg</code></em></code> (not
                   8820:                   shown above) is the list of preprocessor flags to
                   8821:                   add to <code class="varname">CPPFLAGS</code>,
                   8822:                   which are passed on to the configure and build
                   8823:                   phases. The &#8220;<span class=
                   8824:                   "quote">-I</span>&#8221; option should be avoided
                   8825:                   and instead be handled using <code class=
                   8826:                   "varname">BUILDLINK_INCDIRS.<em class=
                   8827:                   "replaceable"><code>pkg</code></em></code> as
                   8828:                   above.</p>
1.1       grant    8829:                 </li>
                   8830:               </ul>
                   8831:             </div>
                   8832: 
                   8833:             <p>The following variables are all optionally defined
                   8834:             within this second section (protected against multiple
                   8835:             inclusion) and control which package files are
1.45      wiz      8836:             symlinked into <code xmlns=
                   8837:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8838:             "filename">${BUILDLINK_DIR}</code> and how their names
1.1       grant    8839:             are transformed during the symlinking:</p>
                   8840: 
                   8841:             <div class="itemizedlist">
                   8842:               <ul type="disc">
                   8843:                 <li>
1.14      xtraeme  8844:                   <p><code class=
                   8845:                   "varname">BUILDLINK_FILES.<em class=
                   8846:                   "replaceable"><code>pkg</code></em></code> (not
                   8847:                   shown above) is a shell glob pattern relative to
1.45      wiz      8848:                   <code xmlns=
                   8849:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8850:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8851:                   "replaceable"><code>pkg</code></em>}</code> to be
1.45      wiz      8852:                   symlinked into <code xmlns=
                   8853:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8854:                   "filename">${BUILDLINK_DIR}</code>, e.g.
1.45      wiz      8855:                   <code xmlns=
                   8856:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8857:                   "filename">include/*.h</code>.</p>
1.1       grant    8858:                 </li>
                   8859: 
                   8860:                 <li>
1.14      xtraeme  8861:                   <p><code class=
                   8862:                   "varname">BUILDLINK_FILES_CMD.<em class=
                   8863:                   "replaceable"><code>pkg</code></em></code> (not
                   8864:                   shown above) is a shell pipeline that outputs to
1.45      wiz      8865:                   stdout a list of files relative to <code xmlns=
                   8866:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8867:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8868:                   "replaceable"><code>pkg</code></em>}</code>. The
1.1       grant    8869:                   resulting files are to be symlinked into
1.45      wiz      8870:                   <code xmlns=
                   8871:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8872:                   "filename">${BUILDLINK_DIR}</code>. By default,
                   8873:                   this takes the <code xmlns=
                   8874:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8875:                   "filename">+CONTENTS</code> of a <em class=
                   8876:                   "replaceable"><code>pkg</code></em> and filters
                   8877:                   it through <code class=
                   8878:                   "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
                   8879:                   "replaceable"><code>pkg</code></em>}</code>.</p>
1.1       grant    8880:                 </li>
                   8881: 
                   8882:                 <li>
1.14      xtraeme  8883:                   <p><code class=
                   8884:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   8885:                   "replaceable"><code>pkg</code></em></code> (not
                   8886:                   shown above) is a filter command that filters
1.45      wiz      8887:                   <code xmlns=
                   8888:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8889:                   "filename">+CONTENTS</code> input into a list of
                   8890:                   files relative to <code xmlns=
                   8891:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8892:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8893:                   "replaceable"><code>pkg</code></em>}</code> on
                   8894:                   stdout. By default for overwrite packages,
                   8895:                   <code class=
                   8896:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   8897:                   "replaceable"><code>pkg</code></em></code>
1.45      wiz      8898:                   outputs the contents of the <code xmlns=
                   8899:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8900:                   "filename">include</code> and <code xmlns=
                   8901:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8902:                   "filename">lib</code> directories in the package
1.45      wiz      8903:                   <code xmlns=
                   8904:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8905:                   "filename">+CONTENTS</code>, and for pkgviews
                   8906:                   packages, it outputs any libtool archives in
                   8907:                   <code xmlns=
                   8908:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8909:                   "filename">lib</code> directories.</p>
1.1       grant    8910:                 </li>
                   8911: 
                   8912:                 <li>
1.14      xtraeme  8913:                   <p><code class=
                   8914:                   "varname">BUILDLINK_TRANSFORM.<em class=
                   8915:                   "replaceable"><code>pkg</code></em></code> (not
                   8916:                   shown above) is a list of sed arguments used to
1.1       grant    8917:                   transform the name of the source filename into a
1.14      xtraeme  8918:                   destination filename, e.g. <span><strong class=
1.1       grant    8919:                   "command">-e
1.14      xtraeme  8920:                   "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1       grant    8921:                 </li>
                   8922:               </ul>
                   8923:             </div>
                   8924: 
1.45      wiz      8925:             <p>The last section includes any <code xmlns=
                   8926:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8927:             "filename">buildlink3.mk</code> needed for <em class=
                   8928:             "replaceable"><code>pkg</code></em>'s library
1.45      wiz      8929:             dependencies. Including these <code xmlns=
                   8930:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8931:             "filename">buildlink3.mk</code> files means that the
                   8932:             headers and libraries for these dependencies are also
1.45      wiz      8933:             symlinked into <code xmlns=
                   8934:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8935:             "filename">${BUILDLINK_DIR}</code> whenever the
                   8936:             <em class="replaceable"><code>pkg</code></em>
1.45      wiz      8937:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8938:             class="filename">buildlink3.mk</code> file is
1.14      xtraeme  8939:             included.</p>
1.1       grant    8940:           </div>
                   8941: 
1.67      hubertf  8942:           <div class="sect2" lang="en">
1.1       grant    8943:             <div class="titlepage">
                   8944:               <div>
                   8945:                 <div>
1.30      wiz      8946:                   <h3 class="title"><a name=
1.67      hubertf  8947:                   "updating-buildlink-depends"></a>11.2.2.&nbsp;Updating
1.30      wiz      8948:                   <code class=
1.67      hubertf  8949:                   "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                   8950:                   in <code xmlns=
1.45      wiz      8951:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      8952:                   "filename">buildlink3.mk</code> files</h3>
1.1       grant    8953:                 </div>
                   8954:               </div>
                   8955:             </div>
                   8956: 
                   8957:             <p>There are two situations that require increasing the
1.14      xtraeme  8958:             dependency listed in <code class=
                   8959:             "varname">BUILDLINK_DEPENDS.<em class=
                   8960:             "replaceable"><code>pkg</code></em></code> after a
                   8961:             package update:</p>
1.1       grant    8962: 
                   8963:             <div class="orderedlist">
                   8964:               <ol type="1">
                   8965:                 <li>
                   8966:                   <p>if the sonames (major number of the library
                   8967:                   version) of any installed shared libraries
1.47      reed     8968:                   change.</p>
1.1       grant    8969:                 </li>
                   8970: 
                   8971:                 <li>
                   8972:                   <p>if the API or interface to the header files
                   8973:                   change.</p>
                   8974:                 </li>
                   8975:               </ol>
                   8976:             </div>
                   8977: 
1.14      xtraeme  8978:             <p>In these cases, <code class=
                   8979:             "varname">BUILDLINK_DEPENDS.<em class=
                   8980:             "replaceable"><code>pkg</code></em></code> should be
                   8981:             adjusted to require at least the new package version.
                   8982:             In some cases, the packages that depend on this new
                   8983:             version may need their <code class=
                   8984:             "varname">PKGREVISION</code>s increased and, if they
1.45      wiz      8985:             have <code xmlns=
                   8986:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8987:             "filename">buildlink3.mk</code> files, their
                   8988:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   8989:             "replaceable"><code>pkg</code></em></code> adjusted,
                   8990:             too. This is needed so that binary packages made using
                   8991:             it will require the correct package dependency and not
                   8992:             settle for an older one which will not contain the
                   8993:             necessary shared libraries.</p>
1.1       grant    8994: 
                   8995:             <p>Please take careful consideration before adjusting
1.14      xtraeme  8996:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   8997:             "replaceable"><code>pkg</code></em></code> as we don't
                   8998:             want to cause unneeded package deletions and rebuilds.
                   8999:             In many cases, new versions of packages work just fine
                   9000:             with older dependencies. See <a href="#dependencies"
1.67      hubertf  9001:             title=
1.68      rillig   9002:             "16.1.4.&nbsp;Handling dependencies">Section&nbsp;16.1.4,
1.67      hubertf  9003:             &#8220;Handling dependencies&#8221;</a> for more
                   9004:             information about dependencies on other packages,
1.25      rillig   9005:             including the <code class=
                   9006:             "varname">BUILDLINK_RECOMMENDED</code> and <code class=
                   9007:             "varname">RECOMMENDED</code> definitions.</p>
1.1       grant    9008:           </div>
                   9009:         </div>
                   9010: 
1.67      hubertf  9011:         <div class="sect1" lang="en">
1.1       grant    9012:           <div class="titlepage">
                   9013:             <div>
                   9014:               <div>
                   9015:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    9016:                 "writing-builtin.mk"></a>11.3.&nbsp;Writing
1.45      wiz      9017:                 <code xmlns=
                   9018:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   9019:                 "filename">builtin.mk</code> files</h2>
1.1       grant    9020:               </div>
                   9021:             </div>
                   9022:           </div>
                   9023: 
                   9024:           <p>Some packages in pkgsrc install headers and libraries
                   9025:           that coincide with headers and libraries present in the
1.45      wiz      9026:           base system. Aside from a <code xmlns=
                   9027:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9028:           "filename">buildlink3.mk</code> file, these packages
1.45      wiz      9029:           should also include a <code xmlns=
                   9030:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9031:           "filename">builtin.mk</code> file that includes the
                   9032:           necessary checks to decide whether using the built-in
                   9033:           software or the pkgsrc software is appropriate.</p>
1.1       grant    9034: 
                   9035:           <p>The only requirements of a builtin.mk file for
1.14      xtraeme  9036:           <em class="replaceable"><code>pkg</code></em> are:</p>
1.1       grant    9037: 
                   9038:           <div class="orderedlist">
                   9039:             <ol type="1">
                   9040:               <li>
1.14      xtraeme  9041:                 <p>It should set <code class=
                   9042:                 "varname">USE_BUILTIN.<em class=
                   9043:                 "replaceable"><code>pkg</code></em></code> to
                   9044:                 either &#8220;<span class="quote">yes</span>&#8221;
                   9045:                 or &#8220;<span class="quote">no</span>&#8221;
                   9046:                 after it is included.</p>
1.1       grant    9047:               </li>
                   9048: 
                   9049:               <li>
                   9050:                 <p>It should <span class=
                   9051:                 "emphasis"><em>not</em></span> override any
1.14      xtraeme  9052:                 <code class="varname">USE_BUILTIN.<em class=
                   9053:                 "replaceable"><code>pkg</code></em></code> which is
1.45      wiz      9054:                 already set before the <code xmlns=
                   9055:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9056:                 "filename">builtin.mk</code> file is included.</p>
1.1       grant    9057:               </li>
                   9058: 
                   9059:               <li>
                   9060:                 <p>It should be written to allow multiple
                   9061:                 inclusion. This is <span class=
                   9062:                 "emphasis"><em>very</em></span> important and takes
1.45      wiz      9063:                 careful attention to <code xmlns=
                   9064:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9065:                 "filename">Makefile</code> coding.</p>
1.1       grant    9066:               </li>
                   9067:             </ol>
                   9068:           </div>
                   9069: 
1.67      hubertf  9070:           <div class="sect2" lang="en">
1.1       grant    9071:             <div class="titlepage">
                   9072:               <div>
                   9073:                 <div>
1.67      hubertf  9074:                   <h3 class="title"><a name=
1.38      dillo    9075:                   "anatomy-of-builtin.mk"></a>11.3.1.&nbsp;Anatomy
1.45      wiz      9076:                   of a <code xmlns=
                   9077:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9078:                   "filename">builtin.mk</code> file</h3>
1.1       grant    9079:                 </div>
                   9080:               </div>
                   9081:             </div>
                   9082: 
                   9083:             <p>The following is the recommended template for
                   9084:             builtin.mk files:</p>
                   9085:             <pre class="programlisting">
1.51      rillig   9086:     .if !defined(IS_BUILTIN.foo)
                   9087:     #
                   9088:     # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
                   9089:     # genuinely exists in the system or not.
                   9090:     #
                   9091:     IS_BUILTIN.foo?=        no
                   9092: 
                   9093:     # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
                   9094:     # version can be determined.
                   9095:     #
                   9096:     .  if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
                   9097:     BUILTIN_PKG.foo?=       foo-1.0
                   9098:     .  endif
                   9099:     .endif  # IS_BUILTIN.foo
                   9100: 
                   9101:     .if !defined(USE_BUILTIN.foo)
                   9102:     USE_BUILTIN.foo?=       ${IS_BUILTIN.foo}
                   9103:     .  if defined(BUILTIN_PKG.foo)
                   9104:     .    for _depend_ in ${BUILDLINK_DEPENDS.foo}
                   9105:     .      if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
                   9106:     USE_BUILTIN.foo!=                                                       \
                   9107:           if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then     \
                   9108:                   ${ECHO} "yes";                                            \
                   9109:           else                                                              \
                   9110:                   ${ECHO} "no";                                             \
                   9111:           fi
                   9112:     .      endif
                   9113:     .    endfor
                   9114:     .  endif
                   9115:     .endif  # USE_BUILTIN.foo
                   9116: 
                   9117:     CHECK_BUILTIN.foo?=     no
                   9118:     .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
                   9119:     #
                   9120:     # Here we place code that depends on whether USE_BUILTIN.foo is set to
                   9121:     # "yes" or "no".
                   9122:     #
                   9123:     .endif  # CHECK_BUILTIN.foo
1.1       grant    9124: </pre>
                   9125: 
1.14      xtraeme  9126:             <p>The first section sets <code class=
                   9127:             "varname">IS_BUILTIN.<em class=
                   9128:             "replaceable"><code>pkg</code></em></code> depending on
                   9129:             if <em class="replaceable"><code>pkg</code></em> really
                   9130:             exists in the base system. This should not be a base
                   9131:             system software with similar functionality to
                   9132:             <em class="replaceable"><code>pkg</code></em>; it
                   9133:             should only be &#8220;<span class=
                   9134:             "quote">yes</span>&#8221; if the actual package is
                   9135:             included as part of the base system. This variable is
1.45      wiz      9136:             only used internally within the <code xmlns=
                   9137:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9138:             "filename">builtin.mk</code> file.</p>
                   9139: 
                   9140:             <p>The second section sets <code class=
                   9141:             "varname">BUILTIN_PKG.<em class=
                   9142:             "replaceable"><code>pkg</code></em></code> to the
                   9143:             version of <em class=
                   9144:             "replaceable"><code>pkg</code></em> in the base system
                   9145:             if it exists (if <code class=
                   9146:             "varname">IS_BUILTIN.<em class=
                   9147:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    9148:             &#8220;<span class="quote">yes</span>&#8221;). This
1.14      xtraeme  9149:             variable is only used internally within the
1.45      wiz      9150:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9151:             class="filename">builtin.mk</code> file.</p>
1.1       grant    9152: 
1.14      xtraeme  9153:             <p>The third section sets <code class=
                   9154:             "varname">USE_BUILTIN.<em class=
                   9155:             "replaceable"><code>pkg</code></em></code> and is
                   9156:             <span class="emphasis"><em>required</em></span> in all
1.45      wiz      9157:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9158:             class="filename">builtin.mk</code> files. The code in
                   9159:             this section must make the determination whether the
                   9160:             built-in software is adequate to satisfy the
                   9161:             dependencies listed in <code class=
1.14      xtraeme  9162:             "varname">BUILDLINK_DEPENDS.<em class=
                   9163:             "replaceable"><code>pkg</code></em></code>. This is
                   9164:             typically done by comparing <code class=
                   9165:             "varname">BUILTIN_PKG.<em class=
                   9166:             "replaceable"><code>pkg</code></em></code> against each
                   9167:             of the dependencies in <code class=
                   9168:             "varname">BUILDLINK_DEPENDS.<em class=
                   9169:             "replaceable"><code>pkg</code></em></code>.
                   9170:             <code class="varname">USE_BUILTIN.<em class=
                   9171:             "replaceable"><code>pkg</code></em></code> <span class=
1.1       grant    9172:             "emphasis"><em>must</em></span> be set to the correct
1.45      wiz      9173:             value by the end of the <code xmlns=
                   9174:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9175:             "filename">builtin.mk</code> file. Note that
                   9176:             <code class="varname">USE_BUILTIN.<em class=
                   9177:             "replaceable"><code>pkg</code></em></code> may be
1.1       grant    9178:             &#8220;<span class="quote">yes</span>&#8221; even if
1.14      xtraeme  9179:             <code class="varname">IS_BUILTIN.<em class=
                   9180:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    9181:             &#8220;<span class="quote">no</span>&#8221; because we
                   9182:             may make the determination that the built-in version of
                   9183:             the software is similar enough to be used as a
                   9184:             replacement.</p>
                   9185: 
1.14      xtraeme  9186:             <p>The last section is guarded by <code class=
                   9187:             "varname">CHECK_BUILTIN.<em class=
                   9188:             "replaceable"><code>pkg</code></em></code>, and
                   9189:             includes code that uses the value of <code class=
                   9190:             "varname">USE_BUILTIN.<em class=
                   9191:             "replaceable"><code>pkg</code></em></code> set in the
                   9192:             previous section. This typically includes, e.g., adding
1.1       grant    9193:             additional dependency restrictions and listing
1.45      wiz      9194:             additional files to symlink into <code xmlns=
                   9195:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9196:             "filename">${BUILDLINK_DIR}</code> (via <code class=
                   9197:             "varname">BUILDLINK_FILES.<em class=
                   9198:             "replaceable"><code>pkg</code></em></code>).</p>
1.1       grant    9199:           </div>
                   9200: 
1.67      hubertf  9201:           <div class="sect2" lang="en">
1.1       grant    9202:             <div class="titlepage">
                   9203:               <div>
                   9204:                 <div>
1.30      wiz      9205:                   <h3 class="title"><a name=
1.38      dillo    9206:                   "native-or-pkgsrc-preference"></a>11.3.2.&nbsp;Global
1.30      wiz      9207:                   preferences for native or pkgsrc software</h3>
1.1       grant    9208:                 </div>
                   9209:               </div>
                   9210:             </div>
                   9211: 
                   9212:             <p>When building packages, it's possible to choose
                   9213:             whether to set a global preference for using either the
                   9214:             built-in (native) version or the pkgsrc version of
                   9215:             software to satisfy a dependency. This is controlled by
1.14      xtraeme  9216:             setting <code class="varname">PREFER_PKGSRC</code> and
                   9217:             <code class="varname">PREFER_NATIVE</code>. These
                   9218:             variables take values of either &#8220;<span class=
1.1       grant    9219:             "quote">yes</span>&#8221;, &#8220;<span class=
                   9220:             "quote">no</span>&#8221;, or a list of packages.
1.14      xtraeme  9221:             <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
                   9222:             to use the pkgsrc versions of software, while
                   9223:             <code class="varname">PREFER_NATIVE</code> tells pkgsrc
                   9224:             to use the built-in versions. Preferences are
                   9225:             determined by the most specific instance of the package
                   9226:             in either <code class="varname">PREFER_PKGSRC</code> or
                   9227:             <code class="varname">PREFER_NATIVE</code>. If a
                   9228:             package is specified in neither or in both variables,
                   9229:             then <code class="varname">PREFER_PKGSRC</code> has
                   9230:             precedence over <code class=
                   9231:             "varname">PREFER_NATIVE</code>. For example, to require
                   9232:             using pkgsrc versions of software for all but the most
                   9233:             basic bits on a NetBSD system, you can set:</p>
1.1       grant    9234:             <pre class="programlisting">
1.51      rillig   9235:     PREFER_PKGSRC=  yes
                   9236:     PREFER_NATIVE=  getopt skey tcp_wrappers
1.1       grant    9237: </pre>
                   9238: 
                   9239:             <p>A package <span class=
1.45      wiz      9240:             "emphasis"><em>must</em></span> have a <code xmlns=
                   9241:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9242:             "filename">builtin.mk</code> file to be listed in
                   9243:             <code class="varname">PREFER_NATIVE</code>, otherwise
                   9244:             it is simply ignored in that list.</p>
1.1       grant    9245:           </div>
                   9246:         </div>
                   9247:       </div>
                   9248: 
1.67      hubertf  9249:       <div class="chapter" lang="en">
1.1       grant    9250:         <div class="titlepage">
                   9251:           <div>
                   9252:             <div>
1.67      hubertf  9253:               <h2 class="title"><a name=
1.38      dillo    9254:               "pkginstall"></a>Chapter&nbsp;12.&nbsp;The pkginstall
1.35      jmmv     9255:               framework</h2>
1.1       grant    9256:             </div>
                   9257:           </div>
                   9258:         </div>
                   9259: 
                   9260:         <div class="toc">
                   9261:           <p><b>Table of Contents</b></p>
                   9262: 
                   9263:           <dl>
1.30      wiz      9264:             <dt><span class="sect1"><a href=
1.38      dillo    9265:             "#files-and-dirs-outside-prefix">12.1. Files and
1.35      jmmv     9266:             directories outside the installation
                   9267:             prefix</a></span></dt>
                   9268: 
                   9269:             <dd>
                   9270:               <dl>
                   9271:                 <dt><span class="sect2"><a href=
1.38      dillo    9272:                 "#dirs-outside-prefix">12.1.1. Directory
1.35      jmmv     9273:                 manipulation</a></span></dt>
                   9274: 
                   9275:                 <dt><span class="sect2"><a href=
1.38      dillo    9276:                 "#files-outside-prefix">12.1.2. File
1.35      jmmv     9277:                 manipulation</a></span></dt>
                   9278:               </dl>
                   9279:             </dd>
                   9280: 
1.38      dillo    9281:             <dt><span class="sect1"><a href="#conf-files">12.2.
1.35      jmmv     9282:             Configuration files</a></span></dt>
                   9283: 
                   9284:             <dd>
                   9285:               <dl>
                   9286:                 <dt><span class="sect2"><a href=
1.38      dillo    9287:                 "#conf-files-sysconfdir">12.2.1. How <code class=
1.35      jmmv     9288:                 "varname">PKG_SYSCONFDIR</code> is
                   9289:                 set</a></span></dt>
                   9290: 
                   9291:                 <dt><span class="sect2"><a href=
1.38      dillo    9292:                 "#conf-files-configure">12.2.2. Telling the
1.47      reed     9293:                 software where configuration files
1.35      jmmv     9294:                 are</a></span></dt>
                   9295: 
                   9296:                 <dt><span class="sect2"><a href=
1.38      dillo    9297:                 "#conf-files-patching">12.2.3. Patching
1.35      jmmv     9298:                 installations</a></span></dt>
                   9299: 
                   9300:                 <dt><span class="sect2"><a href=
1.38      dillo    9301:                 "#conf-files-disable">12.2.4. Disabling handling of
1.35      jmmv     9302:                 configuration files</a></span></dt>
                   9303:               </dl>
                   9304:             </dd>
                   9305: 
1.38      dillo    9306:             <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35      jmmv     9307:             System startup scripts</a></span></dt>
                   9308: 
                   9309:             <dd>
                   9310:               <dl>
                   9311:                 <dt><span class="sect2"><a href=
1.38      dillo    9312:                 "#rcd-scripts-disable">12.3.1. Disabling handling
1.35      jmmv     9313:                 of system startup scripts</a></span></dt>
                   9314:               </dl>
                   9315:             </dd>
1.1       grant    9316: 
1.30      wiz      9317:             <dt><span class="sect1"><a href=
1.38      dillo    9318:             "#users-and-groups">12.4. System users and
1.35      jmmv     9319:             groups</a></span></dt>
                   9320: 
1.38      dillo    9321:             <dt><span class="sect1"><a href="#shells">12.5. System
1.35      jmmv     9322:             shells</a></span></dt>
                   9323: 
                   9324:             <dd>
                   9325:               <dl>
                   9326:                 <dt><span class="sect2"><a href=
1.65      hubertf  9327:                 "#shells-disable">12.5.1. Disabling shell
                   9328:                 registration</a></span></dt>
                   9329:               </dl>
                   9330:             </dd>
                   9331: 
                   9332:             <dt><span class="sect1"><a href="#fonts">12.6.
                   9333:             Fonts</a></span></dt>
                   9334: 
                   9335:             <dd>
                   9336:               <dl>
                   9337:                 <dt><span class="sect2"><a href=
                   9338:                 "#fonts-disable">12.6.1. Disabling automatic update
                   9339:                 of the fonts databases</a></span></dt>
1.35      jmmv     9340:               </dl>
                   9341:             </dd>
1.1       grant    9342:           </dl>
                   9343:         </div>
                   9344: 
1.35      jmmv     9345:         <p>This chapter describes the framework known as
                   9346:         <code class="literal">pkginstall</code>, whose key features
                   9347:         are:</p>
                   9348: 
                   9349:         <div class="itemizedlist">
                   9350:           <ul type="disc">
                   9351:             <li>
                   9352:               <p>Generic installation and manipulation of
                   9353:               directories and files outside the pkgsrc-handled
                   9354:               tree, <code class="varname">LOCALBASE</code>.</p>
                   9355:             </li>
                   9356: 
                   9357:             <li>
                   9358:               <p>Automatic handling of configuration files during
                   9359:               installation, provided that packages are correctly
                   9360:               designed.</p>
                   9361:             </li>
                   9362: 
                   9363:             <li>
                   9364:               <p>Generation and installation of system startup
                   9365:               scripts.</p>
                   9366:             </li>
                   9367: 
                   9368:             <li>
                   9369:               <p>Registration of system users and groups.</p>
                   9370:             </li>
                   9371: 
                   9372:             <li>
                   9373:               <p>Registration of system shells.</p>
                   9374:             </li>
1.65      hubertf  9375: 
                   9376:             <li>
                   9377:               <p>Automatic updating of fonts databases.</p>
                   9378:             </li>
1.35      jmmv     9379:           </ul>
                   9380:         </div>
                   9381: 
                   9382:         <p>The following sections inspect each of the above points
1.65      hubertf  9383:         in detail.</p>
1.35      jmmv     9384: 
                   9385:         <p>You may be thinking that many of the things described
                   9386:         here could be easily done with simple code in the package's
                   9387:         post-installation target (<code class=
                   9388:         "literal">post-install</code>). <span class=
                   9389:         "emphasis"><em>This is incorrect</em></span>, as the code
                   9390:         in them is only executed when building from source.
                   9391:         Machines using binary packages could not benefit from it at
                   9392:         all (as the code itself could be unavailable). Therefore,
                   9393:         the only way to achieve any of the items described above is
                   9394:         by means of the installation scripts, which are
                   9395:         automatically generated by pkginstall.</p>
1.1       grant    9396: 
1.67      hubertf  9397:         <div class="sect1" lang="en">
1.1       grant    9398:           <div class="titlepage">
                   9399:             <div>
                   9400:               <div>
                   9401:                 <h2 class="title" style="clear: both"><a name=
1.63      dillo    9402:                 "files-and-dirs-outside-prefix"></a>12.1.&nbsp;Files
                   9403:                 and directories outside the installation
                   9404:                 prefix</h2>
1.1       grant    9405:               </div>
                   9406:             </div>
                   9407:           </div>
                   9408: 
1.45      wiz      9409:           <p>As you already know, the <code xmlns=
                   9410:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9411:           "filename">PLIST</code> file holds a list of files and
                   9412:           directories that belong to a package. The names used in
1.45      wiz      9413:           it are relative to the installation prefix (<code xmlns=
                   9414:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9415:           "filename">${PREFIX}</code>), which means that it cannot
                   9416:           register files outside this directory (absolute path
                   9417:           names are not allowed). Despite this restriction, some
                   9418:           packages need to install files outside this location;
1.45      wiz      9419:           e.g., under <code xmlns=
                   9420:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   9421:           "filename">${VARBASE}</code> or <code xmlns=
                   9422:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   9423:           "filename">${PKG_SYSCONFDIR}</code>.</p>
1.35      jmmv     9424: 
                   9425:           <p>The only way to achieve this is to create such files
                   9426:           during installation time by using the installation
                   9427:           scripts. These scripts can run arbitrary commands, so
                   9428:           they have the potential to create and manage files
1.47      reed     9429:           anywhere in the file system. Here is where pkginstall
1.35      jmmv     9430:           comes into play: it provides generic scripts to abstract
                   9431:           the manipulation of such files and directories based on
1.45      wiz      9432:           variables set in the package's <code xmlns=
                   9433:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9434:           "filename">Makefile</code>. The rest of this section
1.47      reed     9435:           describes these variables.</p>
1.1       grant    9436: 
1.67      hubertf  9437:           <div class="sect2" lang="en">
1.35      jmmv     9438:             <div class="titlepage">
1.1       grant    9439:               <div>
1.35      jmmv     9440:                 <div>
1.67      hubertf  9441:                   <h3 class="title"><a name=
1.63      dillo    9442:                   "dirs-outside-prefix"></a>12.1.1.&nbsp;Directory
1.35      jmmv     9443:                   manipulation</h3>
                   9444:                 </div>
1.1       grant    9445:               </div>
                   9446:             </div>
                   9447: 
1.35      jmmv     9448:             <p>The following variables can be set to request the
1.47      reed     9449:             creation of directories anywhere in the file
                   9450:             system:</p>
1.27      rillig   9451: 
1.35      jmmv     9452:             <div class="itemizedlist">
                   9453:               <ul type="disc">
                   9454:                 <li>
                   9455:                   <p><code class="varname">MAKE_DIRS</code> and
                   9456:                   <code class="varname">OWN_DIRS</code> contain a
                   9457:                   list of directories that should be created and
                   9458:                   should attempt to be destroyed by the
                   9459:                   installation scripts. The difference between the
                   9460:                   two is that the latter prompts the administrator
                   9461:                   to remove any directories that may be left after
                   9462:                   deinstallation (because they were not empty),
                   9463:                   while the former does not.</p>
                   9464:                 </li>
1.1       grant    9465: 
1.35      jmmv     9466:                 <li>
                   9467:                   <p><code class="varname">MAKE_DIRS_PERMS</code>
                   9468:                   and <code class="varname">OWN_DIRS_PERMS</code>
                   9469:                   contain a list of tuples describing which
                   9470:                   directories should be created and should attempt
                   9471:                   to be destroyed by the installation scripts. Each
                   9472:                   tuple holds the following values, separated by
                   9473:                   spaces: the directory name, its owner, its group
                   9474:                   and its numerical mode. For example:</p>
                   9475:                   <pre class="programlisting">
1.51      rillig   9476:     MAKE_DIRS_PERMS+=         ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
1.35      jmmv     9477: </pre>
1.1       grant    9478: 
1.35      jmmv     9479:                   <p>The difference between the two is exactly the
                   9480:                   same as their non-<code class=
                   9481:                   "varname">PERMS</code> counterparts.</p>
                   9482:                 </li>
                   9483:               </ul>
                   9484:             </div>
                   9485:           </div>
                   9486: 
1.67      hubertf  9487:           <div class="sect2" lang="en">
1.35      jmmv     9488:             <div class="titlepage">
                   9489:               <div>
                   9490:                 <div>
1.67      hubertf  9491:                   <h3 class="title"><a name=
                   9492:                   "files-outside-prefix"></a>12.1.2.&nbsp;File
1.35      jmmv     9493:                   manipulation</h3>
                   9494:                 </div>
                   9495:               </div>
                   9496:             </div>
                   9497: 
                   9498:             <p>Creating non-empty files outside the installation
1.45      wiz      9499:             prefix is tricky because the <code xmlns=
                   9500:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9501:             "filename">PLIST</code> forces all files to be inside
                   9502:             it. To overcome this problem, the only solution is to
                   9503:             extract the file in the known place (i.e., inside the
                   9504:             installation prefix) and copy it to the appropriate
                   9505:             location during installation (done by the installation
                   9506:             scripts generated by pkginstall). We will call the
                   9507:             former the <span class="emphasis"><em>master
                   9508:             file</em></span> in the following paragraphs, which
                   9509:             describe the variables that can be used to
                   9510:             automatically and consistently handle files outside the
                   9511:             installation prefix:</p>
                   9512: 
                   9513:             <div class="itemizedlist">
                   9514:               <ul type="disc">
                   9515:                 <li>
                   9516:                   <p><code class="varname">CONF_FILES</code> and
                   9517:                   <code class="varname">SUPPORT_FILES</code> are
                   9518:                   pairs of master and target files. During
                   9519:                   installation time, the master file is copied to
                   9520:                   the target one if and only if the latter does not
                   9521:                   exist. Upon deinstallation, the target file is
                   9522:                   removed provided that it was not modified by the
                   9523:                   installation.</p>
                   9524: 
                   9525:                   <p>The difference between the two is that the
                   9526:                   latter prompts the administrator to remove any
                   9527:                   files that may be left after deinstallation
                   9528:                   (because they were not empty), while the former
                   9529:                   does not.</p>
                   9530:                 </li>
                   9531: 
                   9532:                 <li>
                   9533:                   <p><code class="varname">CONF_FILES_PERMS</code>
                   9534:                   and <code class=
                   9535:                   "varname">SUPPORT_FILES_PERMS</code> contain
                   9536:                   tuples describing master files as well as their
                   9537:                   target locations. For each of them, it also
                   9538:                   specifies their owner, their group and their
                   9539:                   numeric permissions, in this order. For
                   9540:                   example:</p>
                   9541:                   <pre class="programlisting">
1.51      rillig   9542:     SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
1.35      jmmv     9543: </pre>
                   9544: 
                   9545:                   <p>The difference between the two is exactly the
                   9546:                   same as their non-<code class=
                   9547:                   "varname">PERMS</code> counterparts.</p>
                   9548:                 </li>
                   9549:               </ul>
                   9550:             </div>
                   9551:           </div>
                   9552:         </div>
                   9553: 
1.67      hubertf  9554:         <div class="sect1" lang="en">
1.35      jmmv     9555:           <div class="titlepage">
                   9556:             <div>
                   9557:               <div>
                   9558:                 <h2 class="title" style="clear: both"><a name=
1.63      dillo    9559:                 "conf-files"></a>12.2.&nbsp;Configuration
                   9560:                 files</h2>
1.35      jmmv     9561:               </div>
                   9562:             </div>
                   9563:           </div>
                   9564: 
                   9565:           <p>Configuration files are special in the sense that they
                   9566:           are installed in their own specific directory,
                   9567:           <code class="varname">PKG_SYSCONFDIR</code>, and need
                   9568:           special treatment during installation (most of which is
                   9569:           automated by pkginstall). The main concept you must bear
1.36      wiz      9570:           in mind is that files marked as configuration files are
1.35      jmmv     9571:           automatically copied to the right place (somewhere inside
                   9572:           <code class="varname">PKG_SYSCONFDIR</code>) during
                   9573:           installation <span class="emphasis"><em>if and only
                   9574:           if</em></span> they didn't exist before. Similarly, they
                   9575:           will not be removed if they have local modifications.
1.36      wiz      9576:           This ensures that administrators never lose any custom
1.35      jmmv     9577:           changes they may have made.</p>
                   9578: 
1.67      hubertf  9579:           <div class="sect2" lang="en">
1.35      jmmv     9580:             <div class="titlepage">
                   9581:               <div>
                   9582:                 <div>
1.67      hubertf  9583:                   <h3 class="title"><a name=
                   9584:                   "conf-files-sysconfdir"></a>12.2.1.&nbsp;How
1.35      jmmv     9585:                   <code class="varname">PKG_SYSCONFDIR</code> is
                   9586:                   set</h3>
                   9587:                 </div>
                   9588:               </div>
                   9589:             </div>
                   9590: 
                   9591:             <p>As said before, the <code class=
                   9592:             "varname">PKG_SYSCONFDIR</code> variable specifies
                   9593:             where configuration files shall be installed. Its
                   9594:             contents are set based upon the following
                   9595:             variables:</p>
                   9596: 
                   9597:             <div class="itemizedlist">
                   9598:               <ul type="disc">
                   9599:                 <li>
                   9600:                   <p><code class="varname">PKG_SYSCONFBASE</code>:
                   9601:                   The configuration's root directory. Defaults to
1.45      wiz      9602:                   <code xmlns=
                   9603:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9604:                   "filename">${PREFIX}/etc</code> although it may
                   9605:                   be overridden by the user to point to his
                   9606:                   preferred location (e.g., <code xmlns=
                   9607:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9608:                   "filename">/etc</code>, <code xmlns=
                   9609:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9610:                   "filename">/etc/pkg</code>, etc.). Packages must
                   9611:                   not use it directly.</p>
                   9612:                 </li>
                   9613: 
                   9614:                 <li>
                   9615:                   <p><code class=
                   9616:                   "varname">PKG_SYSCONFSUBDIR</code>: A
                   9617:                   subdirectory of <code class=
                   9618:                   "varname">PKG_SYSCONFBASE</code> under which the
                   9619:                   configuration files for the package being built
                   9620:                   shall be installed. The definition of this
                   9621:                   variable only makes sense in the package's
1.45      wiz      9622:                   <code xmlns=
                   9623:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     9624:                   "filename">Makefile</code> (i.e., it is not
                   9625:                   user-customizable).</p>
1.35      jmmv     9626: 
                   9627:                   <p>As an example, consider the Apache package,
                   9628:                   <a xmlns=
                   9629:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   9630:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
1.45      wiz      9631:                   target="_top"><code xmlns="" class=
                   9632:                   "filename">www/apache2</code></a>, which places
                   9633:                   its configuration files under the <code xmlns=
                   9634:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9635:                   "filename">httpd/</code> subdirectory of
                   9636:                   <code class="varname">PKG_SYSCONFBASE</code>.
                   9637:                   This should be set in the package Makefile.</p>
                   9638:                 </li>
                   9639: 
                   9640:                 <li>
                   9641:                   <p><code class="varname">PKG_SYSCONFVAR</code>:
                   9642:                   Specifies the name of the variable that holds
                   9643:                   this package's configuration directory (if
                   9644:                   different from <code class=
                   9645:                   "varname">PKG_SYSCONFBASE</code>). It defaults to
                   9646:                   <code class="varname">PKGBASE</code>'s value, and
                   9647:                   is always prefixed with <code class=
                   9648:                   "literal">PKG_SYSCONFDIR</code>.</p>
                   9649:                 </li>
                   9650: 
                   9651:                 <li>
                   9652:                   <p><code class=
                   9653:                   "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
                   9654:                   Holds the directory where the configuration files
                   9655:                   for the package identified by <code class=
                   9656:                   "varname">PKG_SYSCONFVAR</code>'s shall be
                   9657:                   placed.</p>
                   9658:                 </li>
                   9659:               </ul>
                   9660:             </div>
                   9661: 
                   9662:             <p>Based on the above variables, pkginstall determines
                   9663:             the value of <code class=
                   9664:             "varname">PKG_SYSCONFDIR</code>, which is the
                   9665:             <span class="emphasis"><em>only</em></span> variable
                   9666:             that can be used within a package to refer to its
                   9667:             configuration directory. The algorithm used to set its
                   9668:             value is basically the following:</p>
                   9669: 
                   9670:             <div class="orderedlist">
                   9671:               <ol type="1">
                   9672:                 <li>
                   9673:                   <p>If <code class=
                   9674:                   "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   9675:                   is set, its value is used.</p>
                   9676:                 </li>
                   9677: 
                   9678:                 <li>
                   9679:                   <p>If the previous variable is not defined but
                   9680:                   <code class="varname">PKG_SYSCONFSUBDIR</code> is
1.45      wiz      9681:                   set in the package's <code xmlns=
                   9682:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9683:                   "filename">Makefile</code>, the resulting value
1.45      wiz      9684:                   is <code xmlns=
                   9685:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9686:                   "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
                   9687:                 </li>
                   9688: 
                   9689:                 <li>
1.45      wiz      9690:                   <p>Otherwise, it is set to <code xmlns=
                   9691:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9692:                   "filename">${PKG_SYSCONFBASE}</code>.</p>
                   9693:                 </li>
                   9694:               </ol>
                   9695:             </div>
                   9696: 
1.45      wiz      9697:             <p>It is worth mentioning that <code xmlns=
                   9698:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9699:             "filename">${PKG_SYSCONFDIR}</code> is automatically
1.45      wiz      9700:             added to <code xmlns=
                   9701:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   9702:             "filename">OWN_DIRS</code>. See <a href=
                   9703:             "#dirs-outside-prefix" title=
1.63      dillo    9704:             "12.1.1.&nbsp;Directory manipulation">Section&nbsp;12.1.1,
1.35      jmmv     9705:             &#8220;Directory manipulation&#8221;</a> what this
                   9706:             means.</p>
                   9707:           </div>
                   9708: 
1.67      hubertf  9709:           <div class="sect2" lang="en">
1.35      jmmv     9710:             <div class="titlepage">
                   9711:               <div>
                   9712:                 <div>
1.67      hubertf  9713:                   <h3 class="title"><a name=
1.63      dillo    9714:                   "conf-files-configure"></a>12.2.2.&nbsp;Telling
                   9715:                   the software where configuration files are</h3>
1.35      jmmv     9716:                 </div>
                   9717:               </div>
                   9718:             </div>
                   9719: 
                   9720:             <p>Given that pkgsrc (and users!) expect configuration
                   9721:             files to be in a known place, you need to teach each
1.36      wiz      9722:             package where it shall install its files. In some cases
1.35      jmmv     9723:             you will have to patch the package Makefiles to achieve
                   9724:             it. If you are lucky, though, it may be as easy as
                   9725:             passing an extra flag to the configuration script; this
1.47      reed     9726:             is the case of GNU Autoconf- generated files:</p>
1.35      jmmv     9727:             <pre class="programlisting">
1.51      rillig   9728:     CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.35      jmmv     9729: </pre>
                   9730: 
                   9731:             <p>Note that this specifies where the package has to
                   9732:             <span class="emphasis"><em>look for</em></span> its
                   9733:             configuration files, not where they will be originally
                   9734:             installed (although the difference is never explicit,
                   9735:             unfortunately).</p>
                   9736:           </div>
                   9737: 
1.67      hubertf  9738:           <div class="sect2" lang="en">
1.35      jmmv     9739:             <div class="titlepage">
                   9740:               <div>
                   9741:                 <div>
1.67      hubertf  9742:                   <h3 class="title"><a name=
1.63      dillo    9743:                   "conf-files-patching"></a>12.2.3.&nbsp;Patching
1.35      jmmv     9744:                   installations</h3>
                   9745:                 </div>
                   9746:               </div>
                   9747:             </div>
                   9748: 
                   9749:             <p>As said before, pkginstall automatically handles
                   9750:             configuration files. This means that <span class=
                   9751:             "strong"><strong>the packages themselves must not touch
1.45      wiz      9752:             the contents of <code xmlns=
                   9753:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9754:             "filename">${PKG_SYSCONFDIR}</code>
1.36      wiz      9755:             directly</strong></span>. Bad news is that many
                   9756:             software installation scripts will, out of the box,
                   9757:             mess with the contents of that directory. So what is
                   9758:             the correct procedure to fix this issue?</p>
1.35      jmmv     9759: 
                   9760:             <p>You must teach the package (usually by manually
                   9761:             patching it) to install any configuration files under
1.45      wiz      9762:             the examples hierarchy, <code xmlns=
                   9763:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9764:             "filename">share/examples/${PKGBASE}/</code>. This way,
1.45      wiz      9765:             the <code xmlns=
                   9766:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   9767:             "filename">PLIST</code> registers them and the
                   9768:             administrator always has the original copies
1.35      jmmv     9769:             available.</p>
                   9770: 
                   9771:             <p>Once the required configuration files are in place
                   9772:             (i.e., under the examples hierarchy), the pkginstall
                   9773:             framework can use them as master copies during the
1.45      wiz      9774:             package installation to update what is in <code xmlns=
                   9775:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9776:             "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
                   9777:             the variables <code class="varname">CONF_FILES</code>
                   9778:             and <code class="varname">CONF_FILES_PERMS</code> are
                   9779:             used. Check out <a href="#files-outside-prefix" title=
1.63      dillo    9780:             "12.1.2.&nbsp;File manipulation">Section&nbsp;12.1.2,
1.35      jmmv     9781:             &#8220;File manipulation&#8221;</a> for information
                   9782:             about their syntax and their purpose. Here is an
                   9783:             example, taken from the <a xmlns=
                   9784:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9785:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
1.45      wiz      9786:             target="_top"><code xmlns="" class=
                   9787:             "filename">mail/mutt</code></a> package:</p>
1.35      jmmv     9788:             <pre class="programlisting">
1.51      rillig   9789:     EGDIR=        ${PREFIX}/share/doc/mutt/samples
                   9790:     CONF_FILES=   ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
1.35      jmmv     9791: </pre>
                   9792: 
                   9793:             <p>Note that the <code class="varname">EGDIR</code>
                   9794:             variable is specific to that package and has no meaning
                   9795:             outside it.</p>
                   9796:           </div>
                   9797: 
1.67      hubertf  9798:           <div class="sect2" lang="en">
1.35      jmmv     9799:             <div class="titlepage">
                   9800:               <div>
                   9801:                 <div>
1.67      hubertf  9802:                   <h3 class="title"><a name=
                   9803:                   "conf-files-disable"></a>12.2.4.&nbsp;Disabling
1.35      jmmv     9804:                   handling of configuration files</h3>
                   9805:                 </div>
                   9806:               </div>
                   9807:             </div>
                   9808: 
                   9809:             <p>The automatic copying of config files can be toggled
                   9810:             by setting the environment variable <code class=
                   9811:             "varname">PKG_CONFIG</code> prior to package
                   9812:             installation.</p>
                   9813:           </div>
                   9814:         </div>
                   9815: 
1.67      hubertf  9816:         <div class="sect1" lang="en">
1.35      jmmv     9817:           <div class="titlepage">
                   9818:             <div>
                   9819:               <div>
                   9820:                 <h2 class="title" style="clear: both"><a name=
1.63      dillo    9821:                 "rcd-scripts"></a>12.3.&nbsp;System startup
                   9822:                 scripts</h2>
1.35      jmmv     9823:               </div>
                   9824:             </div>
                   9825:           </div>
                   9826: 
                   9827:           <p>System startup scripts are special files because they
                   9828:           must be installed in a place known by the underlying OS,
                   9829:           usually outside the installation prefix. Therefore, the
                   9830:           same rules described in <a href=
                   9831:           "#files-and-dirs-outside-prefix" title=
1.38      dillo    9832:           "12.1.&nbsp;Files and directories outside the installation prefix">
1.63      dillo    9833:           Section&nbsp;12.1, &#8220;Files and directories outside
                   9834:           the installation prefix&#8221;</a> apply, and the same
1.35      jmmv     9835:           solutions can be used. However, pkginstall provides a
1.36      wiz      9836:           special mechanism to handle these files.</p>
1.35      jmmv     9837: 
                   9838:           <p>In order to provide system startup scripts, the
                   9839:           package has to:</p>
                   9840: 
                   9841:           <div class="orderedlist">
                   9842:             <ol type="1">
                   9843:               <li>
1.45      wiz      9844:                 <p>Store the script inside <code xmlns=
                   9845:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9846:                 "filename">${FILESDIR}</code>, with the
                   9847:                 <code class="literal">.sh</code> suffix appended.
                   9848:                 Considering the <a xmlns=
                   9849:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   9850:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
1.45      wiz      9851:                 target="_top"><code xmlns="" class=
                   9852:                 "filename">print/cups</code></a> package as an
                   9853:                 example, it has a <code xmlns=
                   9854:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9855:                 "filename">cupsd.sh</code> in its files
                   9856:                 directory.</p>
                   9857:               </li>
                   9858: 
                   9859:               <li>
                   9860:                 <p>Tell pkginstall to handle it, appending the name
                   9861:                 of the script, without its extension, to the
                   9862:                 <code class="varname">RCD_SCRIPTS</code> variable.
                   9863:                 Continuing the previous example:</p>
                   9864:                 <pre class="programlisting">
1.51      rillig   9865:     RCD_SCRIPTS+=   cupsd
1.35      jmmv     9866: </pre>
                   9867:               </li>
                   9868:             </ol>
                   9869:           </div>
                   9870: 
                   9871:           <p>Once this is done, pkginstall will do the following
                   9872:           steps for each script in an automated fashion:</p>
                   9873: 
                   9874:           <div class="orderedlist">
                   9875:             <ol type="1">
                   9876:               <li>
                   9877:                 <p>Process the file found in the files directory
                   9878:                 applying all the substitutions described in the
1.45      wiz      9879:                 <code xmlns=
                   9880:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   9881:                 "filename">FILES_SUBST</code> variable.</p>
1.35      jmmv     9882:               </li>
                   9883: 
                   9884:               <li>
                   9885:                 <p>Copy the script from the files directory to the
1.45      wiz      9886:                 examples hierarchy, <code xmlns=
                   9887:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9888:                 "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36      wiz      9889:                 Note that this master file must be explicitly
1.45      wiz      9890:                 registered in the <code xmlns=
                   9891:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9892:                 "filename">PLIST</code>.</p>
                   9893:               </li>
                   9894: 
                   9895:               <li>
                   9896:                 <p>Add code to the installation scripts to copy the
                   9897:                 startup script from the examples hierarchy into the
                   9898:                 system-wide startup scripts directory.</p>
                   9899:               </li>
                   9900:             </ol>
                   9901:           </div>
                   9902: 
1.67      hubertf  9903:           <div class="sect2" lang="en">
1.35      jmmv     9904:             <div class="titlepage">
                   9905:               <div>
                   9906:                 <div>
1.67      hubertf  9907:                   <h3 class="title"><a name=
1.63      dillo    9908:                   "rcd-scripts-disable"></a>12.3.1.&nbsp;Disabling
1.35      jmmv     9909:                   handling of system startup scripts</h3>
                   9910:                 </div>
                   9911:               </div>
                   9912:             </div>
                   9913: 
                   9914:             <p>The automatic copying of config files can be toggled
                   9915:             by setting the environment variable <code class=
                   9916:             "varname">PKG_RCD_SCRIPTS</code> prior to package
                   9917:             installation. Note that the scripts will be always
1.45      wiz      9918:             copied inside the examples hierarchy, <code xmlns=
                   9919:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9920:             "filename">${PREFIX}/share/examples/rc.d/</code>, no
                   9921:             matter what the value of this variable is.</p>
                   9922:           </div>
                   9923:         </div>
                   9924: 
1.67      hubertf  9925:         <div class="sect1" lang="en">
1.35      jmmv     9926:           <div class="titlepage">
                   9927:             <div>
                   9928:               <div>
                   9929:                 <h2 class="title" style="clear: both"><a name=
1.63      dillo    9930:                 "users-and-groups"></a>12.4.&nbsp;System users and
                   9931:                 groups</h2>
1.35      jmmv     9932:               </div>
                   9933:             </div>
                   9934:           </div>
                   9935: 
                   9936:           <p>If a package needs to create special users and/or
                   9937:           groups during installation, it can do so by using the
                   9938:           pkginstall framework.</p>
                   9939: 
                   9940:           <p>Users can be created by adding entries to the
                   9941:           <code class="varname">PKG_USERS</code> variable. Each
1.45      wiz      9942:           entry has the following syntax, which mimics <code xmlns=
                   9943:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9944:           "filename">/etc/passwd</code>:</p>
                   9945:           <pre class="programlisting">
1.51      rillig   9946:     user:group[:[userid][:[descr][:[home][:shell]]]]
1.35      jmmv     9947: </pre>
                   9948: 
                   9949:           <p>Only the user and group are required; everything else
                   9950:           is optional, but the colons must be in the right places
                   9951:           when specifying optional bits. By default, a new user
1.45      wiz      9952:           will have home directory <code xmlns=
                   9953:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9954:           "filename">/nonexistent</code>, and login shell
1.45      wiz      9955:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9956:           class="filename">/sbin/nologin</code> unless they are
                   9957:           specified as part of the user element. Note that if the
1.51      rillig   9958:           description contains spaces, then spaces should be
1.45      wiz      9959:           backslash-escaped, as in:</p>
1.35      jmmv     9960:           <pre class="programlisting">
1.51      rillig   9961:     foo:foogrp::The\ Foomister
1.35      jmmv     9962: </pre>
                   9963: 
                   9964:           <p>Similarly, groups can be created using the
                   9965:           <code class="varname">PKG_GROUPS</code> variable, whose
                   9966:           syntax is:</p>
                   9967:           <pre class="programlisting">
1.51      rillig   9968:     group[:groupid]
1.35      jmmv     9969: </pre>
                   9970: 
                   9971:           <p>As before, only the group name is required; the
                   9972:           numeric identifier is optional.</p>
                   9973:         </div>
                   9974: 
1.67      hubertf  9975:         <div class="sect1" lang="en">
1.35      jmmv     9976:           <div class="titlepage">
                   9977:             <div>
                   9978:               <div>
                   9979:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  9980:                 "shells"></a>12.5.&nbsp;System shells</h2>
1.35      jmmv     9981:               </div>
                   9982:             </div>
                   9983:           </div>
                   9984: 
                   9985:           <p>Packages that install system shells should register
1.45      wiz      9986:           them in the shell database, <code xmlns=
                   9987:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9988:           "filename">/etc/shells</code>, to make things easier to
                   9989:           the administrator. This must be done from the
                   9990:           installation scripts to keep binary packages working on
                   9991:           any system. pkginstall provides an easy way to accomplish
                   9992:           this task.</p>
                   9993: 
                   9994:           <p>When a package provides a shell interpreter, it has to
                   9995:           set the <code class="varname">PKG_SHELL</code> variable
                   9996:           to its absolute file name. This will add some hooks to
                   9997:           the installation scripts to handle it. Consider the
                   9998:           following example, taken from <a xmlns=
                   9999:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   10000:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
1.45      wiz      10001:           target="_top"><code xmlns="" class=
                   10002:           "filename">shells/zsh</code></a>:</p>
1.35      jmmv     10003:           <pre class="programlisting">
1.51      rillig   10004:     PKG_SHELL=      ${PREFIX}/bin/zsh
1.35      jmmv     10005: </pre>
                   10006: 
1.67      hubertf  10007:           <div class="sect2" lang="en">
1.35      jmmv     10008:             <div class="titlepage">
                   10009:               <div>
                   10010:                 <div>
1.67      hubertf  10011:                   <h3 class="title"><a name=
                   10012:                   "shells-disable"></a>12.5.1.&nbsp;Disabling shell
1.65      hubertf  10013:                   registration</h3>
1.35      jmmv     10014:                 </div>
                   10015:               </div>
                   10016:             </div>
                   10017: 
                   10018:             <p>The automatic registration of shell interpreters can
                   10019:             be disabled by the administrator by setting the
1.45      wiz      10020:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10021:             class="filename">PKG_REGISTER_SHELLS</code> environment
                   10022:             variable to <code class="literal">NO</code>.</p>
1.35      jmmv     10023:           </div>
                   10024:         </div>
1.65      hubertf  10025: 
1.67      hubertf  10026:         <div class="sect1" lang="en">
1.65      hubertf  10027:           <div class="titlepage">
                   10028:             <div>
                   10029:               <div>
                   10030:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  10031:                 "fonts"></a>12.6.&nbsp;Fonts</h2>
1.65      hubertf  10032:               </div>
                   10033:             </div>
                   10034:           </div>
                   10035: 
                   10036:           <p>Packages that install X11 fonts should update the
                   10037:           database files that index the fonts within each fonts
                   10038:           directory. This can easily be accomplished within the
                   10039:           pkginstall framework.</p>
                   10040: 
                   10041:           <p>When a package installs X11 fonts, it must list the
                   10042:           directories in which fonts are installed in the
                   10043:           <code class="varname">FONTS_DIRS.<em class=
                   10044:           "replaceable"><code>type</code></em></code> variables,
                   10045:           where <em class="replaceable"><code>type</code></em> can
                   10046:           be one of &#8220;<span class="quote">ttf</span>&#8221;,
                   10047:           &#8220;<span class="quote">type1</span>&#8221; or
                   10048:           &#8220;<span class="quote">x11</span>&#8221;. This will
                   10049:           add hooks to the installation scripts to run the
                   10050:           appropriate commands to update the fonts database files
                   10051:           within each of those directories. For convenience, if the
                   10052:           directory path is relative, it is taken to be relative to
                   10053:           the package's installation prefix. Consider the following
                   10054:           example, taken from <a xmlns=
                   10055:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   10056:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/dbz-ttf/README.html"
                   10057:           target="_top"><code xmlns="" class=
                   10058:           "filename">fonts/dbz-ttf</code></a>:</p>
                   10059:           <pre class="programlisting">
                   10060:     FONTS_DIRS.ttf= ${PREFIX}/lib/X11/fonts/TTF
                   10061: </pre>
                   10062: 
1.67      hubertf  10063:           <div class="sect2" lang="en">
1.65      hubertf  10064:             <div class="titlepage">
                   10065:               <div>
                   10066:                 <div>
1.67      hubertf  10067:                   <h3 class="title"><a name=
                   10068:                   "fonts-disable"></a>12.6.1.&nbsp;Disabling
                   10069:                   automatic update of the fonts databases</h3>
1.65      hubertf  10070:                 </div>
                   10071:               </div>
                   10072:             </div>
                   10073: 
                   10074:             <p>The automatic update of fonts databases can be
                   10075:             disabled by the administrator by setting the
                   10076:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10077:             class="filename">PKG_UPDATE_FONTS_DB</code> environment
                   10078:             variable to <code class="literal">NO</code>.</p>
                   10079:           </div>
                   10080:         </div>
1.35      jmmv     10081:       </div>
                   10082: 
1.67      hubertf  10083:       <div class="chapter" lang="en">
1.35      jmmv     10084:         <div class="titlepage">
                   10085:           <div>
                   10086:             <div>
1.67      hubertf  10087:               <h2 class="title"><a name=
1.38      dillo    10088:               "options"></a>Chapter&nbsp;13.&nbsp;Options
1.35      jmmv     10089:               handling</h2>
                   10090:             </div>
                   10091:           </div>
                   10092:         </div>
                   10093: 
                   10094:         <div class="toc">
                   10095:           <p><b>Table of Contents</b></p>
                   10096: 
                   10097:           <dl>
                   10098:             <dt><span class="sect1"><a href=
1.38      dillo    10099:             "#global-default-options">13.1. Global default
1.35      jmmv     10100:             options</a></span></dt>
                   10101: 
                   10102:             <dt><span class="sect1"><a href=
1.38      dillo    10103:             "#converting-to-options">13.2. Converting packages to
1.45      wiz      10104:             use <code xmlns=
                   10105:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     10106:             "filename">bsd.options.mk</code></a></span></dt>
1.48      dillo    10107: 
                   10108:             <dt><span class="sect1"><a href="#option-names">13.3.
                   10109:             Option Names</a></span></dt>
1.35      jmmv     10110:           </dl>
                   10111:         </div>
                   10112: 
                   10113:         <p>Many packages have the ability to be built to support
1.45      wiz      10114:         different sets of features. <code xmlns=
                   10115:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     10116:         "filename">bsd.options.mk</code> is a framework in pkgsrc
                   10117:         that provides generic handling of those options that
                   10118:         determine different ways in which the packages can be
                   10119:         built. It's possible for the user to specify exactly which
                   10120:         sets of options will be built into a package or to allow a
                   10121:         set of global default options apply.</p>
                   10122: 
1.67      hubertf  10123:         <div class="sect1" lang="en">
1.35      jmmv     10124:           <div class="titlepage">
                   10125:             <div>
                   10126:               <div>
                   10127:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    10128:                 "global-default-options"></a>13.1.&nbsp;Global
1.35      jmmv     10129:                 default options</h2>
                   10130:               </div>
                   10131:             </div>
                   10132:           </div>
                   10133: 
                   10134:           <p>Global default options are listed in <code class=
                   10135:           "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
                   10136:           the options that should be built into every package if
                   10137:           that option is supported. This variable should be set in
1.45      wiz      10138:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10139:           class="filename">/etc/mk.conf</code>.</p>
1.35      jmmv     10140:         </div>
                   10141: 
1.67      hubertf  10142:         <div class="sect1" lang="en">
1.35      jmmv     10143:           <div class="titlepage">
                   10144:             <div>
                   10145:               <div>
                   10146:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    10147:                 "converting-to-options"></a>13.2.&nbsp;Converting
1.45      wiz      10148:                 packages to use <code xmlns=
                   10149:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     10150:                 "filename">bsd.options.mk</code></h2>
                   10151:               </div>
                   10152:             </div>
                   10153:           </div>
                   10154: 
1.45      wiz      10155:           <p>The following example shows how <code xmlns=
                   10156:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     10157:           "filename">bsd.options.mk</code> should be used by the
                   10158:           hypothetical ``wibble'' package, either in the package
1.45      wiz      10159:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10160:           class="filename">Makefile</code>, or in a file, e.g.
                   10161:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10162:           class="filename">options.mk</code>, that is included by
                   10163:           the main package <code xmlns=
                   10164:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     10165:           "filename">Makefile</code>.</p>
                   10166:           <pre class="programlisting">
1.51      rillig   10167:     PKG_OPTIONS_VAR=            PKG_OPTIONS.wibble
                   10168:     PKG_SUPPORTED_OPTIONS=              wibble-foo ldap
                   10169:     PKG_OPTIONS_OPTIONAL_GROUPS=        database
                   10170:     PKG_OPTIONS_GROUP.database= mysql pgsql
                   10171:     PKG_SUGGESTED_OPTIONS=              wibble-foo
                   10172:     PKG_OPTIONS_LEGACY_VARS+=   WIBBLE_USE_OPENLDAP:ldap
                   10173:     PKG_OPTIONS_LEGACY_OPTS+=   foo:wibble-foo
                   10174: 
                   10175:     .include "../../mk/bsd.prefs.mk"
                   10176: 
                   10177:     # this package was previously named wibble2
                   10178:     .if defined(PKG_OPTIONS.wibble2)
                   10179:     PKG_LEGACY_OPTIONS+=  ${PKG_OPTIONS.wibble2}
                   10180:     PKG_OPTIONS_DEPRECATED_WARNINGS+= \
                   10181:             "Deprecated variable PKG_OPTIONS.wibble2 used, use "${PKG_OPTIONS_VAR:Q}" instead."
                   10182:     .endif
                   10183: 
                   10184:     .include "../../mk/bsd.options.mk"
                   10185: 
                   10186:     # Package-specific option-handling
                   10187: 
                   10188:     ###
                   10189:     ### FOO support
                   10190:     ###
                   10191:     .if !empty(PKG_OPTIONS:Mwibble-foo)
                   10192:     CONFIGURE_ARGS+=    --enable-foo
                   10193:     .endif
                   10194: 
                   10195:     ###
                   10196:     ### LDAP support
                   10197:     ###
                   10198:     .if !empty(PKG_OPTIONS:Mldap)
                   10199:     .  include "../../databases/openldap/buildlink3.mk"
                   10200:     CONFIGURE_ARGS+=    --enable-ldap=${BUILDLINK_PREFIX.openldap}
                   10201:     .endif
                   10202: 
                   10203:     ###
                   10204:     ### database support
                   10205:     ###
                   10206:     .if !empty(PKG_OPTIONS:Mmysql)
                   10207:     .  include "../../mk/mysql.buildlink3.mk"
                   10208:     .endif
                   10209:     .if !empty(PKG_OPTIONS:Mpgsql)
                   10210:     .  include "../../mk/pgsql.buildlink3.mk"
                   10211:     .endif
1.1       grant    10212: </pre>
                   10213: 
1.28      rillig   10214:           <p>The first section contains the information about which
                   10215:           build options are supported by the package, and any
1.1       grant    10216:           default options settings if needed.</p>
                   10217: 
                   10218:           <div class="orderedlist">
                   10219:             <ol type="1">
                   10220:               <li>
1.14      xtraeme  10221:                 <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27      rillig   10222:                 the name of the <a href=
1.1       grant    10223:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   10224:                 <span class="citerefentry"><span class=
1.27      rillig   10225:                 "refentrytitle">make</span>(1)</span></a> variable
1.37      dillo    10226:                 that the user can set to override the default
1.57      minskim  10227:                 options. It should be set to PKG_OPTIONS.<em class=
1.63      dillo    10228:                 "replaceable"><code>pkgbase</code></em>. Do not set
                   10229:                 it to PKG_OPTIONS.${PKGBASE}, since <code class=
                   10230:                 "varname">PKGBASE</code> is set after <code class=
                   10231:                 "varname">PKG_OPTIONS_VAR</code> is used.</p>
1.1       grant    10232:               </li>
                   10233: 
                   10234:               <li>
1.14      xtraeme  10235:                 <p><code class=
                   10236:                 "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37      dillo    10237:                 build options supported by the package.</p>
                   10238:               </li>
                   10239: 
                   10240:               <li>
                   10241:                 <p><code class=
                   10242:                 "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
                   10243:                 list of names of groups of mutually exclusive
                   10244:                 options. The options in each group are listed in
                   10245:                 <code class="varname">PKG_OPTIONS_GROUP.<em class=
                   10246:                 "replaceable"><code>groupname</code></em></code>.
                   10247:                 The most specific setting of any option from the
                   10248:                 group takes precedence over all other options in
                   10249:                 the group. Options from the groups will be
                   10250:                 automatically added to <code class=
                   10251:                 "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
                   10252:               </li>
                   10253: 
                   10254:               <li>
                   10255:                 <p><code class=
                   10256:                 "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
                   10257:                 like <code class=
                   10258:                 "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
                   10259:                 building the packages will fail if no option from
                   10260:                 the group is selected.</p>
1.1       grant    10261:               </li>
                   10262: 
                   10263:               <li>
1.27      rillig   10264:                 <p><code class=
1.44      gdt      10265:                 "varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a
                   10266:                 list of names of sets of options. At least one
                   10267:                 option from each set must be selected. The options
                   10268:                 in each set are listed in <code class=
                   10269:                 "varname">PKG_OPTIONS_SET.<em class=
                   10270:                 "replaceable"><code>setname</code></em></code>.
                   10271:                 Options from the sets will be automatically added
                   10272:                 to <code class=
                   10273:                 "varname">PKG_SUPPORTED_OPTIONS</code>. Building
                   10274:                 the package will fail if no option from the set is
                   10275:                 selected.</p>
                   10276:               </li>
                   10277: 
                   10278:               <li>
                   10279:                 <p><code class=
1.27      rillig   10280:                 "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
                   10281:                 build options which are enabled by default.</p>
                   10282:               </li>
                   10283: 
                   10284:               <li>
1.37      dillo    10285:                 <p><code class=
                   10286:                 "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
                   10287:                 of &#8220;<span class="quote"><em class=
1.67      hubertf  10288:                 "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable"><code>option</code></em></span>&#8221;
                   10289:                 pairs that map legacy <code xmlns=
1.45      wiz      10290:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.37      dillo    10291:                 "filename">/etc/mk.conf</code> variables to their
                   10292:                 option counterparts. Pairs should be added with
                   10293:                 &#8220;<span class="quote">+=</span>&#8221; to keep
                   10294:                 the listing of global legacy variables. A warning
                   10295:                 will be issued if the user uses a legacy
                   10296:                 variable.</p>
                   10297:               </li>
1.1       grant    10298: 
1.37      dillo    10299:               <li>
                   10300:                 <p><code class=
                   10301:                 "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
                   10302:                 of &#8220;<span class="quote"><em class=
1.67      hubertf  10303:                 "replaceable"><code>old-option</code></em>:<em class="replaceable"><code>new-option</code></em></span>&#8221;
                   10304:                 pairs that map options that have been renamed to
                   10305:                 their new counterparts. Pairs should be added with
1.37      dillo    10306:                 &#8220;<span class="quote">+=</span>&#8221; to keep
                   10307:                 the listing of global legacy options. A warning
                   10308:                 will be issued if the user uses a legacy
                   10309:                 option.</p>
                   10310:               </li>
1.1       grant    10311: 
1.37      dillo    10312:               <li>
                   10313:                 <p><code class="varname">PKG_LEGACY_OPTIONS</code>
                   10314:                 is a list of options implied by deprecated
                   10315:                 variables used. This can be used for cases that
                   10316:                 neither <code class=
                   10317:                 "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
                   10318:                 <code class=
                   10319:                 "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
                   10320:                 handle, e. g. when <code class=
                   10321:                 "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1       grant    10322:               </li>
                   10323: 
                   10324:               <li>
1.37      dillo    10325:                 <p><code class=
                   10326:                 "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
                   10327:                 a list of warnings about deprecated variables or
                   10328:                 options used, and what to use instead.</p>
1.1       grant    10329:               </li>
1.28      rillig   10330:             </ol>
1.1       grant    10331:           </div>
                   10332: 
1.37      dillo    10333:           <p>A package should never modify <code class=
                   10334:           "varname">PKG_DEFAULT_OPTIONS</code> or the variable
                   10335:           named in <code class="varname">PKG_OPTIONS_VAR</code>.
                   10336:           These are strictly user-settable. To suggest a default
                   10337:           set of options, use <code class=
                   10338:           "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
                   10339: 
1.42      dillo    10340:           <p><code class="varname">PKG_OPTIONS_VAR</code> must be
1.45      wiz      10341:           defined before including <code xmlns=
                   10342:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.42      dillo    10343:           "filename">bsd.options.mk</code>. If none of <code class=
1.37      dillo    10344:           "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
                   10345:           "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
                   10346:           <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
1.47      reed     10347:           are defined (as can happen with platform-specific options
1.42      dillo    10348:           if none of them is supported on the current platform),
                   10349:           <code class="varname">PKG_OPTIONS</code> is set to the
                   10350:           empty list and the package is otherwise treated as not
                   10351:           using the options framework.</p>
1.37      dillo    10352: 
1.45      wiz      10353:           <p>After the inclusion of <code xmlns=
                   10354:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.37      dillo    10355:           "filename">bsd.options.mk</code>, the variable
1.28      rillig   10356:           <code class="varname">PKG_OPTIONS</code> contains the
1.37      dillo    10357:           list of selected build options, properly filtered to
1.28      rillig   10358:           remove unsupported and duplicate options.</p>
                   10359: 
1.1       grant    10360:           <p>The remaining sections contain the logic that is
1.37      dillo    10361:           specific to each option. The correct way to check for an
                   10362:           option is to check whether it is listed in <code class=
                   10363:           "varname">PKG_OPTIONS</code>:</p>
                   10364:           <pre class="programlisting">
1.51      rillig   10365:     .if !empty(PKG_OPTIONS:M<em class=
1.37      dillo    10366: "replaceable"><code>option</code></em>)
                   10367: </pre>
1.48      dillo    10368:         </div>
1.37      dillo    10369: 
1.67      hubertf  10370:         <div class="sect1" lang="en">
1.48      dillo    10371:           <div class="titlepage">
                   10372:             <div>
                   10373:               <div>
                   10374:                 <h2 class="title" style="clear: both"><a name=
                   10375:                 "option-names"></a>13.3.&nbsp;Option Names</h2>
                   10376:               </div>
                   10377:             </div>
                   10378:           </div>
                   10379: 
                   10380:           <p>Options that enable similar features in different
                   10381:           packages (like optional support for a library) should use
                   10382:           a common name in all packages that support it (like the
                   10383:           name of the library). If another package already has an
                   10384:           option with the same meaning, use the same name.</p>
                   10385: 
                   10386:           <p>Options that enable features specific to one package,
                   10387:           where it's unlikely that another (unrelated) package has
                   10388:           the same (or a similar) optional feature, should use a
                   10389:           name prefixed with <code class="varname"><em class=
                   10390:           "replaceable"><code>pkgname</code></em>-</code>.</p>
                   10391: 
                   10392:           <p>If a group of related packages share an optional
                   10393:           feature specific to that group, prefix it with the name
                   10394:           of the &#8220;<span class="quote">main</span>&#8221;
                   10395:           package (e. g. <code class=
                   10396:           "varname">djbware-errno-hack</code>).</p>
                   10397: 
                   10398:           <p>For new options, add a line to <code xmlns=
                   10399:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10400:           "filename">mk/defaults/options.description</code>. Lines
                   10401:           have two fields, separated by tab. The first field is the
                   10402:           option name, the second its description. The description
                   10403:           should be a whole sentence (starting with an uppercase
                   10404:           letter and ending with a period) that describes what
                   10405:           enabling the option does. E. g. &#8220;<span class=
                   10406:           "quote">Enable ispell support.</span>&#8221; The file is
                   10407:           sorted by option names.</p>
1.1       grant    10408:         </div>
                   10409:       </div>
                   10410: 
1.67      hubertf  10411:       <div class="chapter" lang="en">
1.1       grant    10412:         <div class="titlepage">
                   10413:           <div>
                   10414:             <div>
1.67      hubertf  10415:               <h2 class="title"><a name=
1.38      dillo    10416:               "build"></a>Chapter&nbsp;14.&nbsp;The build
1.1       grant    10417:               process</h2>
                   10418:             </div>
                   10419:           </div>
                   10420:         </div>
                   10421: 
                   10422:         <div class="toc">
                   10423:           <p><b>Table of Contents</b></p>
                   10424: 
                   10425:           <dl>
1.56      rillig   10426:             <dt><span class="sect1"><a href="#build.intro">14.1.
                   10427:             Introduction</a></span></dt>
                   10428: 
                   10429:             <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1       grant    10430:             Program location</a></span></dt>
                   10431: 
1.56      rillig   10432:             <dt><span class="sect1"><a href=
                   10433:             "#build.builddirs">14.3. Directories used during the
                   10434:             build process</a></span></dt>
                   10435: 
                   10436:             <dt><span class="sect1"><a href="#build.running">14.4.
                   10437:             Running a phase</a></span></dt>
                   10438: 
                   10439:             <dt><span class="sect1"><a href="#build.fetch">14.5.
                   10440:             The <span class="emphasis"><em>fetch</em></span>
                   10441:             phase</a></span></dt>
                   10442: 
                   10443:             <dt><span class="sect1"><a href="#build.checksum">14.6.
                   10444:             The <span class="emphasis"><em>checksum</em></span>
                   10445:             phase</a></span></dt>
                   10446: 
                   10447:             <dt><span class="sect1"><a href="#build.extract">14.7.
                   10448:             The <span class="emphasis"><em>extract</em></span>
                   10449:             phase</a></span></dt>
                   10450: 
                   10451:             <dt><span class="sect1"><a href="#build.patch">14.8.
                   10452:             The <span class="emphasis"><em>patch</em></span>
                   10453:             phase</a></span></dt>
                   10454: 
                   10455:             <dt><span class="sect1"><a href="#build.tools">14.9.
                   10456:             The <span class="emphasis"><em>tools</em></span>
                   10457:             phase</a></span></dt>
                   10458: 
                   10459:             <dt><span class="sect1"><a href="#build.wrapper">14.10.
                   10460:             The <span class="emphasis"><em>wrapper</em></span>
                   10461:             phase</a></span></dt>
1.1       grant    10462: 
                   10463:             <dt><span class="sect1"><a href=
1.56      rillig   10464:             "#build.configure">14.11. The <span class=
                   10465:             "emphasis"><em>configure</em></span>
                   10466:             phase</a></span></dt>
                   10467: 
                   10468:             <dt><span class="sect1"><a href="#build.build">14.12.
                   10469:             The <span class="emphasis"><em>build</em></span>
                   10470:             phase</a></span></dt>
                   10471: 
                   10472:             <dt><span class="sect1"><a href="#build.test">14.13.
                   10473:             The <span class="emphasis"><em>test</em></span>
                   10474:             phase</a></span></dt>
                   10475: 
                   10476:             <dt><span class="sect1"><a href="#build.install">14.14.
                   10477:             The <span class="emphasis"><em>install</em></span>
                   10478:             phase</a></span></dt>
                   10479: 
                   10480:             <dt><span class="sect1"><a href="#build.package">14.15.
                   10481:             The <span class="emphasis"><em>package</em></span>
                   10482:             phase</a></span></dt>
                   10483: 
                   10484:             <dt><span class="sect1"><a href=
                   10485:             "#build.helpful-targets">14.16. Other helpful
1.1       grant    10486:             targets</a></span></dt>
                   10487:           </dl>
                   10488:         </div>
                   10489: 
1.67      hubertf  10490:         <div class="sect1" lang="en">
1.56      rillig   10491:           <div class="titlepage">
                   10492:             <div>
                   10493:               <div>
                   10494:                 <h2 class="title" style="clear: both"><a name=
                   10495:                 "build.intro"></a>14.1.&nbsp;Introduction</h2>
                   10496:               </div>
                   10497:             </div>
                   10498:           </div>
                   10499: 
                   10500:           <p>This chapter gives a detailed description on how a
                   10501:           package is built. Building a package is separated into
                   10502:           different <span class="emphasis"><em>phases</em></span>
                   10503:           (for example <code class="varname">fetch</code>,
                   10504:           <code class="varname">build</code>, <code class=
                   10505:           "varname">install</code>), all of which are described in
                   10506:           the following sections. Each phase is splitted into
                   10507:           so-called <span class="emphasis"><em>stages</em></span>,
1.66      rillig   10508:           which take the name of the containing phase, prefixed by
1.56      rillig   10509:           one of <code class="varname">pre-</code>, <code class=
                   10510:           "varname">do-</code> or <code class=
                   10511:           "varname">post-</code>. (Examples are <code class=
                   10512:           "varname">pre-configure</code>, <code class=
                   10513:           "varname">post-build</code>.) Most of the actual work is
                   10514:           done in the <code class="varname">do-*</code> stages.</p>
                   10515: 
                   10516:           <p>The basic steps for building a program are always the
                   10517:           same. First the program's source (<span class=
                   10518:           "emphasis"><em>distfile</em></span>) must be brought to
1.66      rillig   10519:           the local system and then extracted. After any
                   10520:           pkgsrc-specific patches to compile properly are applied,
                   10521:           the software can be configured, then built (usually by
                   10522:           compiling), and finally the generated binaries, etc. can
                   10523:           be put into place on the system.</p>
1.56      rillig   10524:         </div>
1.1       grant    10525: 
1.67      hubertf  10526:         <div class="sect1" lang="en">
1.1       grant    10527:           <div class="titlepage">
                   10528:             <div>
                   10529:               <div>
                   10530:                 <h2 class="title" style="clear: both"><a name=
1.56      rillig   10531:                 "build.prefix"></a>14.2.&nbsp;Program location</h2>
1.1       grant    10532:               </div>
                   10533:             </div>
                   10534:           </div>
                   10535: 
                   10536:           <p>Before outlining the process performed by the NetBSD
                   10537:           package system in the next section, here's a brief
                   10538:           discussion on where programs are installed, and which
                   10539:           variables influence this.</p>
                   10540: 
1.14      xtraeme  10541:           <p>The automatic variable <code class=
                   10542:           "varname">PREFIX</code> indicates where all files of the
                   10543:           final program shall be installed. It is usually set to
1.45      wiz      10544:           <code class="varname">LOCALBASE</code> (<code xmlns=
                   10545:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10546:           "filename">/usr/pkg</code>), or <code class=
                   10547:           "varname">CROSSBASE</code> for pkgs in the
1.1       grant    10548:           &#8220;<span class="quote">cross</span>&#8221; category.
1.14      xtraeme  10549:           The value of <code class="varname">PREFIX</code> needs to
                   10550:           be put into the various places in the program's source
                   10551:           where paths to these files are encoded. See <a href=
1.1       grant    10552:           "#components.patches" title=
1.38      dillo    10553:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
1.1       grant    10554:           &#8220;patches/*&#8221;</a> and <a href="#fixes.libtool"
                   10555:           title=
1.68      rillig   10556:           "16.3.1.&nbsp;Shared libraries - libtool">Section&nbsp;16.3.1,
1.1       grant    10557:           &#8220;Shared libraries - libtool&#8221;</a> for more
                   10558:           details.</p>
                   10559: 
                   10560:           <p>When choosing which of these variables to use, follow
                   10561:           the following rules:</p>
                   10562: 
                   10563:           <div class="itemizedlist">
                   10564:             <ul type="disc">
                   10565:               <li>
1.14      xtraeme  10566:                 <p><code class="varname">PREFIX</code> always
                   10567:                 points to the location where the current pkg will
                   10568:                 be installed. When referring to a pkg's own
1.1       grant    10569:                 installation path, use &#8220;<span class=
                   10570:                 "quote">${PREFIX}</span>&#8221;.</p>
                   10571:               </li>
                   10572: 
                   10573:               <li>
1.14      xtraeme  10574:                 <p><code class="varname">LOCALBASE</code> is where
                   10575:                 all non-X11 pkgs are installed. If you need to
1.1       grant    10576:                 construct a -I or -L argument to the compiler to
                   10577:                 find includes and libraries installed by another
                   10578:                 non-X11 pkg, use &#8220;<span class=
                   10579:                 "quote">${LOCALBASE}</span>&#8221;.</p>
                   10580:               </li>
                   10581: 
                   10582:               <li>
1.14      xtraeme  10583:                 <p><code class="varname">X11BASE</code> is where
                   10584:                 the actual X11 distribution (from xsrc, etc.) is
1.1       grant    10585:                 installed. When looking for <span class=
                   10586:                 "emphasis"><em>standard</em></span> X11 includes
                   10587:                 (not those installed by a pkg), use
                   10588:                 &#8220;<span class=
                   10589:                 "quote">${X11BASE}</span>&#8221;.</p>
                   10590:               </li>
                   10591: 
                   10592:               <li>
1.47      reed     10593:                 <p>X11-based packages are special in that they may
                   10594:                 be installed in either <code class=
1.14      xtraeme  10595:                 "varname">X11BASE</code> or <code class=
                   10596:                 "varname">LOCALBASE</code>.</p>
1.1       grant    10597: 
                   10598:                 <p>Usually, X11 packages should be installed under
1.14      xtraeme  10599:                 <code class="varname">LOCALBASE</code> whenever
1.34      wiz      10600:                 possible. Note that you will need to include
1.45      wiz      10601:                 <code xmlns=
                   10602:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.34      wiz      10603:                 "filename">../../mk/x11.buildlink3.mk</code> in
                   10604:                 them to request the presence of X11 and to get the
                   10605:                 right compilation flags.</p>
1.1       grant    10606: 
                   10607:                 <p>Even though, there are some packages that cannot
1.14      xtraeme  10608:                 be installed under <code class=
                   10609:                 "varname">LOCALBASE</code>: those that come with
1.1       grant    10610:                 app-defaults files. These packages are special and
1.14      xtraeme  10611:                 they must be placed under <code class=
                   10612:                 "varname">X11BASE</code>. To accomplish this, set
                   10613:                 either <code class="varname">USE_X11BASE</code> or
                   10614:                 <code class="varname">USE_IMAKE</code> in your
1.1       grant    10615:                 package.</p>
                   10616: 
1.34      wiz      10617:                 <p>Some notes: If you need to find includes or
1.14      xtraeme  10618:                 libraries installed by a pkg that has <code class=
                   10619:                 "varname">USE_IMAKE</code> or <code class=
                   10620:                 "varname">USE_X11BASE</code> in its pkg
1.45      wiz      10621:                 <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10622:                 class="filename">Makefile</code>, you need to look
                   10623:                 in <span class="emphasis"><em>both</em></span>
                   10624:                 <code xmlns=
                   10625:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10626:                 "filename">${X11BASE}</code> and <code xmlns=
                   10627:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10628:                 "filename">${LOCALBASE}</code>. To force
                   10629:                 installation of all X11 packages in <code class=
                   10630:                 "varname">LOCALBASE</code>, the <a xmlns=
                   10631:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    10632:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45      wiz      10633:                 target="_top"><code xmlns="" class=
                   10634:                 "filename">pkgtools/xpkgwedge</code></a> package is
1.34      wiz      10635:                 enabled by default.</p>
1.1       grant    10636:               </li>
                   10637: 
                   10638:               <li>
1.14      xtraeme  10639:                 <p><code class="varname">X11PREFIX</code> should be
1.1       grant    10640:                 used to refer to the installed location of an X11
1.14      xtraeme  10641:                 package. <code class="varname">X11PREFIX</code>
                   10642:                 will be set to <code class="varname">X11BASE</code>
                   10643:                 if xpkgwedge is not installed, and to <code class=
                   10644:                 "varname">LOCALBASE</code> if xpkgwedge is
1.1       grant    10645:                 installed.</p>
                   10646:               </li>
                   10647: 
                   10648:               <li>
                   10649:                 <p>If xpkgwedge is installed, it is possible to
1.14      xtraeme  10650:                 have some packages installed in <code class=
                   10651:                 "varname">X11BASE</code> and some in <code class=
                   10652:                 "varname">LOCALBASE</code>. To determine the prefix
                   10653:                 of an installed package, the <code class=
                   10654:                 "varname">EVAL_PREFIX</code> definition can be
                   10655:                 used. It takes pairs in the format
                   10656:                 &#8220;<span class=
1.1       grant    10657:                 "quote">DIRNAME=&lt;package&gt;</span>&#8221;, and
1.24      wiz      10658:                 the <a href=
                   10659:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   10660:                 <span class="citerefentry"><span class=
                   10661:                 "refentrytitle">make</span>(1)</span></a> variable
                   10662:                 <code class="varname">DIRNAME</code> will be set to
                   10663:                 the prefix of the installed package
                   10664:                 &lt;package&gt;, or &#8220;<span class=
1.1       grant    10665:                 "quote">${X11PREFIX}</span>&#8221; if the package
                   10666:                 is not installed.</p>
                   10667: 
                   10668:                 <p>This is best illustrated by example.</p>
                   10669: 
1.45      wiz      10670:                 <p>The following lines are taken from <code xmlns=
                   10671:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10672:                 "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1       grant    10673:                 <pre class="programlisting">
1.51      rillig   10674:     EVAL_PREFIX+=           GTKDIR=gtk+
1.69    ! rillig   10675:     CONFIGURE_ARGS+=        --with-guile-prefix=${LOCALBASE:Q}
        !          10676:     CONFIGURE_ARGS+=        --with-gtk-prefix=${GTKDIR:Q}
        !          10677:     CONFIGURE_ARGS+=        --enable-multibyte
1.1       grant    10678: </pre>
                   10679: 
                   10680:                 <p>Specific defaults can be defined for the
1.14      xtraeme  10681:                 packages evaluated using <code class=
                   10682:                 "varname">EVAL_PREFIX</code>, by using a definition
1.1       grant    10683:                 of the form:</p>
                   10684:                 <pre class="programlisting">
1.51      rillig   10685:     GTKDIR_DEFAULT= ${LOCALBASE}
1.1       grant    10686: </pre>
                   10687: 
1.14      xtraeme  10688:                 <p>where <code class="varname">GTKDIR</code>
1.1       grant    10689:                 corresponds to the first definition in the
1.14      xtraeme  10690:                 <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1       grant    10691:               </li>
                   10692: 
                   10693:               <li>
1.45      wiz      10694:                 <p>Within <code xmlns=
                   10695:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10696:                 "filename">${PREFIX}</code>, packages should
                   10697:                 install files according to <a href=
1.24      wiz      10698:                 "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
                   10699:                 <span class="citerefentry"><span class=
                   10700:                 "refentrytitle">hier</span>(7)</span></a>, with the
1.45      wiz      10701:                 exception that manual pages go into <code xmlns=
                   10702:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10703:                 "filename">${PREFIX}/man</code>, not <code xmlns=
                   10704:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10705:                 "filename">${PREFIX}/share/man</code>.</p>
1.1       grant    10706:               </li>
                   10707:             </ul>
                   10708:           </div>
                   10709:         </div>
                   10710: 
1.67      hubertf  10711:         <div class="sect1" lang="en">
1.1       grant    10712:           <div class="titlepage">
                   10713:             <div>
                   10714:               <div>
                   10715:                 <h2 class="title" style="clear: both"><a name=
1.56      rillig   10716:                 "build.builddirs"></a>14.3.&nbsp;Directories used
                   10717:                 during the build process</h2>
1.1       grant    10718:               </div>
                   10719:             </div>
                   10720:           </div>
                   10721: 
1.56      rillig   10722:           <p>When building a package, a number of directories is
                   10723:           used to store source files, temporary files,
                   10724:           pkgsrc-internal files, and so on. These directories are
                   10725:           explained here.</p>
                   10726: 
                   10727:           <p>Some of the directory variables contain relative
                   10728:           pathnames. There are two common base directories for
                   10729:           these relative directories: <code class=
                   10730:           "varname">PKGSRCDIR/PKGPATH</code> is used for
                   10731:           directories that are pkgsrc-specific. <code class=
                   10732:           "varname">WRKSRC</code> is used for directories inside
1.66      rillig   10733:           the package itself.</p>
1.1       grant    10734: 
                   10735:           <div class="variablelist">
                   10736:             <dl>
1.56      rillig   10737:               <dt><span class="term"><code class=
1.66      rillig   10738:               "varname">PKGSRCDIR</code></span></dt>
1.56      rillig   10739: 
                   10740:               <dd>
                   10741:                 <p>This is an absolute pathname that points to the
                   10742:                 pkgsrc root directory. Generally, you don't need
                   10743:                 it.</p>
                   10744:               </dd>
                   10745: 
                   10746:               <dt><span class="term"><code class=
1.66      rillig   10747:               "varname">PKGPATH</code></span></dt>
1.1       grant    10748: 
                   10749:               <dd>
1.56      rillig   10750:                 <p>This is a pathname relative to <code class=
                   10751:                 "varname">PKGSRCDIR</code> that points to the
                   10752:                 current package.</p>
                   10753:               </dd>
                   10754: 
                   10755:               <dt><span class="term"><code class=
1.66      rillig   10756:               "varname">WRKDIR</code></span></dt>
1.56      rillig   10757: 
                   10758:               <dd>
                   10759:                 <p>This is an absolute pathname pointing to the
1.57      minskim  10760:                 directory where all work takes place. The distfiles
                   10761:                 are extraced to this directory. It also contains
                   10762:                 temporary directories and log files used by the
                   10763:                 various pkgsrc frameworks, like <span class=
                   10764:                 "emphasis"><em>buildlink</em></span> or the
                   10765:                 <span class=
1.56      rillig   10766:                 "emphasis"><em>wrappers</em></span>.</p>
                   10767:               </dd>
                   10768: 
                   10769:               <dt><span class="term"><code class=
1.66      rillig   10770:               "varname">WRKSRC</code></span></dt>
1.56      rillig   10771: 
                   10772:               <dd>
                   10773:                 <p>This is an absolute pathname pointing to the
                   10774:                 directory where the distfiles are extracted. It is
                   10775:                 usually a direct subdirectory of <code class=
                   10776:                 "varname">WRKDIR</code>, and often it's the only
1.66      rillig   10777:                 directory entry that isn't hidden. This variable
                   10778:                 may be changed by a package <code xmlns=
                   10779:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10780:                 "filename">Makefile</code>.</p>
1.56      rillig   10781:               </dd>
                   10782:             </dl>
                   10783:           </div>
                   10784:         </div>
                   10785: 
1.67      hubertf  10786:         <div class="sect1" lang="en">
1.56      rillig   10787:           <div class="titlepage">
                   10788:             <div>
                   10789:               <div>
                   10790:                 <h2 class="title" style="clear: both"><a name=
                   10791:                 "build.running"></a>14.4.&nbsp;Running a phase</h2>
                   10792:               </div>
                   10793:             </div>
                   10794:           </div>
                   10795: 
                   10796:           <p>You can run a particular phase by typing
                   10797:           <span><strong class="command">make phase</strong></span>,
                   10798:           where <span class="emphasis"><em>phase</em></span> is the
                   10799:           name of the phase. This will automatically run all phases
                   10800:           that are required for this phase. The default phase is
                   10801:           <code class="varname">build</code>, that is, when you run
                   10802:           <span><strong class="command">make</strong></span>
                   10803:           without parameters in a package directory, the package
                   10804:           will be built, but not installed.</p>
                   10805:         </div>
                   10806: 
1.67      hubertf  10807:         <div class="sect1" lang="en">
1.56      rillig   10808:           <div class="titlepage">
                   10809:             <div>
                   10810:               <div>
                   10811:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  10812:                 "build.fetch"></a>14.5.&nbsp;The <span class=
                   10813:                 "emphasis"><em>fetch</em></span> phase</h2>
1.56      rillig   10814:               </div>
                   10815:             </div>
                   10816:           </div>
                   10817: 
                   10818:           <p>This will check if the file(s) given in the variables
                   10819:           <code class="varname">DISTFILES</code> and <code class=
                   10820:           "varname">PATCHFILES</code> (as defined in the package's
                   10821:           Makefile) are present on the local system in <code xmlns=
                   10822:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10823:           "filename">/usr/pkgsrc/distfiles</code>. If they are not
                   10824:           present, an attempt will be made to fetch them using
                   10825:           commands of the form:</p>
                   10826:           <pre class="programlisting">
1.51      rillig   10827:     ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
1.1       grant    10828: </pre>
                   10829: 
1.56      rillig   10830:           <p>where ${site} varies through several possibilities in
                   10831:           turn: first, <code class=
                   10832:           "varname">MASTER_SITE_OVERRIDE</code> is tried, then the
                   10833:           sites specified in either <code class=
                   10834:           "varname">SITES_file</code> if defined, else <code class=
                   10835:           "varname">MASTER_SITES</code> or <code class=
                   10836:           "varname">PATCH_SITES</code>, as applies, then finally
                   10837:           the value of <code class=
                   10838:           "varname">MASTER_SITE_BACKUP</code>. The order of all
                   10839:           except the first can be optionally sorted by the user,
                   10840:           via setting either <code class=
                   10841:           "varname">MASTER_SORT_AWK</code> or <code class=
                   10842:           "varname">MASTER_SORT_REGEX</code>.</p>
                   10843:         </div>
                   10844: 
1.67      hubertf  10845:         <div class="sect1" lang="en">
1.56      rillig   10846:           <div class="titlepage">
                   10847:             <div>
                   10848:               <div>
                   10849:                 <h2 class="title" style="clear: both"><a name=
                   10850:                 "build.checksum"></a>14.6.&nbsp;The <span class=
                   10851:                 "emphasis"><em>checksum</em></span> phase</h2>
                   10852:               </div>
                   10853:             </div>
                   10854:           </div>
                   10855: 
                   10856:           <p>After the distfile(s) are fetched, their checksum is
                   10857:           generated and compared with the checksums stored in the
                   10858:           distinfo file. If the checksums don't match, the build is
                   10859:           aborted. This is to ensure the same distfile is used for
                   10860:           building, and that the distfile wasn't changed, e.g. by
                   10861:           some malign force, deliberately changed distfiles on the
                   10862:           master distribution site or network lossage.</p>
                   10863:         </div>
                   10864: 
1.67      hubertf  10865:         <div class="sect1" lang="en">
1.56      rillig   10866:           <div class="titlepage">
                   10867:             <div>
                   10868:               <div>
                   10869:                 <h2 class="title" style="clear: both"><a name=
                   10870:                 "build.extract"></a>14.7.&nbsp;The <span class=
                   10871:                 "emphasis"><em>extract</em></span> phase</h2>
                   10872:               </div>
                   10873:             </div>
                   10874:           </div>
                   10875: 
                   10876:           <p>When the distfiles are present on the local system,
1.69    ! rillig   10877:           they need to be extracted, as they usually come in the
        !          10878:           form of some compressed archive format.</p>
        !          10879: 
        !          10880:           <p>By default, all <code class="varname">DISTFILES</code>
        !          10881:           are extracted. If you only need some of them, you can set
        !          10882:           the <code class="varname">EXTRACT_ONLY</code> variable to
        !          10883:           the list of those files.</p>
        !          10884: 
        !          10885:           <p>Extracting the files is usually done by a little
        !          10886:           program, <code xmlns=
        !          10887:           "http://www.w3.org/TR/xhtml1/transitional" class=
        !          10888:           "filename">mk/scripts/extract</code>, which already knows
        !          10889:           how to extract various archive formats, so most likely
        !          10890:           you will not need to change anything here. But if you
        !          10891:           need, the following variables may help you:</p>
        !          10892: 
        !          10893:           <div class="variablelist">
        !          10894:             <dl>
        !          10895:               <dt><span class="term"><code class=
        !          10896:               "varname">EXTRACT_OPTS_{BIN,LHA,PAX,RAR,TAR,ZIP,ZOO}</code></span></dt>
        !          10897: 
        !          10898:               <dd>
        !          10899:                 <p>Use these variables to override the default
        !          10900:                 options for an extract command, which are defined
        !          10901:                 in <code xmlns=
        !          10902:                 "http://www.w3.org/TR/xhtml1/transitional" class=
        !          10903:                 "filename">mk/scripts/extract</code>.</p>
        !          10904:               </dd>
1.1       grant    10905: 
1.69    ! rillig   10906:               <dt><span class="term"><code class=
        !          10907:               "varname">EXTRACT_USING</code></span></dt>
1.1       grant    10908: 
1.69    ! rillig   10909:               <dd>
        !          10910:                 <p>This variable can be set to <code class=
        !          10911:                 "literal">pax</code>, <code class=
        !          10912:                 "literal">tar</code> or an absolute pathname
        !          10913:                 pointing to the command with which tar archives
        !          10914:                 should be extracted.</p>
        !          10915:               </dd>
        !          10916:             </dl>
        !          10917:           </div>
        !          10918: 
        !          10919:           <p>If the <code xmlns=
1.56      rillig   10920:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.69    ! rillig   10921:           "filename">extract</code> program doesn't serve your
        !          10922:           needs, you can also override the <code class=
        !          10923:           "varname">EXTRACT_CMD</code> variable, which holds the
        !          10924:           command used for extracting the files. This command is
        !          10925:           executed in the <code xmlns=
        !          10926:           "http://www.w3.org/TR/xhtml1/transitional" class=
        !          10927:           "filename">${WRKSRC}</code> directory. During execution
        !          10928:           of this command, the shell variable <code class=
        !          10929:           "varname">extract_file</code> holds the absolute pathname
        !          10930:           of the file that is going to be extracted.</p>
        !          10931: 
        !          10932:           <p>And if that still does not suffice, you can override
        !          10933:           the <code class="varname">do-extract</code> target in the
        !          10934:           package Makefile.</p>
1.56      rillig   10935:         </div>
                   10936: 
1.67      hubertf  10937:         <div class="sect1" lang="en">
1.56      rillig   10938:           <div class="titlepage">
                   10939:             <div>
                   10940:               <div>
                   10941:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  10942:                 "build.patch"></a>14.8.&nbsp;The <span class=
                   10943:                 "emphasis"><em>patch</em></span> phase</h2>
1.56      rillig   10944:               </div>
                   10945:             </div>
                   10946:           </div>
                   10947: 
                   10948:           <p>After extraction, all the patches named by the
                   10949:           <code class="varname">PATCHFILES</code>, those present in
                   10950:           the patches subdirectory of the package as well as in
                   10951:           $LOCALPATCHES/$PKGPATH (e.g. <code xmlns=
                   10952:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10953:           "filename">/usr/local/patches/graphics/png</code>) are
                   10954:           applied. Patchfiles ending in <code xmlns=
                   10955:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10956:           "filename">.Z</code> or <code xmlns=
                   10957:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10958:           "filename">.gz</code> are uncompressed before they are
                   10959:           applied, files ending in <code xmlns=
                   10960:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10961:           "filename">.orig</code> or <code xmlns=
                   10962:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10963:           "filename">.rej</code> are ignored. Any special options
                   10964:           to <a href=
                   10965:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   10966:           <span class="citerefentry"><span class=
                   10967:           "refentrytitle">patch</span>(1)</span></a> can be handed
                   10968:           in <code class="varname">PATCH_DIST_ARGS</code>. See
                   10969:           <a href="#components.patches" title=
                   10970:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
                   10971:           &#8220;patches/*&#8221;</a> for more details.</p>
                   10972: 
                   10973:           <p>By default <a href=
                   10974:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   10975:           <span class="citerefentry"><span class=
                   10976:           "refentrytitle">patch</span>(1)</span></a> is given
                   10977:           special args to make it fail if the patches apply with
                   10978:           some lines of fuzz. Please fix (regen) the patches so
                   10979:           that they apply cleanly. The rationale behind this is
                   10980:           that patches that don't apply cleanly may end up being
                   10981:           applied in the wrong place, and cause severe harm
                   10982:           there.</p>
                   10983:         </div>
                   10984: 
1.67      hubertf  10985:         <div class="sect1" lang="en">
1.56      rillig   10986:           <div class="titlepage">
                   10987:             <div>
                   10988:               <div>
                   10989:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  10990:                 "build.tools"></a>14.9.&nbsp;The <span class=
                   10991:                 "emphasis"><em>tools</em></span> phase</h2>
1.56      rillig   10992:               </div>
                   10993:             </div>
                   10994:           </div>
                   10995: 
1.68      rillig   10996:           <p>This is covered in <a href="#tools" title=
                   10997:           "Chapter&nbsp;15.&nbsp;Tools needed for building or running">
                   10998:           Chapter&nbsp;15, <i>Tools needed for building or
                   10999:           running</i></a>.</p>
1.56      rillig   11000:         </div>
                   11001: 
1.67      hubertf  11002:         <div class="sect1" lang="en">
1.56      rillig   11003:           <div class="titlepage">
                   11004:             <div>
                   11005:               <div>
                   11006:                 <h2 class="title" style="clear: both"><a name=
                   11007:                 "build.wrapper"></a>14.10.&nbsp;The <span class=
                   11008:                 "emphasis"><em>wrapper</em></span> phase</h2>
                   11009:               </div>
                   11010:             </div>
                   11011:           </div>
                   11012: 
                   11013:           <p>[TODO]</p>
                   11014:         </div>
                   11015: 
1.67      hubertf  11016:         <div class="sect1" lang="en">
1.56      rillig   11017:           <div class="titlepage">
                   11018:             <div>
                   11019:               <div>
                   11020:                 <h2 class="title" style="clear: both"><a name=
                   11021:                 "build.configure"></a>14.11.&nbsp;The <span class=
                   11022:                 "emphasis"><em>configure</em></span> phase</h2>
                   11023:               </div>
                   11024:             </div>
                   11025:           </div>
                   11026: 
                   11027:           <p>Most pieces of software need information on the header
                   11028:           files, system calls, and library routines which are
                   11029:           available on the platform they run on. The process of
                   11030:           determining this information is known as configuration,
                   11031:           and is usually automated. In most cases, a script is
                   11032:           supplied with the distfiles, and its invocation results
                   11033:           in generation of header files, Makefiles, etc.</p>
                   11034: 
                   11035:           <p>If the package contains a configure script, this can
                   11036:           be invoked by setting <code class=
                   11037:           "varname">HAS_CONFIGURE</code> to &#8220;<span class=
                   11038:           "quote">yes</span>&#8221;. If the configure script is a
                   11039:           GNU autoconf script, you should set <code class=
                   11040:           "varname">GNU_CONFIGURE</code> to &#8220;<span class=
                   11041:           "quote">yes</span>&#8221; instead. What happens in the
                   11042:           <span class="emphasis"><em>configure</em></span> phase is
                   11043:           roughly:</p>
                   11044:           <pre class="programlisting">
                   11045:     .for d in ${CONFIGURE_DIRS}
                   11046:             cd ${WRKSRC} &amp;&amp; cd ${d} &amp;&amp; env ${CONFIGURE_ENV} \
                   11047:                 ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
                   11048:     .endfor
                   11049: </pre>
1.1       grant    11050: 
1.56      rillig   11051:           <p><code class="varname">CONFIGURE_DIRS</code> (default:
                   11052:           &#8220;<span class="quote">.</span>&#8221;) is a list of
                   11053:           pathnames relative to <code class=
                   11054:           "varname">WRKSRC</code>. In each of these directories,
                   11055:           the configure script is run with the environment
                   11056:           <code class="varname">CONFIGURE_ENV</code> and arguments
                   11057:           <code class="varname">CONFIGURE_ARGS</code>. The
                   11058:           variables <code class="varname">CONFIGURE_ENV</code>,
                   11059:           <code class="varname">CONFIGURE_SCRIPT</code> (default:
                   11060:           &#8220;<span class="quote">./configure</span>&#8221;) and
                   11061:           <code class="varname">CONFIGURE_ARGS</code> may all be
                   11062:           changed by the package.</p>
1.1       grant    11063: 
1.56      rillig   11064:           <p>If the program uses an <code xmlns=
                   11065:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   11066:           "filename">Imakefile</code> for configuration, the
                   11067:           appropriate steps can be invoked by setting <code class=
                   11068:           "varname">USE_IMAKE</code> to &#8220;<span class=
                   11069:           "quote">yes</span>&#8221;. (If you only want the package
                   11070:           installed in <code class="varname">${X11PREFIX}</code>
                   11071:           but xmkmf not being run, set <code class=
                   11072:           "varname">USE_X11BASE</code> instead.)</p>
                   11073:         </div>
1.1       grant    11074: 
1.67      hubertf  11075:         <div class="sect1" lang="en">
1.56      rillig   11076:           <div class="titlepage">
                   11077:             <div>
                   11078:               <div>
                   11079:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  11080:                 "build.build"></a>14.12.&nbsp;The <span class=
                   11081:                 "emphasis"><em>build</em></span> phase</h2>
1.56      rillig   11082:               </div>
                   11083:             </div>
1.1       grant    11084:           </div>
                   11085: 
1.56      rillig   11086:           <p>For building a package, a rough equivalent of the
                   11087:           following code is executed.</p>
1.1       grant    11088:           <pre class="programlisting">
1.56      rillig   11089:     .for d in ${BUILD_DIRS}
                   11090:             cd ${WRKSRC} &amp;&amp; cd ${d} &amp;&amp; env ${MAKE_ENV} \
                   11091:                 ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} \
                   11092:                     -f ${MAKEFILE} ${BUILD_TARGET}
                   11093:     .endfor
1.1       grant    11094: </pre>
1.56      rillig   11095: 
                   11096:           <p><code class="varname">BUILD_DIRS</code> (default:
                   11097:           &#8220;<span class="quote">.</span>&#8221;) is a list of
                   11098:           pathnames relative to <code class=
                   11099:           "varname">WRKSRC</code>. In each of these directories,
                   11100:           <code class="varname">MAKE_PROGRAM</code> is run with the
                   11101:           environment <code class="varname">MAKE_ENV</code> and
                   11102:           arguments <code class="varname">BUILD_MAKE_FLAGS</code>.
                   11103:           The variables <code class="varname">MAKE_ENV</code>,
                   11104:           <code class="varname">BUILD_MAKE_FLAGS</code>,
                   11105:           <code class="varname">MAKEFILE</code> and <code class=
                   11106:           "varname">BUILD_TARGET</code> may all be changed by the
                   11107:           package.</p>
                   11108: 
                   11109:           <p>The default value of <code class=
                   11110:           "varname">MAKE_PROGRAM</code> is &#8220;<span class=
                   11111:           "quote">gmake</span>&#8221; if <code class=
                   11112:           "varname">USE_TOOLS</code> contains &#8220;<span class=
                   11113:           "quote">gmake</span>&#8221;, &#8220;<span class=
                   11114:           "quote">make</span>&#8221; otherwise. The default value
                   11115:           of <code class="varname">MAKEFILE</code> is
                   11116:           &#8220;<span class="quote">Makefile</span>&#8221;, and
                   11117:           <code class="varname">BUILD_TARGET</code> defaults to
                   11118:           &#8220;<span class="quote">all</span>&#8221;.</p>
                   11119:         </div>
                   11120: 
1.67      hubertf  11121:         <div class="sect1" lang="en">
1.56      rillig   11122:           <div class="titlepage">
                   11123:             <div>
                   11124:               <div>
                   11125:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  11126:                 "build.test"></a>14.13.&nbsp;The <span class=
                   11127:                 "emphasis"><em>test</em></span> phase</h2>
1.56      rillig   11128:               </div>
                   11129:             </div>
                   11130:           </div>
                   11131: 
                   11132:           <p>[TODO]</p>
                   11133:         </div>
                   11134: 
1.67      hubertf  11135:         <div class="sect1" lang="en">
1.56      rillig   11136:           <div class="titlepage">
                   11137:             <div>
                   11138:               <div>
                   11139:                 <h2 class="title" style="clear: both"><a name=
                   11140:                 "build.install"></a>14.14.&nbsp;The <span class=
                   11141:                 "emphasis"><em>install</em></span> phase</h2>
                   11142:               </div>
                   11143:             </div>
                   11144:           </div>
                   11145: 
                   11146:           <p>Once the build stage has completed, the final step is
                   11147:           to install the software in public directories, so users
1.68      rillig   11148:           can access the programs and files.</p>
                   11149: 
                   11150:           <p>In the <span class="emphasis"><em>install</em></span>
                   11151:           phase, a rough equivalent of the following code is
                   11152:           executed. Additionally, before and after this code, much
                   11153:           magic is performed to do consistency checks, registering
                   11154:           the package, and so on.</p>
                   11155:           <pre class="programlisting">
                   11156:     .for d in ${INSTALL_DIRS}
                   11157:             cd ${WRKSRC} &amp;&amp; cd ${d} &amp;&amp; env ${MAKE_ENV} \
                   11158:                 ${MAKE_PROGRAM} ${INSTALL_MAKE_FLAGS} \
                   11159:                     -f ${MAKEFILE} ${BUILD_TARGET}
                   11160:     .endfor
                   11161: </pre>
                   11162: 
                   11163:           <p>The variable's meanings are analogous to the ones in
                   11164:           the <span class="emphasis"><em>build</em></span> phase.
                   11165:           <code class="varname">INSTALL_DIRS</code> defaults to
                   11166:           <code class="varname">BUILD_DIRS</code>. <code class=
                   11167:           "varname">INSTALL_TARGET</code> is &#8220;<span class=
                   11168:           "quote">install</span>&#8221; by default, plus
                   11169:           &#8220;<span class="quote">install.man</span>&#8221; if
                   11170:           <code class="varname">USE_IMAKE</code> is defined.</p>
                   11171: 
                   11172:           <p>In the <span class="emphasis"><em>install</em></span>
                   11173:           phase, the following variables are useful. They are all
                   11174:           variations of the <a href=
                   11175:           "http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   11176:           <span class="citerefentry"><span class=
                   11177:           "refentrytitle">install</span>(1)</span></a> command that
                   11178:           have the owner, group and permissions preset.
                   11179:           <code class="varname">INSTALL</code> is the plain install
                   11180:           command. The specialized variants, together with their
                   11181:           intended use, are:</p>
                   11182: 
                   11183:           <div class="variablelist">
                   11184:             <dl>
                   11185:               <dt><span class="term"><code class=
                   11186:               "varname">INSTALL_PROGRAM_DIR</code></span></dt>
                   11187: 
                   11188:               <dd>
                   11189:                 <p>directories that contain binaries</p>
                   11190:               </dd>
                   11191: 
                   11192:               <dt><span class="term"><code class=
                   11193:               "varname">INSTALL_SCRIPT_DIR</code></span></dt>
                   11194: 
                   11195:               <dd>
                   11196:                 <p>directories that contain scripts</p>
                   11197:               </dd>
                   11198: 
                   11199:               <dt><span class="term"><code class=
                   11200:               "varname">INSTALL_LIB_DIR</code></span></dt>
                   11201: 
                   11202:               <dd>
                   11203:                 <p>directories that contain shared and static
                   11204:                 libraries</p>
                   11205:               </dd>
                   11206: 
                   11207:               <dt><span class="term"><code class=
                   11208:               "varname">INSTALL_DATA_DIR</code></span></dt>
                   11209: 
                   11210:               <dd>
                   11211:                 <p>directories that contain data files</p>
                   11212:               </dd>
                   11213: 
                   11214:               <dt><span class="term"><code class=
                   11215:               "varname">INSTALL_MAN_DIR</code></span></dt>
                   11216: 
                   11217:               <dd>
                   11218:                 <p>directories that contain man pages</p>
                   11219:               </dd>
                   11220: 
                   11221:               <dt><span class="term"><code class=
                   11222:               "varname">INSTALL_PROGRAM</code></span></dt>
                   11223: 
                   11224:               <dd>
                   11225:                 <p>binaries that can be stripped from debugging
                   11226:                 symbols</p>
                   11227:               </dd>
                   11228: 
                   11229:               <dt><span class="term"><code class=
                   11230:               "varname">INSTALL_SCRIPT</code></span></dt>
                   11231: 
                   11232:               <dd>
                   11233:                 <p>binaries that cannot be stripped</p>
                   11234:               </dd>
                   11235: 
                   11236:               <dt><span class="term"><code class=
                   11237:               "varname">INSTALL_GAME</code></span></dt>
                   11238: 
                   11239:               <dd>
                   11240:                 <p>game binaries</p>
                   11241:               </dd>
                   11242: 
                   11243:               <dt><span class="term"><code class=
                   11244:               "varname">INSTALL_LIB</code></span></dt>
                   11245: 
                   11246:               <dd>
                   11247:                 <p>shared and static libraries</p>
                   11248:               </dd>
                   11249: 
                   11250:               <dt><span class="term"><code class=
                   11251:               "varname">INSTALL_DATA</code></span></dt>
                   11252: 
                   11253:               <dd>
                   11254:                 <p>data files</p>
                   11255:               </dd>
                   11256: 
                   11257:               <dt><span class="term"><code class=
                   11258:               "varname">INSTALL_GAME_DATA</code></span></dt>
                   11259: 
                   11260:               <dd>
                   11261:                 <p>data files for games</p>
                   11262:               </dd>
                   11263: 
                   11264:               <dt><span class="term"><code class=
                   11265:               "varname">INSTALL_MAN</code></span></dt>
                   11266: 
                   11267:               <dd>
                   11268:                 <p>man pages</p>
                   11269:               </dd>
                   11270:             </dl>
                   11271:           </div>
                   11272: 
                   11273:           <p>Some other variables are:</p>
                   11274: 
                   11275:           <div class="variablelist">
                   11276:             <dl>
                   11277:               <dt><span class="term"><code class=
                   11278:               "varname">INSTALLATION_DIRS</code></span></dt>
                   11279: 
                   11280:               <dd>
                   11281:                 <p>A list of directories relative to <code class=
                   11282:                 "varname">PREFIX</code> that are created by pkgsrc
                   11283:                 at the beginning of the <span class=
                   11284:                 "emphasis"><em>install</em></span> phase. If this
                   11285:                 variable is set, <code class=
                   11286:                 "varname">NO_MTREE</code>=&#8220;<span class=
                   11287:                 "quote">yes</span>&#8221; is assumed, which means
                   11288:                 that the package claims to create all needed
                   11289:                 directories itself before installing files to it.
                   11290:                 Therefore this variable should only be set in
                   11291:                 <code xmlns=
                   11292:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11293:                 "filename">Makefile</code>s that are under control
                   11294:                 of the package's author.</p>
                   11295:               </dd>
                   11296:             </dl>
                   11297:           </div>
1.56      rillig   11298:         </div>
                   11299: 
1.67      hubertf  11300:         <div class="sect1" lang="en">
1.56      rillig   11301:           <div class="titlepage">
                   11302:             <div>
                   11303:               <div>
                   11304:                 <h2 class="title" style="clear: both"><a name=
                   11305:                 "build.package"></a>14.15.&nbsp;The <span class=
                   11306:                 "emphasis"><em>package</em></span> phase</h2>
                   11307:               </div>
                   11308:             </div>
                   11309:           </div>
                   11310: 
                   11311:           <p>[TODO]</p>
1.1       grant    11312:         </div>
                   11313: 
1.67      hubertf  11314:         <div class="sect1" lang="en">
1.1       grant    11315:           <div class="titlepage">
                   11316:             <div>
                   11317:               <div>
                   11318:                 <h2 class="title" style="clear: both"><a name=
1.56      rillig   11319:                 "build.helpful-targets"></a>14.16.&nbsp;Other
1.1       grant    11320:                 helpful targets</h2>
                   11321:               </div>
                   11322:             </div>
                   11323:           </div>
                   11324: 
                   11325:           <div class="variablelist">
                   11326:             <dl>
                   11327:               <dt><span class="term">pre/post-*</span></dt>
                   11328: 
                   11329:               <dd>
                   11330:                 <p>For any of the main targets described in the
                   11331:                 previous section, two auxiliary targets exist with
                   11332:                 &#8220;<span class="quote">pre-</span>&#8221; and
                   11333:                 &#8220;<span class="quote">post-</span>&#8221; used
                   11334:                 as a prefix for the main target's name. These
                   11335:                 targets are invoked before and after the main
                   11336:                 target is called, allowing extra configuration or
                   11337:                 installation steps be performed from a package's
                   11338:                 Makefile, for example, which a program's configure
                   11339:                 script or install target omitted.</p>
                   11340:               </dd>
                   11341: 
                   11342:               <dt><span class="term">do-*</span></dt>
                   11343: 
                   11344:               <dd>
                   11345:                 <p>Should one of the main targets do the wrong
                   11346:                 thing, and should there be no variable to fix this,
                   11347:                 you can redefine it with the do-* target. (Note
                   11348:                 that redefining the target itself instead of the
                   11349:                 do-* target is a bad idea, as the pre-* and post-*
                   11350:                 targets won't be called anymore, etc.) You will not
                   11351:                 usually need to do this.</p>
                   11352:               </dd>
                   11353: 
                   11354:               <dt><span class="term">reinstall</span></dt>
                   11355: 
                   11356:               <dd>
1.14      xtraeme  11357:                 <p>If you did a <span><strong class="command">make
                   11358:                 install</strong></span> and you noticed some file
                   11359:                 was not installed properly, you can repeat the
1.1       grant    11360:                 installation with this target, which will ignore
                   11361:                 the &#8220;<span class="quote">already
                   11362:                 installed</span>&#8221; flag.</p>
                   11363:               </dd>
                   11364: 
                   11365:               <dt><span class="term">deinstall</span></dt>
                   11366: 
                   11367:               <dd>
1.24      wiz      11368:                 <p>This target does a <a href=
                   11369:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   11370:                 <span class="citerefentry"><span class=
                   11371:                 "refentrytitle">pkg_delete</span>(1)</span></a> in
                   11372:                 the current directory, effectively de-installing
                   11373:                 the package. The following variables can be used to
                   11374:                 tune the behaviour:</p>
1.1       grant    11375: 
                   11376:                 <div class="variablelist">
                   11377:                   <dl>
1.14      xtraeme  11378:                     <dt><span class="term"><code class=
                   11379:                     "varname">PKG_VERBOSE</code></span></dt>
1.1       grant    11380: 
                   11381:                     <dd>
                   11382:                       <p>Add a "-v" to the <a href=
                   11383:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   11384:                       <span class="citerefentry"><span class=
                   11385:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   11386:                       command.</p>
                   11387:                     </dd>
                   11388: 
1.14      xtraeme  11389:                     <dt><span class="term"><code class=
                   11390:                     "varname">DEINSTALLDEPENDS</code></span></dt>
1.1       grant    11391: 
                   11392:                     <dd>
                   11393:                       <p>Remove all packages that require (depend
                   11394:                       on) the given package. This can be used to
                   11395:                       remove any packages that may have been pulled
                   11396:                       in by a given package, e.g. if
1.14      xtraeme  11397:                       <span><strong class="command">make deinstall
                   11398:                       DEINSTALLDEPENDS=1</strong></span> is done in
1.45      wiz      11399:                       <code xmlns=
                   11400:                       "http://www.w3.org/TR/xhtml1/transitional"
                   11401:                       class="filename">pkgsrc/x11/kde</code>, this
                   11402:                       is likely to remove whole KDE. Works by
1.1       grant    11403:                       adding &#8220;<span class=
                   11404:                       "quote">-R</span>&#8221; to the <a href=
                   11405:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   11406:                       <span class="citerefentry"><span class=
                   11407:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   11408:                       command line.</p>
                   11409:                     </dd>
                   11410:                   </dl>
                   11411:                 </div>
                   11412:               </dd>
                   11413: 
                   11414:               <dt><span class="term">update</span></dt>
                   11415: 
                   11416:               <dd>
                   11417:                 <p>This target causes the current package to be
                   11418:                 updated to the latest version. The package and all
                   11419:                 depending packages first get de-installed, then
                   11420:                 current versions of the corresponding packages get
                   11421:                 compiled and installed. This is similar to manually
                   11422:                 noting which packages are currently installed, then
1.14      xtraeme  11423:                 performing a series of <span><strong class=
                   11424:                 "command">make deinstall</strong></span> and
                   11425:                 <span><strong class="command">make
                   11426:                 install</strong></span> (or whatever <code class=
                   11427:                 "varname">UPDATE_TARGET</code> is set to) for these
                   11428:                 packages.</p>
1.1       grant    11429: 
                   11430:                 <p>You can use the &#8220;<span class=
                   11431:                 "quote">update</span>&#8221; target to resume
1.14      xtraeme  11432:                 package updating in case a previous
                   11433:                 <span><strong class="command">make
                   11434:                 update</strong></span> was interrupted for some
                   11435:                 reason. However, in this case, make sure you don't
                   11436:                 call <span><strong class="command">make
                   11437:                 clean</strong></span> or otherwise remove the list
                   11438:                 of dependent packages in <code class=
1.47      reed     11439:                 "varname">WRKDIR</code>. Otherwise, you lose the
1.1       grant    11440:                 ability to automatically update the current package
                   11441:                 along with the dependent packages you have
                   11442:                 installed.</p>
                   11443: 
1.14      xtraeme  11444:                 <p>Resuming an interrupted <span><strong class=
                   11445:                 "command">make update</strong></span> will only
                   11446:                 work as long as the package tree remains unchanged.
                   11447:                 If the source code for one of the packages to be
                   11448:                 updated has been changed, resuming
                   11449:                 <span><strong class="command">make
                   11450:                 update</strong></span> will most certainly
                   11451:                 fail!</p>
1.1       grant    11452: 
                   11453:                 <p>The following variables can be used either on
1.45      wiz      11454:                 the command line or in <code xmlns=
                   11455:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11456:                 "filename">/etc/mk.conf</code> to alter the
                   11457:                 behaviour of <span><strong class="command">make
                   11458:                 update</strong></span>:</p>
1.1       grant    11459: 
                   11460:                 <div class="variablelist">
                   11461:                   <dl>
1.14      xtraeme  11462:                     <dt><span class="term"><code class=
                   11463:                     "varname">UPDATE_TARGET</code></span></dt>
1.1       grant    11464: 
                   11465:                     <dd>
                   11466:                       <p>Install target to recursively use for the
                   11467:                       updated package and the dependent packages.
1.14      xtraeme  11468:                       Defaults to <code class=
                   11469:                       "varname">DEPENDS_TARGET</code> if set,
1.1       grant    11470:                       &#8220;<span class=
                   11471:                       "quote">install</span>&#8221; otherwise for
1.14      xtraeme  11472:                       <span><strong class="command">make
                   11473:                       update</strong></span>. e.g.
                   11474:                       <span><strong class="command">make update
                   11475:                       UPDATE_TARGET=package</strong></span></p>
1.1       grant    11476:                     </dd>
                   11477: 
1.14      xtraeme  11478:                     <dt><span class="term"><code class=
                   11479:                     "varname">NOCLEAN</code></span></dt>
1.1       grant    11480: 
                   11481:                     <dd>
                   11482:                       <p>Don't clean up after updating. Useful if
                   11483:                       you want to leave the work sources of the
                   11484:                       updated packages around for inspection or
                   11485:                       other purposes. Be sure you eventually clean
                   11486:                       up the source tree (see the
                   11487:                       &#8220;<span class=
                   11488:                       "quote">clean-update</span>&#8221; target
                   11489:                       below) or you may run into troubles with old
                   11490:                       source code still lying around on your next
1.14      xtraeme  11491:                       <span><strong class=
                   11492:                       "command">make</strong></span> or
                   11493:                       <span><strong class="command">make
                   11494:                       update</strong></span>.</p>
1.1       grant    11495:                     </dd>
                   11496: 
1.14      xtraeme  11497:                     <dt><span class="term"><code class=
                   11498:                     "varname">REINSTALL</code></span></dt>
1.1       grant    11499: 
                   11500:                     <dd>
                   11501:                       <p>Deinstall each package before installing
1.14      xtraeme  11502:                       (making <code class=
                   11503:                       "varname">DEPENDS_TARGET</code>). This may be
1.1       grant    11504:                       necessary if the &#8220;<span class=
                   11505:                       "quote">clean-update</span>&#8221; target
                   11506:                       (see below) was called after interrupting a
1.14      xtraeme  11507:                       running <span><strong class="command">make
                   11508:                       update</strong></span>.</p>
1.1       grant    11509:                     </dd>
                   11510: 
1.14      xtraeme  11511:                     <dt><span class="term"><code class=
                   11512:                     "varname">DEPENDS_TARGET</code></span></dt>
1.1       grant    11513: 
                   11514:                     <dd>
                   11515:                       <p>Allows you to disable recursion and
                   11516:                       hardcode the target for packages. The default
                   11517:                       is &#8220;<span class=
                   11518:                       "quote">update</span>&#8221; for the update
                   11519:                       target, facilitating a recursive update of
1.14      xtraeme  11520:                       prerequisite packages. Only set <code class=
                   11521:                       "varname">DEPENDS_TARGET</code> if you want
                   11522:                       to disable recursive updates. Use
                   11523:                       <code class="varname">UPDATE_TARGET</code>
                   11524:                       instead to just set a specific target for
                   11525:                       each package to be installed during
                   11526:                       <span><strong class="command">make
                   11527:                       update</strong></span> (see above).</p>
1.1       grant    11528:                     </dd>
                   11529:                   </dl>
                   11530:                 </div>
                   11531:               </dd>
                   11532: 
                   11533:               <dt><span class="term">clean-update</span></dt>
                   11534: 
                   11535:               <dd>
                   11536:                 <p>Clean the source tree for all packages that
1.14      xtraeme  11537:                 would get updated if <span><strong class=
                   11538:                 "command">make update</strong></span> was called
                   11539:                 from the current directory. This target should not
                   11540:                 be used if the current package (or any of its
                   11541:                 depending packages) have already been de-installed
                   11542:                 (e.g., after calling <span><strong class=
                   11543:                 "command">make update</strong></span>) or you may
                   11544:                 lose some packages you intended to update. As a
                   11545:                 rule of thumb: only use this target <span class=
                   11546:                 "emphasis"><em>before</em></span> the first time
                   11547:                 you run <span><strong class="command">make
                   11548:                 update</strong></span> and only if you have a dirty
                   11549:                 package tree (e.g., if you used <code class=
                   11550:                 "varname">NOCLEAN</code>).</p>
1.1       grant    11551: 
1.47      reed     11552:                 <p>If you are unsure about whether your tree is
                   11553:                 clean, you can either perform a
1.14      xtraeme  11554:                 <span><strong class="command">make
1.47      reed     11555:                 clean</strong></span> at the top of the tree, or
                   11556:                 use the following sequence of commands from the
                   11557:                 directory of the package you want to update
                   11558:                 (<span class="emphasis"><em>before</em></span>
                   11559:                 running <span><strong class="command">make
1.14      xtraeme  11560:                 update</strong></span> for the first time,
                   11561:                 otherwise you lose all the packages you wanted to
                   11562:                 update!):</p>
1.1       grant    11563:                 <pre class="screen">
1.14      xtraeme  11564: <code class="prompt">#</code> <strong class=
                   11565: "userinput"><code>make clean-update</code></strong>
                   11566: <code class="prompt">#</code> <strong class=
                   11567: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
                   11568: <code class="prompt">#</code> <strong class=
                   11569: "userinput"><code>make update</code></strong>
1.1       grant    11570: </pre>
                   11571: 
                   11572:                 <p>The following variables can be used either on
1.45      wiz      11573:                 the command line or in <code xmlns=
                   11574:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11575:                 "filename">/etc/mk.conf</code> to alter the
                   11576:                 behaviour of <span><strong class="command">make
                   11577:                 clean-update</strong></span>:</p>
1.1       grant    11578: 
                   11579:                 <div class="variablelist">
                   11580:                   <dl>
1.14      xtraeme  11581:                     <dt><span class="term"><code class=
                   11582:                     "varname">CLEAR_DIRLIST</code></span></dt>
1.1       grant    11583: 
                   11584:                     <dd>
1.14      xtraeme  11585:                       <p>After <span><strong class="command">make
                   11586:                       clean</strong></span>, do not reconstruct the
                   11587:                       list of directories to update for this
                   11588:                       package. Only use this if
                   11589:                       <span><strong class="command">make
                   11590:                       update</strong></span> successfully installed
                   11591:                       all packages you wanted to update. Normally,
                   11592:                       this is done automatically on
                   11593:                       <span><strong class="command">make
                   11594:                       update</strong></span>, but may have been
                   11595:                       suppressed by the <code class=
                   11596:                       "varname">NOCLEAN</code> variable (see
1.1       grant    11597:                       above).</p>
                   11598:                     </dd>
                   11599:                   </dl>
                   11600:                 </div>
                   11601:               </dd>
                   11602: 
                   11603:               <dt><span class="term">info</span></dt>
                   11604: 
                   11605:               <dd>
                   11606:                 <p>This target invokes <a href=
                   11607:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   11608:                 <span class="citerefentry"><span class=
                   11609:                 "refentrytitle">pkg_info</span>(1)</span></a> for
                   11610:                 the current package. You can use this to check
                   11611:                 which version of a package is installed.</p>
                   11612:               </dd>
                   11613: 
                   11614:               <dt><span class="term">readme</span></dt>
                   11615: 
                   11616:               <dd>
1.45      wiz      11617:                 <p>This target generates a <code xmlns=
                   11618:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11619:                 "filename">README.html</code> file, which can be
1.1       grant    11620:                 viewed using a browser such as <a xmlns=
                   11621:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   11622:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45      wiz      11623:                 target="_top"><code xmlns="" class=
                   11624:                 "filename">www/mozilla</code></a> or <a xmlns=
1.20      ben      11625:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   11626:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
1.45      wiz      11627:                 target="_top"><code xmlns="" class=
                   11628:                 "filename">www/links</code></a>. The generated
                   11629:                 files contain references to any packages which are
                   11630:                 in the <code class="varname">PACKAGES</code>
                   11631:                 directory on the local host. The generated files
                   11632:                 can be made to refer to URLs based on <code class=
1.20      ben      11633:                 "varname">FTP_PKG_URL_HOST</code> and <code class=
                   11634:                 "varname">FTP_PKG_URL_DIR</code>. For example, if I
1.45      wiz      11635:                 wanted to generate <code xmlns=
                   11636:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      11637:                 "filename">README.html</code> files which pointed
                   11638:                 to binary packages on the local machine, in the
1.45      wiz      11639:                 directory <code xmlns=
                   11640:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      11641:                 "filename">/usr/packages</code>, set <code class=
                   11642:                 "varname">FTP_PKG_URL_HOST=file://localhost</code>
                   11643:                 and <code class=
                   11644:                 "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
                   11645:                 <code class="varname">${PACKAGES}</code> directory
                   11646:                 and its subdirectories will be searched for all the
                   11647:                 binary packages.</p>
1.1       grant    11648:               </dd>
                   11649: 
                   11650:               <dt><span class="term">readme-all</span></dt>
                   11651: 
                   11652:               <dd>
1.45      wiz      11653:                 <p>Use this target to create a file <code xmlns=
                   11654:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11655:                 "filename">README-all.html</code> which contains a
1.1       grant    11656:                 list of all packages currently available in the
                   11657:                 NetBSD Packages Collection, together with the
                   11658:                 category they belong to and a short description.
1.45      wiz      11659:                 This file is compiled from the <code xmlns=
                   11660:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11661:                 "filename">pkgsrc/*/README.html</code> files, so be
1.1       grant    11662:                 sure to run this <span class=
1.14      xtraeme  11663:                 "emphasis"><em>after</em></span> a
                   11664:                 <span><strong class="command">make
                   11665:                 readme</strong></span>.</p>
1.1       grant    11666:               </dd>
                   11667: 
                   11668:               <dt><span class="term">cdrom-readme</span></dt>
                   11669: 
                   11670:               <dd>
                   11671:                 <p>This is very much the same as the
                   11672:                 &#8220;<span class="quote">readme</span>&#8221;
                   11673:                 target (see above), but is to be used when
                   11674:                 generating a pkgsrc tree to be written to a CD-ROM.
1.45      wiz      11675:                 This target also produces <code xmlns=
                   11676:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11677:                 "filename">README.html</code> files, and can be
                   11678:                 made to refer to URLs based on <code class=
                   11679:                 "varname">CDROM_PKG_URL_HOST</code> and
                   11680:                 <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1       grant    11681:               </dd>
                   11682: 
                   11683:               <dt><span class="term">show-distfiles</span></dt>
                   11684: 
                   11685:               <dd>
                   11686:                 <p>This target shows which distfiles and patchfiles
1.14      xtraeme  11687:                 are needed to build the package. (<code class=
                   11688:                 "varname">DISTFILES</code> and <code class=
1.45      wiz      11689:                 "varname">PATCHFILES</code>, but not <code xmlns=
                   11690:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11691:                 "filename">patches/*</code>)</p>
1.1       grant    11692:               </dd>
                   11693: 
                   11694:               <dt><span class="term">show-downlevel</span></dt>
                   11695: 
                   11696:               <dd>
                   11697:                 <p>This target shows nothing if the package is not
                   11698:                 installed. If a version of this package is
                   11699:                 installed, but is not the version provided in this
                   11700:                 version of pkgsrc, then a warning message is
                   11701:                 displayed. This target can be used to show which of
                   11702:                 your installed packages are downlevel, and so the
                   11703:                 old versions can be deleted, and the current ones
                   11704:                 added.</p>
                   11705:               </dd>
                   11706: 
                   11707:               <dt><span class="term">show-pkgsrc-dir</span></dt>
                   11708: 
                   11709:               <dd>
                   11710:                 <p>This target shows the directory in the pkgsrc
                   11711:                 hierarchy from which the package can be built and
                   11712:                 installed. This may not be the same directory as
                   11713:                 the one from which the package was installed. This
                   11714:                 target is intended to be used by people who may
                   11715:                 wish to upgrade many packages on a single host, and
                   11716:                 can be invoked from the top-level pkgsrc Makefile
                   11717:                 by using the &#8220;<span class=
                   11718:                 "quote">show-host-specific-pkgs</span>&#8221;
                   11719:                 target.</p>
                   11720:               </dd>
                   11721: 
                   11722:               <dt><span class=
                   11723:               "term">show-installed-depends</span></dt>
                   11724: 
                   11725:               <dd>
                   11726:                 <p>This target shows which installed packages match
1.14      xtraeme  11727:                 the current package's <code class=
                   11728:                 "varname">DEPENDS</code>. Useful if out of date
1.1       grant    11729:                 dependencies are causing build problems.</p>
                   11730:               </dd>
                   11731: 
                   11732:               <dt><span class="term">check-shlibs</span></dt>
                   11733: 
                   11734:               <dd>
                   11735:                 <p>After a package is installed, check all its
                   11736:                 binaries and (on ELF platforms) shared libraries to
                   11737:                 see if they find the shared libs they need. Run by
1.14      xtraeme  11738:                 default if <code class=
                   11739:                 "varname">PKG_DEVELOPER</code> is set in
1.45      wiz      11740:                 <code xmlns=
                   11741:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11742:                 "filename">/etc/mk.conf</code>.</p>
1.1       grant    11743:               </dd>
                   11744: 
                   11745:               <dt><span class="term">print-PLIST</span></dt>
                   11746: 
                   11747:               <dd>
                   11748:                 <p>After a &#8220;<span class="quote">make
                   11749:                 install</span>&#8221; from a new or upgraded pkg,
                   11750:                 this prints out an attempt to generate a new
1.45      wiz      11751:                 <code xmlns=
                   11752:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11753:                 "filename">PLIST</code> from a <span><strong class=
                   11754:                 "command">find -newer
1.14      xtraeme  11755:                 work/.extract_done</strong></span>. An attempt is
                   11756:                 made to care for shared libs etc., but it is
1.1       grant    11757:                 <span class="emphasis"><em>strongly</em></span>
                   11758:                 recommended to review the result before putting it
1.45      wiz      11759:                 into <code xmlns=
                   11760:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11761:                 "filename">PLIST</code>. On upgrades, it's useful
                   11762:                 to diff the output of this command against an
                   11763:                 already existing <code xmlns=
                   11764:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11765:                 "filename">PLIST</code> file.</p>
1.1       grant    11766: 
1.24      wiz      11767:                 <p>If the package installs files via <a href=
                   11768:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   11769:                 <span class="citerefentry"><span class=
                   11770:                 "refentrytitle">tar</span>(1)</span></a> or other
                   11771:                 methods that don't update file access times, be
                   11772:                 sure to add these files manually to your
1.45      wiz      11773:                 <code xmlns=
                   11774:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11775:                 "filename">PLIST</code>, as the &#8220;<span class=
                   11776:                 "quote">find -newer</span>&#8221; command used by
                   11777:                 this target won't catch them!</p>
1.1       grant    11778: 
                   11779:                 <p>See <a href="#print-PLIST" title=
1.38      dillo    11780:                 "10.3.&nbsp;Tweaking output of make print-PLIST">Section&nbsp;10.3,
1.14      xtraeme  11781:                 &#8220;Tweaking output of <span><strong class=
                   11782:                 "command">make
                   11783:                 print-PLIST</strong></span>&#8221;</a> for more
                   11784:                 information on this target.</p>
1.1       grant    11785:               </dd>
                   11786: 
                   11787:               <dt><span class="term">bulk-package</span></dt>
                   11788: 
                   11789:               <dd>
                   11790:                 <p>Used to do bulk builds. If an appropriate binary
                   11791:                 package already exists, no action is taken. If not,
                   11792:                 this target will compile, install and package it
1.47      reed     11793:                 (and its depends, if <code class=
1.14      xtraeme  11794:                 "varname">PKG_DEPENDS</code> is set properly. See
1.1       grant    11795:                 <a href="#binary.configuration" title=
1.38      dillo    11796:                 "6.3.1.&nbsp;Configuration">Section&nbsp;6.3.1,
1.47      reed     11797:                 &#8220;Configuration&#8221;</a>). After creating
                   11798:                 the binary package, the sources, the just-installed
                   11799:                 package and its required packages are removed,
1.1       grant    11800:                 preserving free disk space.</p>
                   11801: 
                   11802:                 <p><span class="emphasis"><em>Beware that this
                   11803:                 target may deinstall all packages installed on a
                   11804:                 system!</em></span></p>
                   11805:               </dd>
                   11806: 
                   11807:               <dt><span class="term">bulk-install</span></dt>
                   11808: 
                   11809:               <dd>
                   11810:                 <p>Used during bulk-installs to install required
1.47      reed     11811:                 packages. If an up-to-date binary package is
1.1       grant    11812:                 available, it will be installed via <a href=
                   11813:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   11814:                 <span class="citerefentry"><span class=
                   11815:                 "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14      xtraeme  11816:                 not, <span><strong class="command">make
                   11817:                 bulk-package</strong></span> will be executed, but
1.47      reed     11818:                 the installed binary won't be removed.</p>
1.1       grant    11819: 
                   11820:                 <p>A binary package is considered
1.47      reed     11821:                 &#8220;<span class="quote">up-to-date</span>&#8221;
1.1       grant    11822:                 to be installed via <a href=
                   11823:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   11824:                 <span class="citerefentry"><span class=
                   11825:                 "refentrytitle">pkg_add</span>(1)</span></a>
                   11826:                 if:</p>
                   11827: 
                   11828:                 <div class="itemizedlist">
                   11829:                   <ul type="disc">
                   11830:                     <li>
1.45      wiz      11831:                       <p>None of the package's files (<code xmlns=
                   11832:                       "http://www.w3.org/TR/xhtml1/transitional"
                   11833:                       class="filename">Makefile</code>, ...) were
1.14      xtraeme  11834:                       modified since it was built.</p>
1.1       grant    11835:                     </li>
                   11836: 
                   11837:                     <li>
                   11838:                       <p>None of the package's required (binary)
                   11839:                       packages were modified since it was
                   11840:                       built.</p>
                   11841:                     </li>
                   11842:                   </ul>
                   11843:                 </div>
                   11844: 
                   11845:                 <p><span class="emphasis"><em>Beware that this
                   11846:                 target may deinstall all packages installed on a
                   11847:                 system!</em></span></p>
                   11848:               </dd>
                   11849:             </dl>
                   11850:           </div>
                   11851:         </div>
                   11852:       </div>
                   11853: 
1.67      hubertf  11854:       <div class="chapter" lang="en">
1.1       grant    11855:         <div class="titlepage">
                   11856:           <div>
                   11857:             <div>
1.67      hubertf  11858:               <h2 class="title"><a name=
1.68      rillig   11859:               "tools"></a>Chapter&nbsp;15.&nbsp;Tools needed for
                   11860:               building or running</h2>
                   11861:             </div>
                   11862:           </div>
                   11863:         </div>
                   11864: 
                   11865:         <div class="toc">
                   11866:           <p><b>Table of Contents</b></p>
                   11867: 
                   11868:           <dl>
                   11869:             <dt><span class="sect1"><a href="#pkgsrc-tools">15.1.
                   11870:             Tools for pkgsrc builds</a></span></dt>
                   11871: 
                   11872:             <dt><span class="sect1"><a href="#package-tools">15.2.
                   11873:             Tools needed by packages</a></span></dt>
                   11874: 
                   11875:             <dt><span class="sect1"><a href="#platform-tools">15.3.
                   11876:             Tools provided by platforms</a></span></dt>
                   11877:           </dl>
                   11878:         </div>
                   11879: 
                   11880:         <p>The <code class="varname">USE_TOOLS</code> definition is
                   11881:         used both internally by pkgsrc and also for individual
                   11882:         packages to define what commands are needed for building a
                   11883:         package (like <code class="varname">BUILD_DEPENDS</code>)
                   11884:         or for later run-time of an installed packaged (such as
                   11885:         <code class="varname">DEPENDS</code>). If the native system
                   11886:         provides an adequate tool, then in many cases, a pkgsrc
                   11887:         package will not be used.</p>
                   11888: 
                   11889:         <p>When building a package, the replacement tools are made
                   11890:         available in a directory (as symlinks or wrapper scripts)
                   11891:         that is early in the executable search path. Just like the
                   11892:         buildlink system, this helps with consistent builds.</p>
                   11893: 
                   11894:         <p>A tool may be needed to help build a specific package.
                   11895:         For example, perl, GNU make (gmake) or yacc may be
                   11896:         needed.</p>
                   11897: 
                   11898:         <p>Also a tool may be needed, for example, because the
                   11899:         native system's supplied tool may be inefficient for
                   11900:         building a package with pkgsrc. For example, a package may
                   11901:         need GNU awk, bison (instead of yacc) or a better sed.</p>
                   11902: 
                   11903:         <p>The tools used by a package can be listed by running
                   11904:         <span><strong class="command">make
                   11905:         show-tools</strong></span>.</p>
                   11906: 
                   11907:         <div class="sect1" lang="en">
                   11908:           <div class="titlepage">
                   11909:             <div>
                   11910:               <div>
                   11911:                 <h2 class="title" style="clear: both"><a name=
                   11912:                 "pkgsrc-tools"></a>15.1.&nbsp;Tools for pkgsrc
                   11913:                 builds</h2>
                   11914:               </div>
                   11915:             </div>
                   11916:           </div>
                   11917: 
                   11918:           <p>The default set of tools used by pkgsrc is defined in
                   11919:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   11920:           class="filename">bsd.pkg.mk</code>. This includes
                   11921:           standard Unix tools, such as: <span><strong class=
                   11922:           "command">cat</strong></span>, <span><strong class=
                   11923:           "command">awk</strong></span>, <span><strong class=
                   11924:           "command">chmod</strong></span>, <span><strong class=
                   11925:           "command">test</strong></span>, and so on. These can be
                   11926:           seen by running: <span><strong class="command">make
                   11927:           show-var VARNAME=USE_TOOLS</strong></span>.</p>
                   11928: 
                   11929:           <p>If a package needs a specific program to build then
                   11930:           the <code class="varname">USE_TOOLS</code> variable can
                   11931:           be used to define the tools needed.</p>
                   11932:         </div>
                   11933: 
                   11934:         <div class="sect1" lang="en">
                   11935:           <div class="titlepage">
                   11936:             <div>
                   11937:               <div>
                   11938:                 <h2 class="title" style="clear: both"><a name=
                   11939:                 "package-tools"></a>15.2.&nbsp;Tools needed by
                   11940:                 packages</h2>
                   11941:               </div>
                   11942:             </div>
                   11943:           </div>
                   11944: 
                   11945:           <p>In the following examples, the :pkgsrc means to use
                   11946:           the pkgsrc version and not the native version for a build
                   11947:           dependency. And the :run means that it is used for a
                   11948:           run-time dependencies also (and becomes a DEPENDS). The
                   11949:           default is a build dependency which can be set with
                   11950:           :build. (So in this example, it is the same as
                   11951:           gmake:build and pkg-config:build.)</p>
                   11952:           <pre class="programlisting">
                   11953: USE_TOOLS+=     mktemp:pkgsrc
                   11954: USE_TOOLS+=     gmake perl:run pkg-config
                   11955: </pre>
                   11956: 
                   11957:           <p>When using the tools framework, a <code class=
                   11958:           "varname">TOOLS_PATH.foo</code> variable is defined which
                   11959:           contains the full path to the appropriate tool. For
                   11960:           example, <code class="varname">TOOLS_PATH.bash</code>
                   11961:           could be &#8220;<span class=
                   11962:           "quote">/bin/bash</span>&#8221; on Linux systems.</p>
                   11963: 
                   11964:           <p>If you always need a pkgsrc version of the tool at
                   11965:           run-time, then just use <code class=
                   11966:           "varname">DEPENDS</code> instead.</p>
                   11967:         </div>
                   11968: 
                   11969:         <div class="sect1" lang="en">
                   11970:           <div class="titlepage">
                   11971:             <div>
                   11972:               <div>
                   11973:                 <h2 class="title" style="clear: both"><a name=
                   11974:                 "platform-tools"></a>15.3.&nbsp;Tools provided by
                   11975:                 platforms</h2>
                   11976:               </div>
                   11977:             </div>
                   11978:           </div>
                   11979: 
                   11980:           <p>When improving or porting pkgsrc to a new platform,
                   11981:           have a look at (or create) the corresponding platform
                   11982:           specific make file fragment under <code xmlns=
                   11983:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   11984:           "filename">pkgsrc/mk/tools/tools.${OPSYS}.mk</code> which
                   11985:           defines the name of the common tools. For example:</p>
                   11986:           <pre class="programlisting">
                   11987: .if exists(/usr/bin/bzcat)
                   11988: TOOLS_PLATFORM.bzcat?=          /usr/bin/bzcat
                   11989: .elif exists(/usr/bin/bzip2)
                   11990: TOOLS_PLATFORM.bzcat?=          /usr/bin/bzip2 -cd
                   11991: .endif
                   11992: 
                   11993: TOOLS_PLATFORM.true?=           true                    # shell builtin
                   11994: </pre>
                   11995:         </div>
                   11996:       </div>
                   11997: 
                   11998:       <div class="chapter" lang="en">
                   11999:         <div class="titlepage">
                   12000:           <div>
                   12001:             <div>
                   12002:               <h2 class="title"><a name=
                   12003:               "fixes"></a>Chapter&nbsp;16.&nbsp;Making your package
1.55      rillig   12004:               work</h2>
1.1       grant    12005:             </div>
                   12006:           </div>
                   12007:         </div>
                   12008: 
                   12009:         <div class="toc">
                   12010:           <p><b>Table of Contents</b></p>
                   12011: 
                   12012:           <dl>
1.30      wiz      12013:             <dt><span class="sect1"><a href=
1.68      rillig   12014:             "#general-operation">16.1. General
1.30      wiz      12015:             operation</a></span></dt>
1.1       grant    12016: 
                   12017:             <dd>
                   12018:               <dl>
                   12019:                 <dt><span class="sect2"><a href=
1.68      rillig   12020:                 "#pulling-vars-from-etc-mk.conf">16.1.1. How to
1.30      wiz      12021:                 pull in variables from /etc/mk.conf</a></span></dt>
1.1       grant    12022: 
                   12023:                 <dt><span class="sect2"><a href=
1.68      rillig   12024:                 "#where-to-install-documentation">16.1.2. Where to
1.31      wiz      12025:                 install documentation</a></span></dt>
                   12026: 
                   12027:                 <dt><span class="sect2"><a href=
1.68      rillig   12028:                 "#restricted-packages">16.1.3. Restricted
1.1       grant    12029:                 packages</a></span></dt>
                   12030: 
                   12031:                 <dt><span class="sect2"><a href=
1.68      rillig   12032:                 "#dependencies">16.1.4. Handling
1.1       grant    12033:                 dependencies</a></span></dt>
                   12034: 
                   12035:                 <dt><span class="sect2"><a href=
1.68      rillig   12036:                 "#conflicts">16.1.5. Handling conflicts with other
1.1       grant    12037:                 packages</a></span></dt>
                   12038: 
                   12039:                 <dt><span class="sect2"><a href=
1.68      rillig   12040:                 "#not-building-packages">16.1.6. Packages that
1.30      wiz      12041:                 cannot or should not be built</a></span></dt>
1.1       grant    12042: 
                   12043:                 <dt><span class="sect2"><a href=
1.68      rillig   12044:                 "#undeletable-packages">16.1.7. Packages which
1.30      wiz      12045:                 should not be deleted, once
                   12046:                 installed</a></span></dt>
1.1       grant    12047: 
                   12048:                 <dt><span class="sect2"><a href=
1.68      rillig   12049:                 "#security-handling">16.1.8. Handling packages with
1.1       grant    12050:                 security problems</a></span></dt>
                   12051: 
                   12052:                 <dt><span class="sect2"><a href=
1.68      rillig   12053:                 "#compiler-bugs">16.1.9. How to handle compiler
1.1       grant    12054:                 bugs</a></span></dt>
                   12055: 
                   12056:                 <dt><span class="sect2"><a href=
1.68      rillig   12057:                 "#bumping-pkgrevision">16.1.10. How to handle
1.30      wiz      12058:                 incrementing versions when fixing an existing
1.1       grant    12059:                 package</a></span></dt>
                   12060: 
                   12061:                 <dt><span class="sect2"><a href=
1.68      rillig   12062:                 "#portability-of-packages">16.1.11. Portability of
1.1       grant    12063:                 packages</a></span></dt>
                   12064:               </dl>
                   12065:             </dd>
                   12066: 
1.30      wiz      12067:             <dt><span class="sect1"><a href=
1.68      rillig   12068:             "#downloading-issues">16.2. Possible downloading
1.30      wiz      12069:             issues</a></span></dt>
1.1       grant    12070: 
                   12071:             <dd>
                   12072:               <dl>
                   12073:                 <dt><span class="sect2"><a href=
1.68      rillig   12074:                 "#no-plain-download">16.2.1. Packages whose
1.30      wiz      12075:                 distfiles aren't available for plain
1.1       grant    12076:                 downloading</a></span></dt>
                   12077: 
                   12078:                 <dt><span class="sect2"><a href=
1.68      rillig   12079:                 "#modified-distfiles-same-name">16.2.2. How to
1.30      wiz      12080:                 handle modified distfiles with the 'old'
                   12081:                 name</a></span></dt>
1.1       grant    12082:               </dl>
                   12083:             </dd>
                   12084: 
1.30      wiz      12085:             <dt><span class="sect1"><a href=
1.68      rillig   12086:             "#configuration-gotchas">16.3. Configuration
1.30      wiz      12087:             gotchas</a></span></dt>
1.1       grant    12088: 
                   12089:             <dd>
                   12090:               <dl>
                   12091:                 <dt><span class="sect2"><a href=
1.68      rillig   12092:                 "#fixes.libtool">16.3.1. Shared libraries -
1.1       grant    12093:                 libtool</a></span></dt>
                   12094: 
                   12095:                 <dt><span class="sect2"><a href=
1.68      rillig   12096:                 "#using-libtool">16.3.2. Using libtool on GNU
1.30      wiz      12097:                 packages that already support
                   12098:                 libtool</a></span></dt>
1.1       grant    12099: 
                   12100:                 <dt><span class="sect2"><a href=
1.68      rillig   12101:                 "#autoconf-automake">16.3.3. GNU
1.1       grant    12102:                 Autoconf/Automake</a></span></dt>
                   12103:               </dl>
                   12104:             </dd>
                   12105: 
1.68      rillig   12106:             <dt><span class="sect1"><a href="#fixes-build">16.4.
1.55      rillig   12107:             Building the package</a></span></dt>
1.1       grant    12108: 
                   12109:             <dd>
                   12110:               <dl>
                   12111:                 <dt><span class="sect2"><a href=
1.68      rillig   12112:                 "#cpp-defines">16.4.1. CPP defines</a></span></dt>
1.51      rillig   12113: 
1.60      rillig   12114:                 <dt><span class="sect2"><a href=
1.68      rillig   12115:                 "#cpp-list-examples">16.4.2. Examples of CPP
1.60      rillig   12116:                 defines for some platforms</a></span></dt>
                   12117: 
1.68      rillig   12118:                 <dt><span class="sect2"><a href="#cpp-list">16.4.3.
1.51      rillig   12119:                 Getting a list of CPP defines</a></span></dt>
1.1       grant    12120:               </dl>
                   12121:             </dd>
                   12122: 
1.30      wiz      12123:             <dt><span class="sect1"><a href=
1.68      rillig   12124:             "#package-specific-actions">16.5. Package specific
1.30      wiz      12125:             actions</a></span></dt>
1.1       grant    12126: 
                   12127:             <dd>
                   12128:               <dl>
                   12129:                 <dt><span class="sect2"><a href=
1.68      rillig   12130:                 "#user-interaction">16.5.1. User
1.2       hubertf  12131:                 interaction</a></span></dt>
1.1       grant    12132: 
                   12133:                 <dt><span class="sect2"><a href=
1.68      rillig   12134:                 "#handling-licenses">16.5.2. Handling
1.1       grant    12135:                 licenses</a></span></dt>
                   12136: 
                   12137:                 <dt><span class="sect2"><a href=
1.68      rillig   12138:                 "#installing-score-files">16.5.3. Installing score
1.1       grant    12139:                 files</a></span></dt>
                   12140: 
                   12141:                 <dt><span class="sect2"><a href=
1.68      rillig   12142:                 "#perl-scripts">16.5.4. Packages containing perl
1.1       grant    12143:                 scripts</a></span></dt>
                   12144: 
                   12145:                 <dt><span class="sect2"><a href=
1.68      rillig   12146:                 "#hardcoded-paths">16.5.5. Packages with hardcoded
1.30      wiz      12147:                 paths to other interpreters</a></span></dt>
1.1       grant    12148: 
                   12149:                 <dt><span class="sect2"><a href=
1.68      rillig   12150:                 "#perl-modules">16.5.6. Packages installing perl
1.1       grant    12151:                 modules</a></span></dt>
                   12152: 
                   12153:                 <dt><span class="sect2"><a href=
1.68      rillig   12154:                 "#faq.info-files">16.5.7. Packages installing info
1.1       grant    12155:                 files</a></span></dt>
                   12156: 
1.68      rillig   12157:                 <dt><span class="sect2"><a href="#manpages">16.5.8.
1.57      minskim  12158:                 Packages installing man pages</a></span></dt>
                   12159: 
1.1       grant    12160:                 <dt><span class="sect2"><a href=
1.68      rillig   12161:                 "#gconf2-data-files">16.5.9. Packages installing
1.30      wiz      12162:                 GConf2 data files</a></span></dt>
1.1       grant    12163: 
                   12164:                 <dt><span class="sect2"><a href=
1.68      rillig   12165:                 "#scrollkeeper-data-files">16.5.10. Packages
1.30      wiz      12166:                 installing scrollkeeper data files</a></span></dt>
1.1       grant    12167: 
                   12168:                 <dt><span class="sect2"><a href=
1.68      rillig   12169:                 "#x11-fonts">16.5.11. Packages installing X11
1.1       grant    12170:                 fonts</a></span></dt>
                   12171: 
                   12172:                 <dt><span class="sect2"><a href=
1.68      rillig   12173:                 "#gtk2-modules">16.5.12. Packages installing GTK2
1.1       grant    12174:                 modules</a></span></dt>
                   12175: 
                   12176:                 <dt><span class="sect2"><a href=
1.68      rillig   12177:                 "#sgml-xml-data">16.5.13. Packages installing SGML
1.30      wiz      12178:                 or XML data</a></span></dt>
1.1       grant    12179: 
                   12180:                 <dt><span class="sect2"><a href=
1.68      rillig   12181:                 "#mime-database">16.5.14. Packages installing
1.1       grant    12182:                 extensions to the MIME database</a></span></dt>
                   12183: 
                   12184:                 <dt><span class="sect2"><a href=
1.68      rillig   12185:                 "#intltool">16.5.15. Packages using
1.1       grant    12186:                 intltool</a></span></dt>
1.18      xtraeme  12187: 
                   12188:                 <dt><span class="sect2"><a href=
1.68      rillig   12189:                 "#startup-scripts">16.5.16. Packages installing
1.30      wiz      12190:                 startup scripts</a></span></dt>
1.57      minskim  12191: 
                   12192:                 <dt><span class="sect2"><a href=
1.68      rillig   12193:                 "#tex-packages">16.5.17. Packages installing TeX
1.57      minskim  12194:                 modules</a></span></dt>
1.1       grant    12195:               </dl>
                   12196:             </dd>
                   12197: 
1.30      wiz      12198:             <dt><span class="sect1"><a href=
1.68      rillig   12199:             "#feedback-to-author">16.6. Feedback to the
1.30      wiz      12200:             author</a></span></dt>
1.1       grant    12201:           </dl>
                   12202:         </div>
                   12203: 
1.67      hubertf  12204:         <div class="sect1" lang="en">
1.1       grant    12205:           <div class="titlepage">
                   12206:             <div>
                   12207:               <div>
                   12208:                 <h2 class="title" style="clear: both"><a name=
1.68      rillig   12209:                 "general-operation"></a>16.1.&nbsp;General
1.1       grant    12210:                 operation</h2>
                   12211:               </div>
                   12212:             </div>
                   12213:           </div>
                   12214: 
1.67      hubertf  12215:           <div class="sect2" lang="en">
1.1       grant    12216:             <div class="titlepage">
                   12217:               <div>
                   12218:                 <div>
1.30      wiz      12219:                   <h3 class="title"><a name=
1.68      rillig   12220:                   "pulling-vars-from-etc-mk.conf"></a>16.1.1.&nbsp;How
1.30      wiz      12221:                   to pull in variables from /etc/mk.conf</h3>
1.1       grant    12222:                 </div>
                   12223:               </div>
                   12224:             </div>
                   12225: 
                   12226:             <p>The problem with package-defined variables that can
1.14      xtraeme  12227:             be overridden via <code class="varname">MAKECONF</code>
1.45      wiz      12228:             or <code xmlns=
                   12229:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12230:             "filename">/etc/mk.conf</code> is that <a href=
1.1       grant    12231:             "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   12232:             <span class="citerefentry"><span class=
                   12233:             "refentrytitle">make</span>(1)</span></a> expands a
1.47      reed     12234:             variable as it is used, but evaluates preprocessor-like
1.1       grant    12235:             statements (.if, .ifdef and .ifndef) as they are read.
1.14      xtraeme  12236:             So, to use any variable (which may be set in
1.45      wiz      12237:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12238:             class="filename">/etc/mk.conf</code>) in one of the
                   12239:             .if* statements, the file <code xmlns=
                   12240:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12241:             "filename">/etc/mk.conf</code> must be included before
1.1       grant    12242:             that .if* statement.</p>
                   12243: 
1.47      reed     12244:             <p>Rather than having a number of ad-hoc ways of
1.45      wiz      12245:             including <code xmlns=
                   12246:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12247:             "filename">/etc/mk.conf</code>, should it exist, or
                   12248:             <code class="varname">MAKECONF</code>, should it exist,
                   12249:             include the <code xmlns=
                   12250:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12251:             "filename">pkgsrc/mk/bsd.prefs.mk</code> file in the
                   12252:             package Makefile before any preprocessor-like .if,
                   12253:             .ifdef, or .ifndef statements:</p>
1.1       grant    12254:             <pre class="programlisting">
1.51      rillig   12255:     .include "../../mk/bsd.prefs.mk"
                   12256: 
1.1       grant    12257:     .if defined(USE_MENUS)
1.51      rillig   12258:     # ...
1.1       grant    12259:     .endif
                   12260: </pre>
                   12261: 
1.14      xtraeme  12262:             <p>If you wish to set the <code class=
1.45      wiz      12263:             "varname">CFLAGS</code> variable in <code xmlns=
                   12264:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     12265:             "filename">/etc/mk.conf</code>, please make sure to
1.1       grant    12266:             use:</p>
                   12267:             <pre class="programlisting">
1.51      rillig   12268:     CFLAGS+=  -your -flags
1.1       grant    12269: </pre>
                   12270: 
1.14      xtraeme  12271:             <p>Using <code class="varname">CFLAGS=</code> (i.e.
                   12272:             without the &#8220;<span class="quote">+</span>&#8221;)
                   12273:             may lead to problems with packages that need to add
                   12274:             their own flags. Also, you may want to take a look at
                   12275:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1       grant    12276:             href=
                   12277:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45      wiz      12278:             target="_top"><code xmlns="" class=
                   12279:             "filename">devel/cpuflags</code></a> package if you're
1.20      ben      12280:             interested in optimization for the current CPU.</p>
1.1       grant    12281:           </div>
                   12282: 
1.67      hubertf  12283:           <div class="sect2" lang="en">
1.1       grant    12284:             <div class="titlepage">
                   12285:               <div>
                   12286:                 <div>
1.31      wiz      12287:                   <h3 class="title"><a name=
1.68      rillig   12288:                   "where-to-install-documentation"></a>16.1.2.&nbsp;Where
1.31      wiz      12289:                   to install documentation</h3>
                   12290:                 </div>
                   12291:               </div>
                   12292:             </div>
                   12293: 
1.45      wiz      12294:             <p>Documentation should be installed into <code xmlns=
                   12295:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.31      wiz      12296:             "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
1.45      wiz      12297:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12298:             class="filename">${PREFIX}/share/doc/${PKGNAME}</code>
                   12299:             (the latter includes the version number of the
                   12300:             package).</p>
1.31      wiz      12301:           </div>
                   12302: 
1.67      hubertf  12303:           <div class="sect2" lang="en">
1.31      wiz      12304:             <div class="titlepage">
                   12305:               <div>
                   12306:                 <div>
1.67      hubertf  12307:                   <h3 class="title"><a name=
1.68      rillig   12308:                   "restricted-packages"></a>16.1.3.&nbsp;Restricted
1.1       grant    12309:                   packages</h3>
                   12310:                 </div>
                   12311:               </div>
                   12312:             </div>
                   12313: 
                   12314:             <p>Some licenses restrict how software may be
                   12315:             re-distributed. In order to satisfy these restrictions,
                   12316:             the package system defines five make variables that can
                   12317:             be set to note these restrictions:</p>
                   12318: 
                   12319:             <div class="itemizedlist">
                   12320:               <ul type="disc">
                   12321:                 <li>
1.14      xtraeme  12322:                   <p><code class="varname">RESTRICTED</code></p>
1.1       grant    12323: 
                   12324:                   <p>This variable should be set whenever a
                   12325:                   restriction exists (regardless of its kind). Set
                   12326:                   this variable to a string containing the reason
                   12327:                   for the restriction.</p>
                   12328:                 </li>
                   12329: 
                   12330:                 <li>
1.14      xtraeme  12331:                   <p><code class=
                   12332:                   "varname">NO_BIN_ON_CDROM</code></p>
1.1       grant    12333: 
                   12334:                   <p>Binaries may not be placed on CD-ROM. Set this
1.14      xtraeme  12335:                   variable to <code class=
                   12336:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    12337:                   package may not be included on a CD-ROM.</p>
                   12338:                 </li>
                   12339: 
                   12340:                 <li>
1.14      xtraeme  12341:                   <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1       grant    12342: 
                   12343:                   <p>Binaries may not be placed on an FTP server.
1.14      xtraeme  12344:                   Set this variable to <code class=
                   12345:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    12346:                   package may not not be made available on the
                   12347:                   Internet.</p>
                   12348:                 </li>
                   12349: 
                   12350:                 <li>
1.14      xtraeme  12351:                   <p><code class=
                   12352:                   "varname">NO_SRC_ON_CDROM</code></p>
1.1       grant    12353: 
                   12354:                   <p>Distfiles may not be placed on CD-ROM. Set
1.14      xtraeme  12355:                   this variable to <code class=
                   12356:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    12357:                   of the source code or other distfile(s) is not
                   12358:                   allowed on CD-ROMs.</p>
                   12359:                 </li>
                   12360: 
                   12361:                 <li>
1.14      xtraeme  12362:                   <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1       grant    12363: 
                   12364:                   <p>Distfiles may not be placed on FTP. Set this
1.14      xtraeme  12365:                   variable to <code class=
                   12366:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    12367:                   of the source code or other distfile(s) via the
                   12368:                   Internet is not allowed.</p>
                   12369:                 </li>
                   12370:               </ul>
                   12371:             </div>
                   12372: 
1.14      xtraeme  12373:             <p>Please note that the use of <code class=
                   12374:             "varname">NO_PACKAGE</code>, <code class=
                   12375:             "varname">IGNORE</code>, <code class=
                   12376:             "varname">NO_CDROM</code>, or other generic make
1.1       grant    12377:             variables to denote restrictions is deprecated, because
                   12378:             they unconditionally prevent users from generating
                   12379:             binary packages!</p>
                   12380:           </div>
                   12381: 
1.67      hubertf  12382:           <div class="sect2" lang="en">
1.1       grant    12383:             <div class="titlepage">
                   12384:               <div>
                   12385:                 <div>
1.67      hubertf  12386:                   <h3 class="title"><a name=
1.68      rillig   12387:                   "dependencies"></a>16.1.4.&nbsp;Handling
1.1       grant    12388:                   dependencies</h3>
                   12389:                 </div>
                   12390:               </div>
                   12391:             </div>
                   12392: 
                   12393:             <p>Your package may depend on some other package being
                   12394:             present - and there are various ways of expressing this
1.14      xtraeme  12395:             dependency. pkgsrc supports the <code class=
                   12396:             "varname">BUILD_DEPENDS</code> and <code class=
1.47      reed     12397:             "varname">DEPENDS</code> definitions, the <code class=
                   12398:             "varname">USE_TOOLS</code> definition, as well as
1.45      wiz      12399:             dependencies via <code xmlns=
                   12400:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12401:             "filename">buildlink3.mk</code>, which is the preferred
1.1       grant    12402:             way to handle dependencies, and which uses the
                   12403:             variables named above. See <a href="#buildlink" title=
1.38      dillo    12404:             "Chapter&nbsp;11.&nbsp;Buildlink methodology">Chapter&nbsp;11,
1.1       grant    12405:             <i>Buildlink methodology</i></a> for more
                   12406:             information.</p>
                   12407: 
                   12408:             <p>The basic difference between the two variables is as
1.14      xtraeme  12409:             follows: The <code class="varname">DEPENDS</code>
1.1       grant    12410:             definition registers that pre-requisite in the binary
                   12411:             package so it will be pulled in when the binary package
1.14      xtraeme  12412:             is later installed, whilst the <code class=
                   12413:             "varname">BUILD_DEPENDS</code> definition does not,
1.1       grant    12414:             marking a dependency that is only needed for building
                   12415:             the package.</p>
                   12416: 
                   12417:             <p>This means that if you only need a package present
                   12418:             whilst you are building, it should be noted as a
1.14      xtraeme  12419:             <code class="varname">BUILD_DEPENDS</code>.</p>
1.1       grant    12420: 
1.14      xtraeme  12421:             <p>The format for a <code class=
                   12422:             "varname">BUILD_DEPENDS</code> and a <code class=
                   12423:             "varname">DEPENDS</code> definition is:</p>
1.1       grant    12424:             <pre class="programlisting">
1.51      rillig   12425:     &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
1.1       grant    12426: </pre>
                   12427: 
                   12428:             <p>Please note that the &#8220;<span class=
                   12429:             "quote">pre-req-package-name</span>&#8221; may include
1.18      xtraeme  12430:             any of the wildcard version numbers recognized by
1.1       grant    12431:             <a href=
                   12432:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   12433:             <span class="citerefentry"><span class=
                   12434:             "refentrytitle">pkg_info</span>(1)</span></a>.</p>
                   12435: 
                   12436:             <div class="orderedlist">
                   12437:               <ol type="1">
                   12438:                 <li>
                   12439:                   <p>If your package needs another package's
                   12440:                   binaries or libraries to build or run, and if
1.45      wiz      12441:                   that package has a <code xmlns=
                   12442:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12443:                   "filename">buildlink3.mk</code> file available,
                   12444:                   use it:</p>
1.1       grant    12445:                   <pre class="programlisting">
                   12446:     .include "../../graphics/jpeg/buildlink3.mk"
                   12447: </pre>
                   12448:                 </li>
                   12449: 
                   12450:                 <li>
                   12451:                   <p>If your package needs to use another package
1.45      wiz      12452:                   to build itself and there is no <code xmlns=
                   12453:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12454:                   "filename">buildlink3.mk</code> file available,
                   12455:                   use the <code class=
                   12456:                   "varname">BUILD_DEPENDS</code> definition:</p>
1.1       grant    12457:                   <pre class="programlisting">
1.51      rillig   12458:     BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
1.1       grant    12459: </pre>
                   12460:                 </li>
                   12461: 
                   12462:                 <li>
                   12463:                   <p>If your package needs a library with which to
1.45      wiz      12464:                   link and again there is no <code xmlns=
                   12465:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12466:                   "filename">buildlink3.mk</code> file available,
                   12467:                   this is specified using the <code class=
                   12468:                   "varname">DEPENDS</code> definition. An example
                   12469:                   of this is the <a xmlns=
1.1       grant    12470:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   12471:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45      wiz      12472:                   target="_top"><code xmlns="" class=
                   12473:                   "filename">print/lyx</code></a> package, which
                   12474:                   uses the xpm library, version 3.4j to build:</p>
1.1       grant    12475:                   <pre class="programlisting">
1.51      rillig   12476:     DEPENDS+=       xpm-3.4j:../../graphics/xpm
1.1       grant    12477: </pre>
                   12478: 
                   12479:                   <p>You can also use wildcards in package
                   12480:                   dependences:</p>
                   12481:                   <pre class="programlisting">
1.51      rillig   12482:     DEPENDS+=       xpm-[0-9]*:../../graphics/xpm
1.1       grant    12483: </pre>
                   12484: 
                   12485:                   <p>Note that such wildcard dependencies are
                   12486:                   retained when creating binary packages. The
                   12487:                   dependency is checked when installing the binary
                   12488:                   package and any package which matches the pattern
                   12489:                   will be used. Wildcard dependencies should be
                   12490:                   used with care.</p>
                   12491: 
                   12492:                   <p>The &#8220;<span class=
                   12493:                   "quote">-[0-9]*</span>&#8221; should be used
                   12494:                   instead of &#8220;<span class=
                   12495:                   "quote">-*</span>&#8221; to avoid potentially
                   12496:                   ambiguous matches such as &#8220;<span class=
                   12497:                   "quote">tk-postgresql</span>&#8221; matching a
                   12498:                   &#8220;<span class="quote">tk-*</span>&#8221;
1.14      xtraeme  12499:                   <code class="varname">DEPENDS</code>.</p>
1.1       grant    12500: 
                   12501:                   <p>Wildcards can also be used to specify that a
                   12502:                   package will only build against a certain minimum
                   12503:                   version of a pre-requisite:</p>
                   12504:                   <pre class="programlisting">
1.51      rillig   12505:     DEPENDS+=       tiff&gt;=3.5.4:../../graphics/tiff
1.1       grant    12506: </pre>
                   12507: 
                   12508:                   <p>This means that the package will build against
                   12509:                   version 3.5.4 of the tiff library or newer. Such
                   12510:                   a dependency may be warranted if, for example,
                   12511:                   the API of the library has changed with version
                   12512:                   3.5.4 and a package would not compile against an
                   12513:                   earlier version of tiff.</p>
                   12514: 
                   12515:                   <p>Please note that such dependencies should only
                   12516:                   be updated if a package requires a newer
                   12517:                   pre-requisite, but not to denote recommendations
                   12518:                   such as security updates or ABI changes that do
                   12519:                   not prevent a package from building correctly.
                   12520:                   Such recommendations can be expressed using
1.14      xtraeme  12521:                   <code class="varname">RECOMMENDED</code>:</p>
1.1       grant    12522:                   <pre class="programlisting">
1.51      rillig   12523:     RECOMMENDED+=   tiff&gt;=3.6.1:../../graphics/tiff
1.1       grant    12524: </pre>
                   12525: 
1.14      xtraeme  12526:                   <p>In addition to the above <code class=
                   12527:                   "varname">DEPENDS</code> line, this denotes that
1.1       grant    12528:                   while a package will build against
                   12529:                   tiff&gt;=3.5.4, at least version 3.6.1 is
1.14      xtraeme  12530:                   recommended. <code class=
                   12531:                   "varname">RECOMMENDED</code> entries will be
                   12532:                   turned into dependencies unless explicitly
                   12533:                   ignored (in which case a warning will be
1.36      wiz      12534:                   printed).</p>
                   12535: 
                   12536:                   <p>To ignore these dependency recommendations and
                   12537:                   just use the required <code class=
                   12538:                   "varname">DEPENDS</code>, set <code class=
                   12539:                   "varname">IGNORE_RECOMMENDED=YES</code>. This may
                   12540:                   make it easier and faster to update packages
                   12541:                   built using pkgsrc, since older compatible
                   12542:                   dependencies can continue to be used. This is
                   12543:                   useful for people who watch their rebuilds very
                   12544:                   carefully; it is not very good as a
                   12545:                   general-purpose hammer. If you use it, you need
                   12546:                   to be mindful of possible ABI changes, including
                   12547:                   those from the underlying OS.</p>
                   12548: 
                   12549:                   <p>Packages that are built with recommendations
                   12550:                   ignored may not be uploaded to ftp.NetBSD.org by
                   12551:                   developers and should not be used across
                   12552:                   different systems that may have different
                   12553:                   versions of binary packages installed.</p>
1.1       grant    12554: 
                   12555:                   <p>For security fixes, please update the package
                   12556:                   vulnerabilities file as well as setting
1.14      xtraeme  12557:                   <code class="varname">RECOMMENDED</code>, see
1.1       grant    12558:                   <a href="#security-handling" title=
1.68      rillig   12559:                   "16.1.8.&nbsp;Handling packages with security problems">
                   12560:                   Section&nbsp;16.1.8, &#8220;Handling packages
1.67      hubertf  12561:                   with security problems&#8221;</a> for more
1.1       grant    12562:                   information.</p>
                   12563:                 </li>
                   12564: 
                   12565:                 <li>
                   12566:                   <p>If your package needs some executable to be
1.17      sketch   12567:                   able to run correctly and if there's no
1.45      wiz      12568:                   <code xmlns=
                   12569:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12570:                   "filename">buildlink3.mk</code> file, this is
                   12571:                   specified using the <code class=
1.14      xtraeme  12572:                   "varname">DEPENDS</code> variable. The <a xmlns=
1.1       grant    12573:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   12574:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45      wiz      12575:                   target="_top"><code xmlns="" class=
                   12576:                   "filename">print/lyx</code></a> package needs to
                   12577:                   be able to execute the latex binary from the
                   12578:                   teTeX package when it runs, and that is
                   12579:                   specified:</p>
1.1       grant    12580:                   <pre class="programlisting">
1.51      rillig   12581:     DEPENDS+=        teTeX-[0-9]*:../../print/teTeX
1.1       grant    12582: </pre>
                   12583: 
                   12584:                   <p>The comment about wildcard dependencies from
                   12585:                   previous paragraph applies here, too.</p>
                   12586:                 </li>
                   12587:               </ol>
                   12588:             </div>
                   12589: 
                   12590:             <p>If your package needs files from another package to
                   12591:             build, see the first part of the &#8220;<span class=
                   12592:             "quote">do-configure</span>&#8221; target <a xmlns=
                   12593:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12594:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.45      wiz      12595:             target="_top"><code xmlns="" class=
                   12596:             "filename">print/ghostscript5</code></a> package (it
1.20      ben      12597:             relies on the jpeg sources being present in source form
                   12598:             during the build):</p>
1.1       grant    12599:             <pre class="programlisting">
1.51      rillig   12600:     if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then    \
                   12601:         cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} extract; \
1.1       grant    12602:     fi
                   12603: </pre>
                   12604: 
                   12605:             <p>If you build any other packages that way, please
                   12606:             make sure the working files are deleted too when this
                   12607:             package's working files are cleaned up. The easiest way
                   12608:             to do so is by adding a pre-clean target:</p>
                   12609:             <pre class="programlisting">
1.51      rillig   12610:     pre-clean:
                   12611:             cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} clean
1.1       grant    12612: </pre>
                   12613: 
1.14      xtraeme  12614:             <p>Please also note the <code class=
                   12615:             "varname">BUILD_USES_MSGFMT</code> and <code class=
                   12616:             "varname">BUILD_USES_GETTEXT_M4</code> definitions,
                   12617:             which are provided as convenience definitions. The
1.24      wiz      12618:             former works out whether <a href=
                   12619:             "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
                   12620:             <span class="citerefentry"><span class=
                   12621:             "refentrytitle">msgfmt</span>(1)</span></a> is part of
                   12622:             the base system, and, if it isn't, installs the
                   12623:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12624:             href=
1.1       grant    12625:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.45      wiz      12626:             target="_top"><code xmlns="" class=
                   12627:             "filename">devel/gettext</code></a> package. The latter
1.20      ben      12628:             adds a build dependency on either an installed version
                   12629:             of an older gettext package, or if it isn't, installs
                   12630:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12631:             href=
                   12632:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
1.45      wiz      12633:             target="_top"><code xmlns="" class=
                   12634:             "filename">devel/gettext-m4</code></a> package.</p>
1.1       grant    12635:           </div>
                   12636: 
1.67      hubertf  12637:           <div class="sect2" lang="en">
1.1       grant    12638:             <div class="titlepage">
                   12639:               <div>
                   12640:                 <div>
1.67      hubertf  12641:                   <h3 class="title"><a name=
1.68      rillig   12642:                   "conflicts"></a>16.1.5.&nbsp;Handling conflicts
1.1       grant    12643:                   with other packages</h3>
                   12644:                 </div>
                   12645:               </div>
                   12646:             </div>
                   12647: 
                   12648:             <p>Your package may conflict with other packages a user
                   12649:             might already have installed on his system, e.g. if
                   12650:             your package installs the same set of files like
                   12651:             another package in our pkgsrc tree.</p>
                   12652: 
1.14      xtraeme  12653:             <p>In this case you can set <code class=
1.47      reed     12654:             "varname">CONFLICTS</code> to a space-separated list of
1.1       grant    12655:             packages (including version string) your package
                   12656:             conflicts with.</p>
                   12657: 
1.47      reed     12658:             <p>For example, <a xmlns=
1.1       grant    12659:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12660:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.45      wiz      12661:             target="_top"><code xmlns="" class=
                   12662:             "filename">x11/Xaw3d</code></a> and <a xmlns=
1.20      ben      12663:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12664:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
1.45      wiz      12665:             target="_top"><code xmlns="" class=
1.47      reed     12666:             "filename">x11/Xaw-Xpm</code></a> install the same
                   12667:             shared library, thus you set in <code xmlns=
1.45      wiz      12668:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      12669:             "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1       grant    12670:             <pre class="programlisting">
1.51      rillig   12671:     CONFLICTS=      Xaw-Xpm-[0-9]*
1.1       grant    12672: </pre>
                   12673: 
1.45      wiz      12674:             <p>and in <code xmlns=
                   12675:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12676:             "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1       grant    12677:             <pre class="programlisting">
1.51      rillig   12678:     CONFLICTS=      Xaw3d-[0-9]*
1.1       grant    12679: </pre>
                   12680: 
                   12681:             <p>Packages will automatically conflict with other
                   12682:             packages with the name prefix and a different version
                   12683:             string. &#8220;<span class=
                   12684:             "quote">Xaw3d-1.5</span>&#8221; e.g. will automatically
                   12685:             conflict with the older version &#8220;<span class=
                   12686:             "quote">Xaw3d-1.3</span>&#8221;.</p>
                   12687:           </div>
                   12688: 
1.67      hubertf  12689:           <div class="sect2" lang="en">
1.1       grant    12690:             <div class="titlepage">
                   12691:               <div>
                   12692:                 <div>
1.67      hubertf  12693:                   <h3 class="title"><a name=
1.68      rillig   12694:                   "not-building-packages"></a>16.1.6.&nbsp;Packages
1.30      wiz      12695:                   that cannot or should not be built</h3>
1.1       grant    12696:                 </div>
                   12697:               </div>
                   12698:             </div>
                   12699: 
                   12700:             <p>There are several reasons why a package might be
                   12701:             instructed to not build under certain circumstances. If
                   12702:             the package builds and runs on most platforms, the
1.14      xtraeme  12703:             exceptions should be noted with <code class=
                   12704:             "varname">NOT_FOR_PLATFORM</code>. If the package
                   12705:             builds and runs on a small handful of platforms, set
                   12706:             <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.45      wiz      12707:             Both <code class="varname">ONLY_FOR_PLATFORM</code> and
                   12708:             <code class="varname">NOT_FOR_PLATFORM</code> are OS
                   12709:             triples (OS-version-platform) that can use glob-style
                   12710:             wildcards.</p>
                   12711: 
                   12712:             <p>If the package should be skipped (for example,
                   12713:             because it provides functionality already provided by
                   12714:             the system), set <code class=
1.14      xtraeme  12715:             "varname">PKG_SKIP_REASON</code> to a descriptive
                   12716:             message. If the package should fail because some
                   12717:             preconditions are not met, set <code class=
                   12718:             "varname">PKG_FAIL_REASON</code> to a descriptive
1.1       grant    12719:             message.</p>
                   12720:           </div>
                   12721: 
1.67      hubertf  12722:           <div class="sect2" lang="en">
1.1       grant    12723:             <div class="titlepage">
                   12724:               <div>
                   12725:                 <div>
1.67      hubertf  12726:                   <h3 class="title"><a name=
1.68      rillig   12727:                   "undeletable-packages"></a>16.1.7.&nbsp;Packages
1.30      wiz      12728:                   which should not be deleted, once installed</h3>
1.1       grant    12729:                 </div>
                   12730:               </div>
                   12731:             </div>
                   12732: 
                   12733:             <p>To ensure that a package may not be deleted, once it
1.14      xtraeme  12734:             has been installed, the <code class=
                   12735:             "varname">PKG_PRESERVE</code> definition should be set
                   12736:             in the package Makefile. This will be carried into any
1.1       grant    12737:             binary package that is made from this pkgsrc entry. A
                   12738:             &#8220;<span class="quote">preserved</span>&#8221;
                   12739:             package will not be deleted using <a href=
                   12740:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   12741:             <span class="citerefentry"><span class=
                   12742:             "refentrytitle">pkg_delete</span>(1)</span></a> unless
                   12743:             the &#8220;<span class="quote">-f</span>&#8221; option
                   12744:             is used.</p>
                   12745:           </div>
                   12746: 
1.67      hubertf  12747:           <div class="sect2" lang="en">
1.1       grant    12748:             <div class="titlepage">
                   12749:               <div>
                   12750:                 <div>
1.67      hubertf  12751:                   <h3 class="title"><a name=
1.68      rillig   12752:                   "security-handling"></a>16.1.8.&nbsp;Handling
1.1       grant    12753:                   packages with security problems</h3>
                   12754:                 </div>
                   12755:               </div>
                   12756:             </div>
                   12757: 
                   12758:             <p>When a vulnerability is found, this should be noted
1.45      wiz      12759:             in <code xmlns=
                   12760:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12761:             "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.43      wiz      12762:             and after committing that file, use
                   12763:             <span><strong class="command">make
                   12764:             upload</strong></span> in the same directory to update
                   12765:             the file on ftp.NetBSD.org.</p>
                   12766: 
                   12767:             <p>After fixing the vulnerability by a patch, its
                   12768:             <code class="varname">PKGREVISION</code> should be
                   12769:             increased (this is of course not necessary if the
                   12770:             problem is fixed by using a newer release of the
1.45      wiz      12771:             software). In addition, if a <code xmlns=
                   12772:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12773:             "filename">buildlink3.mk</code> file exists for an
1.43      wiz      12774:             affected package, a corresponding <code class=
1.14      xtraeme  12775:             "varname">BUILDLINK_RECOMMENDED.<em class=
                   12776:             "replaceable"><code>pkg</code></em></code> entry should
1.43      wiz      12777:             be added or updated in it.</p>
1.1       grant    12778: 
                   12779:             <p>Also, if the fix should be applied to the stable
                   12780:             pkgsrc branch, be sure to submit a pullup request!</p>
1.43      wiz      12781: 
                   12782:             <p>Binary packages already on ftp.NetBSD.org will be
                   12783:             handled semi-automatically by a weekly cron job.</p>
1.1       grant    12784:           </div>
                   12785: 
1.67      hubertf  12786:           <div class="sect2" lang="en">
1.1       grant    12787:             <div class="titlepage">
                   12788:               <div>
                   12789:                 <div>
1.67      hubertf  12790:                   <h3 class="title"><a name=
1.68      rillig   12791:                   "compiler-bugs"></a>16.1.9.&nbsp;How to handle
1.1       grant    12792:                   compiler bugs</h3>
                   12793:                 </div>
                   12794:               </div>
                   12795:             </div>
                   12796: 
                   12797:             <p>Some source files trigger bugs in the compiler,
                   12798:             based on combinations of compiler version and
                   12799:             architecture and almost always relation to optimisation
                   12800:             being enabled. Common symptoms are gcc internal errors
                   12801:             or never finishing compiling a file.</p>
                   12802: 
1.47      reed     12803:             <p>Typically, a workaround involves testing the
1.14      xtraeme  12804:             <code class="varname">MACHINE_ARCH</code> and compiler
1.1       grant    12805:             version, disabling optimisation for that
1.14      xtraeme  12806:             file/<code class="varname">MACHINE_ARCH</code>/compiler
1.45      wiz      12807:             combination, and documenting it in <code xmlns=
                   12808:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12809:             "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1       grant    12810:             number of examples!</p>
                   12811:           </div>
                   12812: 
1.67      hubertf  12813:           <div class="sect2" lang="en">
1.1       grant    12814:             <div class="titlepage">
                   12815:               <div>
                   12816:                 <div>
1.67      hubertf  12817:                   <h3 class="title"><a name=
1.68      rillig   12818:                   "bumping-pkgrevision"></a>16.1.10.&nbsp;How to
1.30      wiz      12819:                   handle incrementing versions when fixing an
                   12820:                   existing package</h3>
1.1       grant    12821:                 </div>
                   12822:               </div>
                   12823:             </div>
                   12824: 
                   12825:             <p>When making fixes to an existing package it can be
1.14      xtraeme  12826:             useful to change the version number in <code class=
                   12827:             "varname">PKGNAME</code>. To avoid conflicting with
1.1       grant    12828:             future versions by the original author, a
                   12829:             &#8220;<span class="quote">nb1</span>&#8221;,
                   12830:             &#8220;<span class="quote">nb2</span>&#8221;, ...
                   12831:             suffix can be used on package versions by setting
1.14      xtraeme  12832:             <code class="varname">PKGREVISION=1</code> (2, ...).
                   12833:             The &#8220;<span class="quote">nb</span>&#8221; is
                   12834:             treated like a &#8220;<span class=
                   12835:             "quote">.</span>&#8221; by the pkg tools. e.g.</p>
1.1       grant    12836:             <pre class="programlisting">
1.51      rillig   12837:     DISTNAME=       foo-17.42
                   12838:     PKGREVISION=    9
1.1       grant    12839: </pre>
                   12840: 
1.14      xtraeme  12841:             <p>will result in a <code class=
                   12842:             "varname">PKGNAME</code> of &#8220;<span class=
1.1       grant    12843:             "quote">foo-17.42nb9</span>&#8221;.</p>
                   12844: 
                   12845:             <p>When a new release of the package is released, the
1.14      xtraeme  12846:             <code class="varname">PKGREVISION</code> should be
1.47      reed     12847:             removed, e.g. on a new minor release of the above
1.14      xtraeme  12848:             package, things should be like:</p>
1.1       grant    12849:             <pre class="programlisting">
1.51      rillig   12850:     DISTNAME=       foo-17.43
1.1       grant    12851: </pre>
                   12852:           </div>
                   12853: 
1.67      hubertf  12854:           <div class="sect2" lang="en">
1.1       grant    12855:             <div class="titlepage">
                   12856:               <div>
                   12857:                 <div>
1.30      wiz      12858:                   <h3 class="title"><a name=
1.68      rillig   12859:                   "portability-of-packages"></a>16.1.11.&nbsp;Portability
1.30      wiz      12860:                   of packages</h3>
1.1       grant    12861:                 </div>
                   12862:               </div>
                   12863:             </div>
                   12864: 
                   12865:             <p>One appealing feature of pkgsrc is that it runs on
                   12866:             many different platforms. As a result, it is important
                   12867:             to ensure, where possible, that packages in pkgsrc are
                   12868:             portable. There are some particular details you should
                   12869:             pay attention to while working on pkgsrc.</p>
                   12870: 
1.67      hubertf  12871:             <div class="sect3" lang="en">
1.1       grant    12872:               <div class="titlepage">
                   12873:                 <div>
                   12874:                   <div>
1.67      hubertf  12875:                     <h4 class="title"><a name=
1.68      rillig   12876:                     "install-scripts"></a>16.1.11.1.&nbsp;${INSTALL},
1.1       grant    12877:                     ${INSTALL_DATA_DIR}, ...</h4>
                   12878:                   </div>
                   12879:                 </div>
                   12880:               </div>
                   12881: 
1.14      xtraeme  12882:               <p>The BSD-compatible <span><strong class=
                   12883:               "command">install</strong></span> supplied with some
1.1       grant    12884:               operating systems will not perform more than one
                   12885:               operation at a time. As such, you should call
                   12886:               &#8220;<span class="quote">${INSTALL}</span>&#8221;,
                   12887:               etc. like this:</p>
                   12888:               <pre class="programlisting">
1.51      rillig   12889:     ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   12890:     ${INSTALL_DATA_DIR} ${PREFIX}/dir2
1.1       grant    12891: </pre>
                   12892:             </div>
                   12893:           </div>
                   12894:         </div>
                   12895: 
1.67      hubertf  12896:         <div class="sect1" lang="en">
1.1       grant    12897:           <div class="titlepage">
                   12898:             <div>
                   12899:               <div>
                   12900:                 <h2 class="title" style="clear: both"><a name=
1.68      rillig   12901:                 "downloading-issues"></a>16.2.&nbsp;Possible
1.1       grant    12902:                 downloading issues</h2>
                   12903:               </div>
                   12904:             </div>
                   12905:           </div>
                   12906: 
1.67      hubertf  12907:           <div class="sect2" lang="en">
1.1       grant    12908:             <div class="titlepage">
                   12909:               <div>
                   12910:                 <div>
1.67      hubertf  12911:                   <h3 class="title"><a name=
1.68      rillig   12912:                   "no-plain-download"></a>16.2.1.&nbsp;Packages
1.30      wiz      12913:                   whose distfiles aren't available for plain
1.1       grant    12914:                   downloading</h3>
                   12915:                 </div>
                   12916:               </div>
                   12917:             </div>
                   12918: 
                   12919:             <p>If you need to download from a dynamic URL you can
1.14      xtraeme  12920:             set <code class="varname">DYNAMIC_MASTER_SITES</code>
                   12921:             and a <span><strong class="command">make
1.45      wiz      12922:             fetch</strong></span> will call <code xmlns=
                   12923:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12924:             "filename">files/getsite.sh</code> with the name of
                   12925:             each file to download as an argument, expecting it to
                   12926:             output the URL of the directory from which to download
                   12927:             it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12928:             href=
1.1       grant    12929:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.45      wiz      12930:             target="_top"><code xmlns="" class=
                   12931:             "filename">graphics/ns-cult3d</code></a> is an example
                   12932:             of this usage.</p>
1.1       grant    12933: 
                   12934:             <p>If the download can't be automated, because the user
                   12935:             must submit personal information to apply for a
                   12936:             password, or must pay for the source, or whatever, you
1.14      xtraeme  12937:             can set <code class="varname">_FETCH_MESSAGE</code> to
                   12938:             a macro which displays a message explaining the
                   12939:             situation. <code class="varname">_FETCH_MESSAGE</code>
                   12940:             must be executable shell commands, not just a message.
                   12941:             (Generally, it executes <code class=
                   12942:             "varname">${ECHO}</code>). As of this writing, the
1.1       grant    12943:             following packages use this: <a xmlns=
                   12944:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.20      ben      12945:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
1.45      wiz      12946:             target="_top"><code xmlns="" class=
                   12947:             "filename">cad/simian</code></a>, <a xmlns=
1.20      ben      12948:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12949:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
1.45      wiz      12950:             target="_top"><code xmlns="" class=
                   12951:             "filename">devel/ipv6socket</code></a>, <a xmlns=
1.20      ben      12952:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12953:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
1.45      wiz      12954:             target="_top"><code xmlns="" class=
                   12955:             "filename">emulators/vmware-module</code></a>,
                   12956:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12957:             href=
1.20      ben      12958:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
1.45      wiz      12959:             target="_top"><code xmlns="" class=
                   12960:             "filename">fonts/acroread-jpnfont</code></a>, <a xmlns=
1.20      ben      12961:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.43      wiz      12962:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/multimedia/realplayer/README.html"
1.45      wiz      12963:             target="_top"><code xmlns="" class=
                   12964:             "filename">multimedia/realplayer</code></a>, <a xmlns=
1.43      wiz      12965:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.20      ben      12966:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
1.45      wiz      12967:             target="_top"><code xmlns="" class=
                   12968:             "filename">sysutils/storage-manager</code></a>,
                   12969:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12970:             href=
1.20      ben      12971:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
1.45      wiz      12972:             target="_top"><code xmlns="" class=
                   12973:             "filename">www/ap-aolserver</code></a>, <a xmlns=
1.20      ben      12974:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12975:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
1.45      wiz      12976:             target="_top"><code xmlns="" class=
                   12977:             "filename">www/openacs</code></a>. Try to be consistent
1.20      ben      12978:             with them.</p>
1.1       grant    12979:           </div>
                   12980: 
1.67      hubertf  12981:           <div class="sect2" lang="en">
1.1       grant    12982:             <div class="titlepage">
                   12983:               <div>
                   12984:                 <div>
1.30      wiz      12985:                   <h3 class="title"><a name=
1.68      rillig   12986:                   "modified-distfiles-same-name"></a>16.2.2.&nbsp;How
1.30      wiz      12987:                   to handle modified distfiles with the 'old'
                   12988:                   name</h3>
1.1       grant    12989:                 </div>
                   12990:               </div>
                   12991:             </div>
                   12992: 
                   12993:             <p>Sometimes authors of a software package make some
                   12994:             modifications after the software was released, and they
                   12995:             put up a new distfile without changing the package's
                   12996:             version number. If a package is already in pkgsrc at
1.32      wiz      12997:             that time, the checksum will no longer match. The
                   12998:             contents of the new distfile should be compared against
                   12999:             the old one before changing anything, to make sure the
                   13000:             distfile was really updated on purpose, and that no
                   13001:             trojan horse or so crept in. Then, the correct way to
                   13002:             work around this is to set <code class=
                   13003:             "varname">DIST_SUBDIR</code> to a unique directory
                   13004:             name, usually based on <code class=
                   13005:             "varname">PKGNAME_NOREV</code>. In case this happens
                   13006:             more often, <code class="varname">PKGNAME</code> can be
1.45      wiz      13007:             used (thus including the <code xmlns=
                   13008:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.32      wiz      13009:             "filename">nbX</code> suffix) or a date stamp can be
                   13010:             appended, like <code class=
                   13011:             "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
1.45      wiz      13012:             forget regenerating the <code xmlns=
                   13013:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.32      wiz      13014:             "filename">distinfo</code> file after that, since it
                   13015:             contains the <code class="varname">DIST_SUBDIR</code>
                   13016:             path in the filenames. Furthermore, a mail to the
                   13017:             package's authors seems appropriate telling them that
                   13018:             changing distfiles after releases without changing the
                   13019:             file names is not good practice.</p>
1.1       grant    13020:           </div>
                   13021:         </div>
                   13022: 
1.67      hubertf  13023:         <div class="sect1" lang="en">
1.1       grant    13024:           <div class="titlepage">
                   13025:             <div>
                   13026:               <div>
                   13027:                 <h2 class="title" style="clear: both"><a name=
1.68      rillig   13028:                 "configuration-gotchas"></a>16.3.&nbsp;Configuration
1.1       grant    13029:                 gotchas</h2>
                   13030:               </div>
                   13031:             </div>
                   13032:           </div>
                   13033: 
1.67      hubertf  13034:           <div class="sect2" lang="en">
1.1       grant    13035:             <div class="titlepage">
                   13036:               <div>
                   13037:                 <div>
1.67      hubertf  13038:                   <h3 class="title"><a name=
1.68      rillig   13039:                   "fixes.libtool"></a>16.3.1.&nbsp;Shared libraries
1.1       grant    13040:                   - libtool</h3>
                   13041:                 </div>
                   13042:               </div>
                   13043:             </div>
                   13044: 
                   13045:             <p>pkgsrc supports many different machines, with
                   13046:             different object formats like a.out and ELF, and
                   13047:             varying abilities to do shared library and dynamic
                   13048:             loading at all. To accompany this, varying commands and
                   13049:             options have to be passed to the compiler, linker, etc.
                   13050:             to get the Right Thing, which can be pretty annoying
                   13051:             especially if you don't have all the machines at your
                   13052:             hand to test things. The <a xmlns=
                   13053:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   13054:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.45      wiz      13055:             target="_top"><code xmlns="" class=
                   13056:             "filename">devel/libtool</code></a> pkg can help here,
                   13057:             as it just &#8220;<span class=
                   13058:             "quote">knows</span>&#8221; how to build both static
                   13059:             and dynamic libraries from a set of source files, thus
1.47      reed     13060:             being platform-independent.</p>
1.1       grant    13061: 
                   13062:             <p>Here's how to use libtool in a pkg in seven simple
                   13063:             steps:</p>
                   13064: 
                   13065:             <div class="orderedlist">
                   13066:               <ol type="1">
                   13067:                 <li>
1.14      xtraeme  13068:                   <p>Add <code class=
                   13069:                   "varname">USE_LIBTOOL=yes</code> to the package
                   13070:                   Makefile.</p>
1.1       grant    13071:                 </li>
                   13072: 
                   13073:                 <li>
                   13074:                   <p>For library objects, use &#8220;<span class=
                   13075:                   "quote">${LIBTOOL} --mode=compile
                   13076:                   ${CC}</span>&#8221; in place of
                   13077:                   &#8220;<span class="quote">${CC}</span>&#8221;.
                   13078:                   You could even add it to the definition of
1.14      xtraeme  13079:                   <code class="varname">CC</code>, if only
                   13080:                   libraries are being built in a given Makefile.
                   13081:                   This one command will build both PIC and non-PIC
                   13082:                   library objects, so you need not have separate
                   13083:                   shared and non-shared library rules.</p>
1.1       grant    13084:                 </li>
                   13085: 
                   13086:                 <li>
                   13087:                   <p>For the linking of the library, remove any
                   13088:                   &#8220;<span class="quote">ar</span>&#8221;,
                   13089:                   &#8220;<span class="quote">ranlib</span>&#8221;,
                   13090:                   and &#8220;<span class="quote">ld
                   13091:                   -Bshareable</span>&#8221; commands, and instead
                   13092:                   use:</p>
                   13093:                   <pre class="programlisting">
1.51      rillig   13094:     ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} \
                   13095:         -rpath ${PREFIX}/lib -version-info major:minor
1.1       grant    13096: </pre>
                   13097: 
                   13098:                   <p>Note that the library is changed to have a
1.45      wiz      13099:                   <code xmlns=
                   13100:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13101:                   "filename">.la</code> extension, and the objects
                   13102:                   are changed to have a <code xmlns=
                   13103:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13104:                   "filename">.lo</code> extension. Change
                   13105:                   <code class="varname">OBJS</code> as necessary.
                   13106:                   This automatically creates all of the
1.45      wiz      13107:                   <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13108:                   class="filename">.a</code>, <code xmlns=
                   13109:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13110:                   "filename">.so.major.minor</code>, and ELF
                   13111:                   symlinks (if necessary) in the build directory.
                   13112:                   Be sure to include &#8220;<span class=
1.1       grant    13113:                   "quote">-version-info</span>&#8221;, especially
                   13114:                   when major and minor are zero, as libtool will
                   13115:                   otherwise strip off the shared library
                   13116:                   version.</p>
                   13117: 
                   13118:                   <p>From the libtool manual:</p>
                   13119:                   <pre class="programlisting">
1.51      rillig   13120:     So, libtool library versions are described by three integers:
1.1       grant    13121: 
1.51      rillig   13122:     CURRENT
                   13123:         The most recent interface number that this library implements.
1.1       grant    13124: 
1.51      rillig   13125:     REVISION
                   13126:         The implementation number of the CURRENT interface.
1.1       grant    13127: 
1.51      rillig   13128:     AGE
                   13129:         The difference between the newest and oldest interfaces that
                   13130:         this library implements.  In other words, the library implements
                   13131:         all the interface numbers in the range from number `CURRENT -
                   13132:         AGE' to `CURRENT'.
1.68      rillig   13133: 
1.51      rillig   13134:     If two libraries have identical CURRENT and AGE numbers, then the
                   13135:     dynamic linker chooses the library with the greater REVISION number.
1.1       grant    13136: </pre>
                   13137: 
                   13138:                   <p>The &#8220;<span class=
                   13139:                   "quote">-release</span>&#8221; option will
                   13140:                   produce different results for a.out and ELF
                   13141:                   (excluding symlinks) in only one case. An ELF
                   13142:                   library of the form &#8220;<span class=
                   13143:                   "quote">libfoo-release.so.<span class=
                   13144:                   "emphasis"><em>x</em></span>.<span class=
                   13145:                   "emphasis"><em>y</em></span></span>&#8221; will
                   13146:                   have a symlink of &#8220;<span class=
                   13147:                   "quote">libfoo.so.<span class=
                   13148:                   "emphasis"><em>x</em></span>.<span class=
                   13149:                   "emphasis"><em>y</em></span></span>&#8221; on an
                   13150:                   a.out platform. This is handled
                   13151:                   automatically.</p>
                   13152: 
                   13153:                   <p>The &#8220;<span class="quote">-rpath
                   13154:                   argument</span>&#8221; is the install directory
                   13155:                   of the library being built.</p>
                   13156: 
1.45      wiz      13157:                   <p>In the <code xmlns=
                   13158:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13159:                   "filename">PLIST</code>, include only the
                   13160:                   <code xmlns=
                   13161:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.19      hubertf  13162:                   "filename">.la</code> file, the other files will
                   13163:                   be added automatically.</p>
1.1       grant    13164:                 </li>
                   13165: 
                   13166:                 <li>
1.45      wiz      13167:                   <p>When linking shared object (<code xmlns=
                   13168:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13169:                   "filename">.so</code>) files, i.e. files that are
1.24      wiz      13170:                   loaded via <a href=
                   13171:                   "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
                   13172:                   <span class="citerefentry"><span class=
                   13173:                   "refentrytitle">dlopen</span>(3)</span></a>, NOT
                   13174:                   shared libraries, use &#8220;<span class=
                   13175:                   "quote">-module -avoid-version</span>&#8221; to
                   13176:                   prevent them getting version tacked on.</p>
1.1       grant    13177: 
1.45      wiz      13178:                   <p>The <code xmlns=
                   13179:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13180:                   "filename">PLIST</code> file gets the
                   13181:                   <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13182:                   class="filename">foo.so</code> entry.</p>
1.1       grant    13183:                 </li>
                   13184: 
                   13185:                 <li>
                   13186:                   <p>When linking programs that depend on these
                   13187:                   libraries <span class=
                   13188:                   "emphasis"><em>before</em></span> they are
                   13189:                   installed, preface the <a href=
                   13190:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
                   13191:                   <span class="citerefentry"><span class=
                   13192:                   "refentrytitle">cc</span>(1)</span></a> or
                   13193:                   <a href=
                   13194:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   13195:                   <span class="citerefentry"><span class=
                   13196:                   "refentrytitle">ld</span>(1)</span></a> line with
                   13197:                   &#8220;<span class="quote">${LIBTOOL}
                   13198:                   --mode=link</span>&#8221;, and it will find the
                   13199:                   correct libraries (static or shared), but please
                   13200:                   be aware that libtool will not allow you to
                   13201:                   specify a relative path in -L (such as
                   13202:                   &#8220;<span class=
                   13203:                   "quote">-L../somelib</span>&#8221;), because it
                   13204:                   expects you to change that argument to be the
1.45      wiz      13205:                   <code xmlns=
                   13206:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13207:                   "filename">.la</code> file. e.g.</p>
1.1       grant    13208:                   <pre class="programlisting">
1.51      rillig   13209:     ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
1.1       grant    13210: </pre>
                   13211: 
                   13212:                   <p>should be changed to:</p>
                   13213:                   <pre class="programlisting">
1.51      rillig   13214:     ${LIBTOOL} --mode=link ${CC} -o <em class=
1.14      xtraeme  13215: "replaceable"><code>someprog</code></em> <em class=
                   13216: "replaceable"><code>../somelib/somelib.la</code></em>
1.1       grant    13217: </pre>
                   13218: 
                   13219:                   <p>and it will do the right thing with the
                   13220:                   libraries.</p>
                   13221:                 </li>
                   13222: 
                   13223:                 <li>
                   13224:                   <p>When installing libraries, preface the
                   13225:                   <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   13226:                   <span class="citerefentry"><span class=
                   13227:                   "refentrytitle">install</span>(1)</span></a> or
                   13228:                   <a href=
                   13229:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
                   13230:                   <span class="citerefentry"><span class=
                   13231:                   "refentrytitle">cp</span>(1)</span></a> command
                   13232:                   with &#8220;<span class="quote">${LIBTOOL}
                   13233:                   --mode=install</span>&#8221;, and change the
1.45      wiz      13234:                   library name to <code xmlns=
                   13235:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13236:                   "filename">.la</code>. e.g.</p>
1.1       grant    13237:                   <pre class="programlisting">
1.51      rillig   13238:     ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1       grant    13239: </pre>
                   13240: 
1.45      wiz      13241:                   <p>This will install the static <code xmlns=
                   13242:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13243:                   "filename">.a</code>, shared library, any needed
1.1       grant    13244:                   symlinks, and run <a href=
                   13245:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
                   13246:                   <span class="citerefentry"><span class=
                   13247:                   "refentrytitle">ldconfig</span>(8)</span></a>.</p>
                   13248:                 </li>
                   13249: 
                   13250:                 <li>
1.45      wiz      13251:                   <p>In your <code xmlns=
                   13252:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13253:                   "filename">PLIST</code>, include only the
                   13254:                   <code xmlns=
                   13255:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.23      wiz      13256:                   "filename">.la</code> file (this is a change from
                   13257:                   previous behaviour).</p>
1.1       grant    13258:                 </li>
                   13259:               </ol>
                   13260:             </div>
                   13261:           </div>
                   13262: 
1.67      hubertf  13263:           <div class="sect2" lang="en">
1.1       grant    13264:             <div class="titlepage">
                   13265:               <div>
                   13266:                 <div>
1.67      hubertf  13267:                   <h3 class="title"><a name=
1.68      rillig   13268:                   "using-libtool"></a>16.3.2.&nbsp;Using libtool on
1.30      wiz      13269:                   GNU packages that already support libtool</h3>
1.1       grant    13270:                 </div>
                   13271:               </div>
                   13272:             </div>
                   13273: 
1.14      xtraeme  13274:             <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
                   13275:             the package Makefile. This will override the package's
                   13276:             own libtool in most cases. For older libtool using
1.1       grant    13277:             packages, libtool is made by ltconfig script during the
                   13278:             do-configure step; you can check the libtool script
1.14      xtraeme  13279:             location by doing <span><strong class="command">make
                   13280:             configure; find work*/ -name
                   13281:             libtool</strong></span>.</p>
                   13282: 
                   13283:             <p><code class="varname">LIBTOOL_OVERRIDE</code>
                   13284:             specifies which libtool scripts, relative to
                   13285:             <code class="varname">WRKSRC</code>, to override. By
                   13286:             default, it is set to &#8220;<span class=
                   13287:             "quote">libtool */libtool */*/libtool</span>&#8221;. If
                   13288:             this does not match the location of the package's
                   13289:             libtool script(s), set it as appropriate.</p>
1.13      hubertf  13290: 
1.45      wiz      13291:             <p>If you do not need <code xmlns=
                   13292:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13293:             "filename">*.a</code> static libraries built and
                   13294:             installed, then use <code class=
                   13295:             "varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.1       grant    13296: 
1.47      reed     13297:             <p>If your package makes use of the
                   13298:             platform-independent library for loading dynamic shared
                   13299:             objects, that comes with libtool (libltdl), you should
                   13300:             include devel/libltdl/buildlink3.mk.</p>
1.1       grant    13301: 
                   13302:             <p>Some packages use libtool incorrectly so that the
                   13303:             package may not work or build in some circumstances.
                   13304:             Some of the more common errors are:</p>
                   13305: 
                   13306:             <div class="itemizedlist">
                   13307:               <ul type="disc">
                   13308:                 <li>
                   13309:                   <p>The inclusion of a shared object (-module) as
                   13310:                   a dependent library in an executable or library.
                   13311:                   This in itself isn't a problem if one of two
                   13312:                   things has been done:</p>
                   13313: 
                   13314:                   <div class="orderedlist">
                   13315:                     <ol type="1">
                   13316:                       <li>
                   13317:                         <p>The shared object is named correctly,
1.45      wiz      13318:                         i.e. <code xmlns=
                   13319:                         "http://www.w3.org/TR/xhtml1/transitional"
                   13320:                         class="filename">libfoo.la</code>, not
                   13321:                         <code xmlns=
                   13322:                         "http://www.w3.org/TR/xhtml1/transitional"
                   13323:                         class="filename">foo.la</code></p>
1.1       grant    13324:                       </li>
                   13325: 
                   13326:                       <li>
                   13327:                         <p>The -dlopen option is used when linking
                   13328:                         an executable.</p>
                   13329:                       </li>
                   13330:                     </ol>
                   13331:                   </div>
                   13332:                 </li>
                   13333: 
                   13334:                 <li>
                   13335:                   <p>The use of libltdl without the correct calls
                   13336:                   to initialisation routines. The function
                   13337:                   lt_dlinit() should be called and the macro
1.14      xtraeme  13338:                   <code class=
                   13339:                   "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1       grant    13340:                   included in executables.</p>
                   13341:                 </li>
                   13342:               </ul>
                   13343:             </div>
                   13344:           </div>
                   13345: 
1.67      hubertf  13346:           <div class="sect2" lang="en">
1.1       grant    13347:             <div class="titlepage">
                   13348:               <div>
                   13349:                 <div>
1.67      hubertf  13350:                   <h3 class="title"><a name=
1.68      rillig   13351:                   "autoconf-automake"></a>16.3.3.&nbsp;GNU
1.1       grant    13352:                   Autoconf/Automake</h3>
                   13353:                 </div>
                   13354:               </div>
                   13355:             </div>
                   13356: 
                   13357:             <p>If a package needs GNU autoconf or automake to be
                   13358:             executed to regenerate the configure script and
                   13359:             Makefile.in makefile templates, then they should be
1.35      jmmv     13360:             executed in a pre-configure target.</p>
1.1       grant    13361: 
                   13362:             <p>For packages that need only autoconf:</p>
                   13363:             <pre class="programlisting">
1.51      rillig   13364:     AUTOCONF_REQD=  2.50            # if default version is not good enough
                   13365:     USE_TOOLS+=     autoconf        # use "autoconf213" for autoconf-2.13
                   13366:     ...
1.1       grant    13367: 
1.51      rillig   13368:     pre-configure:
                   13369:             cd ${WRKSRC}; autoconf
1.1       grant    13370: 
1.51      rillig   13371:     ...
1.1       grant    13372: </pre>
                   13373: 
                   13374:             <p>and for packages that need automake and
                   13375:             autoconf:</p>
                   13376:             <pre class="programlisting">
1.51      rillig   13377:     AUTOMAKE_REQD=  1.7.1           # if default version is not good enough
                   13378:     USE_TOOLS+=     automake        # use "automake14" for automake-1.4
                   13379:     ...
1.1       grant    13380: 
1.51      rillig   13381:     pre-configure:
                   13382:             cd ${WRKSRC};                          \
                   13383:             aclocal; autoheader;                   \
                   13384:             automake -a --foreign -i; autoconf
                   13385: 
                   13386:     ...
1.1       grant    13387: </pre>
                   13388: 
                   13389:             <p>Packages which use GNU Automake will almost
1.35      jmmv     13390:             certainly require GNU Make.</p>
1.1       grant    13391: 
                   13392:             <p>There are times when the configure process makes
                   13393:             additional changes to the generated files, which then
                   13394:             causes the build process to try to re-execute the
                   13395:             automake sequence. This is prevented by touching
                   13396:             various files in the configure stage. If this causes
1.14      xtraeme  13397:             problems with your package you can set <code class=
                   13398:             "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1       grant    13399:             Makefile.</p>
                   13400:           </div>
                   13401:         </div>
                   13402: 
1.67      hubertf  13403:         <div class="sect1" lang="en">
1.1       grant    13404:           <div class="titlepage">
                   13405:             <div>
                   13406:               <div>
                   13407:                 <h2 class="title" style="clear: both"><a name=
1.68      rillig   13408:                 "fixes-build"></a>16.4.&nbsp;Building the
1.55      rillig   13409:                 package</h2>
1.1       grant    13410:               </div>
                   13411:             </div>
                   13412:           </div>
                   13413: 
1.67      hubertf  13414:           <div class="sect2" lang="en">
1.1       grant    13415:             <div class="titlepage">
                   13416:               <div>
                   13417:                 <div>
1.67      hubertf  13418:                   <h3 class="title"><a name=
1.68      rillig   13419:                   "cpp-defines"></a>16.4.1.&nbsp;CPP defines</h3>
1.1       grant    13420:                 </div>
                   13421:               </div>
                   13422:             </div>
                   13423: 
1.55      rillig   13424:             <p>Sometimes you need to compile different code
                   13425:             depending on the target platform. The C preprocessor
                   13426:             has a set of predefined macros that can be queried by
                   13427:             using <code class="varname">#ifdef FOO</code> or
                   13428:             <code class="varname">#if defined(FOO)</code>. Among
                   13429:             these macros are usually ones that describe the target
                   13430:             CPU and operating system. Depending of which of the
                   13431:             macros are defined, you can write code that uses
1.61      rillig   13432:             features unique to a specific platform. Generally you
                   13433:             should rather use the GNU autotools (automake,
                   13434:             autoconf, etc.) to check for specific features (like
                   13435:             the existence of a header file, a function or a
                   13436:             library), but sometimes this is not possible or
                   13437:             desired.</p>
                   13438: 
                   13439:             <p>In that case you can use the predefined macros below
                   13440:             to configure your code to the platform it runs on.
                   13441:             Almost every operating system, hardware architecture
                   13442:             and compiler has its own macro. For example, if the
                   13443:             macros <code class="varname">__GNUC__</code>,
                   13444:             <code class="varname">__i386__</code> and <code class=
1.55      rillig   13445:             "varname">__NetBSD__</code> are all defined, you know
1.61      rillig   13446:             that you are using NetBSD on an i386 compatible CPU,
                   13447:             and your compiler is GCC.</p>
1.55      rillig   13448: 
1.67      hubertf  13449:             <div class="sect3" lang="en">
1.55      rillig   13450:               <div class="titlepage">
                   13451:                 <div>
                   13452:                   <div>
                   13453:                     <h4 class="title"><a name=
1.68      rillig   13454:                     "fixes-build-cpp-opsys"></a>16.4.1.1.&nbsp;CPP
1.55      rillig   13455:                     defines for operating systems</h4>
                   13456:                   </div>
                   13457:                 </div>
                   13458:               </div>
                   13459: 
                   13460:               <p>To distinguish between 4.4 BSD-derived systems and
                   13461:               the rest of the world, you should use the following
                   13462:               code.</p>
                   13463:               <pre class="programlisting">
1.51      rillig   13464:     #include &lt;sys/param.h&gt;
1.55      rillig   13465:     #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
1.60      rillig   13466:       /* BSD-specific code goes here */
1.55      rillig   13467:     #else
1.60      rillig   13468:       /* non-BSD-specific code goes here */
1.55      rillig   13469:     #endif
1.1       grant    13470: </pre>
                   13471: 
1.55      rillig   13472:               <p>If this distinction is not fine enough, you can
                   13473:               also use the following defines.</p>
                   13474:               <pre class="programlisting">
                   13475:     FreeBSD     __FreeBSD__
1.56      rillig   13476:     DragonFly   __DragonFly__
1.57      minskim  13477:     Interix     __INTERIX
1.55      rillig   13478:     Linux       linux, __linux, __linux__
                   13479:     NetBSD      __NetBSD__
                   13480:     OpenBSD     __OpenBSD__
1.60      rillig   13481:     Solaris     sun, __sun
1.1       grant    13482: </pre>
1.55      rillig   13483:             </div>
1.1       grant    13484: 
1.67      hubertf  13485:             <div class="sect3" lang="en">
1.55      rillig   13486:               <div class="titlepage">
                   13487:                 <div>
                   13488:                   <div>
1.67      hubertf  13489:                     <h4 class="title"><a name=
1.68      rillig   13490:                     "fixes-build-cpp-cpu"></a>16.4.1.2.&nbsp;CPP
1.55      rillig   13491:                     defines for CPUs</h4>
                   13492:                   </div>
                   13493:                 </div>
                   13494:               </div>
                   13495:               <pre class="programlisting">
                   13496:     i386        i386, __i386, __i386__
                   13497:     MIPS        __mips
                   13498:     SPARC       sparc, __sparc
                   13499: </pre>
                   13500:             </div>
                   13501: 
1.67      hubertf  13502:             <div class="sect3" lang="en">
1.55      rillig   13503:               <div class="titlepage">
                   13504:                 <div>
                   13505:                   <div>
                   13506:                     <h4 class="title"><a name=
1.68      rillig   13507:                     "fixes-build-cpp-compiler"></a>16.4.1.3.&nbsp;CPP
1.55      rillig   13508:                     defines for compilers</h4>
                   13509:                   </div>
                   13510:                 </div>
                   13511:               </div>
                   13512:               <pre class="programlisting">
                   13513:     GCC         __GNUC__ (major version), __GNUC_MINOR__
1.60      rillig   13514:     SunPro      __SUNPRO_C (0x570 for version 5.7)
1.55      rillig   13515: </pre>
                   13516:             </div>
1.1       grant    13517:           </div>
1.51      rillig   13518: 
1.67      hubertf  13519:           <div class="sect2" lang="en">
1.51      rillig   13520:             <div class="titlepage">
                   13521:               <div>
                   13522:                 <div>
1.67      hubertf  13523:                   <h3 class="title"><a name=
1.68      rillig   13524:                   "cpp-list-examples"></a>16.4.2.&nbsp;Examples of
1.60      rillig   13525:                   CPP defines for some platforms</h3>
                   13526:                 </div>
                   13527:               </div>
                   13528:             </div>
                   13529: 
                   13530:             <p>The list of the CPP identification macros for
                   13531:             hardware and operating system may depend on the
                   13532:             compiler that is used. The following list contains some
                   13533:             examples that may help you to choose the right ones.
                   13534:             For example, if you want to conditionally compile code
                   13535:             on Solaris, don't use <code class=
                   13536:             "varname">__sun__</code>, as the SunPro compiler does
                   13537:             not define it. Use <code class="varname">__sun</code>
                   13538:             instead.</p>
                   13539: 
                   13540:             <div class="variablelist">
                   13541:               <dl>
1.61      rillig   13542:                 <dt><span class="term">GCC 3.3.3 + SuSE Linux 9.1 +
                   13543:                 i386</span></dt>
                   13544: 
                   13545:                 <dd>
1.62      rillig   13546:                   <p>__ELF__, __gnu_linux__, __i386, __i386__,
1.61      rillig   13547:                   __linux, __linux__, __unix, __unix__, i386,
                   13548:                   linux, unix.</p>
                   13549:                 </dd>
                   13550: 
                   13551:                 <dt><span class="term">GCC 2.95 + NetBSD 1.6.2 +
                   13552:                 i386</span></dt>
                   13553: 
                   13554:                 <dd>
1.62      rillig   13555:                   <p>__ELF__, __NetBSD__, __i386, __i386__,
1.61      rillig   13556:                   i386.</p>
                   13557:                 </dd>
                   13558: 
                   13559:                 <dt><span class="term">GCC 3.3.3 + NetBSD 2.0 +
                   13560:                 i386</span></dt>
1.60      rillig   13561: 
                   13562:                 <dd>
1.62      rillig   13563:                   <p>__ELF__, __NetBSD__, __i386, __i386__,
1.61      rillig   13564:                   i386.</p>
1.60      rillig   13565:                 </dd>
                   13566: 
                   13567:                 <dt><span class="term">GCC 4 + Solaris 8 +
                   13568:                 SPARC</span></dt>
                   13569: 
                   13570:                 <dd>
                   13571:                   <p>__ELF__, __sparc, __sparc__, __sun, __sun__,
                   13572:                   __SVR4, __svr4__, __unix, __unix__, sparc, sun,
                   13573:                   unix.</p>
                   13574:                 </dd>
1.61      rillig   13575: 
                   13576:                 <dt><span class="term">SunPro 5.7 + Solaris 8 +
                   13577:                 SPARC</span></dt>
                   13578: 
                   13579:                 <dd>
                   13580:                   <p>__SVR4, __sparc, __sun, __unix, sparc, sun,
                   13581:                   unix.</p>
                   13582:                 </dd>
1.60      rillig   13583:               </dl>
                   13584:             </div>
                   13585:           </div>
                   13586: 
1.67      hubertf  13587:           <div class="sect2" lang="en">
1.60      rillig   13588:             <div class="titlepage">
                   13589:               <div>
                   13590:                 <div>
1.67      hubertf  13591:                   <h3 class="title"><a name=
1.68      rillig   13592:                   "cpp-list"></a>16.4.3.&nbsp;Getting a list of CPP
1.51      rillig   13593:                   defines</h3>
                   13594:                 </div>
                   13595:               </div>
                   13596:             </div>
                   13597: 
1.60      rillig   13598:             <p>If your system uses the GNU C Compiler, you can get
                   13599:             a list of symbols that are defined by default, e.g. to
                   13600:             identify the platform, with the following command:</p>
1.51      rillig   13601:             <pre class="programlisting">
                   13602:     gcc -E -dM - &lt; /dev/null 
                   13603: </pre>
1.60      rillig   13604: 
                   13605:             <p>On other systems you may get the list by using the
                   13606:             system's syscall trace utility (ktrace, truss, strace)
                   13607:             to have a look which arguments are passed to the actual
                   13608:             compiler.</p>
1.51      rillig   13609:           </div>
1.1       grant    13610:         </div>
                   13611: 
1.67      hubertf  13612:         <div class="sect1" lang="en">
1.1       grant    13613:           <div class="titlepage">
                   13614:             <div>
                   13615:               <div>
                   13616:                 <h2 class="title" style="clear: both"><a name=
1.68      rillig   13617:                 "package-specific-actions"></a>16.5.&nbsp;Package
1.1       grant    13618:                 specific actions</h2>
                   13619:               </div>
                   13620:             </div>
                   13621:           </div>
                   13622: 
1.67      hubertf  13623:           <div class="sect2" lang="en">
1.1       grant    13624:             <div class="titlepage">
                   13625:               <div>
                   13626:                 <div>
1.67      hubertf  13627:                   <h3 class="title"><a name=
1.68      rillig   13628:                   "user-interaction"></a>16.5.1.&nbsp;User
1.2       hubertf  13629:                   interaction</h3>
1.1       grant    13630:                 </div>
                   13631:               </div>
                   13632:             </div>
                   13633: 
                   13634:             <p>Occasionally, packages require interaction from the
                   13635:             user, and this can be in a number of ways:</p>
                   13636: 
                   13637:             <div class="itemizedlist">
                   13638:               <ul type="disc">
                   13639:                 <li>
                   13640:                   <p>help in fetching the distfiles</p>
                   13641:                 </li>
                   13642: 
                   13643:                 <li>
                   13644:                   <p>help to configure the package before it is
                   13645:                   built</p>
                   13646:                 </li>
                   13647: 
                   13648:                 <li>
                   13649:                   <p>help during the build process</p>
                   13650:                 </li>
                   13651: 
                   13652:                 <li>
                   13653:                   <p>help during the installation of a package</p>
                   13654:                 </li>
                   13655:               </ul>
                   13656:             </div>
                   13657: 
1.14      xtraeme  13658:             <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1       grant    13659:             definition is provided to notify the pkgsrc mechanism
                   13660:             of an interactive stage which will be needed, and this
1.45      wiz      13661:             should be set in the package's <code xmlns=
                   13662:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     13663:             "filename">Makefile</code>, e.g.:</p>
1.1       grant    13664:             <pre class="programlisting">
1.51      rillig   13665:     INTERACTIVE_STAGE=      build
1.1       grant    13666: </pre>
                   13667: 
                   13668:             <p>Multiple interactive stages can be specified:</p>
                   13669:             <pre class="programlisting">
1.51      rillig   13670:     INTERACTIVE_STAGE=      configure install
1.1       grant    13671: </pre>
                   13672:           </div>
                   13673: 
1.67      hubertf  13674:           <div class="sect2" lang="en">
1.1       grant    13675:             <div class="titlepage">
                   13676:               <div>
                   13677:                 <div>
1.67      hubertf  13678:                   <h3 class="title"><a name=
1.68      rillig   13679:                   "handling-licenses"></a>16.5.2.&nbsp;Handling
1.1       grant    13680:                   licenses</h3>
                   13681:                 </div>
                   13682:               </div>
                   13683:             </div>
                   13684: 
1.44      gdt      13685:             <p>A package may be covered by a license which the user
                   13686:             has or has not agreed to accept. For these cases,
                   13687:             pkgsrc contains a mechanism to note that a package is
                   13688:             covered by a particular license, and the package cannot
                   13689:             be built unless the user has accepted the license.
                   13690:             (Installation of binary packages are not currently
                   13691:             subject to this mechanism.) Packages with licenses that
                   13692:             are either Open Source according to the Open Source
                   13693:             Initiative or Free according to the Free Software
                   13694:             Foundation will not be marked with a license tag.
                   13695:             Packages with licenses that have not been determined to
                   13696:             meet either definition will be marked with a license
                   13697:             tag referring to the license. This will prevent
                   13698:             building unless pkgsrc is informed that the license is
                   13699:             acceptable, and enables displaying the license.</p>
                   13700: 
                   13701:             <p>The license tag mechanism is intended to address
                   13702:             copyright-related issues surrounding building,
                   13703:             installing and using a package, and not to address
                   13704:             redistribution issues (see <code class=
                   13705:             "varname">RESTRICTED</code> and <code class=
                   13706:             "varname">NO_SRC_ON_FTP</code>, etc.). However, the
                   13707:             above definition of licenses for which tags are not
                   13708:             needed implies that packages with redistribution
                   13709:             restrictions should have tags.</p>
                   13710: 
                   13711:             <p>Denoting that a package is covered by a particular
1.45      wiz      13712:             license is done by placing the license in <code xmlns=
                   13713:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.44      gdt      13714:             "filename">pkgsrc/licenses</code> and setting the
                   13715:             <code class="varname">LICENSE</code> variable to a
                   13716:             string identifying the license, e.g. in <a xmlns=
1.14      xtraeme  13717:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.44      gdt      13718:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/xv/README.html"
1.45      wiz      13719:             target="_top"><code xmlns="" class=
                   13720:             "filename">graphics/xv</code></a>:</p>
1.1       grant    13721:             <pre class="programlisting">
1.51      rillig   13722:     LICENSE=        xv-license
1.1       grant    13723: </pre>
                   13724: 
                   13725:             <p>When trying to build, the user will get a notice
1.44      gdt      13726:             that the package is covered by a license which has not
                   13727:             been accepted:</p>
1.1       grant    13728:             <pre class="programlisting">
1.51      rillig   13729:     <code class="prompt">%</code> <strong class=
1.14      xtraeme  13730: "userinput"><code>make</code></strong>
1.51      rillig   13731:     ===&gt; xv-3.10anb9 has an unacceptable license: xv-license.
                   13732:     ===&gt;     To view the license, enter "/usr/bin/make show-license".
                   13733:     ===&gt;     To indicate acceptance, add this line to your /etc/mk.conf:
                   13734:     ===&gt;     ACCEPTABLE_LICENSES+=xv-license
                   13735:     *** Error code 1
1.1       grant    13736: </pre>
                   13737: 
1.14      xtraeme  13738:             <p>The license can be viewed with <span><strong class=
                   13739:             "command">make show-license</strong></span>, and if it
                   13740:             is considered appropriate, the line printed above can
1.45      wiz      13741:             be added to <code xmlns=
                   13742:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13743:             "filename">/etc/mk.conf</code> to indicate acceptance
                   13744:             of the particular license:</p>
1.1       grant    13745:             <pre class="programlisting">
1.51      rillig   13746:     ACCEPTABLE_LICENSES+=xv-license
1.1       grant    13747: </pre>
                   13748: 
                   13749:             <p>When adding a package with a new license, the
1.45      wiz      13750:             license text should be added to <code xmlns=
                   13751:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13752:             "filename">pkgsrc/licenses</code> for displaying. A
                   13753:             list of known licenses can be seen in this directory as
                   13754:             well as by looking at the list of (commented out)
                   13755:             <code class="varname">ACCEPTABLE_LICENSES</code>
1.45      wiz      13756:             variable settings in <code xmlns=
                   13757:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13758:             "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1       grant    13759: 
1.44      gdt      13760:             <p>The use of <code class=
                   13761:             "varname">LICENSE=shareware</code>, <code class=
                   13762:             "varname">LICENSE=no-commercial-use</code>, and similar
                   13763:             language is deprecated because it does not crisply
                   13764:             refer to a particular license text. Another problem
                   13765:             with such usage is that it does not enable a user to
                   13766:             denote acceptance of the license for a single package
                   13767:             without accepting the same license text for another
                   13768:             package. In particular, this can be inappropriate when
                   13769:             e.g. one accepts a particular license to indicate to
                   13770:             pkgsrc that a fee has been paid.</p>
1.1       grant    13771:           </div>
                   13772: 
1.67      hubertf  13773:           <div class="sect2" lang="en">
1.1       grant    13774:             <div class="titlepage">
                   13775:               <div>
                   13776:                 <div>
1.30      wiz      13777:                   <h3 class="title"><a name=
1.68      rillig   13778:                   "installing-score-files"></a>16.5.3.&nbsp;Installing
1.30      wiz      13779:                   score files</h3>
1.1       grant    13780:                 </div>
                   13781:               </div>
                   13782:             </div>
                   13783: 
                   13784:             <p>Certain packages, most of them in the games
                   13785:             category, install a score file that allows all users on
                   13786:             the system to record their highscores. In order for
                   13787:             this to work, the binaries need to be installed setgid
                   13788:             and the score files owned by the appropriate group
                   13789:             and/or owner (traditionally the "games" user/group).
                   13790:             The following variables, documented in more detail in
1.45      wiz      13791:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13792:             class="filename">mk/defaults/mk.conf</code>, control
                   13793:             this behaviour: <code class=
1.14      xtraeme  13794:             "varname">SETGIDGAME</code>, <code class=
                   13795:             "varname">GAMEDATAMODE</code>, <code class=
                   13796:             "varname">GAMEGRP</code>, <code class=
                   13797:             "varname">GAMEMODE</code>, <code class=
                   13798:             "varname">GAMEOWN</code>.</p>
1.1       grant    13799: 
                   13800:             <p>Note that per default, setgid installation of games
1.14      xtraeme  13801:             is disabled; setting <code class=
                   13802:             "varname">SETGIDGAME=YES</code> will set all the other
1.1       grant    13803:             variables accordingly.</p>
                   13804: 
                   13805:             <p>A package should therefor never hard code file
1.14      xtraeme  13806:             ownership or access permissions but rely on
                   13807:             <code class="varname">INSTALL_GAME</code> and
                   13808:             <code class="varname">INSTALL_GAME_DATA</code> to set
                   13809:             these correctly.</p>
1.1       grant    13810:           </div>
                   13811: 
1.67      hubertf  13812:           <div class="sect2" lang="en">
1.1       grant    13813:             <div class="titlepage">
                   13814:               <div>
                   13815:                 <div>
1.67      hubertf  13816:                   <h3 class="title"><a name=
1.68      rillig   13817:                   "perl-scripts"></a>16.5.4.&nbsp;Packages
1.30      wiz      13818:                   containing perl scripts</h3>
1.1       grant    13819:                 </div>
                   13820:               </div>
                   13821:             </div>
                   13822: 
                   13823:             <p>If your package contains interpreted perl scripts,
1.14      xtraeme  13824:             set <code class="varname">REPLACE_PERL</code> to ensure
                   13825:             that the proper interpreter path is set. <code class=
                   13826:             "varname">REPLACE_PERL</code> should contain a list of
                   13827:             scripts, relative to <code class=
                   13828:             "varname">WRKSRC</code>, that you want adjusted.</p>
1.1       grant    13829:           </div>
                   13830: 
1.67      hubertf  13831:           <div class="sect2" lang="en">
1.1       grant    13832:             <div class="titlepage">
                   13833:               <div>
                   13834:                 <div>
1.67      hubertf  13835:                   <h3 class="title"><a name=
1.68      rillig   13836:                   "hardcoded-paths"></a>16.5.5.&nbsp;Packages with
1.1       grant    13837:                   hardcoded paths to other interpreters</h3>
                   13838:                 </div>
                   13839:               </div>
                   13840:             </div>
                   13841: 
                   13842:             <p>Your package may also contain scripts with hardcoded
                   13843:             paths to other interpreters besides (or as well as)
                   13844:             perl. To correct the full pathname to the script
                   13845:             interpreter, you need to set the following definitions
1.45      wiz      13846:             in your <code xmlns=
                   13847:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13848:             "filename">Makefile</code> (we shall use
                   13849:             <span><strong class="command">tclsh</strong></span> in
                   13850:             this example):</p>
1.1       grant    13851:             <pre class="programlisting">
1.51      rillig   13852:     REPLACE_INTERPRETER+=   tcl
                   13853:     _REPLACE.tcl.old=       .*/bin/tclsh
                   13854:     _REPLACE.tcl.new=       ${PREFIX}/bin/tclsh
                   13855:     _REPLACE_FILES.tcl=     # list of tcl scripts which need to be fixed,
                   13856:                             # relative to ${WRKSRC}, just as in REPLACE_PERL
1.1       grant    13857: </pre>
                   13858:           </div>
                   13859: 
1.67      hubertf  13860:           <div class="sect2" lang="en">
1.1       grant    13861:             <div class="titlepage">
                   13862:               <div>
                   13863:                 <div>
1.67      hubertf  13864:                   <h3 class="title"><a name=
1.68      rillig   13865:                   "perl-modules"></a>16.5.6.&nbsp;Packages
1.30      wiz      13866:                   installing perl modules</h3>
1.1       grant    13867:                 </div>
                   13868:               </div>
                   13869:             </div>
                   13870: 
                   13871:             <p>Makefiles of packages providing perl5 modules should
1.45      wiz      13872:             include the Makefile fragment <code xmlns=
                   13873:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13874:             "filename">../../lang/perl5/module.mk</code>. It
                   13875:             provides a <span><strong class=
                   13876:             "command">do-configure</strong></span> target for the
                   13877:             standard perl configuration for such modules as well as
                   13878:             various hooks to tune this configuration. See comments
                   13879:             in this file for details.</p>
1.1       grant    13880: 
                   13881:             <p>Perl5 modules will install into different places
                   13882:             depending on the version of perl used during the build
                   13883:             process. To address this, pkgsrc will append lines to
1.45      wiz      13884:             the <code xmlns=
                   13885:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13886:             "filename">PLIST</code> corresponding to the files
                   13887:             listed in the installed <code xmlns=
                   13888:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13889:             "filename">.packlist</code> file generated by most
                   13890:             perl5 modules. This is invoked by defining <code class=
                   13891:             "varname">PERL5_PACKLIST</code> to a space-separated
                   13892:             list of paths to packlist files, e.g.:</p>
1.1       grant    13893:             <pre class="programlisting">
1.51      rillig   13894:     PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
1.1       grant    13895: </pre>
                   13896: 
1.14      xtraeme  13897:             <p>The variables <code class=
                   13898:             "varname">PERL5_SITELIB</code>, <code class=
                   13899:             "varname">PERL5_SITEARCH</code>, and <code class=
                   13900:             "varname">PERL5_ARCHLIB</code> represent the three
1.1       grant    13901:             locations in which perl5 modules may be installed, and
                   13902:             may be used by perl5 packages that don't have a
                   13903:             packlist. These three variables are also substituted
1.45      wiz      13904:             for in the <code xmlns=
                   13905:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13906:             "filename">PLIST</code>.</p>
1.1       grant    13907:           </div>
                   13908: 
1.67      hubertf  13909:           <div class="sect2" lang="en">
1.1       grant    13910:             <div class="titlepage">
                   13911:               <div>
                   13912:                 <div>
1.67      hubertf  13913:                   <h3 class="title"><a name=
1.68      rillig   13914:                   "faq.info-files"></a>16.5.7.&nbsp;Packages
1.1       grant    13915:                   installing info files</h3>
                   13916:                 </div>
                   13917:               </div>
                   13918:             </div>
                   13919: 
                   13920:             <p>Some packages install info files or use the
                   13921:             &#8220;<span class="quote">makeinfo</span>&#8221; or
                   13922:             &#8220;<span class="quote">install-info</span>&#8221;
                   13923:             commands. Each of the info files:</p>
                   13924: 
                   13925:             <div class="itemizedlist">
                   13926:               <ul type="disc">
                   13927:                 <li>
                   13928:                   <p>is considered to be installed in the directory
1.45      wiz      13929:                   <code xmlns=
                   13930:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13931:                   "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1       grant    13932:                 </li>
                   13933: 
                   13934:                 <li>
                   13935:                   <p>is registered in the Info directory file
1.45      wiz      13936:                   <code xmlns=
                   13937:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13938:                   "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1       grant    13939:                 </li>
                   13940: 
                   13941:                 <li>
                   13942:                   <p>and must be listed as a filename in the
1.14      xtraeme  13943:                   <code class="varname">INFO_FILES</code> variable
                   13944:                   in the package Makefile.</p>
1.1       grant    13945:                 </li>
                   13946:               </ul>
                   13947:             </div>
                   13948: 
1.14      xtraeme  13949:             <p><code class="varname">INFO_DIR</code> defaults to
1.1       grant    13950:             &#8220;<span class="quote">info</span>&#8221; and can
1.45      wiz      13951:             be overridden in the package Makefile. <code xmlns=
                   13952:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13953:             "filename">INSTALL</code> and <code xmlns=
                   13954:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13955:             "filename">DEINSTALL</code> scripts will be generated
                   13956:             to handle registration of the info files in the Info
1.1       grant    13957:             directory file. The &#8220;<span class=
                   13958:             "quote">install-info</span>&#8221; command used for the
                   13959:             info files registration is either provided by the
                   13960:             system, or by a special purpose package automatically
                   13961:             added as dependency if needed.</p>
                   13962: 
                   13963:             <p>A package which needs the &#8220;<span class=
                   13964:             "quote">makeinfo</span>&#8221; command at build time
1.14      xtraeme  13965:             must define the variable <code class=
                   13966:             "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1       grant    13967:             minimum version of the &#8220;<span class=
                   13968:             "quote">makeinfo</span>&#8221; command is needed it
1.14      xtraeme  13969:             should be noted with the <code class=
                   13970:             "varname">TEXINFO_REQD</code> variable in the package
1.45      wiz      13971:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13972:             class="filename">Makefile</code>. By default, a minimum
                   13973:             version of 3.12 is required. If the system does not
                   13974:             provide a <span><strong class=
1.14      xtraeme  13975:             "command">makeinfo</strong></span> command or if it
                   13976:             does not match the required minimum, a build dependency
                   13977:             on the <a xmlns=
                   13978:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    13979:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.45      wiz      13980:             target="_top"><code xmlns="" class=
                   13981:             "filename">devel/gtexinfo</code></a> package will be
1.20      ben      13982:             added automatically.</p>
1.1       grant    13983: 
                   13984:             <p>The build and installation process of the software
                   13985:             provided by the package should not use the
1.14      xtraeme  13986:             <span><strong class=
                   13987:             "command">install-info</strong></span> command as the
                   13988:             registration of info files is the task of the package
1.45      wiz      13989:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13990:             class="filename">INSTALL</code> script, and it must use
                   13991:             the appropriate <span><strong class=
1.14      xtraeme  13992:             "command">makeinfo</strong></span> command.</p>
1.1       grant    13993: 
1.47      reed     13994:             <p>To achieve this goal, the pkgsrc infrastructure
1.14      xtraeme  13995:             creates overriding scripts for the <span><strong class=
                   13996:             "command">install-info</strong></span> and
                   13997:             <span><strong class="command">makeinfo</strong></span>
                   13998:             commands in a directory listed early in <code class=
                   13999:             "varname">PATH</code>.</p>
1.1       grant    14000: 
1.14      xtraeme  14001:             <p>The script overriding <span><strong class=
                   14002:             "command">install-info</strong></span> has no effect
                   14003:             except the logging of a message. The script overriding
                   14004:             <span><strong class="command">makeinfo</strong></span>
                   14005:             logs a message and according to the value of
                   14006:             <code class="varname">USE_MAKEINFO</code> and
                   14007:             <code class="varname">TEXINFO_REQD</code> either run
                   14008:             the appropriate <span><strong class=
                   14009:             "command">makeinfo</strong></span> command or exit on
                   14010:             error.</p>
1.1       grant    14011:           </div>
                   14012: 
1.67      hubertf  14013:           <div class="sect2" lang="en">
1.57      minskim  14014:             <div class="titlepage">
                   14015:               <div>
                   14016:                 <div>
1.67      hubertf  14017:                   <h3 class="title"><a name=
1.68      rillig   14018:                   "manpages"></a>16.5.8.&nbsp;Packages installing
1.57      minskim  14019:                   man pages</h3>
                   14020:                 </div>
                   14021:               </div>
                   14022:             </div>
                   14023: 
                   14024:             <p>Many packages install manual pages. The man pages
                   14025:             are installed under <code class=
                   14026:             "varname">${PREFIX}/${PKGMANDIR}</code> which is
                   14027:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   14028:             class="filename">/usr/pkg/man</code> by default.
                   14029:             <code class="varname">PKGMANDIR</code> defaults to
                   14030:             &#8220;<span class="quote">man</span>&#8221;. For
                   14031:             example, you can set <code class=
                   14032:             "varname">PKGMANDIR</code> to &#8220;<span class=
                   14033:             "quote">share/man</span>&#8221; to have man pages
                   14034:             install under <code xmlns=
                   14035:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   14036:             "filename">/usr/pkg/share/man/</code> by default.</p>
                   14037: 
                   14038:             <div class="note" style=
                   14039:             "margin-left: 0.5in; margin-right: 0.5in;">
                   14040:               <h3 class="title">Note</h3>
                   14041: 
                   14042:               <p>The support for a custom <code class=
                   14043:               "varname">PKGMANDIR</code> is not complete.</p>
                   14044:             </div>
                   14045: 
                   14046:             <p>The <code xmlns=
                   14047:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   14048:             "filename">PLIST</code> files can just use <code xmlns=
                   14049:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   14050:             "filename">man/</code> as the top level directory for
                   14051:             the man page file entries and the pkgsrc framework will
                   14052:             convert as needed.</p>
                   14053: 
                   14054:             <p>Packages that are configured with <code class=
                   14055:             "varname">GNU_CONFIGURE</code> set as
                   14056:             &#8220;<span class="quote">yes</span>&#8221;, by
                   14057:             default will use the <code xmlns=
                   14058:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   14059:             "filename">./configure</code> --mandir switch to set
                   14060:             where the man pages should be installed. The path is
                   14061:             <code class="varname">GNU_CONFIGURE_MANDIR</code> which
                   14062:             defaults to <code class=
                   14063:             "varname">${PREFIX}/${PKGMANDIR}</code>.</p>
                   14064: 
                   14065:             <p>Packages that use <code class=
                   14066:             "varname">GNU_CONFIGURE</code> but do not use --mandir,
                   14067:             can set <code class=
                   14068:             "varname">CONFIGURE_HAS_MANDIR</code> to
                   14069:             &#8220;<span class="quote">no</span>&#8221;. Or if the
                   14070:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   14071:             class="filename">./configure</code> script uses a
                   14072:             non-standard use of --mandir, you can set <code class=
                   14073:             "varname">GNU_CONFIGURE_MANDIR</code> as needed.</p>
                   14074: 
                   14075:             <p>See <a href="#manpage-compression" title=
                   14076:             "10.5.&nbsp;Man page compression">Section&nbsp;10.5,
                   14077:             &#8220;Man page compression&#8221;</a> for information
                   14078:             on installation of compressed manual pages.</p>
                   14079:           </div>
                   14080: 
1.67      hubertf  14081:           <div class="sect2" lang="en">
1.1       grant    14082:             <div class="titlepage">
                   14083:               <div>
                   14084:                 <div>
1.67      hubertf  14085:                   <h3 class="title"><a name=
1.68      rillig   14086:                   "gconf2-data-files"></a>16.5.9.&nbsp;Packages
1.30      wiz      14087:                   installing GConf2 data files</h3>
1.1       grant    14088:                 </div>
                   14089:               </div>
                   14090:             </div>
                   14091: 
1.45      wiz      14092:             <p>If a package installs <code xmlns=
                   14093:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   14094:             "filename">.schemas</code> or <code xmlns=
                   14095:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14096:             "filename">.entries</code> files, used by GConf2, you
1.1       grant    14097:             need to take some extra steps to make sure they get
                   14098:             registered in the database:</p>
                   14099: 
                   14100:             <div class="orderedlist">
                   14101:               <ol type="1">
                   14102:                 <li>
1.45      wiz      14103:                   <p>Include <code xmlns=
                   14104:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14105:                   "filename">../../devel/GConf2/schemas.mk</code>
1.45      wiz      14106:                   instead of its <code xmlns=
                   14107:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14108:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    14109:                   care of rebuilding the GConf2 database at
                   14110:                   installation and deinstallation time, and tells
                   14111:                   the package where to install GConf2 data files
                   14112:                   using some standard configure arguments. It also
                   14113:                   disallows any access to the database directly
                   14114:                   from the package.</p>
                   14115:                 </li>
                   14116: 
                   14117:                 <li>
                   14118:                   <p>Ensure that the package installs its
1.45      wiz      14119:                   <code xmlns=
                   14120:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14121:                   "filename">.schemas</code> files under
                   14122:                   <code xmlns=
                   14123:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14124:                   "filename">${PREFIX}/share/gconf/schemas</code>.
1.45      wiz      14125:                   If they get installed under <code xmlns=
                   14126:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14127:                   "filename">${PREFIX}/etc</code>, you will need to
1.1       grant    14128:                   manually patch the package.</p>
                   14129:                 </li>
                   14130: 
                   14131:                 <li>
                   14132:                   <p>Check the PLIST and remove any entries under
                   14133:                   the etc/gconf directory, as they will be handled
                   14134:                   automatically. See <a href="#faq.conf" title=
1.38      dillo    14135:                   "7.14.&nbsp;How do I change the location of configuration files?">
                   14136:                   Section&nbsp;7.14, &#8220;How do I change the
1.35      jmmv     14137:                   location of configuration files?&#8221;</a> for
                   14138:                   more information.</p>
1.1       grant    14139:                 </li>
                   14140: 
                   14141:                 <li>
1.14      xtraeme  14142:                   <p>Define the <code class=
                   14143:                   "varname">GCONF2_SCHEMAS</code> variable in your
1.45      wiz      14144:                   <code xmlns=
                   14145:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14146:                   "filename">Makefile</code> with a list of all
                   14147:                   <code xmlns=
                   14148:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14149:                   "filename">.schemas</code> files installed by the
                   14150:                   package, if any. Names must not contain any
                   14151:                   directories in them.</p>
1.1       grant    14152:                 </li>
                   14153: 
                   14154:                 <li>
1.14      xtraeme  14155:                   <p>Define the <code class=
                   14156:                   "varname">GCONF2_ENTRIES</code> variable in your
1.45      wiz      14157:                   <code xmlns=
                   14158:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14159:                   "filename">Makefile</code> with a list of all
                   14160:                   <code xmlns=
                   14161:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14162:                   "filename">.entries</code> files installed by the
                   14163:                   package, if any. Names must not contain any
                   14164:                   directories in them.</p>
1.1       grant    14165:                 </li>
                   14166:               </ol>
                   14167:             </div>
                   14168:           </div>
                   14169: 
1.67      hubertf  14170:           <div class="sect2" lang="en">
1.1       grant    14171:             <div class="titlepage">
                   14172:               <div>
                   14173:                 <div>
1.30      wiz      14174:                   <h3 class="title"><a name=
1.68      rillig   14175:                   "scrollkeeper-data-files"></a>16.5.10.&nbsp;Packages
1.30      wiz      14176:                   installing scrollkeeper data files</h3>
1.1       grant    14177:                 </div>
                   14178:               </div>
                   14179:             </div>
                   14180: 
1.45      wiz      14181:             <p>If a package installs <code xmlns=
                   14182:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14183:             "filename">.omf</code> files, used by scrollkeeper, you
                   14184:             need to take some extra steps to make sure they get
                   14185:             registered in the database:</p>
1.1       grant    14186: 
                   14187:             <div class="orderedlist">
                   14188:               <ol type="1">
                   14189:                 <li>
1.45      wiz      14190:                   <p>Include <code xmlns=
                   14191:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14192:                   "filename">../../textproc/scrollkeeper/omf.mk</code>
1.45      wiz      14193:                   instead of its <code xmlns=
                   14194:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14195:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    14196:                   care of rebuilding the scrollkeeper database at
                   14197:                   installation and deinstallation time, and
                   14198:                   disallows any access to it directly from the
                   14199:                   package.</p>
                   14200:                 </li>
                   14201: 
                   14202:                 <li>
                   14203:                   <p>Check the PLIST and remove any entries under
1.45      wiz      14204:                   the <code xmlns=
                   14205:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14206:                   "filename">libdata/scrollkeeper</code> directory,
1.1       grant    14207:                   as they will be handled automatically.</p>
                   14208:                 </li>
                   14209: 
                   14210:                 <li>
1.45      wiz      14211:                   <p>Remove the <code xmlns=
                   14212:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14213:                   "filename">share/omf</code> directory from the
                   14214:                   PLIST. It will be handled by scrollkeeper.</p>
1.1       grant    14215:                 </li>
                   14216:               </ol>
                   14217:             </div>
                   14218:           </div>
                   14219: 
1.67      hubertf  14220:           <div class="sect2" lang="en">
1.1       grant    14221:             <div class="titlepage">
                   14222:               <div>
                   14223:                 <div>
1.67      hubertf  14224:                   <h3 class="title"><a name=
1.68      rillig   14225:                   "x11-fonts"></a>16.5.11.&nbsp;Packages installing
1.1       grant    14226:                   X11 fonts</h3>
                   14227:                 </div>
                   14228:               </div>
                   14229:             </div>
                   14230: 
                   14231:             <p>If a package installs font files, you will need to
                   14232:             rebuild the fonts database in the directory where they
                   14233:             get installed at installation and deinstallation time.
1.65      hubertf  14234:             This can be automatically done by using the pkginstall
                   14235:             framework.</p>
1.1       grant    14236: 
1.65      hubertf  14237:             <p>You can list the directories where fonts are
                   14238:             installed in the <code class=
                   14239:             "varname">FONTS_DIRS.<em class=
                   14240:             "replaceable"><code>type</code></em></code> variables,
                   14241:             where <em class="replaceable"><code>type</code></em>
                   14242:             can be one of &#8220;<span class=
                   14243:             "quote">ttf</span>&#8221;, &#8220;<span class=
                   14244:             "quote">type1</span>&#8221; or &#8220;<span class=
                   14245:             "quote">x11</span>&#8221;. Also make sure that the
                   14246:             database file <code xmlns=
1.45      wiz      14247:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14248:             "filename">fonts.dir</code> is not listed in the
1.1       grant    14249:             PLIST.</p>
                   14250: 
                   14251:             <p>Note that you should not create new directories for
                   14252:             fonts; instead use the standard ones to avoid that the
                   14253:             user needs to manually configure his X server to find
                   14254:             them.</p>
                   14255:           </div>
                   14256: 
1.67      hubertf  14257:           <div class="sect2" lang="en">
1.1       grant    14258:             <div class="titlepage">
                   14259:               <div>
                   14260:                 <div>
1.67      hubertf  14261:                   <h3 class="title"><a name=
1.68      rillig   14262:                   "gtk2-modules"></a>16.5.12.&nbsp;Packages
1.30      wiz      14263:                   installing GTK2 modules</h3>
1.1       grant    14264:                 </div>
                   14265:               </div>
                   14266:             </div>
                   14267: 
1.47      reed     14268:             <p>If a package installs GTK2 immodules or loaders, you
1.1       grant    14269:             need to take some extra steps to get them registered in
                   14270:             the GTK2 database properly:</p>
                   14271: 
                   14272:             <div class="orderedlist">
                   14273:               <ol type="1">
                   14274:                 <li>
1.45      wiz      14275:                   <p>Include <code xmlns=
                   14276:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14277:                   "filename">../../x11/gtk2/modules.mk</code>
1.45      wiz      14278:                   instead of its <code xmlns=
                   14279:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14280:                   "filename">buildlink3.mk</code> file. This takes
                   14281:                   care of rebuilding the database at installation
                   14282:                   and deinstallation time.</p>
1.1       grant    14283:                 </li>
                   14284: 
                   14285:                 <li>
1.14      xtraeme  14286:                   <p>Set <code class=
                   14287:                   "varname">GTK2_IMMODULES=YES</code> if your
                   14288:                   package installs GTK2 immodules.</p>
1.1       grant    14289:                 </li>
                   14290: 
                   14291:                 <li>
1.14      xtraeme  14292:                   <p>Set <code class=
                   14293:                   "varname">GTK2_LOADERS=YES</code> if your package
                   14294:                   installs GTK2 loaders.</p>
1.1       grant    14295:                 </li>
                   14296: 
                   14297:                 <li>
1.47      reed     14298:                   <p>Patch the package to not touch any of the GTK2
1.1       grant    14299:                   databases directly. These are:</p>
                   14300: 
                   14301:                   <div class="itemizedlist">
                   14302:                     <ul type="disc">
                   14303:                       <li>
1.45      wiz      14304:                         <p><code xmlns=
                   14305:                         "http://www.w3.org/TR/xhtml1/transitional"
                   14306:                         class=
1.14      xtraeme  14307:                         "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1       grant    14308:                       </li>
                   14309: 
                   14310:                       <li>
1.45      wiz      14311:                         <p><code xmlns=
                   14312:                         "http://www.w3.org/TR/xhtml1/transitional"
                   14313:                         class=
1.14      xtraeme  14314:                         "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1       grant    14315:                       </li>
                   14316:                     </ul>
                   14317:                   </div>
                   14318:                 </li>
                   14319: 
                   14320:                 <li>
                   14321:                   <p>Check the PLIST and remove any entries under
1.45      wiz      14322:                   the <code xmlns=
                   14323:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14324:                   "filename">libdata/gtk-2.0</code> directory, as
                   14325:                   they will be handled automatically.</p>
1.1       grant    14326:                 </li>
                   14327:               </ol>
                   14328:             </div>
                   14329:           </div>
                   14330: 
1.67      hubertf  14331:           <div class="sect2" lang="en">
1.1       grant    14332:             <div class="titlepage">
                   14333:               <div>
                   14334:                 <div>
1.67      hubertf  14335:                   <h3 class="title"><a name=
1.68      rillig   14336:                   "sgml-xml-data"></a>16.5.13.&nbsp;Packages
1.30      wiz      14337:                   installing SGML or XML data</h3>
1.1       grant    14338:                 </div>
                   14339:               </div>
                   14340:             </div>
                   14341: 
                   14342:             <p>If a package installs SGML or XML data files that
                   14343:             need to be registered in system-wide catalogs (like
                   14344:             DTDs, sub-catalogs, etc.), you need to take some extra
                   14345:             steps:</p>
                   14346: 
                   14347:             <div class="orderedlist">
                   14348:               <ol type="1">
                   14349:                 <li>
1.45      wiz      14350:                   <p>Include <code xmlns=
                   14351:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14352:                   "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
1.45      wiz      14353:                   in your <code xmlns=
                   14354:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14355:                   "filename">Makefile</code>, which takes care of
                   14356:                   registering those files in system-wide catalogs
                   14357:                   at installation and deinstallation time.</p>
1.1       grant    14358:                 </li>
                   14359: 
                   14360:                 <li>
1.14      xtraeme  14361:                   <p>Set <code class="varname">SGML_CATALOGS</code>
                   14362:                   to the full path of any SGML catalogs installed
                   14363:                   by the package.</p>
1.1       grant    14364:                 </li>
                   14365: 
                   14366:                 <li>
1.14      xtraeme  14367:                   <p>Set <code class="varname">XML_CATALOGS</code>
                   14368:                   to the full path of any XML catalogs installed by
1.1       grant    14369:                   the package.</p>
                   14370:                 </li>
                   14371: 
                   14372:                 <li>
1.14      xtraeme  14373:                   <p>Set <code class="varname">SGML_ENTRIES</code>
                   14374:                   to individual entries to be added to the SGML
1.1       grant    14375:                   catalog. These come in groups of three strings;
                   14376:                   see xmlcatmgr(1) for more information
                   14377:                   (specifically, arguments recognized by the 'add'
                   14378:                   action). Note that you will normally not use this
                   14379:                   variable.</p>
                   14380:                 </li>
                   14381: 
                   14382:                 <li>
1.14      xtraeme  14383:                   <p>Set <code class="varname">XML_ENTRIES</code>
                   14384:                   to individual entries to be added to the XML
1.1       grant    14385:                   catalog. These come in groups of three strings;
                   14386:                   see xmlcatmgr(1) for more information
                   14387:                   (specifically, arguments recognized by the 'add'
                   14388:                   action). Note that you will normally not use this
                   14389:                   variable.</p>
                   14390:                 </li>
                   14391:               </ol>
                   14392:             </div>
                   14393:           </div>
                   14394: 
1.67      hubertf  14395:           <div class="sect2" lang="en">
1.1       grant    14396:             <div class="titlepage">
                   14397:               <div>
                   14398:                 <div>
1.67      hubertf  14399:                   <h3 class="title"><a name=
1.68      rillig   14400:                   "mime-database"></a>16.5.14.&nbsp;Packages
1.30      wiz      14401:                   installing extensions to the MIME database</h3>
1.1       grant    14402:                 </div>
                   14403:               </div>
                   14404:             </div>
                   14405: 
                   14406:             <p>If a package provides extensions to the MIME
1.45      wiz      14407:             database by installing <code xmlns=
                   14408:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   14409:             "filename">.xml</code> files inside <code xmlns=
                   14410:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14411:             "filename">${PREFIX}/share/mime/packages</code>, you
                   14412:             need to take some extra steps to ensure that the
                   14413:             database is kept consistent with respect to these new
                   14414:             files:</p>
1.1       grant    14415: 
                   14416:             <div class="orderedlist">
                   14417:               <ol type="1">
                   14418:                 <li>
1.45      wiz      14419:                   <p>Include <code xmlns=
                   14420:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14421:                   "filename">../../databases/shared-mime-info/mimedb.mk</code>
1.45      wiz      14422:                   (avoid using the <code xmlns=
                   14423:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14424:                   "filename">buildlink3.mk</code> file from this
                   14425:                   same directory, which is reserved for inclusion
1.45      wiz      14426:                   from other <code xmlns=
                   14427:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14428:                   "filename">buildlink3.mk</code> files). It takes
                   14429:                   care of rebuilding the MIME database at
                   14430:                   installation and deinstallation time, and
                   14431:                   disallows any access to it directly from the
1.1       grant    14432:                   package.</p>
                   14433:                 </li>
                   14434: 
                   14435:                 <li>
                   14436:                   <p>Check the PLIST and remove any entries under
1.45      wiz      14437:                   the <code xmlns=
                   14438:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14439:                   "filename">share/mime</code> directory,
                   14440:                   <span class="emphasis"><em>except</em></span> for
                   14441:                   files saved under <code xmlns=
                   14442:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14443:                   "filename">share/mime/packages</code>. The former
1.1       grant    14444:                   are handled automatically by the
1.47      reed     14445:                   update-mime-database program, but the latter are
1.1       grant    14446:                   package-dependent and must be removed by the
                   14447:                   package that installed them in the first
                   14448:                   place.</p>
                   14449:                 </li>
                   14450: 
                   14451:                 <li>
1.45      wiz      14452:                   <p>Remove any <code xmlns=
                   14453:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14454:                   "filename">share/mime/*</code> directories from
                   14455:                   the PLIST. They will be handled by the
1.1       grant    14456:                   shared-mime-info package.</p>
                   14457:                 </li>
                   14458:               </ol>
                   14459:             </div>
                   14460:           </div>
                   14461: 
1.67      hubertf  14462:           <div class="sect2" lang="en">
1.1       grant    14463:             <div class="titlepage">
                   14464:               <div>
                   14465:                 <div>
1.67      hubertf  14466:                   <h3 class="title"><a name=
1.68      rillig   14467:                   "intltool"></a>16.5.15.&nbsp;Packages using
1.1       grant    14468:                   intltool</h3>
                   14469:                 </div>
                   14470:               </div>
                   14471:             </div>
                   14472: 
                   14473:             <p>If a package uses intltool during its build, include
1.45      wiz      14474:             the <code xmlns=
                   14475:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14476:             "filename">../../textproc/intltool/buildlink3.mk</code>
1.1       grant    14477:             file, which forces it to use the intltool package
                   14478:             provided by pkgsrc, instead of the one bundled with the
                   14479:             distribution file.</p>
                   14480: 
                   14481:             <p>This tracks intltool's build-time dependencies and
                   14482:             uses the latest available version; this way, the
                   14483:             package benefits of any bug fixes that may have
                   14484:             appeared since it was released.</p>
                   14485:           </div>
1.18      xtraeme  14486: 
1.67      hubertf  14487:           <div class="sect2" lang="en">
1.18      xtraeme  14488:             <div class="titlepage">
                   14489:               <div>
                   14490:                 <div>
1.67      hubertf  14491:                   <h3 class="title"><a name=
1.68      rillig   14492:                   "startup-scripts"></a>16.5.16.&nbsp;Packages
1.30      wiz      14493:                   installing startup scripts</h3>
1.18      xtraeme  14494:                 </div>
                   14495:               </div>
                   14496:             </div>
                   14497: 
                   14498:             <p>If a package contains a rc.d script, it won't be
                   14499:             copied into the startup directory by default, but you
                   14500:             can enable it, by adding the option <code class=
1.45      wiz      14501:             "varname">PKG_RCD_SCRIPTS=YES</code> in <code xmlns=
                   14502:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.18      xtraeme  14503:             "filename">/etc/mk.conf</code>. This option will copy
1.45      wiz      14504:             the scripts into <code xmlns=
                   14505:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.18      xtraeme  14506:             "filename">/etc/rc.d</code> when a package is
                   14507:             installed, and it will automatically remove the scripts
                   14508:             when the package is deinstalled.</p>
                   14509:           </div>
1.57      minskim  14510: 
1.67      hubertf  14511:           <div class="sect2" lang="en">
1.57      minskim  14512:             <div class="titlepage">
                   14513:               <div>
                   14514:                 <div>
1.67      hubertf  14515:                   <h3 class="title"><a name=
1.68      rillig   14516:                   "tex-packages"></a>16.5.17.&nbsp;Packages
1.57      minskim  14517:                   installing TeX modules</h3>
                   14518:                 </div>
                   14519:               </div>
                   14520:             </div>
                   14521: 
                   14522:             <p>If a package installs TeX packages into the texmf
                   14523:             tree, the <code xmlns=
                   14524:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   14525:             "filename">ls-R</code> database of the tree needs to be
                   14526:             updated.</p>
                   14527: 
                   14528:             <div class="note" style=
                   14529:             "margin-left: 0.5in; margin-right: 0.5in;">
                   14530:               <h3 class="title">Note</h3>
                   14531: 
                   14532:               <p>Except the main TeX packages such as teTeX-texmf,
                   14533:               packages should install files into <code class=
                   14534:               "varname">PKG_LOCALTEXMFPREFIX</code>, not
                   14535:               <code class="varname">PKG_TEXMFPREFIX</code>.</p>
                   14536:             </div>
                   14537: 
                   14538:             <div class="orderedlist">
                   14539:               <ol type="1">
                   14540:                 <li>
                   14541:                   <p>Include <code xmlns=
                   14542:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14543:                   "filename">../../print/teTeX/module.mk</code>
                   14544:                   instead of <code xmlns=
                   14545:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14546:                   "filename">../../mk/tex.buildlink3.mk</code>.
                   14547:                   This takes care of rebuilding the <code xmlns=
                   14548:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14549:                   "filename">ls-R</code> database at installation
                   14550:                   and deinstallation time.</p>
                   14551:                 </li>
                   14552: 
                   14553:                 <li>
                   14554:                   <p>If your package installs files into a texmf
                   14555:                   tree other than the one at <code class=
                   14556:                   "varname">PKG_LOCALTEXMFPREFIX</code>, set
                   14557:                   <code class="varname">TEXMFDIRS</code> to the
                   14558:                   list of all texmf trees that need database
                   14559:                   update.</p>
1.64      kim      14560: 
                   14561:                   <p>If your package also installs font map files
                   14562:                   that need to be registered using
                   14563:                   <span><strong class=
                   14564:                   "command">updmap</strong></span>, set
                   14565:                   <code class="varname">TEX_FONTMAPS</code> to the
                   14566:                   list of all such font map files. Then
                   14567:                   <span><strong class=
                   14568:                   "command">updmap</strong></span> will be run
                   14569:                   automatically at installation/deinstallation to
                   14570:                   enable/disable font map files for TeX output
                   14571:                   drivers.</p>
1.57      minskim  14572:                 </li>
                   14573: 
                   14574:                 <li>
                   14575:                   <p>Make sure that none of <code xmlns=
                   14576:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14577:                   "filename">ls-R</code> databases are included in
                   14578:                   <code xmlns=
                   14579:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14580:                   "filename">PLIST</code>, as they will be removed
                   14581:                   only by the teTeX-bin package.</p>
                   14582:                 </li>
                   14583:               </ol>
                   14584:             </div>
                   14585:           </div>
1.1       grant    14586:         </div>
                   14587: 
1.67      hubertf  14588:         <div class="sect1" lang="en">
1.1       grant    14589:           <div class="titlepage">
                   14590:             <div>
                   14591:               <div>
                   14592:                 <h2 class="title" style="clear: both"><a name=
1.68      rillig   14593:                 "feedback-to-author"></a>16.6.&nbsp;Feedback to the
1.30      wiz      14594:                 author</h2>
1.1       grant    14595:               </div>
                   14596:             </div>
                   14597:           </div>
                   14598: 
                   14599:           <p>If you have found any bugs in the package you make
                   14600:           available, if you had to do special steps to make it run
                   14601:           under NetBSD or if you enhanced the software in various
                   14602:           other ways, be sure to report these changes back to the
                   14603:           original author of the program! With that kind of
                   14604:           support, the next release of the program can incorporate
                   14605:           these fixes, and people not using the NetBSD packages
                   14606:           system can win from your efforts.</p>
                   14607: 
                   14608:           <p>Support the idea of free software!</p>
                   14609:         </div>
                   14610:       </div>
                   14611: 
1.67      hubertf  14612:       <div class="chapter" lang="en">
1.1       grant    14613:         <div class="titlepage">
                   14614:           <div>
                   14615:             <div>
1.67      hubertf  14616:               <h2 class="title"><a name=
1.68      rillig   14617:               "debug"></a>Chapter&nbsp;17.&nbsp;Debugging</h2>
1.1       grant    14618:             </div>
                   14619:           </div>
                   14620:         </div>
                   14621: 
                   14622:         <p>To check out all the gotchas when building a package,
                   14623:         here are the steps that I do in order to get a package
                   14624:         working. Please note this is basically the same as what was
                   14625:         explained in the previous sections, only with some
                   14626:         debugging aids.</p>
                   14627: 
                   14628:         <div class="itemizedlist">
                   14629:           <ul type="disc">
                   14630:             <li>
1.14      xtraeme  14631:               <p>Be sure to set <code class=
1.45      wiz      14632:               "varname">PKG_DEVELOPER=1</code> in <code xmlns=
                   14633:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14634:               "filename">/etc/mk.conf</code></p>
1.1       grant    14635:             </li>
                   14636: 
                   14637:             <li>
                   14638:               <p>Install <a xmlns=
                   14639:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   14640:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45      wiz      14641:               target="_top"><code xmlns="" class=
                   14642:               "filename">pkgtools/url2pkg</code></a>, create a
1.20      ben      14643:               directory for a new package, change into it, then run
                   14644:               <span><strong class=
                   14645:               "command">url2pkg</strong></span>:</p>
1.1       grant    14646:               <pre class="screen">
1.14      xtraeme  14647: <code class="prompt">%</code> <strong class=
                   14648: "userinput"><code>mkdir /usr/pkgsrc/<em class=
                   14649: "replaceable"><code>category</code></em>/<em class=
                   14650: "replaceable"><code>examplepkg</code></em></code></strong>
                   14651: <code class="prompt">%</code> <strong class=
                   14652: "userinput"><code>cd /usr/pkgsrc/<em class=
                   14653: "replaceable"><code>category</code></em>/<em class=
                   14654: "replaceable"><code>examplepkg</code></em></code></strong>
                   14655: <code class="prompt">%</code> <strong class=
                   14656: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1       grant    14657: </pre>
                   14658:             </li>
                   14659: 
                   14660:             <li>
1.45      wiz      14661:               <p>Edit the <code xmlns=
                   14662:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14663:               "filename">Makefile</code> as requested.</p>
1.1       grant    14664:             </li>
                   14665: 
                   14666:             <li>
1.45      wiz      14667:               <p>Fill in the <code xmlns=
                   14668:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14669:               "filename">DESCR</code> file</p>
1.1       grant    14670:             </li>
                   14671: 
                   14672:             <li>
1.14      xtraeme  14673:               <p>Run <span><strong class="command">make
                   14674:               configure</strong></span></p>
1.1       grant    14675:             </li>
                   14676: 
                   14677:             <li>
                   14678:               <p>Add any dependencies glimpsed from documentation
1.45      wiz      14679:               and the configure step to the package's <code xmlns=
                   14680:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14681:               "filename">Makefile</code>.</p>
1.1       grant    14682:             </li>
                   14683: 
                   14684:             <li>
                   14685:               <p>Make the package compile, doing multiple rounds
                   14686:               of</p>
                   14687:               <pre class="screen">
1.14      xtraeme  14688: <code class="prompt">%</code> <strong class=
                   14689: "userinput"><code>make</code></strong>
                   14690: <code class="prompt">%</code> <strong class=
                   14691: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
                   14692: <code class="prompt">%</code> <strong class=
                   14693: "userinput"><code>mkpatches</code></strong>
                   14694: <code class="prompt">%</code> <strong class=
                   14695: "userinput"><code>patchdiff</code></strong>
                   14696: <code class="prompt">%</code> <strong class=
                   14697: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
                   14698: <code class="prompt">%</code> <strong class=
                   14699: "userinput"><code>make mps</code></strong>
                   14700: <code class="prompt">%</code> <strong class=
                   14701: "userinput"><code>make clean</code></strong>
1.1       grant    14702: </pre>
                   14703: 
                   14704:               <p>Doing as non-root user will ensure that no files
                   14705:               are modified that shouldn't be, especially during the
1.14      xtraeme  14706:               build phase. <span><strong class=
                   14707:               "command">mkpatches</strong></span>,
                   14708:               <span><strong class=
                   14709:               "command">patchdiff</strong></span> and
                   14710:               <span><strong class="command">pkgvi</strong></span>
                   14711:               are from the <a xmlns=
1.1       grant    14712:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   14713:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45      wiz      14714:               target="_top"><code xmlns="" class=
                   14715:               "filename">pkgtools/pkgdiff</code></a> package.</p>
1.1       grant    14716:             </li>
                   14717: 
                   14718:             <li>
1.45      wiz      14719:               <p>Look at the <code xmlns=
                   14720:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14721:               "filename">Makefile</code>, fix if necessary; see
                   14722:               <a href="#components.Makefile" title=
1.38      dillo    14723:               "8.1.&nbsp;Makefile">Section&nbsp;8.1,
1.45      wiz      14724:               &#8220;<code xmlns=
                   14725:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14726:               "filename">Makefile</code>&#8221;</a>.</p>
1.1       grant    14727:             </li>
                   14728: 
                   14729:             <li>
1.45      wiz      14730:               <p>Generate a <code xmlns=
                   14731:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14732:               "filename">PLIST</code>:</p>
1.1       grant    14733:               <pre class="screen">
1.14      xtraeme  14734: <code class="prompt">#</code> <strong class=
                   14735: "userinput"><code>make install</code></strong>
                   14736: <code class="prompt">#</code> <strong class=
                   14737: "userinput"><code>make print-PLIST &gt;PLIST</code></strong>
                   14738: <code class="prompt">#</code> <strong class=
                   14739: "userinput"><code>make deinstall</code></strong>
                   14740: <code class="prompt">#</code> <strong class=
                   14741: "userinput"><code>make install</code></strong>
                   14742: <code class="prompt">#</code> <strong class=
                   14743: "userinput"><code>make deinstall</code></strong>
1.1       grant    14744: </pre>
                   14745: 
1.45      wiz      14746:               <p>You usually need to be <code xmlns=
                   14747:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14748:               "username">root</code> to do this. Look if there are
1.1       grant    14749:               any files left:</p>
                   14750:               <pre class="screen">
1.14      xtraeme  14751: <code class="prompt">#</code> <strong class=
                   14752: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    14753: </pre>
                   14754: 
                   14755:               <p>If this reveals any files that are missing in
1.45      wiz      14756:               <code xmlns=
                   14757:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14758:               "filename">PLIST</code>, add them.</p>
1.1       grant    14759:             </li>
                   14760: 
                   14761:             <li>
1.45      wiz      14762:               <p>Now that the <code xmlns=
                   14763:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14764:               "filename">PLIST</code> is OK, install the package
                   14765:               again and make a binary package:</p>
1.1       grant    14766:               <pre class="screen">
1.14      xtraeme  14767: <code class="prompt">#</code> <strong class=
                   14768: "userinput"><code>make reinstall</code></strong>
                   14769: <code class="prompt">#</code> <strong class=
                   14770: "userinput"><code>make package</code></strong>
1.1       grant    14771: </pre>
                   14772:             </li>
                   14773: 
                   14774:             <li>
                   14775:               <p>Delete the installed package:</p>
                   14776:               <pre class="screen">
1.14      xtraeme  14777: <code class="prompt">#</code> <strong class=
                   14778: "userinput"><code>pkg_delete blub</code></strong>
1.1       grant    14779: </pre>
                   14780:             </li>
                   14781: 
                   14782:             <li>
1.14      xtraeme  14783:               <p>Repeat the above <span><strong class=
                   14784:               "command">make print-PLIST</strong></span> command,
                   14785:               which shouldn't find anything now:</p>
1.1       grant    14786:               <pre class="screen">
1.14      xtraeme  14787: <code class="prompt">#</code> <strong class=
                   14788: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    14789: </pre>
                   14790:             </li>
                   14791: 
                   14792:             <li>
                   14793:               <p>Reinstall the binary package:</p>
                   14794:               <pre class="screen">
1.14      xtraeme  14795: <code class="prompt">#</code> <strong class=
                   14796: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1       grant    14797: </pre>
                   14798:             </li>
                   14799: 
                   14800:             <li>
                   14801:               <p>Play with it. Make sure everything works.</p>
                   14802:             </li>
                   14803: 
                   14804:             <li>
1.14      xtraeme  14805:               <p>Run <span><strong class=
                   14806:               "command">pkglint</strong></span> from <a xmlns=
1.1       grant    14807:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   14808:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45      wiz      14809:               target="_top"><code xmlns="" class=
                   14810:               "filename">pkgtools/pkglint</code></a>, and fix the
1.20      ben      14811:               problems it reports:</p>
1.1       grant    14812:               <pre class="screen">
1.14      xtraeme  14813: <code class="prompt">#</code> <strong class=
                   14814: "userinput"><code>pkglint</code></strong>
1.1       grant    14815: </pre>
                   14816:             </li>
                   14817: 
                   14818:             <li>
                   14819:               <p>Submit (or commit, if you have cvs access); see
                   14820:               <a href="#submit" title=
1.68      rillig   14821:               "Chapter&nbsp;18.&nbsp;Submitting and Committing">Chapter&nbsp;18,
1.1       grant    14822:               <i>Submitting and Committing</i></a>.</p>
                   14823:             </li>
                   14824:           </ul>
                   14825:         </div>
                   14826:       </div>
                   14827: 
1.67      hubertf  14828:       <div class="chapter" lang="en">
1.1       grant    14829:         <div class="titlepage">
                   14830:           <div>
                   14831:             <div>
1.67      hubertf  14832:               <h2 class="title"><a name=
1.68      rillig   14833:               "submit"></a>Chapter&nbsp;18.&nbsp;Submitting and
1.1       grant    14834:               Committing</h2>
                   14835:             </div>
                   14836:           </div>
                   14837:         </div>
                   14838: 
                   14839:         <div class="toc">
                   14840:           <p><b>Table of Contents</b></p>
                   14841: 
                   14842:           <dl>
1.30      wiz      14843:             <dt><span class="sect1"><a href=
1.68      rillig   14844:             "#submitting-your-package">18.1. Submitting your
1.30      wiz      14845:             packages</a></span></dt>
1.1       grant    14846: 
1.30      wiz      14847:             <dt><span class="sect1"><a href=
1.68      rillig   14848:             "#general-notes-for-changes">18.2. General notes when
1.41      wiz      14849:             adding, updating, or removing packages</a></span></dt>
                   14850: 
                   14851:             <dt><span class="sect1"><a href=
1.68      rillig   14852:             "#committing-importing">18.3. Committing: Importing a
1.30      wiz      14853:             package into CVS</a></span></dt>
1.1       grant    14854: 
1.30      wiz      14855:             <dt><span class="sect1"><a href=
1.68      rillig   14856:             "#updating-package">18.4. Updating a package to a newer
1.30      wiz      14857:             version</a></span></dt>
1.1       grant    14858: 
1.68      rillig   14859:             <dt><span class="sect1"><a href="#moving-package">18.5.
1.2       hubertf  14860:             Moving a package in pkgsrc</a></span></dt>
1.1       grant    14861:           </dl>
                   14862:         </div>
                   14863: 
1.67      hubertf  14864:         <div class="sect1" lang="en">
1.1       grant    14865:           <div class="titlepage">
                   14866:             <div>
                   14867:               <div>
                   14868:                 <h2 class="title" style="clear: both"><a name=
1.68      rillig   14869:                 "submitting-your-package"></a>18.1.&nbsp;Submitting
1.30      wiz      14870:                 your packages</h2>
1.1       grant    14871:               </div>
                   14872:             </div>
                   14873:           </div>
                   14874: 
                   14875:           <p>You have to separate between binary and
                   14876:           &#8220;<span class="quote">normal</span>&#8221; (source)
                   14877:           packages here:</p>
                   14878: 
                   14879:           <div class="itemizedlist">
                   14880:             <ul type="disc">
                   14881:               <li>
                   14882:                 <p>precompiled binary packages</p>
                   14883: 
                   14884:                 <p>Our policy is that we accept binaries only from
                   14885:                 pkgsrc developers to guarantee that the packages
                   14886:                 don't contain any trojan horses etc. This is not to
1.13      hubertf  14887:                 annoy anyone but rather to protect our users!
1.1       grant    14888:                 You're still free to put up your home-made binary
1.13      hubertf  14889:                 packages and tell the world where to get them.
                   14890:                 NetBSD developers doing bulk builds and wanting to
                   14891:                 upload them please see <a href="#bulk-upload"
1.38      dillo    14892:                 title="6.3.8.&nbsp;Uploading results of a bulk build">
                   14893:                 Section&nbsp;6.3.8, &#8220;Uploading results of a
1.13      hubertf  14894:                 bulk build&#8221;</a>.</p>
1.1       grant    14895:               </li>
                   14896: 
                   14897:               <li>
                   14898:                 <p>packages</p>
                   14899: 
                   14900:                 <p>First, check that your package is complete,
                   14901:                 compiles and runs well; see <a href="#debug" title=
1.68      rillig   14902:                 "Chapter&nbsp;17.&nbsp;Debugging">Chapter&nbsp;17,
1.1       grant    14903:                 <i>Debugging</i></a> and the rest of this document.
1.24      wiz      14904:                 Next, generate an uuencoded gzipped <a href=
                   14905:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   14906:                 <span class="citerefentry"><span class=
                   14907:                 "refentrytitle">tar</span>(1)</span></a> archive,
1.1       grant    14908:                 preferably with all files in a single directory.
1.14      xtraeme  14909:                 Finally, <span><strong class=
                   14910:                 "command">send-pr</strong></span> with category
1.1       grant    14911:                 &#8220;<span class="quote">pkg</span>&#8221;, a
                   14912:                 synopsis which includes the package name and
                   14913:                 version number, a short description of your package
                   14914:                 (contents of the COMMENT variable or DESCR file are
                   14915:                 OK) and attach the archive to your PR.</p>
                   14916: 
                   14917:                 <p>If you want to submit several packages, please
                   14918:                 send a separate PR for each one, it's easier for us
                   14919:                 to track things that way.</p>
                   14920: 
                   14921:                 <p>Alternatively, you can also import new packages
                   14922:                 into pkgsrc-wip (&#8220;<span class="quote">pkgsrc
                   14923:                 work-in-progress</span>&#8221;); see the homepage
                   14924:                 at <a href="http://pkgsrc-wip.sourceforge.net/"
                   14925:                 target=
                   14926:                 "_top">http://pkgsrc-wip.sourceforge.net/</a> for
                   14927:                 details.</p>
                   14928:               </li>
                   14929:             </ul>
                   14930:           </div>
                   14931:         </div>
                   14932: 
1.67      hubertf  14933:         <div class="sect1" lang="en">
1.1       grant    14934:           <div class="titlepage">
                   14935:             <div>
                   14936:               <div>
                   14937:                 <h2 class="title" style="clear: both"><a name=
1.68      rillig   14938:                 "general-notes-for-changes"></a>18.2.&nbsp;General
1.41      wiz      14939:                 notes when adding, updating, or removing
                   14940:                 packages</h2>
                   14941:               </div>
                   14942:             </div>
                   14943:           </div>
                   14944: 
                   14945:           <p>Please note all package additions, updates, moves, and
1.45      wiz      14946:           removals in <code xmlns=
                   14947:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      14948:           "filename">pkgsrc/doc/CHANGES</code>. It's very important
                   14949:           to keep this file up to date and conforming to the
                   14950:           existing format, because it will be used by scripts to
                   14951:           automatically update pages on <a href=
                   14952:           "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
1.45      wiz      14953:           and other sites. Additionally, check the <code xmlns=
                   14954:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      14955:           "filename">pkgsrc/doc/TODO</code> file and remove the
                   14956:           entry for the package you updated or removed, in case it
                   14957:           was mentioned there.</p>
                   14958: 
                   14959:           <p>There is a make target that helps in creating proper
1.45      wiz      14960:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   14961:           class="filename">CHANGES</code> entries:
1.41      wiz      14962:           <span><strong class="command">make
                   14963:           changes-entry</strong></span>. It uses the optional
                   14964:           <code class="varname">CTYPE</code> and <code class=
                   14965:           "varname">NETBSD_LOGIN_NAME</code> variables. The general
1.45      wiz      14966:           usage is to first make sure that your <code xmlns=
                   14967:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      14968:           "filename">CHANGES</code> file is up-to-date (to avoid
                   14969:           having to resolve conflicts later-on) and then to
                   14970:           <span><strong class="command">cd</strong></span> to the
                   14971:           package directory. For package updates,
                   14972:           <span><strong class="command">make
                   14973:           changes-entry</strong></span> is enough. For new
                   14974:           packages, or package moves or removals, set the
                   14975:           <code class="varname">CTYPE</code> variable on the
                   14976:           command line to "Added", "Moved", or "Removed". You can
                   14977:           set <code class="varname">NETBSD_LOGIN_NAME</code> in
1.45      wiz      14978:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   14979:           class="filename">/etc/mk.conf</code> if your local login
                   14980:           name is not the same as your NetBSD login name. Don't
                   14981:           forget to commit the changes to <code xmlns=
                   14982:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      14983:           "filename">pkgsrc/doc/CHANGES</code>!</p>
                   14984:         </div>
                   14985: 
1.67      hubertf  14986:         <div class="sect1" lang="en">
1.41      wiz      14987:           <div class="titlepage">
                   14988:             <div>
                   14989:               <div>
                   14990:                 <h2 class="title" style="clear: both"><a name=
1.68      rillig   14991:                 "committing-importing"></a>18.3.&nbsp;Committing:
1.30      wiz      14992:                 Importing a package into CVS</h2>
1.1       grant    14993:               </div>
                   14994:             </div>
                   14995:           </div>
                   14996: 
                   14997:           <p>This section is only of interest for pkgsrc developers
                   14998:           with write access to the pkgsrc repository. Please
                   14999:           remember that cvs imports files relative to the current
                   15000:           working directory, and that the pathname that you give
1.14      xtraeme  15001:           the <span><strong class="command">cvs
                   15002:           import</strong></span> command is so that it knows where
                   15003:           to place the files in the repository. Newly created
                   15004:           packages should be imported with a vendor tag of
                   15005:           &#8220;<span class="quote">TNF</span>&#8221; and a
                   15006:           release tag of &#8220;<span class=
                   15007:           "quote">pkgsrc-base</span>&#8221;, e.g:</p>
1.1       grant    15008:           <pre class="programlisting">
1.51      rillig   15009:     <code class="prompt">$</code> cd .../pkgsrc/category/pkgname
                   15010:     <code class=
                   15011: "prompt">$</code> cvs import pkgsrc/category/pkgname TNF pkgsrc-base
1.1       grant    15012: </pre>
                   15013: 
                   15014:           <p>Remember to move the directory from which you imported
                   15015:           out of the way, or cvs will complain the next time you
                   15016:           &#8220;<span class="quote">cvs update</span>&#8221; your
                   15017:           source tree. Also don't forget to add the new package to
1.45      wiz      15018:           the category's <code xmlns=
                   15019:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15020:           "filename">Makefile</code>.</p>
1.1       grant    15021: 
                   15022:           <p>The commit message of the initial import should
1.45      wiz      15023:           include part of the <code xmlns=
                   15024:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   15025:           "filename">DESCR</code> file, so people reading the
                   15026:           mailing lists know what the package is/does.</p>
1.1       grant    15027: 
                   15028:           <p>For new packages, &#8220;<span class="quote">cvs
                   15029:           import</span>&#8221; is preferred to &#8220;<span class=
                   15030:           "quote">cvs add</span>&#8221; because the former gets
                   15031:           everything with a single command, and provides a
                   15032:           consistent tag.</p>
                   15033:         </div>
                   15034: 
1.67      hubertf  15035:         <div class="sect1" lang="en">
1.1       grant    15036:           <div class="titlepage">
                   15037:             <div>
                   15038:               <div>
                   15039:                 <h2 class="title" style="clear: both"><a name=
1.68      rillig   15040:                 "updating-package"></a>18.4.&nbsp;Updating a
1.30      wiz      15041:                 package to a newer version</h2>
1.1       grant    15042:               </div>
                   15043:             </div>
                   15044:           </div>
                   15045: 
                   15046:           <p>Please always put a concise, appropriate and relevant
                   15047:           summary of the changes between old and new versions into
                   15048:           the commit log when updating a package. There are various
                   15049:           reasons for this:</p>
                   15050: 
                   15051:           <div class="itemizedlist">
                   15052:             <ul type="disc">
                   15053:               <li>
                   15054:                 <p>A URL is volatile, and can change over time. It
                   15055:                 may go away completely or its information may be
                   15056:                 overwritten by newer information.</p>
                   15057:               </li>
                   15058: 
                   15059:               <li>
                   15060:                 <p>Having the change information between old and
                   15061:                 new versions in our CVS repository is very useful
                   15062:                 for people who use either cvs or anoncvs.</p>
                   15063:               </li>
                   15064: 
                   15065:               <li>
                   15066:                 <p>Having the change information between old and
                   15067:                 new versions in our CVS repository is very useful
                   15068:                 for people who read the pkgsrc-changes mailing
                   15069:                 list, so that they can make tactical decisions
                   15070:                 about when to upgrade the package.</p>
                   15071:               </li>
                   15072:             </ul>
                   15073:           </div>
                   15074: 
1.18      xtraeme  15075:           <p>Please also recognize that, just because a new version
1.1       grant    15076:           of a package has been released, it should not
                   15077:           automatically be upgraded in the CVS repository. We
                   15078:           prefer to be conservative in the packages that are
                   15079:           included in pkgsrc - development or beta packages are not
                   15080:           really the best thing for most places in which pkgsrc is
                   15081:           used. Please use your judgement about what should go into
                   15082:           pkgsrc, and bear in mind that stability is to be
                   15083:           preferred above new and possibly untested features.</p>
                   15084:         </div>
                   15085: 
1.67      hubertf  15086:         <div class="sect1" lang="en">
1.1       grant    15087:           <div class="titlepage">
                   15088:             <div>
                   15089:               <div>
                   15090:                 <h2 class="title" style="clear: both"><a name=
1.68      rillig   15091:                 "moving-package"></a>18.5.&nbsp;Moving a package in
1.30      wiz      15092:                 pkgsrc</h2>
1.1       grant    15093:               </div>
                   15094:             </div>
                   15095:           </div>
                   15096: 
                   15097:           <div class="orderedlist">
                   15098:             <ol type="1">
                   15099:               <li>
                   15100:                 <p>Make a copy of the directory somewhere else.</p>
                   15101:               </li>
                   15102: 
                   15103:               <li>
                   15104:                 <p>Remove all CVS dirs.</p>
                   15105: 
                   15106:                 <p>Alternatively to the first two steps you can
                   15107:                 also do:</p>
                   15108:                 <pre class="screen">
1.14      xtraeme  15109: <code class="prompt">%</code> <strong class=
                   15110: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1       grant    15111: </pre>
                   15112: 
                   15113:                 <p>and use that for further work.</p>
                   15114:               </li>
                   15115: 
                   15116:               <li>
1.14      xtraeme  15117:                 <p>Fix <code class="varname">CATEGORIES</code> and
                   15118:                 any <code class="varname">DEPENDS</code> paths that
                   15119:                 just did &#8220;<span class=
1.1       grant    15120:                 "quote">../package</span>&#8221; instead of
                   15121:                 &#8220;<span class=
                   15122:                 "quote">../../category/package</span>&#8221;.</p>
                   15123:               </li>
                   15124: 
                   15125:               <li>
1.14      xtraeme  15126:                 <p><span><strong class="command">cvs
                   15127:                 import</strong></span> the modified package in the
                   15128:                 new place.</p>
1.1       grant    15129:               </li>
                   15130: 
                   15131:               <li>
                   15132:                 <p>Check if any package depends on it:</p>
                   15133:                 <pre class="screen">
1.14      xtraeme  15134: <code class="prompt">%</code> <strong class=
                   15135: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   15136: <code class="prompt">%</code> <strong class=
                   15137: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1       grant    15138: </pre>
                   15139:               </li>
                   15140: 
                   15141:               <li>
                   15142:                 <p>Fix paths in packages from step 5 to point to
                   15143:                 new location.</p>
                   15144:               </li>
                   15145: 
                   15146:               <li>
1.14      xtraeme  15147:                 <p><span><strong class="command">cvs rm
                   15148:                 (-f)</strong></span> the package at the old
                   15149:                 location.</p>
1.1       grant    15150:               </li>
                   15151: 
                   15152:               <li>
1.45      wiz      15153:                 <p>Remove from <code xmlns=
                   15154:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15155:                 "filename">oldcategory/Makefile</code>.</p>
1.1       grant    15156:               </li>
                   15157: 
                   15158:               <li>
1.45      wiz      15159:                 <p>Add to <code xmlns=
                   15160:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15161:                 "filename">newcategory/Makefile</code>.</p>
1.1       grant    15162:               </li>
                   15163: 
                   15164:               <li>
                   15165:                 <p>Commit the changed and removed files:</p>
                   15166:                 <pre class="screen">
1.14      xtraeme  15167: <code class="prompt">%</code> <strong class=
                   15168: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1       grant    15169: </pre>
                   15170: 
                   15171:                 <p>(and any packages from step 5, of course).</p>
                   15172:               </li>
                   15173:             </ol>
                   15174:           </div>
                   15175:         </div>
                   15176:       </div>
1.69    ! rillig   15177: 
        !          15178:       <div class="chapter" lang="en">
        !          15179:         <div class="titlepage">
        !          15180:           <div>
        !          15181:             <div>
        !          15182:               <h2 class="title"><a name=
        !          15183:               "porting"></a>Chapter&nbsp;19.&nbsp;Porting
        !          15184:               pkgsrc</h2>
        !          15185:             </div>
        !          15186:           </div>
        !          15187:         </div>
        !          15188: 
        !          15189:         <div class="toc">
        !          15190:           <p><b>Table of Contents</b></p>
        !          15191: 
        !          15192:           <dl>
        !          15193:             <dt><span class="sect1"><a href="#porting.opsys">19.1.
        !          15194:             Porting pkgsrc to a new operating
        !          15195:             system</a></span></dt>
        !          15196: 
        !          15197:             <dt><span class="sect1"><a href=
        !          15198:             "#porting.compiler">19.2. Adding support for a new
        !          15199:             compiler</a></span></dt>
        !          15200:           </dl>
        !          15201:         </div>
        !          15202: 
        !          15203:         <p>The pkgsrc system has already been ported to many
        !          15204:         operating systems, hardware architectures and compilers.
        !          15205:         This chapter explains the necessary steps to make pkgsrc
        !          15206:         even more portable.</p>
        !          15207: 
        !          15208:         <div class="sect1" lang="en">
        !          15209:           <div class="titlepage">
        !          15210:             <div>
        !          15211:               <div>
        !          15212:                 <h2 class="title" style="clear: both"><a name=
        !          15213:                 "porting.opsys"></a>19.1.&nbsp;Porting pkgsrc to a
        !          15214:                 new operating system</h2>
        !          15215:               </div>
        !          15216:             </div>
        !          15217:           </div>
        !          15218: 
        !          15219:           <p>To port pkgsrc to a new operating system (called
        !          15220:           <code class="literal">MyOS</code> in this example), you
        !          15221:           need to touch the following files:</p>
        !          15222: 
        !          15223:           <div class="variablelist">
        !          15224:             <dl>
        !          15225:               <dt><span class="term"><code xmlns=
        !          15226:               "http://www.w3.org/TR/xhtml1/transitional" class=
        !          15227:               "filename">bootstrap/mods/mk/<em class=
        !          15228:               "replaceable"><code>MyOS</code></em>.sys.mk</code></span></dt>
        !          15229: 
        !          15230:               <dd>
        !          15231:                 <p>This file contains some basic definitions, for
        !          15232:                 example the name of the C compiler.</p>
        !          15233:               </dd>
        !          15234: 
        !          15235:               <dt><span class="term"><code xmlns=
        !          15236:               "http://www.w3.org/TR/xhtml1/transitional" class=
        !          15237:               "filename">mk/bsd.prefs.mk</code></span></dt>
        !          15238: 
        !          15239:               <dd>
        !          15240:                 <p>Insert code that defines the variables
        !          15241:                 <code class="varname">OPSYS</code>, <code class=
        !          15242:                 "varname">OS_VERSION</code>, <code class=
        !          15243:                 "varname">LOWER_OS_VERSION</code>, <code class=
        !          15244:                 "varname">LOWER_VENDOR</code>, <code class=
        !          15245:                 "varname">MACHINE_ARCH</code>, <code class=
        !          15246:                 "varname">OBJECT_FMT</code>, <code class=
        !          15247:                 "varname">APPEND_ELF</code>, and the other
        !          15248:                 variables that appear in this file.</p>
        !          15249:               </dd>
        !          15250: 
        !          15251:               <dt><span class="term"><code xmlns=
        !          15252:               "http://www.w3.org/TR/xhtml1/transitional" class=
        !          15253:               "filename">mk/platform/MyOS.mk</code></span></dt>
        !          15254: 
        !          15255:               <dd>
        !          15256:                 <p>This file contains the platform-specific
        !          15257:                 definitions that are used by pkgsrc. Start by
        !          15258:                 copying one of the other files and edit it to your
        !          15259:                 needs.</p>
        !          15260:               </dd>
        !          15261: 
        !          15262:               <dt><span class="term"><code xmlns=
        !          15263:               "http://www.w3.org/TR/xhtml1/transitional" class=
        !          15264:               "filename">mk/platform/MyOS.pkg.dist</code></span></dt>
        !          15265: 
        !          15266:               <dd>
        !          15267:                 <p>This file contains a list of directories,
        !          15268:                 together with their permission bits and ownership.
        !          15269:                 These directories will be created automatically
        !          15270:                 with every package that does not explicitly set
        !          15271:                 <code class="varname">NO_MTREE</code>. There have
        !          15272:                 been some discussions about whether this file is
        !          15273:                 needed at all, but with no result.</p>
        !          15274:               </dd>
        !          15275: 
        !          15276:               <dt><span class="term"><code xmlns=
        !          15277:               "http://www.w3.org/TR/xhtml1/transitional" class=
        !          15278:               "filename">mk/platform/MyOS.x11.dist</code></span></dt>
        !          15279: 
        !          15280:               <dd>
        !          15281:                 <p>Just copy one of the pre-existing x11.dist files
        !          15282:                 to your <code xmlns=
        !          15283:                 "http://www.w3.org/TR/xhtml1/transitional" class=
        !          15284:                 "filename"><em class=
        !          15285:                 "replaceable"><code>MyOS</code></em>.x11.dist</code>.</p>
        !          15286:               </dd>
        !          15287: 
        !          15288:               <dt><span class="term"><code xmlns=
        !          15289:               "http://www.w3.org/TR/xhtml1/transitional" class=
        !          15290:               "filename">mk/tools/bootstrap.mk</code></span></dt>
        !          15291: 
        !          15292:               <dd>
        !          15293:                 <p>On some operating systems, the tools that are
        !          15294:                 provided with the base system are not good enough
        !          15295:                 for pkgsrc. For example, there are many versions of
        !          15296:                 <a href=
        !          15297:                 "http://netbsd.gw.com/cgi-bin/man-cgi?sed+1+NetBSD-current">
        !          15298:                 <span class="citerefentry"><span class=
        !          15299:                 "refentrytitle">sed</span>(1)</span></a> that have
        !          15300:                 a narrow limit on the line length they can process.
        !          15301:                 Therefore pkgsrc brings its own tools, which can be
        !          15302:                 enabled here.</p>
        !          15303:               </dd>
        !          15304: 
        !          15305:               <dt><span class="term"><code xmlns=
        !          15306:               "http://www.w3.org/TR/xhtml1/transitional" class=
        !          15307:               "filename">mk/tools/<em class=
        !          15308:               "replaceable"><code>MyOS</code></em>.mk</code></span></dt>
        !          15309: 
        !          15310:               <dd>
        !          15311:                 <p>This file defines the paths to all the tools
        !          15312:                 that are needed by one or the other package in
        !          15313:                 pkgsrc, as well as by pkgsrc itself. Find out where
        !          15314:                 these tools are on your platform and add them.</p>
        !          15315:               </dd>
        !          15316:             </dl>
        !          15317:           </div>
        !          15318: 
        !          15319:           <p>Now, you should be able to build some basic packages,
        !          15320:           like <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
        !          15321:           href=
        !          15322:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/perl5/README.html"
        !          15323:           target="_top"><code xmlns="" class=
        !          15324:           "filename">lang/perl5</code></a>, <a xmlns=
        !          15325:           "http://www.w3.org/TR/xhtml1/transitional" href=
        !          15326:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/bash/README.html"
        !          15327:           target="_top"><code xmlns="" class=
        !          15328:           "filename">shells/bash</code></a>.</p>
        !          15329:         </div>
        !          15330: 
        !          15331:         <div class="sect1" lang="en">
        !          15332:           <div class="titlepage">
        !          15333:             <div>
        !          15334:               <div>
        !          15335:                 <h2 class="title" style="clear: both"><a name=
        !          15336:                 "porting.compiler"></a>19.2.&nbsp;Adding support
        !          15337:                 for a new compiler</h2>
        !          15338:               </div>
        !          15339:             </div>
        !          15340:           </div>
        !          15341: 
        !          15342:           <p>TODO</p>
        !          15343:         </div>
        !          15344:       </div>
1.1       grant    15345:     </div>
                   15346: 
1.67      hubertf  15347:     <div class="appendix" lang="en">
1.1       grant    15348:       <div class="titlepage">
                   15349:         <div>
                   15350:           <div>
1.67      hubertf  15351:             <h2 class="title"><a name=
1.46      gdt      15352:             "examples"></a>Appendix&nbsp;A.&nbsp;A simple example
1.1       grant    15353:             package: bison</h2>
                   15354:           </div>
                   15355:         </div>
                   15356:       </div>
                   15357: 
                   15358:       <div class="toc">
                   15359:         <p><b>Table of Contents</b></p>
                   15360: 
                   15361:         <dl>
1.46      gdt      15362:           <dt><span class="sect1"><a href="#example-files">A.1.
1.1       grant    15363:           files</a></span></dt>
                   15364: 
                   15365:           <dd>
                   15366:             <dl>
1.30      wiz      15367:               <dt><span class="sect2"><a href=
1.46      gdt      15368:               "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1       grant    15369: 
1.30      wiz      15370:               <dt><span class="sect2"><a href=
1.46      gdt      15371:               "#example-descr">A.1.2. DESCR</a></span></dt>
1.1       grant    15372: 
1.30      wiz      15373:               <dt><span class="sect2"><a href=
1.46      gdt      15374:               "#example-plist">A.1.3. PLIST</a></span></dt>
1.1       grant    15375: 
1.30      wiz      15376:               <dt><span class="sect2"><a href=
1.46      gdt      15377:               "#checking-package-with-pkglint">A.1.4. Checking a
1.30      wiz      15378:               package with <span><strong class=
1.14      xtraeme  15379:               "command">pkglint</strong></span></a></span></dt>
1.1       grant    15380:             </dl>
                   15381:           </dd>
                   15382: 
1.46      gdt      15383:           <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30      wiz      15384:           Steps for building, installing, packaging</a></span></dt>
1.1       grant    15385:         </dl>
                   15386:       </div>
                   15387: 
                   15388:       <p>We checked to find a piece of software that wasn't in the
                   15389:       packages collection, and picked GNU bison. Quite why someone
1.14      xtraeme  15390:       would want to have <span><strong class=
                   15391:       "command">bison</strong></span> when Berkeley
                   15392:       <span><strong class="command">yacc</strong></span> is already
                   15393:       present in the tree is beyond us, but it's useful for the
                   15394:       purposes of this exercise.</p>
1.1       grant    15395: 
1.67      hubertf  15396:       <div class="sect1" lang="en">
1.1       grant    15397:         <div class="titlepage">
                   15398:           <div>
                   15399:             <div>
                   15400:               <h2 class="title" style="clear: both"><a name=
1.46      gdt      15401:               "example-files"></a>A.1.&nbsp;files</h2>
1.1       grant    15402:             </div>
                   15403:           </div>
                   15404:         </div>
                   15405: 
1.67      hubertf  15406:         <div class="sect2" lang="en">
1.1       grant    15407:           <div class="titlepage">
                   15408:             <div>
                   15409:               <div>
1.67      hubertf  15410:                 <h3 class="title"><a name=
1.46      gdt      15411:                 "example-Makefile"></a>A.1.1.&nbsp;Makefile</h3>
1.1       grant    15412:               </div>
                   15413:             </div>
                   15414:           </div>
                   15415:           <pre class="programlisting">
1.51      rillig   15416:     # $NetBSD$
                   15417:     #
1.1       grant    15418: 
1.51      rillig   15419:     DISTNAME=       bison-1.25
                   15420:     CATEGORIES=     devel
                   15421:     MASTER_SITES=   ${MASTER_SITE_GNU}
1.1       grant    15422: 
1.51      rillig   15423:     MAINTAINER=     thorpej@NetBSD.org
                   15424:     HOMEPAGE=       http://www.gnu.org/software/bison/bison.html
                   15425:     COMMENT=        GNU yacc clone
1.1       grant    15426: 
1.51      rillig   15427:     GNU_CONFIGURE=  yes
                   15428:     INFO_FILES=     bison.info
1.1       grant    15429: 
1.51      rillig   15430:     .include "../../mk/bsd.pkg.mk"
1.1       grant    15431: </pre>
                   15432:         </div>
                   15433: 
1.67      hubertf  15434:         <div class="sect2" lang="en">
1.1       grant    15435:           <div class="titlepage">
                   15436:             <div>
                   15437:               <div>
1.67      hubertf  15438:                 <h3 class="title"><a name=
1.46      gdt      15439:                 "example-descr"></a>A.1.2.&nbsp;DESCR</h3>
1.1       grant    15440:               </div>
                   15441:             </div>
                   15442:           </div>
                   15443:           <pre class="programlisting">
1.51      rillig   15444:     GNU version of yacc.  Can make re-entrant parsers, and numerous other
                   15445:     improvements.  Why you would want this when Berkeley <a href=
1.1       grant    15446: "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   15447:     of the NetBSD source tree is beyond me.
1.1       grant    15448: </pre>
                   15449:         </div>
                   15450: 
1.67      hubertf  15451:         <div class="sect2" lang="en">
1.1       grant    15452:           <div class="titlepage">
                   15453:             <div>
                   15454:               <div>
1.67      hubertf  15455:                 <h3 class="title"><a name=
1.46      gdt      15456:                 "example-plist"></a>A.1.3.&nbsp;PLIST</h3>
1.1       grant    15457:               </div>
                   15458:             </div>
                   15459:           </div>
                   15460:           <pre class="programlisting">
1.51      rillig   15461:     @comment $NetBSD$
                   15462:     bin/bison
                   15463:     man/man1/bison.1.gz
                   15464:     share/bison.simple
                   15465:     share/bison.hairy
1.1       grant    15466: </pre>
                   15467:         </div>
                   15468: 
1.67      hubertf  15469:         <div class="sect2" lang="en">
1.1       grant    15470:           <div class="titlepage">
                   15471:             <div>
                   15472:               <div>
1.30      wiz      15473:                 <h3 class="title"><a name=
1.46      gdt      15474:                 "checking-package-with-pkglint"></a>A.1.4.&nbsp;Checking
1.30      wiz      15475:                 a package with <span><strong class=
1.14      xtraeme  15476:                 "command">pkglint</strong></span></h3>
1.1       grant    15477:               </div>
                   15478:             </div>
                   15479:           </div>
                   15480: 
                   15481:           <p>The NetBSD package system comes with <a xmlns=
                   15482:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   15483:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45      wiz      15484:           target="_top"><code xmlns="" class=
                   15485:           "filename">pkgtools/pkglint</code></a> which helps to
                   15486:           check the contents of these files. After installation it
                   15487:           is quite easy to use, just change to the directory of the
1.20      ben      15488:           package you wish to examine and execute
                   15489:           <span><strong class=
                   15490:           "command">pkglint</strong></span>:</p>
1.1       grant    15491:           <pre class="screen">
1.14      xtraeme  15492: <code class="prompt">$</code> <strong class=
                   15493: "userinput"><code>pkglint</code></strong>
1.1       grant    15494: looks fine.
                   15495: </pre>
                   15496: 
                   15497:           <p>Depending on the supplied command line arguments (see
1.60      rillig   15498:           pkglint(1)), more checks will be performed. Use e.g.
                   15499:           <span><strong class="command">pkglint -Call
                   15500:           -Wall</strong></span> for a very thorough check.</p>
1.1       grant    15501:         </div>
                   15502:       </div>
                   15503: 
1.67      hubertf  15504:       <div class="sect1" lang="en">
1.1       grant    15505:         <div class="titlepage">
                   15506:           <div>
                   15507:             <div>
                   15508:               <h2 class="title" style="clear: both"><a name=
1.46      gdt      15509:               "steps-for-b-i-p"></a>A.2.&nbsp;Steps for building,
1.30      wiz      15510:               installing, packaging</h2>
1.1       grant    15511:             </div>
                   15512:           </div>
                   15513:         </div>
                   15514: 
                   15515:         <p>Create the directory where the package lives, plus any
                   15516:         auxiliary directories:</p>
                   15517:         <pre class="screen">
1.14      xtraeme  15518: <code class="prompt">#</code> <strong class=
                   15519: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
                   15520: <code class="prompt">#</code> <strong class=
                   15521: "userinput"><code>mkdir bison</code></strong>
                   15522: <code class="prompt">#</code> <strong class=
                   15523: "userinput"><code>cd bison</code></strong>
                   15524: <code class="prompt">#</code> <strong class=
                   15525: "userinput"><code>mkdir patches</code></strong>
1.1       grant    15526: </pre>
                   15527: 
1.45      wiz      15528:         <p>Create <code xmlns=
                   15529:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   15530:         "filename">Makefile</code>, <code xmlns=
                   15531:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   15532:         "filename">DESCR</code> and <code xmlns=
                   15533:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15534:         "filename">PLIST</code> (see <a href="#components" title=
1.38      dillo    15535:         "Chapter&nbsp;8.&nbsp;Package components - files, directories and contents">
1.67      hubertf  15536:         Chapter&nbsp;8, <i>Package components - files, directories
                   15537:         and contents</i></a>) then continue with fetching the
1.1       grant    15538:         distfile:</p>
                   15539:         <pre class="screen">
1.14      xtraeme  15540: <code class="prompt">#</code> <strong class=
                   15541: "userinput"><code>make fetch</code></strong>
1.1       grant    15542: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   15543: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   15544: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   15545: ftp: Error retrieving file: 500 Internal error
                   15546: 
                   15547: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   15548: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   15549: ftp: Error retrieving file: 500 Internal error
                   15550: 
                   15551: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   15552: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   15553: Successfully retrieved file.
                   15554: </pre>
                   15555: 
1.45      wiz      15556:         <p>Generate the checksum of the distfile into <code xmlns=
                   15557:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15558:         "filename">distinfo</code>:</p>
1.1       grant    15559:         <pre class="screen">
1.14      xtraeme  15560: <code class="prompt">#</code> <strong class=
                   15561: "userinput"><code>make makesum</code></strong>
1.1       grant    15562: </pre>
                   15563: 
                   15564:         <p>Now compile:</p>
                   15565:         <pre class="screen">
1.14      xtraeme  15566: <code class="prompt">#</code> <strong class=
                   15567: "userinput"><code>make</code></strong>
1.1       grant    15568: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   15569: ===&gt;  Extracting for bison-1.25
                   15570: ===&gt;  Patching for bison-1.25
                   15571: ===&gt;   Ignoring empty patch directory
                   15572: ===&gt;  Configuring for bison-1.25
                   15573: creating cache ./config.cache
                   15574: checking for gcc... cc
                   15575: checking whether we are using GNU C... yes
                   15576: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   15577: checking how to run the C preprocessor... cc -E
                   15578: checking for minix/config.h... no
                   15579: checking for POSIXized ISC... no
                   15580: checking whether cross-compiling... no
                   15581: checking for ANSI C header files... yes
                   15582: checking for string.h... yes
                   15583: checking for stdlib.h... yes
                   15584: checking for memory.h... yes
                   15585: checking for working const... yes
                   15586: checking for working alloca.h... no
                   15587: checking for alloca... yes
                   15588: checking for strerror... yes
                   15589: updating cache ./config.cache
                   15590: creating ./config.status
                   15591: creating Makefile
                   15592: ===&gt;  Building for bison-1.25
                   15593: 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
                   15594: 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
                   15595: 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
                   15596: 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
                   15597: 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
1.68      rillig   15598: 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
1.1       grant    15599: 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
                   15600: 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
                   15601: 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
                   15602: 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
                   15603: 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
                   15604: 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
                   15605: 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
                   15606: 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
                   15607: 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
                   15608: 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
                   15609: 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
                   15610: 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
                   15611: 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
                   15612: 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
                   15613: 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
                   15614: 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
                   15615: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   15616: rm -f bison.s1
                   15617: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1
                   15618: </pre>
                   15619: 
                   15620:         <p>Everything seems OK, so install the files:</p>
                   15621:         <pre class="screen">
1.14      xtraeme  15622: <code class="prompt">#</code> <strong class=
                   15623: "userinput"><code>make install</code></strong>
1.1       grant    15624: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   15625: ===&gt;  Installing for bison-1.25
                   15626: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   15627: rm -f /usr/pkg/bin/bison
                   15628: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   15629: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   15630: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   15631: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   15632: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   15633: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   15634: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
                   15635: ===&gt;  Registering installation for bison-1.25
                   15636: </pre>
                   15637: 
                   15638:         <p>You can now use bison, and also - if you decide so -
1.14      xtraeme  15639:         remove it with <span><strong class="command">pkg_delete
                   15640:         bison</strong></span>. Should you decide that you want a
                   15641:         binary package, do this now:</p>
1.1       grant    15642:         <pre class="screen">
1.14      xtraeme  15643: <code class="prompt">#</code> <strong class=
                   15644: "userinput"><code>make package</code></strong>
1.1       grant    15645: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   15646: ===&gt;  Building package for bison-1.25
                   15647: Creating package bison-1.25.tgz
                   15648: Registering depends:.
                   15649: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
                   15650: </pre>
                   15651: 
                   15652:         <p>Now that you don't need the source and object files any
                   15653:         more, clean up:</p>
                   15654:         <pre class="screen">
1.14      xtraeme  15655: <code class="prompt">#</code> <strong class=
                   15656: "userinput"><code>make clean</code></strong>
1.1       grant    15657: ===&gt;  Cleaning for bison-1.25
                   15658: </pre>
                   15659:       </div>
                   15660:     </div>
                   15661: 
1.67      hubertf  15662:     <div class="appendix" lang="en">
1.1       grant    15663:       <div class="titlepage">
                   15664:         <div>
                   15665:           <div>
1.67      hubertf  15666:             <h2 class="title"><a name=
1.46      gdt      15667:             "logs"></a>Appendix&nbsp;B.&nbsp;Build logs</h2>
1.1       grant    15668:           </div>
                   15669:         </div>
                   15670:       </div>
                   15671: 
                   15672:       <div class="toc">
                   15673:         <p><b>Table of Contents</b></p>
                   15674: 
                   15675:         <dl>
1.46      gdt      15676:           <dt><span class="sect1"><a href="#logs.building">B.1.
1.1       grant    15677:           Building figlet</a></span></dt>
                   15678: 
1.46      gdt      15679:           <dt><span class="sect1"><a href="#logs.package">B.2.
1.1       grant    15680:           Packaging figlet</a></span></dt>
                   15681:         </dl>
                   15682:       </div>
                   15683: 
1.67      hubertf  15684:       <div class="sect1" lang="en">
1.1       grant    15685:         <div class="titlepage">
                   15686:           <div>
                   15687:             <div>
                   15688:               <h2 class="title" style="clear: both"><a name=
1.46      gdt      15689:               "logs.building"></a>B.1.&nbsp;Building figlet</h2>
1.1       grant    15690:             </div>
                   15691:           </div>
                   15692:         </div>
                   15693:         <pre class="screen">
1.14      xtraeme  15694: <code class="prompt">#</code> <strong class=
                   15695: "userinput"><code>make</code></strong>
1.1       grant    15696: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   15697: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   15698: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   15699: =&gt; [172219 bytes]
                   15700: Connected to ftp.plig.net.
                   15701: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   15702: 331 Guest login ok, send your complete e-mail address as password.
                   15703: 230-You are user #5 of 500 simultaneous users allowed.
                   15704: 230-
1.68      rillig   15705: 230-  ___ _             _ _
                   15706: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___
1.1       grant    15707: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   15708: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   15709: 230-         |_|   |_|     |___|         |___|
                   15710: 230-
                   15711: 230-** Welcome to ftp.plig.org **
                   15712: 230-
                   15713: 230-Please note that all transfers from this FTP site are logged. If you
                   15714: 230-do not like this, please disconnect now.
                   15715: 230-
                   15716: 230-This arhive is available via
                   15717: 230-
                   15718: 230-HTTP:  http://ftp.plig.org/
                   15719: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   15720: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   15721: 230-
                   15722: 230-Please email comments, bug reports and requests for packages to be
1.68      rillig   15723: 230-mirrored to ftp-admin@plig.org.
1.1       grant    15724: 230-
                   15725: 230-
                   15726: 230 Logged in anonymously.
                   15727: Remote system type is UNIX.
                   15728: Using binary mode to transfer files.
                   15729: 200 Type okay.
                   15730: 250 "/pub" is new cwd.
                   15731: 250-"/pub/figlet" is new cwd.
                   15732: 250-
                   15733: 250-Welcome to the figlet archive at ftp.figlet.org
1.68      rillig   15734: 250-
1.1       grant    15735: 250-    ftp://ftp.figlet.org/pub/figlet/
                   15736: 250-
                   15737: 250-The official FIGlet web page is:
                   15738: 250-    http://www.figlet.org/
                   15739: 250-
                   15740: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   15741: 250-contribute a font or something else, you can email us.
1.68      rillig   15742: 250
1.1       grant    15743: 250 "/pub/figlet/program" is new cwd.
                   15744: 250 "/pub/figlet/program/unix" is new cwd.
                   15745: local: figlet221.tar.gz remote: figlet221.tar.gz
                   15746: 502 Unimplemented command.
                   15747: 227 Entering Passive Mode (195,40,6,41,246,104)
                   15748: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   15749: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   15750: 226 Transfer completed.
                   15751: 172219 bytes received in 00:02 (75.99 KB/s)
                   15752: 221 Goodbye.
                   15753: =&gt; Checksum OK for figlet221.tar.gz.
                   15754: ===&gt; Extracting for figlet-2.2.1nb2
                   15755: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   15756: ===&gt; Patching for figlet-2.2.1nb2
                   15757: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   15758: ===&gt; Overriding tools for figlet-2.2.1nb2
                   15759: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   15760: ===&gt; Configuring for figlet-2.2.1nb2
                   15761: ===&gt; Building for figlet-2.2.1nb2
                   15762: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   15763: chmod a+x figlet
                   15764: gcc -O2 -o chkfont chkfont.c
                   15765: =&gt; Unwrapping files-to-be-installed.
1.14      xtraeme  15766: <code class="prompt">#</code>
                   15767: <code class="prompt">#</code> <strong class=
                   15768: "userinput"><code>make install</code></strong>
1.1       grant    15769: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   15770: ===&gt; Installing for figlet-2.2.1nb2
                   15771: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   15772: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   15773: mkdir -p /usr/pkg/share/figlet
                   15774: cp figlet /usr/pkg/bin
                   15775: cp chkfont /usr/pkg/bin
                   15776: chmod 555 figlist showfigfonts
                   15777: cp figlist /usr/pkg/bin
                   15778: cp showfigfonts /usr/pkg/bin
                   15779: cp fonts/*.flf /usr/pkg/share/figlet
                   15780: cp fonts/*.flc /usr/pkg/share/figlet
                   15781: cp figlet.6 /usr/pkg/man/man6
                   15782: ===&gt; Registering installation for figlet-2.2.1nb2
1.14      xtraeme  15783: <code class="prompt">#</code>
1.1       grant    15784: </pre>
                   15785:       </div>
                   15786: 
1.67      hubertf  15787:       <div class="sect1" lang="en">
1.1       grant    15788:         <div class="titlepage">
                   15789:           <div>
                   15790:             <div>
                   15791:               <h2 class="title" style="clear: both"><a name=
1.46      gdt      15792:               "logs.package"></a>B.2.&nbsp;Packaging figlet</h2>
1.1       grant    15793:             </div>
                   15794:           </div>
                   15795:         </div>
                   15796:         <pre class="screen">
1.14      xtraeme  15797: <code class="prompt">#</code> <strong class=
                   15798: "userinput"><code>make package</code></strong>
1.1       grant    15799: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   15800: ===&gt; Packaging figlet-2.2.1nb2
                   15801: ===&gt; Building binary package for figlet-2.2.1nb2
                   15802: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   15803: Using SrcDir value of /usr/pkg
1.68      rillig   15804: Registering depends:.
1.14      xtraeme  15805: <code class="prompt">#</code>
1.1       grant    15806: </pre>
                   15807:       </div>
                   15808:     </div>
                   15809: 
1.67      hubertf  15810:     <div class="appendix" lang="en">
1.1       grant    15811:       <div class="titlepage">
                   15812:         <div>
                   15813:           <div>
1.67      hubertf  15814:             <h2 class="title"><a name=
1.46      gdt      15815:             "ftp-layout"></a>Appendix&nbsp;C.&nbsp;Layout of the
1.1       grant    15816:             FTP server's package archive</h2>
                   15817:           </div>
                   15818:         </div>
                   15819:       </div>
                   15820: 
                   15821:       <p>Layout for precompiled binary packages on
                   15822:       ftp.NetBSD.org:</p>
                   15823:       <pre class="programlisting">
1.51      rillig   15824:     /pub/NetBSD/packages/
                   15825:         distfiles/
1.1       grant    15826: 
1.51      rillig   15827:         # Unpacked pkgsrc trees
                   15828:         pkgsrc-current -&gt; /pub/NetBSD/NetBSD-current/pkgsrc
                   15829:         pkgsrc-2003Q4 -&gt; N/A
                   15830:         pkgsrc-2004Q1/pkgsrc
                   15831: 
                   15832:         # pkgsrc archives
                   15833:         pkgsrc-current.tar.gz -&gt; ../NetBSD-current/tar_files/pkgsrc.tar.gz
                   15834:         pkgsrc-2003Q4.tar.gz -&gt; N/A
                   15835:         pkgsrc-2004Q1.tar.gz -&gt; N/A
                   15836: 
                   15837:         # Per pkgsrc-release/OS-release/arch package archives
                   15838:         pkgsrc-2003Q4/
                   15839:             NetBSD-1.6.2/
                   15840:                 i386/
                   15841:                     All/
                   15842:                     archivers/
                   15843:                         foo -&gt; ../All/foo
                   15844:                     ...
                   15845:         pkgsrc-2004Q1/
                   15846:             NetBSD-1.6.2/
                   15847:                 i386/
                   15848:                     All/
                   15849:                     ...
                   15850:             NetBSD-2.0/
                   15851:                 i386/
                   15852:                     All/
                   15853:                     ...
                   15854:             SunOS-5.9/
                   15855:                 sparc/
                   15856:                     All/
                   15857:                     ...
                   15858:                 x86/
                   15859:                     All/
                   15860:                     ...
                   15861: 
                   15862:         # Per os-release package archive convenience links
                   15863:         NetBSD-1.6.2 -&gt; 1.6.2
                   15864:         1.6.2/
                   15865:             i386 -&gt; ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
                   15866:             m68k/
                   15867:                 All/
                   15868:                 archivers/
                   15869:                     foo -&gt; ../All/foo
                   15870:                 ...
                   15871:             amiga -&gt; m68k
                   15872:             atari -&gt; m68k
                   15873:             ...
                   15874: 
                   15875:         2.0 -&gt; NetBSD-2.0       # backward compat, historic
                   15876:         NetBSD-2.0/
                   15877:             i386 -&gt; ../pkgsrc-2004Q1/NetBSD-2.0/i386
                   15878:         SunOS-5.9/
                   15879:             sparc -&gt; ../pkgsrc-2004Q1/SunOS-5.9/sparc
                   15880:             x86 -&gt; ../pkgsrc-2004Q1/SunOS-5.9/x86
1.1       grant    15881: </pre>
                   15882: 
                   15883:       <p>To create:</p>
                   15884: 
                   15885:       <div class="orderedlist">
                   15886:         <ol type="1">
                   15887:           <li>
                   15888:             <p>Run bulk build, see <a href="#bulkbuild" title=
1.67      hubertf  15889:             "6.3.&nbsp;Doing a bulk build of all packages">Section&nbsp;6.3,
                   15890:             &#8220;Doing a bulk build of all
1.1       grant    15891:             packages&#8221;</a></p>
                   15892:           </li>
                   15893: 
                   15894:           <li>
                   15895:             <p>Upload /usr/pkgsrc/packages to</p>
                   15896:             <pre class="programlisting">
                   15897:     ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.51      rillig   15898:         pkgsrc-2004Q4/\             # pkgsrc-branch
                   15899:         `uname -s`-`uname -r`/\     # OS &amp; version
                   15900:         `uname -p`                  # architecture
1.1       grant    15901: </pre>
                   15902:           </li>
                   15903: 
                   15904:           <li>
1.14      xtraeme  15905:             <p>If necessary, create a symlink <span><strong class=
                   15906:             "command">ln -s `uname -m` `uname -p`</strong></span>
                   15907:             (amiga -&gt; m68k, ...)</p>
1.1       grant    15908:           </li>
                   15909:         </ol>
                   15910:       </div>
                   15911:     </div>
1.2       hubertf  15912: 
1.67      hubertf  15913:     <div class="appendix" lang="en">
1.2       hubertf  15914:       <div class="titlepage">
                   15915:         <div>
                   15916:           <div>
1.67      hubertf  15917:             <h2 class="title"><a name=
1.46      gdt      15918:             "editing"></a>Appendix&nbsp;D.&nbsp;Editing guidelines
1.2       hubertf  15919:             for the pkgsrc guide</h2>
                   15920:           </div>
                   15921:         </div>
                   15922:       </div>
                   15923: 
                   15924:       <div class="toc">
                   15925:         <p><b>Table of Contents</b></p>
                   15926: 
                   15927:         <dl>
1.46      gdt      15928:           <dt><span class="sect1"><a href="#targets">D.1.
1.2       hubertf  15929:           Targets</a></span></dt>
                   15930: 
1.46      gdt      15931:           <dt><span class="sect1"><a href="#procedure">D.2.
1.2       hubertf  15932:           Procedure</a></span></dt>
                   15933:         </dl>
                   15934:       </div>
                   15935: 
                   15936:       <p>This section contains information on editing the pkgsrc
                   15937:       guide itself.</p>
                   15938: 
1.67      hubertf  15939:       <div class="sect1" lang="en">
1.2       hubertf  15940:         <div class="titlepage">
                   15941:           <div>
                   15942:             <div>
                   15943:               <h2 class="title" style="clear: both"><a name=
1.67      hubertf  15944:               "targets"></a>D.1.&nbsp;Targets</h2>
1.2       hubertf  15945:             </div>
                   15946:           </div>
                   15947:         </div>
                   15948: 
1.45      wiz      15949:         <p>The pkgsrc guide's source code is stored in <code xmlns=
                   15950:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15951:         "filename">pkgsrc/doc/guide/files</code>, and several files
1.2       hubertf  15952:         are created from it:</p>
                   15953: 
                   15954:         <div class="itemizedlist">
                   15955:           <ul type="disc">
                   15956:             <li>
1.45      wiz      15957:               <p><code xmlns=
                   15958:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.23      wiz      15959:               "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2       hubertf  15960:             </li>
                   15961: 
                   15962:             <li>
1.45      wiz      15963:               <p><code xmlns=
                   15964:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15965:               "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2       hubertf  15966:             </li>
                   15967: 
                   15968:             <li>
1.45      wiz      15969:               <p><code xmlns=
                   15970:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15971:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2       hubertf  15972:               the documentation on the NetBSD website will be built
                   15973:               from pkgsrc and kept up to date on the web server
                   15974:               itself. This means you <span class=
                   15975:               "emphasis"><em>must</em></span> make sure that your
                   15976:               changes haven't broken the build!</p>
                   15977:             </li>
1.6       hubertf  15978: 
                   15979:             <li>
1.45      wiz      15980:               <p><code xmlns=
                   15981:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15982:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6       hubertf  15983:               PDF version of the pkgsrc guide.</p>
                   15984:             </li>
                   15985: 
                   15986:             <li>
1.45      wiz      15987:               <p><code xmlns=
                   15988:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15989:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6       hubertf  15990:               PostScript version of the pkgsrc guide.</p>
                   15991:             </li>
1.2       hubertf  15992:           </ul>
                   15993:         </div>
                   15994:       </div>
                   15995: 
1.67      hubertf  15996:       <div class="sect1" lang="en">
1.2       hubertf  15997:         <div class="titlepage">
                   15998:           <div>
                   15999:             <div>
                   16000:               <h2 class="title" style="clear: both"><a name=
1.46      gdt      16001:               "procedure"></a>D.2.&nbsp;Procedure</h2>
1.2       hubertf  16002:             </div>
                   16003:           </div>
                   16004:         </div>
                   16005: 
                   16006:         <p>The procedure to edit the pkgsrc guide is:</p>
                   16007: 
                   16008:         <div class="itemizedlist">
                   16009:           <ul type="disc">
                   16010:             <li>
1.6       hubertf  16011:               <p>Make sure you have the packages needed to
                   16012:               re-generate the pkgsrc guide (and other XML-based
                   16013:               NetBSD documentation) installed. These are
1.11      ben      16014:               &#8220;<span class="quote">netbsd-doc</span>&#8221;
1.47      reed     16015:               for creating the ASCII and HTML versions, and
1.6       hubertf  16016:               &#8220;<span class=
1.47      reed     16017:               "quote">netbsd-doc-print</span>&#8221; for the
                   16018:               PostScript and PDF versions. You will need both
1.6       hubertf  16019:               packages installed, to make sure documentation is
                   16020:               consistent across all formats. The packages can be
1.45      wiz      16021:               found in <code xmlns=
                   16022:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  16023:               "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
1.45      wiz      16024:               <code xmlns=
                   16025:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  16026:               "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6       hubertf  16027:             </li>
                   16028: 
                   16029:             <li>
1.45      wiz      16030:               <p>Edit the XML file(s) in <code xmlns=
                   16031:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  16032:               "filename">pkgsrc/doc/guide/files</code>.</p>
1.2       hubertf  16033:             </li>
                   16034: 
                   16035:             <li>
1.14      xtraeme  16036:               <p>Run <span><strong class="command">make extract
                   16037:               &amp;&amp; make do-lint</strong></span> in
1.45      wiz      16038:               <code xmlns=
                   16039:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   16040:               "filename">pkgsrc/doc/guide</code> to check the XML
                   16041:               syntax, and fix it if needed.</p>
1.4       hubertf  16042:             </li>
                   16043: 
                   16044:             <li>
1.14      xtraeme  16045:               <p>Run <span><strong class=
1.45      wiz      16046:               "command">make</strong></span> in <code xmlns=
                   16047:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  16048:               "filename">pkgsrc/doc/guide</code> to build the HTML
                   16049:               and ASCII version.</p>
1.2       hubertf  16050:             </li>
                   16051: 
                   16052:             <li>
1.14      xtraeme  16053:               <p>If all is well, run <span><strong class=
                   16054:               "command">make install-doc</strong></span> to put the
1.45      wiz      16055:               generated files into <code xmlns=
                   16056:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  16057:               "filename">pkgsrc/doc</code>.</p>
1.2       hubertf  16058:             </li>
                   16059: 
                   16060:             <li>
1.14      xtraeme  16061:               <p><span><strong class="command">cvs commit
                   16062:               pkgsrc/doc/guide/files</strong></span></p>
1.2       hubertf  16063:             </li>
                   16064: 
                   16065:             <li>
1.14      xtraeme  16066:               <p><span><strong class="command">cvs commit -m
                   16067:               re-generate
                   16068:               pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2       hubertf  16069:             </li>
1.4       hubertf  16070: 
                   16071:             <li>
                   16072:               <p>Until the webserver on www.NetBSD.org is really
                   16073:               updated automatically to pick up changes to the
1.14      xtraeme  16074:               pkgsrc guide automatically, also run
1.18      xtraeme  16075:               <span><strong class="command">make install-htdocs
1.14      xtraeme  16076:               HTDOCSDIR=../../../htdocs</strong></span> (or
                   16077:               similar, adjust <code class=
                   16078:               "varname">HTDOCSDIR</code>!).</p>
1.4       hubertf  16079:             </li>
                   16080: 
                   16081:             <li>
1.14      xtraeme  16082:               <p><span><strong class="command">cvs commit
                   16083:               htdocs/Documentation/pkgsrc</strong></span></p>
1.4       hubertf  16084:             </li>
1.2       hubertf  16085:           </ul>
                   16086:         </div>
                   16087:       </div>
                   16088:     </div>
1.1       grant    16089:   </div>
                   16090: </body>
                   16091: </html>

CVSweb <webmaster@jp.NetBSD.org>