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

1.1       grant       1: <html xmlns="http://www.w3.org/1999/xhtml">
                      2: <head>
                      3:   <meta name="generator" content=
1.63    ! dillo       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.63    ! dillo      18:   <div class="book" lang="en">
1.1       grant      19:     <div class="titlepage">
                     20:       <div>
                     21:         <div>
1.63    ! dillo      22:           <h1 class="title"><a name="the-pkgsrc-guide"></a>The
        !            23:           pkgsrc guide</h1>
1.1       grant      24:         </div>
                     25: 
                     26:         <div>
1.2       hubertf    27:           <h2 class="subtitle">Documentation on the NetBSD packages
1.1       grant      28:           system</h2>
                     29:         </div>
                     30: 
                     31:         <div>
                     32:           <div class="authorgroup">
                     33:             <div class="author">
                     34:               <h3 class="author"><span class=
                     35:               "firstname">Alistair</span> <span class=
                     36:               "surname">Crooks</span></h3>
                     37: 
                     38:               <div class="affiliation">
                     39:                 <div class="address">
1.14      xtraeme    40:                   <p><code class="email">&lt;<a href=
                     41:                   "mailto:agc@NetBSD.org">agc@NetBSD.org</a>&gt;</code></p>
1.1       grant      42:                 </div>
                     43:               </div>
                     44:             </div>
                     45: 
                     46:             <div class="author">
                     47:               <h3 class="author"><span class=
                     48:               "firstname">Hubert</span> <span class=
                     49:               "surname">Feyrer</span></h3>
                     50: 
                     51:               <div class="affiliation">
                     52:                 <div class="address">
1.14      xtraeme    53:                   <p><code class="email">&lt;<a href=
                     54:                   "mailto:hubertf@NetBSD.org">hubertf@NetBSD.org</a>&gt;</code></p>
1.1       grant      55:                 </div>
                     56:               </div>
                     57:             </div>
1.2       hubertf    58: 
1.3       hubertf    59:             <h3 class="corpauthor">The pkgsrc Developers</h3>
1.1       grant      60:           </div>
                     61:         </div>
                     62: 
                     63:         <div>
1.48      dillo      64:           <p class="copyright">Copyright &#169; 1994-2005 The
1.1       grant      65:           NetBSD Foundation, Inc</p>
                     66:         </div>
                     67: 
1.23      wiz        68:         <div xmlns="http://www.w3.org/TR/xhtml1/transitional">
1.48      dillo      69:           <p xmlns="" class="pubdate">$NetBSD: pkgsrc.xml,v 1.10
                     70:           2005/10/05 13:59:56 dillo Exp $</p>
1.1       grant      71:         </div>
                     72: 
                     73:         <div>
                     74:           <div class="abstract">
                     75:             <p class="title"><b>Abstract</b></p>
                     76: 
                     77:             <p>Information about using the NetBSD package system
                     78:             (pkgsrc) from both a user view for installing packages
                     79:             as well as from a pkgsrc developers' view for creating
                     80:             new packages.</p>
                     81:           </div>
                     82:         </div>
                     83:       </div>
                     84:       <hr />
                     85:     </div>
                     86: 
                     87:     <div class="toc">
                     88:       <p><b>Table of Contents</b></p>
                     89: 
                     90:       <dl>
1.51      rillig     91:         <dt><span class="chapter"><a href="#introduction">1. What
                     92:         is pkgsrc?</a></span></dt>
1.1       grant      93: 
                     94:         <dd>
                     95:           <dl>
1.30      wiz        96:             <dt><span class="sect1"><a href=
                     97:             "#introduction-section">1.1.
1.1       grant      98:             Introduction</a></span></dt>
                     99: 
                    100:             <dt><span class="sect1"><a href="#overview">1.2.
                    101:             Overview</a></span></dt>
                    102: 
                    103:             <dt><span class="sect1"><a href="#terminology">1.3.
                    104:             Terminology</a></span></dt>
                    105: 
                    106:             <dt><span class="sect1"><a href="#typography">1.4.
                    107:             Typography</a></span></dt>
                    108:           </dl>
                    109:         </dd>
                    110: 
1.46      gdt       111:         <dt><span class="part"><a href="#users-guide">I. The pkgsrc
1.1       grant     112:         user's guide</a></span></dt>
                    113: 
                    114:         <dd>
                    115:           <dl>
                    116:             <dt><span class="chapter"><a href="#getting">2. Where
1.59      rillig    117:             to get pkgsrc and how to keep it
                    118:             up-to-date</a></span></dt>
1.1       grant     119: 
                    120:             <dd>
                    121:               <dl>
1.30      wiz       122:                 <dt><span class="sect1"><a href="#as-tar-file">2.1.
1.1       grant     123:                 As tar file</a></span></dt>
                    124: 
1.30      wiz       125:                 <dt><span class="sect1"><a href="#via-sup">2.2. Via
                    126:                 SUP</a></span></dt>
1.1       grant     127: 
1.30      wiz       128:                 <dt><span class="sect1"><a href="#via-cvs">2.3. Via
                    129:                 CVS</a></span></dt>
1.59      rillig    130: 
                    131:                 <dt><span class="sect1"><a href=
                    132:                 "#uptodate-cvs">2.4. Keeping pkgsrc up-to-date via
                    133:                 CVS</a></span></dt>
1.1       grant     134:               </dl>
                    135:             </dd>
                    136: 
                    137:             <dt><span class="chapter"><a href="#platforms">3. Using
                    138:             pkgsrc on systems other than NetBSD</a></span></dt>
                    139: 
                    140:             <dd>
                    141:               <dl>
1.30      wiz       142:                 <dt><span class="sect1"><a href=
                    143:                 "#bootstrapping-pkgsrc">3.1. Bootstrapping
                    144:                 pkgsrc</a></span></dt>
1.1       grant     145: 
1.30      wiz       146:                 <dt><span class="sect1"><a href=
1.47      reed      147:                 "#platform-specific-notes">3.2. Platform-specific
1.30      wiz       148:                 notes</a></span></dt>
1.1       grant     149: 
                    150:                 <dd>
                    151:                   <dl>
                    152:                     <dt><span class="sect2"><a href=
1.30      wiz       153:                     "#darwin">3.2.1. Darwin (Mac OS
1.1       grant     154:                     X)</a></span></dt>
                    155: 
                    156:                     <dt><span class="sect2"><a href=
1.30      wiz       157:                     "#freebsd">3.2.2. FreeBSD</a></span></dt>
1.1       grant     158: 
                    159:                     <dt><span class="sect2"><a href=
1.30      wiz       160:                     "#interix">3.2.3. Interix</a></span></dt>
1.1       grant     161: 
1.30      wiz       162:                     <dt><span class="sect2"><a href="#irix">3.2.4.
                    163:                     IRIX</a></span></dt>
1.1       grant     164: 
1.30      wiz       165:                     <dt><span class="sect2"><a href="#linux">3.2.5.
                    166:                     Linux</a></span></dt>
1.1       grant     167: 
                    168:                     <dt><span class="sect2"><a href=
1.30      wiz       169:                     "#openbsd">3.2.6. OpenBSD</a></span></dt>
1.22      tv        170: 
                    171:                     <dt><span class="sect2"><a href=
1.30      wiz       172:                     "#solaris">3.2.7. Solaris</a></span></dt>
1.1       grant     173:                   </dl>
                    174:                 </dd>
                    175:               </dl>
                    176:             </dd>
                    177: 
                    178:             <dt><span class="chapter"><a href="#using">4. Using
                    179:             pkgsrc</a></span></dt>
                    180: 
                    181:             <dd>
                    182:               <dl>
                    183:                 <dt><span class="sect1"><a href=
                    184:                 "#getting-started">4.1. Working with binary
                    185:                 packages</a></span></dt>
                    186: 
                    187:                 <dd>
                    188:                   <dl>
                    189:                     <dt><span class="sect2"><a href=
1.30      wiz       190:                     "#where-to-get-binary-packages">4.1.1. Where to
                    191:                     get binary packages</a></span></dt>
1.1       grant     192: 
                    193:                     <dt><span class="sect2"><a href=
1.30      wiz       194:                     "#how-to-use-binary-packages">4.1.2. How to use
                    195:                     binary packages</a></span></dt>
1.1       grant     196: 
                    197:                     <dt><span class="sect2"><a href=
1.30      wiz       198:                     "#a-word-of-warning">4.1.3. A word of
1.1       grant     199:                     warning</a></span></dt>
                    200:                   </dl>
                    201:                 </dd>
                    202: 
1.30      wiz       203:                 <dt><span class="sect1"><a href=
                    204:                 "#building-packages-from-source">4.2. Building
                    205:                 packages from source</a></span></dt>
1.1       grant     206: 
                    207:                 <dd>
                    208:                   <dl>
                    209:                     <dt><span class="sect2"><a href=
1.30      wiz       210:                     "#requirements">4.2.1.
1.1       grant     211:                     Requirements</a></span></dt>
                    212: 
                    213:                     <dt><span class="sect2"><a href=
1.30      wiz       214:                     "#fetching-distfiles">4.2.2. Fetching
1.1       grant     215:                     distfiles</a></span></dt>
                    216: 
                    217:                     <dt><span class="sect2"><a href=
1.30      wiz       218:                     "#how-to-build-and-install">4.2.3. How to build
                    219:                     and install</a></span></dt>
1.1       grant     220: 
                    221:                     <dt><span class="sect2"><a href=
1.30      wiz       222:                     "#selecting-the-compiler">4.2.4. Selecting the
1.1       grant     223:                     compiler</a></span></dt>
                    224:                   </dl>
                    225:                 </dd>
                    226:               </dl>
                    227:             </dd>
                    228: 
1.38      dillo     229:             <dt><span class="chapter"><a href="#configuring">5.
                    230:             Configuring pkgsrc</a></span></dt>
                    231: 
                    232:             <dd>
                    233:               <dl>
                    234:                 <dt><span class="sect1"><a href=
1.45      wiz       235:                 "#general-configuration">5.1. General
                    236:                 configuration</a></span></dt>
                    237: 
                    238:                 <dt><span class="sect1"><a href=
                    239:                 "#variables-affecting-build">5.2. Variables
                    240:                 affecting the build process</a></span></dt>
                    241: 
                    242:                 <dt><span class="sect1"><a href=
                    243:                 "#developer-advanced-settings">5.3.
                    244:                 Developer/advanced settings</a></span></dt>
                    245: 
                    246:                 <dt><span class="sect1"><a href=
                    247:                 "#selecting-build-options">5.4. Selecting Build
1.42      dillo     248:                 Options</a></span></dt>
1.38      dillo     249:               </dl>
                    250:             </dd>
                    251: 
                    252:             <dt><span class="chapter"><a href="#binary">6. Creating
1.1       grant     253:             binary packages</a></span></dt>
                    254: 
                    255:             <dd>
                    256:               <dl>
1.30      wiz       257:                 <dt><span class="sect1"><a href=
1.38      dillo     258:                 "#building-a-single-binary-package">6.1. Building a
1.30      wiz       259:                 single binary package</a></span></dt>
1.1       grant     260: 
1.30      wiz       261:                 <dt><span class="sect1"><a href=
1.38      dillo     262:                 "#settings-for-creationg-of-binary-packages">6.2.
1.1       grant     263:                 Settings for creation of binary
                    264:                 packages</a></span></dt>
                    265: 
1.38      dillo     266:                 <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1       grant     267:                 Doing a bulk build of all packages</a></span></dt>
                    268: 
                    269:                 <dd>
                    270:                   <dl>
                    271:                     <dt><span class="sect2"><a href=
1.38      dillo     272:                     "#binary.configuration">6.3.1.
1.1       grant     273:                     Configuration</a></span></dt>
                    274: 
                    275:                     <dt><span class="sect2"><a href=
1.38      dillo     276:                     "#other-environmental-considerations">6.3.2.
1.30      wiz       277:                     Other environmental
1.1       grant     278:                     considerations</a></span></dt>
                    279: 
                    280:                     <dt><span class="sect2"><a href=
1.38      dillo     281:                     "#operation">6.3.3. Operation</a></span></dt>
1.1       grant     282: 
                    283:                     <dt><span class="sect2"><a href=
1.38      dillo     284:                     "#what-it-does">6.3.4. What it
1.1       grant     285:                     does</a></span></dt>
                    286: 
                    287:                     <dt><span class="sect2"><a href=
1.38      dillo     288:                     "#disk-space-requirements">6.3.5. Disk space
1.1       grant     289:                     requirements</a></span></dt>
                    290: 
                    291:                     <dt><span class="sect2"><a href=
1.38      dillo     292:                     "#setting-up-a-sandbox">6.3.6. Setting up a
1.47      reed      293:                     sandbox for chrooted builds</a></span></dt>
1.1       grant     294: 
                    295:                     <dt><span class="sect2"><a href=
1.38      dillo     296:                     "#building-a-partial-set">6.3.7. Building a
1.30      wiz       297:                     partial set of packages</a></span></dt>
1.13      hubertf   298: 
                    299:                     <dt><span class="sect2"><a href=
1.38      dillo     300:                     "#bulk-upload">6.3.8. Uploading results of a
1.13      hubertf   301:                     bulk build</a></span></dt>
1.1       grant     302:                   </dl>
                    303:                 </dd>
                    304: 
1.30      wiz       305:                 <dt><span class="sect1"><a href=
1.38      dillo     306:                 "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30      wiz       307:                 packages collection</a></span></dt>
1.1       grant     308: 
                    309:                 <dd>
                    310:                   <dl>
                    311:                     <dt><span class="sect2"><a href=
1.38      dillo     312:                     "#cdpack-example">6.4.1. Example of
1.1       grant     313:                     cdpack</a></span></dt>
                    314:                   </dl>
                    315:                 </dd>
                    316:               </dl>
                    317:             </dd>
                    318: 
1.38      dillo     319:             <dt><span class="chapter"><a href="#faq">7. Frequently
1.1       grant     320:             Asked Questions</a></span></dt>
                    321: 
                    322:             <dd>
                    323:               <dl>
1.30      wiz       324:                 <dt><span class="sect1"><a href=
1.38      dillo     325:                 "#mailing-list-pointers">7.1. Are there any mailing
1.30      wiz       326:                 lists for pkg-related discussion?</a></span></dt>
1.1       grant     327: 
1.30      wiz       328:                 <dt><span class="sect1"><a href=
1.38      dillo     329:                 "#pkgviews-docs">7.2. Where's the pkgviews
1.30      wiz       330:                 documentation?</a></span></dt>
1.1       grant     331: 
1.5       hubertf   332:                 <dt><span class="sect1"><a href=
1.38      dillo     333:                 "#faq-pkgtools">7.3. Utilities for package
1.5       hubertf   334:                 management (pkgtools)</a></span></dt>
1.1       grant     335: 
1.30      wiz       336:                 <dt><span class="sect1"><a href=
1.38      dillo     337:                 "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30      wiz       338:                 non-root</a></span></dt>
                    339: 
                    340:                 <dt><span class="sect1"><a href=
1.38      dillo     341:                 "#resume-transfers">7.5. How to resume transfers
1.30      wiz       342:                 when fetching distfiles?</a></span></dt>
                    343: 
                    344:                 <dt><span class="sect1"><a href=
1.38      dillo     345:                 "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30      wiz       346:                 XFree86 from pkgsrc?</a></span></dt>
                    347: 
                    348:                 <dt><span class="sect1"><a href=
1.38      dillo     349:                 "#x.org-from-pkgsrc">7.7. How can I install/use
1.30      wiz       350:                 X.org from pkgsrc?</a></span></dt>
1.1       grant     351: 
1.30      wiz       352:                 <dt><span class="sect1"><a href=
1.38      dillo     353:                 "#fetch-behind-firewall">7.8. How to fetch files
1.30      wiz       354:                 from behind a firewall</a></span></dt>
1.1       grant     355: 
1.38      dillo     356:                 <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.14      xtraeme   357:                 How do I tell <span><strong class="command">make
                    358:                 fetch</strong></span> to do passive
1.1       grant     359:                 FTP?</a></span></dt>
                    360: 
1.30      wiz       361:                 <dt><span class="sect1"><a href=
1.38      dillo     362:                 "#fetching-all-distfiles">7.10. How to fetch all
1.30      wiz       363:                 distfiles at once</a></span></dt>
1.1       grant     364: 
1.30      wiz       365:                 <dt><span class="sect1"><a href=
1.38      dillo     366:                 "#tmac.andoc-missing">7.11. What does
1.30      wiz       367:                 &#8220;<span class="quote">Don't know how to make
                    368:                 /usr/share/tmac/tmac.andoc</span>&#8221;
1.14      xtraeme   369:                 mean?</a></span></dt>
1.13      hubertf   370: 
1.30      wiz       371:                 <dt><span class="sect1"><a href=
1.38      dillo     372:                 "#bsd.own.mk-missing">7.12. What does
1.30      wiz       373:                 &#8220;<span class="quote">Could not find
1.14      xtraeme   374:                 bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant     375: 
1.30      wiz       376:                 <dt><span class="sect1"><a href=
1.38      dillo     377:                 "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30      wiz       378:                 pkgsrc</a></span></dt>
1.1       grant     379: 
1.38      dillo     380:                 <dt><span class="sect1"><a href="#faq.conf">7.14.
1.35      jmmv      381:                 How do I change the location of configuration
                    382:                 files?</a></span></dt>
1.1       grant     383: 
                    384:                 <dt><span class="sect1"><a href=
1.38      dillo     385:                 "#audit-packages">7.15. Automated security
1.1       grant     386:                 checks</a></span></dt>
                    387:               </dl>
                    388:             </dd>
                    389:           </dl>
                    390:         </dd>
                    391: 
1.46      gdt       392:         <dt><span class="part"><a href="#developers-guide">II. The
1.1       grant     393:         pkgsrc developer's guide</a></span></dt>
                    394: 
                    395:         <dd>
                    396:           <dl>
1.38      dillo     397:             <dt><span class="chapter"><a href="#components">8.
1.27      rillig    398:             Package components - files, directories and
                    399:             contents</a></span></dt>
                    400: 
                    401:             <dd>
                    402:               <dl>
                    403:                 <dt><span class="sect1"><a href=
1.45      wiz       404:                 "#components.Makefile">8.1. <code xmlns=
                    405:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig    406:                 "filename">Makefile</code></a></span></dt>
                    407: 
                    408:                 <dt><span class="sect1"><a href=
1.45      wiz       409:                 "#components.distinfo">8.2. <code xmlns=
                    410:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig    411:                 "filename">distinfo</code></a></span></dt>
                    412: 
                    413:                 <dt><span class="sect1"><a href=
1.38      dillo     414:                 "#components.patches">8.3.
1.27      rillig    415:                 patches/*</a></span></dt>
                    416: 
1.30      wiz       417:                 <dt><span class="sect1"><a href=
1.38      dillo     418:                 "#other-mandatory-files">8.4. Other mandatory
1.30      wiz       419:                 files</a></span></dt>
1.27      rillig    420: 
                    421:                 <dt><span class="sect1"><a href=
1.38      dillo     422:                 "#components.optional">8.5. Optional
1.27      rillig    423:                 files</a></span></dt>
                    424: 
1.38      dillo     425:                 <dt><span class="sect1"><a href="#work-dir">8.6.
1.45      wiz       426:                 <code xmlns=
                    427:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                    428:                 "filename">work*</code></a></span></dt>
1.27      rillig    429: 
1.38      dillo     430:                 <dt><span class="sect1"><a href="#files-dir">8.7.
1.45      wiz       431:                 <code xmlns=
                    432:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig    433:                 "filename">files/*</code></a></span></dt>
                    434:               </dl>
                    435:             </dd>
                    436: 
1.38      dillo     437:             <dt><span class="chapter"><a href="#makefile">9.
1.45      wiz       438:             Programming in <code xmlns=
                    439:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.25      rillig    440:             "filename">Makefile</code>s</a></span></dt>
                    441: 
                    442:             <dd>
                    443:               <dl>
                    444:                 <dt><span class="sect1"><a href=
1.45      wiz       445:                 "#makefile.variables">9.1. <code xmlns=
                    446:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.25      rillig    447:                 "filename">Makefile</code>
                    448:                 variables</a></span></dt>
                    449: 
1.27      rillig    450:                 <dd>
                    451:                   <dl>
                    452:                     <dt><span class="sect2"><a href=
1.38      dillo     453:                     "#makefile.variables.names">9.1.1. Naming
1.27      rillig    454:                     conventions</a></span></dt>
                    455:                   </dl>
                    456:                 </dd>
                    457: 
1.25      rillig    458:                 <dt><span class="sect1"><a href=
1.38      dillo     459:                 "#makefile.code">9.2. Code snippets</a></span></dt>
1.25      rillig    460: 
                    461:                 <dd>
                    462:                   <dl>
                    463:                     <dt><span class="sect2"><a href=
1.38      dillo     464:                     "#adding-to-list">9.2.1. Adding things to a
1.25      rillig    465:                     list</a></span></dt>
                    466: 
                    467:                     <dt><span class="sect2"><a href=
1.38      dillo     468:                     "#converting-internal-to-external">9.2.2.
1.30      wiz       469:                     Converting an internal list into an external
                    470:                     list</a></span></dt>
1.25      rillig    471: 
                    472:                     <dt><span class="sect2"><a href=
1.38      dillo     473:                     "#passing-variable-to-shell">9.2.3. Passing
1.30      wiz       474:                     variables to a shell command</a></span></dt>
1.27      rillig    475: 
                    476:                     <dt><span class="sect2"><a href=
1.38      dillo     477:                     "#quoting-guideline">9.2.4. Quoting
1.27      rillig    478:                     guideline</a></span></dt>
                    479: 
                    480:                     <dt><span class="sect2"><a href=
1.38      dillo     481:                     "#bsd-make-bug-workaround">9.2.5. Workaround
1.30      wiz       482:                     for a bug in BSD Make</a></span></dt>
1.25      rillig    483:                   </dl>
                    484:                 </dd>
                    485:               </dl>
                    486:             </dd>
                    487: 
1.38      dillo     488:             <dt><span class="chapter"><a href="#plist">10. PLIST
1.1       grant     489:             issues</a></span></dt>
                    490: 
                    491:             <dd>
                    492:               <dl>
1.38      dillo     493:                 <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.30      wiz       494:                 ID</a></span></dt>
1.1       grant     495: 
1.30      wiz       496:                 <dt><span class="sect1"><a href=
1.38      dillo     497:                 "#automatic-plist-generation">10.2. Semi-automatic
1.45      wiz       498:                 <code xmlns=
                    499:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                    500:                 "filename">PLIST</code> generation</a></span></dt>
1.1       grant     501: 
1.38      dillo     502:                 <dt><span class="sect1"><a href=
                    503:                 "#print-PLIST">10.3. Tweaking output of
                    504:                 <span><strong class="command">make
1.14      xtraeme   505:                 print-PLIST</strong></span></a></span></dt>
1.1       grant     506: 
1.38      dillo     507:                 <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1       grant     508:                 Variable substitution in PLIST</a></span></dt>
                    509: 
1.30      wiz       510:                 <dt><span class="sect1"><a href=
1.48      dillo     511:                 "#manpage-compression">10.5. Man page
                    512:                 compression</a></span></dt>
1.1       grant     513: 
1.30      wiz       514:                 <dt><span class="sect1"><a href=
1.38      dillo     515:                 "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30      wiz       516:                 <code class=
1.14      xtraeme   517:                 "varname">PLIST_SRC</code></a></span></dt>
1.1       grant     518: 
1.30      wiz       519:                 <dt><span class="sect1"><a href=
1.47      reed      520:                 "#platform-specific-plist">10.7. Platform-specific
1.30      wiz       521:                 and differing PLISTs</a></span></dt>
1.1       grant     522: 
                    523:                 <dt><span class="sect1"><a href=
1.38      dillo     524:                 "#faq.common-dirs">10.8. Sharing directories
                    525:                 between packages</a></span></dt>
1.1       grant     526:               </dl>
                    527:             </dd>
                    528: 
1.38      dillo     529:             <dt><span class="chapter"><a href="#buildlink">11.
1.1       grant     530:             Buildlink methodology</a></span></dt>
                    531: 
                    532:             <dd>
                    533:               <dl>
1.30      wiz       534:                 <dt><span class="sect1"><a href=
1.38      dillo     535:                 "#converting-to-buildlink3">11.1. Converting
1.30      wiz       536:                 packages to use buildlink3</a></span></dt>
1.1       grant     537: 
1.30      wiz       538:                 <dt><span class="sect1"><a href=
1.38      dillo     539:                 "#creating-buildlink3.mk">11.2. Writing
1.45      wiz       540:                 <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                    541:                 class="filename">buildlink3.mk</code>
1.14      xtraeme   542:                 files</a></span></dt>
1.1       grant     543: 
                    544:                 <dd>
                    545:                   <dl>
                    546:                     <dt><span class="sect2"><a href=
1.38      dillo     547:                     "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30      wiz       548:                     buildlink3.mk file</a></span></dt>
1.1       grant     549: 
                    550:                     <dt><span class="sect2"><a href=
1.38      dillo     551:                     "#updating-buildlink-depends">11.2.2. Updating
1.30      wiz       552:                     <code class=
1.14      xtraeme   553:                     "varname">BUILDLINK_DEPENDS.<em class=
                    554:                     "replaceable"><code>pkg</code></em></code> in
1.45      wiz       555:                     <code xmlns=
                    556:                     "http://www.w3.org/TR/xhtml1/transitional"
                    557:                     class="filename">buildlink3.mk</code>
1.1       grant     558:                     files</a></span></dt>
                    559:                   </dl>
                    560:                 </dd>
                    561: 
1.30      wiz       562:                 <dt><span class="sect1"><a href=
1.45      wiz       563:                 "#writing-builtin.mk">11.3. Writing <code xmlns=
                    564:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz       565:                 "filename">builtin.mk</code> files</a></span></dt>
1.1       grant     566: 
                    567:                 <dd>
                    568:                   <dl>
                    569:                     <dt><span class="sect2"><a href=
1.38      dillo     570:                     "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45      wiz       571:                     <code xmlns=
                    572:                     "http://www.w3.org/TR/xhtml1/transitional"
                    573:                     class="filename">builtin.mk</code>
1.1       grant     574:                     file</a></span></dt>
                    575: 
                    576:                     <dt><span class="sect2"><a href=
1.38      dillo     577:                     "#native-or-pkgsrc-preference">11.3.2. Global
1.30      wiz       578:                     preferences for native or pkgsrc
                    579:                     software</a></span></dt>
1.1       grant     580:                   </dl>
                    581:                 </dd>
                    582:               </dl>
                    583:             </dd>
                    584: 
1.38      dillo     585:             <dt><span class="chapter"><a href="#pkginstall">12. The
1.35      jmmv      586:             pkginstall framework</a></span></dt>
                    587: 
                    588:             <dd>
                    589:               <dl>
                    590:                 <dt><span class="sect1"><a href=
1.38      dillo     591:                 "#files-and-dirs-outside-prefix">12.1. Files and
1.35      jmmv      592:                 directories outside the installation
                    593:                 prefix</a></span></dt>
                    594: 
                    595:                 <dd>
                    596:                   <dl>
                    597:                     <dt><span class="sect2"><a href=
1.38      dillo     598:                     "#dirs-outside-prefix">12.1.1. Directory
1.35      jmmv      599:                     manipulation</a></span></dt>
                    600: 
                    601:                     <dt><span class="sect2"><a href=
1.38      dillo     602:                     "#files-outside-prefix">12.1.2. File
1.35      jmmv      603:                     manipulation</a></span></dt>
                    604:                   </dl>
                    605:                 </dd>
                    606: 
1.38      dillo     607:                 <dt><span class="sect1"><a href="#conf-files">12.2.
1.35      jmmv      608:                 Configuration files</a></span></dt>
                    609: 
                    610:                 <dd>
                    611:                   <dl>
                    612:                     <dt><span class="sect2"><a href=
1.38      dillo     613:                     "#conf-files-sysconfdir">12.2.1. How
1.35      jmmv      614:                     <code class="varname">PKG_SYSCONFDIR</code> is
                    615:                     set</a></span></dt>
                    616: 
                    617:                     <dt><span class="sect2"><a href=
1.38      dillo     618:                     "#conf-files-configure">12.2.2. Telling the
1.47      reed      619:                     software where configuration files
1.35      jmmv      620:                     are</a></span></dt>
                    621: 
                    622:                     <dt><span class="sect2"><a href=
1.38      dillo     623:                     "#conf-files-patching">12.2.3. Patching
1.35      jmmv      624:                     installations</a></span></dt>
                    625: 
                    626:                     <dt><span class="sect2"><a href=
1.38      dillo     627:                     "#conf-files-disable">12.2.4. Disabling
1.35      jmmv      628:                     handling of configuration files</a></span></dt>
                    629:                   </dl>
                    630:                 </dd>
                    631: 
                    632:                 <dt><span class="sect1"><a href=
1.38      dillo     633:                 "#rcd-scripts">12.3. System startup
1.35      jmmv      634:                 scripts</a></span></dt>
                    635: 
                    636:                 <dd>
                    637:                   <dl>
                    638:                     <dt><span class="sect2"><a href=
1.38      dillo     639:                     "#rcd-scripts-disable">12.3.1. Disabling
1.35      jmmv      640:                     handling of system startup
                    641:                     scripts</a></span></dt>
                    642:                   </dl>
                    643:                 </dd>
                    644: 
                    645:                 <dt><span class="sect1"><a href=
1.38      dillo     646:                 "#users-and-groups">12.4. System users and
1.35      jmmv      647:                 groups</a></span></dt>
                    648: 
1.38      dillo     649:                 <dt><span class="sect1"><a href="#shells">12.5.
1.35      jmmv      650:                 System shells</a></span></dt>
                    651: 
                    652:                 <dd>
                    653:                   <dl>
                    654:                     <dt><span class="sect2"><a href=
1.38      dillo     655:                     "#shells-disable">12.5.1. Disabling handling of
1.35      jmmv      656:                     configuration files</a></span></dt>
                    657:                   </dl>
                    658:                 </dd>
                    659:               </dl>
                    660:             </dd>
                    661: 
1.38      dillo     662:             <dt><span class="chapter"><a href="#options">13.
1.1       grant     663:             Options handling</a></span></dt>
                    664: 
                    665:             <dd>
                    666:               <dl>
1.30      wiz       667:                 <dt><span class="sect1"><a href=
1.38      dillo     668:                 "#global-default-options">13.1. Global default
1.30      wiz       669:                 options</a></span></dt>
1.1       grant     670: 
1.30      wiz       671:                 <dt><span class="sect1"><a href=
1.38      dillo     672:                 "#converting-to-options">13.2. Converting packages
1.45      wiz       673:                 to use <code xmlns=
                    674:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme   675:                 "filename">bsd.options.mk</code></a></span></dt>
1.48      dillo     676: 
                    677:                 <dt><span class="sect1"><a href=
                    678:                 "#option-names">13.3. Option Names</a></span></dt>
1.1       grant     679:               </dl>
                    680:             </dd>
                    681: 
1.38      dillo     682:             <dt><span class="chapter"><a href="#build">14. The
1.1       grant     683:             build process</a></span></dt>
                    684: 
                    685:             <dd>
                    686:               <dl>
                    687:                 <dt><span class="sect1"><a href=
1.56      rillig    688:                 "#build.intro">14.1. Introduction</a></span></dt>
                    689: 
                    690:                 <dt><span class="sect1"><a href=
                    691:                 "#build.prefix">14.2. Program
1.1       grant     692:                 location</a></span></dt>
                    693: 
1.30      wiz       694:                 <dt><span class="sect1"><a href=
1.56      rillig    695:                 "#build.builddirs">14.3. Directories used during
                    696:                 the build process</a></span></dt>
                    697: 
                    698:                 <dt><span class="sect1"><a href=
                    699:                 "#build.running">14.4. Running a
                    700:                 phase</a></span></dt>
                    701: 
                    702:                 <dt><span class="sect1"><a href=
                    703:                 "#build.fetch">14.5. The <span class=
                    704:                 "emphasis"><em>fetch</em></span>
                    705:                 phase</a></span></dt>
                    706: 
                    707:                 <dt><span class="sect1"><a href=
                    708:                 "#build.checksum">14.6. The <span class=
                    709:                 "emphasis"><em>checksum</em></span>
                    710:                 phase</a></span></dt>
                    711: 
                    712:                 <dt><span class="sect1"><a href=
                    713:                 "#build.extract">14.7. The <span class=
                    714:                 "emphasis"><em>extract</em></span>
                    715:                 phase</a></span></dt>
                    716: 
                    717:                 <dt><span class="sect1"><a href=
                    718:                 "#build.patch">14.8. The <span class=
                    719:                 "emphasis"><em>patch</em></span>
                    720:                 phase</a></span></dt>
                    721: 
                    722:                 <dt><span class="sect1"><a href=
                    723:                 "#build.tools">14.9. The <span class=
                    724:                 "emphasis"><em>tools</em></span>
                    725:                 phase</a></span></dt>
                    726: 
                    727:                 <dt><span class="sect1"><a href=
                    728:                 "#build.wrapper">14.10. The <span class=
                    729:                 "emphasis"><em>wrapper</em></span>
                    730:                 phase</a></span></dt>
                    731: 
                    732:                 <dt><span class="sect1"><a href=
                    733:                 "#build.configure">14.11. The <span class=
                    734:                 "emphasis"><em>configure</em></span>
                    735:                 phase</a></span></dt>
                    736: 
                    737:                 <dt><span class="sect1"><a href=
                    738:                 "#build.build">14.12. The <span class=
                    739:                 "emphasis"><em>build</em></span>
                    740:                 phase</a></span></dt>
                    741: 
                    742:                 <dt><span class="sect1"><a href=
                    743:                 "#build.test">14.13. The <span class=
                    744:                 "emphasis"><em>test</em></span>
                    745:                 phase</a></span></dt>
                    746: 
                    747:                 <dt><span class="sect1"><a href=
                    748:                 "#build.install">14.14. The <span class=
                    749:                 "emphasis"><em>install</em></span>
                    750:                 phase</a></span></dt>
1.1       grant     751: 
                    752:                 <dt><span class="sect1"><a href=
1.56      rillig    753:                 "#build.package">14.15. The <span class=
                    754:                 "emphasis"><em>package</em></span>
                    755:                 phase</a></span></dt>
                    756: 
                    757:                 <dt><span class="sect1"><a href=
                    758:                 "#build.helpful-targets">14.16. Other helpful
1.1       grant     759:                 targets</a></span></dt>
                    760:               </dl>
                    761:             </dd>
                    762: 
1.55      rillig    763:             <dt><span class="chapter"><a href="#fixes">15. Making
                    764:             your package work</a></span></dt>
1.1       grant     765: 
                    766:             <dd>
                    767:               <dl>
1.30      wiz       768:                 <dt><span class="sect1"><a href=
1.38      dillo     769:                 "#general-operation">15.1. General
1.30      wiz       770:                 operation</a></span></dt>
1.1       grant     771: 
                    772:                 <dd>
                    773:                   <dl>
                    774:                     <dt><span class="sect2"><a href=
1.38      dillo     775:                     "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30      wiz       776:                     pull in variables from
                    777:                     /etc/mk.conf</a></span></dt>
1.1       grant     778: 
                    779:                     <dt><span class="sect2"><a href=
1.38      dillo     780:                     "#where-to-install-documentation">15.1.2. Where
1.31      wiz       781:                     to install documentation</a></span></dt>
                    782: 
                    783:                     <dt><span class="sect2"><a href=
1.38      dillo     784:                     "#restricted-packages">15.1.3. Restricted
1.1       grant     785:                     packages</a></span></dt>
                    786: 
                    787:                     <dt><span class="sect2"><a href=
1.38      dillo     788:                     "#dependencies">15.1.4. Handling
1.1       grant     789:                     dependencies</a></span></dt>
                    790: 
                    791:                     <dt><span class="sect2"><a href=
1.38      dillo     792:                     "#conflicts">15.1.5. Handling conflicts with
1.1       grant     793:                     other packages</a></span></dt>
                    794: 
                    795:                     <dt><span class="sect2"><a href=
1.38      dillo     796:                     "#not-building-packages">15.1.6. Packages that
1.30      wiz       797:                     cannot or should not be built</a></span></dt>
1.1       grant     798: 
                    799:                     <dt><span class="sect2"><a href=
1.38      dillo     800:                     "#undeletable-packages">15.1.7. Packages which
1.30      wiz       801:                     should not be deleted, once
                    802:                     installed</a></span></dt>
1.1       grant     803: 
                    804:                     <dt><span class="sect2"><a href=
1.38      dillo     805:                     "#security-handling">15.1.8. Handling packages
1.1       grant     806:                     with security problems</a></span></dt>
                    807: 
                    808:                     <dt><span class="sect2"><a href=
1.38      dillo     809:                     "#compiler-bugs">15.1.9. How to handle compiler
1.1       grant     810:                     bugs</a></span></dt>
                    811: 
                    812:                     <dt><span class="sect2"><a href=
1.38      dillo     813:                     "#bumping-pkgrevision">15.1.10. How to handle
1.30      wiz       814:                     incrementing versions when fixing an existing
1.1       grant     815:                     package</a></span></dt>
                    816: 
                    817:                     <dt><span class="sect2"><a href=
1.38      dillo     818:                     "#portability-of-packages">15.1.11. Portability
1.30      wiz       819:                     of packages</a></span></dt>
1.1       grant     820:                   </dl>
                    821:                 </dd>
                    822: 
1.30      wiz       823:                 <dt><span class="sect1"><a href=
1.38      dillo     824:                 "#downloading-issues">15.2. Possible downloading
1.30      wiz       825:                 issues</a></span></dt>
1.1       grant     826: 
                    827:                 <dd>
                    828:                   <dl>
                    829:                     <dt><span class="sect2"><a href=
1.38      dillo     830:                     "#no-plain-download">15.2.1. Packages whose
1.30      wiz       831:                     distfiles aren't available for plain
1.1       grant     832:                     downloading</a></span></dt>
                    833: 
                    834:                     <dt><span class="sect2"><a href=
1.38      dillo     835:                     "#modified-distfiles-same-name">15.2.2. How to
1.30      wiz       836:                     handle modified distfiles with the 'old'
                    837:                     name</a></span></dt>
1.1       grant     838:                   </dl>
                    839:                 </dd>
                    840: 
1.30      wiz       841:                 <dt><span class="sect1"><a href=
1.38      dillo     842:                 "#configuration-gotchas">15.3. Configuration
1.30      wiz       843:                 gotchas</a></span></dt>
1.1       grant     844: 
                    845:                 <dd>
                    846:                   <dl>
                    847:                     <dt><span class="sect2"><a href=
1.38      dillo     848:                     "#fixes.libtool">15.3.1. Shared libraries -
1.1       grant     849:                     libtool</a></span></dt>
                    850: 
                    851:                     <dt><span class="sect2"><a href=
1.38      dillo     852:                     "#using-libtool">15.3.2. Using libtool on GNU
1.1       grant     853:                     packages that already support
                    854:                     libtool</a></span></dt>
                    855: 
                    856:                     <dt><span class="sect2"><a href=
1.38      dillo     857:                     "#autoconf-automake">15.3.3. GNU
1.1       grant     858:                     Autoconf/Automake</a></span></dt>
                    859:                   </dl>
                    860:                 </dd>
                    861: 
1.30      wiz       862:                 <dt><span class="sect1"><a href=
1.55      rillig    863:                 "#fixes-build">15.4. Building the
                    864:                 package</a></span></dt>
1.1       grant     865: 
                    866:                 <dd>
                    867:                   <dl>
                    868:                     <dt><span class="sect2"><a href=
1.38      dillo     869:                     "#cpp-defines">15.4.1. CPP
1.1       grant     870:                     defines</a></span></dt>
1.51      rillig    871: 
                    872:                     <dt><span class="sect2"><a href=
1.60      rillig    873:                     "#cpp-list-examples">15.4.2. Examples of CPP
                    874:                     defines for some platforms</a></span></dt>
                    875: 
                    876:                     <dt><span class="sect2"><a href=
                    877:                     "#cpp-list">15.4.3. Getting a list of CPP
1.51      rillig    878:                     defines</a></span></dt>
1.1       grant     879:                   </dl>
                    880:                 </dd>
                    881: 
1.30      wiz       882:                 <dt><span class="sect1"><a href=
1.38      dillo     883:                 "#package-specific-actions">15.5. Package specific
1.30      wiz       884:                 actions</a></span></dt>
1.1       grant     885: 
                    886:                 <dd>
                    887:                   <dl>
                    888:                     <dt><span class="sect2"><a href=
1.38      dillo     889:                     "#user-interaction">15.5.1. User
1.2       hubertf   890:                     interaction</a></span></dt>
1.1       grant     891: 
                    892:                     <dt><span class="sect2"><a href=
1.38      dillo     893:                     "#handling-licenses">15.5.2. Handling
1.1       grant     894:                     licenses</a></span></dt>
                    895: 
                    896:                     <dt><span class="sect2"><a href=
1.38      dillo     897:                     "#installing-score-files">15.5.3. Installing
1.30      wiz       898:                     score files</a></span></dt>
1.1       grant     899: 
                    900:                     <dt><span class="sect2"><a href=
1.38      dillo     901:                     "#perl-scripts">15.5.4. Packages containing
1.30      wiz       902:                     perl scripts</a></span></dt>
1.1       grant     903: 
                    904:                     <dt><span class="sect2"><a href=
1.38      dillo     905:                     "#hardcoded-paths">15.5.5. Packages with
1.30      wiz       906:                     hardcoded paths to other
                    907:                     interpreters</a></span></dt>
1.1       grant     908: 
                    909:                     <dt><span class="sect2"><a href=
1.38      dillo     910:                     "#perl-modules">15.5.6. Packages installing
1.30      wiz       911:                     perl modules</a></span></dt>
1.1       grant     912: 
                    913:                     <dt><span class="sect2"><a href=
1.38      dillo     914:                     "#faq.info-files">15.5.7. Packages installing
1.1       grant     915:                     info files</a></span></dt>
                    916: 
                    917:                     <dt><span class="sect2"><a href=
1.57      minskim   918:                     "#manpages">15.5.8. Packages installing man
                    919:                     pages</a></span></dt>
                    920: 
                    921:                     <dt><span class="sect2"><a href=
                    922:                     "#gconf2-data-files">15.5.9. Packages
1.30      wiz       923:                     installing GConf2 data files</a></span></dt>
1.1       grant     924: 
                    925:                     <dt><span class="sect2"><a href=
1.57      minskim   926:                     "#scrollkeeper-data-files">15.5.10. Packages
1.30      wiz       927:                     installing scrollkeeper data
                    928:                     files</a></span></dt>
1.1       grant     929: 
                    930:                     <dt><span class="sect2"><a href=
1.57      minskim   931:                     "#x11-fonts">15.5.11. Packages installing X11
1.1       grant     932:                     fonts</a></span></dt>
                    933: 
                    934:                     <dt><span class="sect2"><a href=
1.57      minskim   935:                     "#gtk2-modules">15.5.12. Packages installing
1.30      wiz       936:                     GTK2 modules</a></span></dt>
1.1       grant     937: 
                    938:                     <dt><span class="sect2"><a href=
1.57      minskim   939:                     "#sgml-xml-data">15.5.13. Packages installing
1.30      wiz       940:                     SGML or XML data</a></span></dt>
1.1       grant     941: 
                    942:                     <dt><span class="sect2"><a href=
1.57      minskim   943:                     "#mime-database">15.5.14. Packages installing
1.1       grant     944:                     extensions to the MIME database</a></span></dt>
                    945: 
                    946:                     <dt><span class="sect2"><a href=
1.57      minskim   947:                     "#intltool">15.5.15. Packages using
1.1       grant     948:                     intltool</a></span></dt>
1.18      xtraeme   949: 
                    950:                     <dt><span class="sect2"><a href=
1.57      minskim   951:                     "#startup-scripts">15.5.16. Packages installing
1.18      xtraeme   952:                     startup scripts</a></span></dt>
1.57      minskim   953: 
                    954:                     <dt><span class="sect2"><a href=
                    955:                     "#tex-packages">15.5.17. Packages installing
                    956:                     TeX modules</a></span></dt>
1.1       grant     957:                   </dl>
                    958:                 </dd>
                    959: 
1.30      wiz       960:                 <dt><span class="sect1"><a href=
1.38      dillo     961:                 "#feedback-to-author">15.6. Feedback to the
1.30      wiz       962:                 author</a></span></dt>
1.1       grant     963:               </dl>
                    964:             </dd>
                    965: 
1.38      dillo     966:             <dt><span class="chapter"><a href="#debug">16.
1.1       grant     967:             Debugging</a></span></dt>
                    968: 
1.38      dillo     969:             <dt><span class="chapter"><a href="#submit">17.
1.1       grant     970:             Submitting and Committing</a></span></dt>
                    971: 
                    972:             <dd>
                    973:               <dl>
1.30      wiz       974:                 <dt><span class="sect1"><a href=
1.38      dillo     975:                 "#submitting-your-package">17.1. Submitting your
1.30      wiz       976:                 packages</a></span></dt>
1.1       grant     977: 
1.30      wiz       978:                 <dt><span class="sect1"><a href=
1.41      wiz       979:                 "#general-notes-for-changes">17.2. General notes
                    980:                 when adding, updating, or removing
                    981:                 packages</a></span></dt>
                    982: 
                    983:                 <dt><span class="sect1"><a href=
                    984:                 "#committing-importing">17.3. Committing: Importing
1.30      wiz       985:                 a package into CVS</a></span></dt>
1.1       grant     986: 
1.30      wiz       987:                 <dt><span class="sect1"><a href=
1.41      wiz       988:                 "#updating-package">17.4. Updating a package to a
1.30      wiz       989:                 newer version</a></span></dt>
1.1       grant     990: 
1.30      wiz       991:                 <dt><span class="sect1"><a href=
1.41      wiz       992:                 "#moving-package">17.5. Moving a package in
1.30      wiz       993:                 pkgsrc</a></span></dt>
1.1       grant     994:               </dl>
                    995:             </dd>
                    996:           </dl>
                    997:         </dd>
                    998: 
1.46      gdt       999:         <dt><span class="appendix"><a href="#examples">A. A simple
1.1       grant    1000:         example package: bison</a></span></dt>
                   1001: 
                   1002:         <dd>
                   1003:           <dl>
1.46      gdt      1004:             <dt><span class="sect1"><a href="#example-files">A.1.
1.1       grant    1005:             files</a></span></dt>
                   1006: 
                   1007:             <dd>
                   1008:               <dl>
1.30      wiz      1009:                 <dt><span class="sect2"><a href=
1.46      gdt      1010:                 "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1       grant    1011: 
1.30      wiz      1012:                 <dt><span class="sect2"><a href=
1.46      gdt      1013:                 "#example-descr">A.1.2. DESCR</a></span></dt>
1.1       grant    1014: 
1.30      wiz      1015:                 <dt><span class="sect2"><a href=
1.46      gdt      1016:                 "#example-plist">A.1.3. PLIST</a></span></dt>
1.1       grant    1017: 
1.30      wiz      1018:                 <dt><span class="sect2"><a href=
1.46      gdt      1019:                 "#checking-package-with-pkglint">A.1.4. Checking a
1.30      wiz      1020:                 package with <span><strong class=
1.14      xtraeme  1021:                 "command">pkglint</strong></span></a></span></dt>
1.1       grant    1022:               </dl>
                   1023:             </dd>
                   1024: 
1.46      gdt      1025:             <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30      wiz      1026:             Steps for building, installing,
                   1027:             packaging</a></span></dt>
1.1       grant    1028:           </dl>
                   1029:         </dd>
                   1030: 
1.46      gdt      1031:         <dt><span class="appendix"><a href="#logs">B. Build
1.1       grant    1032:         logs</a></span></dt>
                   1033: 
                   1034:         <dd>
                   1035:           <dl>
1.46      gdt      1036:             <dt><span class="sect1"><a href="#logs.building">B.1.
1.1       grant    1037:             Building figlet</a></span></dt>
                   1038: 
1.46      gdt      1039:             <dt><span class="sect1"><a href="#logs.package">B.2.
1.1       grant    1040:             Packaging figlet</a></span></dt>
                   1041:           </dl>
                   1042:         </dd>
                   1043: 
1.46      gdt      1044:         <dt><span class="appendix"><a href="#ftp-layout">C. Layout
1.1       grant    1045:         of the FTP server's package archive</a></span></dt>
1.2       hubertf  1046: 
1.46      gdt      1047:         <dt><span class="appendix"><a href="#editing">D. Editing
1.2       hubertf  1048:         guidelines for the pkgsrc guide</a></span></dt>
                   1049: 
                   1050:         <dd>
                   1051:           <dl>
1.46      gdt      1052:             <dt><span class="sect1"><a href="#targets">D.1.
1.2       hubertf  1053:             Targets</a></span></dt>
                   1054: 
1.46      gdt      1055:             <dt><span class="sect1"><a href="#procedure">D.2.
1.2       hubertf  1056:             Procedure</a></span></dt>
                   1057:           </dl>
                   1058:         </dd>
1.1       grant    1059:       </dl>
                   1060:     </div>
                   1061: 
1.63    ! dillo    1062:     <div class="chapter" lang="en">
1.1       grant    1063:       <div class="titlepage">
                   1064:         <div>
                   1065:           <div>
1.63    ! dillo    1066:             <h2 class="title"><a name=
1.51      rillig   1067:             "introduction"></a>Chapter&nbsp;1.&nbsp;What is
                   1068:             pkgsrc?</h2>
1.1       grant    1069:           </div>
                   1070:         </div>
                   1071:       </div>
                   1072: 
                   1073:       <div class="toc">
                   1074:         <p><b>Table of Contents</b></p>
                   1075: 
                   1076:         <dl>
1.30      wiz      1077:           <dt><span class="sect1"><a href=
                   1078:           "#introduction-section">1.1. Introduction</a></span></dt>
1.1       grant    1079: 
                   1080:           <dt><span class="sect1"><a href="#overview">1.2.
                   1081:           Overview</a></span></dt>
                   1082: 
                   1083:           <dt><span class="sect1"><a href="#terminology">1.3.
                   1084:           Terminology</a></span></dt>
                   1085: 
                   1086:           <dt><span class="sect1"><a href="#typography">1.4.
                   1087:           Typography</a></span></dt>
                   1088:         </dl>
                   1089:       </div>
                   1090: 
1.63    ! dillo    1091:       <div class="sect1" lang="en">
1.1       grant    1092:         <div class="titlepage">
                   1093:           <div>
                   1094:             <div>
                   1095:               <h2 class="title" style="clear: both"><a name=
1.30      wiz      1096:               "introduction-section"></a>1.1.&nbsp;Introduction</h2>
1.1       grant    1097:             </div>
                   1098:           </div>
                   1099:         </div>
                   1100: 
1.47      reed     1101:         <p>There is a lot of software freely available for
                   1102:         Unix-based systems, which usually runs on NetBSD and other
1.1       grant    1103:         Unix-flavoured systems, too, sometimes with some
                   1104:         modifications. The NetBSD Packages Collection (pkgsrc)
                   1105:         incorporates any such changes necessary to make that
                   1106:         software run, and makes the installation (and
                   1107:         de-installation) of the software package easy by means of a
                   1108:         single command.</p>
                   1109: 
                   1110:         <p>Once the software has been built, it is manipulated with
1.14      xtraeme  1111:         the <span><strong class="command">pkg_*</strong></span>
                   1112:         tools so that installation and de-installation, printing of
                   1113:         an inventory of all installed packages and retrieval of
                   1114:         one-line comments or more verbose descriptions are all
                   1115:         simple.</p>
1.1       grant    1116: 
                   1117:         <p>pkgsrc currently contains several thousand packages,
                   1118:         including:</p>
                   1119: 
                   1120:         <div class="itemizedlist">
                   1121:           <ul type="disc">
                   1122:             <li>
                   1123:               <p><a xmlns=
                   1124:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1125:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.45      wiz      1126:               target="_top"><code xmlns="" class=
                   1127:               "filename">www/apache</code></a> - The Apache web
1.20      ben      1128:               server</p>
1.1       grant    1129:             </li>
                   1130: 
                   1131:             <li>
                   1132:               <p><a xmlns=
                   1133:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1134:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45      wiz      1135:               target="_top"><code xmlns="" class=
                   1136:               "filename">www/mozilla</code></a> - The Mozilla web
1.20      ben      1137:               browser</p>
1.1       grant    1138:             </li>
                   1139: 
                   1140:             <li>
                   1141:               <p><a xmlns=
                   1142:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1143:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.45      wiz      1144:               target="_top"><code xmlns="" class=
                   1145:               "filename">meta-pkgs/gnome</code></a> - The GNOME
1.20      ben      1146:               Desktop Environment</p>
1.1       grant    1147:             </li>
                   1148: 
                   1149:             <li>
                   1150:               <p><a xmlns=
                   1151:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1152:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.45      wiz      1153:               target="_top"><code xmlns="" class=
                   1154:               "filename">meta-pkgs/kde3</code></a> - The K Desktop
1.20      ben      1155:               Environment</p>
1.1       grant    1156:             </li>
                   1157:           </ul>
                   1158:         </div>
                   1159: 
                   1160:         <p>...just to name a few.</p>
                   1161: 
                   1162:         <p>pkgsrc has built-in support for handling varying
                   1163:         dependencies, such as pthreads and X11, and extended
                   1164:         features such as IPv6 support on a range of platforms.</p>
                   1165: 
                   1166:         <p>pkgsrc was derived from FreeBSD's ports system, and
                   1167:         initially developed for NetBSD only. Since then, pkgsrc has
                   1168:         grown a lot, and now supports the following platforms:</p>
                   1169: 
                   1170:         <div class="itemizedlist">
                   1171:           <ul type="disc">
                   1172:             <li>
                   1173:               <p><a href="http://developer.apple.com/darwin/"
                   1174:               target="_top">Darwin</a> (<a href=
                   1175:               "http://www.apple.com/macosx/" target="_top">Mac OS
                   1176:               X</a>)</p>
                   1177:             </li>
                   1178: 
                   1179:             <li>
1.3       hubertf  1180:               <p><a href="http://www.DragonFlyBSD.org/" target=
                   1181:               "_top">DragonFlyBSD</a></p>
                   1182:             </li>
                   1183: 
                   1184:             <li>
1.1       grant    1185:               <p><a href="http://www.FreeBSD.org/" target=
                   1186:               "_top">FreeBSD</a></p>
                   1187:             </li>
                   1188: 
                   1189:             <li>
1.3       hubertf  1190:               <p>Microsoft Windows, via <a href=
                   1191:               "http://www.microsoft.com/windows/sfu/" target=
                   1192:               "_top">Interix</a></p>
1.1       grant    1193:             </li>
                   1194: 
                   1195:             <li>
                   1196:               <p><a href="http://www.sgi.com/software/irix6.5/"
                   1197:               target="_top">IRIX</a></p>
                   1198:             </li>
                   1199: 
                   1200:             <li>
                   1201:               <p><a href="http://www.linux.org/" target=
                   1202:               "_top">Linux</a></p>
                   1203:             </li>
                   1204: 
                   1205:             <li>
                   1206:               <p><a href="http://www.NetBSD.org/" target=
                   1207:               "_top">NetBSD</a> (of course)</p>
                   1208:             </li>
                   1209: 
                   1210:             <li>
1.17      sketch   1211:               <p><a href="http://h30097.www3.hp.com/" target=
                   1212:               "_top">Tru64</a> (Digital UNIX, OSF1)</p>
                   1213:             </li>
                   1214: 
                   1215:             <li>
1.1       grant    1216:               <p><a href="http://www.openbsd.org/" target=
                   1217:               "_top">OpenBSD</a></p>
                   1218:             </li>
                   1219: 
                   1220:             <li>
                   1221:               <p><a href="http://www.sun.com/solaris/" target=
                   1222:               "_top">Solaris</a></p>
                   1223:             </li>
                   1224:           </ul>
                   1225:         </div>
                   1226:       </div>
                   1227: 
1.63    ! dillo    1228:       <div class="sect1" lang="en">
1.1       grant    1229:         <div class="titlepage">
                   1230:           <div>
                   1231:             <div>
                   1232:               <h2 class="title" style="clear: both"><a name=
1.63    ! dillo    1233:               "overview"></a>1.2.&nbsp;Overview</h2>
1.1       grant    1234:             </div>
                   1235:           </div>
                   1236:         </div>
                   1237: 
                   1238:         <p>This document is divided into two parts. The first,
                   1239:         <a href="#users-guide" title=
1.46      gdt      1240:         "Part&nbsp;I.&nbsp;The pkgsrc user's guide">The pkgsrc
1.2       hubertf  1241:         user's guide</a>, describes how one can use one of the
                   1242:         packages in the Package Collection, either by installing a
                   1243:         precompiled binary package, or by building one's own copy
                   1244:         using the NetBSD package system. The second part, <a href=
1.1       grant    1245:         "#developers-guide" title=
1.46      gdt      1246:         "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">The
                   1247:         pkgsrc developer's guide</a>, explains how to prepare a
                   1248:         package so it can be easily built by other NetBSD users
                   1249:         without knowing about the package's building details.</p>
1.1       grant    1250: 
                   1251:         <p>This document is available in various formats:</p>
                   1252: 
                   1253:         <div class="itemizedlist">
                   1254:           <ul type="disc">
                   1255:             <li>
                   1256:               <p><a href="index.html" target="_top">HTML</a></p>
                   1257:             </li>
                   1258: 
                   1259:             <li>
                   1260:               <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
                   1261:             </li>
                   1262: 
                   1263:             <li>
                   1264:               <p><a href="pkgsrc.ps" target="_top">PS</a></p>
                   1265:             </li>
                   1266: 
                   1267:             <li>
                   1268:               <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
                   1269:             </li>
                   1270:           </ul>
                   1271:         </div>
                   1272:       </div>
                   1273: 
1.63    ! dillo    1274:       <div class="sect1" lang="en">
1.1       grant    1275:         <div class="titlepage">
                   1276:           <div>
                   1277:             <div>
                   1278:               <h2 class="title" style="clear: both"><a name=
                   1279:               "terminology"></a>1.3.&nbsp;Terminology</h2>
                   1280:             </div>
                   1281:           </div>
                   1282:         </div>
                   1283: 
                   1284:         <p>There has been a lot of talk about &#8220;<span class=
                   1285:         "quote">ports</span>&#8221;, &#8220;<span class=
                   1286:         "quote">packages</span>&#8221;, etc. so far. Here is a
                   1287:         description of all the terminology used within this
                   1288:         document.</p>
                   1289: 
                   1290:         <div class="variablelist">
                   1291:           <dl>
                   1292:             <dt><span class="term">Package</span></dt>
                   1293: 
                   1294:             <dd>
                   1295:               <p>A set of files and building instructions that
                   1296:               describe what's necessary to build a certain piece of
                   1297:               software using pkgsrc. Packages are traditionally
1.45      wiz      1298:               stored under <code xmlns=
                   1299:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1300:               "filename">/usr/pkgsrc</code>.</p>
1.1       grant    1301:             </dd>
                   1302: 
                   1303:             <dt><span class="term">The NetBSD package
                   1304:             system</span></dt>
                   1305: 
                   1306:             <dd>
                   1307:               <p>This is the former name of &#8220;<span class=
                   1308:               "quote">pkgsrc</span>&#8221;. It is part of the
1.27      rillig   1309:               NetBSD operating system and can be bootstrapped to
                   1310:               run on non-NetBSD operating systems as well. It
                   1311:               handles building (compiling), installing, and
                   1312:               removing of packages.</p>
1.1       grant    1313:             </dd>
                   1314: 
                   1315:             <dt><span class="term">Distfile</span></dt>
                   1316: 
                   1317:             <dd>
                   1318:               <p>This term describes the file or files that are
                   1319:               provided by the author of the piece of software to
                   1320:               distribute his work. All the changes necessary to
                   1321:               build on NetBSD are reflected in the corresponding
                   1322:               package. Usually the distfile is in the form of a
                   1323:               compressed tar-archive, but other types are possible,
1.45      wiz      1324:               too. Distfiles are usually stored below <code xmlns=
                   1325:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1326:               "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    1327:             </dd>
                   1328: 
                   1329:             <dt><span class="term">Port</span></dt>
                   1330: 
                   1331:             <dd>
                   1332:               <p>This is the term used by FreeBSD and OpenBSD
                   1333:               people for what we call a package. In NetBSD
                   1334:               terminology, &#8220;<span class=
                   1335:               "quote">port</span>&#8221; refers to a different
                   1336:               architecture.</p>
                   1337:             </dd>
                   1338: 
                   1339:             <dt><span class="term">Precompiled/binary
                   1340:             package</span></dt>
                   1341: 
                   1342:             <dd>
                   1343:               <p>A set of binaries built with pkgsrc from a
1.14      xtraeme  1344:               distfile and stuffed together in a single
1.45      wiz      1345:               <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   1346:               class="filename">.tgz</code> file so it can be
1.14      xtraeme  1347:               installed on machines of the same machine
                   1348:               architecture without the need to recompile. Packages
1.45      wiz      1349:               are usually generated in <code xmlns=
                   1350:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1351:               "filename">/usr/pkgsrc/packages</code>; there is also
                   1352:               an archive on <a href=
1.1       grant    1353:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
                   1354:               "_top">ftp.NetBSD.org</a>.</p>
                   1355: 
                   1356:               <p>Sometimes, this is referred to by the term
                   1357:               &#8220;<span class="quote">package</span>&#8221; too,
                   1358:               especially in the context of precompiled
                   1359:               packages.</p>
                   1360:             </dd>
                   1361: 
                   1362:             <dt><span class="term">Program</span></dt>
                   1363: 
                   1364:             <dd>
                   1365:               <p>The piece of software to be installed which will
1.47      reed     1366:               be constructed from all the files in the distfile by
1.1       grant    1367:               the actions defined in the corresponding package.</p>
                   1368:             </dd>
                   1369:           </dl>
                   1370:         </div>
                   1371:       </div>
                   1372: 
1.63    ! dillo    1373:       <div class="sect1" lang="en">
1.1       grant    1374:         <div class="titlepage">
                   1375:           <div>
                   1376:             <div>
                   1377:               <h2 class="title" style="clear: both"><a name=
                   1378:               "typography"></a>1.4.&nbsp;Typography</h2>
                   1379:             </div>
                   1380:           </div>
                   1381:         </div>
                   1382: 
                   1383:         <p>When giving examples for commands, shell prompts are
                   1384:         used to show if the command should/can be issued as root,
                   1385:         or if &#8220;<span class="quote">normal</span>&#8221; user
1.14      xtraeme  1386:         privileges are sufficient. We use a <code class=
                   1387:         "prompt">#</code> for root's shell prompt, and a
1.27      rillig   1388:         <code class="prompt">%</code> for users' shell prompt,
1.14      xtraeme  1389:         assuming they use the C-shell or tcsh.</p>
1.1       grant    1390:       </div>
                   1391:     </div>
                   1392: 
1.63    ! dillo    1393:     <div class="part" lang="en">
1.1       grant    1394:       <div class="titlepage">
                   1395:         <div>
                   1396:           <div>
1.63    ! dillo    1397:             <h1 class="title"><a name=
1.48      dillo    1398:             "users-guide"></a>Part&nbsp;I.&nbsp;The pkgsrc user's
                   1399:             guide</h1>
1.1       grant    1400:           </div>
                   1401:         </div>
                   1402:       </div>
                   1403: 
                   1404:       <div class="toc">
                   1405:         <p><b>Table of Contents</b></p>
                   1406: 
                   1407:         <dl>
                   1408:           <dt><span class="chapter"><a href="#getting">2. Where to
1.59      rillig   1409:           get pkgsrc and how to keep it up-to-date</a></span></dt>
1.1       grant    1410: 
                   1411:           <dd>
                   1412:             <dl>
1.30      wiz      1413:               <dt><span class="sect1"><a href="#as-tar-file">2.1.
                   1414:               As tar file</a></span></dt>
1.1       grant    1415: 
1.30      wiz      1416:               <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1       grant    1417:               SUP</a></span></dt>
                   1418: 
1.30      wiz      1419:               <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1       grant    1420:               CVS</a></span></dt>
1.59      rillig   1421: 
                   1422:               <dt><span class="sect1"><a href="#uptodate-cvs">2.4.
                   1423:               Keeping pkgsrc up-to-date via CVS</a></span></dt>
1.1       grant    1424:             </dl>
                   1425:           </dd>
                   1426: 
                   1427:           <dt><span class="chapter"><a href="#platforms">3. Using
                   1428:           pkgsrc on systems other than NetBSD</a></span></dt>
                   1429: 
                   1430:           <dd>
                   1431:             <dl>
1.30      wiz      1432:               <dt><span class="sect1"><a href=
                   1433:               "#bootstrapping-pkgsrc">3.1. Bootstrapping
                   1434:               pkgsrc</a></span></dt>
1.1       grant    1435: 
1.30      wiz      1436:               <dt><span class="sect1"><a href=
1.47      reed     1437:               "#platform-specific-notes">3.2. Platform-specific
1.30      wiz      1438:               notes</a></span></dt>
1.1       grant    1439: 
                   1440:               <dd>
                   1441:                 <dl>
1.30      wiz      1442:                   <dt><span class="sect2"><a href="#darwin">3.2.1.
                   1443:                   Darwin (Mac OS X)</a></span></dt>
1.1       grant    1444: 
1.30      wiz      1445:                   <dt><span class="sect2"><a href="#freebsd">3.2.2.
                   1446:                   FreeBSD</a></span></dt>
1.22      tv       1447: 
1.30      wiz      1448:                   <dt><span class="sect2"><a href="#interix">3.2.3.
                   1449:                   Interix</a></span></dt>
1.1       grant    1450: 
1.30      wiz      1451:                   <dt><span class="sect2"><a href="#irix">3.2.4.
                   1452:                   IRIX</a></span></dt>
1.1       grant    1453: 
1.30      wiz      1454:                   <dt><span class="sect2"><a href="#linux">3.2.5.
                   1455:                   Linux</a></span></dt>
1.1       grant    1456: 
1.30      wiz      1457:                   <dt><span class="sect2"><a href="#openbsd">3.2.6.
                   1458:                   OpenBSD</a></span></dt>
1.1       grant    1459: 
1.30      wiz      1460:                   <dt><span class="sect2"><a href="#solaris">3.2.7.
                   1461:                   Solaris</a></span></dt>
1.1       grant    1462:                 </dl>
                   1463:               </dd>
                   1464:             </dl>
                   1465:           </dd>
                   1466: 
                   1467:           <dt><span class="chapter"><a href="#using">4. Using
                   1468:           pkgsrc</a></span></dt>
                   1469: 
                   1470:           <dd>
                   1471:             <dl>
                   1472:               <dt><span class="sect1"><a href=
                   1473:               "#getting-started">4.1. Working with binary
                   1474:               packages</a></span></dt>
                   1475: 
                   1476:               <dd>
                   1477:                 <dl>
                   1478:                   <dt><span class="sect2"><a href=
1.30      wiz      1479:                   "#where-to-get-binary-packages">4.1.1. Where to
                   1480:                   get binary packages</a></span></dt>
1.1       grant    1481: 
                   1482:                   <dt><span class="sect2"><a href=
1.30      wiz      1483:                   "#how-to-use-binary-packages">4.1.2. How to use
                   1484:                   binary packages</a></span></dt>
1.1       grant    1485: 
                   1486:                   <dt><span class="sect2"><a href=
1.30      wiz      1487:                   "#a-word-of-warning">4.1.3. A word of
1.1       grant    1488:                   warning</a></span></dt>
                   1489:                 </dl>
                   1490:               </dd>
                   1491: 
1.30      wiz      1492:               <dt><span class="sect1"><a href=
                   1493:               "#building-packages-from-source">4.2. Building
                   1494:               packages from source</a></span></dt>
1.1       grant    1495: 
                   1496:               <dd>
                   1497:                 <dl>
                   1498:                   <dt><span class="sect2"><a href=
1.30      wiz      1499:                   "#requirements">4.2.1.
                   1500:                   Requirements</a></span></dt>
1.1       grant    1501: 
                   1502:                   <dt><span class="sect2"><a href=
1.30      wiz      1503:                   "#fetching-distfiles">4.2.2. Fetching
1.1       grant    1504:                   distfiles</a></span></dt>
                   1505: 
                   1506:                   <dt><span class="sect2"><a href=
1.30      wiz      1507:                   "#how-to-build-and-install">4.2.3. How to build
                   1508:                   and install</a></span></dt>
1.1       grant    1509: 
                   1510:                   <dt><span class="sect2"><a href=
1.30      wiz      1511:                   "#selecting-the-compiler">4.2.4. Selecting the
1.1       grant    1512:                   compiler</a></span></dt>
                   1513:                 </dl>
                   1514:               </dd>
                   1515:             </dl>
                   1516:           </dd>
                   1517: 
1.38      dillo    1518:           <dt><span class="chapter"><a href="#configuring">5.
                   1519:           Configuring pkgsrc</a></span></dt>
                   1520: 
                   1521:           <dd>
                   1522:             <dl>
                   1523:               <dt><span class="sect1"><a href=
1.45      wiz      1524:               "#general-configuration">5.1. General
                   1525:               configuration</a></span></dt>
                   1526: 
                   1527:               <dt><span class="sect1"><a href=
                   1528:               "#variables-affecting-build">5.2. Variables affecting
                   1529:               the build process</a></span></dt>
                   1530: 
                   1531:               <dt><span class="sect1"><a href=
                   1532:               "#developer-advanced-settings">5.3.
                   1533:               Developer/advanced settings</a></span></dt>
                   1534: 
                   1535:               <dt><span class="sect1"><a href=
                   1536:               "#selecting-build-options">5.4. Selecting Build
1.42      dillo    1537:               Options</a></span></dt>
1.38      dillo    1538:             </dl>
                   1539:           </dd>
                   1540: 
                   1541:           <dt><span class="chapter"><a href="#binary">6. Creating
1.1       grant    1542:           binary packages</a></span></dt>
                   1543: 
                   1544:           <dd>
                   1545:             <dl>
1.30      wiz      1546:               <dt><span class="sect1"><a href=
1.38      dillo    1547:               "#building-a-single-binary-package">6.1. Building a
1.30      wiz      1548:               single binary package</a></span></dt>
1.1       grant    1549: 
1.30      wiz      1550:               <dt><span class="sect1"><a href=
1.38      dillo    1551:               "#settings-for-creationg-of-binary-packages">6.2.
1.1       grant    1552:               Settings for creation of binary
                   1553:               packages</a></span></dt>
                   1554: 
1.38      dillo    1555:               <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1       grant    1556:               Doing a bulk build of all packages</a></span></dt>
                   1557: 
                   1558:               <dd>
                   1559:                 <dl>
                   1560:                   <dt><span class="sect2"><a href=
1.38      dillo    1561:                   "#binary.configuration">6.3.1.
1.1       grant    1562:                   Configuration</a></span></dt>
                   1563: 
                   1564:                   <dt><span class="sect2"><a href=
1.38      dillo    1565:                   "#other-environmental-considerations">6.3.2.
1.30      wiz      1566:                   Other environmental
1.1       grant    1567:                   considerations</a></span></dt>
                   1568: 
                   1569:                   <dt><span class="sect2"><a href=
1.38      dillo    1570:                   "#operation">6.3.3. Operation</a></span></dt>
1.1       grant    1571: 
                   1572:                   <dt><span class="sect2"><a href=
1.38      dillo    1573:                   "#what-it-does">6.3.4. What it
1.30      wiz      1574:                   does</a></span></dt>
1.1       grant    1575: 
                   1576:                   <dt><span class="sect2"><a href=
1.38      dillo    1577:                   "#disk-space-requirements">6.3.5. Disk space
1.1       grant    1578:                   requirements</a></span></dt>
                   1579: 
                   1580:                   <dt><span class="sect2"><a href=
1.38      dillo    1581:                   "#setting-up-a-sandbox">6.3.6. Setting up a
1.47      reed     1582:                   sandbox for chrooted builds</a></span></dt>
1.1       grant    1583: 
                   1584:                   <dt><span class="sect2"><a href=
1.38      dillo    1585:                   "#building-a-partial-set">6.3.7. Building a
1.30      wiz      1586:                   partial set of packages</a></span></dt>
1.13      hubertf  1587: 
                   1588:                   <dt><span class="sect2"><a href=
1.38      dillo    1589:                   "#bulk-upload">6.3.8. Uploading results of a bulk
1.13      hubertf  1590:                   build</a></span></dt>
1.1       grant    1591:                 </dl>
                   1592:               </dd>
                   1593: 
1.30      wiz      1594:               <dt><span class="sect1"><a href=
1.38      dillo    1595:               "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30      wiz      1596:               packages collection</a></span></dt>
1.1       grant    1597: 
                   1598:               <dd>
                   1599:                 <dl>
                   1600:                   <dt><span class="sect2"><a href=
1.38      dillo    1601:                   "#cdpack-example">6.4.1. Example of
1.1       grant    1602:                   cdpack</a></span></dt>
                   1603:                 </dl>
                   1604:               </dd>
                   1605:             </dl>
                   1606:           </dd>
                   1607: 
1.38      dillo    1608:           <dt><span class="chapter"><a href="#faq">7. Frequently
1.1       grant    1609:           Asked Questions</a></span></dt>
                   1610: 
                   1611:           <dd>
                   1612:             <dl>
1.30      wiz      1613:               <dt><span class="sect1"><a href=
1.38      dillo    1614:               "#mailing-list-pointers">7.1. Are there any mailing
1.30      wiz      1615:               lists for pkg-related discussion?</a></span></dt>
1.1       grant    1616: 
1.38      dillo    1617:               <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1       grant    1618:               Where's the pkgviews documentation?</a></span></dt>
                   1619: 
1.38      dillo    1620:               <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1       grant    1621:               Utilities for package management
                   1622:               (pkgtools)</a></span></dt>
                   1623: 
1.30      wiz      1624:               <dt><span class="sect1"><a href=
1.38      dillo    1625:               "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30      wiz      1626:               non-root</a></span></dt>
1.1       grant    1627: 
1.30      wiz      1628:               <dt><span class="sect1"><a href=
1.38      dillo    1629:               "#resume-transfers">7.5. How to resume transfers when
1.30      wiz      1630:               fetching distfiles?</a></span></dt>
1.14      xtraeme  1631: 
1.30      wiz      1632:               <dt><span class="sect1"><a href=
1.38      dillo    1633:               "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30      wiz      1634:               XFree86 from pkgsrc?</a></span></dt>
1.1       grant    1635: 
1.30      wiz      1636:               <dt><span class="sect1"><a href=
1.38      dillo    1637:               "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30      wiz      1638:               from pkgsrc?</a></span></dt>
1.1       grant    1639: 
1.30      wiz      1640:               <dt><span class="sect1"><a href=
1.38      dillo    1641:               "#fetch-behind-firewall">7.8. How to fetch files from
1.30      wiz      1642:               behind a firewall</a></span></dt>
1.1       grant    1643: 
1.38      dillo    1644:               <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.30      wiz      1645:               How do I tell <span><strong class="command">make
1.14      xtraeme  1646:               fetch</strong></span> to do passive
1.1       grant    1647:               FTP?</a></span></dt>
                   1648: 
1.30      wiz      1649:               <dt><span class="sect1"><a href=
1.38      dillo    1650:               "#fetching-all-distfiles">7.10. How to fetch all
1.30      wiz      1651:               distfiles at once</a></span></dt>
1.1       grant    1652: 
1.30      wiz      1653:               <dt><span class="sect1"><a href=
1.38      dillo    1654:               "#tmac.andoc-missing">7.11. What does
1.30      wiz      1655:               &#8220;<span class="quote">Don't know how to make
                   1656:               /usr/share/tmac/tmac.andoc</span>&#8221;
1.14      xtraeme  1657:               mean?</a></span></dt>
1.13      hubertf  1658: 
1.30      wiz      1659:               <dt><span class="sect1"><a href=
1.38      dillo    1660:               "#bsd.own.mk-missing">7.12. What does
1.30      wiz      1661:               &#8220;<span class="quote">Could not find
1.14      xtraeme  1662:               bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    1663: 
1.30      wiz      1664:               <dt><span class="sect1"><a href=
1.38      dillo    1665:               "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30      wiz      1666:               pkgsrc</a></span></dt>
1.1       grant    1667: 
1.38      dillo    1668:               <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35      jmmv     1669:               do I change the location of configuration
                   1670:               files?</a></span></dt>
1.1       grant    1671: 
                   1672:               <dt><span class="sect1"><a href=
1.38      dillo    1673:               "#audit-packages">7.15. Automated security
1.1       grant    1674:               checks</a></span></dt>
                   1675:             </dl>
                   1676:           </dd>
                   1677:         </dl>
                   1678:       </div>
                   1679: 
1.63    ! dillo    1680:       <div class="chapter" lang="en">
1.1       grant    1681:         <div class="titlepage">
                   1682:           <div>
                   1683:             <div>
1.63    ! dillo    1684:               <h2 class="title"><a name=
1.1       grant    1685:               "getting"></a>Chapter&nbsp;2.&nbsp;Where to get
1.59      rillig   1686:               pkgsrc and how to keep it up-to-date</h2>
1.1       grant    1687:             </div>
                   1688:           </div>
                   1689:         </div>
                   1690: 
                   1691:         <div class="toc">
                   1692:           <p><b>Table of Contents</b></p>
                   1693: 
                   1694:           <dl>
1.30      wiz      1695:             <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1       grant    1696:             tar file</a></span></dt>
                   1697: 
1.30      wiz      1698:             <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1       grant    1699:             SUP</a></span></dt>
                   1700: 
1.30      wiz      1701:             <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1       grant    1702:             CVS</a></span></dt>
1.59      rillig   1703: 
                   1704:             <dt><span class="sect1"><a href="#uptodate-cvs">2.4.
                   1705:             Keeping pkgsrc up-to-date via CVS</a></span></dt>
1.1       grant    1706:           </dl>
                   1707:         </div>
                   1708: 
                   1709:         <p>There are three ways to get pkgsrc. Either as a tar
                   1710:         file, via SUP, or via CVS. All three ways are described
                   1711:         here.</p>
                   1712: 
1.63    ! dillo    1713:         <div class="sect1" lang="en">
1.1       grant    1714:           <div class="titlepage">
                   1715:             <div>
                   1716:               <div>
                   1717:                 <h2 class="title" style="clear: both"><a name=
1.63    ! dillo    1718:                 "as-tar-file"></a>2.1.&nbsp;As tar file</h2>
1.1       grant    1719:               </div>
                   1720:             </div>
                   1721:           </div>
                   1722: 
                   1723:           <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
                   1724:           file from <a href=
1.11      ben      1725:           "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20      ben      1726:           target="_top">ftp.NetBSD.org</a> and unpack it into
1.45      wiz      1727:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   1728:           class="filename">/usr/pkgsrc</code>.</p>
1.1       grant    1729:         </div>
                   1730: 
1.63    ! dillo    1731:         <div class="sect1" lang="en">
1.1       grant    1732:           <div class="titlepage">
                   1733:             <div>
                   1734:               <div>
                   1735:                 <h2 class="title" style="clear: both"><a name=
1.63    ! dillo    1736:                 "via-sup"></a>2.2.&nbsp;Via SUP</h2>
1.1       grant    1737:               </div>
                   1738:             </div>
                   1739:           </div>
                   1740: 
                   1741:           <p>As an alternative to the tar file, you can get pkgsrc
                   1742:           via the Software Update Protocol, SUP. To do so, make
                   1743:           sure your supfile has a line</p>
                   1744:           <pre class="programlisting">
1.51      rillig   1745:     release=pkgsrc
1.1       grant    1746: </pre>
                   1747: 
1.45      wiz      1748:           <p>in it, see the examples in <code xmlns=
                   1749:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1750:           "filename">/usr/share/examples/supfiles</code>, and that
1.45      wiz      1751:           the <code xmlns=
                   1752:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1753:           "filename">/usr/pkgsrc</code> directory exists. Then,
                   1754:           simply run <span><strong class="command">sup -v
                   1755:           <em class="replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1       grant    1756:         </div>
                   1757: 
1.63    ! dillo    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.63    ! dillo    1763:                 "via-cvs"></a>2.3.&nbsp;Via CVS</h2>
1.1       grant    1764:               </div>
                   1765:             </div>
                   1766:           </div>
                   1767: 
                   1768:           <p>To get pkgsrc via CVS, make sure you have
                   1769:           &#8220;<span class="quote">cvs</span>&#8221; installed.
1.27      rillig   1770:           To do an initial (full) checkout of pkgsrc, do the
                   1771:           following steps:</p>
1.1       grant    1772:           <pre class="screen">
1.14      xtraeme  1773: <code class="prompt">%</code> <strong class=
                   1774: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
                   1775: <code class="prompt">%</code> <strong class=
                   1776: "userinput"><code>setenv CVS_RSH ssh</code></strong>
                   1777: <code class="prompt">%</code> <strong class=
                   1778: "userinput"><code>cd /usr</code></strong>
                   1779: <code class="prompt">%</code> <strong class=
                   1780: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
                   1781: </pre>
                   1782: 
1.45      wiz      1783:           <p>This will create the <code xmlns=
                   1784:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1785:           "filename">pkgsrc</code> directory in your <code xmlns=
                   1786:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1787:           "filename">/usr</code>, and all the package source will
1.45      wiz      1788:           be stored under <code xmlns=
                   1789:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1790:           "filename">/usr/pkgsrc</code>. To update pkgsrc after the
                   1791:           initial checkout, make sure you have <code class=
                   1792:           "varname">CVS_RSH</code> set as above, then do:</p>
1.1       grant    1793:           <pre class="screen">
1.14      xtraeme  1794: <code class="prompt">%</code> <strong class=
                   1795: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   1796: <code class="prompt">%</code> <strong class=
                   1797: "userinput"><code>cvs -q update -dP</code></strong>
1.1       grant    1798: </pre>
                   1799: 
                   1800:           <p>Please also note that it is possible to have multiple
                   1801:           copies of the pkgsrc hierarchy in use at any one time -
                   1802:           all work is done relatively within the pkgsrc tree.</p>
                   1803:         </div>
1.59      rillig   1804: 
1.63    ! dillo    1805:         <div class="sect1" lang="en">
1.59      rillig   1806:           <div class="titlepage">
                   1807:             <div>
                   1808:               <div>
                   1809:                 <h2 class="title" style="clear: both"><a name=
                   1810:                 "uptodate-cvs"></a>2.4.&nbsp;Keeping pkgsrc
                   1811:                 up-to-date via CVS</h2>
                   1812:               </div>
                   1813:             </div>
                   1814:           </div>
                   1815: 
                   1816:           <p>If your copy of pkgsrc contains a lot of <code xmlns=
                   1817:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1818:           "filename">CVS</code> directories, you can update it
                   1819:           using the <a href=
                   1820:           "http://netbsd.gw.com/cgi-bin/man-cgi?cvs+1+NetBSD-current">
                   1821:           <span class="citerefentry"><span class=
                   1822:           "refentrytitle">cvs</span>(1)</span></a> program. First,
                   1823:           <span><strong class="command">cd</strong></span> to the
                   1824:           top level directory of pkgsrc. Then run
                   1825:           <span><strong class="command">cvs -q update
                   1826:           -dP</strong></span>, and you're done.</p>
                   1827: 
                   1828:           <p>If that doesn't work and the file <code xmlns=
                   1829:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1830:           "filename">CVS/Root</code> contains the string
                   1831:           &#8220;<span class="quote">:pserver:</span>&#8221;, you
                   1832:           have to run <span><strong class="command">cvs
                   1833:           login</strong></span> once to get known to the NetBSD CVS
                   1834:           server. The <span><strong class=
                   1835:           "command">cvs</strong></span> utility will then ask you
                   1836:           for a password. Just enter &#8220;<span class=
                   1837:           "quote">anoncvs</span>&#8221;. Then try again to
                   1838:           update.</p>
                   1839:         </div>
1.1       grant    1840:       </div>
                   1841: 
1.63    ! dillo    1842:       <div class="chapter" lang="en">
1.1       grant    1843:         <div class="titlepage">
                   1844:           <div>
                   1845:             <div>
1.63    ! dillo    1846:               <h2 class="title"><a name=
1.1       grant    1847:               "platforms"></a>Chapter&nbsp;3.&nbsp;Using pkgsrc on
                   1848:               systems other than NetBSD</h2>
                   1849:             </div>
                   1850:           </div>
                   1851:         </div>
                   1852: 
                   1853:         <div class="toc">
                   1854:           <p><b>Table of Contents</b></p>
                   1855: 
                   1856:           <dl>
1.30      wiz      1857:             <dt><span class="sect1"><a href=
                   1858:             "#bootstrapping-pkgsrc">3.1. Bootstrapping
                   1859:             pkgsrc</a></span></dt>
1.1       grant    1860: 
1.30      wiz      1861:             <dt><span class="sect1"><a href=
1.47      reed     1862:             "#platform-specific-notes">3.2. Platform-specific
1.30      wiz      1863:             notes</a></span></dt>
1.1       grant    1864: 
                   1865:             <dd>
                   1866:               <dl>
1.30      wiz      1867:                 <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1       grant    1868:                 Darwin (Mac OS X)</a></span></dt>
                   1869: 
1.30      wiz      1870:                 <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1       grant    1871:                 FreeBSD</a></span></dt>
                   1872: 
1.30      wiz      1873:                 <dt><span class="sect2"><a href="#interix">3.2.3.
1.1       grant    1874:                 Interix</a></span></dt>
                   1875: 
1.30      wiz      1876:                 <dt><span class="sect2"><a href="#irix">3.2.4.
1.1       grant    1877:                 IRIX</a></span></dt>
                   1878: 
1.30      wiz      1879:                 <dt><span class="sect2"><a href="#linux">3.2.5.
1.22      tv       1880:                 Linux</a></span></dt>
                   1881: 
1.30      wiz      1882:                 <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1       grant    1883:                 OpenBSD</a></span></dt>
                   1884: 
1.30      wiz      1885:                 <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1       grant    1886:                 Solaris</a></span></dt>
                   1887:               </dl>
                   1888:             </dd>
                   1889:           </dl>
                   1890:         </div>
                   1891: 
1.63    ! dillo    1892:         <div class="sect1" lang="en">
1.1       grant    1893:           <div class="titlepage">
                   1894:             <div>
                   1895:               <div>
                   1896:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      1897:                 "bootstrapping-pkgsrc"></a>3.1.&nbsp;Bootstrapping
                   1898:                 pkgsrc</h2>
1.1       grant    1899:               </div>
                   1900:             </div>
                   1901:           </div>
                   1902: 
1.27      rillig   1903:           <p>For operating systems other than NetBSD, we provide a
1.1       grant    1904:           bootstrap kit to build the required tools to use pkgsrc
                   1905:           on your platform. Besides support for native NetBSD,
                   1906:           pkgsrc and the bootstrap kit have support for the
                   1907:           following operating systems:</p>
                   1908: 
                   1909:           <div class="itemizedlist">
                   1910:             <ul type="disc">
                   1911:               <li>
                   1912:                 <p>Darwin (Mac OS X)</p>
                   1913:               </li>
                   1914: 
                   1915:               <li>
1.16      grant    1916:                 <p>DragonFlyBSD</p>
                   1917:               </li>
                   1918: 
                   1919:               <li>
1.1       grant    1920:                 <p>FreeBSD</p>
                   1921:               </li>
                   1922: 
                   1923:               <li>
                   1924:                 <p>Interix (Windows 2000, XP, 2003)</p>
                   1925:               </li>
                   1926: 
                   1927:               <li>
                   1928:                 <p>IRIX</p>
                   1929:               </li>
                   1930: 
                   1931:               <li>
                   1932:                 <p>Linux</p>
                   1933:               </li>
                   1934: 
                   1935:               <li>
                   1936:                 <p>OpenBSD</p>
                   1937:               </li>
                   1938: 
                   1939:               <li>
                   1940:                 <p>Solaris</p>
                   1941:               </li>
1.16      grant    1942: 
                   1943:               <li>
                   1944:                 <p>Tru64 (Digital UNIX/OSF1)</p>
                   1945:               </li>
1.1       grant    1946:             </ul>
                   1947:           </div>
                   1948: 
                   1949:           <p>Support for other platforms is under development.</p>
                   1950: 
                   1951:           <p>Installing the bootstrap kit should be as simple
                   1952:           as:</p>
                   1953:           <pre class="screen">
1.14      xtraeme  1954: <code class="prompt">#</code> <strong class=
                   1955: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
                   1956: <code class="prompt">#</code> <strong class=
                   1957: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1958: <code class="prompt">#</code> <strong class=
                   1959: "userinput"><code>./bootstrap</code></strong>
1.1       grant    1960: </pre>
                   1961: 
                   1962:           <p>See <a href="#getting" title=
1.59      rillig   1963:           "Chapter&nbsp;2.&nbsp;Where to get pkgsrc and how to keep it up-to-date">
1.63    ! dillo    1964:           Chapter&nbsp;2, <i>Where to get pkgsrc and how to keep it
1.59      rillig   1965:           up-to-date</i></a> for other ways to get pkgsrc before
                   1966:           bootstrapping. The given <span><strong class=
                   1967:           "command">bootstrap</strong></span> command will use the
                   1968:           defaults of <code xmlns=
1.45      wiz      1969:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1970:           "filename">/usr/pkg</code> for the <span class=
                   1971:           "emphasis"><em>prefix</em></span> where programs will be
1.45      wiz      1972:           installed in, and <code xmlns=
                   1973:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1974:           "filename">/var/db/pkg</code> for the package database
1.27      rillig   1975:           directory where pkgsrc will do its internal bookkeeping.
1.1       grant    1976:           However, these can also be set using command-line
1.27      rillig   1977:           arguments.</p>
1.1       grant    1978: 
                   1979:           <p>Binary packages for the pkgsrc tools and an initial
                   1980:           set of packages is available for supported platforms. An
                   1981:           up-to-date list of these can be found on <a href=
                   1982:           "http://www.pkgsrc.org/" target=
1.63    ! dillo    1983:           "_top">www.pkgsrc.org</a>. Note that this only works for
        !          1984:           privileged builds that install into <code xmlns=
        !          1985:           "http://www.w3.org/TR/xhtml1/transitional" class=
        !          1986:           "filename">/usr/pkg</code>.</p>
1.47      reed     1987: 
                   1988:           <div class="note" style=
                   1989:           "margin-left: 0.5in; margin-right: 0.5in;">
                   1990:             <h3 class="title">Note</h3>
                   1991: 
                   1992:             <p>The bootstrap installs a <span><strong class=
                   1993:             "command">bmake</strong></span> tool. Use this
                   1994:             <span><strong class="command">bmake</strong></span>
                   1995:             when building via pkgsrc. For examples in this guide,
                   1996:             use <span><strong class="command">bmake</strong></span>
                   1997:             instead of &#8220;<span class=
                   1998:             "quote">make</span>&#8221;.</p>
                   1999:           </div>
1.1       grant    2000:         </div>
                   2001: 
1.63    ! dillo    2002:         <div class="sect1" lang="en">
1.1       grant    2003:           <div class="titlepage">
                   2004:             <div>
                   2005:               <div>
                   2006:                 <h2 class="title" style="clear: both"><a name=
1.47      reed     2007:                 "platform-specific-notes"></a>3.2.&nbsp;Platform-specific
                   2008:                 notes</h2>
1.1       grant    2009:               </div>
                   2010:             </div>
                   2011:           </div>
                   2012: 
                   2013:           <p>Here are some platform-specific notes you should be
                   2014:           aware of.</p>
                   2015: 
1.63    ! dillo    2016:           <div class="sect2" lang="en">
1.1       grant    2017:             <div class="titlepage">
                   2018:               <div>
                   2019:                 <div>
1.63    ! dillo    2020:                   <h3 class="title"><a name=
1.30      wiz      2021:                   "darwin"></a>3.2.1.&nbsp;Darwin (Mac OS X)</h3>
1.1       grant    2022:                 </div>
                   2023:               </div>
                   2024:             </div>
                   2025: 
                   2026:             <p>Darwin 5.x and 6.x are supported. There are two
                   2027:             methods of using pkgsrc on Mac OS X, by using a
                   2028:             <a href="#platform.osx-image" title=
                   2029:             "3.2.1.1.&nbsp;Using a disk image">disk image</a>, or a
                   2030:             <a href="#platform.osx-ufs" title=
                   2031:             "3.2.1.2.&nbsp;Using a UFS partition">UFS
                   2032:             partition</a>.</p>
                   2033: 
                   2034:             <p>Before you start, you will need to download and
                   2035:             install the Mac OS X Developer Tools from Apple's
                   2036:             Developer Connection. See <a href=
                   2037:             "http://developer.apple.com/macosx/" target=
                   2038:             "_top">http://developer.apple.com/macosx/</a> for
                   2039:             details. Also, make sure you install X11 for Mac OS X
                   2040:             and the X11 SDK from <a href=
                   2041:             "http://www.apple.com/macosx/x11/download/" target=
                   2042:             "_top">http://www.apple.com/macosx/x11/download/</a> if
                   2043:             you intend to build packages that use the X11 Window
                   2044:             System.</p>
                   2045: 
                   2046:             <p>If you already have a UFS partition, or have a spare
                   2047:             partition that you can format as UFS, it is recommended
                   2048:             to use that instead of the disk image. It'll be
                   2049:             somewhat faster and will mount automatically at boot
                   2050:             time, where you must manually mount a disk image.</p>
                   2051: 
                   2052:             <div class="note" style=
                   2053:             "margin-left: 0.5in; margin-right: 0.5in;">
                   2054:               <h3 class="title">Note</h3>
                   2055: 
                   2056:               <p>You cannot use a HFS+ file system for pkgsrc,
1.47      reed     2057:               because pkgsrc currently requires the file system to
1.1       grant    2058:               be case-sensitive, and HFS+ is not.</p>
                   2059:             </div>
                   2060: 
1.63    ! dillo    2061:             <div class="sect3" lang="en">
1.1       grant    2062:               <div class="titlepage">
                   2063:                 <div>
                   2064:                   <div>
1.63    ! dillo    2065:                     <h4 class="title"><a name=
        !          2066:                     "platform.osx-image"></a>3.2.1.1.&nbsp;Using a
        !          2067:                     disk image</h4>
1.1       grant    2068:                   </div>
                   2069:                 </div>
                   2070:               </div>
                   2071: 
                   2072:               <p>Create the disk image:</p>
                   2073:               <pre class="screen">
1.14      xtraeme  2074: <code class="prompt">#</code> <strong class=
                   2075: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   2076: <code class="prompt">#</code> <strong class=
                   2077: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
                   2078: <code class="prompt">#</code> <strong class=
                   2079: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
                   2080: <code class="prompt">#</code> <strong class=
                   2081: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1       grant    2082: </pre>
                   2083: 
                   2084:               <p>That's it!</p>
                   2085:             </div>
                   2086: 
1.63    ! dillo    2087:             <div class="sect3" lang="en">
1.1       grant    2088:               <div class="titlepage">
                   2089:                 <div>
                   2090:                   <div>
1.63    ! dillo    2091:                     <h4 class="title"><a name=
        !          2092:                     "platform.osx-ufs"></a>3.2.1.2.&nbsp;Using a
1.1       grant    2093:                     UFS partition</h4>
                   2094:                   </div>
                   2095:                 </div>
                   2096:               </div>
                   2097: 
1.45      wiz      2098:               <p>By default, <code xmlns=
                   2099:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   2100:               "filename">/usr</code> will be on your root file
                   2101:               system, normally HFS+. It is possible to use the
                   2102:               default <span class="emphasis"><em>prefix</em></span>
                   2103:               of <code xmlns=
                   2104:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   2105:               "filename">/usr/pkg</code> by symlinking <code xmlns=
                   2106:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2107:               "filename">/usr/pkg</code> to a directory on a UFS
                   2108:               file system. Obviously, another symlink is required
                   2109:               if you want to place the package database directory
                   2110:               outside the <span class=
                   2111:               "emphasis"><em>prefix</em></span>. e.g.</p>
1.1       grant    2112:               <pre class="screen">
1.14      xtraeme  2113: <code class="prompt">#</code> <strong class=
1.59      rillig   2114: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb</code></strong>
1.1       grant    2115: </pre>
                   2116: 
                   2117:               <p>If you created your partitions at the time of
                   2118:               installing Mac OS X and formatted the target
                   2119:               partition as UFS, it should automatically mount on
1.45      wiz      2120:               <code xmlns=
                   2121:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   2122:               "filename">/Volumes/&lt;volume name&gt;</code> when
                   2123:               the machine boots. If you are (re)formatting a
                   2124:               partition as UFS, you need to ensure that the
                   2125:               partition map correctly reflects &#8220;<span class=
                   2126:               "quote">Apple_UFS</span>&#8221; and not
                   2127:               &#8220;<span class=
1.1       grant    2128:               "quote">Apple_HFS</span>&#8221;.</p>
                   2129: 
                   2130:               <p>The problem is that none of the disk tools will
                   2131:               let you touch a disk that is booted from. You can
                   2132:               unmount the partition, but even if you newfs it, the
                   2133:               partition type will be incorrect and the automounter
                   2134:               won't mount it. It can be mounted manually, but it
                   2135:               won't appear in Finder.</p>
                   2136: 
                   2137:               <p>You'll need to boot off of the OS X Installation
                   2138:               (User) CD. When the Installation program starts, go
                   2139:               up to the menu and select Disk Utility. Now, you will
                   2140:               be able to select the partition you want to be UFS,
                   2141:               and Format it Apple UFS. Quit the Disk Utility, quit
                   2142:               the installer which will reboot your machine. The new
                   2143:               UFS file system will appear in Finder.</p>
                   2144: 
                   2145:               <p>Be aware that the permissions on the new file
                   2146:               system will be writable by root only.</p>
                   2147: 
                   2148:               <p>This note is as of 10.2 (Jaguar) and applies to
                   2149:               earlier versions. Hopefully Apple will fix Disk
                   2150:               Utility in 10.3 (Panther).</p>
                   2151:             </div>
                   2152:           </div>
                   2153: 
1.63    ! dillo    2154:           <div class="sect2" lang="en">
1.1       grant    2155:             <div class="titlepage">
                   2156:               <div>
                   2157:                 <div>
1.63    ! dillo    2158:                   <h3 class="title"><a name=
1.30      wiz      2159:                   "freebsd"></a>3.2.2.&nbsp;FreeBSD</h3>
1.1       grant    2160:                 </div>
                   2161:               </div>
                   2162:             </div>
                   2163: 
                   2164:             <p>FreeBSD 4.7 and 5.0 have been tested and are
                   2165:             supported, other versions may work.</p>
                   2166: 
                   2167:             <p>Care should be taken so that the tools that this kit
                   2168:             installs do not conflict with the FreeBSD userland
                   2169:             tools. There are several steps:</p>
                   2170: 
                   2171:             <div class="orderedlist">
                   2172:               <ol type="1">
                   2173:                 <li>
                   2174:                   <p>FreeBSD stores its ports pkg database in
1.45      wiz      2175:                   <code xmlns=
                   2176:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   2177:                   "filename">/var/db/pkg</code>. It is therefore
                   2178:                   recommended that you choose a different location
                   2179:                   (e.g. <code xmlns=
                   2180:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2181:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2182:                   --pkgdbdir option to the bootstrap script.</p>
                   2183:                 </li>
                   2184: 
                   2185:                 <li>
                   2186:                   <p>If you do not intend to use the FreeBSD ports
                   2187:                   tools, it's probably a good idea to move them out
                   2188:                   of the way to avoid confusion, e.g.</p>
                   2189:                   <pre class="screen">
1.14      xtraeme  2190: <code class="prompt">#</code> <strong class=
                   2191: "userinput"><code>cd /usr/sbin</code></strong>
                   2192: <code class="prompt">#</code> <strong class=
                   2193: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2194: <code class="prompt">#</code> <strong class=
                   2195: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2196: <code class="prompt">#</code> <strong class=
                   2197: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2198: <code class="prompt">#</code> <strong class=
                   2199: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2200: </pre>
                   2201:                 </li>
                   2202: 
                   2203:                 <li>
1.45      wiz      2204:                   <p>An example <code xmlns=
                   2205:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2206:                   "filename">/etc/mk.conf</code> file will be
1.45      wiz      2207:                   placed in <code xmlns=
                   2208:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2209:                   "filename">/etc/mk.conf.example</code> file when
                   2210:                   you use the bootstrap script.</p>
1.1       grant    2211:                 </li>
                   2212:               </ol>
                   2213:             </div>
                   2214:           </div>
                   2215: 
1.63    ! dillo    2216:           <div class="sect2" lang="en">
1.1       grant    2217:             <div class="titlepage">
                   2218:               <div>
                   2219:                 <div>
1.63    ! dillo    2220:                   <h3 class="title"><a name=
1.30      wiz      2221:                   "interix"></a>3.2.3.&nbsp;Interix</h3>
1.1       grant    2222:                 </div>
                   2223:               </div>
                   2224:             </div>
                   2225: 
1.47      reed     2226:             <p>Interix is a POSIX-compatible subsystem for the
1.1       grant    2227:             Windows NT kernel, providing a Unix-like environment
                   2228:             with a tighter kernel integration than available with
                   2229:             Cygwin. It is part of the Windows Services for Unix
                   2230:             package, available for free for any licensed copy of
1.22      tv       2231:             Windows 2000, XP (not including XP Home), or 2003. SFU
                   2232:             can be downloaded from <a href=
                   2233:             "http://www.microsoft.com/windows/sfu/" target=
1.1       grant    2234:             "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
                   2235: 
                   2236:             <p>Services for Unix 3.5, current as of this writing,
                   2237:             has been tested. 3.0 or 3.1 may work, but are not
                   2238:             officially supported. (The main difference in 3.0/3.1
                   2239:             is lack of pthreads.)</p>
                   2240: 
1.63    ! dillo    2241:             <div class="sect3" lang="en">
1.1       grant    2242:               <div class="titlepage">
                   2243:                 <div>
                   2244:                   <div>
                   2245:                     <h4 class="title"><a name=
                   2246:                     "platform.interix-sfu-install"></a>3.2.3.1.&nbsp;When
1.2       hubertf  2247:                     installing Interix/SFU</h4>
1.1       grant    2248:                   </div>
                   2249:                 </div>
                   2250:               </div>
                   2251: 
                   2252:               <p>At an absolute minimum, the following packages
                   2253:               must be installed from the Windows Services for Unix
                   2254:               3.5 distribution in order to use pkgsrc:</p>
                   2255: 
                   2256:               <div class="itemizedlist">
                   2257:                 <ul type="disc">
                   2258:                   <li>
                   2259:                     <p>Utilities -&gt; Base Utilities</p>
                   2260:                   </li>
                   2261: 
                   2262:                   <li>
                   2263:                     <p>Interix GNU Components -&gt; (all)</p>
                   2264:                   </li>
                   2265: 
                   2266:                   <li>
                   2267:                     <p>Remote Connectivity</p>
                   2268:                   </li>
                   2269: 
                   2270:                   <li>
                   2271:                     <p>Interix SDK</p>
                   2272:                   </li>
                   2273:                 </ul>
                   2274:               </div>
                   2275: 
                   2276:               <p>When using pkgsrc on Interix, DO NOT install the
                   2277:               Utilities subcomponent "UNIX Perl". That is Perl 5.6
                   2278:               without shared module support, installed to
                   2279:               /usr/local, and will only cause confusion. Instead,
                   2280:               install Perl 5.8 from pkgsrc (or from a binary
                   2281:               package).</p>
                   2282: 
                   2283:               <p>The Remote Connectivity subcomponent "Windows
                   2284:               Remote Shell Service" does not need to be installed,
                   2285:               but Remote Connectivity itself should be installed in
                   2286:               order to have a working inetd.</p>
                   2287: 
1.52      tv       2288:               <p>During installation you may be asked whether to
                   2289:               enable setuid behavior for Interix programs, and
                   2290:               whether to make pathnames default to case-sensitive.
                   2291:               Setuid should be enabled, and case-sensitivity MUST
                   2292:               be enabled. (Without case-sensitivity, a large number
                   2293:               of packages including perl will not build.)</p>
                   2294: 
                   2295:               <p>NOTE: Newer Windows service packs change the way
                   2296:               binary execution works (via the Data Execution
                   2297:               Prevention feature). In order to use pkgsrc and other
                   2298:               gcc-compiled binaries reliably, a hotfix containing
                   2299:               POSIX.EXE, PSXDLL.DLL, PSXRUN.EXE, and PSXSS.EXE
                   2300:               (899522 or newer) must be installed. Hotfixes are
                   2301:               available from Microsoft through a support contract;
                   2302:               however, a NetBSD developer has made most Interix
                   2303:               hotfixes available for personal use from <a href=
                   2304:               "http://www.duh.org/interix/hotfixes.php" target=
                   2305:               "_top">http://www.duh.org/interix/hotfixes.php</a>.</p>
1.1       grant    2306:             </div>
                   2307: 
1.63    ! dillo    2308:             <div class="sect3" lang="en">
1.1       grant    2309:               <div class="titlepage">
                   2310:                 <div>
                   2311:                   <div>
                   2312:                     <h4 class="title"><a name=
                   2313:                     "platform.interix-sfu-postinstall"></a>3.2.3.2.&nbsp;What
                   2314:                     to do if Interix/SFU is already installed</h4>
                   2315:                   </div>
                   2316:                 </div>
                   2317:               </div>
                   2318: 
                   2319:               <p>If SFU is already installed and you wish to alter
                   2320:               these settings to work with pkgsrc, note the
                   2321:               following things.</p>
                   2322: 
                   2323:               <div class="itemizedlist">
                   2324:                 <ul type="disc">
                   2325:                   <li>
                   2326:                     <p>To uninstall UNIX Perl, use Add/Remove
                   2327:                     Programs, select Microsoft Windows Services for
                   2328:                     UNIX, then click Change. In the installer,
                   2329:                     choose Add or Remove, then uncheck
                   2330:                     Utilities-&gt;UNIX Perl.</p>
                   2331:                   </li>
                   2332: 
                   2333:                   <li>
1.47      reed     2334:                     <p>To enable case-sensitivity for the file
                   2335:                     system, run REGEDIT.EXE, and change the
1.1       grant    2336:                     following registry key:</p>
                   2337: 
                   2338:                     <p>
                   2339:                     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
                   2340:                     Manager\kernel</p>
                   2341: 
                   2342:                     <p>Set the DWORD value "obcaseinsensitive" to
                   2343:                     0; then reboot.</p>
                   2344:                   </li>
                   2345: 
                   2346:                   <li>
                   2347:                     <p>To enable setuid binaries (optional), run
                   2348:                     REGEDIT.EXE, and change the following registry
                   2349:                     key:</p>
                   2350: 
                   2351:                     <p>
                   2352:                     HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
                   2353:                     for UNIX</p>
                   2354: 
                   2355:                     <p>Set the DWORD value "EnableSetuidBinaries"
                   2356:                     to 1; then reboot.</p>
                   2357:                   </li>
                   2358:                 </ul>
                   2359:               </div>
                   2360:             </div>
                   2361: 
1.63    ! dillo    2362:             <div class="sect3" lang="en">
1.1       grant    2363:               <div class="titlepage">
                   2364:                 <div>
                   2365:                   <div>
                   2366:                     <h4 class="title"><a name=
                   2367:                     "platform.interix-notes"></a>3.2.3.3.&nbsp;Important
                   2368:                     notes for using pkgsrc</h4>
                   2369:                   </div>
                   2370:                 </div>
                   2371:               </div>
                   2372: 
1.52      tv       2373:               <p>The package manager (either the pkgsrc "su" user,
1.1       grant    2374:               or the user running "pkg_add") must be a member of
                   2375:               the local Administrators group. Such a user must also
                   2376:               be used to run the bootstrap. This is slightly
                   2377:               relaxed from the normal pkgsrc requirement of
                   2378:               "root".</p>
                   2379: 
                   2380:               <p>The package manager should use a umask of 002.
                   2381:               "make install" will automatically complain if this is
                   2382:               not the case. This ensures that directories written
                   2383:               in /var/db/pkg are Administrators-group
                   2384:               writeable.</p>
                   2385: 
                   2386:               <p>The popular Interix binary packages from
                   2387:               http://www.interopsystems.com/ use an older version
                   2388:               of pkgsrc's pkg_* tools. Ideally, these should NOT be
                   2389:               used in conjunction with pkgsrc. If you choose to use
                   2390:               them at the same time as the pkgsrc packages, ensure
                   2391:               that you use the proper pkg_* tools for each type of
                   2392:               binary package.</p>
1.22      tv       2393: 
                   2394:               <p>The TERM setting used for DOS-type console windows
                   2395:               (including those invoked by the csh and ksh startup
                   2396:               shortcuts) is "interix". Most systems don't have a
                   2397:               termcap/terminfo entry for it, but the following
                   2398:               .termcap entry provides adequate emulation in most
                   2399:               cases:</p>
                   2400:               <pre class="programlisting">
1.51      rillig   2401:     interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
1.22      tv       2402: </pre>
1.1       grant    2403:             </div>
1.52      tv       2404: 
1.63    ! dillo    2405:             <div class="sect3" lang="en">
1.52      tv       2406:               <div class="titlepage">
                   2407:                 <div>
                   2408:                   <div>
                   2409:                     <h4 class="title"><a name=
                   2410:                     "platform.interix-limits"></a>3.2.3.4.&nbsp;Limitations
                   2411:                     of the Interix platform</h4>
                   2412:                   </div>
                   2413:                 </div>
                   2414:               </div>
                   2415: 
                   2416:               <p>Though Interix suffices as a familiar and flexible
                   2417:               substitute for a full Unix-like platform, it has some
                   2418:               drawbacks that should be noted for those desiring to
                   2419:               make the most of Interix.</p>
                   2420: 
                   2421:               <div class="itemizedlist">
                   2422:                 <ul type="disc">
                   2423:                   <li>
1.54      tv       2424:                     <p><span class=
1.57      minskim  2425:                     "strong"><strong>X11:</strong></span></p>
1.52      tv       2426: 
                   2427:                     <p>Interix comes with the standard set of X11R6
1.57      minskim  2428:                     client libraries, and can run X11 based
1.52      tv       2429:                     applications, but it does <span class=
                   2430:                     "emphasis"><em>not</em></span> come with an X
                   2431:                     server. Some options are <a href=
                   2432:                     "http://www.starnet.com/products/xwin32/"
                   2433:                     target="_top">StarNet X-Win32</a>, <a href=
                   2434:                     "http://connectivity.hummingbird.com/products/nc/exceed/"
1.57      minskim  2435:                     target="_top">Hummingbird Exceed</a> (available
                   2436:                     in a trimmed version for Interix from Interop
                   2437:                     Systems as the <a href=
                   2438:                     "http://www.interopsystems.com/InteropXserver.htm"
                   2439:                     target="_top">Interop X Server</a>), and the
                   2440:                     free X11 server included with <a href=
1.52      tv       2441:                     "http://x.cygwin.com/" target=
                   2442:                     "_top">Cygwin</a>.</p>
                   2443: 
                   2444:                     <p>Also, StarNet Communications has graciously
                   2445:                     provided a free version of their X-Win32
                   2446:                     product that accepts connections only from
                   2447:                     localhost: <a href=
                   2448:                     "http://www.starnet.com/xwin32LX/get_xwin32LX.htm"
                   2449:                     target="_top">X-Win32 LX</a>, recommended by
                   2450:                     the maintainer of Interix pkgsrc support.</p>
                   2451:                   </li>
                   2452: 
                   2453:                   <li>
1.57      minskim  2454:                     <p><span class="strong"><strong>X11
1.54      tv       2455:                     acceleration:</strong></span></p>
1.52      tv       2456: 
                   2457:                     <p>Because Interix runs in a completely
                   2458:                     different NT subsystem from Win32 applications,
                   2459:                     it does not currently support various X11
                   2460:                     protocol extensions for acceleration (such as
                   2461:                     MIT-SHM or DGA). Most interactive applications
                   2462:                     to a local X server will run reasonably fast,
                   2463:                     but full motion video and other graphics
                   2464:                     intensive applications may require a
                   2465:                     faster-than-expected CPU.</p>
                   2466:                   </li>
                   2467: 
                   2468:                   <li>
1.54      tv       2469:                     <p><span class=
                   2470:                     "strong"><strong>Audio:</strong></span></p>
1.52      tv       2471: 
                   2472:                     <p>Interix has no native support for audio
1.53      tv       2473:                     output. For audio support, pkgsrc uses the
                   2474:                     <span><strong class=
1.52      tv       2475:                     "command">esound</strong></span> client/server
                   2476:                     audio system on Interix. Unlike on most
                   2477:                     platforms, the <a xmlns=
                   2478:                     "http://www.w3.org/TR/xhtml1/transitional"
                   2479:                     href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/esound/README.html"
                   2480:                     target="_top"><code xmlns="" class=
                   2481:                     "filename">audio/esound</code></a> package does
                   2482:                     <span class="emphasis"><em>not</em></span>
                   2483:                     contain the <span><strong class=
1.53      tv       2484:                     "command">esd</strong></span> server component.
                   2485:                     To output audio via an Interix host, the
                   2486:                     <a xmlns=
1.52      tv       2487:                     "http://www.w3.org/TR/xhtml1/transitional"
                   2488:                     href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/cygwin_esound/README.html"
                   2489:                     target="_top"><code xmlns="" class=
                   2490:                     "filename">emulators/cygwin_esound</code></a>
                   2491:                     package must also be installed.</p>
                   2492:                   </li>
                   2493: 
                   2494:                   <li>
1.54      tv       2495:                     <p><span class="strong"><strong>CD/DVDs, USB,
                   2496:                     and SCSI:</strong></span></p>
1.52      tv       2497: 
                   2498:                     <p>Direct device access is not currently
                   2499:                     supported in Interix, so it is not currently
                   2500:                     possible to access CD/DVD drives, USB devices,
                   2501:                     or SCSI devices through non-filesystem means.
                   2502:                     Among other things, this makes it impossible to
                   2503:                     use Interix directly for CD/DVD burning.</p>
                   2504:                   </li>
                   2505: 
                   2506:                   <li>
1.54      tv       2507:                     <p><span class="strong"><strong>Tape
                   2508:                     drives:</strong></span></p>
1.52      tv       2509: 
                   2510:                     <p>Due to the same limitations as for CD-ROMs
                   2511:                     and SCSI devices, tape drives are also not
                   2512:                     directly accessible in Interix. However,
                   2513:                     support is in work to make tape drive access
                   2514:                     possible by using Cygwin as a bridge (similarly
                   2515:                     to audio bridged via Cygwin's esound
                   2516:                     server).</p>
                   2517:                   </li>
                   2518:                 </ul>
                   2519:               </div>
                   2520:             </div>
                   2521: 
1.63    ! dillo    2522:             <div class="sect3" lang="en">
1.52      tv       2523:               <div class="titlepage">
                   2524:                 <div>
                   2525:                   <div>
                   2526:                     <h4 class="title"><a name=
                   2527:                     "platform.interix-knownissues"></a>3.2.3.5.&nbsp;Known
                   2528:                     issues for pkgsrc on Interix</h4>
                   2529:                   </div>
                   2530:                 </div>
                   2531:               </div>
                   2532: 
                   2533:               <p>It is not necessary, in general, to have a "root"
                   2534:               user on the Windows system; any member of the local
                   2535:               Administrators group will suffice. However, some
                   2536:               packages currently assume that the user named "root"
                   2537:               is the privileged user. To accommodate these, you may
                   2538:               create such a user; make sure it is in the local
                   2539:               group Administrators (or your language
                   2540:               equivalent).</p>
                   2541: 
                   2542:               <p>"pkg_add" creates directories of mode 0755, not
                   2543:               0775, in $PKG_DBDIR. For the time being, install
                   2544:               packages as the local Administrator (or your language
                   2545:               equivalent), or run the following command after
                   2546:               installing a package to work around the issue:</p>
                   2547:               <pre class="screen">
                   2548: <code class="prompt">#</code> <strong class=
                   2549: "userinput"><code>chmod -R g+w $PKG_DBDIR</code></strong>
                   2550: </pre>
                   2551:             </div>
1.1       grant    2552:           </div>
                   2553: 
1.63    ! dillo    2554:           <div class="sect2" lang="en">
1.1       grant    2555:             <div class="titlepage">
                   2556:               <div>
                   2557:                 <div>
1.63    ! dillo    2558:                   <h3 class="title"><a name=
1.30      wiz      2559:                   "irix"></a>3.2.4.&nbsp;IRIX</h3>
1.1       grant    2560:                 </div>
                   2561:               </div>
                   2562:             </div>
                   2563: 
                   2564:             <p>You will need a working C compiler, either gcc or
                   2565:             SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14      xtraeme  2566:             the <code class="varname">CC</code> environment
                   2567:             variable according to your preference. If you do not
                   2568:             have a license for the MIPSpro compiler suite, you can
1.1       grant    2569:             download a gcc tardist file from <a href=
                   2570:             "http://freeware.sgi.com/" target=
                   2571:             "_top">http://freeware.sgi.com/</a>.</p>
                   2572: 
                   2573:             <p>Please note that you will need IRIX 6.5.17 or
                   2574:             higher, as this is the earliest version of IRIX
1.24      wiz      2575:             providing support for <a href=
                   2576:             "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
                   2577:             <span class="citerefentry"><span class=
                   2578:             "refentrytitle">if_indextoname</span>(3)</span></a>,
                   2579:             <a href=
                   2580:             "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
                   2581:             <span class="citerefentry"><span class=
                   2582:             "refentrytitle">if_nametoindex</span>(3)</span></a>,
                   2583:             etc.</p>
1.1       grant    2584: 
1.27      rillig   2585:             <p>At this point in time, pkgsrc only supports one ABI
                   2586:             at a time. That is, you can not switch between the old
                   2587:             32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
                   2588:             you start out using "abi=n32", that's what all your
                   2589:             packages will be built with.</p>
1.1       grant    2590: 
                   2591:             <p>Therefore, please make sure that you have no
1.14      xtraeme  2592:             conflicting <code class="varname">CFLAGS</code> in your
1.45      wiz      2593:             environment or the <code xmlns=
                   2594:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2595:             "filename">/etc/mk.conf</code>. Particularly, make sure
1.1       grant    2596:             that you do not try to link n32 object files with lib64
1.45      wiz      2597:             or vice versa. Check your <code xmlns=
                   2598:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2599:             "filename">/etc/compiler.defaults</code>!</p>
1.1       grant    2600: 
                   2601:             <p>If you have the actual pkgsrc tree mounted via NFS
                   2602:             from a different host, please make sure to set
1.14      xtraeme  2603:             <code class="varname">WRKOBJDIR</code> to a local
1.1       grant    2604:             directory, as it appears that IRIX linker occasionally
1.47      reed     2605:             runs into issues when trying to link over a
                   2606:             network-mounted file system.</p>
1.1       grant    2607: 
                   2608:             <p>The bootstrapping process should set all the right
                   2609:             options for programs such as imake(1), but you may want
                   2610:             to set some options depending on your local setup.
1.45      wiz      2611:             Please see <code xmlns=
                   2612:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2613:             "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27      rillig   2614:             course, your compiler's man pages for details.</p>
1.22      tv       2615: 
                   2616:             <p>If you are using SGI's MIPSPro compiler, please
                   2617:             set</p>
                   2618:             <pre class="programlisting">
1.51      rillig   2619:     PKGSRC_COMPILER=        mipspro
1.22      tv       2620: </pre>
                   2621: 
1.45      wiz      2622:             <p>in <code xmlns=
                   2623:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   2624:             "filename">/etc/mk.conf</code>. Otherwise, pkgsrc will
                   2625:             assume you are using gcc and may end up passing invalid
                   2626:             flags to the compiler. Note that bootstrap should
                   2627:             create an appropriate <code xmlns=
                   2628:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2629:             "filename">mk.conf.example</code> by default.</p>
                   2630: 
                   2631:             <p>If you have both the MIPSPro compiler chain
                   2632:             installed as well as gcc, but want to make sure that
                   2633:             MIPRPro is used, please set your <code class=
                   2634:             "varname">PATH</code> to <span class=
                   2635:             "emphasis"><em>not</em></span> include the location of
1.45      wiz      2636:             gcc (often <code xmlns=
                   2637:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2638:             "filename">/usr/freeware/bin</code>), and (important)
                   2639:             pass the '--preserve-path' flag.</p>
1.1       grant    2640:           </div>
                   2641: 
1.63    ! dillo    2642:           <div class="sect2" lang="en">
1.1       grant    2643:             <div class="titlepage">
                   2644:               <div>
                   2645:                 <div>
1.63    ! dillo    2646:                   <h3 class="title"><a name=
1.30      wiz      2647:                   "linux"></a>3.2.5.&nbsp;Linux</h3>
1.22      tv       2648:                 </div>
                   2649:               </div>
                   2650:             </div>
                   2651: 
                   2652:             <p>Some versions of Linux (for example Debian
                   2653:             GNU/Linux) need either libtermcap or libcurses
                   2654:             (libncurses). Installing the distributions
                   2655:             libncurses-dev package (or equivalent) should fix the
                   2656:             problem.</p>
                   2657: 
                   2658:             <p>pkgsrc supports both gcc (GNU Compiler Collection)
                   2659:             and icc (Intel C++ Compiler). gcc is the default. icc
                   2660:             8.0 and 8.1 on i386 have been tested.</p>
                   2661: 
                   2662:             <p>To bootstrap using icc, assuming the default icc
                   2663:             installation directory:</p>
                   2664:             <pre class="programlisting">
1.51      rillig   2665:     env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
                   2666:             ac_cv___attribute__=yes ./bootstrap
1.22      tv       2667: </pre>
                   2668: 
                   2669:             <div class="note" style=
                   2670:             "margin-left: 0.5in; margin-right: 0.5in;">
                   2671:               <h3 class="title">Note</h3>
                   2672: 
                   2673:               <p>icc 8.1 needs the `-i-static' argument instead of
                   2674:               -static-libcxa.</p>
                   2675:             </div>
                   2676: 
                   2677:             <p>icc supports __attribute__, but the GNU configure
                   2678:             test uses a nested function, which icc does not
                   2679:             support. #undef'ing __attribute__ has the unfortunate
                   2680:             side-effect of breaking many of the Linux header files,
                   2681:             which cannot be compiled properly without
                   2682:             __attribute__. The test must be overridden so that
                   2683:             __attribute__ is assumed supported by the compiler.</p>
                   2684: 
                   2685:             <p>After bootstrapping, you should set <code class=
1.45      wiz      2686:             "varname">PKGSRC_COMPILER</code> in <code xmlns=
                   2687:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2688:             "filename">/etc/mk.conf</code>:</p>
                   2689:             <pre class="programlisting">
1.51      rillig   2690:     PKGSRC_COMPILER=        icc
1.22      tv       2691: </pre>
                   2692: 
                   2693:             <p>The default installation directory for icc is
1.45      wiz      2694:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2695:             class="filename">/opt/intel_cc_80</code>, which is also
                   2696:             the pkgsrc default. If you have installed it into a
                   2697:             different directory, set <code class=
                   2698:             "varname">ICCBASE</code> in <code xmlns=
                   2699:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2700:             "filename">/etc/mk.conf</code>:</p>
                   2701:             <pre class="programlisting">
1.51      rillig   2702:     ICCBASE=                /opt/icc
1.22      tv       2703: </pre>
                   2704: 
                   2705:             <p>pkgsrc uses the static linking method of the runtime
                   2706:             libraries provided by icc, so binaries can be run on
                   2707:             other systems which do not have the shared libraries
                   2708:             installed.</p>
                   2709: 
                   2710:             <p>Libtool, however, extracts a list of libraries from
1.24      wiz      2711:             the <a href=
                   2712:             "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   2713:             <span class="citerefentry"><span class=
                   2714:             "refentrytitle">ld</span>(1)</span></a> command run
                   2715:             when linking a C++ shared library and records it,
                   2716:             throwing away the -Bstatic and -Bdynamic options
                   2717:             interspersed between the libraries. This means that
                   2718:             libtool-linked C++ shared libraries will have a runtime
                   2719:             dependency on the icc libraries until this is fixed in
                   2720:             libtool.</p>
1.22      tv       2721:           </div>
                   2722: 
1.63    ! dillo    2723:           <div class="sect2" lang="en">
1.22      tv       2724:             <div class="titlepage">
                   2725:               <div>
                   2726:                 <div>
1.63    ! dillo    2727:                   <h3 class="title"><a name=
1.30      wiz      2728:                   "openbsd"></a>3.2.6.&nbsp;OpenBSD</h3>
1.1       grant    2729:                 </div>
                   2730:               </div>
                   2731:             </div>
                   2732: 
                   2733:             <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
                   2734: 
                   2735:             <p>Care should be taken so that the tools that this kit
                   2736:             installs do not conflict with the OpenBSD userland
                   2737:             tools. There are several steps:</p>
                   2738: 
                   2739:             <div class="orderedlist">
                   2740:               <ol type="1">
                   2741:                 <li>
                   2742:                   <p>OpenBSD stores its ports pkg database in
1.45      wiz      2743:                   <code xmlns=
                   2744:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   2745:                   "filename">/var/db/pkg</code>. It is therefore
                   2746:                   recommended that you choose a different location
                   2747:                   (e.g. <code xmlns=
                   2748:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2749:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2750:                   --pkgdbdir option to the bootstrap script.</p>
                   2751:                 </li>
                   2752: 
                   2753:                 <li>
                   2754:                   <p>If you do not intend to use the OpenBSD ports
                   2755:                   tools, it's probably a good idea to move them out
                   2756:                   of the way to avoid confusion, e.g.</p>
                   2757:                   <pre class="screen">
1.14      xtraeme  2758: <code class="prompt">#</code> <strong class=
                   2759: "userinput"><code>cd /usr/sbin</code></strong>
                   2760: <code class="prompt">#</code> <strong class=
                   2761: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2762: <code class="prompt">#</code> <strong class=
                   2763: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2764: <code class="prompt">#</code> <strong class=
                   2765: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2766: <code class="prompt">#</code> <strong class=
                   2767: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2768: </pre>
                   2769:                 </li>
                   2770: 
                   2771:                 <li>
1.45      wiz      2772:                   <p>An example <code xmlns=
                   2773:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2774:                   "filename">/etc/mk.conf</code> file will be
1.45      wiz      2775:                   placed in <code xmlns=
                   2776:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2777:                   "filename">/etc/mk.conf.example</code> file when
                   2778:                   you use the bootstrap script. OpenBSD's make
1.45      wiz      2779:                   program uses <code xmlns=
                   2780:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2781:                   "filename">/etc/mk.conf</code> as well. You can
1.47      reed     2782:                   work around this by enclosing all the
                   2783:                   pkgsrc-specific parts of the file with:</p>
1.1       grant    2784:                   <pre class="programlisting">
1.51      rillig   2785:     .ifdef BSD_PKG_MK
                   2786:     # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
                   2787:     .else
                   2788:     # OpenBSD stuff
                   2789:     .endif
1.1       grant    2790: </pre>
                   2791:                 </li>
                   2792:               </ol>
                   2793:             </div>
                   2794:           </div>
                   2795: 
1.63    ! dillo    2796:           <div class="sect2" lang="en">
1.1       grant    2797:             <div class="titlepage">
                   2798:               <div>
                   2799:                 <div>
1.63    ! dillo    2800:                   <h3 class="title"><a name=
1.30      wiz      2801:                   "solaris"></a>3.2.7.&nbsp;Solaris</h3>
1.1       grant    2802:                 </div>
                   2803:               </div>
                   2804:             </div>
                   2805: 
                   2806:             <p>Solaris 2.6 through 9 are supported on both x86 and
                   2807:             sparc. You will need a working C compiler. Both gcc
                   2808:             2.95.3 and Sun WorkShop 5 have been tested.</p>
                   2809: 
                   2810:             <p>The following packages are required on Solaris 8 for
                   2811:             the bootstrap process and to build packages.</p>
                   2812: 
                   2813:             <div class="itemizedlist">
                   2814:               <ul type="disc">
                   2815:                 <li>
                   2816:                   <p>SUNWsprot</p>
                   2817:                 </li>
                   2818: 
                   2819:                 <li>
                   2820:                   <p>SUNWarc</p>
                   2821:                 </li>
                   2822: 
                   2823:                 <li>
                   2824:                   <p>SUNWbtool</p>
                   2825:                 </li>
                   2826: 
                   2827:                 <li>
                   2828:                   <p>SUNWtoo</p>
                   2829:                 </li>
                   2830: 
                   2831:                 <li>
                   2832:                   <p>SUNWlibm</p>
                   2833:                 </li>
                   2834:               </ul>
                   2835:             </div>
                   2836: 
                   2837:             <p>Please note the use of GNU binutils on Solaris is
                   2838:             <span class="emphasis"><em>not</em></span>
                   2839:             supported.</p>
                   2840: 
1.63    ! dillo    2841:             <div class="sect3" lang="en">
1.1       grant    2842:               <div class="titlepage">
                   2843:                 <div>
                   2844:                   <div>
1.63    ! dillo    2845:                     <h4 class="title"><a name=
        !          2846:                     "solaris-gcc-note"></a>3.2.7.1.&nbsp;If you are
        !          2847:                     using gcc</h4>
1.1       grant    2848:                   </div>
                   2849:                 </div>
                   2850:               </div>
                   2851: 
                   2852:               <p>It makes life much simpler if you only use the
                   2853:               same gcc consistently for building all packages.</p>
                   2854: 
                   2855:               <p>It is recommended that an external gcc be used
                   2856:               only for bootstrapping, then either build gcc from
                   2857:               <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2858:               href=
                   2859:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.45      wiz      2860:               target="_top"><code xmlns="" class=
                   2861:               "filename">lang/gcc</code></a> or install a binary
                   2862:               gcc package, then remove gcc used during
1.20      ben      2863:               bootstrapping.</p>
1.1       grant    2864: 
                   2865:               <p>Binary packages of gcc can be found through
                   2866:               <a href=
                   2867:               "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20      ben      2868:               target=
                   2869:               "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1       grant    2870:             </div>
                   2871: 
1.63    ! dillo    2872:             <div class="sect3" lang="en">
1.1       grant    2873:               <div class="titlepage">
                   2874:                 <div>
                   2875:                   <div>
1.30      wiz      2876:                     <h4 class="title"><a name=
                   2877:                     "solaris-sun-workshop-note"></a>3.2.7.2.&nbsp;If
                   2878:                     you are using Sun WorkShop</h4>
1.1       grant    2879:                   </div>
                   2880:                 </div>
                   2881:               </div>
                   2882: 
                   2883:               <p>You will need at least the following packages
                   2884:               installed (from WorkShop 5.0)</p>
                   2885: 
                   2886:               <div class="itemizedlist">
                   2887:                 <ul type="disc">
                   2888:                   <li>
                   2889:                     <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
                   2890:                   </li>
                   2891: 
                   2892:                   <li>
                   2893:                     <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
                   2894:                   </li>
                   2895: 
                   2896:                   <li>
                   2897:                     <p>SPROild - Sun WorkShop Incremental
                   2898:                     Linker</p>
                   2899:                   </li>
                   2900: 
                   2901:                   <li>
                   2902:                     <p>SPROlang - Sun WorkShop Compilers common
                   2903:                     components</p>
                   2904:                   </li>
                   2905:                 </ul>
                   2906:               </div>
                   2907: 
1.14      xtraeme  2908:               <p>You should set <code class="varname">CC</code>,
                   2909:               <code class="varname">CXX</code> and optionally,
1.45      wiz      2910:               <code class="varname">CPP</code> in <code xmlns=
                   2911:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     2912:               "filename">/etc/mk.conf</code>, e.g.:</p>
1.1       grant    2913:               <pre class="programlisting">
1.51      rillig   2914:     CC=     cc
                   2915:     CXX=    CC
                   2916:     CPP=    /usr/ccs/lib/cpp
1.1       grant    2917: </pre>
                   2918: 
                   2919:               <p>You may also want to build 64-bit binaries,
1.47      reed     2920:               e.g.:</p>
1.1       grant    2921:               <pre class="programlisting">
1.51      rillig   2922:     CFLAGS= -xtarget=ultra -xarch=v9
1.1       grant    2923: </pre>
                   2924: 
                   2925:               <p>Whichever compiler you use, please ensure the
                   2926:               compiler tools and your $prefix are in your
1.14      xtraeme  2927:               <code class="varname">PATH</code>. This includes
1.45      wiz      2928:               <code xmlns=
                   2929:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     2930:               "filename">/usr/ccs/{bin,lib}</code> and e.g.
1.45      wiz      2931:               <code xmlns=
                   2932:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2933:               "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1       grant    2934:             </div>
                   2935:           </div>
                   2936:         </div>
                   2937:       </div>
                   2938: 
1.63    ! dillo    2939:       <div class="chapter" lang="en">
1.1       grant    2940:         <div class="titlepage">
                   2941:           <div>
                   2942:             <div>
1.63    ! dillo    2943:               <h2 class="title"><a name=
1.1       grant    2944:               "using"></a>Chapter&nbsp;4.&nbsp;Using pkgsrc</h2>
                   2945:             </div>
                   2946:           </div>
                   2947:         </div>
                   2948: 
                   2949:         <div class="toc">
                   2950:           <p><b>Table of Contents</b></p>
                   2951: 
                   2952:           <dl>
                   2953:             <dt><span class="sect1"><a href="#getting-started">4.1.
                   2954:             Working with binary packages</a></span></dt>
                   2955: 
                   2956:             <dd>
                   2957:               <dl>
1.30      wiz      2958:                 <dt><span class="sect2"><a href=
                   2959:                 "#where-to-get-binary-packages">4.1.1. Where to get
                   2960:                 binary packages</a></span></dt>
1.1       grant    2961: 
1.30      wiz      2962:                 <dt><span class="sect2"><a href=
                   2963:                 "#how-to-use-binary-packages">4.1.2. How to use
                   2964:                 binary packages</a></span></dt>
1.1       grant    2965: 
1.30      wiz      2966:                 <dt><span class="sect2"><a href=
                   2967:                 "#a-word-of-warning">4.1.3. A word of
                   2968:                 warning</a></span></dt>
1.1       grant    2969:               </dl>
                   2970:             </dd>
                   2971: 
1.30      wiz      2972:             <dt><span class="sect1"><a href=
                   2973:             "#building-packages-from-source">4.2. Building packages
                   2974:             from source</a></span></dt>
1.1       grant    2975: 
                   2976:             <dd>
                   2977:               <dl>
1.30      wiz      2978:                 <dt><span class="sect2"><a href=
                   2979:                 "#requirements">4.2.1. Requirements</a></span></dt>
1.1       grant    2980: 
1.30      wiz      2981:                 <dt><span class="sect2"><a href=
                   2982:                 "#fetching-distfiles">4.2.2. Fetching
                   2983:                 distfiles</a></span></dt>
1.1       grant    2984: 
1.30      wiz      2985:                 <dt><span class="sect2"><a href=
                   2986:                 "#how-to-build-and-install">4.2.3. How to build and
                   2987:                 install</a></span></dt>
1.1       grant    2988: 
1.30      wiz      2989:                 <dt><span class="sect2"><a href=
                   2990:                 "#selecting-the-compiler">4.2.4. Selecting the
                   2991:                 compiler</a></span></dt>
1.1       grant    2992:               </dl>
                   2993:             </dd>
                   2994:           </dl>
                   2995:         </div>
                   2996: 
1.63    ! dillo    2997:         <div class="sect1" lang="en">
1.1       grant    2998:           <div class="titlepage">
                   2999:             <div>
                   3000:               <div>
                   3001:                 <h2 class="title" style="clear: both"><a name=
                   3002:                 "getting-started"></a>4.1.&nbsp;Working with binary
                   3003:                 packages</h2>
                   3004:               </div>
                   3005:             </div>
                   3006:           </div>
                   3007: 
                   3008:           <p>This section describes how to find, retrieve and
                   3009:           install a precompiled binary package that someone else
                   3010:           already prepared for your type of machine.</p>
                   3011: 
1.63    ! dillo    3012:           <div class="sect2" lang="en">
1.1       grant    3013:             <div class="titlepage">
                   3014:               <div>
                   3015:                 <div>
1.30      wiz      3016:                   <h3 class="title"><a name=
                   3017:                   "where-to-get-binary-packages"></a>4.1.1.&nbsp;Where
                   3018:                   to get binary packages</h3>
1.1       grant    3019:                 </div>
                   3020:               </div>
                   3021:             </div>
                   3022: 
                   3023:             <p>Precompiled packages are stored on ftp.NetBSD.org
1.45      wiz      3024:             and its mirrors in the directory <code xmlns=
                   3025:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   3026:             "filename">/pub/NetBSD/packages/&lt;OSVERSION&gt;/&lt;ARCH&gt;/</code>
                   3027:             for anonymous FTP access. <code class=
                   3028:             "varname">OSVERSION</code> is the NetBSD version
                   3029:             (<span><strong class="command">uname
                   3030:             -r</strong></span>), <code class="varname">ARCH</code>
                   3031:             is the architecture (<span><strong class=
                   3032:             "command">uname -p</strong></span>). In that directory,
                   3033:             there is a subdirectory for each category plus a
1.45      wiz      3034:             subdirectory <code xmlns=
                   3035:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3036:             "filename">All</code> which includes the actual
                   3037:             binaries in <code xmlns=
                   3038:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   3039:             "filename">.tgz</code> files. The category
                   3040:             subdirectories use symbolic links to those files (this
1.45      wiz      3041:             is the same directory layout as in <code xmlns=
                   3042:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3043:             "filename">/usr/pkgsrc/packages</code>).</p>
1.1       grant    3044: 
1.47      reed     3045:             <p>This same directory layout applies for CD-ROM
1.1       grant    3046:             distributions, only that the directory may be rooted
1.45      wiz      3047:             somewhere else, probably somewhere below <code xmlns=
                   3048:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     3049:             "filename">/cdrom</code>. Please consult your CD-ROMs
1.1       grant    3050:             documentation for the exact location.</p>
                   3051:           </div>
                   3052: 
1.63    ! dillo    3053:           <div class="sect2" lang="en">
1.1       grant    3054:             <div class="titlepage">
                   3055:               <div>
                   3056:                 <div>
1.30      wiz      3057:                   <h3 class="title"><a name=
                   3058:                   "how-to-use-binary-packages"></a>4.1.2.&nbsp;How
                   3059:                   to use binary packages</h3>
1.1       grant    3060:                 </div>
                   3061:               </div>
                   3062:             </div>
                   3063: 
1.47      reed     3064:             <p>If you have the files on a CD-ROM or downloaded them
1.23      wiz      3065:             to your hard disk, you can install them with the
1.27      rillig   3066:             following command (be sure to <span><strong class=
1.14      xtraeme  3067:             "command">su</strong></span> to root first):</p>
1.1       grant    3068:             <pre class="screen">
1.14      xtraeme  3069: <code class="prompt">#</code> <strong class=
                   3070: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1       grant    3071: </pre>
                   3072: 
                   3073:             <p>If you have FTP access and you don't want to
                   3074:             download the packages via FTP prior to installation,
1.14      xtraeme  3075:             you can do this automatically by giving
                   3076:             <span><strong class="command">pkg_add</strong></span>
                   3077:             an FTP URL:</p>
1.1       grant    3078:             <pre class="screen">
1.14      xtraeme  3079: <code class="prompt">#</code> <strong class=
1.27      rillig   3080: "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    3081: </pre>
                   3082: 
1.27      rillig   3083:             <p>Note that any prerequisite packages needed to run
                   3084:             the package in question will be installed, too,
1.1       grant    3085:             assuming they are present where you install from.</p>
                   3086: 
1.23      wiz      3087:             <p>To save some typing, you can set the <code class=
                   3088:             "varname">PKG_PATH</code> environment variable to a
1.47      reed     3089:             semicolon-separated list of paths (including remote
1.23      wiz      3090:             URLs); trailing slashes are not allowed.</p>
                   3091: 
1.45      wiz      3092:             <p>Additionally to the <code xmlns=
                   3093:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.23      wiz      3094:             "filename">All</code> directory there exists a
1.45      wiz      3095:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3096:             class="filename">vulnerable</code> directory to which
                   3097:             binary packages with known vulnerabilities are moved,
                   3098:             since removing them could cause missing dependencies.
                   3099:             To use these packages, add the <code xmlns=
                   3100:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3101:             "filename">vulnerable</code> directory to your
                   3102:             <code class="varname">PKG_PATH</code>. However, you
                   3103:             should run <a xmlns=
1.23      wiz      3104:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   3105:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45      wiz      3106:             target="_top"><code xmlns="" class=
                   3107:             "filename">security/audit-packages</code></a>
1.47      reed     3108:             regularly, especially after installing new packages,
                   3109:             and verify that the vulnerabilities are acceptable for
                   3110:             your configuration. An example <code class=
                   3111:             "varname">PKG_PATH</code> would be: <code xmlns=
                   3112:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   3113:             "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      3114:             Please note that semicolon (';') is a shell
                   3115:             meta-character, so you'll probably have to quote
                   3116:             it.</p>
                   3117: 
1.1       grant    3118:             <p>After you've installed packages, be sure to have
1.45      wiz      3119:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3120:             class="filename">/usr/pkg/bin</code> and <code xmlns=
                   3121:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3122:             "filename">/usr/pkg/sbin</code> in your <code class=
                   3123:             "varname">PATH</code> so you can actually start the
                   3124:             just installed program.</p>
1.1       grant    3125:           </div>
                   3126: 
1.63    ! dillo    3127:           <div class="sect2" lang="en">
1.1       grant    3128:             <div class="titlepage">
                   3129:               <div>
                   3130:                 <div>
1.63    ! dillo    3131:                   <h3 class="title"><a name=
1.30      wiz      3132:                   "a-word-of-warning"></a>4.1.3.&nbsp;A word of
1.1       grant    3133:                   warning</h3>
                   3134:                 </div>
                   3135:               </div>
                   3136:             </div>
                   3137: 
                   3138:             <p>Please pay very careful attention to the warnings
                   3139:             expressed in the <a href=
                   3140:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3141:             <span class="citerefentry"><span class=
                   3142:             "refentrytitle">pkg_add</span>(1)</span></a> manual
                   3143:             page about the inherent dangers of installing binary
                   3144:             packages which you did not create yourself, and the
                   3145:             security holes that can be introduced onto your system
                   3146:             by indiscriminate adding of such files.</p>
                   3147:           </div>
                   3148:         </div>
                   3149: 
1.63    ! dillo    3150:         <div class="sect1" lang="en">
1.1       grant    3151:           <div class="titlepage">
                   3152:             <div>
                   3153:               <div>
                   3154:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      3155:                 "building-packages-from-source"></a>4.2.&nbsp;Building
1.1       grant    3156:                 packages from source</h2>
                   3157:               </div>
                   3158:             </div>
                   3159:           </div>
                   3160: 
                   3161:           <p>This assumes that the package is already in pkgsrc. If
                   3162:           it is not, see <a href="#developers-guide" title=
1.46      gdt      3163:           "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">Part&nbsp;II,
1.27      rillig   3164:           &#8220;The pkgsrc developer's guide&#8221;</a> for
                   3165:           instructions how to create your own packages.</p>
1.1       grant    3166: 
1.63    ! dillo    3167:           <div class="sect2" lang="en">
1.1       grant    3168:             <div class="titlepage">
                   3169:               <div>
                   3170:                 <div>
1.63    ! dillo    3171:                   <h3 class="title"><a name=
1.30      wiz      3172:                   "requirements"></a>4.2.1.&nbsp;Requirements</h3>
1.1       grant    3173:                 </div>
                   3174:               </div>
                   3175:             </div>
                   3176: 
                   3177:             <p>To build packages from source on a NetBSD system the
                   3178:             &#8220;<span class="quote">comp</span>&#8221; and the
                   3179:             &#8220;<span class="quote">text</span>&#8221;
                   3180:             distribution sets must be installed. If you want to
1.47      reed     3181:             build X11-related packages the &#8220;<span class=
1.1       grant    3182:             "quote">xbase</span>&#8221; and &#8220;<span class=
                   3183:             "quote">xcomp</span>&#8221; distribution sets are
                   3184:             required, too.</p>
                   3185:           </div>
                   3186: 
1.63    ! dillo    3187:           <div class="sect2" lang="en">
1.1       grant    3188:             <div class="titlepage">
                   3189:               <div>
                   3190:                 <div>
1.63    ! dillo    3191:                   <h3 class="title"><a name=
        !          3192:                   "fetching-distfiles"></a>4.2.2.&nbsp;Fetching
1.1       grant    3193:                   distfiles</h3>
                   3194:                 </div>
                   3195:               </div>
                   3196:             </div>
                   3197: 
1.27      rillig   3198:             <p>The first step for building a package is downloading
                   3199:             the distfiles (i.e. the unmodified source). If they
                   3200:             have not yet been downloaded, pkgsrc will fetch them
1.1       grant    3201:             automatically.</p>
                   3202: 
                   3203:             <p>You can overwrite some of the major distribution
                   3204:             sites to fit to sites that are close to your own. Have
1.45      wiz      3205:             a look at <code xmlns=
                   3206:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3207:             "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27      rillig   3208:             some examples &#8212; in particular, look for the
1.14      xtraeme  3209:             <code class="varname">MASTER_SORT</code>, <code class=
                   3210:             "varname">MASTER_SORT_REGEX</code> and <code class=
                   3211:             "varname">INET_COUNTRY</code> definitions. This may
                   3212:             save some of your bandwidth and time.</p>
1.1       grant    3213: 
                   3214:             <p>You can change these settings either in your shell's
                   3215:             environment, or, if you want to keep the settings, by
1.45      wiz      3216:             editing the <code xmlns=
                   3217:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3218:             "filename">/etc/mk.conf</code> file, and adding the
                   3219:             definitions there.</p>
1.1       grant    3220: 
                   3221:             <p>If you don't have a permanent Internet connection
                   3222:             and you want to know which files to download,
1.14      xtraeme  3223:             <span><strong class="command">make
                   3224:             fetch-list</strong></span> will tell you what you'll
1.45      wiz      3225:             need. Put these distfiles into <code xmlns=
                   3226:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3227:             "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    3228:           </div>
                   3229: 
1.63    ! dillo    3230:           <div class="sect2" lang="en">
1.1       grant    3231:             <div class="titlepage">
                   3232:               <div>
                   3233:                 <div>
1.30      wiz      3234:                   <h3 class="title"><a name=
                   3235:                   "how-to-build-and-install"></a>4.2.3.&nbsp;How to
                   3236:                   build and install</h3>
1.1       grant    3237:                 </div>
                   3238:               </div>
                   3239:             </div>
                   3240: 
                   3241:             <p>Assuming that the distfile has been fetched (see
                   3242:             previous section), become root and change into the
1.47      reed     3243:             relevant directory and run <span><strong class=
                   3244:             "command">make</strong></span>.</p>
                   3245: 
                   3246:             <div class="note" style=
                   3247:             "margin-left: 0.5in; margin-right: 0.5in;">
                   3248:               <h3 class="title">Note</h3>
                   3249: 
                   3250:               <p>If using bootstrap or pkgsrc on a non-NetBSD
                   3251:               system, use the pkgsrc <span><strong class=
                   3252:               "command">bmake</strong></span> command instead of
                   3253:               &#8220;<span class="quote">make</span>&#8221; in the
                   3254:               examples in this guide.</p>
                   3255:             </div>
                   3256: 
                   3257:             <p>For example, type</p>
1.1       grant    3258:             <pre class="screen">
1.14      xtraeme  3259: <code class="prompt">%</code> <strong class=
                   3260: "userinput"><code>cd misc/figlet</code></strong>
                   3261: <code class="prompt">%</code> <strong class=
                   3262: "userinput"><code>make</code></strong>
1.1       grant    3263: </pre>
                   3264: 
                   3265:             <p>at the shell prompt to build the various components
                   3266:             of the package, and</p>
                   3267:             <pre class="screen">
1.14      xtraeme  3268: <code class="prompt">#</code> <strong class=
                   3269: "userinput"><code>make install</code></strong>
1.1       grant    3270: </pre>
                   3271: 
                   3272:             <p>to install the various components into the correct
                   3273:             places on your system. Installing the package on your
                   3274:             system requires you to be root. However, pkgsrc has a
                   3275:             <span class="emphasis"><em>just-in-time-su</em></span>
                   3276:             feature, which allows you to only become root for the
                   3277:             actual installation step</p>
                   3278: 
                   3279:             <p>Taking the figlet utility as an example, we can
                   3280:             install it on our system by building as shown in
                   3281:             <a href="#logs" title=
1.63    ! dillo    3282:             "Appendix&nbsp;B.&nbsp;Build logs">Appendix&nbsp;B,
        !          3283:             <i>Build logs</i></a>.</p>
1.1       grant    3284: 
                   3285:             <p>The program is installed under the default root of
1.45      wiz      3286:             the packages tree - <code xmlns=
                   3287:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3288:             "filename">/usr/pkg</code>. Should this not conform to
                   3289:             your tastes, set the <code class=
                   3290:             "varname">LOCALBASE</code> variable in your
1.1       grant    3291:             environment, and it will use that value as the root of
1.45      wiz      3292:             your packages tree. So, to use <code xmlns=
                   3293:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3294:             "filename">/usr/local</code>, set <code class=
                   3295:             "varname">LOCALBASE=/usr/local</code> in your
1.1       grant    3296:             environment. Please note that you should use a
                   3297:             directory which is dedicated to packages and not shared
1.47      reed     3298:             with other programs (i.e., do not try and use
1.14      xtraeme  3299:             <code class="varname">LOCALBASE=/usr</code>). Also, you
                   3300:             should not try to add any of your own files or
1.45      wiz      3301:             directories (such as <code xmlns=
                   3302:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3303:             "filename">src/</code>, <code xmlns=
                   3304:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3305:             "filename">obj/</code>, or <code xmlns=
                   3306:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3307:             "filename">pkgsrc/</code>) below the <code class=
                   3308:             "varname">LOCALBASE</code> tree. This is to prevent
1.1       grant    3309:             possible conflicts between programs and other files
                   3310:             installed by the package system and whatever else may
                   3311:             have been installed there.</p>
                   3312: 
1.45      wiz      3313:             <p>Some packages look in <code xmlns=
                   3314:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3315:             "filename">/etc/mk.conf</code> to alter some
1.1       grant    3316:             configuration options at build time. Have a look at
1.45      wiz      3317:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3318:             class="filename">pkgsrc/mk/defaults/mk.conf</code> to
                   3319:             get an overview of what will be set there by default.
1.14      xtraeme  3320:             Environment variables such as <code class=
1.45      wiz      3321:             "varname">LOCALBASE</code> can be set in <code xmlns=
                   3322:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3323:             "filename">/etc/mk.conf</code> to save having to
                   3324:             remember to set them each time you want to use
                   3325:             pkgsrc.</p>
1.1       grant    3326: 
                   3327:             <p>Occasionally, people want to &#8220;<span class=
                   3328:             "quote">look under the covers</span>&#8221; to see what
                   3329:             is going on when a package is building or being
                   3330:             installed. This may be for debugging purposes, or out
                   3331:             of simple curiosity. A number of utility values have
                   3332:             been added to help with this.</p>
                   3333: 
                   3334:             <div class="orderedlist">
                   3335:               <ol type="1">
                   3336:                 <li>
                   3337:                   <p>If you invoke the <a href=
                   3338:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   3339:                   <span class="citerefentry"><span class=
                   3340:                   "refentrytitle">make</span>(1)</span></a> command
1.14      xtraeme  3341:                   with <code class=
                   3342:                   "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
                   3343:                   amount of information will be displayed. For
                   3344:                   example,</p>
1.1       grant    3345:                   <pre class="screen">
1.14      xtraeme  3346: <strong class=
                   3347: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1       grant    3348: </pre>
                   3349: 
                   3350:                   <p>will show all the commands that are invoked,
                   3351:                   up to and including the &#8220;<span class=
                   3352:                   "quote">patch</span>&#8221; stage.</p>
                   3353:                 </li>
                   3354: 
                   3355:                 <li>
                   3356:                   <p>If you want to know the value of a certain
1.22      tv       3357:                   <a href=
                   3358:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   3359:                   <span class="citerefentry"><span class=
                   3360:                   "refentrytitle">make</span>(1)</span></a>
                   3361:                   definition, then the <code class=
1.14      xtraeme  3362:                   "varname">VARNAME</code> definition should be
                   3363:                   used, in conjunction with the show-var target.
                   3364:                   e.g. to show the expansion of the <a href=
1.1       grant    3365:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   3366:                   <span class="citerefentry"><span class=
                   3367:                   "refentrytitle">make</span>(1)</span></a>
1.14      xtraeme  3368:                   variable <code class=
1.22      tv       3369:                   "varname">LOCALBASE</code>:</p>
1.1       grant    3370:                   <pre class="screen">
1.14      xtraeme  3371: <code class="prompt">%</code> <strong class=
                   3372: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1       grant    3373: /usr/pkg
1.14      xtraeme  3374: <code class="prompt">%</code>
1.1       grant    3375:           
                   3376: </pre>
                   3377:                 </li>
                   3378:               </ol>
                   3379:             </div>
                   3380: 
                   3381:             <p>If you want to install a binary package that you've
                   3382:             either created yourself (see next section), that you
                   3383:             put into pkgsrc/packages manually or that is located on
1.8       wiz      3384:             a remote FTP server, you can use the "bin-install"
1.1       grant    3385:             target. This target will install a binary package - if
                   3386:             available - via <a href=
                   3387:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3388:             <span class="citerefentry"><span class=
                   3389:             "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14      xtraeme  3390:             <span><strong class="command">make
                   3391:             package</strong></span>. The list of remote FTP sites
                   3392:             searched is kept in the variable <code class=
                   3393:             "varname">BINPKG_SITES</code>, which defaults to
                   3394:             ftp.NetBSD.org. Any flags that should be added to
                   3395:             <a href=
1.1       grant    3396:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3397:             <span class="citerefentry"><span class=
                   3398:             "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14      xtraeme  3399:             into <code class="varname">BIN_INSTALL_FLAGS</code>.
1.45      wiz      3400:             See <code xmlns=
                   3401:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3402:             "filename">pkgsrc/mk/defaults/mk.conf</code> for more
                   3403:             details.</p>
1.1       grant    3404: 
1.47      reed     3405:             <p>A final word of warning: If you set up a system that
1.14      xtraeme  3406:             has a non-standard setting for <code class=
                   3407:             "varname">LOCALBASE</code>, be sure to set that before
1.1       grant    3408:             any packages are installed, as you can not use several
                   3409:             directories for the same purpose. Doing so will result
                   3410:             in pkgsrc not being able to properly detect your
                   3411:             installed packages, and fail miserably. Note also that
                   3412:             precompiled binary packages are usually built with the
1.14      xtraeme  3413:             default <code class="varname">LOCALBASE</code> of
1.45      wiz      3414:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3415:             class="filename">/usr/pkg</code>, and that you should
                   3416:             <span class="emphasis"><em>not</em></span> install any
                   3417:             if you use a non-standard <code class=
1.14      xtraeme  3418:             "varname">LOCALBASE</code>.</p>
1.1       grant    3419:           </div>
                   3420: 
1.63    ! dillo    3421:           <div class="sect2" lang="en">
1.1       grant    3422:             <div class="titlepage">
                   3423:               <div>
                   3424:                 <div>
1.30      wiz      3425:                   <h3 class="title"><a name=
                   3426:                   "selecting-the-compiler"></a>4.2.4.&nbsp;Selecting
                   3427:                   the compiler</h3>
1.1       grant    3428:                 </div>
                   3429:               </div>
                   3430:             </div>
                   3431: 
                   3432:             <p>By default, pkgsrc will use GCC to build packages.
                   3433:             This may be overridden by setting the following
                   3434:             variables in /etc/mk.conf:</p>
                   3435: 
                   3436:             <div class="variablelist">
                   3437:               <dl>
1.14      xtraeme  3438:                 <dt><span class="term"><code class=
                   3439:                 "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1       grant    3440: 
                   3441:                 <dd>
                   3442:                   <p>This is a list of values specifying the chain
                   3443:                   of compilers to invoke when building packages.
                   3444:                   Valid values are:</p>
                   3445: 
                   3446:                   <div class="itemizedlist">
                   3447:                     <ul type="disc">
                   3448:                       <li>
1.14      xtraeme  3449:                         <p><code class="varname">distcc</code>:
1.1       grant    3450:                         distributed C/C++ (chainable)</p>
                   3451:                       </li>
                   3452: 
                   3453:                       <li>
1.14      xtraeme  3454:                         <p><code class="varname">ccache</code>:
1.1       grant    3455:                         compiler cache (chainable)</p>
                   3456:                       </li>
                   3457: 
                   3458:                       <li>
1.14      xtraeme  3459:                         <p><code class="varname">gcc</code>: GNU
                   3460:                         C/C++ Compiler</p>
1.1       grant    3461:                       </li>
                   3462: 
                   3463:                       <li>
1.14      xtraeme  3464:                         <p><code class="varname">mipspro</code>:
1.1       grant    3465:                         Silicon Graphics, Inc. MIPSpro
                   3466:                         (n32/n64)</p>
                   3467:                       </li>
                   3468: 
                   3469:                       <li>
1.14      xtraeme  3470:                         <p><code class="varname">mipspro</code>:
1.1       grant    3471:                         Silicon Graphics, Inc. MIPSpro (o32)</p>
                   3472:                       </li>
                   3473: 
                   3474:                       <li>
1.14      xtraeme  3475:                         <p><code class="varname">sunpro</code>:
1.1       grant    3476:                         Microsystems, Inc. WorkShip/Forte/Sun ONE
                   3477:                         Studio</p>
                   3478:                       </li>
                   3479:                     </ul>
                   3480:                   </div>
                   3481: 
                   3482:                   <p>The default is &#8220;<span class=
1.14      xtraeme  3483:                   "quote"><code class=
                   3484:                   "varname">gcc</code></span>&#8221;. You can use
                   3485:                   <code class="varname">ccache</code> and/or
                   3486:                   <code class="varname">distcc</code> with an
                   3487:                   appropriate <code class=
                   3488:                   "varname">PKGSRC_COMPILER</code> setting, e.g.
                   3489:                   &#8220;<span class="quote"><code class=
                   3490:                   "varname">ccache gcc</code></span>&#8221;. This
1.1       grant    3491:                   variable should always be terminated with a value
                   3492:                   for a real compiler.</p>
                   3493:                 </dd>
                   3494: 
1.14      xtraeme  3495:                 <dt><span class="term"><code class=
                   3496:                 "varname">GCC_REQD</code>:</span></dt>
1.1       grant    3497: 
                   3498:                 <dd>
                   3499:                   <p>This specifies the minimum version of GCC to
                   3500:                   use when building packages. If the system GCC
                   3501:                   doesn't satisfy this requirement, then pkgsrc
                   3502:                   will build and install one of the GCC packages to
                   3503:                   use instead.</p>
                   3504:                 </dd>
                   3505:               </dl>
                   3506:             </div>
                   3507:           </div>
                   3508:         </div>
                   3509:       </div>
                   3510: 
1.63    ! dillo    3511:       <div class="chapter" lang="en">
1.1       grant    3512:         <div class="titlepage">
                   3513:           <div>
                   3514:             <div>
1.63    ! dillo    3515:               <h2 class="title"><a name=
1.38      dillo    3516:               "configuring"></a>Chapter&nbsp;5.&nbsp;Configuring
                   3517:               pkgsrc</h2>
                   3518:             </div>
                   3519:           </div>
                   3520:         </div>
                   3521: 
                   3522:         <div class="toc">
                   3523:           <p><b>Table of Contents</b></p>
                   3524: 
                   3525:           <dl>
                   3526:             <dt><span class="sect1"><a href=
1.45      wiz      3527:             "#general-configuration">5.1. General
                   3528:             configuration</a></span></dt>
                   3529: 
                   3530:             <dt><span class="sect1"><a href=
                   3531:             "#variables-affecting-build">5.2. Variables affecting
                   3532:             the build process</a></span></dt>
                   3533: 
                   3534:             <dt><span class="sect1"><a href=
                   3535:             "#developer-advanced-settings">5.3. Developer/advanced
                   3536:             settings</a></span></dt>
                   3537: 
                   3538:             <dt><span class="sect1"><a href=
                   3539:             "#selecting-build-options">5.4. Selecting Build
1.42      dillo    3540:             Options</a></span></dt>
1.38      dillo    3541:           </dl>
                   3542:         </div>
                   3543: 
1.63    ! dillo    3544:         <div class="sect1" lang="en">
1.38      dillo    3545:           <div class="titlepage">
                   3546:             <div>
                   3547:               <div>
                   3548:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      3549:                 "general-configuration"></a>5.1.&nbsp;General
                   3550:                 configuration</h2>
                   3551:               </div>
                   3552:             </div>
                   3553:           </div>
                   3554: 
1.47      reed     3555:           <p>In this section, you can find some variables that
                   3556:           apply to all pkgsrc packages. The preferred method of
                   3557:           setting these variables is by setting them in
                   3558:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3559:           class="filename">/etc/mk.conf</code>.</p>
1.45      wiz      3560: 
                   3561:           <div class="itemizedlist">
                   3562:             <ul type="disc">
                   3563:               <li>
                   3564:                 <p><code class="varname">LOCALBASE</code>: Where
                   3565:                 packages will be installed. The default is
                   3566:                 <code xmlns=
                   3567:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3568:                 "filename">/usr/pkg</code>. Do not mix binary
                   3569:                 packages with different <code class=
                   3570:                 "varname">LOCALBASE</code>s!</p>
                   3571:               </li>
                   3572: 
                   3573:               <li>
                   3574:                 <p><code class="varname">CROSSBASE</code>: Where
                   3575:                 &#8220;<span class="quote">cross</span>&#8221;
                   3576:                 category packages will be installed. The default is
                   3577:                 <code xmlns=
                   3578:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3579:                 "filename">${LOCALBASE}/cross</code>.</p>
                   3580:               </li>
                   3581: 
                   3582:               <li>
                   3583:                 <p><code class="varname">X11BASE</code>: Where X11
                   3584:                 is installed on the system. The default is
                   3585:                 <code xmlns=
                   3586:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3587:                 "filename">/usr/X11R6</code>.</p>
                   3588:               </li>
                   3589: 
                   3590:               <li>
                   3591:                 <p><code class="varname">DISTDIR</code>: Where to
                   3592:                 store the downloaded copies of the original source
                   3593:                 distributions used for building pkgsrc packages.
                   3594:                 The default is <code xmlns=
                   3595:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3596:                 "filename">${PKGSRCDIR}/distfiles</code>.</p>
                   3597:               </li>
                   3598: 
                   3599:               <li>
                   3600:                 <p><code class=
                   3601:                 "varname">MASTER_SITE_OVERRIDE</code>: If set,
                   3602:                 override the packages' <code class=
                   3603:                 "varname">MASTER_SITES</code> with this value.</p>
                   3604:               </li>
                   3605: 
                   3606:               <li>
                   3607:                 <p><code class="varname">MASTER_SITE_BACKUP</code>:
                   3608:                 Backup location(s) for distribution files and patch
                   3609:                 files if not found locally or in <code xmlns=
                   3610:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3611:                 "filename">${MASTER_SITES}</code> or <code xmlns=
                   3612:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3613:                 "filename">${PATCH_SITES}</code> respectively. The
                   3614:                 defaults are <code xmlns=
                   3615:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3616:                 "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/${DIST_SUBDIR}/</code>
                   3617:                 and <code xmlns=
                   3618:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3619:                 "filename">ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/</code>.</p>
                   3620:               </li>
                   3621: 
                   3622:               <li>
                   3623:                 <p><code class="varname">BINPKG_SITES</code>: List
                   3624:                 of sites carrying binary pkgs.</p>
                   3625:               </li>
                   3626:             </ul>
                   3627:           </div>
                   3628:         </div>
                   3629: 
1.63    ! dillo    3630:         <div class="sect1" lang="en">
1.45      wiz      3631:           <div class="titlepage">
                   3632:             <div>
                   3633:               <div>
                   3634:                 <h2 class="title" style="clear: both"><a name=
                   3635:                 "variables-affecting-build"></a>5.2.&nbsp;Variables
                   3636:                 affecting the build process</h2>
                   3637:               </div>
                   3638:             </div>
                   3639:           </div>
                   3640: 
                   3641:           <p>XXX</p>
                   3642: 
                   3643:           <div class="itemizedlist">
                   3644:             <ul type="disc">
                   3645:               <li>
                   3646:                 <p><code class="varname">PACKAGES</code>: The top
                   3647:                 level directory for the binary packages. The
                   3648:                 default is <code xmlns=
                   3649:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3650:                 "filename">${PKGSRCDIR}/packages</code>.</p>
                   3651:               </li>
                   3652: 
                   3653:               <li>
                   3654:                 <p><code class="varname">WRKOBJDIR</code>: The top
                   3655:                 level directory where, if defined, the separate
                   3656:                 working directories will get created, and
                   3657:                 symbolically linked to from <code xmlns=
                   3658:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3659:                 "filename">${WRKDIR}</code> (see below). This is
                   3660:                 useful for building packages on several
                   3661:                 architectures, then <code xmlns=
                   3662:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3663:                 "filename">${PKGSRCDIR}</code> can be NFS-mounted
                   3664:                 while <code xmlns=
                   3665:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3666:                 "filename">${WRKOBJDIR}</code> is local to every
                   3667:                 architecture. (It should be noted that <code class=
                   3668:                 "varname">PKGSRCDIR</code> should not be set by the
                   3669:                 user &#8212; it is an internal definition which
                   3670:                 refers to the root of the pkgsrc tree. It is
                   3671:                 possible to have many pkgsrc tree instances.)</p>
                   3672:               </li>
                   3673: 
                   3674:               <li>
                   3675:                 <p><code class="varname">LOCALPATCHES</code>:
                   3676:                 Directory for local patches that aren't part of
                   3677:                 pkgsrc. See <a href="#components.patches" title=
                   3678:                 "8.3.&nbsp;patches/*">Section&nbsp;8.3,
                   3679:                 &#8220;patches/*&#8221;</a> for more information.
                   3680:                 <em class="replaceable"><code>rel</code></em> and
                   3681:                 <em class="replaceable"><code>arch</code></em> are
                   3682:                 replaced with OS release (&#8220;<span class=
                   3683:                 "quote">2.0</span>&#8221;, etc.) and architecture
                   3684:                 (&#8220;<span class="quote">mipsel</span>&#8221;,
                   3685:                 etc.).</p>
                   3686:               </li>
                   3687: 
                   3688:               <li>
                   3689:                 <p><code class="varname">PKGMAKECONF</code>:
                   3690:                 Location of the <code xmlns=
                   3691:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3692:                 "filename">mk.conf</code> file used by a package's
                   3693:                 BSD-style Makefile. If this is not set,
                   3694:                 <code class="varname">MAKECONF</code> is set to
                   3695:                 <code xmlns=
                   3696:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3697:                 "filename">/dev/null</code> to avoid picking up
                   3698:                 settings used by builds in <code xmlns=
                   3699:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3700:                 "filename">/usr/src</code>.</p>
                   3701:               </li>
                   3702:             </ul>
                   3703:           </div>
                   3704:         </div>
                   3705: 
1.63    ! dillo    3706:         <div class="sect1" lang="en">
1.45      wiz      3707:           <div class="titlepage">
                   3708:             <div>
                   3709:               <div>
                   3710:                 <h2 class="title" style="clear: both"><a name=
                   3711:                 "developer-advanced-settings"></a>5.3.&nbsp;Developer/advanced
                   3712:                 settings</h2>
                   3713:               </div>
                   3714:             </div>
                   3715:           </div>
                   3716: 
                   3717:           <p>XXX</p>
                   3718: 
                   3719:           <div class="itemizedlist">
                   3720:             <ul type="disc">
                   3721:               <li>
                   3722:                 <p><code class="varname">PKG_DEVELOPER</code>: Run
                   3723:                 some sanity checks that package developers
                   3724:                 want:</p>
                   3725: 
                   3726:                 <div class="itemizedlist">
                   3727:                   <ul type="circle">
                   3728:                     <li>
                   3729:                       <p>make sure patches apply with zero fuzz</p>
                   3730:                     </li>
                   3731: 
                   3732:                     <li>
                   3733:                       <p>run check-shlibs to see that all binaries
                   3734:                       will find their shared libs.</p>
                   3735:                     </li>
                   3736:                   </ul>
                   3737:                 </div>
                   3738:               </li>
                   3739: 
                   3740:               <li>
                   3741:                 <p><code class="varname">PKG_DEBUG_LEVEL</code>:
                   3742:                 The level of debugging output which is displayed
                   3743:                 whilst making and installing the package. The
                   3744:                 default value for this is 0, which will not display
                   3745:                 the commands as they are executed (normal, default,
                   3746:                 quiet operation); the value 1 will display all
                   3747:                 shell commands before their invocation, and the
                   3748:                 value 2 will display both the shell commands before
                   3749:                 their invocation, and their actual execution
                   3750:                 progress with <span><strong class="command">set
                   3751:                 -x</strong></span> will be displayed.</p>
                   3752:               </li>
1.58      erh      3753: 
                   3754:               <li>
                   3755:                 <p><code class=
                   3756:                 "varname">ALLOW_VULNERABILITIES.<em class=
                   3757:                 "replaceable"><code>pkgbase</code></em></code>: A
                   3758:                 space separated list of vulnerability IDs that may
                   3759:                 be ignored when performing the automated security
                   3760:                 checks. These IDs are listed in the
                   3761:                 pkg-vulnerabilities file and are displayed by
                   3762:                 <span><strong class=
                   3763:                 "command">audit-packages</strong></span> when it
                   3764:                 finds a vulnerable package.</p>
                   3765:               </li>
                   3766: 
                   3767:               <li>
                   3768:                 <p><code class=
                   3769:                 "varname">SKIP_AUDIT_PACKAGES</code>: If this is
                   3770:                 set to &#8220;<span class=
                   3771:                 "quote">yes</span>&#8221;, the automated security
                   3772:                 checks (which use the <a xmlns=
                   3773:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3774:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
                   3775:                 target="_top"><code xmlns="" class=
                   3776:                 "filename">security/audit-packages</code></a>
                   3777:                 package) will be <span class=
                   3778:                 "strong"><strong>entirely</strong></span> skipped
                   3779:                 for <span class=
                   3780:                 "strong"><strong>all</strong></span> packages
                   3781:                 built. Normally you'll want to use
                   3782:                 ALLOW_VULNERABILITIES instead of this.</p>
                   3783:               </li>
1.45      wiz      3784:             </ul>
                   3785:           </div>
                   3786:         </div>
                   3787: 
1.63    ! dillo    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:                 "selecting-build-options"></a>5.4.&nbsp;Selecting
                   3794:                 Build Options</h2>
1.38      dillo    3795:               </div>
                   3796:             </div>
                   3797:           </div>
                   3798: 
                   3799:           <p>Some packages have build time options, usually to
                   3800:           select between different dependencies, enable optional
                   3801:           support for big dependencies or enable experimental
                   3802:           features.</p>
                   3803: 
                   3804:           <p>To see which options, if any, a package supports, and
                   3805:           which options are mutually exclusive, run
                   3806:           <span><strong class="command">make
                   3807:           show-options</strong></span>, for example:</p>
                   3808:           <pre class="programlisting">
1.51      rillig   3809:     The following options are supported by this package:
                   3810:     ssl      Enable SSL support.
                   3811:     Exactly one of the following gecko options is required:
                   3812:     firefox  Use firefox as gecko rendering engine.
                   3813:     mozilla  Use mozilla as gecko rendering engine.
                   3814:     At most one of the following database options may be selected:
                   3815:     mysql    Enable support for MySQL database.
                   3816:     pgsql    Enable support for PostgreSQL database.
                   3817: 
                   3818:     These options are enabled by default: firefox
                   3819:     These options are currently enabled: mozilla ssl
1.38      dillo    3820: </pre>
                   3821: 
1.45      wiz      3822:           <p>The following variables can be defined in <code xmlns=
                   3823:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.38      dillo    3824:           "filename">/etc/mk.conf</code> to select which options to
                   3825:           enable for a package: <code class=
                   3826:           "varname">PKG_DEFAULT_OPTIONS</code>, which can be used
                   3827:           to select or disable options for all packages that
                   3828:           support them, and <code class=
                   3829:           "varname">PKG_OPTIONS.<em class=
                   3830:           "replaceable"><code>pkgbase</code></em></code>, which can
                   3831:           be used to select or disable options specifically for
                   3832:           package <em class=
                   3833:           "replaceable"><code>pkgbase</code></em>. Options listed
                   3834:           in these variables are selected, options preceded by
                   3835:           &#8220;<span class="quote">-</span>&#8221; are
                   3836:           disabled.</p>
                   3837: 
1.39      dillo    3838:           <p>The following settings are consulted in the order
                   3839:           given, and the last setting that selects or disables an
                   3840:           option is used:</p>
1.38      dillo    3841: 
                   3842:           <div class="orderedlist">
                   3843:             <ol type="1">
                   3844:               <li>
                   3845:                 <p>the default options as suggested by the package
                   3846:                 maintainer</p>
                   3847:               </li>
                   3848: 
                   3849:               <li>
                   3850:                 <p>the options implied by the settings of legacy
                   3851:                 variables (see below)</p>
                   3852:               </li>
                   3853: 
                   3854:               <li>
                   3855:                 <p><code class=
                   3856:                 "varname">PKG_DEFAULT_OPTIONS</code></p>
                   3857:               </li>
                   3858: 
                   3859:               <li>
                   3860:                 <p><code class="varname">PKG_OPTIONS.<em class=
                   3861:                 "replaceable"><code>pkgbase</code></em></code></p>
                   3862:               </li>
                   3863:             </ol>
                   3864:           </div>
                   3865: 
                   3866:           <p>For groups of mutually exclusive options, the last
                   3867:           option selected is used, all others are automatically
                   3868:           disabled. If an option of the group is explicitly
                   3869:           disabled, the previously selected option, if any, is
                   3870:           used. It is an error if no option from a required group
                   3871:           of options is selected, and building the package will
                   3872:           fail.</p>
                   3873: 
                   3874:           <p>Before the options framework was introduced, build
                   3875:           options were selected by setting a variable in
1.45      wiz      3876:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3877:           class="filename">/etc/mk.conf</code> for each option. To
                   3878:           ease transition to the options framework for the user,
                   3879:           these legacy variables are converted to the appropriate
                   3880:           options setting automatically. A warning is issued to
                   3881:           prompt the user to update <code xmlns=
                   3882:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.38      dillo    3883:           "filename">/etc/mk.conf</code> to use the options
                   3884:           framework directly. Support for these legacy variables
                   3885:           will be removed eventually.</p>
                   3886:         </div>
                   3887:       </div>
                   3888: 
1.63    ! dillo    3889:       <div class="chapter" lang="en">
1.38      dillo    3890:         <div class="titlepage">
                   3891:           <div>
                   3892:             <div>
1.63    ! dillo    3893:               <h2 class="title"><a name=
1.38      dillo    3894:               "binary"></a>Chapter&nbsp;6.&nbsp;Creating binary
1.1       grant    3895:               packages</h2>
                   3896:             </div>
                   3897:           </div>
                   3898:         </div>
                   3899: 
                   3900:         <div class="toc">
                   3901:           <p><b>Table of Contents</b></p>
                   3902: 
                   3903:           <dl>
1.30      wiz      3904:             <dt><span class="sect1"><a href=
1.38      dillo    3905:             "#building-a-single-binary-package">6.1. Building a
1.30      wiz      3906:             single binary package</a></span></dt>
1.1       grant    3907: 
1.30      wiz      3908:             <dt><span class="sect1"><a href=
1.38      dillo    3909:             "#settings-for-creationg-of-binary-packages">6.2.
1.1       grant    3910:             Settings for creation of binary
                   3911:             packages</a></span></dt>
                   3912: 
1.38      dillo    3913:             <dt><span class="sect1"><a href="#bulkbuild">6.3. Doing
1.1       grant    3914:             a bulk build of all packages</a></span></dt>
                   3915: 
                   3916:             <dd>
                   3917:               <dl>
                   3918:                 <dt><span class="sect2"><a href=
1.38      dillo    3919:                 "#binary.configuration">6.3.1.
1.1       grant    3920:                 Configuration</a></span></dt>
                   3921: 
1.30      wiz      3922:                 <dt><span class="sect2"><a href=
1.38      dillo    3923:                 "#other-environmental-considerations">6.3.2. Other
1.30      wiz      3924:                 environmental considerations</a></span></dt>
1.1       grant    3925: 
1.38      dillo    3926:                 <dt><span class="sect2"><a href="#operation">6.3.3.
1.1       grant    3927:                 Operation</a></span></dt>
                   3928: 
1.30      wiz      3929:                 <dt><span class="sect2"><a href=
1.38      dillo    3930:                 "#what-it-does">6.3.4. What it does</a></span></dt>
1.1       grant    3931: 
1.30      wiz      3932:                 <dt><span class="sect2"><a href=
1.38      dillo    3933:                 "#disk-space-requirements">6.3.5. Disk space
1.30      wiz      3934:                 requirements</a></span></dt>
1.1       grant    3935: 
1.30      wiz      3936:                 <dt><span class="sect2"><a href=
1.38      dillo    3937:                 "#setting-up-a-sandbox">6.3.6. Setting up a sandbox
1.47      reed     3938:                 for chrooted builds</a></span></dt>
1.1       grant    3939: 
1.30      wiz      3940:                 <dt><span class="sect2"><a href=
1.38      dillo    3941:                 "#building-a-partial-set">6.3.7. Building a partial
1.30      wiz      3942:                 set of packages</a></span></dt>
1.13      hubertf  3943: 
                   3944:                 <dt><span class="sect2"><a href=
1.38      dillo    3945:                 "#bulk-upload">6.3.8. Uploading results of a bulk
1.13      hubertf  3946:                 build</a></span></dt>
1.1       grant    3947:               </dl>
                   3948:             </dd>
                   3949: 
1.38      dillo    3950:             <dt><span class="sect1"><a href="#creating-cdroms">6.4.
1.1       grant    3951:             Creating a multiple CD-ROM packages
                   3952:             collection</a></span></dt>
                   3953: 
                   3954:             <dd>
                   3955:               <dl>
1.30      wiz      3956:                 <dt><span class="sect2"><a href=
1.38      dillo    3957:                 "#cdpack-example">6.4.1. Example of
1.30      wiz      3958:                 cdpack</a></span></dt>
1.1       grant    3959:               </dl>
                   3960:             </dd>
                   3961:           </dl>
                   3962:         </div>
                   3963: 
1.63    ! dillo    3964:         <div class="sect1" lang="en">
1.1       grant    3965:           <div class="titlepage">
                   3966:             <div>
                   3967:               <div>
                   3968:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    3969:                 "building-a-single-binary-package"></a>6.1.&nbsp;Building
1.30      wiz      3970:                 a single binary package</h2>
1.1       grant    3971:               </div>
                   3972:             </div>
                   3973:           </div>
                   3974: 
                   3975:           <p>Once you have built and installed a package, you can
                   3976:           create a <span class="emphasis"><em>binary
                   3977:           package</em></span> which can be installed on another
                   3978:           system with <a href=
                   3979:           "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3980:           <span class="citerefentry"><span class=
1.47      reed     3981:           "refentrytitle">pkg_add</span>(1)</span></a>. This saves
1.1       grant    3982:           having to build the same package on a group of hosts and
                   3983:           wasting CPU time. It also provides a simple means for
                   3984:           others to install your package, should you distribute
                   3985:           it.</p>
                   3986: 
                   3987:           <p>To create a binary package, change into the
1.14      xtraeme  3988:           appropriate directory in pkgsrc, and run
                   3989:           <span><strong class="command">make
                   3990:           package</strong></span>:</p>
1.1       grant    3991:           <pre class="screen">
1.14      xtraeme  3992: <code class="prompt">#</code> <strong class=
                   3993: "userinput"><code>cd misc/figlet</code></strong>
                   3994: <code class="prompt">#</code> <strong class=
                   3995: "userinput"><code>make package</code></strong>
1.1       grant    3996: </pre>
                   3997: 
                   3998:           <p>This will build and install your package (if not
                   3999:           already done), and then build a binary package from what
1.14      xtraeme  4000:           was installed. You can then use the <span><strong class=
                   4001:           "command">pkg_*</strong></span> tools to manipulate it.
1.45      wiz      4002:           Binary packages are created by default in <code xmlns=
                   4003:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4004:           "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1       grant    4005:           gzipped tar file. See <a href="#logs.package" title=
1.63    ! dillo    4006:           "B.2.&nbsp;Packaging figlet">Section&nbsp;B.2,
1.1       grant    4007:           &#8220;Packaging figlet&#8221;</a> for a continuation of
                   4008:           the above <a xmlns=
                   4009:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4010:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.45      wiz      4011:           target="_top"><code xmlns="" class=
                   4012:           "filename">misc/figlet</code></a> example.</p>
1.1       grant    4013: 
                   4014:           <p>See <a href="#submit" title=
1.63    ! dillo    4015:           "Chapter&nbsp;17.&nbsp;Submitting and Committing">Chapter&nbsp;17,
        !          4016:           <i>Submitting and Committing</i></a> for information on
        !          4017:           how to submit such a binary package.</p>
1.1       grant    4018:         </div>
                   4019: 
1.63    ! dillo    4020:         <div class="sect1" lang="en">
1.1       grant    4021:           <div class="titlepage">
                   4022:             <div>
                   4023:               <div>
                   4024:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    4025:                 "settings-for-creationg-of-binary-packages"></a>6.2.&nbsp;Settings
1.1       grant    4026:                 for creation of binary packages</h2>
                   4027:               </div>
                   4028:             </div>
                   4029:           </div>
                   4030: 
                   4031:           <p>See <a href="#build.helpful-targets" title=
1.56      rillig   4032:           "14.16.&nbsp;Other helpful targets">Section&nbsp;14.16,
1.1       grant    4033:           &#8220;Other helpful targets&#8221;</a>.</p>
                   4034:         </div>
                   4035: 
1.63    ! dillo    4036:         <div class="sect1" lang="en">
1.1       grant    4037:           <div class="titlepage">
                   4038:             <div>
                   4039:               <div>
                   4040:                 <h2 class="title" style="clear: both"><a name=
1.63    ! dillo    4041:                 "bulkbuild"></a>6.3.&nbsp;Doing a bulk build of all
        !          4042:                 packages</h2>
1.1       grant    4043:               </div>
                   4044:             </div>
                   4045:           </div>
                   4046: 
                   4047:           <p>If you want to get a full set of precompiled binary
                   4048:           packages, this section describes how to get them. Beware
                   4049:           that the bulk build will remove all currently installed
1.63    ! dillo    4050:           packages from your system!</p>
        !          4051: 
        !          4052:           <p>Having an FTP server configured either on the machine
        !          4053:           doing the bulk builds or on a nearby NFS server can help
        !          4054:           to make the packages available to other machines that can
        !          4055:           then save time by installing only the binary packages.
        !          4056:           See <a href=
1.1       grant    4057:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
                   4058:           <span class="citerefentry"><span class=
                   4059:           "refentrytitle">ftpd</span>(8)</span></a> for more
                   4060:           information. If you use a remote NFS server's storage, be
                   4061:           sure to not actually compile on NFS storage, as this
                   4062:           slows things down a lot.</p>
                   4063: 
1.63    ! dillo    4064:           <div class="sect2" lang="en">
1.1       grant    4065:             <div class="titlepage">
                   4066:               <div>
                   4067:                 <div>
1.63    ! dillo    4068:                   <h3 class="title"><a name=
1.38      dillo    4069:                   "binary.configuration"></a>6.3.1.&nbsp;Configuration</h3>
1.1       grant    4070:                 </div>
                   4071:               </div>
                   4072:             </div>
                   4073: 
1.63    ! dillo    4074:             <div class="sect3" lang="en">
1.1       grant    4075:               <div class="titlepage">
                   4076:                 <div>
                   4077:                   <div>
1.63    ! dillo    4078:                     <h4 class="title"><a name=
        !          4079:                     "binary.bulk.build.conf"></a>6.3.1.1.&nbsp;<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
        !          4080:                     class="filename">build.conf</code></h4>
        !          4081:                   </div>
        !          4082:                 </div>
        !          4083:               </div>
        !          4084: 
        !          4085:               <p>The <code xmlns=
        !          4086:               "http://www.w3.org/TR/xhtml1/transitional" class=
        !          4087:               "filename">build.conf</code> file is the main
        !          4088:               configuration file for bulk builds. You can configure
        !          4089:               how your copy of pkgsrc is kept up to date, how the
        !          4090:               distfiles are downloaded, how the packages are built
        !          4091:               and how the report is generated. You can find an
        !          4092:               annotated example file in <code xmlns=
        !          4093:               "http://www.w3.org/TR/xhtml1/transitional" class=
        !          4094:               "filename">pkgsrc/mk/bulk/build.conf-example</code>.
        !          4095:               To use it, copy <code xmlns=
        !          4096:               "http://www.w3.org/TR/xhtml1/transitional" class=
        !          4097:               "filename">build.conf-example</code> to <code xmlns=
        !          4098:               "http://www.w3.org/TR/xhtml1/transitional" class=
        !          4099:               "filename">build.conf</code> and edit it, following
        !          4100:               the comments in that file.</p>
        !          4101:             </div>
        !          4102: 
        !          4103:             <div class="sect3" lang="en">
        !          4104:               <div class="titlepage">
        !          4105:                 <div>
        !          4106:                   <div>
        !          4107:                     <h4 class="title"><a name=
        !          4108:                     "binary.mk.conf"></a>6.3.1.2.&nbsp;/etc/mk.conf</h4>
1.1       grant    4109:                   </div>
                   4110:                 </div>
                   4111:               </div>
                   4112: 
1.45      wiz      4113:               <p>You may want to set variables in <code xmlns=
                   4114:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4115:               "filename">/etc/mk.conf</code>. Look at <code xmlns=
                   4116:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4117:               "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1       grant    4118:               details of the default settings. You will want to
1.14      xtraeme  4119:               ensure that <code class=
                   4120:               "varname">ACCEPTABLE_LICENSES</code> meet your local
                   4121:               policy. As used in this example, <code class=
                   4122:               "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1       grant    4123:               "emphasis"><em>all</em></span> licenses.</p>
                   4124:               <pre class="programlisting">
1.51      rillig   4125:     PACKAGES?=      ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
                   4126:     WRKOBJDIR?=     /usr/tmp/pkgsrc   # build here instead of in pkgsrc
                   4127:     BSDSRCDIR=      /usr/src
                   4128:     BSDXSRCDIR=     /usr/xsrc         # for x11/xservers
                   4129:     OBJHOSTNAME?=   yes               # use work.`hostname`
                   4130:     FAILOVER_FETCH= yes               # insist on the correct checksum
                   4131:     PKG_DEVELOPER?= yes
                   4132:     _ACCEPTABLE=    yes
1.1       grant    4133: </pre>
                   4134: 
1.63    ! dillo    4135:               <p>Some options that are especially useful for bulk
        !          4136:               builds can be found at the top lines of the file
        !          4137:               <code xmlns=
        !          4138:               "http://www.w3.org/TR/xhtml1/transitional" class=
        !          4139:               "filename">mk/bulk/bsd.bulk-pkg.mk</code>. The most
        !          4140:               useful options of these are briefly described
        !          4141:               here.</p>
        !          4142: 
        !          4143:               <div class="itemizedlist">
        !          4144:                 <ul type="disc">
        !          4145:                   <li>
        !          4146:                     <p>If you are on a slow machine, you may want
        !          4147:                     to set <code class=
        !          4148:                     "varname">USE_BULK_BROKEN_CHECK</code> to
        !          4149:                     &#8220;<span class=
        !          4150:                     "quote">no</span>&#8221;.</p>
        !          4151:                   </li>
        !          4152: 
        !          4153:                   <li>
        !          4154:                     <p>If you are doing bulk builds from a
        !          4155:                     read-only copy of pkgsrc, you have to set
        !          4156:                     <code class="varname">BULKFILESDIR</code> to
        !          4157:                     the directory where all log files are created.
        !          4158:                     Otherwise the log files are created in the
        !          4159:                     pkgsrc directory.</p>
        !          4160:                   </li>
        !          4161: 
        !          4162:                   <li>
        !          4163:                     <p>Another important variable is <code class=
        !          4164:                     "varname">BULK_PREREQ</code>, which is a list
        !          4165:                     of packages that should be always available
        !          4166:                     while building other packages.</p>
        !          4167:                   </li>
        !          4168:                 </ul>
1.1       grant    4169:               </div>
                   4170:             </div>
                   4171: 
1.63    ! dillo    4172:             <div class="sect3" lang="en">
1.1       grant    4173:               <div class="titlepage">
                   4174:                 <div>
                   4175:                   <div>
1.63    ! dillo    4176:                     <h4 class="title"><a name=
1.45      wiz      4177:                     "pre-build.local"></a>6.3.1.3.&nbsp;<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4178:                     class="filename">pre-build.local</code></h4>
1.1       grant    4179:                   </div>
                   4180:                 </div>
                   4181:               </div>
                   4182: 
                   4183:               <p>It is possible to configure the bulk build to
1.47      reed     4184:               perform certain site-specific tasks at the end of the
1.45      wiz      4185:               pre-build stage. If the file <code xmlns=
                   4186:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4187:               "filename">pre-build.local</code> exists in
1.45      wiz      4188:               <code xmlns=
                   4189:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4190:               "filename">/usr/pkgsrc/mk/bulk</code>, it will be
                   4191:               executed (as a <a href=
1.24      wiz      4192:               "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
                   4193:               <span class="citerefentry"><span class=
                   4194:               "refentrytitle">sh</span>(1)</span></a> script) at
                   4195:               the end of the usual pre-build stage. An example use
1.45      wiz      4196:               of <code xmlns=
                   4197:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4198:               "filename">pre-build.local</code> is to have the
                   4199:               line:</p>
1.1       grant    4200:               <pre class="screen">
1.14      xtraeme  4201: <code class="prompt">#</code> <strong class=
                   4202: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23      wiz      4203:     &gt; pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1       grant    4204: </pre>
                   4205: 
                   4206:               <p>to prevent the system from trying to build a
                   4207:               particular package which requires nearly 3 GB of disk
                   4208:               space.</p>
                   4209:             </div>
                   4210:           </div>
                   4211: 
1.63    ! dillo    4212:           <div class="sect2" lang="en">
1.1       grant    4213:             <div class="titlepage">
                   4214:               <div>
                   4215:                 <div>
1.30      wiz      4216:                   <h3 class="title"><a name=
1.38      dillo    4217:                   "other-environmental-considerations"></a>6.3.2.&nbsp;Other
1.30      wiz      4218:                   environmental considerations</h3>
1.1       grant    4219:                 </div>
                   4220:               </div>
                   4221:             </div>
                   4222: 
1.45      wiz      4223:             <p>As <code xmlns=
                   4224:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4225:             "filename">/usr/pkg</code> will be completely deleted
                   4226:             at the start of bulk builds, make sure your login shell
                   4227:             is placed somewhere else. Either drop it into
                   4228:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4229:             class="filename">/usr/local/bin</code> (and adjust your
                   4230:             login shell in the passwd file), or (re-)install it via
1.14      xtraeme  4231:             <a href=
1.1       grant    4232:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   4233:             <span class="citerefentry"><span class=
                   4234:             "refentrytitle">pkg_add</span>(1)</span></a> from
1.45      wiz      4235:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4236:             class="filename">/etc/rc.local</code>, so you can login
                   4237:             after a reboot (remember that your current process
                   4238:             won't die if the package is removed, you just can't
                   4239:             start any new instances of the shell any more). Also,
                   4240:             if you use NetBSD earlier than 1.5, or you still want
                   4241:             to use the pkgsrc version of ssh for some reason, be
                   4242:             sure to install ssh before starting it from
                   4243:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4244:             class="filename">rc.local</code>:</p>
1.1       grant    4245:             <pre class="programlisting">
1.51      rillig   4246:     ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
                   4247:     if [ -f /usr/pkg/etc/rc.d/sshd ]; then
                   4248:         /usr/pkg/etc/rc.d/sshd
                   4249:     fi
1.1       grant    4250: </pre>
                   4251: 
                   4252:             <p>Not doing so will result in you being not able to
                   4253:             log in via ssh after the bulk build is finished or if
                   4254:             the machine gets rebooted or crashes. You have been
                   4255:             warned! :)</p>
                   4256:           </div>
                   4257: 
1.63    ! dillo    4258:           <div class="sect2" lang="en">
1.1       grant    4259:             <div class="titlepage">
                   4260:               <div>
                   4261:                 <div>
1.63    ! dillo    4262:                   <h3 class="title"><a name=
1.38      dillo    4263:                   "operation"></a>6.3.3.&nbsp;Operation</h3>
1.1       grant    4264:                 </div>
                   4265:               </div>
                   4266:             </div>
                   4267: 
                   4268:             <p>Make sure you don't need any of the packages still
                   4269:             installed.</p>
                   4270: 
                   4271:             <div class="warning" style=
                   4272:             "margin-left: 0.5in; margin-right: 0.5in;">
                   4273:               <h3 class="title">Warning</h3>
                   4274: 
                   4275:               <p>During the bulk build, <span class=
                   4276:               "emphasis"><em>all packages will be
                   4277:               removed!</em></span></p>
                   4278:             </div>
                   4279: 
                   4280:             <p>Be sure to remove all other things that might
                   4281:             interfere with builds, like some libs installed in
1.45      wiz      4282:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4283:             class="filename">/usr/local</code>, etc. then become
                   4284:             root and type:</p>
1.1       grant    4285:             <pre class="screen">
1.14      xtraeme  4286: <code class="prompt">#</code> <strong class=
                   4287: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   4288: <code class="prompt">#</code> <strong class=
                   4289: "userinput"><code>sh mk/bulk/build</code></strong>
1.1       grant    4290: </pre>
                   4291: 
                   4292:             <p>If for some reason your last build didn't complete
                   4293:             (power failure, system panic, ...), you can continue it
                   4294:             by running:</p>
                   4295:             <pre class="screen">
1.14      xtraeme  4296: <code class="prompt">#</code> <strong class=
                   4297: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1       grant    4298: </pre>
                   4299: 
                   4300:             <p>At the end of the bulk build, you will get a summary
                   4301:             via mail, and find build logs in the directory
1.14      xtraeme  4302:             specified by <code class="varname">FTP</code> in the
1.45      wiz      4303:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4304:             class="filename">build.conf</code> file.</p>
1.1       grant    4305:           </div>
                   4306: 
1.63    ! dillo    4307:           <div class="sect2" lang="en">
1.1       grant    4308:             <div class="titlepage">
                   4309:               <div>
                   4310:                 <div>
1.63    ! dillo    4311:                   <h3 class="title"><a name=
1.38      dillo    4312:                   "what-it-does"></a>6.3.4.&nbsp;What it does</h3>
1.1       grant    4313:                 </div>
                   4314:               </div>
                   4315:             </div>
                   4316: 
                   4317:             <p>The bulk builds consist of three steps:</p>
                   4318: 
                   4319:             <div class="variablelist">
                   4320:               <dl>
                   4321:                 <dt><span class="term">1. pre-build</span></dt>
                   4322: 
                   4323:                 <dd>
                   4324:                   <p>The script updates your pkgsrc tree via
                   4325:                   (anon)cvs, then cleans out any broken distfiles,
                   4326:                   and removes all packages installed.</p>
                   4327:                 </dd>
                   4328: 
                   4329:                 <dt><span class="term">2. the bulk
                   4330:                 build</span></dt>
                   4331: 
                   4332:                 <dd>
                   4333:                   <p>This is basically &#8220;<span class=
                   4334:                   "quote">make bulk-package</span>&#8221; with an
                   4335:                   optimised order in which packages will be built.
                   4336:                   Packages that don't require other packages will
                   4337:                   be built first, and packages with many
                   4338:                   dependencies will be built later.</p>
                   4339:                 </dd>
                   4340: 
                   4341:                 <dt><span class="term">3. post-build</span></dt>
                   4342: 
                   4343:                 <dd>
                   4344:                   <p>Generates a report that's placed in the
1.45      wiz      4345:                   directory specified in the <code xmlns=
                   4346:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4347:                   "filename">build.conf</code> file named
1.45      wiz      4348:                   <code xmlns=
                   4349:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4350:                   "filename">broken.html</code>, a short version of
                   4351:                   that report will also be mailed to the build's
                   4352:                   admin.</p>
1.1       grant    4353:                 </dd>
                   4354:               </dl>
                   4355:             </div>
                   4356: 
                   4357:             <p>During the build, a list of broken packages will be
1.45      wiz      4358:             compiled in <code xmlns=
                   4359:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4360:             "filename">/usr/pkgsrc/.broken</code> (or <code xmlns=
                   4361:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4362:             "filename">.../.broken.${MACHINE}</code> if
                   4363:             <code class="varname">OBJMACHINE</code> is set),
                   4364:             individual build logs of broken builds can be found in
                   4365:             the package's directory. These files are used by the
                   4366:             bulk-targets to mark broken builds to not waste time
                   4367:             trying to rebuild them, and they can be used to debug
                   4368:             these broken package builds later.</p>
1.1       grant    4369:           </div>
                   4370: 
1.63    ! dillo    4371:           <div class="sect2" lang="en">
1.1       grant    4372:             <div class="titlepage">
                   4373:               <div>
                   4374:                 <div>
1.30      wiz      4375:                   <h3 class="title"><a name=
1.38      dillo    4376:                   "disk-space-requirements"></a>6.3.5.&nbsp;Disk
1.30      wiz      4377:                   space requirements</h3>
1.1       grant    4378:                 </div>
                   4379:               </div>
                   4380:             </div>
                   4381: 
                   4382:             <p>Currently, roughly the following requirements are
                   4383:             valid for NetBSD 2.0/i386:</p>
                   4384: 
                   4385:             <div class="itemizedlist">
                   4386:               <ul type="disc">
                   4387:                 <li>
                   4388:                   <p>10 GB - distfiles (NFS ok)</p>
                   4389:                 </li>
                   4390: 
                   4391:                 <li>
                   4392:                   <p>8 GB - full set of all binaries (NFS ok)</p>
                   4393:                 </li>
                   4394: 
                   4395:                 <li>
                   4396:                   <p>5 GB - temp space for compiling (local disk
                   4397:                   recommended)</p>
                   4398:                 </li>
                   4399:               </ul>
                   4400:             </div>
                   4401: 
                   4402:             <p>Note that all pkgs will be de-installed as soon as
                   4403:             they are turned into a binary package, and that sources
                   4404:             are removed, so there is no excessively huge demand to
                   4405:             disk space. Afterwards, if the package is needed again,
                   4406:             it will be installed via <a href=
                   4407:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   4408:             <span class="citerefentry"><span class=
                   4409:             "refentrytitle">pkg_add</span>(1)</span></a> instead of
                   4410:             building again, so there are no cycles wasted by
                   4411:             recompiling.</p>
                   4412:           </div>
                   4413: 
1.63    ! dillo    4414:           <div class="sect2" lang="en">
1.1       grant    4415:             <div class="titlepage">
                   4416:               <div>
                   4417:                 <div>
1.63    ! dillo    4418:                   <h3 class="title"><a name=
        !          4419:                   "setting-up-a-sandbox"></a>6.3.6.&nbsp;Setting up
        !          4420:                   a sandbox for chrooted builds</h3>
1.1       grant    4421:                 </div>
                   4422:               </div>
                   4423:             </div>
                   4424: 
1.12      agc      4425:             <p>If you don't want all the packages nuked from a
                   4426:             machine (rendering it useless for anything but pkg
1.23      wiz      4427:             compiling), there is the possibility of doing the
                   4428:             package bulk build inside a chroot environment.</p>
1.12      agc      4429: 
                   4430:             <p>The first step is to set up a chroot sandbox, e.g.
1.45      wiz      4431:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4432:             class="filename">/usr/sandbox</code>. This can be done
                   4433:             by using null mounts, or manually.</p>
1.12      agc      4434: 
1.45      wiz      4435:             <p>There is a shell script called <code xmlns=
                   4436:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4437:             "filename">pkgsrc/mk/bulk/mksandbox</code> which will
                   4438:             set up the sandbox environment using null mounts. It
1.45      wiz      4439:             will also create a script called <code xmlns=
                   4440:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4441:             "filename">sandbox</code> in the root of the sandbox
1.12      agc      4442:             environment, which will allow the null mounts to be
1.14      xtraeme  4443:             activated using the <span><strong class=
                   4444:             "command">sandbox mount</strong></span> command and
                   4445:             deactivated using the <span><strong class=
                   4446:             "command">sandbox umount</strong></span> command.</p>
1.12      agc      4447: 
                   4448:             <p>To set up a sandbox environment by hand, after
                   4449:             extracting all the sets from a NetBSD installation or
1.14      xtraeme  4450:             doing a <span><strong class="command">make distribution
1.45      wiz      4451:             DESTDIR=/usr/sandbox</strong></span> in <code xmlns=
                   4452:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4453:             "filename">/usr/src/etc</code>, be sure the following
1.7       wiz      4454:             items are present and properly configured:</p>
1.1       grant    4455: 
                   4456:             <div class="procedure">
                   4457:               <ol type="1">
                   4458:                 <li>
                   4459:                   <p>Kernel</p>
                   4460:                   <pre class="screen">
1.14      xtraeme  4461: <code class="prompt">#</code> <strong class=
                   4462: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1       grant    4463: </pre>
                   4464:                 </li>
                   4465: 
                   4466:                 <li>
1.45      wiz      4467:                   <p><code xmlns=
                   4468:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4469:                   "filename">/dev/*</code></p>
1.1       grant    4470:                   <pre class="screen">
1.14      xtraeme  4471: <code class="prompt">#</code> <strong class=
                   4472: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1       grant    4473: </pre>
                   4474:                 </li>
                   4475: 
                   4476:                 <li>
1.45      wiz      4477:                   <p><code xmlns=
                   4478:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4479:                   "filename">/etc/resolv.conf</code> (for <a xmlns=
1.1       grant    4480:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   4481:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45      wiz      4482:                   target="_top"><code xmlns="" class=
                   4483:                   "filename">security/smtpd</code></a> and
                   4484:                   mail):</p>
1.1       grant    4485:                   <pre class="screen">
1.14      xtraeme  4486: <code class="prompt">#</code> <strong class=
                   4487: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1       grant    4488: </pre>
                   4489:                 </li>
                   4490: 
                   4491:                 <li>
                   4492:                   <p>Working(!) mail config (hostname,
                   4493:                   sendmail.cf):</p>
                   4494:                   <pre class="screen">
1.14      xtraeme  4495: <code class="prompt">#</code> <strong class=
                   4496: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1       grant    4497: </pre>
                   4498:                 </li>
                   4499: 
                   4500:                 <li>
1.45      wiz      4501:                   <p><code xmlns=
                   4502:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4503:                   "filename">/etc/localtime</code> (for <a xmlns=
1.1       grant    4504:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   4505:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45      wiz      4506:                   target="_top"><code xmlns="" class=
                   4507:                   "filename">security/smtpd</code></a>):</p>
1.1       grant    4508:                   <pre class="screen">
1.14      xtraeme  4509: <code class="prompt">#</code> <strong class=
                   4510: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1       grant    4511: </pre>
                   4512:                 </li>
                   4513: 
                   4514:                 <li>
1.45      wiz      4515:                   <p><code xmlns=
                   4516:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4517:                   "filename">/usr/src</code> (system sources, for
                   4518:                   <a xmlns=
1.1       grant    4519:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   4520:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.45      wiz      4521:                   target="_top"><code xmlns="" class=
                   4522:                   "filename">sysutils/aperture</code></a>,
                   4523:                   <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4524:                   href=
1.20      ben      4525:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
1.45      wiz      4526:                   target="_top"><code xmlns="" class=
                   4527:                   "filename">net/ppp-mppe</code></a>):</p>
1.1       grant    4528:                   <pre class="screen">
1.14      xtraeme  4529: <code class="prompt">#</code> <strong class=
                   4530: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
                   4531: <code class="prompt">#</code> <strong class=
1.23      wiz      4532: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1       grant    4533: </pre>
                   4534:                 </li>
                   4535: 
                   4536:                 <li>
1.45      wiz      4537:                   <p>Create <code xmlns=
                   4538:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4539:                   "filename">/var/db/pkg</code> (not part of
                   4540:                   default install):</p>
1.1       grant    4541:                   <pre class="screen">
1.14      xtraeme  4542: <code class="prompt">#</code> <strong class=
                   4543: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1       grant    4544: </pre>
                   4545:                 </li>
                   4546: 
                   4547:                 <li>
1.45      wiz      4548:                   <p>Create <code xmlns=
                   4549:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4550:                   "filename">/usr/pkg</code> (not part of default
                   4551:                   install):</p>
1.1       grant    4552:                   <pre class="screen">
1.14      xtraeme  4553: <code class="prompt">#</code> <strong class=
                   4554: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1       grant    4555: </pre>
                   4556:                 </li>
                   4557: 
                   4558:                 <li>
1.45      wiz      4559:                   <p>Checkout pkgsrc via cvs into <code xmlns=
                   4560:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4561:                   "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1       grant    4562:                   <pre class="screen">
1.14      xtraeme  4563: <code class="prompt">#</code> <strong class=
                   4564: "userinput"><code>cd /usr/sandbox/usr</code></strong>
                   4565: <code class="prompt">#</code> <strong class=
                   4566: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1       grant    4567: </pre>
                   4568: 
                   4569:                   <p>Do not mount/link this to the copy of your
                   4570:                   pkgsrc tree you do development in, as this will
                   4571:                   likely cause problems!</p>
                   4572:                 </li>
                   4573: 
                   4574:                 <li>
1.45      wiz      4575:                   <p>Make <code xmlns=
                   4576:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4577:                   "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.45      wiz      4578:                   and <code xmlns=
                   4579:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4580:                   "filename">.../distfiles</code> point somewhere
                   4581:                   appropriate. NFS- and/or nullfs-mounts may come
                   4582:                   in handy!</p>
1.1       grant    4583:                 </li>
                   4584: 
                   4585:                 <li>
1.45      wiz      4586:                   <p>Edit <code xmlns=
                   4587:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4588:                   "filename">/etc/mk.conf</code>, see <a href=
                   4589:                   "#binary.mk.conf" title=
1.63    ! dillo    4590:                   "6.3.1.2.&nbsp;/etc/mk.conf">Section&nbsp;6.3.1.2,
1.1       grant    4591:                   &#8220;/etc/mk.conf&#8221;</a>.</p>
                   4592:                 </li>
                   4593: 
                   4594:                 <li>
1.45      wiz      4595:                   <p>Adjust <code xmlns=
                   4596:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4597:                   "filename">mk/bulk/build.conf</code> to suit your
1.1       grant    4598:                   needs.</p>
                   4599:                 </li>
                   4600: 
                   4601:                 <li>
1.14      xtraeme  4602:                   <p>If you have set <code class=
1.45      wiz      4603:                   "varname">CVS_USER</code> in <code xmlns=
                   4604:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4605:                   "filename">build.conf</code>, make sure that
                   4606:                   account exists and can do a <span><strong class=
                   4607:                   "command">cvs ${CVS_FLAGS} update</strong></span>
1.1       grant    4608:                   properly!</p>
                   4609:                 </li>
                   4610:               </ol>
                   4611:             </div>
                   4612: 
1.47      reed     4613:             <p>When the chroot sandbox is set up, you can start the
1.1       grant    4614:             build with the following steps:</p>
                   4615:             <pre class="screen">
1.14      xtraeme  4616: <code class="prompt">#</code> <strong class=
                   4617: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
                   4618: <code class="prompt">#</code> <strong class=
                   4619: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1       grant    4620: </pre>
                   4621: 
                   4622:             <p>This will just jump inside the sandbox and start
                   4623:             building. At the end of the build, mail will be sent
                   4624:             with the results of the build. Created binary pkgs will
1.45      wiz      4625:             be in <code xmlns=
                   4626:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4627:             "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1       grant    4628:             (wherever that points/mounts to/from).</p>
                   4629:           </div>
                   4630: 
1.63    ! dillo    4631:           <div class="sect2" lang="en">
1.1       grant    4632:             <div class="titlepage">
                   4633:               <div>
                   4634:                 <div>
1.30      wiz      4635:                   <h3 class="title"><a name=
1.38      dillo    4636:                   "building-a-partial-set"></a>6.3.7.&nbsp;Building
1.30      wiz      4637:                   a partial set of packages</h3>
1.1       grant    4638:                 </div>
                   4639:               </div>
                   4640:             </div>
                   4641: 
                   4642:             <p>In addition to building a complete set of all
1.45      wiz      4643:             packages in pkgsrc, the <code xmlns=
                   4644:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4645:             "filename">pkgsrc/mk/bulk/build</code> script may be
                   4646:             used to build a subset of the packages contained in
1.47      reed     4647:             pkgsrc. By setting <code class=
1.45      wiz      4648:             "varname">SPECIFIC_PKGS</code> in <code xmlns=
                   4649:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4650:             "filename">/etc/mk.conf</code>, the variables</p>
1.1       grant    4651: 
                   4652:             <div class="itemizedlist">
                   4653:               <ul type="disc">
                   4654:                 <li>
                   4655:                   <p>SITE_SPECIFIC_PKGS</p>
                   4656:                 </li>
                   4657: 
                   4658:                 <li>
                   4659:                   <p>HOST_SPECIFIC_PKGS</p>
                   4660:                 </li>
                   4661: 
                   4662:                 <li>
                   4663:                   <p>GROUP_SPECIFIC_PKGS</p>
                   4664:                 </li>
                   4665: 
                   4666:                 <li>
                   4667:                   <p>USER_SPECIFIC_PKGS</p>
                   4668:                 </li>
                   4669:               </ul>
                   4670:             </div>
                   4671: 
                   4672:             <p>will define the set of packages which should be
                   4673:             built. The bulk build code will also include any
                   4674:             packages which are needed as dependencies for the
                   4675:             explicitly listed packages.</p>
                   4676: 
                   4677:             <p>One use of this is to do a bulk build with
1.14      xtraeme  4678:             <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1       grant    4679:             sandbox periodically to have a complete set of the
                   4680:             binary packages needed for your site available without
                   4681:             the overhead of building extra packages that are not
                   4682:             needed.</p>
                   4683:           </div>
1.13      hubertf  4684: 
1.63    ! dillo    4685:           <div class="sect2" lang="en">
1.13      hubertf  4686:             <div class="titlepage">
                   4687:               <div>
                   4688:                 <div>
1.63    ! dillo    4689:                   <h3 class="title"><a name=
1.38      dillo    4690:                   "bulk-upload"></a>6.3.8.&nbsp;Uploading results
1.13      hubertf  4691:                   of a bulk build</h3>
                   4692:                 </div>
                   4693:               </div>
                   4694:             </div>
                   4695: 
                   4696:             <p>This section describes how pkgsrc developers can
                   4697:             upload binary pkgs built by bulk builds to
                   4698:             ftp.NetBSD.org.</p>
                   4699: 
1.17      sketch   4700:             <p>If you would like to automatically create checksum
                   4701:             files for the binary packages you intend to upload,
                   4702:             remember to set <code class="varname">MKSUMS=yes</code>
1.45      wiz      4703:             in your <code xmlns=
                   4704:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.17      sketch   4705:             "filename">mk/bulk/build.conf</code>.</p>
                   4706: 
                   4707:             <p>If you would like to PGP sign the checksum files
                   4708:             (highly recommended!), remember to set <code class=
                   4709:             "varname">SIGN_AS=username@NetBSD.org</code> in your
1.45      wiz      4710:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4711:             class="filename">mk/bulk/build.conf</code>. This will
                   4712:             prompt you for your GPG password to sign the files
1.17      sketch   4713:             before uploading everything.</p>
                   4714: 
                   4715:             <p>Then, make sure that you have <code class=
1.14      xtraeme  4716:             "varname">RSYNC_DST</code> set properly in your
1.45      wiz      4717:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4718:             class="filename">mk/bulk/build.conf</code> file, i.e.
                   4719:             adjust it to something like one of the following:</p>
1.13      hubertf  4720:             <pre class="screen">
                   4721: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   4722: </pre>
                   4723: 
1.47      reed     4724:             <p>Please use appropriate values for "pkgsrc-200xQy",
1.13      hubertf  4725:             "NetBSD-a.b.c" and "arch" here. If your login on
1.14      xtraeme  4726:             ftp.NetBSD.org is different from <code class=
                   4727:             "varname">CVS_USER</code>, write your login directly
                   4728:             into the variable, e.g. my local account is "feyrer",
                   4729:             but for my login "hubertf", I use:</p>
1.13      hubertf  4730:             <pre class="screen">
                   4731: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   4732: </pre>
                   4733: 
1.45      wiz      4734:             <p>A separate <code xmlns=
                   4735:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4736:             "filename">upload</code> directory is used here to
                   4737:             allow "closing" the directory during upload. To do so,
                   4738:             run the following command on ftp.NetBSD.org next:</p>
1.13      hubertf  4739:             <pre class="screen">
1.14      xtraeme  4740: nbftp% <strong class=
                   4741: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13      hubertf  4742: </pre>
                   4743: 
1.45      wiz      4744:             <p>Please note that <code xmlns=
                   4745:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4746:             "filename">/pub/NetBSD/packages</code> is only
1.13      hubertf  4747:             appropriate for packages for the NetBSD operating
                   4748:             system. Binary packages for other operating systems
1.45      wiz      4749:             should go into <code xmlns=
                   4750:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4751:             "filename">/pub/pkgsrc</code>.</p>
1.13      hubertf  4752: 
                   4753:             <p>Before uploading the binary pkgs, ssh authentication
1.47      reed     4754:             needs to be set up. This example shows how to set up
1.13      hubertf  4755:             temporary keys for the root account <span class=
                   4756:             "emphasis"><em>inside the sandbox</em></span> (assuming
                   4757:             that no keys should be present there usually):</p>
                   4758:             <pre class="screen">
1.14      xtraeme  4759: <code class="prompt">#</code> <strong class=
                   4760: "userinput"><code>chroot /usr/sandbox</code></strong>        
                   4761: chroot-<code class="prompt">#</code> <strong class=
                   4762: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>        
                   4763: chroot-<code class="prompt">#</code> <strong class=
                   4764: "userinput"><code>ssh-keygen -t dsa</code></strong>        
                   4765: chroot-<code class="prompt">#</code> <strong class=
                   4766: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong> 
1.13      hubertf  4767: </pre>
                   4768: 
1.45      wiz      4769:             <p>Now take the output of <code xmlns=
                   4770:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4771:             "filename">id-dsa.pub</code> and append it to your
1.45      wiz      4772:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4773:             class="filename">~/.ssh/authorized_keys</code> file on
                   4774:             ftp.NetBSD.org. You can remove the key after the upload
                   4775:             is done!</p>
1.13      hubertf  4776: 
                   4777:             <p>Next, test if your ssh connection really works:</p>
                   4778:             <pre class="screen">
1.14      xtraeme  4779: chroot-<code class="prompt">#</code> <strong class=
                   4780: "userinput"><code>ssh ftp.NetBSD.org date</code></strong> 
1.13      hubertf  4781: </pre>
                   4782: 
                   4783:             <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
                   4784: 
                   4785:             <p>Now after all this works, you can exit the sandbox
                   4786:             and start the upload:</p>
                   4787:             <pre class="screen">
1.14      xtraeme  4788: chroot-<code class="prompt">#</code> <strong class=
                   4789: "userinput"><code>exit</code></strong>        
                   4790: <code class="prompt">#</code> <strong class=
                   4791: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>        
                   4792: <code class="prompt">#</code> <strong class=
                   4793: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong> 
1.13      hubertf  4794: </pre>
                   4795: 
                   4796:             <p>The upload process may take quite some time. Use
1.24      wiz      4797:             <a href=
                   4798:             "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
                   4799:             <span class="citerefentry"><span class=
                   4800:             "refentrytitle">ls</span>(1)</span></a> or <a href=
                   4801:             "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
                   4802:             <span class="citerefentry"><span class=
                   4803:             "refentrytitle">du</span>(1)</span></a> on the FTP
                   4804:             server to monitor progress of the upload. The upload
                   4805:             script will take care of not uploading restricted
                   4806:             packages and putting vulnerable packages into the
1.45      wiz      4807:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4808:             class="filename">vulnerable</code> subdirectory.</p>
1.13      hubertf  4809: 
                   4810:             <p>After the upload has ended, first thing is to revoke
                   4811:             ssh access:</p>
                   4812:             <pre class="screen">
1.14      xtraeme  4813: nbftp% <strong class=
                   4814: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13      hubertf  4815: Gdd:x! 
                   4816: </pre>
                   4817: 
                   4818:             <p>Use whatever is needed to remove the key you've
                   4819:             entered before! Last, move the uploaded packages out of
1.45      wiz      4820:             the <code xmlns=
                   4821:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4822:             "filename">upload</code> directory to have them
                   4823:             accessible to everyone:</p>
1.13      hubertf  4824:             <pre class="screen">
1.14      xtraeme  4825: nbftp% <strong class=
                   4826: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
                   4827: nbftp% <strong class=
                   4828: "userinput"><code>mv upload/* .</code></strong>
                   4829: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
                   4830: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong> 
1.13      hubertf  4831: </pre>
                   4832:           </div>
1.1       grant    4833:         </div>
                   4834: 
1.63    ! dillo    4835:         <div class="sect1" lang="en">
1.1       grant    4836:           <div class="titlepage">
                   4837:             <div>
                   4838:               <div>
                   4839:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    4840:                 "creating-cdroms"></a>6.4.&nbsp;Creating a multiple
1.30      wiz      4841:                 CD-ROM packages collection</h2>
1.1       grant    4842:               </div>
                   4843:             </div>
                   4844:           </div>
                   4845: 
                   4846:           <p>After your pkgsrc bulk-build has completed, you may
                   4847:           wish to create a CD-ROM set of the resulting binary
                   4848:           packages to assist in installing packages on other
                   4849:           machines. The <a xmlns=
                   4850:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4851:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.45      wiz      4852:           target="_top"><code xmlns="" class=
                   4853:           "filename">pkgtools/cdpack</code></a> package provides a
1.20      ben      4854:           simple tool for creating the ISO 9660 images.
                   4855:           <span><strong class="command">cdpack</strong></span>
                   4856:           arranges the packages on the CD-ROMs in a way that keeps
1.47      reed     4857:           all the dependencies for a given package on the same CD
                   4858:           as that package.</p>
1.1       grant    4859: 
1.63    ! dillo    4860:           <div class="sect2" lang="en">
1.1       grant    4861:             <div class="titlepage">
                   4862:               <div>
                   4863:                 <div>
1.63    ! dillo    4864:                   <h3 class="title"><a name=
1.38      dillo    4865:                   "cdpack-example"></a>6.4.1.&nbsp;Example of
1.1       grant    4866:                   cdpack</h3>
                   4867:                 </div>
                   4868:               </div>
                   4869:             </div>
                   4870: 
                   4871:             <p>Complete documentation for cdpack is found in the
1.47      reed     4872:             cdpack(1) man page. The following short example assumes
1.45      wiz      4873:             that the binary packages are left in <code xmlns=
                   4874:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4875:             "filename">/usr/pkgsrc/packages/All</code> and that
1.45      wiz      4876:             sufficient disk space exists in <code xmlns=
                   4877:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4878:             "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1       grant    4879:             <pre class="screen">
1.14      xtraeme  4880: <code class="prompt">#</code> <strong class=
                   4881: "userinput"><code>mkdir /u2/images</code></strong>
                   4882: <code class="prompt">#</code> <strong class=
                   4883: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
                   4884: <code class="prompt">#</code> <strong class=
                   4885: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    4886: </pre>
                   4887: 
                   4888:             <p>If you wish to include a common set of files
1.45      wiz      4889:             (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4890:             class="filename">COPYRIGHT</code>, <code xmlns=
                   4891:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4892:             "filename">README</code>, etc.) on each CD in the
1.1       grant    4893:             collection, then you need to create a directory which
                   4894:             contains these files. e.g.</p>
                   4895:             <pre class="screen">
1.14      xtraeme  4896: <code class="prompt">#</code> <strong class=
                   4897: "userinput"><code>mkdir /tmp/common</code></strong>
                   4898: <code class="prompt">#</code> <strong class=
                   4899: "userinput"><code>echo "This is a README" &gt; /tmp/common/README</code></strong>
                   4900: <code class="prompt">#</code> <strong class=
                   4901: "userinput"><code>echo "Another file" &gt; /tmp/common/COPYING</code></strong>
                   4902: <code class="prompt">#</code> <strong class=
                   4903: "userinput"><code>mkdir /tmp/common/bin</code></strong>
                   4904: <code class="prompt">#</code> <strong class=
                   4905: "userinput"><code>echo "#!/bin/sh" &gt; /tmp/common/bin/myscript</code></strong>
                   4906: <code class="prompt">#</code> <strong class=
                   4907: "userinput"><code>echo "echo Hello world" &gt;&gt; /tmp/common/bin/myscript</code></strong>
                   4908: <code class="prompt">#</code> <strong class=
                   4909: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1       grant    4910: </pre>
                   4911: 
                   4912:             <p>Now create the images:</p>
                   4913:             <pre class="screen">
1.14      xtraeme  4914: <code class="prompt">#</code> <strong class=
                   4915: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    4916: </pre>
                   4917: 
1.45      wiz      4918:             <p>Each image will contain <code xmlns=
                   4919:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4920:             "filename">README</code>, <code xmlns=
                   4921:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4922:             "filename">COPYING</code>, and <code xmlns=
                   4923:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4924:             "filename">bin/myscript</code> in their root
1.1       grant    4925:             directories.</p>
                   4926:           </div>
                   4927:         </div>
                   4928:       </div>
                   4929: 
1.63    ! dillo    4930:       <div class="chapter" lang="en">
1.1       grant    4931:         <div class="titlepage">
                   4932:           <div>
                   4933:             <div>
1.63    ! dillo    4934:               <h2 class="title"><a name=
1.38      dillo    4935:               "faq"></a>Chapter&nbsp;7.&nbsp;Frequently Asked
1.1       grant    4936:               Questions</h2>
                   4937:             </div>
                   4938:           </div>
                   4939:         </div>
                   4940: 
                   4941:         <div class="toc">
                   4942:           <p><b>Table of Contents</b></p>
                   4943: 
                   4944:           <dl>
1.30      wiz      4945:             <dt><span class="sect1"><a href=
1.38      dillo    4946:             "#mailing-list-pointers">7.1. Are there any mailing
1.30      wiz      4947:             lists for pkg-related discussion?</a></span></dt>
1.1       grant    4948: 
1.38      dillo    4949:             <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1       grant    4950:             Where's the pkgviews documentation?</a></span></dt>
                   4951: 
1.38      dillo    4952:             <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1       grant    4953:             Utilities for package management
                   4954:             (pkgtools)</a></span></dt>
                   4955: 
1.38      dillo    4956:             <dt><span class="sect1"><a href="#non-root-pkgsrc">7.4.
1.30      wiz      4957:             How to use pkgsrc as non-root</a></span></dt>
1.1       grant    4958: 
1.30      wiz      4959:             <dt><span class="sect1"><a href=
1.38      dillo    4960:             "#resume-transfers">7.5. How to resume transfers when
1.30      wiz      4961:             fetching distfiles?</a></span></dt>
1.14      xtraeme  4962: 
1.30      wiz      4963:             <dt><span class="sect1"><a href=
1.38      dillo    4964:             "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30      wiz      4965:             XFree86 from pkgsrc?</a></span></dt>
1.1       grant    4966: 
1.30      wiz      4967:             <dt><span class="sect1"><a href=
1.38      dillo    4968:             "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30      wiz      4969:             from pkgsrc?</a></span></dt>
1.1       grant    4970: 
1.30      wiz      4971:             <dt><span class="sect1"><a href=
1.38      dillo    4972:             "#fetch-behind-firewall">7.8. How to fetch files from
1.30      wiz      4973:             behind a firewall</a></span></dt>
1.1       grant    4974: 
1.38      dillo    4975:             <dt><span class="sect1"><a href="#passive-ftp">7.9. How
1.14      xtraeme  4976:             do I tell <span><strong class="command">make
                   4977:             fetch</strong></span> to do passive
                   4978:             FTP?</a></span></dt>
1.1       grant    4979: 
1.30      wiz      4980:             <dt><span class="sect1"><a href=
1.38      dillo    4981:             "#fetching-all-distfiles">7.10. How to fetch all
1.30      wiz      4982:             distfiles at once</a></span></dt>
1.1       grant    4983: 
1.30      wiz      4984:             <dt><span class="sect1"><a href=
1.38      dillo    4985:             "#tmac.andoc-missing">7.11. What does
1.30      wiz      4986:             &#8220;<span class="quote">Don't know how to make
1.14      xtraeme  4987:             /usr/share/tmac/tmac.andoc</span>&#8221;
1.1       grant    4988:             mean?</a></span></dt>
                   4989: 
1.30      wiz      4990:             <dt><span class="sect1"><a href=
1.38      dillo    4991:             "#bsd.own.mk-missing">7.12. What does
1.30      wiz      4992:             &#8220;<span class="quote">Could not find
1.14      xtraeme  4993:             bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    4994: 
1.30      wiz      4995:             <dt><span class="sect1"><a href=
1.38      dillo    4996:             "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30      wiz      4997:             pkgsrc</a></span></dt>
1.1       grant    4998: 
1.38      dillo    4999:             <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35      jmmv     5000:             do I change the location of configuration
                   5001:             files?</a></span></dt>
1.1       grant    5002: 
1.38      dillo    5003:             <dt><span class="sect1"><a href="#audit-packages">7.15.
1.1       grant    5004:             Automated security checks</a></span></dt>
                   5005:           </dl>
                   5006:         </div>
                   5007: 
                   5008:         <p>This section contains hints, tips &amp; tricks on
                   5009:         special things in pkgsrc that we didn't find a better place
                   5010:         for in the previous chapters, and it contains items for
                   5011:         both pkgsrc users and developers.</p>
                   5012: 
1.63    ! dillo    5013:         <div class="sect1" lang="en">
1.1       grant    5014:           <div class="titlepage">
                   5015:             <div>
                   5016:               <div>
                   5017:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5018:                 "mailing-list-pointers"></a>7.1.&nbsp;Are there any
1.30      wiz      5019:                 mailing lists for pkg-related discussion?</h2>
1.1       grant    5020:               </div>
                   5021:             </div>
                   5022:           </div>
                   5023: 
1.18      xtraeme  5024:           <p>The following mailing lists may be of interest to
                   5025:           pkgsrc users:</p>
                   5026: 
                   5027:           <div class="itemizedlist">
                   5028:             <ul type="disc">
                   5029:               <li>
                   5030:                 <p><a href=
                   5031:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.34      wiz      5032:                 target="_top">pkgsrc-bugs</a>: A list where problem
                   5033:                 reports related to pkgsrc are sent and
                   5034:                 discussed.</p>
1.18      xtraeme  5035:               </li>
                   5036: 
                   5037:               <li>
                   5038:                 <p><a href=
                   5039:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34      wiz      5040:                 target="_top">pkgsrc-bulk</a>: A list where the
1.20      ben      5041:                 results of pkgsrc bulk builds are sent and
1.34      wiz      5042:                 discussed.</p>
1.18      xtraeme  5043:               </li>
                   5044: 
                   5045:               <li>
                   5046:                 <p><a href=
                   5047:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.34      wiz      5048:                 target="_top">pkgsrc-changes</a>: A list where all
                   5049:                 commit messages to pkgsrc are sent.</p>
1.18      xtraeme  5050:               </li>
                   5051: 
                   5052:               <li>
                   5053:                 <p><a href=
                   5054:                 "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.34      wiz      5055:                 target="_top">tech-pkg</a>: A general discussion
                   5056:                 list for all things related to pkgsrc.</p>
1.18      xtraeme  5057:               </li>
                   5058:             </ul>
                   5059:           </div>
                   5060: 
                   5061:           <p>To subscribe, do:</p>
1.1       grant    5062:           <pre class="programlisting">
1.51      rillig   5063:     <code class="prompt">%</code> echo subscribe <em class=
1.18      xtraeme  5064: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1       grant    5065: </pre>
                   5066: 
1.18      xtraeme  5067:           <p>Archives for all these mailing lists are available
                   5068:           from <a href="http://mail-index.NetBSD.org/" target=
                   5069:           "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1       grant    5070:         </div>
                   5071: 
1.63    ! dillo    5072:         <div class="sect1" lang="en">
1.1       grant    5073:           <div class="titlepage">
                   5074:             <div>
                   5075:               <div>
                   5076:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5077:                 "pkgviews-docs"></a>7.2.&nbsp;Where's the pkgviews
1.30      wiz      5078:                 documentation?</h2>
1.1       grant    5079:               </div>
                   5080:             </div>
                   5081:           </div>
                   5082: 
                   5083:           <p>Pkgviews is tightly integrated with buildlink. You can
1.45      wiz      5084:           find a pkgviews User's guide in <code xmlns=
                   5085:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5086:           "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1       grant    5087:         </div>
                   5088: 
1.63    ! dillo    5089:         <div class="sect1" lang="en">
1.1       grant    5090:           <div class="titlepage">
                   5091:             <div>
                   5092:               <div>
                   5093:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5094:                 "faq-pkgtools"></a>7.3.&nbsp;Utilities for package
1.5       hubertf  5095:                 management (pkgtools)</h2>
1.1       grant    5096:               </div>
                   5097:             </div>
                   5098:           </div>
                   5099: 
1.45      wiz      5100:           <p>The <code xmlns=
                   5101:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5102:           "filename">pkgsrc/pkgtools</code> directory pkgtools
                   5103:           contains a number of useful utilities for both users and
                   5104:           developers of pkgsrc. This section attempts only to make
                   5105:           the reader aware of the utilities and when they might be
                   5106:           useful, and not to duplicate the documentation that comes
                   5107:           with each package.</p>
1.1       grant    5108: 
                   5109:           <p>Utilities used by pkgsrc (automatically installed when
                   5110:           needed):</p>
                   5111: 
                   5112:           <div class="itemizedlist">
                   5113:             <ul type="disc">
                   5114:               <li>
                   5115:                 <p><a xmlns=
                   5116:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5117:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.45      wiz      5118:                 target="_top"><code xmlns="" class=
                   5119:                 "filename">pkgtools/x11-links</code></a>: Symlinks
1.34      wiz      5120:                 for use by buildlink.</p>
1.1       grant    5121:               </li>
                   5122:             </ul>
                   5123:           </div>
                   5124: 
                   5125:           <p>OS tool augmentation (automatically installed when
                   5126:           needed):</p>
                   5127: 
                   5128:           <div class="itemizedlist">
                   5129:             <ul type="disc">
                   5130:               <li>
                   5131:                 <p><a xmlns=
                   5132:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5133:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.45      wiz      5134:                 target="_top"><code xmlns="" class=
                   5135:                 "filename">pkgtools/digest</code></a>: Calculates
1.34      wiz      5136:                 various kinds of checksums (including SHA1).</p>
1.1       grant    5137:               </li>
                   5138: 
                   5139:               <li>
                   5140:                 <p><a xmlns=
                   5141:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5142:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.45      wiz      5143:                 target="_top"><code xmlns="" class=
                   5144:                 "filename">pkgtools/libnbcompat</code></a>:
1.34      wiz      5145:                 Compatibility library for pkgsrc tools.</p>
1.1       grant    5146:               </li>
                   5147: 
                   5148:               <li>
                   5149:                 <p><a xmlns=
                   5150:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5151:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.45      wiz      5152:                 target="_top"><code xmlns="" class=
                   5153:                 "filename">pkgtools/mtree</code></a>: Installed on
1.34      wiz      5154:                 non-BSD systems due to lack of native mtree.</p>
1.1       grant    5155:               </li>
                   5156: 
                   5157:               <li>
                   5158:                 <p><a xmlns=
                   5159:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5160:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45      wiz      5161:                 target="_top"><code xmlns="" class=
                   5162:                 "filename">pkgtools/pkg_install</code></a>:
                   5163:                 Up-to-date replacement for <code xmlns=
                   5164:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.34      wiz      5165:                 "filename">/usr/sbin/pkg_install</code>, or for use
                   5166:                 on operating systems where pkg_install is not
                   5167:                 present.</p>
1.1       grant    5168:               </li>
                   5169:             </ul>
                   5170:           </div>
                   5171: 
                   5172:           <p>Utilities used by pkgsrc (not automatically
                   5173:           installed):</p>
                   5174: 
                   5175:           <div class="itemizedlist">
                   5176:             <ul type="disc">
                   5177:               <li>
                   5178:                 <p><a xmlns=
                   5179:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5180:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.45      wiz      5181:                 target="_top"><code xmlns="" class=
                   5182:                 "filename">pkgtools/pkg_tarup</code></a>: Create a
1.20      ben      5183:                 binary package from an already-installed package.
1.34      wiz      5184:                 Used by <span><strong class="command">make
                   5185:                 replace</strong></span> to save the old
                   5186:                 package.</p>
1.1       grant    5187:               </li>
                   5188: 
                   5189:               <li>
                   5190:                 <p><a xmlns=
                   5191:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.5       hubertf  5192:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.45      wiz      5193:                 target="_top"><code xmlns="" class=
                   5194:                 "filename">pkgtools/dfdisk</code></a>: Adds extra
1.20      ben      5195:                 functionality to pkgsrc, allowing it to fetch
                   5196:                 distfiles from multiple locations. It currently
                   5197:                 supports the following methods: multiple CD-ROMs
                   5198:                 and network FTP/HTTP connections.</p>
1.5       hubertf  5199:               </li>
                   5200: 
                   5201:               <li>
                   5202:                 <p><a xmlns=
                   5203:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    5204:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45      wiz      5205:                 target="_top"><code xmlns="" class=
                   5206:                 "filename">pkgtools/xpkgwedge</code></a>: Put X11
1.34      wiz      5207:                 packages someplace else (enabled by default).</p>
1.1       grant    5208:               </li>
1.5       hubertf  5209: 
                   5210:               <li>
                   5211:                 <p><a xmlns=
                   5212:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5213:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45      wiz      5214:                 target="_top"><code xmlns="" class=
                   5215:                 "filename">devel/cpuflags</code></a>: Determine the
1.34      wiz      5216:                 best compiler flags to optimise code for your
1.20      ben      5217:                 current CPU and compiler.</p>
1.5       hubertf  5218:               </li>
1.1       grant    5219:             </ul>
                   5220:           </div>
                   5221: 
                   5222:           <p>Utilities for keeping track of installed packages,
                   5223:           being up to date, etc:</p>
                   5224: 
                   5225:           <div class="itemizedlist">
                   5226:             <ul type="disc">
                   5227:               <li>
                   5228:                 <p><a xmlns=
                   5229:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5230:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.45      wiz      5231:                 target="_top"><code xmlns="" class=
                   5232:                 "filename">pkgtools/pkg_chk</code></a>: Reports on
1.27      rillig   5233:                 packages whose installed versions do not match the
1.34      wiz      5234:                 latest pkgsrc entries.</p>
1.1       grant    5235:               </li>
                   5236: 
                   5237:               <li>
                   5238:                 <p><a xmlns=
                   5239:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5240:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45      wiz      5241:                 target="_top"><code xmlns="" class=
                   5242:                 "filename">pkgtools/pkgdep</code></a>: Makes
1.20      ben      5243:                 dependency graphs of packages, to aid in choosing a
1.34      wiz      5244:                 strategy for updating.</p>
1.1       grant    5245:               </li>
                   5246: 
                   5247:               <li>
                   5248:                 <p><a xmlns=
                   5249:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5250:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.45      wiz      5251:                 target="_top"><code xmlns="" class=
                   5252:                 "filename">pkgtools/pkgdepgraph</code></a>: Makes
1.27      rillig   5253:                 graphs from the output of <a xmlns=
                   5254:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5255:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45      wiz      5256:                 target="_top"><code xmlns="" class=
                   5257:                 "filename">pkgtools/pkgdep</code></a> (uses
1.34      wiz      5258:                 graphviz).</p>
1.1       grant    5259:               </li>
                   5260: 
                   5261:               <li>
                   5262:                 <p><a xmlns=
                   5263:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5264:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45      wiz      5265:                 target="_top"><code xmlns="" class=
                   5266:                 "filename">pkgtools/pkglint</code></a>: The
1.27      rillig   5267:                 pkglint(1) program checks a pkgsrc entry for
                   5268:                 errors, lintpkgsrc(1) does various checks on the
                   5269:                 complete pkgsrc system.</p>
1.1       grant    5270:               </li>
                   5271: 
                   5272:               <li>
                   5273:                 <p><a xmlns=
                   5274:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5275:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.45      wiz      5276:                 target="_top"><code xmlns="" class=
                   5277:                 "filename">pkgtools/pkgsurvey</code></a>: Report
                   5278:                 what packages you have installed.</p>
1.1       grant    5279:               </li>
                   5280:             </ul>
                   5281:           </div>
                   5282: 
                   5283:           <p>Utilities for people maintaining or creating
                   5284:           individual packages:</p>
                   5285: 
                   5286:           <div class="itemizedlist">
                   5287:             <ul type="disc">
                   5288:               <li>
                   5289:                 <p><a xmlns=
                   5290:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5291:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45      wiz      5292:                 target="_top"><code xmlns="" class=
                   5293:                 "filename">pkgtools/pkgdiff</code></a>: Automate
1.20      ben      5294:                 making and maintaining patches for a package
1.34      wiz      5295:                 (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1       grant    5296:               </li>
                   5297: 
                   5298:               <li>
                   5299:                 <p><a xmlns=
                   5300:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5301:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.45      wiz      5302:                 target="_top"><code xmlns="" class=
                   5303:                 "filename">pkgtools/rpm2pkg</code></a>, <a xmlns=
1.20      ben      5304:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5305:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45      wiz      5306:                 target="_top"><code xmlns="" class=
                   5307:                 "filename">pkgtools/url2pkg</code></a>: Aids in
1.34      wiz      5308:                 converting to pkgsrc.</p>
1.1       grant    5309:               </li>
                   5310: 
                   5311:               <li>
                   5312:                 <p><a xmlns=
                   5313:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5314:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.45      wiz      5315:                 target="_top"><code xmlns="" class=
                   5316:                 "filename">pkgtools/gensolpkg</code></a>: Convert
1.34      wiz      5317:                 pkgsrc to a Solaris package.</p>
1.1       grant    5318:               </li>
                   5319:             </ul>
                   5320:           </div>
                   5321: 
1.47      reed     5322:           <p>Utilities for people maintaining pkgsrc (or: more
1.1       grant    5323:           obscure pkg utilities)</p>
                   5324: 
                   5325:           <div class="itemizedlist">
                   5326:             <ul type="disc">
                   5327:               <li>
                   5328:                 <p><a xmlns=
                   5329:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5330:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.45      wiz      5331:                 target="_top"><code xmlns="" class=
                   5332:                 "filename">pkgtools/pkg_comp</code></a>: Build
1.34      wiz      5333:                 packages in a chrooted area.</p>
1.1       grant    5334:               </li>
                   5335: 
                   5336:               <li>
                   5337:                 <p><a xmlns=
                   5338:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5339:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.45      wiz      5340:                 target="_top"><code xmlns="" class=
                   5341:                 "filename">pkgtools/libkver</code></a>: Spoof
                   5342:                 kernel version for chrooted cross builds.</p>
1.1       grant    5343:               </li>
                   5344:             </ul>
                   5345:           </div>
                   5346:         </div>
                   5347: 
1.63    ! dillo    5348:         <div class="sect1" lang="en">
1.1       grant    5349:           <div class="titlepage">
                   5350:             <div>
                   5351:               <div>
                   5352:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5353:                 "non-root-pkgsrc"></a>7.4.&nbsp;How to use pkgsrc
1.30      wiz      5354:                 as non-root</h2>
1.1       grant    5355:               </div>
                   5356:             </div>
                   5357:           </div>
                   5358: 
                   5359:           <p>If you want to use pkgsrc as non-root user, you can
                   5360:           set some variables to make pkgsrc work under these
1.33      jmmv     5361:           conditions. At the very least, you need to set
                   5362:           <code class="varname">UNPRIVILEGED</code> to
                   5363:           &#8220;<span class="quote">yes</span>&#8221;; this will
                   5364:           turn on unprivileged mode and set multiple related
                   5365:           variables to allow installation of packages as
                   5366:           non-root.</p>
                   5367: 
                   5368:           <p>In case the defaults are not enough, you may want to
                   5369:           tune some other variables used. For example, if the
                   5370:           automatic user/group detection leads to incorrect values
                   5371:           (or not the ones you would like to use), you can change
                   5372:           them by setting <code class=
                   5373:           "varname">UNPRIVILEGED_USER</code> and <code class=
                   5374:           "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
                   5375: 
                   5376:           <p>As regards bootstrapping, please note that the
                   5377:           <span><strong class="command">bootstrap</strong></span>
                   5378:           script will ease non-root configuration when given the
                   5379:           &#8220;<span class=
                   5380:           "quote">--ignore-user-check</span>&#8221; flag, as it
                   5381:           will choose and use multiple default directories under
1.45      wiz      5382:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5383:           class="filename">~/pkg</code> as the installation
1.33      jmmv     5384:           targets. These directories can be overriden by the
                   5385:           &#8220;<span class="quote">--prefix</span>&#8221; flag
                   5386:           provided by the script, as well as some others that allow
                   5387:           finer tuning of the tree layout.</p>
1.14      xtraeme  5388:         </div>
                   5389: 
1.63    ! dillo    5390:         <div class="sect1" lang="en">
1.14      xtraeme  5391:           <div class="titlepage">
                   5392:             <div>
                   5393:               <div>
                   5394:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5395:                 "resume-transfers"></a>7.5.&nbsp;How to resume
1.30      wiz      5396:                 transfers when fetching distfiles?</h2>
1.14      xtraeme  5397:               </div>
                   5398:             </div>
                   5399:           </div>
                   5400: 
1.47      reed     5401:           <p>By default, resuming transfers in pkgsrc is disabled,
1.15      xtraeme  5402:           but you can enable this feature by adding the option
                   5403:           <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
1.45      wiz      5404:           into <code xmlns=
                   5405:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5406:           "filename">/etc/mk.conf</code>. If, during a fetch step,
                   5407:           an incomplete distfile is found, pkgsrc will try to
                   5408:           resume it.</p>
1.15      xtraeme  5409: 
                   5410:           <p>You can also use a different program than the default
1.24      wiz      5411:           <a href=
                   5412:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   5413:           <span class="citerefentry"><span class=
                   5414:           "refentrytitle">ftp</span>(1)</span></a> by changing the
                   5415:           <code class="varname">FETCH_CMD</code> variable. Don't
                   5416:           forget to set <code class=
                   5417:           "varname">FETCH_RESUME_ARGS</code> and <code class=
                   5418:           "varname">FETCH_OUTPUT_ARGS</code> if you are not using
                   5419:           default values.</p>
1.14      xtraeme  5420: 
1.45      wiz      5421:           <p>For example, if you want to use <code xmlns=
                   5422:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5423:           "filename">wget</code> to resume downloads, you'll have
                   5424:           to use something like:</p>
                   5425:           <pre class="programlisting">
1.51      rillig   5426:     FETCH_CMD=             wget
                   5427:     FETCH_BEFORE_ARGS=     --passive-ftp
                   5428:     FETCH_RESUME_ARGS=     -c
                   5429:     FETCH_OUTPUT_ARGS=     -O
1.14      xtraeme  5430: </pre>
1.1       grant    5431:         </div>
                   5432: 
1.63    ! dillo    5433:         <div class="sect1" lang="en">
1.1       grant    5434:           <div class="titlepage">
                   5435:             <div>
                   5436:               <div>
                   5437:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5438:                 "XFree86-from-pkgsrc"></a>7.6.&nbsp;How can I
1.1       grant    5439:                 install/use XFree86 from pkgsrc?</h2>
                   5440:               </div>
                   5441:             </div>
                   5442:           </div>
                   5443: 
                   5444:           <p>If you want to use XFree86 from pkgsrc instead of your
1.45      wiz      5445:           system's own X11 (<code xmlns=
                   5446:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5447:           "filename">/usr/X11R6</code>, <code xmlns=
                   5448:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5449:           "filename">/usr/openwin</code>, ...), you will have to
1.45      wiz      5450:           add the following line into <code xmlns=
                   5451:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.15      xtraeme  5452:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    5453:           <pre class="programlisting">
1.51      rillig   5454:     X11_TYPE=XFree86
1.1       grant    5455: </pre>
                   5456:         </div>
                   5457: 
1.63    ! dillo    5458:         <div class="sect1" lang="en">
1.1       grant    5459:           <div class="titlepage">
                   5460:             <div>
                   5461:               <div>
                   5462:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5463:                 "x.org-from-pkgsrc"></a>7.7.&nbsp;How can I
1.1       grant    5464:                 install/use X.org from pkgsrc?</h2>
                   5465:               </div>
                   5466:             </div>
                   5467:           </div>
                   5468: 
                   5469:           <p>If you want to use X.org from pkgsrc instead of your
1.45      wiz      5470:           system's own X11 (<code xmlns=
                   5471:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5472:           "filename">/usr/X11R6</code>, <code xmlns=
                   5473:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5474:           "filename">/usr/openwin</code>, ...) you will have to add
1.45      wiz      5475:           the following line into <code xmlns=
                   5476:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.15      xtraeme  5477:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    5478:           <pre class="programlisting">
1.51      rillig   5479:     X11_TYPE=xorg
1.1       grant    5480: </pre>
                   5481:         </div>
                   5482: 
1.63    ! dillo    5483:         <div class="sect1" lang="en">
1.1       grant    5484:           <div class="titlepage">
                   5485:             <div>
                   5486:               <div>
                   5487:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5488:                 "fetch-behind-firewall"></a>7.8.&nbsp;How to fetch
1.30      wiz      5489:                 files from behind a firewall</h2>
1.1       grant    5490:               </div>
                   5491:             </div>
                   5492:           </div>
                   5493: 
                   5494:           <p>If you are sitting behind a firewall which does not
                   5495:           allow direct connections to Internet hosts (i.e.
                   5496:           non-NAT), you may specify the relevant proxy hosts. This
                   5497:           is done using an environment variable in the form of a
1.47      reed     5498:           URL, e.g. in Amdahl, the machine &#8220;<span class=
1.1       grant    5499:           "quote">orpheus.amdahl.com</span>&#8221; is one of the
                   5500:           firewalls, and it uses port 80 as the proxy port number.
                   5501:           So the proxy environment variables are:</p>
                   5502:           <pre class="programlisting">
1.51      rillig   5503:     ftp_proxy=ftp://orpheus.amdahl.com:80/
                   5504:     http_proxy=http://orpheus.amdahl.com:80/
1.1       grant    5505: </pre>
                   5506:         </div>
                   5507: 
1.63    ! dillo    5508:         <div class="sect1" lang="en">
1.1       grant    5509:           <div class="titlepage">
                   5510:             <div>
                   5511:               <div>
                   5512:                 <h2 class="title" style="clear: both"><a name=
1.63    ! dillo    5513:                 "passive-ftp"></a>7.9.&nbsp;How do I tell
        !          5514:                 <span><strong class="command">make
1.14      xtraeme  5515:                 fetch</strong></span> to do passive FTP?</h2>
1.1       grant    5516:               </div>
                   5517:             </div>
                   5518:           </div>
                   5519: 
                   5520:           <p>This depends on which utility is used to retrieve
1.45      wiz      5521:           distfiles. From <code xmlns=
                   5522:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5523:           "filename">bsd.pkg.mk</code>, <code class=
                   5524:           "varname">FETCH_CMD</code> is assigned the first
                   5525:           available command from the following list:</p>
1.34      wiz      5526: 
                   5527:           <div class="itemizedlist">
                   5528:             <ul type="disc">
                   5529:               <li>
1.45      wiz      5530:                 <p><code xmlns=
                   5531:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.34      wiz      5532:                 "filename">${LOCALBASE}/bin/ftp</code></p>
                   5533:               </li>
                   5534: 
                   5535:               <li>
1.45      wiz      5536:                 <p><code xmlns=
                   5537:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   5538:                 "filename">/usr/bin/ftp</code></p>
1.34      wiz      5539:               </li>
                   5540:             </ul>
                   5541:           </div>
1.1       grant    5542: 
                   5543:           <p>On a default NetBSD installation, this will be
1.45      wiz      5544:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5545:           class="filename">/usr/bin/ftp</code>, which automatically
                   5546:           tries passive connections first, and falls back to active
                   5547:           connections if the server refuses to do passive. For the
                   5548:           other tools, add the following to your <code xmlns=
                   5549:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5550:           "filename">/etc/mk.conf</code> file: <code class=
                   5551:           "varname">PASSIVE_FETCH=1</code>.</p>
1.1       grant    5552: 
1.45      wiz      5553:           <p>Having that option present will prevent <code xmlns=
                   5554:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5555:           "filename">/usr/bin/ftp</code> from falling back to
                   5556:           active transfers.</p>
1.1       grant    5557:         </div>
                   5558: 
1.63    ! dillo    5559:         <div class="sect1" lang="en">
1.1       grant    5560:           <div class="titlepage">
                   5561:             <div>
                   5562:               <div>
                   5563:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5564:                 "fetching-all-distfiles"></a>7.10.&nbsp;How to
1.1       grant    5565:                 fetch all distfiles at once</h2>
                   5566:               </div>
                   5567:             </div>
                   5568:           </div>
                   5569: 
                   5570:           <p>You would like to download all the distfiles in a
                   5571:           single batch from work or university, where you can't run
1.14      xtraeme  5572:           a <span><strong class="command">make
                   5573:           fetch</strong></span>. There is an archive of distfiles
                   5574:           on <a href=
1.1       grant    5575:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
                   5576:           target="_top">ftp.NetBSD.org</a>, but downloading the
                   5577:           entire directory may not be appropriate.</p>
                   5578: 
1.14      xtraeme  5579:           <p>The answer here is to do a <span><strong class=
1.45      wiz      5580:           "command">make fetch-list</strong></span> in <code xmlns=
                   5581:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     5582:           "filename">/usr/pkgsrc</code> or one of its
1.1       grant    5583:           subdirectories, carry the resulting list to your machine
1.23      wiz      5584:           at work/school and use it there. If you don't have a
1.24      wiz      5585:           NetBSD-compatible <a href=
                   5586:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   5587:           <span class="citerefentry"><span class=
                   5588:           "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
                   5589:           at work, don't forget to set <code class=
                   5590:           "varname">FETCH_CMD</code> to something that fetches a
                   5591:           URL:</p>
1.1       grant    5592: 
                   5593:           <p>At home:</p>
                   5594:           <pre class="screen">
1.14      xtraeme  5595: <code class="prompt">%</code> <strong class=
                   5596: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   5597: <code class="prompt">%</code> <strong class=
                   5598: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles &gt;/tmp/fetch.sh</code></strong>
                   5599: <code class="prompt">%</code> <strong class=
                   5600: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1       grant    5601: </pre>
                   5602: 
                   5603:           <p>At work:</p>
                   5604:           <pre class="screen">
1.14      xtraeme  5605: <code class="prompt">%</code> <strong class=
                   5606: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1       grant    5607: </pre>
                   5608: 
1.45      wiz      5609:           <p>then tar up <code xmlns=
                   5610:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5611:           "filename">/tmp/distfiles</code> and take it home.</p>
1.1       grant    5612: 
                   5613:           <p>If you have a machine running NetBSD, and you want to
                   5614:           get <span class="emphasis"><em>all</em></span> distfiles
                   5615:           (even ones that aren't for your machine architecture),
                   5616:           you can do so by using the above-mentioned
1.14      xtraeme  5617:           <span><strong class="command">make
                   5618:           fetch-list</strong></span> approach, or fetch the
                   5619:           distfiles directly by running:</p>
1.1       grant    5620:           <pre class="screen">
1.14      xtraeme  5621: <code class="prompt">%</code> <strong class=
                   5622: "userinput"><code>make mirror-distfiles</code></strong>
1.1       grant    5623: </pre>
                   5624: 
1.14      xtraeme  5625:           <p>If you even decide to ignore <code class=
                   5626:           "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
                   5627:           can get everything by running:</p>
1.1       grant    5628:           <pre class="screen">
1.14      xtraeme  5629: <code class="prompt">%</code> <strong class=
                   5630: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1       grant    5631: </pre>
                   5632:         </div>
                   5633: 
1.63    ! dillo    5634:         <div class="sect1" lang="en">
1.1       grant    5635:           <div class="titlepage">
                   5636:             <div>
                   5637:               <div>
                   5638:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5639:                 "tmac.andoc-missing"></a>7.11.&nbsp;What does
1.1       grant    5640:                 &#8220;<span class="quote">Don't know how to make
                   5641:                 /usr/share/tmac/tmac.andoc</span>&#8221; mean?</h2>
                   5642:               </div>
                   5643:             </div>
                   5644:           </div>
                   5645: 
                   5646:           <p>When compiling the <a xmlns=
                   5647:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5648:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45      wiz      5649:           target="_top"><code xmlns="" class=
                   5650:           "filename">pkgtools/pkg_install</code></a> package, you
                   5651:           get the error from make that it doesn't know how to make
                   5652:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5653:           class="filename">/usr/share/tmac/tmac.andoc</code>? This
                   5654:           indicates that you don't have installed the
1.23      wiz      5655:           &#8220;<span class="quote">text</span>&#8221; set (nroff,
                   5656:           ...) from the NetBSD base distribution on your machine.
1.47      reed     5657:           It is recommended to do that to format man pages.</p>
1.1       grant    5658: 
                   5659:           <p>In the case of the <a xmlns=
                   5660:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5661:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45      wiz      5662:           target="_top"><code xmlns="" class=
                   5663:           "filename">pkgtools/pkg_install</code></a> package, you
                   5664:           can get away with setting <code class=
1.20      ben      5665:           "varname">NOMAN=YES</code> either in the environment or
1.45      wiz      5666:           in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5667:           class="filename">/etc/mk.conf</code>.</p>
1.1       grant    5668:         </div>
                   5669: 
1.63    ! dillo    5670:         <div class="sect1" lang="en">
1.1       grant    5671:           <div class="titlepage">
                   5672:             <div>
                   5673:               <div>
                   5674:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5675:                 "bsd.own.mk-missing"></a>7.12.&nbsp;What does
1.1       grant    5676:                 &#8220;<span class="quote">Could not find
                   5677:                 bsd.own.mk</span>&#8221; mean?</h2>
                   5678:               </div>
                   5679:             </div>
                   5680:           </div>
                   5681: 
1.45      wiz      5682:           <p>You didn't install the compiler set, <code xmlns=
                   5683:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5684:           "filename">comp.tgz</code>, when you installed your
1.47      reed     5685:           NetBSD machine. Please get and install it, by extracting
                   5686:           it in <code xmlns=
1.45      wiz      5687:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5688:           "filename">/</code>:</p>
1.1       grant    5689:           <pre class="screen">
1.14      xtraeme  5690: <code class="prompt">#</code> <strong class=
                   5691: "userinput"><code>cd /</code></strong>
                   5692: <code class="prompt">#</code> <strong class=
                   5693: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1       grant    5694: </pre>
                   5695: 
1.45      wiz      5696:           <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5697:           class="filename">comp.tgz</code> is part of every NetBSD
                   5698:           release. Get the one that corresponds to your release
                   5699:           (determine via <span><strong class="command">uname
                   5700:           -r</strong></span>).</p>
1.1       grant    5701:         </div>
                   5702: 
1.63    ! dillo    5703:         <div class="sect1" lang="en">
1.1       grant    5704:           <div class="titlepage">
                   5705:             <div>
                   5706:               <div>
                   5707:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5708:                 "using-sudo-with-pkgsrc"></a>7.13.&nbsp;Using
1.1       grant    5709:                 'sudo' with pkgsrc</h2>
                   5710:               </div>
                   5711:             </div>
                   5712:           </div>
                   5713: 
                   5714:           <p>When installing packages as non-root user and using
1.24      wiz      5715:           the just-in-time <a href=
                   5716:           "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
                   5717:           <span class="citerefentry"><span class=
                   5718:           "refentrytitle">su</span>(1)</span></a> feature of
                   5719:           pkgsrc, it can become annoying to type in the root
                   5720:           password for each required package installed. To avoid
                   5721:           this, the sudo package can be used, which does password
                   5722:           caching over a limited time. To use it, install sudo
                   5723:           (either as binary package or from <a xmlns=
                   5724:           "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    5725:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.45      wiz      5726:           target="_top"><code xmlns="" class=
                   5727:           "filename">security/sudo</code></a>) and then put the
                   5728:           following into your <code xmlns=
                   5729:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      5730:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    5731:           <pre class="programlisting">
1.51      rillig   5732:     .if exists(${LOCALBASE}/bin/sudo)
                   5733:     SU_CMD=        ${LOCALBASE}/bin/sudo /bin/sh -c
                   5734:     .endif
1.1       grant    5735: </pre>
                   5736:         </div>
                   5737: 
1.63    ! dillo    5738:         <div class="sect1" lang="en">
1.1       grant    5739:           <div class="titlepage">
                   5740:             <div>
                   5741:               <div>
                   5742:                 <h2 class="title" style="clear: both"><a name=
1.63    ! dillo    5743:                 "faq.conf"></a>7.14.&nbsp;How do I change the
        !          5744:                 location of configuration files?</h2>
1.1       grant    5745:               </div>
                   5746:             </div>
                   5747:           </div>
                   5748: 
1.35      jmmv     5749:           <p>As the system administrator, you can choose where
                   5750:           configuration files are installed. The default settings
1.45      wiz      5751:           make all these files go into <code xmlns=
                   5752:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     5753:           "filename">${PREFIX}/etc</code> or some of its
                   5754:           subdirectories; this may be suboptimal depending on your
                   5755:           expectations (e.g., a read-only, NFS-exported
                   5756:           <code class="varname">PREFIX</code> with a need of
                   5757:           per-machine configuration of the provided packages).</p>
                   5758: 
                   5759:           <p>In order to change the defaults, you can modify the
                   5760:           <code class="varname">PKG_SYSCONFBASE</code> variable (in
1.45      wiz      5761:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5762:           class="filename">/etc/mk.conf</code>) to point to your
                   5763:           preferred configuration directory; some common examples
                   5764:           include <code xmlns=
                   5765:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5766:           "filename">/etc</code> or <code xmlns=
                   5767:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5768:           "filename">/etc/pkg</code>.</p>
1.35      jmmv     5769: 
                   5770:           <p>Furthermore, you can change this value on a
                   5771:           per-package basis by setting the <code class=
                   5772:           "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   5773:           variable. <code class="varname">PKG_SYSCONFVAR</code>'s
                   5774:           value usually matches the name of the package you would
                   5775:           like to modify, that is, the contents of <code class=
                   5776:           "varname">PKGBASE</code>.</p>
1.1       grant    5777: 
1.47      reed     5778:           <p>Note that after changing these settings, you must
1.35      jmmv     5779:           rebuild and reinstall any affected packages.</p>
1.1       grant    5780:         </div>
                   5781: 
1.63    ! dillo    5782:         <div class="sect1" lang="en">
1.1       grant    5783:           <div class="titlepage">
                   5784:             <div>
                   5785:               <div>
                   5786:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5787:                 "audit-packages"></a>7.15.&nbsp;Automated security
1.1       grant    5788:                 checks</h2>
                   5789:               </div>
                   5790:             </div>
                   5791:           </div>
                   5792: 
                   5793:           <p>Please be aware that there can often be bugs in
                   5794:           third-party software, and some of these bugs can leave a
                   5795:           machine vulnerable to exploitation by attackers. In an
                   5796:           effort to lessen the exposure, the NetBSD packages team
                   5797:           maintains a database of known-exploits to packages which
                   5798:           have at one time been included in pkgsrc. The database
                   5799:           can be downloaded automatically, and a security audit of
                   5800:           all packages installed on a system can take place. To do
                   5801:           this, install the <a xmlns=
                   5802:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5803:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45      wiz      5804:           target="_top"><code xmlns="" class=
                   5805:           "filename">security/audit-packages</code></a> package. It
1.20      ben      5806:           has two components:</p>
1.1       grant    5807: 
                   5808:           <div class="orderedlist">
                   5809:             <ol type="1">
                   5810:               <li>
1.34      wiz      5811:                 <p><span><strong class=
                   5812:                 "command">download-vulnerability-list</strong></span>,
1.1       grant    5813:                 an easy way to download a list of the security
                   5814:                 vulnerabilities information. This list is kept up
                   5815:                 to date by the NetBSD security officer and the
                   5816:                 NetBSD packages team, and is distributed from the
                   5817:                 NetBSD ftp server:</p>
                   5818: 
                   5819:                 <p><a href=
                   5820:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20      ben      5821:                 target=
                   5822:                 "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1       grant    5823:               </li>
                   5824: 
                   5825:               <li>
1.34      wiz      5826:                 <p><span><strong class=
                   5827:                 "command">audit-packages</strong></span>, an easy
                   5828:                 way to audit the current machine, checking each
1.1       grant    5829:                 vulnerability which is known. If a vulnerable
                   5830:                 package is installed, it will be shown by output to
                   5831:                 stdout, including a description of the type of
                   5832:                 vulnerability, and a URL containing more
                   5833:                 information.</p>
                   5834:               </li>
                   5835:             </ol>
                   5836:           </div>
                   5837: 
1.23      wiz      5838:           <p>Use of the <a xmlns=
                   5839:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5840:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45      wiz      5841:           target="_top"><code xmlns="" class=
                   5842:           "filename">security/audit-packages</code></a> package is
1.23      wiz      5843:           strongly recommended! After &#8220;<span class=
                   5844:           "quote">audit-packages</span>&#8221; is installed, please
                   5845:           read the package's message, which you can get by running
                   5846:           <strong class="userinput"><code>pkg_info -D
                   5847:           audit-package</code></strong>.</p>
1.58      erh      5848: 
                   5849:           <p>If this package is installed, pkgsrc builds will use
                   5850:           it to perform a security check before building any
                   5851:           package. See <a href="#variables-affecting-build" title=
                   5852:           "5.2.&nbsp;Variables affecting the build process">Section&nbsp;5.2,
                   5853:           &#8220;Variables affecting the build process&#8221;</a>
1.59      rillig   5854:           for ways to control this check.</p>
1.1       grant    5855:         </div>
                   5856:       </div>
                   5857:     </div>
                   5858: 
1.63    ! dillo    5859:     <div class="part" lang="en">
1.1       grant    5860:       <div class="titlepage">
                   5861:         <div>
                   5862:           <div>
1.63    ! dillo    5863:             <h1 class="title"><a name=
1.48      dillo    5864:             "developers-guide"></a>Part&nbsp;II.&nbsp;The pkgsrc
                   5865:             developer's guide</h1>
1.1       grant    5866:           </div>
                   5867:         </div>
                   5868:       </div>
                   5869: 
                   5870:       <div class="toc">
                   5871:         <p><b>Table of Contents</b></p>
                   5872: 
                   5873:         <dl>
1.38      dillo    5874:           <dt><span class="chapter"><a href="#components">8.
1.27      rillig   5875:           Package components - files, directories and
                   5876:           contents</a></span></dt>
                   5877: 
                   5878:           <dd>
                   5879:             <dl>
                   5880:               <dt><span class="sect1"><a href=
1.45      wiz      5881:               "#components.Makefile">8.1. <code xmlns=
                   5882:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   5883:               "filename">Makefile</code></a></span></dt>
                   5884: 
                   5885:               <dt><span class="sect1"><a href=
1.45      wiz      5886:               "#components.distinfo">8.2. <code xmlns=
                   5887:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   5888:               "filename">distinfo</code></a></span></dt>
                   5889: 
                   5890:               <dt><span class="sect1"><a href=
1.38      dillo    5891:               "#components.patches">8.3. patches/*</a></span></dt>
1.27      rillig   5892: 
1.30      wiz      5893:               <dt><span class="sect1"><a href=
1.38      dillo    5894:               "#other-mandatory-files">8.4. Other mandatory
1.30      wiz      5895:               files</a></span></dt>
1.27      rillig   5896: 
                   5897:               <dt><span class="sect1"><a href=
1.38      dillo    5898:               "#components.optional">8.5. Optional
1.27      rillig   5899:               files</a></span></dt>
                   5900: 
1.38      dillo    5901:               <dt><span class="sect1"><a href="#work-dir">8.6.
1.45      wiz      5902:               <code xmlns=
                   5903:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   5904:               "filename">work*</code></a></span></dt>
1.27      rillig   5905: 
1.38      dillo    5906:               <dt><span class="sect1"><a href="#files-dir">8.7.
1.45      wiz      5907:               <code xmlns=
                   5908:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   5909:               "filename">files/*</code></a></span></dt>
1.27      rillig   5910:             </dl>
                   5911:           </dd>
                   5912: 
1.38      dillo    5913:           <dt><span class="chapter"><a href="#makefile">9.
1.45      wiz      5914:           Programming in <code xmlns=
                   5915:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.25      rillig   5916:           "filename">Makefile</code>s</a></span></dt>
                   5917: 
                   5918:           <dd>
                   5919:             <dl>
                   5920:               <dt><span class="sect1"><a href=
1.45      wiz      5921:               "#makefile.variables">9.1. <code xmlns=
                   5922:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.25      rillig   5923:               "filename">Makefile</code> variables</a></span></dt>
                   5924: 
1.27      rillig   5925:               <dd>
                   5926:                 <dl>
                   5927:                   <dt><span class="sect2"><a href=
1.38      dillo    5928:                   "#makefile.variables.names">9.1.1. Naming
1.27      rillig   5929:                   conventions</a></span></dt>
                   5930:                 </dl>
                   5931:               </dd>
                   5932: 
1.38      dillo    5933:               <dt><span class="sect1"><a href="#makefile.code">9.2.
1.25      rillig   5934:               Code snippets</a></span></dt>
                   5935: 
                   5936:               <dd>
                   5937:                 <dl>
                   5938:                   <dt><span class="sect2"><a href=
1.38      dillo    5939:                   "#adding-to-list">9.2.1. Adding things to a
1.25      rillig   5940:                   list</a></span></dt>
                   5941: 
                   5942:                   <dt><span class="sect2"><a href=
1.38      dillo    5943:                   "#converting-internal-to-external">9.2.2.
1.30      wiz      5944:                   Converting an internal list into an external
                   5945:                   list</a></span></dt>
1.25      rillig   5946: 
                   5947:                   <dt><span class="sect2"><a href=
1.38      dillo    5948:                   "#passing-variable-to-shell">9.2.3. Passing
1.30      wiz      5949:                   variables to a shell command</a></span></dt>
1.27      rillig   5950: 
                   5951:                   <dt><span class="sect2"><a href=
1.38      dillo    5952:                   "#quoting-guideline">9.2.4. Quoting
1.27      rillig   5953:                   guideline</a></span></dt>
                   5954: 
                   5955:                   <dt><span class="sect2"><a href=
1.38      dillo    5956:                   "#bsd-make-bug-workaround">9.2.5. Workaround for
1.30      wiz      5957:                   a bug in BSD Make</a></span></dt>
1.25      rillig   5958:                 </dl>
                   5959:               </dd>
                   5960:             </dl>
                   5961:           </dd>
                   5962: 
1.38      dillo    5963:           <dt><span class="chapter"><a href="#plist">10. PLIST
1.1       grant    5964:           issues</a></span></dt>
                   5965: 
                   5966:           <dd>
                   5967:             <dl>
1.38      dillo    5968:               <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1       grant    5969:               ID</a></span></dt>
                   5970: 
1.30      wiz      5971:               <dt><span class="sect1"><a href=
1.38      dillo    5972:               "#automatic-plist-generation">10.2. Semi-automatic
1.45      wiz      5973:               <code xmlns=
                   5974:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   5975:               "filename">PLIST</code> generation</a></span></dt>
1.1       grant    5976: 
1.38      dillo    5977:               <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14      xtraeme  5978:               Tweaking output of <span><strong class="command">make
                   5979:               print-PLIST</strong></span></a></span></dt>
1.1       grant    5980: 
1.38      dillo    5981:               <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1       grant    5982:               Variable substitution in PLIST</a></span></dt>
                   5983: 
1.30      wiz      5984:               <dt><span class="sect1"><a href=
1.48      dillo    5985:               "#manpage-compression">10.5. Man page
                   5986:               compression</a></span></dt>
1.1       grant    5987: 
1.30      wiz      5988:               <dt><span class="sect1"><a href=
1.38      dillo    5989:               "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30      wiz      5990:               <code class=
1.14      xtraeme  5991:               "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    5992: 
1.30      wiz      5993:               <dt><span class="sect1"><a href=
1.47      reed     5994:               "#platform-specific-plist">10.7. Platform-specific
1.38      dillo    5995:               and differing PLISTs</a></span></dt>
1.1       grant    5996: 
                   5997:               <dt><span class="sect1"><a href=
1.38      dillo    5998:               "#faq.common-dirs">10.8. Sharing directories between
1.1       grant    5999:               packages</a></span></dt>
                   6000:             </dl>
                   6001:           </dd>
                   6002: 
1.38      dillo    6003:           <dt><span class="chapter"><a href="#buildlink">11.
1.1       grant    6004:           Buildlink methodology</a></span></dt>
                   6005: 
                   6006:           <dd>
                   6007:             <dl>
1.30      wiz      6008:               <dt><span class="sect1"><a href=
1.38      dillo    6009:               "#converting-to-buildlink3">11.1. Converting packages
1.30      wiz      6010:               to use buildlink3</a></span></dt>
1.1       grant    6011: 
1.30      wiz      6012:               <dt><span class="sect1"><a href=
1.45      wiz      6013:               "#creating-buildlink3.mk">11.2. Writing <code xmlns=
                   6014:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      6015:               "filename">buildlink3.mk</code> files</a></span></dt>
1.1       grant    6016: 
                   6017:               <dd>
                   6018:                 <dl>
                   6019:                   <dt><span class="sect2"><a href=
1.38      dillo    6020:                   "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30      wiz      6021:                   buildlink3.mk file</a></span></dt>
1.1       grant    6022: 
                   6023:                   <dt><span class="sect2"><a href=
1.38      dillo    6024:                   "#updating-buildlink-depends">11.2.2. Updating
1.30      wiz      6025:                   <code class=
1.63    ! dillo    6026:                   "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
        !          6027:                   in <code xmlns=
1.45      wiz      6028:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      6029:                   "filename">buildlink3.mk</code>
1.1       grant    6030:                   files</a></span></dt>
                   6031:                 </dl>
                   6032:               </dd>
                   6033: 
1.30      wiz      6034:               <dt><span class="sect1"><a href=
1.45      wiz      6035:               "#writing-builtin.mk">11.3. Writing <code xmlns=
                   6036:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      6037:               "filename">builtin.mk</code> files</a></span></dt>
1.1       grant    6038: 
                   6039:               <dd>
                   6040:                 <dl>
                   6041:                   <dt><span class="sect2"><a href=
1.38      dillo    6042:                   "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45      wiz      6043:                   <code xmlns=
                   6044:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   6045:                   "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    6046: 
                   6047:                   <dt><span class="sect2"><a href=
1.38      dillo    6048:                   "#native-or-pkgsrc-preference">11.3.2. Global
1.30      wiz      6049:                   preferences for native or pkgsrc
                   6050:                   software</a></span></dt>
1.1       grant    6051:                 </dl>
                   6052:               </dd>
                   6053:             </dl>
                   6054:           </dd>
                   6055: 
1.38      dillo    6056:           <dt><span class="chapter"><a href="#pkginstall">12. The
1.35      jmmv     6057:           pkginstall framework</a></span></dt>
                   6058: 
                   6059:           <dd>
                   6060:             <dl>
                   6061:               <dt><span class="sect1"><a href=
1.38      dillo    6062:               "#files-and-dirs-outside-prefix">12.1. Files and
1.35      jmmv     6063:               directories outside the installation
                   6064:               prefix</a></span></dt>
                   6065: 
                   6066:               <dd>
                   6067:                 <dl>
                   6068:                   <dt><span class="sect2"><a href=
1.38      dillo    6069:                   "#dirs-outside-prefix">12.1.1. Directory
1.35      jmmv     6070:                   manipulation</a></span></dt>
                   6071: 
                   6072:                   <dt><span class="sect2"><a href=
1.38      dillo    6073:                   "#files-outside-prefix">12.1.2. File
1.35      jmmv     6074:                   manipulation</a></span></dt>
                   6075:                 </dl>
                   6076:               </dd>
                   6077: 
1.38      dillo    6078:               <dt><span class="sect1"><a href="#conf-files">12.2.
1.35      jmmv     6079:               Configuration files</a></span></dt>
                   6080: 
                   6081:               <dd>
                   6082:                 <dl>
                   6083:                   <dt><span class="sect2"><a href=
1.38      dillo    6084:                   "#conf-files-sysconfdir">12.2.1. How <code class=
1.35      jmmv     6085:                   "varname">PKG_SYSCONFDIR</code> is
                   6086:                   set</a></span></dt>
                   6087: 
                   6088:                   <dt><span class="sect2"><a href=
1.38      dillo    6089:                   "#conf-files-configure">12.2.2. Telling the
1.47      reed     6090:                   software where configuration files
1.35      jmmv     6091:                   are</a></span></dt>
                   6092: 
                   6093:                   <dt><span class="sect2"><a href=
1.38      dillo    6094:                   "#conf-files-patching">12.2.3. Patching
1.35      jmmv     6095:                   installations</a></span></dt>
                   6096: 
                   6097:                   <dt><span class="sect2"><a href=
1.38      dillo    6098:                   "#conf-files-disable">12.2.4. Disabling handling
1.35      jmmv     6099:                   of configuration files</a></span></dt>
                   6100:                 </dl>
                   6101:               </dd>
                   6102: 
1.38      dillo    6103:               <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35      jmmv     6104:               System startup scripts</a></span></dt>
                   6105: 
                   6106:               <dd>
                   6107:                 <dl>
                   6108:                   <dt><span class="sect2"><a href=
1.38      dillo    6109:                   "#rcd-scripts-disable">12.3.1. Disabling handling
1.35      jmmv     6110:                   of system startup scripts</a></span></dt>
                   6111:                 </dl>
                   6112:               </dd>
                   6113: 
                   6114:               <dt><span class="sect1"><a href=
1.38      dillo    6115:               "#users-and-groups">12.4. System users and
1.35      jmmv     6116:               groups</a></span></dt>
                   6117: 
1.38      dillo    6118:               <dt><span class="sect1"><a href="#shells">12.5.
1.35      jmmv     6119:               System shells</a></span></dt>
                   6120: 
                   6121:               <dd>
                   6122:                 <dl>
                   6123:                   <dt><span class="sect2"><a href=
1.38      dillo    6124:                   "#shells-disable">12.5.1. Disabling handling of
1.35      jmmv     6125:                   configuration files</a></span></dt>
                   6126:                 </dl>
                   6127:               </dd>
                   6128:             </dl>
                   6129:           </dd>
                   6130: 
1.38      dillo    6131:           <dt><span class="chapter"><a href="#options">13. Options
1.1       grant    6132:           handling</a></span></dt>
                   6133: 
                   6134:           <dd>
                   6135:             <dl>
1.30      wiz      6136:               <dt><span class="sect1"><a href=
1.38      dillo    6137:               "#global-default-options">13.1. Global default
1.30      wiz      6138:               options</a></span></dt>
1.1       grant    6139: 
1.30      wiz      6140:               <dt><span class="sect1"><a href=
1.38      dillo    6141:               "#converting-to-options">13.2. Converting packages to
1.45      wiz      6142:               use <code xmlns=
                   6143:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6144:               "filename">bsd.options.mk</code></a></span></dt>
1.48      dillo    6145: 
                   6146:               <dt><span class="sect1"><a href="#option-names">13.3.
                   6147:               Option Names</a></span></dt>
1.1       grant    6148:             </dl>
                   6149:           </dd>
                   6150: 
1.38      dillo    6151:           <dt><span class="chapter"><a href="#build">14. The build
1.1       grant    6152:           process</a></span></dt>
                   6153: 
                   6154:           <dd>
                   6155:             <dl>
1.56      rillig   6156:               <dt><span class="sect1"><a href="#build.intro">14.1.
                   6157:               Introduction</a></span></dt>
                   6158: 
                   6159:               <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1       grant    6160:               Program location</a></span></dt>
                   6161: 
1.56      rillig   6162:               <dt><span class="sect1"><a href=
                   6163:               "#build.builddirs">14.3. Directories used during the
                   6164:               build process</a></span></dt>
1.1       grant    6165: 
                   6166:               <dt><span class="sect1"><a href=
1.56      rillig   6167:               "#build.running">14.4. Running a
                   6168:               phase</a></span></dt>
                   6169: 
                   6170:               <dt><span class="sect1"><a href="#build.fetch">14.5.
                   6171:               The <span class="emphasis"><em>fetch</em></span>
                   6172:               phase</a></span></dt>
                   6173: 
                   6174:               <dt><span class="sect1"><a href=
                   6175:               "#build.checksum">14.6. The <span class=
                   6176:               "emphasis"><em>checksum</em></span>
                   6177:               phase</a></span></dt>
                   6178: 
                   6179:               <dt><span class="sect1"><a href=
                   6180:               "#build.extract">14.7. The <span class=
                   6181:               "emphasis"><em>extract</em></span>
                   6182:               phase</a></span></dt>
                   6183: 
                   6184:               <dt><span class="sect1"><a href="#build.patch">14.8.
                   6185:               The <span class="emphasis"><em>patch</em></span>
                   6186:               phase</a></span></dt>
                   6187: 
                   6188:               <dt><span class="sect1"><a href="#build.tools">14.9.
                   6189:               The <span class="emphasis"><em>tools</em></span>
                   6190:               phase</a></span></dt>
                   6191: 
                   6192:               <dt><span class="sect1"><a href=
                   6193:               "#build.wrapper">14.10. The <span class=
                   6194:               "emphasis"><em>wrapper</em></span>
                   6195:               phase</a></span></dt>
                   6196: 
                   6197:               <dt><span class="sect1"><a href=
                   6198:               "#build.configure">14.11. The <span class=
                   6199:               "emphasis"><em>configure</em></span>
                   6200:               phase</a></span></dt>
                   6201: 
                   6202:               <dt><span class="sect1"><a href="#build.build">14.12.
                   6203:               The <span class="emphasis"><em>build</em></span>
                   6204:               phase</a></span></dt>
                   6205: 
                   6206:               <dt><span class="sect1"><a href="#build.test">14.13.
                   6207:               The <span class="emphasis"><em>test</em></span>
                   6208:               phase</a></span></dt>
                   6209: 
                   6210:               <dt><span class="sect1"><a href=
                   6211:               "#build.install">14.14. The <span class=
                   6212:               "emphasis"><em>install</em></span>
                   6213:               phase</a></span></dt>
                   6214: 
                   6215:               <dt><span class="sect1"><a href=
                   6216:               "#build.package">14.15. The <span class=
                   6217:               "emphasis"><em>package</em></span>
                   6218:               phase</a></span></dt>
                   6219: 
                   6220:               <dt><span class="sect1"><a href=
                   6221:               "#build.helpful-targets">14.16. Other helpful
1.1       grant    6222:               targets</a></span></dt>
                   6223:             </dl>
                   6224:           </dd>
                   6225: 
1.55      rillig   6226:           <dt><span class="chapter"><a href="#fixes">15. Making
                   6227:           your package work</a></span></dt>
1.1       grant    6228: 
                   6229:           <dd>
                   6230:             <dl>
1.30      wiz      6231:               <dt><span class="sect1"><a href=
1.38      dillo    6232:               "#general-operation">15.1. General
1.30      wiz      6233:               operation</a></span></dt>
1.1       grant    6234: 
                   6235:               <dd>
                   6236:                 <dl>
                   6237:                   <dt><span class="sect2"><a href=
1.38      dillo    6238:                   "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30      wiz      6239:                   pull in variables from
                   6240:                   /etc/mk.conf</a></span></dt>
1.1       grant    6241: 
                   6242:                   <dt><span class="sect2"><a href=
1.38      dillo    6243:                   "#where-to-install-documentation">15.1.2. Where
1.31      wiz      6244:                   to install documentation</a></span></dt>
                   6245: 
                   6246:                   <dt><span class="sect2"><a href=
1.38      dillo    6247:                   "#restricted-packages">15.1.3. Restricted
1.1       grant    6248:                   packages</a></span></dt>
                   6249: 
                   6250:                   <dt><span class="sect2"><a href=
1.38      dillo    6251:                   "#dependencies">15.1.4. Handling
1.1       grant    6252:                   dependencies</a></span></dt>
                   6253: 
                   6254:                   <dt><span class="sect2"><a href=
1.38      dillo    6255:                   "#conflicts">15.1.5. Handling conflicts with
1.1       grant    6256:                   other packages</a></span></dt>
                   6257: 
                   6258:                   <dt><span class="sect2"><a href=
1.38      dillo    6259:                   "#not-building-packages">15.1.6. Packages that
1.30      wiz      6260:                   cannot or should not be built</a></span></dt>
1.1       grant    6261: 
                   6262:                   <dt><span class="sect2"><a href=
1.38      dillo    6263:                   "#undeletable-packages">15.1.7. Packages which
1.30      wiz      6264:                   should not be deleted, once
                   6265:                   installed</a></span></dt>
1.1       grant    6266: 
                   6267:                   <dt><span class="sect2"><a href=
1.38      dillo    6268:                   "#security-handling">15.1.8. Handling packages
1.1       grant    6269:                   with security problems</a></span></dt>
                   6270: 
                   6271:                   <dt><span class="sect2"><a href=
1.38      dillo    6272:                   "#compiler-bugs">15.1.9. How to handle compiler
1.1       grant    6273:                   bugs</a></span></dt>
                   6274: 
                   6275:                   <dt><span class="sect2"><a href=
1.38      dillo    6276:                   "#bumping-pkgrevision">15.1.10. How to handle
1.30      wiz      6277:                   incrementing versions when fixing an existing
1.1       grant    6278:                   package</a></span></dt>
                   6279: 
                   6280:                   <dt><span class="sect2"><a href=
1.38      dillo    6281:                   "#portability-of-packages">15.1.11. Portability
1.30      wiz      6282:                   of packages</a></span></dt>
1.1       grant    6283:                 </dl>
                   6284:               </dd>
                   6285: 
1.30      wiz      6286:               <dt><span class="sect1"><a href=
1.38      dillo    6287:               "#downloading-issues">15.2. Possible downloading
1.30      wiz      6288:               issues</a></span></dt>
1.1       grant    6289: 
                   6290:               <dd>
                   6291:                 <dl>
                   6292:                   <dt><span class="sect2"><a href=
1.38      dillo    6293:                   "#no-plain-download">15.2.1. Packages whose
1.30      wiz      6294:                   distfiles aren't available for plain
1.1       grant    6295:                   downloading</a></span></dt>
                   6296: 
                   6297:                   <dt><span class="sect2"><a href=
1.38      dillo    6298:                   "#modified-distfiles-same-name">15.2.2. How to
1.30      wiz      6299:                   handle modified distfiles with the 'old'
                   6300:                   name</a></span></dt>
1.1       grant    6301:                 </dl>
                   6302:               </dd>
                   6303: 
1.30      wiz      6304:               <dt><span class="sect1"><a href=
1.38      dillo    6305:               "#configuration-gotchas">15.3. Configuration
1.30      wiz      6306:               gotchas</a></span></dt>
1.1       grant    6307: 
                   6308:               <dd>
                   6309:                 <dl>
                   6310:                   <dt><span class="sect2"><a href=
1.38      dillo    6311:                   "#fixes.libtool">15.3.1. Shared libraries -
1.1       grant    6312:                   libtool</a></span></dt>
                   6313: 
                   6314:                   <dt><span class="sect2"><a href=
1.38      dillo    6315:                   "#using-libtool">15.3.2. Using libtool on GNU
1.1       grant    6316:                   packages that already support
                   6317:                   libtool</a></span></dt>
                   6318: 
                   6319:                   <dt><span class="sect2"><a href=
1.38      dillo    6320:                   "#autoconf-automake">15.3.3. GNU
1.1       grant    6321:                   Autoconf/Automake</a></span></dt>
                   6322:                 </dl>
                   6323:               </dd>
                   6324: 
1.55      rillig   6325:               <dt><span class="sect1"><a href="#fixes-build">15.4.
                   6326:               Building the package</a></span></dt>
1.1       grant    6327: 
                   6328:               <dd>
                   6329:                 <dl>
                   6330:                   <dt><span class="sect2"><a href=
1.38      dillo    6331:                   "#cpp-defines">15.4.1. CPP
1.30      wiz      6332:                   defines</a></span></dt>
1.51      rillig   6333: 
                   6334:                   <dt><span class="sect2"><a href=
1.60      rillig   6335:                   "#cpp-list-examples">15.4.2. Examples of CPP
                   6336:                   defines for some platforms</a></span></dt>
                   6337: 
                   6338:                   <dt><span class="sect2"><a href=
                   6339:                   "#cpp-list">15.4.3. Getting a list of CPP
1.51      rillig   6340:                   defines</a></span></dt>
1.1       grant    6341:                 </dl>
                   6342:               </dd>
                   6343: 
1.30      wiz      6344:               <dt><span class="sect1"><a href=
1.38      dillo    6345:               "#package-specific-actions">15.5. Package specific
1.30      wiz      6346:               actions</a></span></dt>
1.1       grant    6347: 
                   6348:               <dd>
                   6349:                 <dl>
                   6350:                   <dt><span class="sect2"><a href=
1.38      dillo    6351:                   "#user-interaction">15.5.1. User
1.2       hubertf  6352:                   interaction</a></span></dt>
1.1       grant    6353: 
                   6354:                   <dt><span class="sect2"><a href=
1.38      dillo    6355:                   "#handling-licenses">15.5.2. Handling
1.1       grant    6356:                   licenses</a></span></dt>
                   6357: 
                   6358:                   <dt><span class="sect2"><a href=
1.38      dillo    6359:                   "#installing-score-files">15.5.3. Installing
1.30      wiz      6360:                   score files</a></span></dt>
1.1       grant    6361: 
                   6362:                   <dt><span class="sect2"><a href=
1.38      dillo    6363:                   "#perl-scripts">15.5.4. Packages containing perl
1.1       grant    6364:                   scripts</a></span></dt>
                   6365: 
                   6366:                   <dt><span class="sect2"><a href=
1.38      dillo    6367:                   "#hardcoded-paths">15.5.5. Packages with
1.30      wiz      6368:                   hardcoded paths to other
                   6369:                   interpreters</a></span></dt>
1.1       grant    6370: 
                   6371:                   <dt><span class="sect2"><a href=
1.38      dillo    6372:                   "#perl-modules">15.5.6. Packages installing perl
1.1       grant    6373:                   modules</a></span></dt>
                   6374: 
                   6375:                   <dt><span class="sect2"><a href=
1.38      dillo    6376:                   "#faq.info-files">15.5.7. Packages installing
1.1       grant    6377:                   info files</a></span></dt>
                   6378: 
                   6379:                   <dt><span class="sect2"><a href=
1.57      minskim  6380:                   "#manpages">15.5.8. Packages installing man
                   6381:                   pages</a></span></dt>
                   6382: 
                   6383:                   <dt><span class="sect2"><a href=
                   6384:                   "#gconf2-data-files">15.5.9. Packages installing
1.30      wiz      6385:                   GConf2 data files</a></span></dt>
1.1       grant    6386: 
                   6387:                   <dt><span class="sect2"><a href=
1.57      minskim  6388:                   "#scrollkeeper-data-files">15.5.10. Packages
1.30      wiz      6389:                   installing scrollkeeper data
                   6390:                   files</a></span></dt>
1.1       grant    6391: 
                   6392:                   <dt><span class="sect2"><a href=
1.57      minskim  6393:                   "#x11-fonts">15.5.11. Packages installing X11
1.1       grant    6394:                   fonts</a></span></dt>
                   6395: 
                   6396:                   <dt><span class="sect2"><a href=
1.57      minskim  6397:                   "#gtk2-modules">15.5.12. Packages installing GTK2
1.1       grant    6398:                   modules</a></span></dt>
                   6399: 
                   6400:                   <dt><span class="sect2"><a href=
1.57      minskim  6401:                   "#sgml-xml-data">15.5.13. Packages installing
1.30      wiz      6402:                   SGML or XML data</a></span></dt>
1.1       grant    6403: 
                   6404:                   <dt><span class="sect2"><a href=
1.57      minskim  6405:                   "#mime-database">15.5.14. Packages installing
1.1       grant    6406:                   extensions to the MIME database</a></span></dt>
                   6407: 
                   6408:                   <dt><span class="sect2"><a href=
1.57      minskim  6409:                   "#intltool">15.5.15. Packages using
1.1       grant    6410:                   intltool</a></span></dt>
1.18      xtraeme  6411: 
                   6412:                   <dt><span class="sect2"><a href=
1.57      minskim  6413:                   "#startup-scripts">15.5.16. Packages installing
1.30      wiz      6414:                   startup scripts</a></span></dt>
1.57      minskim  6415: 
                   6416:                   <dt><span class="sect2"><a href=
                   6417:                   "#tex-packages">15.5.17. Packages installing TeX
                   6418:                   modules</a></span></dt>
1.1       grant    6419:                 </dl>
                   6420:               </dd>
                   6421: 
1.30      wiz      6422:               <dt><span class="sect1"><a href=
1.38      dillo    6423:               "#feedback-to-author">15.6. Feedback to the
1.30      wiz      6424:               author</a></span></dt>
1.1       grant    6425:             </dl>
                   6426:           </dd>
                   6427: 
1.38      dillo    6428:           <dt><span class="chapter"><a href="#debug">16.
1.1       grant    6429:           Debugging</a></span></dt>
                   6430: 
1.38      dillo    6431:           <dt><span class="chapter"><a href="#submit">17.
1.1       grant    6432:           Submitting and Committing</a></span></dt>
                   6433: 
                   6434:           <dd>
                   6435:             <dl>
1.30      wiz      6436:               <dt><span class="sect1"><a href=
1.38      dillo    6437:               "#submitting-your-package">17.1. Submitting your
1.30      wiz      6438:               packages</a></span></dt>
1.1       grant    6439: 
1.30      wiz      6440:               <dt><span class="sect1"><a href=
1.41      wiz      6441:               "#general-notes-for-changes">17.2. General notes when
                   6442:               adding, updating, or removing
                   6443:               packages</a></span></dt>
                   6444: 
                   6445:               <dt><span class="sect1"><a href=
                   6446:               "#committing-importing">17.3. Committing: Importing a
1.30      wiz      6447:               package into CVS</a></span></dt>
1.1       grant    6448: 
1.30      wiz      6449:               <dt><span class="sect1"><a href=
1.41      wiz      6450:               "#updating-package">17.4. Updating a package to a
1.30      wiz      6451:               newer version</a></span></dt>
1.1       grant    6452: 
1.30      wiz      6453:               <dt><span class="sect1"><a href=
1.41      wiz      6454:               "#moving-package">17.5. Moving a package in
1.30      wiz      6455:               pkgsrc</a></span></dt>
1.1       grant    6456:             </dl>
                   6457:           </dd>
                   6458:         </dl>
                   6459:       </div>
                   6460: 
1.63    ! dillo    6461:       <div class="chapter" lang="en">
1.1       grant    6462:         <div class="titlepage">
                   6463:           <div>
                   6464:             <div>
1.63    ! dillo    6465:               <h2 class="title"><a name=
1.38      dillo    6466:               "components"></a>Chapter&nbsp;8.&nbsp;Package
1.27      rillig   6467:               components - files, directories and contents</h2>
1.25      rillig   6468:             </div>
                   6469:           </div>
                   6470:         </div>
                   6471: 
                   6472:         <div class="toc">
                   6473:           <p><b>Table of Contents</b></p>
                   6474: 
                   6475:           <dl>
                   6476:             <dt><span class="sect1"><a href=
1.45      wiz      6477:             "#components.Makefile">8.1. <code xmlns=
                   6478:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6479:             "filename">Makefile</code></a></span></dt>
                   6480: 
                   6481:             <dt><span class="sect1"><a href=
1.45      wiz      6482:             "#components.distinfo">8.2. <code xmlns=
                   6483:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6484:             "filename">distinfo</code></a></span></dt>
                   6485: 
                   6486:             <dt><span class="sect1"><a href=
1.38      dillo    6487:             "#components.patches">8.3. patches/*</a></span></dt>
1.25      rillig   6488: 
1.30      wiz      6489:             <dt><span class="sect1"><a href=
1.38      dillo    6490:             "#other-mandatory-files">8.4. Other mandatory
1.30      wiz      6491:             files</a></span></dt>
1.25      rillig   6492: 
1.27      rillig   6493:             <dt><span class="sect1"><a href=
1.38      dillo    6494:             "#components.optional">8.5. Optional
1.27      rillig   6495:             files</a></span></dt>
1.25      rillig   6496: 
1.38      dillo    6497:             <dt><span class="sect1"><a href="#work-dir">8.6.
1.45      wiz      6498:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6499:             class="filename">work*</code></a></span></dt>
1.25      rillig   6500: 
1.38      dillo    6501:             <dt><span class="sect1"><a href="#files-dir">8.7.
1.45      wiz      6502:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6503:             class="filename">files/*</code></a></span></dt>
1.25      rillig   6504:           </dl>
                   6505:         </div>
                   6506: 
1.27      rillig   6507:         <p>Whenever you're preparing a package, there are a number
                   6508:         of files involved which are described in the following
                   6509:         sections.</p>
1.25      rillig   6510: 
1.63    ! dillo    6511:         <div class="sect1" lang="en">
1.25      rillig   6512:           <div class="titlepage">
                   6513:             <div>
                   6514:               <div>
                   6515:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      6516:                 "components.Makefile"></a>8.1.&nbsp;<code xmlns=
                   6517:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6518:                 "filename">Makefile</code></h2>
1.25      rillig   6519:               </div>
                   6520:             </div>
                   6521:           </div>
                   6522: 
1.27      rillig   6523:           <p>Building, installation and creation of a binary
1.45      wiz      6524:           package are all controlled by the package's <code xmlns=
                   6525:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6526:           "filename">Makefile</code>. The <code xmlns=
                   6527:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6528:           "filename">Makefile</code> describes various things about
                   6529:           a package, for example from where to get it, how to
                   6530:           configure, build, and install it.</p>
                   6531: 
1.45      wiz      6532:           <p>A package <code xmlns=
                   6533:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6534:           "filename">Makefile</code> contains several sections that
                   6535:           describe the package.</p>
1.25      rillig   6536: 
1.27      rillig   6537:           <p>In the first section there are the following
                   6538:           variables, which should appear exactly in the order given
                   6539:           here.</p>
1.25      rillig   6540: 
                   6541:           <div class="itemizedlist">
                   6542:             <ul type="disc">
                   6543:               <li>
1.27      rillig   6544:                 <p><code class="varname">DISTNAME</code> is the
                   6545:                 basename of the distribution file to be downloaded
                   6546:                 from the package's website.</p>
                   6547:               </li>
                   6548: 
                   6549:               <li>
                   6550:                 <p><code class="varname">PKGNAME</code> is the name
                   6551:                 of the package, as used by pkgsrc. You only need to
1.50      rillig   6552:                 provide it if it differs from <code class=
                   6553:                 "varname">DISTNAME</code>. Usually it is the
                   6554:                 directory name together with the version number. It
                   6555:                 must match the regular expression <code class=
1.27      rillig   6556:                 "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
                   6557:                 that is, it starts with a letter or digit, and
                   6558:                 contains only letters, digits, dashes, underscores,
                   6559:                 dots and plus signs.</p>
1.25      rillig   6560:               </li>
                   6561: 
                   6562:               <li>
1.27      rillig   6563:                 <p><code class="varname">CATEGORIES</code> is a
                   6564:                 list of categories which the package fits in. You
                   6565:                 can choose any of the top-level directories of
                   6566:                 pkgsrc for it.</p>
1.45      wiz      6567: 
                   6568:                 <p>Currently the following values are available for
                   6569:                 <code class="varname">CATEGORIES</code>. If more
                   6570:                 than one is used, they need to be separated by
                   6571:                 spaces:</p>
                   6572:                 <pre class="programlisting">
1.51      rillig   6573:     archivers     cross         geography     meta-pkgs     security
                   6574:     audio         databases     graphics      misc          shells
                   6575:     benchmarks    devel         ham           multimedia    sysutils
                   6576:     biology       editors       inputmethod   net           textproc
                   6577:     cad           emulators     lang          news          time
                   6578:     chat          finance       mail          parallel      wm
                   6579:     comms         fonts         math          pkgtools      www
                   6580:     converters    games         mbone         print         x11
1.45      wiz      6581: </pre>
1.25      rillig   6582:               </li>
                   6583: 
                   6584:               <li>
1.27      rillig   6585:                 <p><code class="varname">MASTER_SITES</code> is a
                   6586:                 list of URLs where the distribution files can be
                   6587:                 downloaded. Each URL must end with a slash.</p>
1.45      wiz      6588: 
                   6589:                 <p>The <code class="varname">MASTER_SITES</code>
                   6590:                 may make use of the following predefined sites:</p>
                   6591:                 <pre class="programlisting">
1.51      rillig   6592:     ${MASTER_SITE_APACHE}
                   6593:     ${MASTER_SITE_BACKUP}
                   6594:     ${MASTER_SITE_CYGWIN}
                   6595:     ${MASTER_SITE_DEBIAN}
                   6596:     ${MASTER_SITE_FREEBSD}
                   6597:     ${MASTER_SITE_FREEBSD_LOCAL}
                   6598:     ${MASTER_SITE_GNOME}
                   6599:     ${MASTER_SITE_GNU}
                   6600:     ${MASTER_SITE_GNUSTEP}
                   6601:     ${MASTER_SITE_IFARCHIVE}
                   6602:     ${MASTER_SITE_MOZILLA}
                   6603:     ${MASTER_SITE_OPENOFFICE}
                   6604:     ${MASTER_SITE_PERL_CPAN}
                   6605:     ${MASTER_SITE_R_CRAN}
                   6606:     ${MASTER_SITE_SOURCEFORGE}
                   6607:     ${MASTER_SITE_SUNSITE}
                   6608:     ${MASTER_SITE_SUSE}
                   6609:     ${MASTER_SITE_TEX_CTAN}
                   6610:     ${MASTER_SITE_XCONTRIB}
                   6611:     ${MASTER_SITE_XEMACS}
1.45      wiz      6612: </pre>
                   6613: 
                   6614:                 <p>If one of these predefined sites is chosen, you
                   6615:                 may want to specify a subdirectory of that site.
                   6616:                 Since these macros may expand to more than one
                   6617:                 actual site, you <span class=
                   6618:                 "emphasis"><em>must</em></span> use the following
                   6619:                 construct to specify a subdirectory:</p>
                   6620:                 <pre class="programlisting">
1.51      rillig   6621:     ${MASTER_SITE_GNU:=subdirectory/name/}
                   6622:     ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.45      wiz      6623: </pre>
                   6624: 
                   6625:                 <p>Note the trailing slash after the subdirectory
                   6626:                 name.</p>
                   6627: 
                   6628:                 <p>If the package has multiple <code class=
                   6629:                 "varname">DISTFILES</code> or multiple <code class=
                   6630:                 "varname">PATCHFILES</code> from different sites,
                   6631:                 set <code class="varname">SITES_foo</code> to a
1.47      reed     6632:                 list of URIs where file &#8220;<span class=
1.45      wiz      6633:                 "quote">foo</span>&#8221; may be found.
                   6634:                 &#8220;<span class="quote">foo</span>&#8221;
1.47      reed     6635:                 includes the suffix, e.g.:</p>
1.45      wiz      6636:                 <pre class="programlisting">
1.51      rillig   6637:     DISTFILES=      ${DISTNAME}${EXTRACT_SUFX}
                   6638:     DISTFILES+=     foo-file.tar.gz
                   6639:     SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
                   6640:             http://www.somewhereelse.com/mirror/somehow/
1.45      wiz      6641: </pre>
                   6642:               </li>
                   6643: 
                   6644:               <li>
                   6645:                 <p><code class="varname">DISTFILES</code>: Name(s)
                   6646:                 of archive file(s) containing distribution. The
                   6647:                 default is <code xmlns=
                   6648:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6649:                 "filename">${DISTNAME}${EXTRACT_SUFX}</code>.
                   6650:                 Should only be set if you have more than one
                   6651:                 distfile.</p>
                   6652: 
                   6653:                 <p>Note that the normal default setting of
                   6654:                 <code class="varname">DISTFILES</code> must be made
                   6655:                 explicit if you want to add to it (rather than
                   6656:                 replace it), as you usually would.</p>
                   6657:               </li>
                   6658: 
                   6659:               <li>
                   6660:                 <p><code class="varname">EXTRACT_SUFX</code>:
                   6661:                 Suffix of the distribution file, will be appended
                   6662:                 to <code class="varname">DISTNAME</code>. Defaults
                   6663:                 to <code xmlns=
                   6664:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6665:                 "filename">.tar.gz</code>.</p>
                   6666:               </li>
                   6667:             </ul>
                   6668:           </div>
                   6669: 
                   6670:           <p>The second section contains information about
                   6671:           separately downloaded patches, if any.</p>
                   6672: 
                   6673:           <div class="itemizedlist">
                   6674:             <ul type="disc">
                   6675:               <li>
1.47      reed     6676:                 <p><code class="varname">PATCHFILES:</code> Name(s)
1.45      wiz      6677:                 of additional files that contain distribution
                   6678:                 patches. There is no default. pkgsrc will look for
                   6679:                 them at <code class="varname">PATCH_SITES</code>.
                   6680:                 They will automatically be uncompressed before
                   6681:                 patching if the names end with <code xmlns=
                   6682:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6683:                 "filename">.gz</code> or <code xmlns=
                   6684:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6685:                 "filename">.Z</code>.</p>
                   6686:               </li>
                   6687: 
                   6688:               <li>
                   6689:                 <p><code class="varname">PATCH_SITES</code>:
                   6690:                 Primary location(s) for distribution patch files
                   6691:                 (see <code class="varname">PATCHFILES</code> below)
                   6692:                 if not found locally.</p>
1.25      rillig   6693:               </li>
                   6694:             </ul>
                   6695:           </div>
                   6696: 
1.45      wiz      6697:           <p>The third section contains the following
1.27      rillig   6698:           variables.</p>
1.25      rillig   6699: 
1.27      rillig   6700:           <div class="itemizedlist">
                   6701:             <ul type="disc">
                   6702:               <li>
                   6703:                 <p><code class="varname">MAINTAINER</code> is the
1.50      rillig   6704:                 email address of the person who feels responsible
                   6705:                 for this package, and who is most likely to look at
                   6706:                 problems or questions regarding this package which
                   6707:                 have been reported with <a href=
1.45      wiz      6708:                 "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
                   6709:                 <span class="citerefentry"><span class=
1.50      rillig   6710:                 "refentrytitle">send-pr</span>(1)</span></a>. Other
                   6711:                 developers should contact the <code class=
                   6712:                 "varname">MAINTAINER</code> before making major
                   6713:                 changes to the package. When packaging a new
                   6714:                 program, set <code class=
                   6715:                 "varname">MAINTAINER</code> to yourself. If you
                   6716:                 really can't maintain the package for future
                   6717:                 updates, set it to <code class="email">&lt;<a href=
1.45      wiz      6718:                 "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>&gt;</code>.</p>
1.27      rillig   6719:               </li>
1.25      rillig   6720: 
1.27      rillig   6721:               <li>
                   6722:                 <p><code class="varname">HOMEPAGE</code> is a URL
                   6723:                 where users can find more information about the
1.23      wiz      6724:                 package.</p>
                   6725:               </li>
1.1       grant    6726: 
1.23      wiz      6727:               <li>
                   6728:                 <p><code class="varname">COMMENT</code> is a
1.45      wiz      6729:                 one-line description of the package (should not
                   6730:                 include the package name).</p>
1.23      wiz      6731:               </li>
                   6732:             </ul>
                   6733:           </div>
1.1       grant    6734: 
1.45      wiz      6735:           <p>Other variables that affect the build:</p>
1.1       grant    6736: 
1.45      wiz      6737:           <div class="itemizedlist">
                   6738:             <ul type="disc">
                   6739:               <li>
                   6740:                 <p><code class="varname">WRKSRC</code>: The
1.50      rillig   6741:                 directory where the interesting distribution files
                   6742:                 of the package are found. The default is
                   6743:                 <code xmlns=
                   6744:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6745:                 "filename">${WRKDIR}/${DISTNAME}</code>, which
                   6746:                 works for most packages.</p>
                   6747: 
                   6748:                 <p>If a package doesn't create a subdirectory for
                   6749:                 itself (most GNU software does, for instance), but
                   6750:                 extracts itself in the current directory, you
                   6751:                 should set <code class="varname">WRKSRC=
                   6752:                 ${WRKDIR}</code>.</p>
                   6753: 
                   6754:                 <p>If a package doesn't create a subdirectory with
                   6755:                 the name of <code class="varname">DISTNAME</code>
                   6756:                 but some different name, set <code class=
                   6757:                 "varname">WRKSRC</code> to point to the proper name
                   6758:                 in <code xmlns=
                   6759:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6760:                 "filename">${WRKDIR}</code>, for example
                   6761:                 <code class="varname">WRKSRC=
                   6762:                 ${WRKDIR}/${DISTNAME}/unix</code>. See <a xmlns=
                   6763:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6764:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
                   6765:                 target="_top"><code xmlns="" class=
                   6766:                 "filename">lang/tcl</code></a> and <a xmlns=
                   6767:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6768:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
                   6769:                 target="_top"><code xmlns="" class=
                   6770:                 "filename">x11/tk</code></a> for other
                   6771:                 examples.</p>
                   6772: 
                   6773:                 <p>The name of the working directory created by
                   6774:                 pkgsrc is taken from the <code class=
                   6775:                 "varname">WRKDIR_BASENAME</code> variable. By
                   6776:                 default, its value is <code xmlns=
                   6777:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6778:                 "filename">work</code>. If you want to use the same
                   6779:                 pkgsrc tree for building different kinds of binary
                   6780:                 packages, you can change the variable according to
                   6781:                 your needs. Two other variables handle common cases
                   6782:                 of setting <code class=
                   6783:                 "varname">WRKDIR_BASENAME</code> individually. If
                   6784:                 <code class="varname">OBJHOSTNAME</code> is defined
                   6785:                 in <code xmlns=
1.45      wiz      6786:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.50      rillig   6787:                 "filename">/etc/mk.conf</code>, the first component
                   6788:                 of the host's name is attached to the directory
                   6789:                 name. If <code class="varname">OBJMACHINE</code> is
                   6790:                 defined, the platform name is attached, which might
                   6791:                 look like <code xmlns=
                   6792:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6793:                 "filename">work.i386</code> or <code xmlns=
1.45      wiz      6794:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.50      rillig   6795:                 "filename">work.sparc</code>.</p>
1.45      wiz      6796:               </li>
                   6797:             </ul>
1.1       grant    6798:           </div>
                   6799: 
                   6800:           <p>Please pay attention to the following gotchas:</p>
                   6801: 
                   6802:           <div class="itemizedlist">
                   6803:             <ul type="disc">
                   6804:               <li>
1.14      xtraeme  6805:                 <p>Add <code class="varname">MANCOMPRESSED</code>
1.47      reed     6806:                 if man pages are installed in compressed form by
                   6807:                 the package; see comment in <code xmlns=
1.45      wiz      6808:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6809:                 "filename">bsd.pkg.mk</code>.</p>
1.1       grant    6810:               </li>
                   6811: 
                   6812:               <li>
1.45      wiz      6813:                 <p>Replace <code xmlns=
                   6814:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6815:                 "filename">/usr/local</code> with
                   6816:                 &#8220;<span class="quote">${PREFIX}</span>&#8221;
                   6817:                 in all files (see patches, below).</p>
1.1       grant    6818:               </li>
                   6819: 
                   6820:               <li>
                   6821:                 <p>If the package installs any info files, see
                   6822:                 <a href="#faq.info-files" title=
1.45      wiz      6823:                 "15.5.7.&nbsp;Packages installing info files">Section&nbsp;15.5.7,
                   6824:                 &#8220;Packages installing info
1.1       grant    6825:                 files&#8221;</a>.</p>
                   6826:               </li>
                   6827:             </ul>
                   6828:           </div>
                   6829:         </div>
                   6830: 
1.63    ! dillo    6831:         <div class="sect1" lang="en">
1.1       grant    6832:           <div class="titlepage">
                   6833:             <div>
                   6834:               <div>
                   6835:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      6836:                 "components.distinfo"></a>8.2.&nbsp;<code xmlns=
                   6837:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6838:                 "filename">distinfo</code></h2>
1.1       grant    6839:               </div>
                   6840:             </div>
                   6841:           </div>
                   6842: 
1.50      rillig   6843:           <p>The <code xmlns=
                   6844:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6845:           "filename">distinfo</code> file contains the message
                   6846:           digest, or checksum, of each distfile needed for the
                   6847:           package. This ensures that the distfiles retrieved from
                   6848:           the Internet have not been corrupted during transfer or
                   6849:           altered by a malign force to introduce a security hole.
                   6850:           Due to recent rumor about weaknesses of digest
                   6851:           algorithms, all distfiles are protected using both SHA1
                   6852:           and RMD160 message digests, as well as the file size.</p>
                   6853: 
                   6854:           <p>The <code xmlns=
                   6855:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6856:           "filename">distinfo</code> file also contains the
                   6857:           checksums for all the patches found in the <code xmlns=
                   6858:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6859:           "filename">patches</code> directory (see <a href=
                   6860:           "#components.patches" title=
                   6861:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
                   6862:           &#8220;patches/*&#8221;</a>).</p>
                   6863: 
                   6864:           <p>To regenerate the <code xmlns=
                   6865:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6866:           "filename">distinfo</code> file, use the
1.14      xtraeme  6867:           <span><strong class="command">make
1.50      rillig   6868:           makedistinfo</strong></span> or <span><strong class=
                   6869:           "command">make mdi</strong></span> command.</p>
1.1       grant    6870: 
1.50      rillig   6871:           <p>Some packages have different sets of distfiles
                   6872:           depending on the platform, for example <a xmlns=
1.1       grant    6873:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   6874:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.45      wiz      6875:           target="_top"><code xmlns="" class=
                   6876:           "filename">www/navigator</code></a>). These are kept in
1.50      rillig   6877:           the same <code xmlns=
1.45      wiz      6878:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.50      rillig   6879:           "filename">distinfo</code> file and care should be taken
                   6880:           when upgrading such a package to ensure distfile
                   6881:           information is not lost.</p>
1.1       grant    6882:         </div>
                   6883: 
1.63    ! dillo    6884:         <div class="sect1" lang="en">
1.1       grant    6885:           <div class="titlepage">
                   6886:             <div>
                   6887:               <div>
                   6888:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    6889:                 "components.patches"></a>8.3.&nbsp;patches/*</h2>
1.1       grant    6890:               </div>
                   6891:             </div>
                   6892:           </div>
                   6893: 
                   6894:           <p>This directory contains files that are used by the
                   6895:           <a href=
                   6896:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   6897:           <span class="citerefentry"><span class=
                   6898:           "refentrytitle">patch</span>(1)</span></a> command to
                   6899:           modify the sources as distributed in the distribution
                   6900:           file into a form that will compile and run perfectly on
                   6901:           NetBSD. The files are applied successively in alphabetic
                   6902:           order (as returned by a shell &#8220;<span class=
                   6903:           "quote">patches/patch-*</span>&#8221; glob expansion), so
1.45      wiz      6904:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6905:           class="filename">patch-aa</code> is applied before
                   6906:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6907:           class="filename">patch-ab</code>, etc.</p>
                   6908: 
                   6909:           <p>The <code xmlns=
                   6910:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6911:           "filename">patch-*</code> files should be in
                   6912:           <span><strong class="command">diff -bu</strong></span>
                   6913:           format, and apply without a fuzz to avoid problems. (To
                   6914:           force patches to apply with fuzz you can set <code class=
1.14      xtraeme  6915:           "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1       grant    6916:           not put changes for more than one file into a single
1.47      reed     6917:           patch file, as this will make future modifications more
1.1       grant    6918:           difficult.</p>
                   6919: 
                   6920:           <p>Similar, a file should be patched at most once, not
                   6921:           several times by several different patches. If a file
                   6922:           needs several patches, they should be combined into one
                   6923:           file.</p>
                   6924: 
                   6925:           <p>One important thing to mention is to pay attention
                   6926:           that no RCS IDs get stored in the patch files, as these
                   6927:           will cause problems when later checked into the NetBSD
1.14      xtraeme  6928:           CVS tree. Use the <span><strong class=
                   6929:           "command">pkgdiff</strong></span> from the <a xmlns=
1.1       grant    6930:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   6931:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45      wiz      6932:           target="_top"><code xmlns="" class=
                   6933:           "filename">pkgtools/pkgdiff</code></a> package to avoid
1.20      ben      6934:           these problems.</p>
1.1       grant    6935: 
                   6936:           <p>For even more automation, we recommend using
1.14      xtraeme  6937:           <span><strong class="command">mkpatches</strong></span>
                   6938:           from the same package to make a whole set of patches. You
                   6939:           just have to backup files before you edit them to
1.45      wiz      6940:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6941:           class="filename">filename.orig</code>, e.g. with
1.14      xtraeme  6942:           <span><strong class="command">cp -p filename
                   6943:           filename.orig</strong></span> or, easier, by using
                   6944:           <span><strong class="command">pkgvi</strong></span> again
                   6945:           from the same package. If you upgrade a package this way,
                   6946:           you can easily compare the new set of patches with the
                   6947:           previously existing one with <span><strong class=
                   6948:           "command">patchdiff</strong></span>.</p>
1.1       grant    6949: 
                   6950:           <p>When you have finished a package, remember to generate
                   6951:           the checksums for the patch files by using the
1.14      xtraeme  6952:           <span><strong class="command">make
                   6953:           makepatchsum</strong></span> command, see <a href=
                   6954:           "#components.distinfo" title=
1.38      dillo    6955:           "8.2.&nbsp;distinfo">Section&nbsp;8.2,
1.45      wiz      6956:           &#8220;<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6957:           class="filename">distinfo</code>&#8221;</a>.</p>
1.1       grant    6958: 
1.46      gdt      6959:           <p>When adding a patch that corrects a problem in the
                   6960:           distfile (rather than e.g. enforcing pkgsrc's view of
                   6961:           where man pages should go), send the patch as a bug
                   6962:           report to the maintainer. This benefits non-pkgsrc users
                   6963:           of the package, and usually enables removing the patch in
                   6964:           future version.</p>
                   6965: 
1.1       grant    6966:           <p>Patch files that are distributed by the author or
1.14      xtraeme  6967:           other maintainers can be listed in <code class=
                   6968:           "varname">$PATCHFILES</code>.</p>
1.1       grant    6969: 
                   6970:           <p>If it is desired to store any patches that should not
                   6971:           be committed into pkgsrc, they can be kept outside the
1.45      wiz      6972:           pkgsrc tree in the <code xmlns=
                   6973:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6974:           "filename">$LOCALPATCHES</code> directory. The directory
1.1       grant    6975:           tree there is expected to have the same
                   6976:           &#8220;<span class="quote">category/package</span>&#8221;
                   6977:           structure as pkgsrc, and patches are expected to be
1.45      wiz      6978:           stored inside these dirs (also known as <code xmlns=
                   6979:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     6980:           "filename">$LOCALPATCHES/$PKGPATH</code>). For example,
                   6981:           if you want to keep a private patch for <code xmlns=
1.45      wiz      6982:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6983:           "filename">pkgsrc/graphics/png</code>, keep it in
1.45      wiz      6984:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6985:           class=
1.14      xtraeme  6986:           "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
                   6987:           files in the named directory are expected to be patch
1.1       grant    6988:           files, and <span class="emphasis"><em>they are applied
                   6989:           after pkgsrc patches are applied</em></span>.</p>
1.27      rillig   6990:         </div>
                   6991: 
1.63    ! dillo    6992:         <div class="sect1" lang="en">
1.27      rillig   6993:           <div class="titlepage">
                   6994:             <div>
                   6995:               <div>
                   6996:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    6997:                 "other-mandatory-files"></a>8.4.&nbsp;Other
1.27      rillig   6998:                 mandatory files</h2>
                   6999:               </div>
                   7000:             </div>
                   7001:           </div>
                   7002: 
                   7003:           <div class="variablelist">
                   7004:             <dl>
1.45      wiz      7005:               <dt><span class="term"><code xmlns=
                   7006:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7007:               "filename">DESCR</code></span></dt>
                   7008: 
                   7009:               <dd>
                   7010:                 <p>A multi-line description of the piece of
                   7011:                 software. This should include any credits where
                   7012:                 they are due. Please bear in mind that others do
                   7013:                 not share your sense of humour (or spelling
                   7014:                 idiosyncrasies), and that others will read
                   7015:                 everything that you write here.</p>
                   7016:               </dd>
                   7017: 
1.45      wiz      7018:               <dt><span class="term"><code xmlns=
                   7019:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7020:               "filename">PLIST</code></span></dt>
                   7021: 
                   7022:               <dd>
                   7023:                 <p>This file governs the files that are installed
                   7024:                 on your system: all the binaries, manual pages,
                   7025:                 etc. There are other directives which may be
                   7026:                 entered in this file, to control the creation and
                   7027:                 deletion of directories, and the location of
                   7028:                 inserted files. See <a href="#plist" title=
1.38      dillo    7029:                 "Chapter&nbsp;10.&nbsp;PLIST issues">Chapter&nbsp;10,
1.27      rillig   7030:                 <i>PLIST issues</i></a> for more information.</p>
                   7031:               </dd>
                   7032:             </dl>
                   7033:           </div>
                   7034:         </div>
                   7035: 
1.63    ! dillo    7036:         <div class="sect1" lang="en">
1.27      rillig   7037:           <div class="titlepage">
                   7038:             <div>
                   7039:               <div>
                   7040:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7041:                 "components.optional"></a>8.5.&nbsp;Optional
1.27      rillig   7042:                 files</h2>
                   7043:               </div>
                   7044:             </div>
                   7045:           </div>
                   7046: 
                   7047:           <div class="variablelist">
                   7048:             <dl>
1.45      wiz      7049:               <dt><span class="term"><code xmlns=
                   7050:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7051:               "filename">INSTALL</code></span></dt>
                   7052: 
                   7053:               <dd>
                   7054:                 <p>This shell script is invoked twice by <a href=
                   7055:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7056:                 <span class="citerefentry"><span class=
                   7057:                 "refentrytitle">pkg_add</span>(1)</span></a>. First
                   7058:                 time after package extraction and before files are
                   7059:                 moved in place, the second time after the files to
                   7060:                 install are moved in place. This can be used to do
                   7061:                 any custom procedures not possible with @exec
1.45      wiz      7062:                 commands in <code xmlns=
                   7063:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7064:                 "filename">PLIST</code>. See <a href=
1.27      rillig   7065:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7066:                 <span class="citerefentry"><span class=
                   7067:                 "refentrytitle">pkg_add</span>(1)</span></a> and
                   7068:                 <a href=
                   7069:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   7070:                 <span class="citerefentry"><span class=
                   7071:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   7072:                 more information.</p>
                   7073:               </dd>
                   7074: 
1.45      wiz      7075:               <dt><span class="term"><code xmlns=
                   7076:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7077:               "filename">DEINSTALL</code></span></dt>
                   7078: 
                   7079:               <dd>
                   7080:                 <p>This script is executed before and after any
                   7081:                 files are removed. It is this script's
                   7082:                 responsibility to clean up any additional messy
                   7083:                 details around the package's installation, since
                   7084:                 all pkg_delete knows is how to delete the files
                   7085:                 created in the original distribution. See <a href=
                   7086:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   7087:                 <span class="citerefentry"><span class=
                   7088:                 "refentrytitle">pkg_delete</span>(1)</span></a> and
                   7089:                 <a href=
                   7090:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   7091:                 <span class="citerefentry"><span class=
                   7092:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   7093:                 more information.</p>
                   7094:               </dd>
                   7095: 
1.45      wiz      7096:               <dt><span class="term"><code xmlns=
                   7097:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7098:               "filename">MESSAGE</code></span></dt>
                   7099: 
                   7100:               <dd>
1.50      rillig   7101:                 <p>This file is displayed after installation of the
1.27      rillig   7102:                 package. Useful for things like legal notices on
                   7103:                 almost-free software and hints for updating config
                   7104:                 files after installing modules for apache, PHP etc.
                   7105:                 Please note that you can modify variables in it
                   7106:                 easily by using <code class=
                   7107:                 "varname">MESSAGE_SUBST</code> in the package's
1.45      wiz      7108:                 <code xmlns=
                   7109:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7110:                 "filename">Makefile</code>:</p>
1.27      rillig   7111:                 <pre class="programlisting">
1.51      rillig   7112:     MESSAGE_SUBST+=  SOMEVAR="somevalue"
1.27      rillig   7113: </pre>
                   7114: 
                   7115:                 <p>replaces "${SOMEVAR}" with &#8220;<span class=
1.45      wiz      7116:                 "quote">somevalue</span>&#8221; in <code xmlns=
                   7117:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7118:                 "filename">MESSAGE</code>.</p>
                   7119:               </dd>
                   7120:             </dl>
                   7121:           </div>
                   7122:         </div>
                   7123: 
1.63    ! dillo    7124:         <div class="sect1" lang="en">
1.27      rillig   7125:           <div class="titlepage">
                   7126:             <div>
                   7127:               <div>
                   7128:                 <h2 class="title" style="clear: both"><a name=
1.63    ! dillo    7129:                 "work-dir"></a>8.6.&nbsp;<code xmlns=
1.45      wiz      7130:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7131:                 "filename">work*</code></h2>
                   7132:               </div>
                   7133:             </div>
                   7134:           </div>
                   7135: 
                   7136:           <p>When you type <span><strong class=
1.47      reed     7137:           "command">make</strong></span>, the distribution files
                   7138:           are unpacked into the directory denoted by <code class=
1.45      wiz      7139:           "varname">WRKDIR</code>. It can be removed by running
                   7140:           <span><strong class="command">make clean</strong></span>.
                   7141:           Besides the sources, this directory is also used to keep
                   7142:           various timestamp files. The directory gets <span class=
                   7143:           "emphasis"><em>removed completely</em></span> on clean.
                   7144:           The default is <code xmlns=
                   7145:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   7146:           "filename">${.CURDIR}/work</code> or <code xmlns=
                   7147:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   7148:           "filename">${.CURDIR}/work.${MACHINE_ARCH}</code> if
                   7149:           <code class="varname">OBJMACHINE</code> is set.</p>
1.27      rillig   7150:         </div>
                   7151: 
1.63    ! dillo    7152:         <div class="sect1" lang="en">
1.27      rillig   7153:           <div class="titlepage">
                   7154:             <div>
                   7155:               <div>
                   7156:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      7157:                 "files-dir"></a>8.7.&nbsp;<code xmlns=
                   7158:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7159:                 "filename">files/*</code></h2>
                   7160:               </div>
                   7161:             </div>
                   7162:           </div>
                   7163: 
                   7164:           <p>If you have any files that you wish to be placed in
                   7165:           the package prior to configuration or building, you could
                   7166:           place these files here and use a &#8220;<span class=
                   7167:           "quote">${CP}</span>&#8221; command in the
                   7168:           &#8220;<span class="quote">pre-configure</span>&#8221;
                   7169:           target to achieve this. Alternatively, you could simply
1.45      wiz      7170:           diff the file against <code xmlns=
                   7171:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7172:           "filename">/dev/null</code> and use the patch mechanism
                   7173:           to manage the creation of this file.</p>
                   7174:         </div>
                   7175:       </div>
                   7176: 
1.63    ! dillo    7177:       <div class="chapter" lang="en">
1.27      rillig   7178:         <div class="titlepage">
                   7179:           <div>
                   7180:             <div>
1.63    ! dillo    7181:               <h2 class="title"><a name=
1.38      dillo    7182:               "makefile"></a>Chapter&nbsp;9.&nbsp;Programming in
1.45      wiz      7183:               <code xmlns=
                   7184:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   7185:               "filename">Makefile</code>s</h2>
1.27      rillig   7186:             </div>
                   7187:           </div>
                   7188:         </div>
                   7189: 
                   7190:         <div class="toc">
                   7191:           <p><b>Table of Contents</b></p>
                   7192: 
                   7193:           <dl>
                   7194:             <dt><span class="sect1"><a href=
1.45      wiz      7195:             "#makefile.variables">9.1. <code xmlns=
                   7196:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7197:             "filename">Makefile</code> variables</a></span></dt>
                   7198: 
                   7199:             <dd>
                   7200:               <dl>
                   7201:                 <dt><span class="sect2"><a href=
1.38      dillo    7202:                 "#makefile.variables.names">9.1.1. Naming
1.27      rillig   7203:                 conventions</a></span></dt>
                   7204:               </dl>
                   7205:             </dd>
                   7206: 
1.38      dillo    7207:             <dt><span class="sect1"><a href="#makefile.code">9.2.
1.27      rillig   7208:             Code snippets</a></span></dt>
                   7209: 
                   7210:             <dd>
                   7211:               <dl>
1.30      wiz      7212:                 <dt><span class="sect2"><a href=
1.38      dillo    7213:                 "#adding-to-list">9.2.1. Adding things to a
1.30      wiz      7214:                 list</a></span></dt>
1.27      rillig   7215: 
1.30      wiz      7216:                 <dt><span class="sect2"><a href=
1.38      dillo    7217:                 "#converting-internal-to-external">9.2.2.
1.27      rillig   7218:                 Converting an internal list into an external
                   7219:                 list</a></span></dt>
                   7220: 
1.30      wiz      7221:                 <dt><span class="sect2"><a href=
1.38      dillo    7222:                 "#passing-variable-to-shell">9.2.3. Passing
1.30      wiz      7223:                 variables to a shell command</a></span></dt>
1.27      rillig   7224: 
1.30      wiz      7225:                 <dt><span class="sect2"><a href=
1.38      dillo    7226:                 "#quoting-guideline">9.2.4. Quoting
1.30      wiz      7227:                 guideline</a></span></dt>
1.27      rillig   7228: 
1.30      wiz      7229:                 <dt><span class="sect2"><a href=
1.38      dillo    7230:                 "#bsd-make-bug-workaround">9.2.5. Workaround for a
1.30      wiz      7231:                 bug in BSD Make</a></span></dt>
1.27      rillig   7232:               </dl>
                   7233:             </dd>
                   7234:           </dl>
                   7235:         </div>
                   7236: 
1.45      wiz      7237:         <p>Pkgsrc consists of many <code xmlns=
                   7238:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7239:         "filename">Makefile</code> fragments, each of which forms a
                   7240:         well-defined part of the pkgsrc system. Using the <a href=
                   7241:         "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7242:         <span class="citerefentry"><span class=
                   7243:         "refentrytitle">make</span>(1)</span></a> system as a
                   7244:         programming language for a big system like pkgsrc requires
                   7245:         some discipline to keep the code correct and
                   7246:         understandable.</p>
                   7247: 
1.45      wiz      7248:         <p>The basic ingredients for <code xmlns=
                   7249:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7250:         "filename">Makefile</code> programming are variables (which
                   7251:         are actually macros) and shell commands. Among these shell
                   7252:         commands may even be more complex ones like <a href=
                   7253:         "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
                   7254:         <span class="citerefentry"><span class=
                   7255:         "refentrytitle">awk</span>(1)</span></a> programs. To make
                   7256:         sure that every shell command runs as intended it is
                   7257:         necessary to quote all variables correctly when they are
                   7258:         used.</p>
                   7259: 
                   7260:         <p>This chapter describes some patterns, that appear quite
1.45      wiz      7261:         often in <code xmlns=
                   7262:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   7263:         "filename">Makefile</code>s, including the pitfalls that
                   7264:         come along with them.</p>
1.27      rillig   7265: 
1.63    ! dillo    7266:         <div class="sect1" lang="en">
1.27      rillig   7267:           <div class="titlepage">
                   7268:             <div>
                   7269:               <div>
                   7270:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      7271:                 "makefile.variables"></a>9.1.&nbsp;<code xmlns=
                   7272:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7273:                 "filename">Makefile</code> variables</h2>
                   7274:               </div>
                   7275:             </div>
                   7276:           </div>
                   7277: 
1.45      wiz      7278:           <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7279:           class="filename">Makefile</code> variables contain
                   7280:           strings that can be processed using the five operators
                   7281:           ``='', ``+='', ``?='', ``:='', and ``!='', which are
                   7282:           described in the <a href=
1.27      rillig   7283:           "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7284:           <span class="citerefentry"><span class=
                   7285:           "refentrytitle">make</span>(1)</span></a> man page.</p>
                   7286: 
1.45      wiz      7287:           <p>When a variable's value is parsed from a <code xmlns=
                   7288:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7289:           "filename">Makefile</code>, the hash character ``#'' and
                   7290:           the backslash character ``\'' are handled specially. If a
                   7291:           backslash is followed by a newline, any whitespace
                   7292:           immediately in front of the backslash, the backslash, the
                   7293:           newline, and any whitespace immediately behind the
                   7294:           newline are replaced with a single space. A backspace
                   7295:           character and an immediately following hash character are
1.47      reed     7296:           replaced with a single hash character. Otherwise, the
1.27      rillig   7297:           backslash is passed as is. In a variable assignment, any
                   7298:           hash character that is not preceded by a backslash starts
                   7299:           a comment that continues upto the end of the logical
                   7300:           line.</p>
                   7301: 
                   7302:           <p><span class="emphasis"><em>Note:</em></span> Because
                   7303:           of this parsing algorithm the only way to create a
                   7304:           variable consisting of a single backslash is using the
                   7305:           ``!='' operator, for example: <code class=
                   7306:           "varname">BACKSLASH!=echo "\\"</code>.</p>
                   7307: 
                   7308:           <p>So far for defining variables. The other thing you can
                   7309:           do with variables is evaluating them. A variable is
                   7310:           evaluated when it is part of the right side of the ``:=''
                   7311:           or the ``!='' operator, or directly before executing a
                   7312:           shell command which the variable is part of. In all other
1.47      reed     7313:           cases, <a href=
1.27      rillig   7314:           "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7315:           <span class="citerefentry"><span class=
                   7316:           "refentrytitle">make</span>(1)</span></a> performs lazy
                   7317:           evaluation, that is, variables are not evaluated until
                   7318:           there's no other way. The ``modifiers'' mentioned in the
                   7319:           man page also evaluate the variable.</p>
                   7320: 
                   7321:           <p>Some of the modifiers split the string into words and
                   7322:           then operate on the words, others operate on the string
1.47      reed     7323:           as a whole. When a string is split into words, it is
                   7324:           split as you would expect it from <a href=
1.27      rillig   7325:           "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
                   7326:           <span class="citerefentry"><span class=
                   7327:           "refentrytitle">sh</span>(1)</span></a>.</p>
                   7328: 
                   7329:           <p>No rule without exception&#8212;the
                   7330:           <span><strong class="command">.for</strong></span> loop
                   7331:           does not follow the shell quoting rules but splits at
                   7332:           sequences of whitespace.</p>
                   7333: 
                   7334:           <p>There are several types of variables that should be
                   7335:           handled differently. Strings and two types of lists.</p>
                   7336: 
                   7337:           <div class="itemizedlist">
                   7338:             <ul type="disc">
                   7339:               <li>
                   7340:                 <p><span class="emphasis"><em>Strings</em></span>
1.47      reed     7341:                 can contain arbitrary characters. Nevertheless, you
1.27      rillig   7342:                 should restrict yourself to only using printable
                   7343:                 characters. Examples are <code class=
                   7344:                 "varname">PREFIX</code> and <code class=
                   7345:                 "varname">COMMENT</code>.</p>
                   7346:               </li>
                   7347: 
                   7348:               <li>
                   7349:                 <p><span class="emphasis"><em>Internal
                   7350:                 lists</em></span> are lists that are never exported
                   7351:                 to any shell command. Their elements are separated
1.47      reed     7352:                 by whitespace. Therefore, the elements themselves
1.27      rillig   7353:                 cannot have embedded whitespace. Any other
                   7354:                 characters are allowed. Internal lists can be used
                   7355:                 in <span><strong class=
                   7356:                 "command">.for</strong></span> loops. Examples are
                   7357:                 <code class="varname">DEPENDS</code> and
                   7358:                 <code class="varname">BUILD_DEPENDS</code>.</p>
                   7359:               </li>
                   7360: 
                   7361:               <li>
                   7362:                 <p><span class="emphasis"><em>External
                   7363:                 lists</em></span> are lists that may be exported to
                   7364:                 a shell command. Their elements can contain any
                   7365:                 characters, including whitespace. That's why they
                   7366:                 cannot be used in <span><strong class=
                   7367:                 "command">.for</strong></span> loops. Examples are
                   7368:                 <code class="varname">DISTFILES</code> and
                   7369:                 <code class="varname">MASTER_SITES</code>.</p>
                   7370:               </li>
                   7371:             </ul>
                   7372:           </div>
                   7373: 
1.63    ! dillo    7374:           <div class="sect2" lang="en">
1.27      rillig   7375:             <div class="titlepage">
                   7376:               <div>
                   7377:                 <div>
                   7378:                   <h3 class="title"><a name=
1.38      dillo    7379:                   "makefile.variables.names"></a>9.1.1.&nbsp;Naming
1.27      rillig   7380:                   conventions</h3>
                   7381:                 </div>
                   7382:               </div>
                   7383:             </div>
                   7384: 
                   7385:             <div class="itemizedlist">
                   7386:               <ul type="disc">
                   7387:                 <li>
                   7388:                   <p>All variable names starting with an underscore
                   7389:                   are reserved for use by the pkgsrc
                   7390:                   infrastructure. They shall not be used by package
1.45      wiz      7391:                   <code xmlns=
                   7392:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   7393:                   "filename">Makefile</code>s.</p>
1.27      rillig   7394:                 </li>
                   7395: 
                   7396:                 <li>
                   7397:                   <p>In <span><strong class=
                   7398:                   "command">.for</strong></span> loops you should
                   7399:                   use lowercase variable names for the iteration
                   7400:                   variables.</p>
                   7401:                 </li>
                   7402: 
                   7403:                 <li>
                   7404:                   <p>All list variables should have a ``plural''
                   7405:                   name, e.g. <code class=
                   7406:                   "varname">PKG_OPTIONS</code> or <code class=
                   7407:                   "varname">DISTFILES</code>.</p>
                   7408:                 </li>
                   7409:               </ul>
                   7410:             </div>
                   7411:           </div>
                   7412:         </div>
                   7413: 
1.63    ! dillo    7414:         <div class="sect1" lang="en">
1.27      rillig   7415:           <div class="titlepage">
                   7416:             <div>
                   7417:               <div>
                   7418:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7419:                 "makefile.code"></a>9.2.&nbsp;Code snippets</h2>
1.27      rillig   7420:               </div>
                   7421:             </div>
                   7422:           </div>
                   7423: 
                   7424:           <p>This section presents you with some code snippets you
                   7425:           should use in your own code. If you don't find anything
                   7426:           appropriate here, you should test your code and add it
                   7427:           here.</p>
                   7428: 
1.63    ! dillo    7429:           <div class="sect2" lang="en">
1.27      rillig   7430:             <div class="titlepage">
                   7431:               <div>
                   7432:                 <div>
1.63    ! dillo    7433:                   <h3 class="title"><a name=
1.38      dillo    7434:                   "adding-to-list"></a>9.2.1.&nbsp;Adding things to
1.30      wiz      7435:                   a list</h3>
1.27      rillig   7436:                 </div>
                   7437:               </div>
                   7438:             </div>
                   7439:             <pre class="programlisting">
1.51      rillig   7440:     STRING=                 foo * bar `date`
                   7441:     INT_LIST=               # empty
                   7442:     ANOTHER_INT_LIST=       apache-[0-9]*:../../www/apache
                   7443:     EXT_LIST=               # empty
                   7444:     ANOTHER_EXT_LIST=       a=b c=d
                   7445: 
                   7446:     INT_LIST+=              ${STRING}               # 1
                   7447:     INT_LIST+=              ${ANOTHER_INT_LIST}     # 2
                   7448:     EXT_LIST+=              ${STRING:Q}             # 3
                   7449:     EXT_LIST+=              ${ANOTHER_EXT_LIST}     # 4
1.27      rillig   7450: </pre>
                   7451: 
                   7452:             <p>When you add a string to an external list (example
                   7453:             3), it must be quoted. In all other cases, you must not
                   7454:             add a quoting level. You must not merge internal and
                   7455:             external lists, unless you are sure that all entries
                   7456:             are correctly interpreted in both lists.</p>
                   7457:           </div>
                   7458: 
1.63    ! dillo    7459:           <div class="sect2" lang="en">
1.27      rillig   7460:             <div class="titlepage">
                   7461:               <div>
                   7462:                 <div>
1.30      wiz      7463:                   <h3 class="title"><a name=
1.38      dillo    7464:                   "converting-internal-to-external"></a>9.2.2.&nbsp;Converting
1.30      wiz      7465:                   an internal list into an external list</h3>
1.27      rillig   7466:                 </div>
                   7467:               </div>
                   7468:             </div>
                   7469:             <pre class="programlisting">
1.51      rillig   7470:     EXT_LIST=       # empty
                   7471:     .for i in ${INT_LIST}
                   7472:     EXT_LIST+=      ${i:Q}""
                   7473:     .endfor
1.27      rillig   7474: </pre>
                   7475: 
                   7476:             <p>This code converts the internal list <code class=
                   7477:             "varname">INT_LIST</code> into the external list
                   7478:             <code class="varname">EXT_LIST</code>. As the elements
                   7479:             of an internal list are unquoted they must be quoted
                   7480:             here. The reason for appending <code class=
                   7481:             "varname">""</code> is explained below.</p>
                   7482:           </div>
1.1       grant    7483: 
1.63    ! dillo    7484:           <div class="sect2" lang="en">
1.27      rillig   7485:             <div class="titlepage">
1.1       grant    7486:               <div>
1.27      rillig   7487:                 <div>
1.30      wiz      7488:                   <h3 class="title"><a name=
1.38      dillo    7489:                   "passing-variable-to-shell"></a>9.2.3.&nbsp;Passing
1.30      wiz      7490:                   variables to a shell command</h3>
1.27      rillig   7491:                 </div>
1.1       grant    7492:               </div>
                   7493:             </div>
1.27      rillig   7494:             <pre class="programlisting">
1.51      rillig   7495:     STRING=         foo bar &lt;    &gt; * `date` $$HOME ' "
                   7496:     EXT_LIST=       string=${STRING:Q} x=second\ item
1.27      rillig   7497: 
1.51      rillig   7498:     all:
                   7499:             echo ${STRING}                  # 1
                   7500:             echo "${STRING}"                # 2
                   7501:             echo "${STRING:Q}"              # 3
                   7502:             echo ${STRING:Q}                # 4
                   7503:             echo x${STRING:Q} | sed 1s,.,,  # 5
                   7504:             env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
1.27      rillig   7505: </pre>
                   7506: 
                   7507:             <p>Example 1 leads to a syntax error in the shell, as
                   7508:             the characters are just copied.</p>
                   7509: 
                   7510:             <p>Example 2 leads to a syntax error too, and if you
                   7511:             leave out the last " character from <code class=
                   7512:             "varname">${STRING}</code>, <a href=
                   7513:             "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
                   7514:             <span class="citerefentry"><span class=
                   7515:             "refentrytitle">date</span>(1)</span></a> will be
                   7516:             executed. The <code class="varname">$HOME</code> shell
                   7517:             variable would be evaluated, too.</p>
                   7518: 
                   7519:             <p>Example 3 outputs each space character preceded by a
                   7520:             backslash (or not), depending on the implementation of
                   7521:             the <a href=
                   7522:             "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   7523:             <span class="citerefentry"><span class=
                   7524:             "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1       grant    7525: 
1.27      rillig   7526:             <p>Example 4 handles correctly every string that does
                   7527:             not start with a dash. In that case, the result depends
                   7528:             on the implementation of the <a href=
                   7529:             "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   7530:             <span class="citerefentry"><span class=
                   7531:             "refentrytitle">echo</span>(1)</span></a> command. As
                   7532:             long as you can guarantee that your input does not
1.47      reed     7533:             start with a dash, this form is appropriate.</p>
1.1       grant    7534: 
1.27      rillig   7535:             <p>Example 5 handles even the case of a leading dash
                   7536:             correctly.</p>
1.1       grant    7537: 
1.27      rillig   7538:             <p>The <code class="varname">EXT_LIST</code> does not
1.47      reed     7539:             need to be quoted because the quoting has already been
1.27      rillig   7540:             done when adding elements to the list.</p>
1.1       grant    7541: 
1.27      rillig   7542:             <p>As internal lists shall not be passed to the shell,
                   7543:             there is no example for it.</p>
1.1       grant    7544:           </div>
                   7545: 
1.63    ! dillo    7546:           <div class="sect2" lang="en">
1.27      rillig   7547:             <div class="titlepage">
1.1       grant    7548:               <div>
1.27      rillig   7549:                 <div>
1.63    ! dillo    7550:                   <h3 class="title"><a name=
1.38      dillo    7551:                   "quoting-guideline"></a>9.2.4.&nbsp;Quoting
1.27      rillig   7552:                   guideline</h3>
                   7553:                 </div>
1.1       grant    7554:               </div>
                   7555:             </div>
                   7556: 
1.27      rillig   7557:             <p>There are many possible sources of wrongly quoted
                   7558:             variables. This section lists some of the commonly
                   7559:             known ones.</p>
1.1       grant    7560: 
1.27      rillig   7561:             <div class="itemizedlist">
                   7562:               <ul type="disc">
                   7563:                 <li>
                   7564:                   <p>Whenever you use the value of a list, think
                   7565:                   about what happens to leading or trailing
                   7566:                   whitespace. If the list is a well-formed shell
1.47      reed     7567:                   expression, you can apply the <code class=
1.27      rillig   7568:                   "varname">:M*</code> modifier to strip leading
                   7569:                   and trailing whitespace from each word. The
                   7570:                   <code class="varname">:M</code> operator first
                   7571:                   splits its argument according to the rules of the
                   7572:                   shell, and then creates a new list consisting of
                   7573:                   all words that match the shell glob expression
                   7574:                   <code class="varname">*</code>, that is: all. One
                   7575:                   class of situations where this is needed is when
                   7576:                   adding a variable like <code class=
                   7577:                   "varname">CPPFLAGS</code> to <code class=
                   7578:                   "varname">CONFIGURE_ARGS</code>. If the configure
1.47      reed     7579:                   script invokes other configure scripts, it strips
1.27      rillig   7580:                   the leading and trailing whitespace from the
                   7581:                   variable and then passes it to the other
                   7582:                   configure scripts. But these configure scripts
                   7583:                   expect the (child) <code class=
                   7584:                   "varname">CPPFLAGS</code> variable to be the same
                   7585:                   as the parent <code class=
                   7586:                   "varname">CPPFLAGS</code>. That's why we better
                   7587:                   pass the <code class="varname">CPPFLAGS</code>
                   7588:                   value properly trimmed. And here is how we do
                   7589:                   it:</p>
                   7590:                   <pre class="programlisting">
1.51      rillig   7591:     CPPFLAGS=               # empty
                   7592:     CPPFLAGS+=              -Wundef -DPREFIX=\"${PREFIX:Q}\"
                   7593:     CPPFLAGS+=              ${MY_CPPFLAGS}
                   7594: 
                   7595:     CONFIGURE_ARGS+=        CPPFLAGS=${CPPFLAGS:M*:Q}
                   7596: 
                   7597:     all:
                   7598:             echo x${CPPFLAGS:Q}x            # leading and trailing whitespace
                   7599:             echo x${CONFIGURE_ARGS}x        # properly trimmed
1.27      rillig   7600: </pre>
                   7601:                 </li>
1.1       grant    7602: 
1.27      rillig   7603:                 <li>
                   7604:                   <p>The example above contains one bug: The
                   7605:                   <code class="varname">${PREFIX}</code> is a
                   7606:                   properly quoted shell expression, but there is
                   7607:                   the C compiler after it, which also expects a
                   7608:                   properly quoted string (this time in C syntax).
                   7609:                   The version above is therefore only correct if
                   7610:                   <code class="varname">${PREFIX}</code> does not
                   7611:                   have embedded backslashes or double quotes. If
                   7612:                   you want to allow these, you have to add another
                   7613:                   layer of quoting to each variable that is used as
                   7614:                   a C string literal. You cannot use the
                   7615:                   <code class="varname">:Q</code> operator for it,
                   7616:                   as this operator only works for the shell.</p>
                   7617:                 </li>
1.1       grant    7618: 
1.27      rillig   7619:                 <li>
1.47      reed     7620:                   <p>Whenever a variable can be empty, the
1.27      rillig   7621:                   <code class="varname">:Q</code> operator can have
                   7622:                   surprising results. Here are two completely
                   7623:                   different cases which can be solved with the same
                   7624:                   trick.</p>
                   7625:                   <pre class="programlisting">
1.51      rillig   7626:     EMPTY=                  # empty
                   7627:     empty_test:
                   7628:             for i in a ${EMPTY:Q} c; do \
                   7629:                     echo "$$i"; \
                   7630:             done
                   7631: 
                   7632:     for_test:
                   7633:     .for i in a:\ a:\test.txt
                   7634:             echo ${i:Q}
                   7635:             echo "foo"
                   7636:     .endfor
1.1       grant    7637: </pre>
                   7638: 
1.27      rillig   7639:                   <p>The first example will only print two of the
                   7640:                   three lines we might have expected. This is
                   7641:                   because <code class="varname">${EMPTY:Q}</code>
                   7642:                   expands to the empty string, which the shell
                   7643:                   cannot see. The workaround is to write
                   7644:                   <code class="varname">${EMPTY:Q}""</code>. This
                   7645:                   pattern can be often found as <code class=
                   7646:                   "varname">${TEST} -z ${VAR:Q}</code> or as
                   7647:                   <code class="varname">${TEST} -f
                   7648:                   ${FNAME:Q}</code> (both of these are wrong).</p>
                   7649: 
                   7650:                   <p>The second example will only print three lines
                   7651:                   instead of four. The first line looks like
                   7652:                   <code class="varname">a:\ echo foo</code>. This
                   7653:                   is because the backslash of the value
                   7654:                   <code class="varname">a:\</code> is interpreted
                   7655:                   as a line-continuation by <a href=
                   7656:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7657:                   <span class="citerefentry"><span class=
                   7658:                   "refentrytitle">make</span>(1)</span></a>, which
                   7659:                   makes the second line the arguments of the
                   7660:                   <a href=
                   7661:                   "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   7662:                   <span class="citerefentry"><span class=
                   7663:                   "refentrytitle">echo</span>(1)</span></a> command
                   7664:                   from the first line. To avoid this, write
                   7665:                   <code class="varname">${i:Q}""</code>.</p>
                   7666:                 </li>
                   7667:               </ul>
                   7668:             </div>
1.1       grant    7669:           </div>
                   7670: 
1.63    ! dillo    7671:           <div class="sect2" lang="en">
1.27      rillig   7672:             <div class="titlepage">
1.1       grant    7673:               <div>
1.27      rillig   7674:                 <div>
1.30      wiz      7675:                   <h3 class="title"><a name=
1.38      dillo    7676:                   "bsd-make-bug-workaround"></a>9.2.5.&nbsp;Workaround
1.30      wiz      7677:                   for a bug in BSD Make</h3>
1.27      rillig   7678:                 </div>
1.1       grant    7679:               </div>
                   7680:             </div>
                   7681: 
1.27      rillig   7682:             <p>The pkgsrc bmake program does not handle the
                   7683:             following assignment correctly. In case <code class=
                   7684:             "varname">_othervar_</code> contains a ``-'' character,
                   7685:             one of the closing braces is included in <code class=
                   7686:             "varname">${VAR}</code> after this code executes.</p>
                   7687:             <pre class="programlisting">
1.51      rillig   7688:     VAR:=   ${VAR:N${_othervar_:C/-//}}
1.1       grant    7689: </pre>
                   7690: 
1.27      rillig   7691:             <p>For a more complex code snippet and a workaround,
                   7692:             see the package <a xmlns=
                   7693:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   7694:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
1.45      wiz      7695:             target="_top"><code xmlns="" class=
                   7696:             "filename">regress/make-quoting</code></a>, testcase
1.27      rillig   7697:             <code class="varname">bug1</code>.</p>
1.1       grant    7698:           </div>
                   7699:         </div>
                   7700:       </div>
                   7701: 
1.63    ! dillo    7702:       <div class="chapter" lang="en">
1.1       grant    7703:         <div class="titlepage">
                   7704:           <div>
                   7705:             <div>
1.63    ! dillo    7706:               <h2 class="title"><a name=
1.38      dillo    7707:               "plist"></a>Chapter&nbsp;10.&nbsp;PLIST issues</h2>
1.1       grant    7708:             </div>
                   7709:           </div>
                   7710:         </div>
                   7711: 
                   7712:         <div class="toc">
                   7713:           <p><b>Table of Contents</b></p>
                   7714: 
                   7715:           <dl>
1.38      dillo    7716:             <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1       grant    7717:             ID</a></span></dt>
                   7718: 
1.30      wiz      7719:             <dt><span class="sect1"><a href=
1.38      dillo    7720:             "#automatic-plist-generation">10.2. Semi-automatic
1.45      wiz      7721:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7722:             class="filename">PLIST</code>
1.14      xtraeme  7723:             generation</a></span></dt>
1.1       grant    7724: 
1.38      dillo    7725:             <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14      xtraeme  7726:             Tweaking output of <span><strong class="command">make
                   7727:             print-PLIST</strong></span></a></span></dt>
1.1       grant    7728: 
1.38      dillo    7729:             <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1       grant    7730:             Variable substitution in PLIST</a></span></dt>
                   7731: 
1.30      wiz      7732:             <dt><span class="sect1"><a href=
1.48      dillo    7733:             "#manpage-compression">10.5. Man page
                   7734:             compression</a></span></dt>
1.1       grant    7735: 
1.38      dillo    7736:             <dt><span class="sect1"><a href=
                   7737:             "#using-PLIST_SRC">10.6. Changing PLIST source with
                   7738:             <code class="varname">PLIST_SRC</code></a></span></dt>
1.1       grant    7739: 
1.30      wiz      7740:             <dt><span class="sect1"><a href=
1.47      reed     7741:             "#platform-specific-plist">10.7. Platform-specific and
1.30      wiz      7742:             differing PLISTs</a></span></dt>
1.1       grant    7743: 
1.38      dillo    7744:             <dt><span class="sect1"><a href=
                   7745:             "#faq.common-dirs">10.8. Sharing directories between
                   7746:             packages</a></span></dt>
1.1       grant    7747:           </dl>
                   7748:         </div>
                   7749: 
1.45      wiz      7750:         <p>The <code xmlns=
                   7751:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   7752:         "filename">PLIST</code> file contains a package's
                   7753:         &#8220;<span class="quote">packing list</span>&#8221;, i.e.
                   7754:         a list of files that belong to the package (relative to the
                   7755:         <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7756:         class="filename">${PREFIX}</code> directory it's been
                   7757:         installed in) plus some additional statements - see the
                   7758:         <a href=
1.1       grant    7759:         "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   7760:         <span class="citerefentry"><span class=
1.47      reed     7761:         "refentrytitle">pkg_create</span>(1)</span></a> man page
                   7762:         for a full list. This chapter addresses some issues that
                   7763:         need attention when dealing with the <code xmlns=
1.45      wiz      7764:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7765:         "filename">PLIST</code> file (or files, see below!).</p>
1.1       grant    7766: 
1.63    ! dillo    7767:         <div class="sect1" lang="en">
1.1       grant    7768:           <div class="titlepage">
                   7769:             <div>
                   7770:               <div>
                   7771:                 <h2 class="title" style="clear: both"><a name=
1.63    ! dillo    7772:                 "rcs-id"></a>10.1.&nbsp;RCS ID</h2>
1.1       grant    7773:               </div>
                   7774:             </div>
                   7775:           </div>
                   7776: 
                   7777:           <p>Be sure to add a RCS ID line as the first thing in any
1.45      wiz      7778:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7779:           class="filename">PLIST</code> file you write:</p>
1.1       grant    7780:           <pre class="programlisting">
1.51      rillig   7781:     @comment $NetBSD$
1.1       grant    7782: </pre>
                   7783:         </div>
                   7784: 
1.63    ! dillo    7785:         <div class="sect1" lang="en">
1.1       grant    7786:           <div class="titlepage">
                   7787:             <div>
                   7788:               <div>
                   7789:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7790:                 "automatic-plist-generation"></a>10.2.&nbsp;Semi-automatic
1.45      wiz      7791:                 <code xmlns=
                   7792:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7793:                 "filename">PLIST</code> generation</h2>
1.1       grant    7794:               </div>
                   7795:             </div>
                   7796:           </div>
                   7797: 
1.14      xtraeme  7798:           <p>You can use the <span><strong class="command">make
                   7799:           print-PLIST</strong></span> command to output a PLIST
                   7800:           that matches any new files since the package was
                   7801:           extracted. See <a href="#build.helpful-targets" title=
1.56      rillig   7802:           "14.16.&nbsp;Other helpful targets">Section&nbsp;14.16,
1.1       grant    7803:           &#8220;Other helpful targets&#8221;</a> for more
                   7804:           information on this target.</p>
                   7805:         </div>
                   7806: 
1.63    ! dillo    7807:         <div class="sect1" lang="en">
1.1       grant    7808:           <div class="titlepage">
                   7809:             <div>
                   7810:               <div>
                   7811:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7812:                 "print-PLIST"></a>10.3.&nbsp;Tweaking output of
1.14      xtraeme  7813:                 <span><strong class="command">make
                   7814:                 print-PLIST</strong></span></h2>
1.1       grant    7815:               </div>
                   7816:             </div>
                   7817:           </div>
                   7818: 
                   7819:           <p>If you have used any of the *-dirs packages, as
                   7820:           explained in <a href="#faq.common-dirs" title=
1.38      dillo    7821:           "10.8.&nbsp;Sharing directories between packages">Section&nbsp;10.8,
1.1       grant    7822:           &#8220;Sharing directories between packages&#8221;</a>,
1.14      xtraeme  7823:           you may have noticed that <span><strong class=
                   7824:           "command">make print-PLIST</strong></span> outputs a set
                   7825:           of <code class="varname">@comment</code>s instead of real
                   7826:           <code class="varname">@dirrm</code> lines. You can also
                   7827:           do this for specific directories and files, so that the
                   7828:           results of that command are very close to reality. This
                   7829:           helps <span class="emphasis"><em>a lot</em></span> during
                   7830:           the update of packages.</p>
                   7831: 
                   7832:           <p>The <code class="varname">PRINT_PLIST_AWK</code>
                   7833:           variable takes a set of AWK patterns and actions that are
                   7834:           used to filter the output of print-PLIST. You can
                   7835:           <span class="emphasis"><em>append</em></span> any chunk
                   7836:           of AWK scripting you like to it, but be careful with
1.1       grant    7837:           quoting.</p>
                   7838: 
1.45      wiz      7839:           <p>For example, to get all files inside the <code xmlns=
                   7840:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7841:           "filename">libdata/foo</code> directory removed from the
1.1       grant    7842:           resulting PLIST:</p>
                   7843:           <pre class="programlisting">
1.51      rillig   7844:     PRINT_PLIST_AWK+=       /^libdata\/foo/ { next; }
1.1       grant    7845: </pre>
                   7846: 
1.14      xtraeme  7847:           <p>And to get all the <code class="varname">@dirrm</code>
1.1       grant    7848:           lines referring to a specific (shared) directory
1.14      xtraeme  7849:           converted to <code class="varname">@comment</code>s:</p>
1.1       grant    7850:           <pre class="programlisting">
1.51      rillig   7851:     PRINT_PLIST_AWK+=       /^@dirrm share\/specific/ { print "@comment " $$0; next; }
1.1       grant    7852: </pre>
                   7853:         </div>
                   7854: 
1.63    ! dillo    7855:         <div class="sect1" lang="en">
1.1       grant    7856:           <div class="titlepage">
                   7857:             <div>
                   7858:               <div>
                   7859:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7860:                 "plist.misc"></a>10.4.&nbsp;Variable substitution
                   7861:                 in PLIST</h2>
1.1       grant    7862:               </div>
                   7863:             </div>
                   7864:           </div>
                   7865: 
                   7866:           <p>A number of variables are substituted automatically in
                   7867:           PLISTs when a package is installed on a system. This
                   7868:           includes the following variables:</p>
                   7869: 
                   7870:           <div class="variablelist">
                   7871:             <dl>
1.14      xtraeme  7872:               <dt><span class="term"><code class=
                   7873:               "varname">${MACHINE_ARCH}</code>, <code class=
                   7874:               "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1       grant    7875: 
                   7876:               <dd>
                   7877:                 <p>Some packages like emacs and perl embed
                   7878:                 information about which architecture they were
                   7879:                 built on into the pathnames where they install
1.47      reed     7880:                 their files. To handle this case, PLIST will be
1.1       grant    7881:                 preprocessed before actually used, and the symbol
1.14      xtraeme  7882:                 &#8220;<span class="quote"><code class=
                   7883:                 "varname">${MACHINE_ARCH}</code></span>&#8221; will
                   7884:                 be replaced by what <span><strong class=
                   7885:                 "command">uname -p</strong></span> gives. The same
                   7886:                 is done if the string <code class=
                   7887:                 "varname">${MACHINE_GNU_ARCH}</code> is embedded in
                   7888:                 PLIST somewhere - use this on packages that have
1.47      reed     7889:                 GNU autoconf-created configure scripts.</p>
1.1       grant    7890: 
                   7891:                 <div class="note" style=
                   7892:                 "margin-left: 0.5in; margin-right: 0.5in;">
                   7893:                   <h3 class="title">Legacy note</h3>
                   7894: 
                   7895:                   <p>There used to be a symbol &#8220;<span class=
1.14      xtraeme  7896:                   "quote"><code class=
                   7897:                   "varname">$ARCH</code></span>&#8221; that was
                   7898:                   replaced by the output of <span><strong class=
                   7899:                   "command">uname -m</strong></span>, but that's no
1.1       grant    7900:                   longer supported and has been removed.</p>
                   7901:                 </div>
                   7902:               </dd>
                   7903: 
1.14      xtraeme  7904:               <dt><span class="term"><code class=
                   7905:               "varname">${OPSYS}</code>, <code class=
                   7906:               "varname">${LOWER_OPSYS}</code>, <code class=
                   7907:               "varname">${OS_VERSION}</code></span></dt>
1.1       grant    7908: 
                   7909:               <dd>
                   7910:                 <p>Some packages want to embed the OS name and
                   7911:                 version into some paths. To do this, use these
1.45      wiz      7912:                 variables in the <code xmlns=
                   7913:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7914:                 "filename">PLIST</code>:</p>
1.1       grant    7915: 
                   7916:                 <div class="itemizedlist">
                   7917:                   <ul type="disc">
                   7918:                     <li>
1.14      xtraeme  7919:                       <p><code class="varname">${OPSYS}</code> -
                   7920:                       output of &#8220;<span class=
                   7921:                       "quote"><span><strong class="command">uname
                   7922:                       -s</strong></span></span>&#8221;</p>
1.1       grant    7923:                     </li>
                   7924: 
                   7925:                     <li>
1.14      xtraeme  7926:                       <p><code class=
                   7927:                       "varname">${LOWER_OPSYS}</code> - lowercase
                   7928:                       common name (eg. &#8220;<span class=
                   7929:                       "quote">solaris</span>&#8221;)</p>
1.1       grant    7930:                     </li>
                   7931: 
                   7932:                     <li>
1.14      xtraeme  7933:                       <p><code class="varname">${OS_VERSION}</code>
                   7934:                       - &#8220;<span class=
                   7935:                       "quote"><span><strong class="command">uname
                   7936:                       -r</strong></span></span>&#8221;</p>
1.1       grant    7937:                     </li>
                   7938:                   </ul>
                   7939:                 </div>
                   7940:               </dd>
                   7941: 
1.14      xtraeme  7942:               <dt><span class="term"><code class=
                   7943:               "varname">${PKGLOCALEDIR}</code></span></dt>
1.1       grant    7944: 
                   7945:               <dd>
                   7946:                 <p>Packages that install locale files should list
                   7947:                 them in the PLIST as &#8220;<span class=
                   7948:                 "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>&#8221;
                   7949:                 instead of &#8220;<span class=
                   7950:                 "quote">share/locale/de/LC_MESSAGES/...</span>&#8221;.
                   7951:                 This properly handles the fact that different
                   7952:                 operating systems expect locale files to be either
1.45      wiz      7953:                 in <code xmlns=
                   7954:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7955:                 "filename">share</code> or <code xmlns=
                   7956:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7957:                 "filename">lib</code> by default.</p>
1.1       grant    7958:               </dd>
                   7959:             </dl>
                   7960:           </div>
                   7961: 
                   7962:           <p>For a complete list of values which are replaced by
1.45      wiz      7963:           default, please look in <code xmlns=
                   7964:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7965:           "filename">bsd.pkg.mk</code> (and search for <span class=
1.1       grant    7966:           "emphasis"><em>PLIST_SUBST</em></span>).</p>
                   7967: 
                   7968:           <p>If you want to change other variables not listed
                   7969:           above, you can add variables and their expansions to this
1.14      xtraeme  7970:           variable in the following way, similar to <code class=
                   7971:           "varname">MESSAGE_SUBST</code> (see <a href=
1.1       grant    7972:           "#components.optional" title=
1.38      dillo    7973:           "8.5.&nbsp;Optional files">Section&nbsp;8.5,
1.1       grant    7974:           &#8220;Optional files&#8221;</a>):</p>
                   7975:           <pre class="programlisting">
1.51      rillig   7976:     PLIST_SUBST+=   SOMEVAR="somevalue"
1.1       grant    7977: </pre>
                   7978: 
                   7979:           <p>This replaces all occurrences of &#8220;<span class=
                   7980:           "quote">${SOMEVAR}</span>&#8221; in the PLIST with
                   7981:           &#8220;<span class="quote">somevalue</span>&#8221;.</p>
                   7982:         </div>
                   7983: 
1.63    ! dillo    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.48      dillo    7989:                 "manpage-compression"></a>10.5.&nbsp;Man page
                   7990:                 compression</h2>
1.1       grant    7991:               </div>
                   7992:             </div>
                   7993:           </div>
                   7994: 
1.47      reed     7995:           <p>Man pages should be installed in compressed form if
1.45      wiz      7996:           <code class="varname">MANZ</code> is set (in <code xmlns=
                   7997:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7998:           "filename">bsd.own.mk</code>), and uncompressed
1.45      wiz      7999:           otherwise. To handle this in the <code xmlns=
                   8000:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8001:           "filename">PLIST</code> file, the suffix
                   8002:           &#8220;<span class="quote">.gz</span>&#8221; is
1.47      reed     8003:           appended/removed automatically for man pages according to
1.14      xtraeme  8004:           <code class="varname">MANZ</code> and <code class=
                   8005:           "varname">MANCOMPRESSED</code> being set or not, see
1.45      wiz      8006:           above for details. This modification of the <code xmlns=
                   8007:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8008:           "filename">PLIST</code> file is done on a copy of it, not
1.45      wiz      8009:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8010:           class="filename">PLIST</code> itself.</p>
1.1       grant    8011:         </div>
                   8012: 
1.63    ! dillo    8013:         <div class="sect1" lang="en">
1.1       grant    8014:           <div class="titlepage">
                   8015:             <div>
                   8016:               <div>
                   8017:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8018:                 "using-PLIST_SRC"></a>10.6.&nbsp;Changing PLIST
1.30      wiz      8019:                 source with <code class=
1.14      xtraeme  8020:                 "varname">PLIST_SRC</code></h2>
1.1       grant    8021:               </div>
                   8022:             </div>
                   8023:           </div>
                   8024: 
1.14      xtraeme  8025:           <p>To use one or more files as source for the
1.45      wiz      8026:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8027:           class="filename">PLIST</code> used in generating the
                   8028:           binary package, set the variable <code class=
1.14      xtraeme  8029:           "varname">PLIST_SRC</code> to the names of that file(s).
1.24      wiz      8030:           The files are later concatenated using <a href=
                   8031:           "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
                   8032:           <span class="citerefentry"><span class=
                   8033:           "refentrytitle">cat</span>(1)</span></a>, and order of
                   8034:           things is important.</p>
1.1       grant    8035:         </div>
                   8036: 
1.63    ! dillo    8037:         <div class="sect1" lang="en">
1.1       grant    8038:           <div class="titlepage">
                   8039:             <div>
                   8040:               <div>
                   8041:                 <h2 class="title" style="clear: both"><a name=
1.47      reed     8042:                 "platform-specific-plist"></a>10.7.&nbsp;Platform-specific
                   8043:                 and differing PLISTs</h2>
1.1       grant    8044:               </div>
                   8045:             </div>
                   8046:           </div>
                   8047: 
                   8048:           <p>Some packages decide to install a different set of
                   8049:           files based on the operating system being used. These
                   8050:           differences can be automatically handled by using the
                   8051:           following files:</p>
                   8052: 
                   8053:           <div class="itemizedlist">
                   8054:             <ul type="disc">
                   8055:               <li>
1.45      wiz      8056:                 <p><code xmlns=
                   8057:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8058:                 "filename">PLIST.common</code></p>
1.1       grant    8059:               </li>
                   8060: 
                   8061:               <li>
1.45      wiz      8062:                 <p><code xmlns=
                   8063:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8064:                 "filename">PLIST.${OPSYS}</code></p>
1.1       grant    8065:               </li>
                   8066: 
                   8067:               <li>
1.45      wiz      8068:                 <p><code xmlns=
                   8069:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.21      ben      8070:                 "filename">PLIST.${MACHINE_ARCH}</code></p>
                   8071:               </li>
                   8072: 
                   8073:               <li>
1.45      wiz      8074:                 <p><code xmlns=
                   8075:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.21      ben      8076:                 "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
                   8077:               </li>
                   8078: 
                   8079:               <li>
1.45      wiz      8080:                 <p><code xmlns=
                   8081:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8082:                 "filename">PLIST.common_end</code></p>
1.1       grant    8083:               </li>
                   8084:             </ul>
                   8085:           </div>
                   8086:         </div>
                   8087: 
1.63    ! dillo    8088:         <div class="sect1" lang="en">
1.1       grant    8089:           <div class="titlepage">
                   8090:             <div>
                   8091:               <div>
                   8092:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8093:                 "faq.common-dirs"></a>10.8.&nbsp;Sharing
                   8094:                 directories between packages</h2>
1.1       grant    8095:               </div>
                   8096:             </div>
                   8097:           </div>
                   8098: 
                   8099:           <p>A &#8220;<span class="quote">shared
                   8100:           directory</span>&#8221; is a directory where multiple
                   8101:           (and unrelated) packages install files. These directories
                   8102:           are problematic because you have to add special tricks in
                   8103:           the PLIST to conditionally remove them, or have some
                   8104:           centralized package handle them.</p>
                   8105: 
                   8106:           <p>Within pkgsrc, you'll find both approaches. If a
                   8107:           directory is shared by a few unrelated packages, it's
                   8108:           often not worth to add an extra package to remove it.
                   8109:           Therefore, one simply does:</p>
                   8110:           <pre class="programlisting">
1.51      rillig   8111:     @unexec ${RMDIR} %D/path/to/shared/directory 2&gt;/dev/null || ${TRUE}
1.1       grant    8112: </pre>
                   8113: 
                   8114:           <p>in the PLISTs of all affected packages, instead of the
                   8115:           regular "@dirrm" line.</p>
                   8116: 
                   8117:           <p>However, if the directory is shared across many
                   8118:           packages, two different solutions are available:</p>
                   8119: 
                   8120:           <div class="orderedlist">
                   8121:             <ol type="1">
                   8122:               <li>
                   8123:                 <p>If the packages have a common dependency, the
                   8124:                 directory can be removed in that. For example, see
                   8125:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8126:                 href=
                   8127:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.45      wiz      8128:                 target="_top"><code xmlns="" class=
                   8129:                 "filename">textproc/scrollkeeper</code></a>, which
                   8130:                 removes the shared directory <code xmlns=
                   8131:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      8132:                 "filename">share/omf</code>.</p>
1.1       grant    8133:               </li>
                   8134: 
                   8135:               <li>
                   8136:                 <p>If the packages using the directory are not
                   8137:                 related at all (they have no common dependencies),
                   8138:                 a *-dirs package is used.</p>
                   8139:               </li>
                   8140:             </ol>
                   8141:           </div>
                   8142: 
                   8143:           <p>From now on, we'll discuss the second solution. To get
                   8144:           an idea of the *-dirs packages available, issue:</p>
                   8145:           <pre class="programlisting">
1.51      rillig   8146:     <code class="prompt">%</code> cd .../pkgsrc
                   8147:     <code class="prompt">%</code> ls -d */*-dirs
1.1       grant    8148: </pre>
                   8149: 
                   8150:           <p>Their use from other packages is very simple. The
1.14      xtraeme  8151:           <code class="varname">USE_DIRS</code> variable takes a
                   8152:           list of package names (without the &#8220;<span class=
1.1       grant    8153:           "quote">-dirs</span>&#8221; part) together with the
                   8154:           required version number (always pick the latest one when
1.34      wiz      8155:           writing new packages).</p>
1.1       grant    8156: 
                   8157:           <p>For example, if a package installs files under
1.45      wiz      8158:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8159:           class="filename">share/applications</code>, it should
                   8160:           have the following line in it:</p>
1.1       grant    8161:           <pre class="programlisting">
1.51      rillig   8162:     USE_DIRS+=      xdg-1.1
1.1       grant    8163: </pre>
                   8164: 
1.14      xtraeme  8165:           <p>After regenerating the PLIST using
                   8166:           <span><strong class="command">make
                   8167:           print-PLIST</strong></span>, you should get the right
                   8168:           (commented out) lines.</p>
1.1       grant    8169: 
1.47      reed     8170:           <p>Note that even if your package is using <code xmlns=
1.45      wiz      8171:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8172:           "filename">$X11BASE</code>, it must not depend on the
1.1       grant    8173:           *-x11-dirs packages. Just specify the name without that
1.45      wiz      8174:           part and pkgsrc (in particular, <code xmlns=
                   8175:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8176:           "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1       grant    8177:         </div>
                   8178:       </div>
                   8179: 
1.63    ! dillo    8180:       <div class="chapter" lang="en">
1.1       grant    8181:         <div class="titlepage">
                   8182:           <div>
                   8183:             <div>
1.63    ! dillo    8184:               <h2 class="title"><a name=
1.38      dillo    8185:               "buildlink"></a>Chapter&nbsp;11.&nbsp;Buildlink
1.1       grant    8186:               methodology</h2>
                   8187:             </div>
                   8188:           </div>
                   8189:         </div>
                   8190: 
                   8191:         <div class="toc">
                   8192:           <p><b>Table of Contents</b></p>
                   8193: 
                   8194:           <dl>
1.30      wiz      8195:             <dt><span class="sect1"><a href=
1.38      dillo    8196:             "#converting-to-buildlink3">11.1. Converting packages
1.30      wiz      8197:             to use buildlink3</a></span></dt>
1.1       grant    8198: 
1.30      wiz      8199:             <dt><span class="sect1"><a href=
1.45      wiz      8200:             "#creating-buildlink3.mk">11.2. Writing <code xmlns=
                   8201:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      8202:             "filename">buildlink3.mk</code> files</a></span></dt>
1.1       grant    8203: 
                   8204:             <dd>
                   8205:               <dl>
1.25      rillig   8206:                 <dt><span class="sect2"><a href=
1.38      dillo    8207:                 "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30      wiz      8208:                 buildlink3.mk file</a></span></dt>
1.1       grant    8209: 
1.25      rillig   8210:                 <dt><span class="sect2"><a href=
1.38      dillo    8211:                 "#updating-buildlink-depends">11.2.2. Updating
1.30      wiz      8212:                 <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14      xtraeme  8213:                 "replaceable"><code>pkg</code></em></code> in
1.45      wiz      8214:                 <code xmlns=
                   8215:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8216:                 "filename">buildlink3.mk</code>
1.1       grant    8217:                 files</a></span></dt>
                   8218:               </dl>
                   8219:             </dd>
                   8220: 
1.30      wiz      8221:             <dt><span class="sect1"><a href=
1.45      wiz      8222:             "#writing-builtin.mk">11.3. Writing <code xmlns=
                   8223:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      8224:             "filename">builtin.mk</code> files</a></span></dt>
1.1       grant    8225: 
                   8226:             <dd>
                   8227:               <dl>
1.25      rillig   8228:                 <dt><span class="sect2"><a href=
1.38      dillo    8229:                 "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45      wiz      8230:                 <code xmlns=
                   8231:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8232:                 "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    8233: 
1.25      rillig   8234:                 <dt><span class="sect2"><a href=
1.38      dillo    8235:                 "#native-or-pkgsrc-preference">11.3.2. Global
1.30      wiz      8236:                 preferences for native or pkgsrc
                   8237:                 software</a></span></dt>
1.1       grant    8238:               </dl>
                   8239:             </dd>
                   8240:           </dl>
                   8241:         </div>
                   8242: 
                   8243:         <p>Buildlink is a framework in pkgsrc that controls what
                   8244:         headers and libraries are seen by a package's configure and
                   8245:         build processes. This is implemented in a two step
                   8246:         process:</p>
                   8247: 
                   8248:         <div class="orderedlist">
                   8249:           <ol type="1">
                   8250:             <li>
                   8251:               <p>Symlink headers and libraries for dependencies
1.14      xtraeme  8252:               into <code class="varname">BUILDLINK_DIR</code>,
                   8253:               which by default is a subdirectory of <code class=
                   8254:               "varname">WRKDIR</code>.</p>
1.1       grant    8255:             </li>
                   8256: 
                   8257:             <li>
                   8258:               <p>Create wrapper scripts that are used in place of
1.14      xtraeme  8259:               the normal compiler tools that translate <code class=
                   8260:               "option">-I${LOCALBASE}/include</code> and
                   8261:               <code class="option">-L${LOCALBASE}/lib</code> into
                   8262:               references to <code class=
                   8263:               "varname">BUILDLINK_DIR</code>. The wrapper scripts
                   8264:               also make native compiler on some operating systems
                   8265:               look like GCC, so that packages that expect GCC won't
                   8266:               require modifications to build with those native
                   8267:               compilers.</p>
1.1       grant    8268:             </li>
                   8269:           </ol>
                   8270:         </div>
                   8271: 
                   8272:         <p>This normalizes the environment in which a package is
                   8273:         built so that the package may be built consistently despite
                   8274:         what other software may be installed. Please note that the
1.45      wiz      8275:         normal system header and library paths, e.g. <code xmlns=
                   8276:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   8277:         "filename">/usr/include</code>, <code xmlns=
                   8278:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8279:         "filename">/usr/lib</code>, etc., are always searched --
1.1       grant    8280:         buildlink3 is designed to insulate the package build from
                   8281:         non-system-supplied software.</p>
                   8282: 
1.63    ! dillo    8283:         <div class="sect1" lang="en">
1.1       grant    8284:           <div class="titlepage">
                   8285:             <div>
                   8286:               <div>
                   8287:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8288:                 "converting-to-buildlink3"></a>11.1.&nbsp;Converting
1.30      wiz      8289:                 packages to use buildlink3</h2>
1.1       grant    8290:               </div>
                   8291:             </div>
                   8292:           </div>
                   8293: 
                   8294:           <p>The process of converting packages to use the
                   8295:           buildlink3 framework (&#8220;<span class=
                   8296:           "quote">bl3ifying</span>&#8221;) is fairly
                   8297:           straightforward. The things to keep in mind are:</p>
                   8298: 
                   8299:           <div class="orderedlist">
                   8300:             <ol type="1">
                   8301:               <li>
                   8302:                 <p>Ensure that the build always calls the wrapper
                   8303:                 scripts instead of the actual toolchain. Some
                   8304:                 packages are tricky, and the only way to know for
1.45      wiz      8305:                 sure is the check <code xmlns=
                   8306:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8307:                 "filename">${WRKDIR}/.work.log</code> to see if the
1.1       grant    8308:                 wrappers are being invoked.</p>
                   8309:               </li>
                   8310: 
                   8311:               <li>
1.14      xtraeme  8312:                 <p>Don't override <code class=
                   8313:                 "varname">PREFIX</code> from within the package
                   8314:                 Makefile, e.g. Java VMs, standalone shells, etc.,
1.45      wiz      8315:                 because the code to symlink files into <code xmlns=
                   8316:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8317:                 "filename">${BUILDLINK_DIR}</code> looks for files
1.1       grant    8318:                 relative to &#8220;<span class="quote">pkg_info -qp
1.14      xtraeme  8319:                 <em class=
                   8320:                 "replaceable"><code>pkgname</code></em></span>&#8221;.</p>
1.1       grant    8321:               </li>
                   8322: 
                   8323:               <li>
                   8324:                 <p>Remember that <span class=
1.45      wiz      8325:                 "emphasis"><em>only</em></span> the <code xmlns=
                   8326:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8327:                 "filename">buildlink3.mk</code> files that you list
1.1       grant    8328:                 in a package's Makefile are added as dependencies
                   8329:                 for that package.</p>
                   8330:               </li>
                   8331:             </ol>
                   8332:           </div>
                   8333: 
                   8334:           <p>If a dependency on a particular package is required
                   8335:           for its libraries and headers, then we replace:</p>
                   8336:           <pre class="programlisting">
1.51      rillig   8337:     DEPENDS+=   foo&gt;=1.1.0:../../category/foo
1.1       grant    8338: </pre>
                   8339: 
                   8340:           <p>with</p>
                   8341:           <pre class="programlisting">
1.51      rillig   8342:     .include "../../category/foo/buildlink3.mk"
1.1       grant    8343: </pre>
                   8344: 
1.47      reed     8345:           <p>The buildlink3.mk files usually define the required
                   8346:           dependencies. If you need a newer version of the
                   8347:           dependency when using buildlink3.mk files, then you can
                   8348:           define it in your Makefile; for example:</p>
                   8349:           <pre class="programlisting">
1.51      rillig   8350:     BUILDLINK_DEPENDS.foo+=   foo&gt;=1.1.0
                   8351:     .include "../../category/foo/buildlink3.mk"
1.47      reed     8352: </pre>
                   8353: 
1.45      wiz      8354:           <p>There are several <code xmlns=
                   8355:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   8356:           "filename">buildlink3.mk</code> files in <code xmlns=
                   8357:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8358:           "filename">pkgsrc/mk</code> that handle special package
1.1       grant    8359:           issues:</p>
                   8360: 
                   8361:           <div class="itemizedlist">
                   8362:             <ul type="disc">
                   8363:               <li>
1.45      wiz      8364:                 <p><code xmlns=
                   8365:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8366:                 "filename">bdb.buildlink3.mk</code> chooses either
                   8367:                 the native or a pkgsrc Berkeley DB implementation
                   8368:                 based on the values of <code class=
1.14      xtraeme  8369:                 "varname">BDB_ACCEPTED</code> and <code class=
                   8370:                 "varname">BDB_DEFAULT</code>.</p>
1.1       grant    8371:               </li>
                   8372: 
                   8373:               <li>
1.45      wiz      8374:                 <p><code xmlns=
                   8375:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     8376:                 "filename">curses.buildlink3.mk</code>: If the
1.14      xtraeme  8377:                 system comes with neither Curses nor NCurses, this
                   8378:                 will take care to install the <a xmlns=
                   8379:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    8380:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.45      wiz      8381:                 target="_top"><code xmlns="" class=
                   8382:                 "filename">devel/ncurses</code></a> package.</p>
1.1       grant    8383:               </li>
                   8384: 
                   8385:               <li>
1.45      wiz      8386:                 <p><code xmlns=
                   8387:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8388:                 "filename">krb5.buildlink3.mk</code> uses the value
                   8389:                 of <code class="varname">KRB5_ACCEPTED</code> to
                   8390:                 choose between adding a dependency on Heimdal or
                   8391:                 MIT-krb5 for packages that require a Kerberos 5
1.1       grant    8392:                 implementation.</p>
                   8393:               </li>
                   8394: 
                   8395:               <li>
1.45      wiz      8396:                 <p><code xmlns=
                   8397:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8398:                 "filename">motif.buildlink3.mk</code> checks for a
                   8399:                 system-provided Motif installation or adds a
                   8400:                 dependency on <a xmlns=
1.1       grant    8401:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8402:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.45      wiz      8403:                 target="_top"><code xmlns="" class=
                   8404:                 "filename">x11/lesstif</code></a> or <a xmlns=
1.20      ben      8405:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8406:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
1.45      wiz      8407:                 target="_top"><code xmlns="" class=
1.47      reed     8408:                 "filename">x11/openmotif</code></a>.</p>
1.1       grant    8409:               </li>
                   8410: 
                   8411:               <li>
1.45      wiz      8412:                 <p><code xmlns=
                   8413:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8414:                 "filename">ossaudio.buildlink3.mk</code> defines
                   8415:                 several variables that may be used by packages that
1.47      reed     8416:                 use the Open Sound System (OSS) API.</p>
1.1       grant    8417:               </li>
                   8418: 
                   8419:               <li>
1.45      wiz      8420:                 <p><code xmlns=
                   8421:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8422:                 "filename">pgsql.buildlink3.mk</code> will accept
                   8423:                 either Postgres 7.3 or 7.4, whichever is found
                   8424:                 installed. See the file for more information.</p>
1.1       grant    8425:               </li>
                   8426: 
                   8427:               <li>
1.45      wiz      8428:                 <p><code xmlns=
                   8429:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8430:                 "filename">pthread.buildlink3.mk</code> uses the
                   8431:                 value of <code class="varname">PTHREAD_OPTS</code>
                   8432:                 and checks for native pthreads or adds a dependency
                   8433:                 on <a xmlns=
1.1       grant    8434:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8435:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.45      wiz      8436:                 target="_top"><code xmlns="" class=
1.47      reed     8437:                 "filename">devel/pth</code></a> as needed.</p>
1.1       grant    8438:               </li>
                   8439: 
                   8440:               <li>
1.45      wiz      8441:                 <p><code xmlns=
                   8442:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8443:                 "filename">xaw.buildlink3.mk</code> uses the value
                   8444:                 of <code class="varname">XAW_TYPE</code> to choose
                   8445:                 a particular Athena widgets library.</p>
1.1       grant    8446:               </li>
                   8447:             </ul>
                   8448:           </div>
                   8449: 
1.45      wiz      8450:           <p>The comments in those <code xmlns=
                   8451:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8452:           "filename">buildlink3.mk</code> files provide a more
1.1       grant    8453:           complete description of how to use them properly.</p>
                   8454:         </div>
                   8455: 
1.63    ! dillo    8456:         <div class="sect1" lang="en">
1.1       grant    8457:           <div class="titlepage">
                   8458:             <div>
                   8459:               <div>
                   8460:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8461:                 "creating-buildlink3.mk"></a>11.2.&nbsp;Writing
1.45      wiz      8462:                 <code xmlns=
                   8463:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8464:                 "filename">buildlink3.mk</code> files</h2>
1.1       grant    8465:               </div>
                   8466:             </div>
                   8467:           </div>
                   8468: 
1.45      wiz      8469:           <p>A package's <code xmlns=
                   8470:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8471:           "filename">buildlink3.mk</code> file is included by
                   8472:           Makefiles to indicate the need to compile and link
                   8473:           against header files and libraries provided by the
1.45      wiz      8474:           package. A <code xmlns=
                   8475:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   8476:           "filename">buildlink3.mk</code> file should always
                   8477:           provide enough information to add the correct type of
                   8478:           dependency relationship and include any other
                   8479:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8480:           class="filename">buildlink3.mk</code> files that it needs
                   8481:           to find headers and libraries that it needs in turn.</p>
1.1       grant    8482: 
1.45      wiz      8483:           <p>To generate an initial <code xmlns=
                   8484:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8485:           "filename">buildlink3.mk</code> file for further editing,
1.1       grant    8486:           Rene Hexel's <a xmlns=
                   8487:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   8488:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.45      wiz      8489:           target="_top"><code xmlns="" class=
                   8490:           "filename">pkgtools/createbuildlink</code></a> package is
1.20      ben      8491:           highly recommended. For most packages, the following
                   8492:           command will generate a good starting point for
1.45      wiz      8493:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8494:           class="filename">buildlink3.mk</code> files:</p>
1.1       grant    8495:           <pre class="screen">
1.14      xtraeme  8496: <code class="prompt">%</code> <strong class=
                   8497: "userinput"><code>cd pkgsrc/<em class=
                   8498: "replaceable"><code>category</code></em>/<em class=
                   8499: "replaceable"><code>pkgdir</code></em>
                   8500: <code class=
1.49      rillig   8501: "prompt">%</code> createbuildlink &gt;buildlink3.mk</code></strong>
1.1       grant    8502: </pre>
                   8503: 
1.63    ! dillo    8504:           <div class="sect2" lang="en">
1.1       grant    8505:             <div class="titlepage">
                   8506:               <div>
                   8507:                 <div>
1.63    ! dillo    8508:                   <h3 class="title"><a name=
        !          8509:                   "anatomy-of-bl3"></a>11.2.1.&nbsp;Anatomy of a
1.25      rillig   8510:                   buildlink3.mk file</h3>
1.1       grant    8511:                 </div>
                   8512:               </div>
                   8513:             </div>
                   8514: 
1.45      wiz      8515:             <p>The following real-life example <code xmlns=
                   8516:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8517:             "filename">buildlink3.mk</code> is taken from
1.45      wiz      8518:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8519:             class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1       grant    8520:             <pre class="programlisting">
1.51      rillig   8521:     # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1       grant    8522: 
1.51      rillig   8523:     BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH}+
                   8524:     TIFF_BUILDLINK3_MK:=    ${TIFF_BUILDLINK3_MK}+
1.1       grant    8525: 
1.51      rillig   8526:     .if !empty(BUILDLINK_DEPTH:M+)
                   8527:     BUILDLINK_DEPENDS+=     tiff
                   8528:     .endif
1.1       grant    8529: 
1.51      rillig   8530:     BUILDLINK_PACKAGES:=    ${BUILDLINK_PACKAGES:Ntiff}
                   8531:     BUILDLINK_PACKAGES+=    tiff
1.1       grant    8532: 
1.51      rillig   8533:     .if !empty(TIFF_BUILDLINK3_MK:M+)
                   8534:     BUILDLINK_DEPENDS.tiff+=        tiff&gt;=3.6.1
                   8535:     BUILDLINK_PKGSRCDIR.tiff?=      ../../graphics/tiff
                   8536:     .endif  # TIFF_BUILDLINK3_MK
1.1       grant    8537: 
1.51      rillig   8538:     .include "../../devel/zlib/buildlink3.mk"
                   8539:     .include "../../graphics/jpeg/buildlink3.mk"
1.1       grant    8540: 
1.51      rillig   8541:     BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH:S/+$//}
1.1       grant    8542: </pre>
                   8543: 
1.14      xtraeme  8544:             <p>The header and footer manipulate <code class=
                   8545:             "varname">BUILDLINK_DEPTH</code>, which is common
1.45      wiz      8546:             across all <code xmlns=
                   8547:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8548:             "filename">buildlink3.mk</code> files and is used to
                   8549:             track at what depth we are including <code xmlns=
                   8550:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8551:             "filename">buildlink3.mk</code> files.</p>
1.1       grant    8552: 
                   8553:             <p>The first section controls if the dependency on
1.14      xtraeme  8554:             <em class="replaceable"><code>pkg</code></em> is added.
                   8555:             <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1       grant    8556:             global list of packages for which dependencies are
                   8557:             added by buildlink3.</p>
                   8558: 
                   8559:             <p>The second section advises pkgsrc that the
1.45      wiz      8560:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8561:             class="filename">buildlink3.mk</code> file for
1.14      xtraeme  8562:             <em class="replaceable"><code>pkg</code></em> has been
                   8563:             included at some point. <code class=
                   8564:             "varname">BUILDLINK_PACKAGES</code> is the global list
1.45      wiz      8565:             of packages for which <code xmlns=
                   8566:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8567:             "filename">buildlink3.mk</code> files have been
                   8568:             included. It must <span class=
                   8569:             "emphasis"><em>always</em></span> be appended to within
1.45      wiz      8570:             a <code xmlns=
                   8571:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8572:             "filename">buildlink3.mk</code> file.</p>
1.1       grant    8573: 
                   8574:             <p>The third section is protected from multiple
1.14      xtraeme  8575:             inclusion and controls how the dependency on <em class=
                   8576:             "replaceable"><code>pkg</code></em> is added. Several
1.1       grant    8577:             important variables are set in the section:</p>
                   8578: 
                   8579:             <div class="itemizedlist">
                   8580:               <ul type="disc">
                   8581:                 <li>
1.14      xtraeme  8582:                   <p><code class=
                   8583:                   "varname">BUILDLINK_DEPENDS.<em class=
                   8584:                   "replaceable"><code>pkg</code></em></code> is the
                   8585:                   actual dependency recorded in the installed
                   8586:                   package; this should always be set using
                   8587:                   <span><strong class="command">+=</strong></span>
                   8588:                   to ensure that we're appending to any
                   8589:                   pre-existing list of values. This variable should
                   8590:                   be set to the first version of the package that
                   8591:                   had the last change in the major number of a
                   8592:                   shared library or that had a major API
                   8593:                   change.</p>
1.1       grant    8594:                 </li>
                   8595: 
                   8596:                 <li>
1.14      xtraeme  8597:                   <p><code class=
                   8598:                   "varname">BUILDLINK_PKGSRCDIR.<em class=
                   8599:                   "replaceable"><code>pkg</code></em></code> is the
                   8600:                   location of the <em class=
                   8601:                   "replaceable"><code>pkg</code></em> pkgsrc
1.47      reed     8602:                   directory.</p>
1.1       grant    8603:                 </li>
                   8604: 
                   8605:                 <li>
1.14      xtraeme  8606:                   <p><code class=
                   8607:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   8608:                   "replaceable"><code>pkg</code></em></code> (not
                   8609:                   shown above) controls whether we use <code class=
                   8610:                   "varname">BUILD_DEPENDS</code> or <code class=
                   8611:                   "varname">DEPENDS</code> to add the dependency on
                   8612:                   <em class="replaceable"><code>pkg</code></em>.
                   8613:                   The build dependency is selected by setting
                   8614:                   <code class=
                   8615:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   8616:                   "replaceable"><code>pkg</code></em></code> to
1.1       grant    8617:                   &#8220;<span class="quote">build</span>&#8221;.
                   8618:                   By default, the full dependency is used.</p>
                   8619:                 </li>
                   8620: 
                   8621:                 <li>
1.14      xtraeme  8622:                   <p><code class=
                   8623:                   "varname">BUILDLINK_INCDIRS.<em class=
                   8624:                   "replaceable"><code>pkg</code></em></code> and
                   8625:                   <code class=
1.63    ! dillo    8626:                   "varname">BUILDLINK_LIBDIRS.<em class="replaceable"><code>pkg</code></em></code>
        !          8627:                   (not shown above) are lists of subdirectories of
        !          8628:                   <code xmlns=
1.45      wiz      8629:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8630:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8631:                   "replaceable"><code>pkg</code></em>}</code> to
                   8632:                   add to the header and library search paths. These
1.1       grant    8633:                   default to &#8220;<span class=
                   8634:                   "quote">include</span>&#8221; and
                   8635:                   &#8220;<span class="quote">lib</span>&#8221;
                   8636:                   respectively.</p>
                   8637:                 </li>
                   8638: 
                   8639:                 <li>
1.14      xtraeme  8640:                   <p><code class=
                   8641:                   "varname">BUILDLINK_CPPFLAGS.<em class=
                   8642:                   "replaceable"><code>pkg</code></em></code> (not
                   8643:                   shown above) is the list of preprocessor flags to
                   8644:                   add to <code class="varname">CPPFLAGS</code>,
                   8645:                   which are passed on to the configure and build
                   8646:                   phases. The &#8220;<span class=
                   8647:                   "quote">-I</span>&#8221; option should be avoided
                   8648:                   and instead be handled using <code class=
                   8649:                   "varname">BUILDLINK_INCDIRS.<em class=
                   8650:                   "replaceable"><code>pkg</code></em></code> as
                   8651:                   above.</p>
1.1       grant    8652:                 </li>
                   8653:               </ul>
                   8654:             </div>
                   8655: 
                   8656:             <p>The following variables are all optionally defined
                   8657:             within this second section (protected against multiple
                   8658:             inclusion) and control which package files are
1.45      wiz      8659:             symlinked into <code xmlns=
                   8660:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8661:             "filename">${BUILDLINK_DIR}</code> and how their names
1.1       grant    8662:             are transformed during the symlinking:</p>
                   8663: 
                   8664:             <div class="itemizedlist">
                   8665:               <ul type="disc">
                   8666:                 <li>
1.14      xtraeme  8667:                   <p><code class=
                   8668:                   "varname">BUILDLINK_FILES.<em class=
                   8669:                   "replaceable"><code>pkg</code></em></code> (not
                   8670:                   shown above) is a shell glob pattern relative to
1.45      wiz      8671:                   <code xmlns=
                   8672:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8673:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8674:                   "replaceable"><code>pkg</code></em>}</code> to be
1.45      wiz      8675:                   symlinked into <code xmlns=
                   8676:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8677:                   "filename">${BUILDLINK_DIR}</code>, e.g.
1.45      wiz      8678:                   <code xmlns=
                   8679:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8680:                   "filename">include/*.h</code>.</p>
1.1       grant    8681:                 </li>
                   8682: 
                   8683:                 <li>
1.14      xtraeme  8684:                   <p><code class=
                   8685:                   "varname">BUILDLINK_FILES_CMD.<em class=
                   8686:                   "replaceable"><code>pkg</code></em></code> (not
                   8687:                   shown above) is a shell pipeline that outputs to
1.45      wiz      8688:                   stdout a list of files relative to <code xmlns=
                   8689:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8690:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8691:                   "replaceable"><code>pkg</code></em>}</code>. The
1.1       grant    8692:                   resulting files are to be symlinked into
1.45      wiz      8693:                   <code xmlns=
                   8694:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8695:                   "filename">${BUILDLINK_DIR}</code>. By default,
                   8696:                   this takes the <code xmlns=
                   8697:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8698:                   "filename">+CONTENTS</code> of a <em class=
                   8699:                   "replaceable"><code>pkg</code></em> and filters
                   8700:                   it through <code class=
                   8701:                   "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
                   8702:                   "replaceable"><code>pkg</code></em>}</code>.</p>
1.1       grant    8703:                 </li>
                   8704: 
                   8705:                 <li>
1.14      xtraeme  8706:                   <p><code class=
                   8707:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   8708:                   "replaceable"><code>pkg</code></em></code> (not
                   8709:                   shown above) is a filter command that filters
1.45      wiz      8710:                   <code xmlns=
                   8711:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8712:                   "filename">+CONTENTS</code> input into a list of
                   8713:                   files relative to <code xmlns=
                   8714:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8715:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8716:                   "replaceable"><code>pkg</code></em>}</code> on
                   8717:                   stdout. By default for overwrite packages,
                   8718:                   <code class=
                   8719:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   8720:                   "replaceable"><code>pkg</code></em></code>
1.45      wiz      8721:                   outputs the contents of the <code xmlns=
                   8722:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8723:                   "filename">include</code> and <code xmlns=
                   8724:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8725:                   "filename">lib</code> directories in the package
1.45      wiz      8726:                   <code xmlns=
                   8727:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8728:                   "filename">+CONTENTS</code>, and for pkgviews
                   8729:                   packages, it outputs any libtool archives in
                   8730:                   <code xmlns=
                   8731:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8732:                   "filename">lib</code> directories.</p>
1.1       grant    8733:                 </li>
                   8734: 
                   8735:                 <li>
1.14      xtraeme  8736:                   <p><code class=
                   8737:                   "varname">BUILDLINK_TRANSFORM.<em class=
                   8738:                   "replaceable"><code>pkg</code></em></code> (not
                   8739:                   shown above) is a list of sed arguments used to
1.1       grant    8740:                   transform the name of the source filename into a
1.14      xtraeme  8741:                   destination filename, e.g. <span><strong class=
1.1       grant    8742:                   "command">-e
1.14      xtraeme  8743:                   "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1       grant    8744:                 </li>
                   8745:               </ul>
                   8746:             </div>
                   8747: 
1.45      wiz      8748:             <p>The last section includes any <code xmlns=
                   8749:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8750:             "filename">buildlink3.mk</code> needed for <em class=
                   8751:             "replaceable"><code>pkg</code></em>'s library
1.45      wiz      8752:             dependencies. Including these <code xmlns=
                   8753:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8754:             "filename">buildlink3.mk</code> files means that the
                   8755:             headers and libraries for these dependencies are also
1.45      wiz      8756:             symlinked into <code xmlns=
                   8757:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8758:             "filename">${BUILDLINK_DIR}</code> whenever the
                   8759:             <em class="replaceable"><code>pkg</code></em>
1.45      wiz      8760:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8761:             class="filename">buildlink3.mk</code> file is
1.14      xtraeme  8762:             included.</p>
1.1       grant    8763:           </div>
                   8764: 
1.63    ! dillo    8765:           <div class="sect2" lang="en">
1.1       grant    8766:             <div class="titlepage">
                   8767:               <div>
                   8768:                 <div>
1.30      wiz      8769:                   <h3 class="title"><a name=
1.63    ! dillo    8770:                   "updating-buildlink-depends"></a>11.2.2.&nbsp;Updating
1.30      wiz      8771:                   <code class=
1.63    ! dillo    8772:                   "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
        !          8773:                   in <code xmlns=
1.45      wiz      8774:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      8775:                   "filename">buildlink3.mk</code> files</h3>
1.1       grant    8776:                 </div>
                   8777:               </div>
                   8778:             </div>
                   8779: 
                   8780:             <p>There are two situations that require increasing the
1.14      xtraeme  8781:             dependency listed in <code class=
                   8782:             "varname">BUILDLINK_DEPENDS.<em class=
                   8783:             "replaceable"><code>pkg</code></em></code> after a
                   8784:             package update:</p>
1.1       grant    8785: 
                   8786:             <div class="orderedlist">
                   8787:               <ol type="1">
                   8788:                 <li>
                   8789:                   <p>if the sonames (major number of the library
                   8790:                   version) of any installed shared libraries
1.47      reed     8791:                   change.</p>
1.1       grant    8792:                 </li>
                   8793: 
                   8794:                 <li>
                   8795:                   <p>if the API or interface to the header files
                   8796:                   change.</p>
                   8797:                 </li>
                   8798:               </ol>
                   8799:             </div>
                   8800: 
1.14      xtraeme  8801:             <p>In these cases, <code class=
                   8802:             "varname">BUILDLINK_DEPENDS.<em class=
                   8803:             "replaceable"><code>pkg</code></em></code> should be
                   8804:             adjusted to require at least the new package version.
                   8805:             In some cases, the packages that depend on this new
                   8806:             version may need their <code class=
                   8807:             "varname">PKGREVISION</code>s increased and, if they
1.45      wiz      8808:             have <code xmlns=
                   8809:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8810:             "filename">buildlink3.mk</code> files, their
                   8811:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   8812:             "replaceable"><code>pkg</code></em></code> adjusted,
                   8813:             too. This is needed so that binary packages made using
                   8814:             it will require the correct package dependency and not
                   8815:             settle for an older one which will not contain the
                   8816:             necessary shared libraries.</p>
1.1       grant    8817: 
                   8818:             <p>Please take careful consideration before adjusting
1.14      xtraeme  8819:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   8820:             "replaceable"><code>pkg</code></em></code> as we don't
                   8821:             want to cause unneeded package deletions and rebuilds.
                   8822:             In many cases, new versions of packages work just fine
                   8823:             with older dependencies. See <a href="#dependencies"
1.63    ! dillo    8824:             title=
        !          8825:             "15.1.4.&nbsp;Handling dependencies">Section&nbsp;15.1.4,
        !          8826:             &#8220;Handling dependencies&#8221;</a> for more
        !          8827:             information about dependencies on other packages,
1.25      rillig   8828:             including the <code class=
                   8829:             "varname">BUILDLINK_RECOMMENDED</code> and <code class=
                   8830:             "varname">RECOMMENDED</code> definitions.</p>
1.1       grant    8831:           </div>
                   8832:         </div>
                   8833: 
1.63    ! dillo    8834:         <div class="sect1" lang="en">
1.1       grant    8835:           <div class="titlepage">
                   8836:             <div>
                   8837:               <div>
                   8838:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8839:                 "writing-builtin.mk"></a>11.3.&nbsp;Writing
1.45      wiz      8840:                 <code xmlns=
                   8841:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8842:                 "filename">builtin.mk</code> files</h2>
1.1       grant    8843:               </div>
                   8844:             </div>
                   8845:           </div>
                   8846: 
                   8847:           <p>Some packages in pkgsrc install headers and libraries
                   8848:           that coincide with headers and libraries present in the
1.45      wiz      8849:           base system. Aside from a <code xmlns=
                   8850:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8851:           "filename">buildlink3.mk</code> file, these packages
1.45      wiz      8852:           should also include a <code xmlns=
                   8853:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8854:           "filename">builtin.mk</code> file that includes the
                   8855:           necessary checks to decide whether using the built-in
                   8856:           software or the pkgsrc software is appropriate.</p>
1.1       grant    8857: 
                   8858:           <p>The only requirements of a builtin.mk file for
1.14      xtraeme  8859:           <em class="replaceable"><code>pkg</code></em> are:</p>
1.1       grant    8860: 
                   8861:           <div class="orderedlist">
                   8862:             <ol type="1">
                   8863:               <li>
1.14      xtraeme  8864:                 <p>It should set <code class=
                   8865:                 "varname">USE_BUILTIN.<em class=
                   8866:                 "replaceable"><code>pkg</code></em></code> to
                   8867:                 either &#8220;<span class="quote">yes</span>&#8221;
                   8868:                 or &#8220;<span class="quote">no</span>&#8221;
                   8869:                 after it is included.</p>
1.1       grant    8870:               </li>
                   8871: 
                   8872:               <li>
                   8873:                 <p>It should <span class=
                   8874:                 "emphasis"><em>not</em></span> override any
1.14      xtraeme  8875:                 <code class="varname">USE_BUILTIN.<em class=
                   8876:                 "replaceable"><code>pkg</code></em></code> which is
1.45      wiz      8877:                 already set before the <code xmlns=
                   8878:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8879:                 "filename">builtin.mk</code> file is included.</p>
1.1       grant    8880:               </li>
                   8881: 
                   8882:               <li>
                   8883:                 <p>It should be written to allow multiple
                   8884:                 inclusion. This is <span class=
                   8885:                 "emphasis"><em>very</em></span> important and takes
1.45      wiz      8886:                 careful attention to <code xmlns=
                   8887:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8888:                 "filename">Makefile</code> coding.</p>
1.1       grant    8889:               </li>
                   8890:             </ol>
                   8891:           </div>
                   8892: 
1.63    ! dillo    8893:           <div class="sect2" lang="en">
1.1       grant    8894:             <div class="titlepage">
                   8895:               <div>
                   8896:                 <div>
1.63    ! dillo    8897:                   <h3 class="title"><a name=
1.38      dillo    8898:                   "anatomy-of-builtin.mk"></a>11.3.1.&nbsp;Anatomy
1.45      wiz      8899:                   of a <code xmlns=
                   8900:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8901:                   "filename">builtin.mk</code> file</h3>
1.1       grant    8902:                 </div>
                   8903:               </div>
                   8904:             </div>
                   8905: 
                   8906:             <p>The following is the recommended template for
                   8907:             builtin.mk files:</p>
                   8908:             <pre class="programlisting">
1.51      rillig   8909:     .if !defined(IS_BUILTIN.foo)
                   8910:     #
                   8911:     # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
                   8912:     # genuinely exists in the system or not.
                   8913:     #
                   8914:     IS_BUILTIN.foo?=        no
                   8915: 
                   8916:     # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
                   8917:     # version can be determined.
                   8918:     #
                   8919:     .  if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
                   8920:     BUILTIN_PKG.foo?=       foo-1.0
                   8921:     .  endif
                   8922:     .endif  # IS_BUILTIN.foo
                   8923: 
                   8924:     .if !defined(USE_BUILTIN.foo)
                   8925:     USE_BUILTIN.foo?=       ${IS_BUILTIN.foo}
                   8926:     .  if defined(BUILTIN_PKG.foo)
                   8927:     .    for _depend_ in ${BUILDLINK_DEPENDS.foo}
                   8928:     .      if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
                   8929:     USE_BUILTIN.foo!=                                                       \
                   8930:           if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then     \
                   8931:                   ${ECHO} "yes";                                            \
                   8932:           else                                                              \
                   8933:                   ${ECHO} "no";                                             \
                   8934:           fi
                   8935:     .      endif
                   8936:     .    endfor
                   8937:     .  endif
                   8938:     .endif  # USE_BUILTIN.foo
                   8939: 
                   8940:     CHECK_BUILTIN.foo?=     no
                   8941:     .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
                   8942:     #
                   8943:     # Here we place code that depends on whether USE_BUILTIN.foo is set to
                   8944:     # "yes" or "no".
                   8945:     #
                   8946:     .endif  # CHECK_BUILTIN.foo
1.1       grant    8947: </pre>
                   8948: 
1.14      xtraeme  8949:             <p>The first section sets <code class=
                   8950:             "varname">IS_BUILTIN.<em class=
                   8951:             "replaceable"><code>pkg</code></em></code> depending on
                   8952:             if <em class="replaceable"><code>pkg</code></em> really
                   8953:             exists in the base system. This should not be a base
                   8954:             system software with similar functionality to
                   8955:             <em class="replaceable"><code>pkg</code></em>; it
                   8956:             should only be &#8220;<span class=
                   8957:             "quote">yes</span>&#8221; if the actual package is
                   8958:             included as part of the base system. This variable is
1.45      wiz      8959:             only used internally within the <code xmlns=
                   8960:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8961:             "filename">builtin.mk</code> file.</p>
                   8962: 
                   8963:             <p>The second section sets <code class=
                   8964:             "varname">BUILTIN_PKG.<em class=
                   8965:             "replaceable"><code>pkg</code></em></code> to the
                   8966:             version of <em class=
                   8967:             "replaceable"><code>pkg</code></em> in the base system
                   8968:             if it exists (if <code class=
                   8969:             "varname">IS_BUILTIN.<em class=
                   8970:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    8971:             &#8220;<span class="quote">yes</span>&#8221;). This
1.14      xtraeme  8972:             variable is only used internally within the
1.45      wiz      8973:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8974:             class="filename">builtin.mk</code> file.</p>
1.1       grant    8975: 
1.14      xtraeme  8976:             <p>The third section sets <code class=
                   8977:             "varname">USE_BUILTIN.<em class=
                   8978:             "replaceable"><code>pkg</code></em></code> and is
                   8979:             <span class="emphasis"><em>required</em></span> in all
1.45      wiz      8980:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8981:             class="filename">builtin.mk</code> files. The code in
                   8982:             this section must make the determination whether the
                   8983:             built-in software is adequate to satisfy the
                   8984:             dependencies listed in <code class=
1.14      xtraeme  8985:             "varname">BUILDLINK_DEPENDS.<em class=
                   8986:             "replaceable"><code>pkg</code></em></code>. This is
                   8987:             typically done by comparing <code class=
                   8988:             "varname">BUILTIN_PKG.<em class=
                   8989:             "replaceable"><code>pkg</code></em></code> against each
                   8990:             of the dependencies in <code class=
                   8991:             "varname">BUILDLINK_DEPENDS.<em class=
                   8992:             "replaceable"><code>pkg</code></em></code>.
                   8993:             <code class="varname">USE_BUILTIN.<em class=
                   8994:             "replaceable"><code>pkg</code></em></code> <span class=
1.1       grant    8995:             "emphasis"><em>must</em></span> be set to the correct
1.45      wiz      8996:             value by the end of the <code xmlns=
                   8997:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8998:             "filename">builtin.mk</code> file. Note that
                   8999:             <code class="varname">USE_BUILTIN.<em class=
                   9000:             "replaceable"><code>pkg</code></em></code> may be
1.1       grant    9001:             &#8220;<span class="quote">yes</span>&#8221; even if
1.14      xtraeme  9002:             <code class="varname">IS_BUILTIN.<em class=
                   9003:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    9004:             &#8220;<span class="quote">no</span>&#8221; because we
                   9005:             may make the determination that the built-in version of
                   9006:             the software is similar enough to be used as a
                   9007:             replacement.</p>
                   9008: 
1.14      xtraeme  9009:             <p>The last section is guarded by <code class=
                   9010:             "varname">CHECK_BUILTIN.<em class=
                   9011:             "replaceable"><code>pkg</code></em></code>, and
                   9012:             includes code that uses the value of <code class=
                   9013:             "varname">USE_BUILTIN.<em class=
                   9014:             "replaceable"><code>pkg</code></em></code> set in the
                   9015:             previous section. This typically includes, e.g., adding
1.1       grant    9016:             additional dependency restrictions and listing
1.45      wiz      9017:             additional files to symlink into <code xmlns=
                   9018:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9019:             "filename">${BUILDLINK_DIR}</code> (via <code class=
                   9020:             "varname">BUILDLINK_FILES.<em class=
                   9021:             "replaceable"><code>pkg</code></em></code>).</p>
1.1       grant    9022:           </div>
                   9023: 
1.63    ! dillo    9024:           <div class="sect2" lang="en">
1.1       grant    9025:             <div class="titlepage">
                   9026:               <div>
                   9027:                 <div>
1.30      wiz      9028:                   <h3 class="title"><a name=
1.38      dillo    9029:                   "native-or-pkgsrc-preference"></a>11.3.2.&nbsp;Global
1.30      wiz      9030:                   preferences for native or pkgsrc software</h3>
1.1       grant    9031:                 </div>
                   9032:               </div>
                   9033:             </div>
                   9034: 
                   9035:             <p>When building packages, it's possible to choose
                   9036:             whether to set a global preference for using either the
                   9037:             built-in (native) version or the pkgsrc version of
                   9038:             software to satisfy a dependency. This is controlled by
1.14      xtraeme  9039:             setting <code class="varname">PREFER_PKGSRC</code> and
                   9040:             <code class="varname">PREFER_NATIVE</code>. These
                   9041:             variables take values of either &#8220;<span class=
1.1       grant    9042:             "quote">yes</span>&#8221;, &#8220;<span class=
                   9043:             "quote">no</span>&#8221;, or a list of packages.
1.14      xtraeme  9044:             <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
                   9045:             to use the pkgsrc versions of software, while
                   9046:             <code class="varname">PREFER_NATIVE</code> tells pkgsrc
                   9047:             to use the built-in versions. Preferences are
                   9048:             determined by the most specific instance of the package
                   9049:             in either <code class="varname">PREFER_PKGSRC</code> or
                   9050:             <code class="varname">PREFER_NATIVE</code>. If a
                   9051:             package is specified in neither or in both variables,
                   9052:             then <code class="varname">PREFER_PKGSRC</code> has
                   9053:             precedence over <code class=
                   9054:             "varname">PREFER_NATIVE</code>. For example, to require
                   9055:             using pkgsrc versions of software for all but the most
                   9056:             basic bits on a NetBSD system, you can set:</p>
1.1       grant    9057:             <pre class="programlisting">
1.51      rillig   9058:     PREFER_PKGSRC=  yes
                   9059:     PREFER_NATIVE=  getopt skey tcp_wrappers
1.1       grant    9060: </pre>
                   9061: 
                   9062:             <p>A package <span class=
1.45      wiz      9063:             "emphasis"><em>must</em></span> have a <code xmlns=
                   9064:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9065:             "filename">builtin.mk</code> file to be listed in
                   9066:             <code class="varname">PREFER_NATIVE</code>, otherwise
                   9067:             it is simply ignored in that list.</p>
1.1       grant    9068:           </div>
                   9069:         </div>
                   9070:       </div>
                   9071: 
1.63    ! dillo    9072:       <div class="chapter" lang="en">
1.1       grant    9073:         <div class="titlepage">
                   9074:           <div>
                   9075:             <div>
1.63    ! dillo    9076:               <h2 class="title"><a name=
1.38      dillo    9077:               "pkginstall"></a>Chapter&nbsp;12.&nbsp;The pkginstall
1.35      jmmv     9078:               framework</h2>
1.1       grant    9079:             </div>
                   9080:           </div>
                   9081:         </div>
                   9082: 
                   9083:         <div class="toc">
                   9084:           <p><b>Table of Contents</b></p>
                   9085: 
                   9086:           <dl>
1.30      wiz      9087:             <dt><span class="sect1"><a href=
1.38      dillo    9088:             "#files-and-dirs-outside-prefix">12.1. Files and
1.35      jmmv     9089:             directories outside the installation
                   9090:             prefix</a></span></dt>
                   9091: 
                   9092:             <dd>
                   9093:               <dl>
                   9094:                 <dt><span class="sect2"><a href=
1.38      dillo    9095:                 "#dirs-outside-prefix">12.1.1. Directory
1.35      jmmv     9096:                 manipulation</a></span></dt>
                   9097: 
                   9098:                 <dt><span class="sect2"><a href=
1.38      dillo    9099:                 "#files-outside-prefix">12.1.2. File
1.35      jmmv     9100:                 manipulation</a></span></dt>
                   9101:               </dl>
                   9102:             </dd>
                   9103: 
1.38      dillo    9104:             <dt><span class="sect1"><a href="#conf-files">12.2.
1.35      jmmv     9105:             Configuration files</a></span></dt>
                   9106: 
                   9107:             <dd>
                   9108:               <dl>
                   9109:                 <dt><span class="sect2"><a href=
1.38      dillo    9110:                 "#conf-files-sysconfdir">12.2.1. How <code class=
1.35      jmmv     9111:                 "varname">PKG_SYSCONFDIR</code> is
                   9112:                 set</a></span></dt>
                   9113: 
                   9114:                 <dt><span class="sect2"><a href=
1.38      dillo    9115:                 "#conf-files-configure">12.2.2. Telling the
1.47      reed     9116:                 software where configuration files
1.35      jmmv     9117:                 are</a></span></dt>
                   9118: 
                   9119:                 <dt><span class="sect2"><a href=
1.38      dillo    9120:                 "#conf-files-patching">12.2.3. Patching
1.35      jmmv     9121:                 installations</a></span></dt>
                   9122: 
                   9123:                 <dt><span class="sect2"><a href=
1.38      dillo    9124:                 "#conf-files-disable">12.2.4. Disabling handling of
1.35      jmmv     9125:                 configuration files</a></span></dt>
                   9126:               </dl>
                   9127:             </dd>
                   9128: 
1.38      dillo    9129:             <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35      jmmv     9130:             System startup scripts</a></span></dt>
                   9131: 
                   9132:             <dd>
                   9133:               <dl>
                   9134:                 <dt><span class="sect2"><a href=
1.38      dillo    9135:                 "#rcd-scripts-disable">12.3.1. Disabling handling
1.35      jmmv     9136:                 of system startup scripts</a></span></dt>
                   9137:               </dl>
                   9138:             </dd>
1.1       grant    9139: 
1.30      wiz      9140:             <dt><span class="sect1"><a href=
1.38      dillo    9141:             "#users-and-groups">12.4. System users and
1.35      jmmv     9142:             groups</a></span></dt>
                   9143: 
1.38      dillo    9144:             <dt><span class="sect1"><a href="#shells">12.5. System
1.35      jmmv     9145:             shells</a></span></dt>
                   9146: 
                   9147:             <dd>
                   9148:               <dl>
                   9149:                 <dt><span class="sect2"><a href=
1.38      dillo    9150:                 "#shells-disable">12.5.1. Disabling handling of
1.35      jmmv     9151:                 configuration files</a></span></dt>
                   9152:               </dl>
                   9153:             </dd>
1.1       grant    9154:           </dl>
                   9155:         </div>
                   9156: 
1.35      jmmv     9157:         <p>This chapter describes the framework known as
                   9158:         <code class="literal">pkginstall</code>, whose key features
                   9159:         are:</p>
                   9160: 
                   9161:         <div class="itemizedlist">
                   9162:           <ul type="disc">
                   9163:             <li>
                   9164:               <p>Generic installation and manipulation of
                   9165:               directories and files outside the pkgsrc-handled
                   9166:               tree, <code class="varname">LOCALBASE</code>.</p>
                   9167:             </li>
                   9168: 
                   9169:             <li>
                   9170:               <p>Automatic handling of configuration files during
                   9171:               installation, provided that packages are correctly
                   9172:               designed.</p>
                   9173:             </li>
                   9174: 
                   9175:             <li>
                   9176:               <p>Generation and installation of system startup
                   9177:               scripts.</p>
                   9178:             </li>
                   9179: 
                   9180:             <li>
                   9181:               <p>Registration of system users and groups.</p>
                   9182:             </li>
                   9183: 
                   9184:             <li>
                   9185:               <p>Registration of system shells.</p>
                   9186:             </li>
                   9187:           </ul>
                   9188:         </div>
                   9189: 
                   9190:         <p>The following sections inspect each of the above points
1.47      reed     9191:         in detail. Note that in order to use any of the described
1.35      jmmv     9192:         functionalities, you must add the following to your
1.45      wiz      9193:         package's <code xmlns=
                   9194:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   9195:         "filename">Makefile</code>:</p>
1.35      jmmv     9196:         <pre class="programlisting">
1.51      rillig   9197:     USE_PKGINSTALL= YES
1.35      jmmv     9198: </pre>
                   9199: 
                   9200:         <p>You may be thinking that many of the things described
                   9201:         here could be easily done with simple code in the package's
                   9202:         post-installation target (<code class=
                   9203:         "literal">post-install</code>). <span class=
                   9204:         "emphasis"><em>This is incorrect</em></span>, as the code
                   9205:         in them is only executed when building from source.
                   9206:         Machines using binary packages could not benefit from it at
                   9207:         all (as the code itself could be unavailable). Therefore,
                   9208:         the only way to achieve any of the items described above is
                   9209:         by means of the installation scripts, which are
                   9210:         automatically generated by pkginstall.</p>
1.1       grant    9211: 
1.63    ! dillo    9212:         <div class="sect1" lang="en">
1.1       grant    9213:           <div class="titlepage">
                   9214:             <div>
                   9215:               <div>
                   9216:                 <h2 class="title" style="clear: both"><a name=
1.63    ! dillo    9217:                 "files-and-dirs-outside-prefix"></a>12.1.&nbsp;Files
        !          9218:                 and directories outside the installation
        !          9219:                 prefix</h2>
1.1       grant    9220:               </div>
                   9221:             </div>
                   9222:           </div>
                   9223: 
1.45      wiz      9224:           <p>As you already know, the <code xmlns=
                   9225:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9226:           "filename">PLIST</code> file holds a list of files and
                   9227:           directories that belong to a package. The names used in
1.45      wiz      9228:           it are relative to the installation prefix (<code xmlns=
                   9229:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9230:           "filename">${PREFIX}</code>), which means that it cannot
                   9231:           register files outside this directory (absolute path
                   9232:           names are not allowed). Despite this restriction, some
                   9233:           packages need to install files outside this location;
1.45      wiz      9234:           e.g., under <code xmlns=
                   9235:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   9236:           "filename">${VARBASE}</code> or <code xmlns=
                   9237:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   9238:           "filename">${PKG_SYSCONFDIR}</code>.</p>
1.35      jmmv     9239: 
                   9240:           <p>The only way to achieve this is to create such files
                   9241:           during installation time by using the installation
                   9242:           scripts. These scripts can run arbitrary commands, so
                   9243:           they have the potential to create and manage files
1.47      reed     9244:           anywhere in the file system. Here is where pkginstall
1.35      jmmv     9245:           comes into play: it provides generic scripts to abstract
                   9246:           the manipulation of such files and directories based on
1.45      wiz      9247:           variables set in the package's <code xmlns=
                   9248:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9249:           "filename">Makefile</code>. The rest of this section
1.47      reed     9250:           describes these variables.</p>
1.1       grant    9251: 
1.63    ! dillo    9252:           <div class="sect2" lang="en">
1.35      jmmv     9253:             <div class="titlepage">
1.1       grant    9254:               <div>
1.35      jmmv     9255:                 <div>
1.63    ! dillo    9256:                   <h3 class="title"><a name=
        !          9257:                   "dirs-outside-prefix"></a>12.1.1.&nbsp;Directory
1.35      jmmv     9258:                   manipulation</h3>
                   9259:                 </div>
1.1       grant    9260:               </div>
                   9261:             </div>
                   9262: 
1.35      jmmv     9263:             <p>The following variables can be set to request the
1.47      reed     9264:             creation of directories anywhere in the file
                   9265:             system:</p>
1.27      rillig   9266: 
1.35      jmmv     9267:             <div class="itemizedlist">
                   9268:               <ul type="disc">
                   9269:                 <li>
                   9270:                   <p><code class="varname">MAKE_DIRS</code> and
                   9271:                   <code class="varname">OWN_DIRS</code> contain a
                   9272:                   list of directories that should be created and
                   9273:                   should attempt to be destroyed by the
                   9274:                   installation scripts. The difference between the
                   9275:                   two is that the latter prompts the administrator
                   9276:                   to remove any directories that may be left after
                   9277:                   deinstallation (because they were not empty),
                   9278:                   while the former does not.</p>
                   9279:                 </li>
1.1       grant    9280: 
1.35      jmmv     9281:                 <li>
                   9282:                   <p><code class="varname">MAKE_DIRS_PERMS</code>
                   9283:                   and <code class="varname">OWN_DIRS_PERMS</code>
                   9284:                   contain a list of tuples describing which
                   9285:                   directories should be created and should attempt
                   9286:                   to be destroyed by the installation scripts. Each
                   9287:                   tuple holds the following values, separated by
                   9288:                   spaces: the directory name, its owner, its group
                   9289:                   and its numerical mode. For example:</p>
                   9290:                   <pre class="programlisting">
1.51      rillig   9291:     MAKE_DIRS_PERMS+=         ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
1.35      jmmv     9292: </pre>
1.1       grant    9293: 
1.35      jmmv     9294:                   <p>The difference between the two is exactly the
                   9295:                   same as their non-<code class=
                   9296:                   "varname">PERMS</code> counterparts.</p>
                   9297:                 </li>
                   9298:               </ul>
                   9299:             </div>
                   9300:           </div>
                   9301: 
1.63    ! dillo    9302:           <div class="sect2" lang="en">
1.35      jmmv     9303:             <div class="titlepage">
                   9304:               <div>
                   9305:                 <div>
1.63    ! dillo    9306:                   <h3 class="title"><a name=
        !          9307:                   "files-outside-prefix"></a>12.1.2.&nbsp;File
1.35      jmmv     9308:                   manipulation</h3>
                   9309:                 </div>
                   9310:               </div>
                   9311:             </div>
                   9312: 
                   9313:             <p>Creating non-empty files outside the installation
1.45      wiz      9314:             prefix is tricky because the <code xmlns=
                   9315:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9316:             "filename">PLIST</code> forces all files to be inside
                   9317:             it. To overcome this problem, the only solution is to
                   9318:             extract the file in the known place (i.e., inside the
                   9319:             installation prefix) and copy it to the appropriate
                   9320:             location during installation (done by the installation
                   9321:             scripts generated by pkginstall). We will call the
                   9322:             former the <span class="emphasis"><em>master
                   9323:             file</em></span> in the following paragraphs, which
                   9324:             describe the variables that can be used to
                   9325:             automatically and consistently handle files outside the
                   9326:             installation prefix:</p>
                   9327: 
                   9328:             <div class="itemizedlist">
                   9329:               <ul type="disc">
                   9330:                 <li>
                   9331:                   <p><code class="varname">CONF_FILES</code> and
                   9332:                   <code class="varname">SUPPORT_FILES</code> are
                   9333:                   pairs of master and target files. During
                   9334:                   installation time, the master file is copied to
                   9335:                   the target one if and only if the latter does not
                   9336:                   exist. Upon deinstallation, the target file is
                   9337:                   removed provided that it was not modified by the
                   9338:                   installation.</p>
                   9339: 
                   9340:                   <p>The difference between the two is that the
                   9341:                   latter prompts the administrator to remove any
                   9342:                   files that may be left after deinstallation
                   9343:                   (because they were not empty), while the former
                   9344:                   does not.</p>
                   9345:                 </li>
                   9346: 
                   9347:                 <li>
                   9348:                   <p><code class="varname">CONF_FILES_PERMS</code>
                   9349:                   and <code class=
                   9350:                   "varname">SUPPORT_FILES_PERMS</code> contain
                   9351:                   tuples describing master files as well as their
                   9352:                   target locations. For each of them, it also
                   9353:                   specifies their owner, their group and their
                   9354:                   numeric permissions, in this order. For
                   9355:                   example:</p>
                   9356:                   <pre class="programlisting">
1.51      rillig   9357:     SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
1.35      jmmv     9358: </pre>
                   9359: 
                   9360:                   <p>The difference between the two is exactly the
                   9361:                   same as their non-<code class=
                   9362:                   "varname">PERMS</code> counterparts.</p>
                   9363:                 </li>
                   9364:               </ul>
                   9365:             </div>
                   9366:           </div>
                   9367:         </div>
                   9368: 
1.63    ! dillo    9369:         <div class="sect1" lang="en">
1.35      jmmv     9370:           <div class="titlepage">
                   9371:             <div>
                   9372:               <div>
                   9373:                 <h2 class="title" style="clear: both"><a name=
1.63    ! dillo    9374:                 "conf-files"></a>12.2.&nbsp;Configuration
        !          9375:                 files</h2>
1.35      jmmv     9376:               </div>
                   9377:             </div>
                   9378:           </div>
                   9379: 
                   9380:           <p>Configuration files are special in the sense that they
                   9381:           are installed in their own specific directory,
                   9382:           <code class="varname">PKG_SYSCONFDIR</code>, and need
                   9383:           special treatment during installation (most of which is
                   9384:           automated by pkginstall). The main concept you must bear
1.36      wiz      9385:           in mind is that files marked as configuration files are
1.35      jmmv     9386:           automatically copied to the right place (somewhere inside
                   9387:           <code class="varname">PKG_SYSCONFDIR</code>) during
                   9388:           installation <span class="emphasis"><em>if and only
                   9389:           if</em></span> they didn't exist before. Similarly, they
                   9390:           will not be removed if they have local modifications.
1.36      wiz      9391:           This ensures that administrators never lose any custom
1.35      jmmv     9392:           changes they may have made.</p>
                   9393: 
1.63    ! dillo    9394:           <div class="sect2" lang="en">
1.35      jmmv     9395:             <div class="titlepage">
                   9396:               <div>
                   9397:                 <div>
1.63    ! dillo    9398:                   <h3 class="title"><a name=
        !          9399:                   "conf-files-sysconfdir"></a>12.2.1.&nbsp;How
1.35      jmmv     9400:                   <code class="varname">PKG_SYSCONFDIR</code> is
                   9401:                   set</h3>
                   9402:                 </div>
                   9403:               </div>
                   9404:             </div>
                   9405: 
                   9406:             <p>As said before, the <code class=
                   9407:             "varname">PKG_SYSCONFDIR</code> variable specifies
                   9408:             where configuration files shall be installed. Its
                   9409:             contents are set based upon the following
                   9410:             variables:</p>
                   9411: 
                   9412:             <div class="itemizedlist">
                   9413:               <ul type="disc">
                   9414:                 <li>
                   9415:                   <p><code class="varname">PKG_SYSCONFBASE</code>:
                   9416:                   The configuration's root directory. Defaults to
1.45      wiz      9417:                   <code xmlns=
                   9418:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9419:                   "filename">${PREFIX}/etc</code> although it may
                   9420:                   be overridden by the user to point to his
                   9421:                   preferred location (e.g., <code xmlns=
                   9422:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9423:                   "filename">/etc</code>, <code xmlns=
                   9424:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9425:                   "filename">/etc/pkg</code>, etc.). Packages must
                   9426:                   not use it directly.</p>
                   9427:                 </li>
                   9428: 
                   9429:                 <li>
                   9430:                   <p><code class=
                   9431:                   "varname">PKG_SYSCONFSUBDIR</code>: A
                   9432:                   subdirectory of <code class=
                   9433:                   "varname">PKG_SYSCONFBASE</code> under which the
                   9434:                   configuration files for the package being built
                   9435:                   shall be installed. The definition of this
                   9436:                   variable only makes sense in the package's
1.45      wiz      9437:                   <code xmlns=
                   9438:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     9439:                   "filename">Makefile</code> (i.e., it is not
                   9440:                   user-customizable).</p>
1.35      jmmv     9441: 
                   9442:                   <p>As an example, consider the Apache package,
                   9443:                   <a xmlns=
                   9444:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   9445:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
1.45      wiz      9446:                   target="_top"><code xmlns="" class=
                   9447:                   "filename">www/apache2</code></a>, which places
                   9448:                   its configuration files under the <code xmlns=
                   9449:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9450:                   "filename">httpd/</code> subdirectory of
                   9451:                   <code class="varname">PKG_SYSCONFBASE</code>.
                   9452:                   This should be set in the package Makefile.</p>
                   9453:                 </li>
                   9454: 
                   9455:                 <li>
                   9456:                   <p><code class="varname">PKG_SYSCONFVAR</code>:
                   9457:                   Specifies the name of the variable that holds
                   9458:                   this package's configuration directory (if
                   9459:                   different from <code class=
                   9460:                   "varname">PKG_SYSCONFBASE</code>). It defaults to
                   9461:                   <code class="varname">PKGBASE</code>'s value, and
                   9462:                   is always prefixed with <code class=
                   9463:                   "literal">PKG_SYSCONFDIR</code>.</p>
                   9464:                 </li>
                   9465: 
                   9466:                 <li>
                   9467:                   <p><code class=
                   9468:                   "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
                   9469:                   Holds the directory where the configuration files
                   9470:                   for the package identified by <code class=
                   9471:                   "varname">PKG_SYSCONFVAR</code>'s shall be
                   9472:                   placed.</p>
                   9473:                 </li>
                   9474:               </ul>
                   9475:             </div>
                   9476: 
                   9477:             <p>Based on the above variables, pkginstall determines
                   9478:             the value of <code class=
                   9479:             "varname">PKG_SYSCONFDIR</code>, which is the
                   9480:             <span class="emphasis"><em>only</em></span> variable
                   9481:             that can be used within a package to refer to its
                   9482:             configuration directory. The algorithm used to set its
                   9483:             value is basically the following:</p>
                   9484: 
                   9485:             <div class="orderedlist">
                   9486:               <ol type="1">
                   9487:                 <li>
                   9488:                   <p>If <code class=
                   9489:                   "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   9490:                   is set, its value is used.</p>
                   9491:                 </li>
                   9492: 
                   9493:                 <li>
                   9494:                   <p>If the previous variable is not defined but
                   9495:                   <code class="varname">PKG_SYSCONFSUBDIR</code> is
1.45      wiz      9496:                   set in the package's <code xmlns=
                   9497:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9498:                   "filename">Makefile</code>, the resulting value
1.45      wiz      9499:                   is <code xmlns=
                   9500:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9501:                   "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
                   9502:                 </li>
                   9503: 
                   9504:                 <li>
1.45      wiz      9505:                   <p>Otherwise, it is set to <code xmlns=
                   9506:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9507:                   "filename">${PKG_SYSCONFBASE}</code>.</p>
                   9508:                 </li>
                   9509:               </ol>
                   9510:             </div>
                   9511: 
1.45      wiz      9512:             <p>It is worth mentioning that <code xmlns=
                   9513:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9514:             "filename">${PKG_SYSCONFDIR}</code> is automatically
1.45      wiz      9515:             added to <code xmlns=
                   9516:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   9517:             "filename">OWN_DIRS</code>. See <a href=
                   9518:             "#dirs-outside-prefix" title=
1.63    ! dillo    9519:             "12.1.1.&nbsp;Directory manipulation">Section&nbsp;12.1.1,
1.35      jmmv     9520:             &#8220;Directory manipulation&#8221;</a> what this
                   9521:             means.</p>
                   9522:           </div>
                   9523: 
1.63    ! dillo    9524:           <div class="sect2" lang="en">
1.35      jmmv     9525:             <div class="titlepage">
                   9526:               <div>
                   9527:                 <div>
1.63    ! dillo    9528:                   <h3 class="title"><a name=
        !          9529:                   "conf-files-configure"></a>12.2.2.&nbsp;Telling
        !          9530:                   the software where configuration files are</h3>
1.35      jmmv     9531:                 </div>
                   9532:               </div>
                   9533:             </div>
                   9534: 
                   9535:             <p>Given that pkgsrc (and users!) expect configuration
                   9536:             files to be in a known place, you need to teach each
1.36      wiz      9537:             package where it shall install its files. In some cases
1.35      jmmv     9538:             you will have to patch the package Makefiles to achieve
                   9539:             it. If you are lucky, though, it may be as easy as
                   9540:             passing an extra flag to the configuration script; this
1.47      reed     9541:             is the case of GNU Autoconf- generated files:</p>
1.35      jmmv     9542:             <pre class="programlisting">
1.51      rillig   9543:     CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.35      jmmv     9544: </pre>
                   9545: 
                   9546:             <p>Note that this specifies where the package has to
                   9547:             <span class="emphasis"><em>look for</em></span> its
                   9548:             configuration files, not where they will be originally
                   9549:             installed (although the difference is never explicit,
                   9550:             unfortunately).</p>
                   9551:           </div>
                   9552: 
1.63    ! dillo    9553:           <div class="sect2" lang="en">
1.35      jmmv     9554:             <div class="titlepage">
                   9555:               <div>
                   9556:                 <div>
1.63    ! dillo    9557:                   <h3 class="title"><a name=
        !          9558:                   "conf-files-patching"></a>12.2.3.&nbsp;Patching
1.35      jmmv     9559:                   installations</h3>
                   9560:                 </div>
                   9561:               </div>
                   9562:             </div>
                   9563: 
                   9564:             <p>As said before, pkginstall automatically handles
                   9565:             configuration files. This means that <span class=
                   9566:             "strong"><strong>the packages themselves must not touch
1.45      wiz      9567:             the contents of <code xmlns=
                   9568:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9569:             "filename">${PKG_SYSCONFDIR}</code>
1.36      wiz      9570:             directly</strong></span>. Bad news is that many
                   9571:             software installation scripts will, out of the box,
                   9572:             mess with the contents of that directory. So what is
                   9573:             the correct procedure to fix this issue?</p>
1.35      jmmv     9574: 
                   9575:             <p>You must teach the package (usually by manually
                   9576:             patching it) to install any configuration files under
1.45      wiz      9577:             the examples hierarchy, <code xmlns=
                   9578:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9579:             "filename">share/examples/${PKGBASE}/</code>. This way,
1.45      wiz      9580:             the <code xmlns=
                   9581:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   9582:             "filename">PLIST</code> registers them and the
                   9583:             administrator always has the original copies
1.35      jmmv     9584:             available.</p>
                   9585: 
                   9586:             <p>Once the required configuration files are in place
                   9587:             (i.e., under the examples hierarchy), the pkginstall
                   9588:             framework can use them as master copies during the
1.45      wiz      9589:             package installation to update what is in <code xmlns=
                   9590:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9591:             "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
                   9592:             the variables <code class="varname">CONF_FILES</code>
                   9593:             and <code class="varname">CONF_FILES_PERMS</code> are
                   9594:             used. Check out <a href="#files-outside-prefix" title=
1.63    ! dillo    9595:             "12.1.2.&nbsp;File manipulation">Section&nbsp;12.1.2,
1.35      jmmv     9596:             &#8220;File manipulation&#8221;</a> for information
                   9597:             about their syntax and their purpose. Here is an
                   9598:             example, taken from the <a xmlns=
                   9599:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9600:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
1.45      wiz      9601:             target="_top"><code xmlns="" class=
                   9602:             "filename">mail/mutt</code></a> package:</p>
1.35      jmmv     9603:             <pre class="programlisting">
1.51      rillig   9604:     EGDIR=        ${PREFIX}/share/doc/mutt/samples
                   9605:     CONF_FILES=   ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
1.35      jmmv     9606: </pre>
                   9607: 
                   9608:             <p>Note that the <code class="varname">EGDIR</code>
                   9609:             variable is specific to that package and has no meaning
                   9610:             outside it.</p>
                   9611:           </div>
                   9612: 
1.63    ! dillo    9613:           <div class="sect2" lang="en">
1.35      jmmv     9614:             <div class="titlepage">
                   9615:               <div>
                   9616:                 <div>
1.63    ! dillo    9617:                   <h3 class="title"><a name=
        !          9618:                   "conf-files-disable"></a>12.2.4.&nbsp;Disabling
1.35      jmmv     9619:                   handling of configuration files</h3>
                   9620:                 </div>
                   9621:               </div>
                   9622:             </div>
                   9623: 
                   9624:             <p>The automatic copying of config files can be toggled
                   9625:             by setting the environment variable <code class=
                   9626:             "varname">PKG_CONFIG</code> prior to package
                   9627:             installation.</p>
                   9628:           </div>
                   9629:         </div>
                   9630: 
1.63    ! dillo    9631:         <div class="sect1" lang="en">
1.35      jmmv     9632:           <div class="titlepage">
                   9633:             <div>
                   9634:               <div>
                   9635:                 <h2 class="title" style="clear: both"><a name=
1.63    ! dillo    9636:                 "rcd-scripts"></a>12.3.&nbsp;System startup
        !          9637:                 scripts</h2>
1.35      jmmv     9638:               </div>
                   9639:             </div>
                   9640:           </div>
                   9641: 
                   9642:           <p>System startup scripts are special files because they
                   9643:           must be installed in a place known by the underlying OS,
                   9644:           usually outside the installation prefix. Therefore, the
                   9645:           same rules described in <a href=
                   9646:           "#files-and-dirs-outside-prefix" title=
1.38      dillo    9647:           "12.1.&nbsp;Files and directories outside the installation prefix">
1.63    ! dillo    9648:           Section&nbsp;12.1, &#8220;Files and directories outside
        !          9649:           the installation prefix&#8221;</a> apply, and the same
1.35      jmmv     9650:           solutions can be used. However, pkginstall provides a
1.36      wiz      9651:           special mechanism to handle these files.</p>
1.35      jmmv     9652: 
                   9653:           <p>In order to provide system startup scripts, the
                   9654:           package has to:</p>
                   9655: 
                   9656:           <div class="orderedlist">
                   9657:             <ol type="1">
                   9658:               <li>
1.45      wiz      9659:                 <p>Store the script inside <code xmlns=
                   9660:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9661:                 "filename">${FILESDIR}</code>, with the
                   9662:                 <code class="literal">.sh</code> suffix appended.
                   9663:                 Considering the <a xmlns=
                   9664:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   9665:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
1.45      wiz      9666:                 target="_top"><code xmlns="" class=
                   9667:                 "filename">print/cups</code></a> package as an
                   9668:                 example, it has a <code xmlns=
                   9669:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9670:                 "filename">cupsd.sh</code> in its files
                   9671:                 directory.</p>
                   9672:               </li>
                   9673: 
                   9674:               <li>
                   9675:                 <p>Tell pkginstall to handle it, appending the name
                   9676:                 of the script, without its extension, to the
                   9677:                 <code class="varname">RCD_SCRIPTS</code> variable.
                   9678:                 Continuing the previous example:</p>
                   9679:                 <pre class="programlisting">
1.51      rillig   9680:     RCD_SCRIPTS+=   cupsd
1.35      jmmv     9681: </pre>
                   9682:               </li>
                   9683:             </ol>
                   9684:           </div>
                   9685: 
                   9686:           <p>Once this is done, pkginstall will do the following
                   9687:           steps for each script in an automated fashion:</p>
                   9688: 
                   9689:           <div class="orderedlist">
                   9690:             <ol type="1">
                   9691:               <li>
                   9692:                 <p>Process the file found in the files directory
                   9693:                 applying all the substitutions described in the
1.45      wiz      9694:                 <code xmlns=
                   9695:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   9696:                 "filename">FILES_SUBST</code> variable.</p>
1.35      jmmv     9697:               </li>
                   9698: 
                   9699:               <li>
                   9700:                 <p>Copy the script from the files directory to the
1.45      wiz      9701:                 examples hierarchy, <code xmlns=
                   9702:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9703:                 "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36      wiz      9704:                 Note that this master file must be explicitly
1.45      wiz      9705:                 registered in the <code xmlns=
                   9706:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9707:                 "filename">PLIST</code>.</p>
                   9708:               </li>
                   9709: 
                   9710:               <li>
                   9711:                 <p>Add code to the installation scripts to copy the
                   9712:                 startup script from the examples hierarchy into the
                   9713:                 system-wide startup scripts directory.</p>
                   9714:               </li>
                   9715:             </ol>
                   9716:           </div>
                   9717: 
1.63    ! dillo    9718:           <div class="sect2" lang="en">
1.35      jmmv     9719:             <div class="titlepage">
                   9720:               <div>
                   9721:                 <div>
1.63    ! dillo    9722:                   <h3 class="title"><a name=
        !          9723:                   "rcd-scripts-disable"></a>12.3.1.&nbsp;Disabling
1.35      jmmv     9724:                   handling of system startup scripts</h3>
                   9725:                 </div>
                   9726:               </div>
                   9727:             </div>
                   9728: 
                   9729:             <p>The automatic copying of config files can be toggled
                   9730:             by setting the environment variable <code class=
                   9731:             "varname">PKG_RCD_SCRIPTS</code> prior to package
                   9732:             installation. Note that the scripts will be always
1.45      wiz      9733:             copied inside the examples hierarchy, <code xmlns=
                   9734:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9735:             "filename">${PREFIX}/share/examples/rc.d/</code>, no
                   9736:             matter what the value of this variable is.</p>
                   9737:           </div>
                   9738:         </div>
                   9739: 
1.63    ! dillo    9740:         <div class="sect1" lang="en">
1.35      jmmv     9741:           <div class="titlepage">
                   9742:             <div>
                   9743:               <div>
                   9744:                 <h2 class="title" style="clear: both"><a name=
1.63    ! dillo    9745:                 "users-and-groups"></a>12.4.&nbsp;System users and
        !          9746:                 groups</h2>
1.35      jmmv     9747:               </div>
                   9748:             </div>
                   9749:           </div>
                   9750: 
                   9751:           <p>If a package needs to create special users and/or
                   9752:           groups during installation, it can do so by using the
                   9753:           pkginstall framework.</p>
                   9754: 
                   9755:           <p>Users can be created by adding entries to the
                   9756:           <code class="varname">PKG_USERS</code> variable. Each
1.45      wiz      9757:           entry has the following syntax, which mimics <code xmlns=
                   9758:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9759:           "filename">/etc/passwd</code>:</p>
                   9760:           <pre class="programlisting">
1.51      rillig   9761:     user:group[:[userid][:[descr][:[home][:shell]]]]
1.35      jmmv     9762: </pre>
                   9763: 
                   9764:           <p>Only the user and group are required; everything else
                   9765:           is optional, but the colons must be in the right places
                   9766:           when specifying optional bits. By default, a new user
1.45      wiz      9767:           will have home directory <code xmlns=
                   9768:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9769:           "filename">/nonexistent</code>, and login shell
1.45      wiz      9770:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9771:           class="filename">/sbin/nologin</code> unless they are
                   9772:           specified as part of the user element. Note that if the
1.51      rillig   9773:           description contains spaces, then spaces should be
1.45      wiz      9774:           backslash-escaped, as in:</p>
1.35      jmmv     9775:           <pre class="programlisting">
1.51      rillig   9776:     foo:foogrp::The\ Foomister
1.35      jmmv     9777: </pre>
                   9778: 
                   9779:           <p>Similarly, groups can be created using the
                   9780:           <code class="varname">PKG_GROUPS</code> variable, whose
                   9781:           syntax is:</p>
                   9782:           <pre class="programlisting">
1.51      rillig   9783:     group[:groupid]
1.35      jmmv     9784: </pre>
                   9785: 
                   9786:           <p>As before, only the group name is required; the
                   9787:           numeric identifier is optional.</p>
                   9788:         </div>
                   9789: 
1.63    ! dillo    9790:         <div class="sect1" lang="en">
1.35      jmmv     9791:           <div class="titlepage">
                   9792:             <div>
                   9793:               <div>
                   9794:                 <h2 class="title" style="clear: both"><a name=
1.63    ! dillo    9795:                 "shells"></a>12.5.&nbsp;System shells</h2>
1.35      jmmv     9796:               </div>
                   9797:             </div>
                   9798:           </div>
                   9799: 
                   9800:           <p>Packages that install system shells should register
1.45      wiz      9801:           them in the shell database, <code xmlns=
                   9802:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9803:           "filename">/etc/shells</code>, to make things easier to
                   9804:           the administrator. This must be done from the
                   9805:           installation scripts to keep binary packages working on
                   9806:           any system. pkginstall provides an easy way to accomplish
                   9807:           this task.</p>
                   9808: 
                   9809:           <p>When a package provides a shell interpreter, it has to
                   9810:           set the <code class="varname">PKG_SHELL</code> variable
                   9811:           to its absolute file name. This will add some hooks to
                   9812:           the installation scripts to handle it. Consider the
                   9813:           following example, taken from <a xmlns=
                   9814:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   9815:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
1.45      wiz      9816:           target="_top"><code xmlns="" class=
                   9817:           "filename">shells/zsh</code></a>:</p>
1.35      jmmv     9818:           <pre class="programlisting">
1.51      rillig   9819:     USE_PKGINSTALL= YES
                   9820:     PKG_SHELL=      ${PREFIX}/bin/zsh
1.35      jmmv     9821: </pre>
                   9822: 
1.63    ! dillo    9823:           <div class="sect2" lang="en">
1.35      jmmv     9824:             <div class="titlepage">
                   9825:               <div>
                   9826:                 <div>
1.63    ! dillo    9827:                   <h3 class="title"><a name=
        !          9828:                   "shells-disable"></a>12.5.1.&nbsp;Disabling
        !          9829:                   handling of configuration files</h3>
1.35      jmmv     9830:                 </div>
                   9831:               </div>
                   9832:             </div>
                   9833: 
                   9834:             <p>The automatic registration of shell interpreters can
                   9835:             be disabled by the administrator by setting the
1.45      wiz      9836:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9837:             class="filename">PKG_REGISTER_SHELLS</code> environment
                   9838:             variable to <code class="literal">NO</code>.</p>
1.35      jmmv     9839:           </div>
                   9840:         </div>
                   9841:       </div>
                   9842: 
1.63    ! dillo    9843:       <div class="chapter" lang="en">
1.35      jmmv     9844:         <div class="titlepage">
                   9845:           <div>
                   9846:             <div>
1.63    ! dillo    9847:               <h2 class="title"><a name=
1.38      dillo    9848:               "options"></a>Chapter&nbsp;13.&nbsp;Options
1.35      jmmv     9849:               handling</h2>
                   9850:             </div>
                   9851:           </div>
                   9852:         </div>
                   9853: 
                   9854:         <div class="toc">
                   9855:           <p><b>Table of Contents</b></p>
                   9856: 
                   9857:           <dl>
                   9858:             <dt><span class="sect1"><a href=
1.38      dillo    9859:             "#global-default-options">13.1. Global default
1.35      jmmv     9860:             options</a></span></dt>
                   9861: 
                   9862:             <dt><span class="sect1"><a href=
1.38      dillo    9863:             "#converting-to-options">13.2. Converting packages to
1.45      wiz      9864:             use <code xmlns=
                   9865:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9866:             "filename">bsd.options.mk</code></a></span></dt>
1.48      dillo    9867: 
                   9868:             <dt><span class="sect1"><a href="#option-names">13.3.
                   9869:             Option Names</a></span></dt>
1.35      jmmv     9870:           </dl>
                   9871:         </div>
                   9872: 
                   9873:         <p>Many packages have the ability to be built to support
1.45      wiz      9874:         different sets of features. <code xmlns=
                   9875:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9876:         "filename">bsd.options.mk</code> is a framework in pkgsrc
                   9877:         that provides generic handling of those options that
                   9878:         determine different ways in which the packages can be
                   9879:         built. It's possible for the user to specify exactly which
                   9880:         sets of options will be built into a package or to allow a
                   9881:         set of global default options apply.</p>
                   9882: 
1.63    ! dillo    9883:         <div class="sect1" lang="en">
1.35      jmmv     9884:           <div class="titlepage">
                   9885:             <div>
                   9886:               <div>
                   9887:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    9888:                 "global-default-options"></a>13.1.&nbsp;Global
1.35      jmmv     9889:                 default options</h2>
                   9890:               </div>
                   9891:             </div>
                   9892:           </div>
                   9893: 
                   9894:           <p>Global default options are listed in <code class=
                   9895:           "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
                   9896:           the options that should be built into every package if
                   9897:           that option is supported. This variable should be set in
1.45      wiz      9898:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9899:           class="filename">/etc/mk.conf</code>.</p>
1.35      jmmv     9900:         </div>
                   9901: 
1.63    ! dillo    9902:         <div class="sect1" lang="en">
1.35      jmmv     9903:           <div class="titlepage">
                   9904:             <div>
                   9905:               <div>
                   9906:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    9907:                 "converting-to-options"></a>13.2.&nbsp;Converting
1.45      wiz      9908:                 packages to use <code xmlns=
                   9909:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9910:                 "filename">bsd.options.mk</code></h2>
                   9911:               </div>
                   9912:             </div>
                   9913:           </div>
                   9914: 
1.45      wiz      9915:           <p>The following example shows how <code xmlns=
                   9916:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9917:           "filename">bsd.options.mk</code> should be used by the
                   9918:           hypothetical ``wibble'' package, either in the package
1.45      wiz      9919:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9920:           class="filename">Makefile</code>, or in a file, e.g.
                   9921:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9922:           class="filename">options.mk</code>, that is included by
                   9923:           the main package <code xmlns=
                   9924:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9925:           "filename">Makefile</code>.</p>
                   9926:           <pre class="programlisting">
1.51      rillig   9927:     PKG_OPTIONS_VAR=            PKG_OPTIONS.wibble
                   9928:     PKG_SUPPORTED_OPTIONS=              wibble-foo ldap
                   9929:     PKG_OPTIONS_OPTIONAL_GROUPS=        database
                   9930:     PKG_OPTIONS_GROUP.database= mysql pgsql
                   9931:     PKG_SUGGESTED_OPTIONS=              wibble-foo
                   9932:     PKG_OPTIONS_LEGACY_VARS+=   WIBBLE_USE_OPENLDAP:ldap
                   9933:     PKG_OPTIONS_LEGACY_OPTS+=   foo:wibble-foo
                   9934: 
                   9935:     .include "../../mk/bsd.prefs.mk"
                   9936: 
                   9937:     # this package was previously named wibble2
                   9938:     .if defined(PKG_OPTIONS.wibble2)
                   9939:     PKG_LEGACY_OPTIONS+=  ${PKG_OPTIONS.wibble2}
                   9940:     PKG_OPTIONS_DEPRECATED_WARNINGS+= \
                   9941:             "Deprecated variable PKG_OPTIONS.wibble2 used, use "${PKG_OPTIONS_VAR:Q}" instead."
                   9942:     .endif
                   9943: 
                   9944:     .include "../../mk/bsd.options.mk"
                   9945: 
                   9946:     # Package-specific option-handling
                   9947: 
                   9948:     ###
                   9949:     ### FOO support
                   9950:     ###
                   9951:     .if !empty(PKG_OPTIONS:Mwibble-foo)
                   9952:     CONFIGURE_ARGS+=    --enable-foo
                   9953:     .endif
                   9954: 
                   9955:     ###
                   9956:     ### LDAP support
                   9957:     ###
                   9958:     .if !empty(PKG_OPTIONS:Mldap)
                   9959:     .  include "../../databases/openldap/buildlink3.mk"
                   9960:     CONFIGURE_ARGS+=    --enable-ldap=${BUILDLINK_PREFIX.openldap}
                   9961:     .endif
                   9962: 
                   9963:     ###
                   9964:     ### database support
                   9965:     ###
                   9966:     .if !empty(PKG_OPTIONS:Mmysql)
                   9967:     .  include "../../mk/mysql.buildlink3.mk"
                   9968:     .endif
                   9969:     .if !empty(PKG_OPTIONS:Mpgsql)
                   9970:     .  include "../../mk/pgsql.buildlink3.mk"
                   9971:     .endif
1.1       grant    9972: </pre>
                   9973: 
1.28      rillig   9974:           <p>The first section contains the information about which
                   9975:           build options are supported by the package, and any
1.1       grant    9976:           default options settings if needed.</p>
                   9977: 
                   9978:           <div class="orderedlist">
                   9979:             <ol type="1">
                   9980:               <li>
1.14      xtraeme  9981:                 <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27      rillig   9982:                 the name of the <a href=
1.1       grant    9983:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   9984:                 <span class="citerefentry"><span class=
1.27      rillig   9985:                 "refentrytitle">make</span>(1)</span></a> variable
1.37      dillo    9986:                 that the user can set to override the default
1.57      minskim  9987:                 options. It should be set to PKG_OPTIONS.<em class=
1.63    ! dillo    9988:                 "replaceable"><code>pkgbase</code></em>. Do not set
        !          9989:                 it to PKG_OPTIONS.${PKGBASE}, since <code class=
        !          9990:                 "varname">PKGBASE</code> is set after <code class=
        !          9991:                 "varname">PKG_OPTIONS_VAR</code> is used.</p>
1.1       grant    9992:               </li>
                   9993: 
                   9994:               <li>
1.14      xtraeme  9995:                 <p><code class=
                   9996:                 "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37      dillo    9997:                 build options supported by the package.</p>
                   9998:               </li>
                   9999: 
                   10000:               <li>
                   10001:                 <p><code class=
                   10002:                 "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
                   10003:                 list of names of groups of mutually exclusive
                   10004:                 options. The options in each group are listed in
                   10005:                 <code class="varname">PKG_OPTIONS_GROUP.<em class=
                   10006:                 "replaceable"><code>groupname</code></em></code>.
                   10007:                 The most specific setting of any option from the
                   10008:                 group takes precedence over all other options in
                   10009:                 the group. Options from the groups will be
                   10010:                 automatically added to <code class=
                   10011:                 "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
                   10012:               </li>
                   10013: 
                   10014:               <li>
                   10015:                 <p><code class=
                   10016:                 "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
                   10017:                 like <code class=
                   10018:                 "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
                   10019:                 building the packages will fail if no option from
                   10020:                 the group is selected.</p>
1.1       grant    10021:               </li>
                   10022: 
                   10023:               <li>
1.27      rillig   10024:                 <p><code class=
1.44      gdt      10025:                 "varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a
                   10026:                 list of names of sets of options. At least one
                   10027:                 option from each set must be selected. The options
                   10028:                 in each set are listed in <code class=
                   10029:                 "varname">PKG_OPTIONS_SET.<em class=
                   10030:                 "replaceable"><code>setname</code></em></code>.
                   10031:                 Options from the sets will be automatically added
                   10032:                 to <code class=
                   10033:                 "varname">PKG_SUPPORTED_OPTIONS</code>. Building
                   10034:                 the package will fail if no option from the set is
                   10035:                 selected.</p>
                   10036:               </li>
                   10037: 
                   10038:               <li>
                   10039:                 <p><code class=
1.27      rillig   10040:                 "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
                   10041:                 build options which are enabled by default.</p>
                   10042:               </li>
                   10043: 
                   10044:               <li>
1.37      dillo    10045:                 <p><code class=
                   10046:                 "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
                   10047:                 of &#8220;<span class="quote"><em class=
1.63    ! dillo    10048:                 "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable"><code>option</code></em></span>&#8221;
        !          10049:                 pairs that map legacy <code xmlns=
1.45      wiz      10050:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.37      dillo    10051:                 "filename">/etc/mk.conf</code> variables to their
                   10052:                 option counterparts. Pairs should be added with
                   10053:                 &#8220;<span class="quote">+=</span>&#8221; to keep
                   10054:                 the listing of global legacy variables. A warning
                   10055:                 will be issued if the user uses a legacy
                   10056:                 variable.</p>
                   10057:               </li>
1.1       grant    10058: 
1.37      dillo    10059:               <li>
                   10060:                 <p><code class=
                   10061:                 "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
                   10062:                 of &#8220;<span class="quote"><em class=
1.63    ! dillo    10063:                 "replaceable"><code>old-option</code></em>:<em class="replaceable"><code>new-option</code></em></span>&#8221;
        !          10064:                 pairs that map options that have been renamed to
        !          10065:                 their new counterparts. Pairs should be added with
1.37      dillo    10066:                 &#8220;<span class="quote">+=</span>&#8221; to keep
                   10067:                 the listing of global legacy options. A warning
                   10068:                 will be issued if the user uses a legacy
                   10069:                 option.</p>
                   10070:               </li>
1.1       grant    10071: 
1.37      dillo    10072:               <li>
                   10073:                 <p><code class="varname">PKG_LEGACY_OPTIONS</code>
                   10074:                 is a list of options implied by deprecated
                   10075:                 variables used. This can be used for cases that
                   10076:                 neither <code class=
                   10077:                 "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
                   10078:                 <code class=
                   10079:                 "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
                   10080:                 handle, e. g. when <code class=
                   10081:                 "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1       grant    10082:               </li>
                   10083: 
                   10084:               <li>
1.37      dillo    10085:                 <p><code class=
                   10086:                 "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
                   10087:                 a list of warnings about deprecated variables or
                   10088:                 options used, and what to use instead.</p>
1.1       grant    10089:               </li>
1.28      rillig   10090:             </ol>
1.1       grant    10091:           </div>
                   10092: 
1.37      dillo    10093:           <p>A package should never modify <code class=
                   10094:           "varname">PKG_DEFAULT_OPTIONS</code> or the variable
                   10095:           named in <code class="varname">PKG_OPTIONS_VAR</code>.
                   10096:           These are strictly user-settable. To suggest a default
                   10097:           set of options, use <code class=
                   10098:           "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
                   10099: 
1.42      dillo    10100:           <p><code class="varname">PKG_OPTIONS_VAR</code> must be
1.45      wiz      10101:           defined before including <code xmlns=
                   10102:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.42      dillo    10103:           "filename">bsd.options.mk</code>. If none of <code class=
1.37      dillo    10104:           "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
                   10105:           "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
                   10106:           <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
1.47      reed     10107:           are defined (as can happen with platform-specific options
1.42      dillo    10108:           if none of them is supported on the current platform),
                   10109:           <code class="varname">PKG_OPTIONS</code> is set to the
                   10110:           empty list and the package is otherwise treated as not
                   10111:           using the options framework.</p>
1.37      dillo    10112: 
1.45      wiz      10113:           <p>After the inclusion of <code xmlns=
                   10114:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.37      dillo    10115:           "filename">bsd.options.mk</code>, the variable
1.28      rillig   10116:           <code class="varname">PKG_OPTIONS</code> contains the
1.37      dillo    10117:           list of selected build options, properly filtered to
1.28      rillig   10118:           remove unsupported and duplicate options.</p>
                   10119: 
1.1       grant    10120:           <p>The remaining sections contain the logic that is
1.37      dillo    10121:           specific to each option. The correct way to check for an
                   10122:           option is to check whether it is listed in <code class=
                   10123:           "varname">PKG_OPTIONS</code>:</p>
                   10124:           <pre class="programlisting">
1.51      rillig   10125:     .if !empty(PKG_OPTIONS:M<em class=
1.37      dillo    10126: "replaceable"><code>option</code></em>)
                   10127: </pre>
1.48      dillo    10128:         </div>
1.37      dillo    10129: 
1.63    ! dillo    10130:         <div class="sect1" lang="en">
1.48      dillo    10131:           <div class="titlepage">
                   10132:             <div>
                   10133:               <div>
                   10134:                 <h2 class="title" style="clear: both"><a name=
                   10135:                 "option-names"></a>13.3.&nbsp;Option Names</h2>
                   10136:               </div>
                   10137:             </div>
                   10138:           </div>
                   10139: 
                   10140:           <p>Options that enable similar features in different
                   10141:           packages (like optional support for a library) should use
                   10142:           a common name in all packages that support it (like the
                   10143:           name of the library). If another package already has an
                   10144:           option with the same meaning, use the same name.</p>
                   10145: 
                   10146:           <p>Options that enable features specific to one package,
                   10147:           where it's unlikely that another (unrelated) package has
                   10148:           the same (or a similar) optional feature, should use a
                   10149:           name prefixed with <code class="varname"><em class=
                   10150:           "replaceable"><code>pkgname</code></em>-</code>.</p>
                   10151: 
                   10152:           <p>If a group of related packages share an optional
                   10153:           feature specific to that group, prefix it with the name
                   10154:           of the &#8220;<span class="quote">main</span>&#8221;
                   10155:           package (e. g. <code class=
                   10156:           "varname">djbware-errno-hack</code>).</p>
                   10157: 
                   10158:           <p>For new options, add a line to <code xmlns=
                   10159:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10160:           "filename">mk/defaults/options.description</code>. Lines
                   10161:           have two fields, separated by tab. The first field is the
                   10162:           option name, the second its description. The description
                   10163:           should be a whole sentence (starting with an uppercase
                   10164:           letter and ending with a period) that describes what
                   10165:           enabling the option does. E. g. &#8220;<span class=
                   10166:           "quote">Enable ispell support.</span>&#8221; The file is
                   10167:           sorted by option names.</p>
1.1       grant    10168:         </div>
                   10169:       </div>
                   10170: 
1.63    ! dillo    10171:       <div class="chapter" lang="en">
1.1       grant    10172:         <div class="titlepage">
                   10173:           <div>
                   10174:             <div>
1.63    ! dillo    10175:               <h2 class="title"><a name=
1.38      dillo    10176:               "build"></a>Chapter&nbsp;14.&nbsp;The build
1.1       grant    10177:               process</h2>
                   10178:             </div>
                   10179:           </div>
                   10180:         </div>
                   10181: 
                   10182:         <div class="toc">
                   10183:           <p><b>Table of Contents</b></p>
                   10184: 
                   10185:           <dl>
1.56      rillig   10186:             <dt><span class="sect1"><a href="#build.intro">14.1.
                   10187:             Introduction</a></span></dt>
                   10188: 
                   10189:             <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1       grant    10190:             Program location</a></span></dt>
                   10191: 
1.56      rillig   10192:             <dt><span class="sect1"><a href=
                   10193:             "#build.builddirs">14.3. Directories used during the
                   10194:             build process</a></span></dt>
                   10195: 
                   10196:             <dt><span class="sect1"><a href="#build.running">14.4.
                   10197:             Running a phase</a></span></dt>
                   10198: 
                   10199:             <dt><span class="sect1"><a href="#build.fetch">14.5.
                   10200:             The <span class="emphasis"><em>fetch</em></span>
                   10201:             phase</a></span></dt>
                   10202: 
                   10203:             <dt><span class="sect1"><a href="#build.checksum">14.6.
                   10204:             The <span class="emphasis"><em>checksum</em></span>
                   10205:             phase</a></span></dt>
                   10206: 
                   10207:             <dt><span class="sect1"><a href="#build.extract">14.7.
                   10208:             The <span class="emphasis"><em>extract</em></span>
                   10209:             phase</a></span></dt>
                   10210: 
                   10211:             <dt><span class="sect1"><a href="#build.patch">14.8.
                   10212:             The <span class="emphasis"><em>patch</em></span>
                   10213:             phase</a></span></dt>
                   10214: 
                   10215:             <dt><span class="sect1"><a href="#build.tools">14.9.
                   10216:             The <span class="emphasis"><em>tools</em></span>
                   10217:             phase</a></span></dt>
                   10218: 
                   10219:             <dt><span class="sect1"><a href="#build.wrapper">14.10.
                   10220:             The <span class="emphasis"><em>wrapper</em></span>
                   10221:             phase</a></span></dt>
1.1       grant    10222: 
                   10223:             <dt><span class="sect1"><a href=
1.56      rillig   10224:             "#build.configure">14.11. The <span class=
                   10225:             "emphasis"><em>configure</em></span>
                   10226:             phase</a></span></dt>
                   10227: 
                   10228:             <dt><span class="sect1"><a href="#build.build">14.12.
                   10229:             The <span class="emphasis"><em>build</em></span>
                   10230:             phase</a></span></dt>
                   10231: 
                   10232:             <dt><span class="sect1"><a href="#build.test">14.13.
                   10233:             The <span class="emphasis"><em>test</em></span>
                   10234:             phase</a></span></dt>
                   10235: 
                   10236:             <dt><span class="sect1"><a href="#build.install">14.14.
                   10237:             The <span class="emphasis"><em>install</em></span>
                   10238:             phase</a></span></dt>
                   10239: 
                   10240:             <dt><span class="sect1"><a href="#build.package">14.15.
                   10241:             The <span class="emphasis"><em>package</em></span>
                   10242:             phase</a></span></dt>
                   10243: 
                   10244:             <dt><span class="sect1"><a href=
                   10245:             "#build.helpful-targets">14.16. Other helpful
1.1       grant    10246:             targets</a></span></dt>
                   10247:           </dl>
                   10248:         </div>
                   10249: 
1.63    ! dillo    10250:         <div class="sect1" lang="en">
1.56      rillig   10251:           <div class="titlepage">
                   10252:             <div>
                   10253:               <div>
                   10254:                 <h2 class="title" style="clear: both"><a name=
                   10255:                 "build.intro"></a>14.1.&nbsp;Introduction</h2>
                   10256:               </div>
                   10257:             </div>
                   10258:           </div>
                   10259: 
                   10260:           <p>This chapter gives a detailed description on how a
                   10261:           package is built. Building a package is separated into
                   10262:           different <span class="emphasis"><em>phases</em></span>
                   10263:           (for example <code class="varname">fetch</code>,
                   10264:           <code class="varname">build</code>, <code class=
                   10265:           "varname">install</code>), all of which are described in
                   10266:           the following sections. Each phase is splitted into
                   10267:           so-called <span class="emphasis"><em>stages</em></span>,
                   10268:           which take the name of the containing stage, prefixed by
                   10269:           one of <code class="varname">pre-</code>, <code class=
                   10270:           "varname">do-</code> or <code class=
                   10271:           "varname">post-</code>. (Examples are <code class=
                   10272:           "varname">pre-configure</code>, <code class=
                   10273:           "varname">post-build</code>.) Most of the actual work is
                   10274:           done in the <code class="varname">do-*</code> stages.</p>
                   10275: 
                   10276:           <p>The basic steps for building a program are always the
                   10277:           same. First the program's source (<span class=
                   10278:           "emphasis"><em>distfile</em></span>) must be brought to
                   10279:           the local system and then extracted. After any patches to
                   10280:           compile properly on NetBSD are applied, the software can
                   10281:           be configured, then built (usually by compiling), and
                   10282:           finally the generated binaries, etc. can be put into
                   10283:           place on the system. These are exactly the steps
                   10284:           performed by the NetBSD package system, which is
                   10285:           implemented as a series of targets in a central Makefile,
                   10286:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10287:           class="filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
                   10288:         </div>
1.1       grant    10289: 
1.63    ! dillo    10290:         <div class="sect1" lang="en">
1.1       grant    10291:           <div class="titlepage">
                   10292:             <div>
                   10293:               <div>
                   10294:                 <h2 class="title" style="clear: both"><a name=
1.56      rillig   10295:                 "build.prefix"></a>14.2.&nbsp;Program location</h2>
1.1       grant    10296:               </div>
                   10297:             </div>
                   10298:           </div>
                   10299: 
                   10300:           <p>Before outlining the process performed by the NetBSD
                   10301:           package system in the next section, here's a brief
                   10302:           discussion on where programs are installed, and which
                   10303:           variables influence this.</p>
                   10304: 
1.14      xtraeme  10305:           <p>The automatic variable <code class=
                   10306:           "varname">PREFIX</code> indicates where all files of the
                   10307:           final program shall be installed. It is usually set to
1.45      wiz      10308:           <code class="varname">LOCALBASE</code> (<code xmlns=
                   10309:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10310:           "filename">/usr/pkg</code>), or <code class=
                   10311:           "varname">CROSSBASE</code> for pkgs in the
1.1       grant    10312:           &#8220;<span class="quote">cross</span>&#8221; category.
1.14      xtraeme  10313:           The value of <code class="varname">PREFIX</code> needs to
                   10314:           be put into the various places in the program's source
                   10315:           where paths to these files are encoded. See <a href=
1.1       grant    10316:           "#components.patches" title=
1.38      dillo    10317:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
1.1       grant    10318:           &#8220;patches/*&#8221;</a> and <a href="#fixes.libtool"
                   10319:           title=
1.38      dillo    10320:           "15.3.1.&nbsp;Shared libraries - libtool">Section&nbsp;15.3.1,
1.1       grant    10321:           &#8220;Shared libraries - libtool&#8221;</a> for more
                   10322:           details.</p>
                   10323: 
                   10324:           <p>When choosing which of these variables to use, follow
                   10325:           the following rules:</p>
                   10326: 
                   10327:           <div class="itemizedlist">
                   10328:             <ul type="disc">
                   10329:               <li>
1.14      xtraeme  10330:                 <p><code class="varname">PREFIX</code> always
                   10331:                 points to the location where the current pkg will
                   10332:                 be installed. When referring to a pkg's own
1.1       grant    10333:                 installation path, use &#8220;<span class=
                   10334:                 "quote">${PREFIX}</span>&#8221;.</p>
                   10335:               </li>
                   10336: 
                   10337:               <li>
1.14      xtraeme  10338:                 <p><code class="varname">LOCALBASE</code> is where
                   10339:                 all non-X11 pkgs are installed. If you need to
1.1       grant    10340:                 construct a -I or -L argument to the compiler to
                   10341:                 find includes and libraries installed by another
                   10342:                 non-X11 pkg, use &#8220;<span class=
                   10343:                 "quote">${LOCALBASE}</span>&#8221;.</p>
                   10344:               </li>
                   10345: 
                   10346:               <li>
1.14      xtraeme  10347:                 <p><code class="varname">X11BASE</code> is where
                   10348:                 the actual X11 distribution (from xsrc, etc.) is
1.1       grant    10349:                 installed. When looking for <span class=
                   10350:                 "emphasis"><em>standard</em></span> X11 includes
                   10351:                 (not those installed by a pkg), use
                   10352:                 &#8220;<span class=
                   10353:                 "quote">${X11BASE}</span>&#8221;.</p>
                   10354:               </li>
                   10355: 
                   10356:               <li>
1.47      reed     10357:                 <p>X11-based packages are special in that they may
                   10358:                 be installed in either <code class=
1.14      xtraeme  10359:                 "varname">X11BASE</code> or <code class=
                   10360:                 "varname">LOCALBASE</code>.</p>
1.1       grant    10361: 
                   10362:                 <p>Usually, X11 packages should be installed under
1.14      xtraeme  10363:                 <code class="varname">LOCALBASE</code> whenever
1.34      wiz      10364:                 possible. Note that you will need to include
1.45      wiz      10365:                 <code xmlns=
                   10366:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.34      wiz      10367:                 "filename">../../mk/x11.buildlink3.mk</code> in
                   10368:                 them to request the presence of X11 and to get the
                   10369:                 right compilation flags.</p>
1.1       grant    10370: 
                   10371:                 <p>Even though, there are some packages that cannot
1.14      xtraeme  10372:                 be installed under <code class=
                   10373:                 "varname">LOCALBASE</code>: those that come with
1.1       grant    10374:                 app-defaults files. These packages are special and
1.14      xtraeme  10375:                 they must be placed under <code class=
                   10376:                 "varname">X11BASE</code>. To accomplish this, set
                   10377:                 either <code class="varname">USE_X11BASE</code> or
                   10378:                 <code class="varname">USE_IMAKE</code> in your
1.1       grant    10379:                 package.</p>
                   10380: 
1.34      wiz      10381:                 <p>Some notes: If you need to find includes or
1.14      xtraeme  10382:                 libraries installed by a pkg that has <code class=
                   10383:                 "varname">USE_IMAKE</code> or <code class=
                   10384:                 "varname">USE_X11BASE</code> in its pkg
1.45      wiz      10385:                 <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10386:                 class="filename">Makefile</code>, you need to look
                   10387:                 in <span class="emphasis"><em>both</em></span>
                   10388:                 <code xmlns=
                   10389:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10390:                 "filename">${X11BASE}</code> and <code xmlns=
                   10391:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10392:                 "filename">${LOCALBASE}</code>. To force
                   10393:                 installation of all X11 packages in <code class=
                   10394:                 "varname">LOCALBASE</code>, the <a xmlns=
                   10395:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    10396:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45      wiz      10397:                 target="_top"><code xmlns="" class=
                   10398:                 "filename">pkgtools/xpkgwedge</code></a> package is
1.34      wiz      10399:                 enabled by default.</p>
1.1       grant    10400:               </li>
                   10401: 
                   10402:               <li>
1.14      xtraeme  10403:                 <p><code class="varname">X11PREFIX</code> should be
1.1       grant    10404:                 used to refer to the installed location of an X11
1.14      xtraeme  10405:                 package. <code class="varname">X11PREFIX</code>
                   10406:                 will be set to <code class="varname">X11BASE</code>
                   10407:                 if xpkgwedge is not installed, and to <code class=
                   10408:                 "varname">LOCALBASE</code> if xpkgwedge is
1.1       grant    10409:                 installed.</p>
                   10410:               </li>
                   10411: 
                   10412:               <li>
                   10413:                 <p>If xpkgwedge is installed, it is possible to
1.14      xtraeme  10414:                 have some packages installed in <code class=
                   10415:                 "varname">X11BASE</code> and some in <code class=
                   10416:                 "varname">LOCALBASE</code>. To determine the prefix
                   10417:                 of an installed package, the <code class=
                   10418:                 "varname">EVAL_PREFIX</code> definition can be
                   10419:                 used. It takes pairs in the format
                   10420:                 &#8220;<span class=
1.1       grant    10421:                 "quote">DIRNAME=&lt;package&gt;</span>&#8221;, and
1.24      wiz      10422:                 the <a href=
                   10423:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   10424:                 <span class="citerefentry"><span class=
                   10425:                 "refentrytitle">make</span>(1)</span></a> variable
                   10426:                 <code class="varname">DIRNAME</code> will be set to
                   10427:                 the prefix of the installed package
                   10428:                 &lt;package&gt;, or &#8220;<span class=
1.1       grant    10429:                 "quote">${X11PREFIX}</span>&#8221; if the package
                   10430:                 is not installed.</p>
                   10431: 
                   10432:                 <p>This is best illustrated by example.</p>
                   10433: 
1.45      wiz      10434:                 <p>The following lines are taken from <code xmlns=
                   10435:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10436:                 "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1       grant    10437:                 <pre class="programlisting">
1.51      rillig   10438:     EVAL_PREFIX+=           GTKDIR=gtk+
                   10439:     CONFIGURE_ARGS+=        --with-guile-prefix=${LOCALBASE}        \
                   10440:                             --with-gtk-prefix="${GTKDIR}"           \
                   10441:                             --enable-multibyte
1.1       grant    10442: </pre>
                   10443: 
                   10444:                 <p>Specific defaults can be defined for the
1.14      xtraeme  10445:                 packages evaluated using <code class=
                   10446:                 "varname">EVAL_PREFIX</code>, by using a definition
1.1       grant    10447:                 of the form:</p>
                   10448:                 <pre class="programlisting">
1.51      rillig   10449:     GTKDIR_DEFAULT= ${LOCALBASE}
1.1       grant    10450: </pre>
                   10451: 
1.14      xtraeme  10452:                 <p>where <code class="varname">GTKDIR</code>
1.1       grant    10453:                 corresponds to the first definition in the
1.14      xtraeme  10454:                 <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1       grant    10455:               </li>
                   10456: 
                   10457:               <li>
1.45      wiz      10458:                 <p>Within <code xmlns=
                   10459:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10460:                 "filename">${PREFIX}</code>, packages should
                   10461:                 install files according to <a href=
1.24      wiz      10462:                 "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
                   10463:                 <span class="citerefentry"><span class=
                   10464:                 "refentrytitle">hier</span>(7)</span></a>, with the
1.45      wiz      10465:                 exception that manual pages go into <code xmlns=
                   10466:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10467:                 "filename">${PREFIX}/man</code>, not <code xmlns=
                   10468:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10469:                 "filename">${PREFIX}/share/man</code>.</p>
1.1       grant    10470:               </li>
                   10471:             </ul>
                   10472:           </div>
                   10473:         </div>
                   10474: 
1.63    ! dillo    10475:         <div class="sect1" lang="en">
1.1       grant    10476:           <div class="titlepage">
                   10477:             <div>
                   10478:               <div>
                   10479:                 <h2 class="title" style="clear: both"><a name=
1.56      rillig   10480:                 "build.builddirs"></a>14.3.&nbsp;Directories used
                   10481:                 during the build process</h2>
1.1       grant    10482:               </div>
                   10483:             </div>
                   10484:           </div>
                   10485: 
1.56      rillig   10486:           <p>When building a package, a number of directories is
                   10487:           used to store source files, temporary files,
                   10488:           pkgsrc-internal files, and so on. These directories are
                   10489:           explained here.</p>
                   10490: 
                   10491:           <p>Some of the directory variables contain relative
                   10492:           pathnames. There are two common base directories for
                   10493:           these relative directories: <code class=
                   10494:           "varname">PKGSRCDIR/PKGPATH</code> is used for
                   10495:           directories that are pkgsrc-specific. <code class=
                   10496:           "varname">WRKSRC</code> is used for directories inside
                   10497:           the package itself. The permissions after each variable
                   10498:           indicate whether the variable may be changed by the
                   10499:           package Makefile.</p>
1.1       grant    10500: 
                   10501:           <div class="variablelist">
                   10502:             <dl>
1.56      rillig   10503:               <dt><span class="term"><code class=
                   10504:               "varname">PKGSRCDIR</code> (read-only)</span></dt>
                   10505: 
                   10506:               <dd>
                   10507:                 <p>This is an absolute pathname that points to the
                   10508:                 pkgsrc root directory. Generally, you don't need
                   10509:                 it.</p>
                   10510:               </dd>
                   10511: 
                   10512:               <dt><span class="term"><code class=
                   10513:               "varname">PKGPATH</code> (read-only)</span></dt>
1.1       grant    10514: 
                   10515:               <dd>
1.56      rillig   10516:                 <p>This is a pathname relative to <code class=
                   10517:                 "varname">PKGSRCDIR</code> that points to the
                   10518:                 current package.</p>
                   10519:               </dd>
                   10520: 
                   10521:               <dt><span class="term"><code class=
                   10522:               "varname">WRKDIR</code> (read-only)</span></dt>
                   10523: 
                   10524:               <dd>
                   10525:                 <p>This is an absolute pathname pointing to the
1.57      minskim  10526:                 directory where all work takes place. The distfiles
                   10527:                 are extraced to this directory. It also contains
                   10528:                 temporary directories and log files used by the
                   10529:                 various pkgsrc frameworks, like <span class=
                   10530:                 "emphasis"><em>buildlink</em></span> or the
                   10531:                 <span class=
1.56      rillig   10532:                 "emphasis"><em>wrappers</em></span>.</p>
                   10533:               </dd>
                   10534: 
                   10535:               <dt><span class="term"><code class=
                   10536:               "varname">WRKSRC</code> (read-write)</span></dt>
                   10537: 
                   10538:               <dd>
                   10539:                 <p>This is an absolute pathname pointing to the
                   10540:                 directory where the distfiles are extracted. It is
                   10541:                 usually a direct subdirectory of <code class=
                   10542:                 "varname">WRKDIR</code>, and often it's the only
                   10543:                 directory entry that isn't hidden.</p>
                   10544:               </dd>
                   10545:             </dl>
                   10546:           </div>
                   10547:         </div>
                   10548: 
1.63    ! dillo    10549:         <div class="sect1" lang="en">
1.56      rillig   10550:           <div class="titlepage">
                   10551:             <div>
                   10552:               <div>
                   10553:                 <h2 class="title" style="clear: both"><a name=
                   10554:                 "build.running"></a>14.4.&nbsp;Running a phase</h2>
                   10555:               </div>
                   10556:             </div>
                   10557:           </div>
                   10558: 
                   10559:           <p>You can run a particular phase by typing
                   10560:           <span><strong class="command">make phase</strong></span>,
                   10561:           where <span class="emphasis"><em>phase</em></span> is the
                   10562:           name of the phase. This will automatically run all phases
                   10563:           that are required for this phase. The default phase is
                   10564:           <code class="varname">build</code>, that is, when you run
                   10565:           <span><strong class="command">make</strong></span>
                   10566:           without parameters in a package directory, the package
                   10567:           will be built, but not installed.</p>
                   10568:         </div>
                   10569: 
1.63    ! dillo    10570:         <div class="sect1" lang="en">
1.56      rillig   10571:           <div class="titlepage">
                   10572:             <div>
                   10573:               <div>
                   10574:                 <h2 class="title" style="clear: both"><a name=
1.63    ! dillo    10575:                 "build.fetch"></a>14.5.&nbsp;The <span class=
        !          10576:                 "emphasis"><em>fetch</em></span> phase</h2>
1.56      rillig   10577:               </div>
                   10578:             </div>
                   10579:           </div>
                   10580: 
                   10581:           <p>This will check if the file(s) given in the variables
                   10582:           <code class="varname">DISTFILES</code> and <code class=
                   10583:           "varname">PATCHFILES</code> (as defined in the package's
                   10584:           Makefile) are present on the local system in <code xmlns=
                   10585:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10586:           "filename">/usr/pkgsrc/distfiles</code>. If they are not
                   10587:           present, an attempt will be made to fetch them using
                   10588:           commands of the form:</p>
                   10589:           <pre class="programlisting">
1.51      rillig   10590:     ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
1.1       grant    10591: </pre>
                   10592: 
1.56      rillig   10593:           <p>where ${site} varies through several possibilities in
                   10594:           turn: first, <code class=
                   10595:           "varname">MASTER_SITE_OVERRIDE</code> is tried, then the
                   10596:           sites specified in either <code class=
                   10597:           "varname">SITES_file</code> if defined, else <code class=
                   10598:           "varname">MASTER_SITES</code> or <code class=
                   10599:           "varname">PATCH_SITES</code>, as applies, then finally
                   10600:           the value of <code class=
                   10601:           "varname">MASTER_SITE_BACKUP</code>. The order of all
                   10602:           except the first can be optionally sorted by the user,
                   10603:           via setting either <code class=
                   10604:           "varname">MASTER_SORT_AWK</code> or <code class=
                   10605:           "varname">MASTER_SORT_REGEX</code>.</p>
                   10606:         </div>
                   10607: 
1.63    ! dillo    10608:         <div class="sect1" lang="en">
1.56      rillig   10609:           <div class="titlepage">
                   10610:             <div>
                   10611:               <div>
                   10612:                 <h2 class="title" style="clear: both"><a name=
                   10613:                 "build.checksum"></a>14.6.&nbsp;The <span class=
                   10614:                 "emphasis"><em>checksum</em></span> phase</h2>
                   10615:               </div>
                   10616:             </div>
                   10617:           </div>
                   10618: 
                   10619:           <p>After the distfile(s) are fetched, their checksum is
                   10620:           generated and compared with the checksums stored in the
                   10621:           distinfo file. If the checksums don't match, the build is
                   10622:           aborted. This is to ensure the same distfile is used for
                   10623:           building, and that the distfile wasn't changed, e.g. by
                   10624:           some malign force, deliberately changed distfiles on the
                   10625:           master distribution site or network lossage.</p>
                   10626:         </div>
                   10627: 
1.63    ! dillo    10628:         <div class="sect1" lang="en">
1.56      rillig   10629:           <div class="titlepage">
                   10630:             <div>
                   10631:               <div>
                   10632:                 <h2 class="title" style="clear: both"><a name=
                   10633:                 "build.extract"></a>14.7.&nbsp;The <span class=
                   10634:                 "emphasis"><em>extract</em></span> phase</h2>
                   10635:               </div>
                   10636:             </div>
                   10637:           </div>
                   10638: 
                   10639:           <p>When the distfiles are present on the local system,
                   10640:           they need to be extracted, as they are usually in the
                   10641:           form of some compressed archive format, most commonly
                   10642:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10643:           class="filename">.tar.gz</code>.</p>
1.1       grant    10644: 
1.56      rillig   10645:           <p>If only some of the distfiles need to be uncompressed,
                   10646:           the files to be uncompressed should be put into
                   10647:           <code class="varname">EXTRACT_ONLY</code>.</p>
1.1       grant    10648: 
1.56      rillig   10649:           <p>If the distfiles are not in <code xmlns=
                   10650:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10651:           "filename">.tar.gz</code> format, they can be extracted
                   10652:           by setting either <code class=
                   10653:           "varname">EXTRACT_SUFX</code>, or <code class=
                   10654:           "varname">EXTRACT_CMD</code>, <code class=
                   10655:           "varname">EXTRACT_BEFORE_ARGS</code> and <code class=
                   10656:           "varname">EXTRACT_AFTER_ARGS</code>. In the former case,
                   10657:           pkgsrc knows how to extract a number of suffixes
                   10658:           (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10659:           class="filename">.tar.gz</code>, <code xmlns=
                   10660:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10661:           "filename">.tgz</code>, <code xmlns=
                   10662:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10663:           "filename">.tar.gz2</code>, <code xmlns=
                   10664:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10665:           "filename">.tbz</code>, <code xmlns=
                   10666:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10667:           "filename">.tar.Z</code>, <code xmlns=
                   10668:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10669:           "filename">.tar</code>, <code xmlns=
                   10670:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10671:           "filename">.shar.gz</code>, <code xmlns=
                   10672:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10673:           "filename">.shar.bz2</code>, <code xmlns=
                   10674:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10675:           "filename">.shar.Z</code>, <code xmlns=
                   10676:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10677:           "filename">.shar</code>, <code xmlns=
                   10678:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10679:           "filename">.Z</code>, <code xmlns=
                   10680:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10681:           "filename">.bz2</code> and <code xmlns=
                   10682:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10683:           "filename">.gz</code>; see the definition of the various
                   10684:           <code class="varname">DECOMPRESS_CMD</code> variables in
                   10685:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10686:           class="filename">bsd.pkg.extract.mk</code> for a complete
                   10687:           list). Here's an example on how to use the other
                   10688:           variables for a program that comes with a compressed
                   10689:           shell archive whose name ends in <code xmlns=
                   10690:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10691:           "filename">.msg.gz</code>:</p>
                   10692:           <pre class="programlisting">
1.51      rillig   10693:     EXTRACT_SUFX=           .msg.gz
                   10694:     EXTRACT_CMD=            zcat
                   10695:     EXTRACT_BEFORE_ARGS=
                   10696:     EXTRACT_AFTER_ARGS=     |sh
1.1       grant    10697: </pre>
1.56      rillig   10698:         </div>
                   10699: 
1.63    ! dillo    10700:         <div class="sect1" lang="en">
1.56      rillig   10701:           <div class="titlepage">
                   10702:             <div>
                   10703:               <div>
                   10704:                 <h2 class="title" style="clear: both"><a name=
1.63    ! dillo    10705:                 "build.patch"></a>14.8.&nbsp;The <span class=
        !          10706:                 "emphasis"><em>patch</em></span> phase</h2>
1.56      rillig   10707:               </div>
                   10708:             </div>
                   10709:           </div>
                   10710: 
                   10711:           <p>After extraction, all the patches named by the
                   10712:           <code class="varname">PATCHFILES</code>, those present in
                   10713:           the patches subdirectory of the package as well as in
                   10714:           $LOCALPATCHES/$PKGPATH (e.g. <code xmlns=
                   10715:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10716:           "filename">/usr/local/patches/graphics/png</code>) are
                   10717:           applied. Patchfiles ending in <code xmlns=
                   10718:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10719:           "filename">.Z</code> or <code xmlns=
                   10720:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10721:           "filename">.gz</code> are uncompressed before they are
                   10722:           applied, files ending in <code xmlns=
                   10723:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10724:           "filename">.orig</code> or <code xmlns=
                   10725:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10726:           "filename">.rej</code> are ignored. Any special options
                   10727:           to <a href=
                   10728:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   10729:           <span class="citerefentry"><span class=
                   10730:           "refentrytitle">patch</span>(1)</span></a> can be handed
                   10731:           in <code class="varname">PATCH_DIST_ARGS</code>. See
                   10732:           <a href="#components.patches" title=
                   10733:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
                   10734:           &#8220;patches/*&#8221;</a> for more details.</p>
                   10735: 
                   10736:           <p>By default <a href=
                   10737:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   10738:           <span class="citerefentry"><span class=
                   10739:           "refentrytitle">patch</span>(1)</span></a> is given
                   10740:           special args to make it fail if the patches apply with
                   10741:           some lines of fuzz. Please fix (regen) the patches so
                   10742:           that they apply cleanly. The rationale behind this is
                   10743:           that patches that don't apply cleanly may end up being
                   10744:           applied in the wrong place, and cause severe harm
                   10745:           there.</p>
                   10746:         </div>
                   10747: 
1.63    ! dillo    10748:         <div class="sect1" lang="en">
1.56      rillig   10749:           <div class="titlepage">
                   10750:             <div>
                   10751:               <div>
                   10752:                 <h2 class="title" style="clear: both"><a name=
1.63    ! dillo    10753:                 "build.tools"></a>14.9.&nbsp;The <span class=
        !          10754:                 "emphasis"><em>tools</em></span> phase</h2>
1.56      rillig   10755:               </div>
                   10756:             </div>
                   10757:           </div>
                   10758: 
                   10759:           <p>[TODO]</p>
                   10760:         </div>
                   10761: 
1.63    ! dillo    10762:         <div class="sect1" lang="en">
1.56      rillig   10763:           <div class="titlepage">
                   10764:             <div>
                   10765:               <div>
                   10766:                 <h2 class="title" style="clear: both"><a name=
                   10767:                 "build.wrapper"></a>14.10.&nbsp;The <span class=
                   10768:                 "emphasis"><em>wrapper</em></span> phase</h2>
                   10769:               </div>
                   10770:             </div>
                   10771:           </div>
                   10772: 
                   10773:           <p>[TODO]</p>
                   10774:         </div>
                   10775: 
1.63    ! dillo    10776:         <div class="sect1" lang="en">
1.56      rillig   10777:           <div class="titlepage">
                   10778:             <div>
                   10779:               <div>
                   10780:                 <h2 class="title" style="clear: both"><a name=
                   10781:                 "build.configure"></a>14.11.&nbsp;The <span class=
                   10782:                 "emphasis"><em>configure</em></span> phase</h2>
                   10783:               </div>
                   10784:             </div>
                   10785:           </div>
                   10786: 
                   10787:           <p>Most pieces of software need information on the header
                   10788:           files, system calls, and library routines which are
                   10789:           available on the platform they run on. The process of
                   10790:           determining this information is known as configuration,
                   10791:           and is usually automated. In most cases, a script is
                   10792:           supplied with the distfiles, and its invocation results
                   10793:           in generation of header files, Makefiles, etc.</p>
                   10794: 
                   10795:           <p>If the package contains a configure script, this can
                   10796:           be invoked by setting <code class=
                   10797:           "varname">HAS_CONFIGURE</code> to &#8220;<span class=
                   10798:           "quote">yes</span>&#8221;. If the configure script is a
                   10799:           GNU autoconf script, you should set <code class=
                   10800:           "varname">GNU_CONFIGURE</code> to &#8220;<span class=
                   10801:           "quote">yes</span>&#8221; instead. What happens in the
                   10802:           <span class="emphasis"><em>configure</em></span> phase is
                   10803:           roughly:</p>
                   10804:           <pre class="programlisting">
                   10805:     .for d in ${CONFIGURE_DIRS}
                   10806:             cd ${WRKSRC} &amp;&amp; cd ${d} &amp;&amp; env ${CONFIGURE_ENV} \
                   10807:                 ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
                   10808:     .endfor
                   10809: </pre>
1.1       grant    10810: 
1.56      rillig   10811:           <p><code class="varname">CONFIGURE_DIRS</code> (default:
                   10812:           &#8220;<span class="quote">.</span>&#8221;) is a list of
                   10813:           pathnames relative to <code class=
                   10814:           "varname">WRKSRC</code>. In each of these directories,
                   10815:           the configure script is run with the environment
                   10816:           <code class="varname">CONFIGURE_ENV</code> and arguments
                   10817:           <code class="varname">CONFIGURE_ARGS</code>. The
                   10818:           variables <code class="varname">CONFIGURE_ENV</code>,
                   10819:           <code class="varname">CONFIGURE_SCRIPT</code> (default:
                   10820:           &#8220;<span class="quote">./configure</span>&#8221;) and
                   10821:           <code class="varname">CONFIGURE_ARGS</code> may all be
                   10822:           changed by the package.</p>
1.1       grant    10823: 
1.56      rillig   10824:           <p>If the program uses an <code xmlns=
                   10825:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10826:           "filename">Imakefile</code> for configuration, the
                   10827:           appropriate steps can be invoked by setting <code class=
                   10828:           "varname">USE_IMAKE</code> to &#8220;<span class=
                   10829:           "quote">yes</span>&#8221;. (If you only want the package
                   10830:           installed in <code class="varname">${X11PREFIX}</code>
                   10831:           but xmkmf not being run, set <code class=
                   10832:           "varname">USE_X11BASE</code> instead.)</p>
                   10833:         </div>
1.1       grant    10834: 
1.63    ! dillo    10835:         <div class="sect1" lang="en">
1.56      rillig   10836:           <div class="titlepage">
                   10837:             <div>
                   10838:               <div>
                   10839:                 <h2 class="title" style="clear: both"><a name=
1.63    ! dillo    10840:                 "build.build"></a>14.12.&nbsp;The <span class=
        !          10841:                 "emphasis"><em>build</em></span> phase</h2>
1.56      rillig   10842:               </div>
                   10843:             </div>
1.1       grant    10844:           </div>
                   10845: 
1.56      rillig   10846:           <p>For building a package, a rough equivalent of the
                   10847:           following code is executed.</p>
1.1       grant    10848:           <pre class="programlisting">
1.56      rillig   10849:     .for d in ${BUILD_DIRS}
                   10850:             cd ${WRKSRC} &amp;&amp; cd ${d} &amp;&amp; env ${MAKE_ENV} \
                   10851:                 ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} \
                   10852:                     -f ${MAKEFILE} ${BUILD_TARGET}
                   10853:     .endfor
1.1       grant    10854: </pre>
1.56      rillig   10855: 
                   10856:           <p><code class="varname">BUILD_DIRS</code> (default:
                   10857:           &#8220;<span class="quote">.</span>&#8221;) is a list of
                   10858:           pathnames relative to <code class=
                   10859:           "varname">WRKSRC</code>. In each of these directories,
                   10860:           <code class="varname">MAKE_PROGRAM</code> is run with the
                   10861:           environment <code class="varname">MAKE_ENV</code> and
                   10862:           arguments <code class="varname">BUILD_MAKE_FLAGS</code>.
                   10863:           The variables <code class="varname">MAKE_ENV</code>,
                   10864:           <code class="varname">BUILD_MAKE_FLAGS</code>,
                   10865:           <code class="varname">MAKEFILE</code> and <code class=
                   10866:           "varname">BUILD_TARGET</code> may all be changed by the
                   10867:           package.</p>
                   10868: 
                   10869:           <p>The default value of <code class=
                   10870:           "varname">MAKE_PROGRAM</code> is &#8220;<span class=
                   10871:           "quote">gmake</span>&#8221; if <code class=
                   10872:           "varname">USE_TOOLS</code> contains &#8220;<span class=
                   10873:           "quote">gmake</span>&#8221;, &#8220;<span class=
                   10874:           "quote">make</span>&#8221; otherwise. The default value
                   10875:           of <code class="varname">MAKEFILE</code> is
                   10876:           &#8220;<span class="quote">Makefile</span>&#8221;, and
                   10877:           <code class="varname">BUILD_TARGET</code> defaults to
                   10878:           &#8220;<span class="quote">all</span>&#8221;.</p>
                   10879:         </div>
                   10880: 
1.63    ! dillo    10881:         <div class="sect1" lang="en">
1.56      rillig   10882:           <div class="titlepage">
                   10883:             <div>
                   10884:               <div>
                   10885:                 <h2 class="title" style="clear: both"><a name=
1.63    ! dillo    10886:                 "build.test"></a>14.13.&nbsp;The <span class=
        !          10887:                 "emphasis"><em>test</em></span> phase</h2>
1.56      rillig   10888:               </div>
                   10889:             </div>
                   10890:           </div>
                   10891: 
                   10892:           <p>[TODO]</p>
                   10893:         </div>
                   10894: 
1.63    ! dillo    10895:         <div class="sect1" lang="en">
1.56      rillig   10896:           <div class="titlepage">
                   10897:             <div>
                   10898:               <div>
                   10899:                 <h2 class="title" style="clear: both"><a name=
                   10900:                 "build.install"></a>14.14.&nbsp;The <span class=
                   10901:                 "emphasis"><em>install</em></span> phase</h2>
                   10902:               </div>
                   10903:             </div>
                   10904:           </div>
                   10905: 
                   10906:           <p>Once the build stage has completed, the final step is
                   10907:           to install the software in public directories, so users
                   10908:           can access the programs and files. As in the
                   10909:           build-target, <code class="varname">$MAKE_PROGRAM</code>
                   10910:           is invoked on <code class="varname">$MAKEFILE</code>
                   10911:           here, but with the <code class=
                   10912:           "varname">$INSTALL_TARGET</code> instead, the latter
                   10913:           defaulting to &#8220;<span class=
                   10914:           "quote">install</span>&#8221; (plus &#8220;<span class=
                   10915:           "quote">install.man</span>&#8221;, if <code class=
                   10916:           "varname">USE_IMAKE</code> is set).</p>
                   10917:         </div>
                   10918: 
1.63    ! dillo    10919:         <div class="sect1" lang="en">
1.56      rillig   10920:           <div class="titlepage">
                   10921:             <div>
                   10922:               <div>
                   10923:                 <h2 class="title" style="clear: both"><a name=
                   10924:                 "build.package"></a>14.15.&nbsp;The <span class=
                   10925:                 "emphasis"><em>package</em></span> phase</h2>
                   10926:               </div>
                   10927:             </div>
                   10928:           </div>
                   10929: 
                   10930:           <p>[TODO]</p>
1.1       grant    10931:         </div>
                   10932: 
1.63    ! dillo    10933:         <div class="sect1" lang="en">
1.1       grant    10934:           <div class="titlepage">
                   10935:             <div>
                   10936:               <div>
                   10937:                 <h2 class="title" style="clear: both"><a name=
1.56      rillig   10938:                 "build.helpful-targets"></a>14.16.&nbsp;Other
1.1       grant    10939:                 helpful targets</h2>
                   10940:               </div>
                   10941:             </div>
                   10942:           </div>
                   10943: 
                   10944:           <div class="variablelist">
                   10945:             <dl>
                   10946:               <dt><span class="term">pre/post-*</span></dt>
                   10947: 
                   10948:               <dd>
                   10949:                 <p>For any of the main targets described in the
                   10950:                 previous section, two auxiliary targets exist with
                   10951:                 &#8220;<span class="quote">pre-</span>&#8221; and
                   10952:                 &#8220;<span class="quote">post-</span>&#8221; used
                   10953:                 as a prefix for the main target's name. These
                   10954:                 targets are invoked before and after the main
                   10955:                 target is called, allowing extra configuration or
                   10956:                 installation steps be performed from a package's
                   10957:                 Makefile, for example, which a program's configure
                   10958:                 script or install target omitted.</p>
                   10959:               </dd>
                   10960: 
                   10961:               <dt><span class="term">do-*</span></dt>
                   10962: 
                   10963:               <dd>
                   10964:                 <p>Should one of the main targets do the wrong
                   10965:                 thing, and should there be no variable to fix this,
                   10966:                 you can redefine it with the do-* target. (Note
                   10967:                 that redefining the target itself instead of the
                   10968:                 do-* target is a bad idea, as the pre-* and post-*
                   10969:                 targets won't be called anymore, etc.) You will not
                   10970:                 usually need to do this.</p>
                   10971:               </dd>
                   10972: 
                   10973:               <dt><span class="term">reinstall</span></dt>
                   10974: 
                   10975:               <dd>
1.14      xtraeme  10976:                 <p>If you did a <span><strong class="command">make
                   10977:                 install</strong></span> and you noticed some file
                   10978:                 was not installed properly, you can repeat the
1.1       grant    10979:                 installation with this target, which will ignore
                   10980:                 the &#8220;<span class="quote">already
                   10981:                 installed</span>&#8221; flag.</p>
                   10982:               </dd>
                   10983: 
                   10984:               <dt><span class="term">deinstall</span></dt>
                   10985: 
                   10986:               <dd>
1.24      wiz      10987:                 <p>This target does a <a href=
                   10988:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   10989:                 <span class="citerefentry"><span class=
                   10990:                 "refentrytitle">pkg_delete</span>(1)</span></a> in
                   10991:                 the current directory, effectively de-installing
                   10992:                 the package. The following variables can be used to
                   10993:                 tune the behaviour:</p>
1.1       grant    10994: 
                   10995:                 <div class="variablelist">
                   10996:                   <dl>
1.14      xtraeme  10997:                     <dt><span class="term"><code class=
                   10998:                     "varname">PKG_VERBOSE</code></span></dt>
1.1       grant    10999: 
                   11000:                     <dd>
                   11001:                       <p>Add a "-v" to the <a href=
                   11002:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   11003:                       <span class="citerefentry"><span class=
                   11004:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   11005:                       command.</p>
                   11006:                     </dd>
                   11007: 
1.14      xtraeme  11008:                     <dt><span class="term"><code class=
                   11009:                     "varname">DEINSTALLDEPENDS</code></span></dt>
1.1       grant    11010: 
                   11011:                     <dd>
                   11012:                       <p>Remove all packages that require (depend
                   11013:                       on) the given package. This can be used to
                   11014:                       remove any packages that may have been pulled
                   11015:                       in by a given package, e.g. if
1.14      xtraeme  11016:                       <span><strong class="command">make deinstall
                   11017:                       DEINSTALLDEPENDS=1</strong></span> is done in
1.45      wiz      11018:                       <code xmlns=
                   11019:                       "http://www.w3.org/TR/xhtml1/transitional"
                   11020:                       class="filename">pkgsrc/x11/kde</code>, this
                   11021:                       is likely to remove whole KDE. Works by
1.1       grant    11022:                       adding &#8220;<span class=
                   11023:                       "quote">-R</span>&#8221; to the <a href=
                   11024:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   11025:                       <span class="citerefentry"><span class=
                   11026:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   11027:                       command line.</p>
                   11028:                     </dd>
                   11029:                   </dl>
                   11030:                 </div>
                   11031:               </dd>
                   11032: 
                   11033:               <dt><span class="term">update</span></dt>
                   11034: 
                   11035:               <dd>
                   11036:                 <p>This target causes the current package to be
                   11037:                 updated to the latest version. The package and all
                   11038:                 depending packages first get de-installed, then
                   11039:                 current versions of the corresponding packages get
                   11040:                 compiled and installed. This is similar to manually
                   11041:                 noting which packages are currently installed, then
1.14      xtraeme  11042:                 performing a series of <span><strong class=
                   11043:                 "command">make deinstall</strong></span> and
                   11044:                 <span><strong class="command">make
                   11045:                 install</strong></span> (or whatever <code class=
                   11046:                 "varname">UPDATE_TARGET</code> is set to) for these
                   11047:                 packages.</p>
1.1       grant    11048: 
                   11049:                 <p>You can use the &#8220;<span class=
                   11050:                 "quote">update</span>&#8221; target to resume
1.14      xtraeme  11051:                 package updating in case a previous
                   11052:                 <span><strong class="command">make
                   11053:                 update</strong></span> was interrupted for some
                   11054:                 reason. However, in this case, make sure you don't
                   11055:                 call <span><strong class="command">make
                   11056:                 clean</strong></span> or otherwise remove the list
                   11057:                 of dependent packages in <code class=
1.47      reed     11058:                 "varname">WRKDIR</code>. Otherwise, you lose the
1.1       grant    11059:                 ability to automatically update the current package
                   11060:                 along with the dependent packages you have
                   11061:                 installed.</p>
                   11062: 
1.14      xtraeme  11063:                 <p>Resuming an interrupted <span><strong class=
                   11064:                 "command">make update</strong></span> will only
                   11065:                 work as long as the package tree remains unchanged.
                   11066:                 If the source code for one of the packages to be
                   11067:                 updated has been changed, resuming
                   11068:                 <span><strong class="command">make
                   11069:                 update</strong></span> will most certainly
                   11070:                 fail!</p>
1.1       grant    11071: 
                   11072:                 <p>The following variables can be used either on
1.45      wiz      11073:                 the command line or in <code xmlns=
                   11074:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11075:                 "filename">/etc/mk.conf</code> to alter the
                   11076:                 behaviour of <span><strong class="command">make
                   11077:                 update</strong></span>:</p>
1.1       grant    11078: 
                   11079:                 <div class="variablelist">
                   11080:                   <dl>
1.14      xtraeme  11081:                     <dt><span class="term"><code class=
                   11082:                     "varname">UPDATE_TARGET</code></span></dt>
1.1       grant    11083: 
                   11084:                     <dd>
                   11085:                       <p>Install target to recursively use for the
                   11086:                       updated package and the dependent packages.
1.14      xtraeme  11087:                       Defaults to <code class=
                   11088:                       "varname">DEPENDS_TARGET</code> if set,
1.1       grant    11089:                       &#8220;<span class=
                   11090:                       "quote">install</span>&#8221; otherwise for
1.14      xtraeme  11091:                       <span><strong class="command">make
                   11092:                       update</strong></span>. e.g.
                   11093:                       <span><strong class="command">make update
                   11094:                       UPDATE_TARGET=package</strong></span></p>
1.1       grant    11095:                     </dd>
                   11096: 
1.14      xtraeme  11097:                     <dt><span class="term"><code class=
                   11098:                     "varname">NOCLEAN</code></span></dt>
1.1       grant    11099: 
                   11100:                     <dd>
                   11101:                       <p>Don't clean up after updating. Useful if
                   11102:                       you want to leave the work sources of the
                   11103:                       updated packages around for inspection or
                   11104:                       other purposes. Be sure you eventually clean
                   11105:                       up the source tree (see the
                   11106:                       &#8220;<span class=
                   11107:                       "quote">clean-update</span>&#8221; target
                   11108:                       below) or you may run into troubles with old
                   11109:                       source code still lying around on your next
1.14      xtraeme  11110:                       <span><strong class=
                   11111:                       "command">make</strong></span> or
                   11112:                       <span><strong class="command">make
                   11113:                       update</strong></span>.</p>
1.1       grant    11114:                     </dd>
                   11115: 
1.14      xtraeme  11116:                     <dt><span class="term"><code class=
                   11117:                     "varname">REINSTALL</code></span></dt>
1.1       grant    11118: 
                   11119:                     <dd>
                   11120:                       <p>Deinstall each package before installing
1.14      xtraeme  11121:                       (making <code class=
                   11122:                       "varname">DEPENDS_TARGET</code>). This may be
1.1       grant    11123:                       necessary if the &#8220;<span class=
                   11124:                       "quote">clean-update</span>&#8221; target
                   11125:                       (see below) was called after interrupting a
1.14      xtraeme  11126:                       running <span><strong class="command">make
                   11127:                       update</strong></span>.</p>
1.1       grant    11128:                     </dd>
                   11129: 
1.14      xtraeme  11130:                     <dt><span class="term"><code class=
                   11131:                     "varname">DEPENDS_TARGET</code></span></dt>
1.1       grant    11132: 
                   11133:                     <dd>
                   11134:                       <p>Allows you to disable recursion and
                   11135:                       hardcode the target for packages. The default
                   11136:                       is &#8220;<span class=
                   11137:                       "quote">update</span>&#8221; for the update
                   11138:                       target, facilitating a recursive update of
1.14      xtraeme  11139:                       prerequisite packages. Only set <code class=
                   11140:                       "varname">DEPENDS_TARGET</code> if you want
                   11141:                       to disable recursive updates. Use
                   11142:                       <code class="varname">UPDATE_TARGET</code>
                   11143:                       instead to just set a specific target for
                   11144:                       each package to be installed during
                   11145:                       <span><strong class="command">make
                   11146:                       update</strong></span> (see above).</p>
1.1       grant    11147:                     </dd>
                   11148:                   </dl>
                   11149:                 </div>
                   11150:               </dd>
                   11151: 
                   11152:               <dt><span class="term">clean-update</span></dt>
                   11153: 
                   11154:               <dd>
                   11155:                 <p>Clean the source tree for all packages that
1.14      xtraeme  11156:                 would get updated if <span><strong class=
                   11157:                 "command">make update</strong></span> was called
                   11158:                 from the current directory. This target should not
                   11159:                 be used if the current package (or any of its
                   11160:                 depending packages) have already been de-installed
                   11161:                 (e.g., after calling <span><strong class=
                   11162:                 "command">make update</strong></span>) or you may
                   11163:                 lose some packages you intended to update. As a
                   11164:                 rule of thumb: only use this target <span class=
                   11165:                 "emphasis"><em>before</em></span> the first time
                   11166:                 you run <span><strong class="command">make
                   11167:                 update</strong></span> and only if you have a dirty
                   11168:                 package tree (e.g., if you used <code class=
                   11169:                 "varname">NOCLEAN</code>).</p>
1.1       grant    11170: 
1.47      reed     11171:                 <p>If you are unsure about whether your tree is
                   11172:                 clean, you can either perform a
1.14      xtraeme  11173:                 <span><strong class="command">make
1.47      reed     11174:                 clean</strong></span> at the top of the tree, or
                   11175:                 use the following sequence of commands from the
                   11176:                 directory of the package you want to update
                   11177:                 (<span class="emphasis"><em>before</em></span>
                   11178:                 running <span><strong class="command">make
1.14      xtraeme  11179:                 update</strong></span> for the first time,
                   11180:                 otherwise you lose all the packages you wanted to
                   11181:                 update!):</p>
1.1       grant    11182:                 <pre class="screen">
1.14      xtraeme  11183: <code class="prompt">#</code> <strong class=
                   11184: "userinput"><code>make clean-update</code></strong>
                   11185: <code class="prompt">#</code> <strong class=
                   11186: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
                   11187: <code class="prompt">#</code> <strong class=
                   11188: "userinput"><code>make update</code></strong>
1.1       grant    11189: </pre>
                   11190: 
                   11191:                 <p>The following variables can be used either on
1.45      wiz      11192:                 the command line or in <code xmlns=
                   11193:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11194:                 "filename">/etc/mk.conf</code> to alter the
                   11195:                 behaviour of <span><strong class="command">make
                   11196:                 clean-update</strong></span>:</p>
1.1       grant    11197: 
                   11198:                 <div class="variablelist">
                   11199:                   <dl>
1.14      xtraeme  11200:                     <dt><span class="term"><code class=
                   11201:                     "varname">CLEAR_DIRLIST</code></span></dt>
1.1       grant    11202: 
                   11203:                     <dd>
1.14      xtraeme  11204:                       <p>After <span><strong class="command">make
                   11205:                       clean</strong></span>, do not reconstruct the
                   11206:                       list of directories to update for this
                   11207:                       package. Only use this if
                   11208:                       <span><strong class="command">make
                   11209:                       update</strong></span> successfully installed
                   11210:                       all packages you wanted to update. Normally,
                   11211:                       this is done automatically on
                   11212:                       <span><strong class="command">make
                   11213:                       update</strong></span>, but may have been
                   11214:                       suppressed by the <code class=
                   11215:                       "varname">NOCLEAN</code> variable (see
1.1       grant    11216:                       above).</p>
                   11217:                     </dd>
                   11218:                   </dl>
                   11219:                 </div>
                   11220:               </dd>
                   11221: 
                   11222:               <dt><span class="term">info</span></dt>
                   11223: 
                   11224:               <dd>
                   11225:                 <p>This target invokes <a href=
                   11226:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   11227:                 <span class="citerefentry"><span class=
                   11228:                 "refentrytitle">pkg_info</span>(1)</span></a> for
                   11229:                 the current package. You can use this to check
                   11230:                 which version of a package is installed.</p>
                   11231:               </dd>
                   11232: 
                   11233:               <dt><span class="term">readme</span></dt>
                   11234: 
                   11235:               <dd>
1.45      wiz      11236:                 <p>This target generates a <code xmlns=
                   11237:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11238:                 "filename">README.html</code> file, which can be
1.1       grant    11239:                 viewed using a browser such as <a xmlns=
                   11240:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   11241:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45      wiz      11242:                 target="_top"><code xmlns="" class=
                   11243:                 "filename">www/mozilla</code></a> or <a xmlns=
1.20      ben      11244:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   11245:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
1.45      wiz      11246:                 target="_top"><code xmlns="" class=
                   11247:                 "filename">www/links</code></a>. The generated
                   11248:                 files contain references to any packages which are
                   11249:                 in the <code class="varname">PACKAGES</code>
                   11250:                 directory on the local host. The generated files
                   11251:                 can be made to refer to URLs based on <code class=
1.20      ben      11252:                 "varname">FTP_PKG_URL_HOST</code> and <code class=
                   11253:                 "varname">FTP_PKG_URL_DIR</code>. For example, if I
1.45      wiz      11254:                 wanted to generate <code xmlns=
                   11255:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      11256:                 "filename">README.html</code> files which pointed
                   11257:                 to binary packages on the local machine, in the
1.45      wiz      11258:                 directory <code xmlns=
                   11259:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      11260:                 "filename">/usr/packages</code>, set <code class=
                   11261:                 "varname">FTP_PKG_URL_HOST=file://localhost</code>
                   11262:                 and <code class=
                   11263:                 "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
                   11264:                 <code class="varname">${PACKAGES}</code> directory
                   11265:                 and its subdirectories will be searched for all the
                   11266:                 binary packages.</p>
1.1       grant    11267:               </dd>
                   11268: 
                   11269:               <dt><span class="term">readme-all</span></dt>
                   11270: 
                   11271:               <dd>
1.45      wiz      11272:                 <p>Use this target to create a file <code xmlns=
                   11273:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11274:                 "filename">README-all.html</code> which contains a
1.1       grant    11275:                 list of all packages currently available in the
                   11276:                 NetBSD Packages Collection, together with the
                   11277:                 category they belong to and a short description.
1.45      wiz      11278:                 This file is compiled from the <code xmlns=
                   11279:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11280:                 "filename">pkgsrc/*/README.html</code> files, so be
1.1       grant    11281:                 sure to run this <span class=
1.14      xtraeme  11282:                 "emphasis"><em>after</em></span> a
                   11283:                 <span><strong class="command">make
                   11284:                 readme</strong></span>.</p>
1.1       grant    11285:               </dd>
                   11286: 
                   11287:               <dt><span class="term">cdrom-readme</span></dt>
                   11288: 
                   11289:               <dd>
                   11290:                 <p>This is very much the same as the
                   11291:                 &#8220;<span class="quote">readme</span>&#8221;
                   11292:                 target (see above), but is to be used when
                   11293:                 generating a pkgsrc tree to be written to a CD-ROM.
1.45      wiz      11294:                 This target also produces <code xmlns=
                   11295:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11296:                 "filename">README.html</code> files, and can be
                   11297:                 made to refer to URLs based on <code class=
                   11298:                 "varname">CDROM_PKG_URL_HOST</code> and
                   11299:                 <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1       grant    11300:               </dd>
                   11301: 
                   11302:               <dt><span class="term">show-distfiles</span></dt>
                   11303: 
                   11304:               <dd>
                   11305:                 <p>This target shows which distfiles and patchfiles
1.14      xtraeme  11306:                 are needed to build the package. (<code class=
                   11307:                 "varname">DISTFILES</code> and <code class=
1.45      wiz      11308:                 "varname">PATCHFILES</code>, but not <code xmlns=
                   11309:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11310:                 "filename">patches/*</code>)</p>
1.1       grant    11311:               </dd>
                   11312: 
                   11313:               <dt><span class="term">show-downlevel</span></dt>
                   11314: 
                   11315:               <dd>
                   11316:                 <p>This target shows nothing if the package is not
                   11317:                 installed. If a version of this package is
                   11318:                 installed, but is not the version provided in this
                   11319:                 version of pkgsrc, then a warning message is
                   11320:                 displayed. This target can be used to show which of
                   11321:                 your installed packages are downlevel, and so the
                   11322:                 old versions can be deleted, and the current ones
                   11323:                 added.</p>
                   11324:               </dd>
                   11325: 
                   11326:               <dt><span class="term">show-pkgsrc-dir</span></dt>
                   11327: 
                   11328:               <dd>
                   11329:                 <p>This target shows the directory in the pkgsrc
                   11330:                 hierarchy from which the package can be built and
                   11331:                 installed. This may not be the same directory as
                   11332:                 the one from which the package was installed. This
                   11333:                 target is intended to be used by people who may
                   11334:                 wish to upgrade many packages on a single host, and
                   11335:                 can be invoked from the top-level pkgsrc Makefile
                   11336:                 by using the &#8220;<span class=
                   11337:                 "quote">show-host-specific-pkgs</span>&#8221;
                   11338:                 target.</p>
                   11339:               </dd>
                   11340: 
                   11341:               <dt><span class=
                   11342:               "term">show-installed-depends</span></dt>
                   11343: 
                   11344:               <dd>
                   11345:                 <p>This target shows which installed packages match
1.14      xtraeme  11346:                 the current package's <code class=
                   11347:                 "varname">DEPENDS</code>. Useful if out of date
1.1       grant    11348:                 dependencies are causing build problems.</p>
                   11349:               </dd>
                   11350: 
                   11351:               <dt><span class="term">check-shlibs</span></dt>
                   11352: 
                   11353:               <dd>
                   11354:                 <p>After a package is installed, check all its
                   11355:                 binaries and (on ELF platforms) shared libraries to
                   11356:                 see if they find the shared libs they need. Run by
1.14      xtraeme  11357:                 default if <code class=
                   11358:                 "varname">PKG_DEVELOPER</code> is set in
1.45      wiz      11359:                 <code xmlns=
                   11360:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11361:                 "filename">/etc/mk.conf</code>.</p>
1.1       grant    11362:               </dd>
                   11363: 
                   11364:               <dt><span class="term">print-PLIST</span></dt>
                   11365: 
                   11366:               <dd>
                   11367:                 <p>After a &#8220;<span class="quote">make
                   11368:                 install</span>&#8221; from a new or upgraded pkg,
                   11369:                 this prints out an attempt to generate a new
1.45      wiz      11370:                 <code xmlns=
                   11371:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11372:                 "filename">PLIST</code> from a <span><strong class=
                   11373:                 "command">find -newer
1.14      xtraeme  11374:                 work/.extract_done</strong></span>. An attempt is
                   11375:                 made to care for shared libs etc., but it is
1.1       grant    11376:                 <span class="emphasis"><em>strongly</em></span>
                   11377:                 recommended to review the result before putting it
1.45      wiz      11378:                 into <code xmlns=
                   11379:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11380:                 "filename">PLIST</code>. On upgrades, it's useful
                   11381:                 to diff the output of this command against an
                   11382:                 already existing <code xmlns=
                   11383:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11384:                 "filename">PLIST</code> file.</p>
1.1       grant    11385: 
1.24      wiz      11386:                 <p>If the package installs files via <a href=
                   11387:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   11388:                 <span class="citerefentry"><span class=
                   11389:                 "refentrytitle">tar</span>(1)</span></a> or other
                   11390:                 methods that don't update file access times, be
                   11391:                 sure to add these files manually to your
1.45      wiz      11392:                 <code xmlns=
                   11393:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11394:                 "filename">PLIST</code>, as the &#8220;<span class=
                   11395:                 "quote">find -newer</span>&#8221; command used by
                   11396:                 this target won't catch them!</p>
1.1       grant    11397: 
                   11398:                 <p>See <a href="#print-PLIST" title=
1.38      dillo    11399:                 "10.3.&nbsp;Tweaking output of make print-PLIST">Section&nbsp;10.3,
1.14      xtraeme  11400:                 &#8220;Tweaking output of <span><strong class=
                   11401:                 "command">make
                   11402:                 print-PLIST</strong></span>&#8221;</a> for more
                   11403:                 information on this target.</p>
1.1       grant    11404:               </dd>
                   11405: 
                   11406:               <dt><span class="term">bulk-package</span></dt>
                   11407: 
                   11408:               <dd>
                   11409:                 <p>Used to do bulk builds. If an appropriate binary
                   11410:                 package already exists, no action is taken. If not,
                   11411:                 this target will compile, install and package it
1.47      reed     11412:                 (and its depends, if <code class=
1.14      xtraeme  11413:                 "varname">PKG_DEPENDS</code> is set properly. See
1.1       grant    11414:                 <a href="#binary.configuration" title=
1.38      dillo    11415:                 "6.3.1.&nbsp;Configuration">Section&nbsp;6.3.1,
1.47      reed     11416:                 &#8220;Configuration&#8221;</a>). After creating
                   11417:                 the binary package, the sources, the just-installed
                   11418:                 package and its required packages are removed,
1.1       grant    11419:                 preserving free disk space.</p>
                   11420: 
                   11421:                 <p><span class="emphasis"><em>Beware that this
                   11422:                 target may deinstall all packages installed on a
                   11423:                 system!</em></span></p>
                   11424:               </dd>
                   11425: 
                   11426:               <dt><span class="term">bulk-install</span></dt>
                   11427: 
                   11428:               <dd>
                   11429:                 <p>Used during bulk-installs to install required
1.47      reed     11430:                 packages. If an up-to-date binary package is
1.1       grant    11431:                 available, it will be installed via <a href=
                   11432:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   11433:                 <span class="citerefentry"><span class=
                   11434:                 "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14      xtraeme  11435:                 not, <span><strong class="command">make
                   11436:                 bulk-package</strong></span> will be executed, but
1.47      reed     11437:                 the installed binary won't be removed.</p>
1.1       grant    11438: 
                   11439:                 <p>A binary package is considered
1.47      reed     11440:                 &#8220;<span class="quote">up-to-date</span>&#8221;
1.1       grant    11441:                 to be installed via <a href=
                   11442:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   11443:                 <span class="citerefentry"><span class=
                   11444:                 "refentrytitle">pkg_add</span>(1)</span></a>
                   11445:                 if:</p>
                   11446: 
                   11447:                 <div class="itemizedlist">
                   11448:                   <ul type="disc">
                   11449:                     <li>
1.45      wiz      11450:                       <p>None of the package's files (<code xmlns=
                   11451:                       "http://www.w3.org/TR/xhtml1/transitional"
                   11452:                       class="filename">Makefile</code>, ...) were
1.14      xtraeme  11453:                       modified since it was built.</p>
1.1       grant    11454:                     </li>
                   11455: 
                   11456:                     <li>
                   11457:                       <p>None of the package's required (binary)
                   11458:                       packages were modified since it was
                   11459:                       built.</p>
                   11460:                     </li>
                   11461:                   </ul>
                   11462:                 </div>
                   11463: 
                   11464:                 <p><span class="emphasis"><em>Beware that this
                   11465:                 target may deinstall all packages installed on a
                   11466:                 system!</em></span></p>
                   11467:               </dd>
                   11468:             </dl>
                   11469:           </div>
                   11470:         </div>
                   11471:       </div>
                   11472: 
1.63    ! dillo    11473:       <div class="chapter" lang="en">
1.1       grant    11474:         <div class="titlepage">
                   11475:           <div>
                   11476:             <div>
1.63    ! dillo    11477:               <h2 class="title"><a name=
1.55      rillig   11478:               "fixes"></a>Chapter&nbsp;15.&nbsp;Making your package
                   11479:               work</h2>
1.1       grant    11480:             </div>
                   11481:           </div>
                   11482:         </div>
                   11483: 
                   11484:         <div class="toc">
                   11485:           <p><b>Table of Contents</b></p>
                   11486: 
                   11487:           <dl>
1.30      wiz      11488:             <dt><span class="sect1"><a href=
1.38      dillo    11489:             "#general-operation">15.1. General
1.30      wiz      11490:             operation</a></span></dt>
1.1       grant    11491: 
                   11492:             <dd>
                   11493:               <dl>
                   11494:                 <dt><span class="sect2"><a href=
1.38      dillo    11495:                 "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30      wiz      11496:                 pull in variables from /etc/mk.conf</a></span></dt>
1.1       grant    11497: 
                   11498:                 <dt><span class="sect2"><a href=
1.38      dillo    11499:                 "#where-to-install-documentation">15.1.2. Where to
1.31      wiz      11500:                 install documentation</a></span></dt>
                   11501: 
                   11502:                 <dt><span class="sect2"><a href=
1.38      dillo    11503:                 "#restricted-packages">15.1.3. Restricted
1.1       grant    11504:                 packages</a></span></dt>
                   11505: 
                   11506:                 <dt><span class="sect2"><a href=
1.38      dillo    11507:                 "#dependencies">15.1.4. Handling
1.1       grant    11508:                 dependencies</a></span></dt>
                   11509: 
                   11510:                 <dt><span class="sect2"><a href=
1.38      dillo    11511:                 "#conflicts">15.1.5. Handling conflicts with other
1.1       grant    11512:                 packages</a></span></dt>
                   11513: 
                   11514:                 <dt><span class="sect2"><a href=
1.38      dillo    11515:                 "#not-building-packages">15.1.6. Packages that
1.30      wiz      11516:                 cannot or should not be built</a></span></dt>
1.1       grant    11517: 
                   11518:                 <dt><span class="sect2"><a href=
1.38      dillo    11519:                 "#undeletable-packages">15.1.7. Packages which
1.30      wiz      11520:                 should not be deleted, once
                   11521:                 installed</a></span></dt>
1.1       grant    11522: 
                   11523:                 <dt><span class="sect2"><a href=
1.38      dillo    11524:                 "#security-handling">15.1.8. Handling packages with
1.1       grant    11525:                 security problems</a></span></dt>
                   11526: 
                   11527:                 <dt><span class="sect2"><a href=
1.38      dillo    11528:                 "#compiler-bugs">15.1.9. How to handle compiler
1.1       grant    11529:                 bugs</a></span></dt>
                   11530: 
                   11531:                 <dt><span class="sect2"><a href=
1.38      dillo    11532:                 "#bumping-pkgrevision">15.1.10. How to handle
1.30      wiz      11533:                 incrementing versions when fixing an existing
1.1       grant    11534:                 package</a></span></dt>
                   11535: 
                   11536:                 <dt><span class="sect2"><a href=
1.38      dillo    11537:                 "#portability-of-packages">15.1.11. Portability of
1.1       grant    11538:                 packages</a></span></dt>
                   11539:               </dl>
                   11540:             </dd>
                   11541: 
1.30      wiz      11542:             <dt><span class="sect1"><a href=
1.38      dillo    11543:             "#downloading-issues">15.2. Possible downloading
1.30      wiz      11544:             issues</a></span></dt>
1.1       grant    11545: 
                   11546:             <dd>
                   11547:               <dl>
                   11548:                 <dt><span class="sect2"><a href=
1.38      dillo    11549:                 "#no-plain-download">15.2.1. Packages whose
1.30      wiz      11550:                 distfiles aren't available for plain
1.1       grant    11551:                 downloading</a></span></dt>
                   11552: 
                   11553:                 <dt><span class="sect2"><a href=
1.38      dillo    11554:                 "#modified-distfiles-same-name">15.2.2. How to
1.30      wiz      11555:                 handle modified distfiles with the 'old'
                   11556:                 name</a></span></dt>
1.1       grant    11557:               </dl>
                   11558:             </dd>
                   11559: 
1.30      wiz      11560:             <dt><span class="sect1"><a href=
1.38      dillo    11561:             "#configuration-gotchas">15.3. Configuration
1.30      wiz      11562:             gotchas</a></span></dt>
1.1       grant    11563: 
                   11564:             <dd>
                   11565:               <dl>
                   11566:                 <dt><span class="sect2"><a href=
1.38      dillo    11567:                 "#fixes.libtool">15.3.1. Shared libraries -
1.1       grant    11568:                 libtool</a></span></dt>
                   11569: 
                   11570:                 <dt><span class="sect2"><a href=
1.38      dillo    11571:                 "#using-libtool">15.3.2. Using libtool on GNU
1.30      wiz      11572:                 packages that already support
                   11573:                 libtool</a></span></dt>
1.1       grant    11574: 
                   11575:                 <dt><span class="sect2"><a href=
1.38      dillo    11576:                 "#autoconf-automake">15.3.3. GNU
1.1       grant    11577:                 Autoconf/Automake</a></span></dt>
                   11578:               </dl>
                   11579:             </dd>
                   11580: 
1.55      rillig   11581:             <dt><span class="sect1"><a href="#fixes-build">15.4.
                   11582:             Building the package</a></span></dt>
1.1       grant    11583: 
                   11584:             <dd>
                   11585:               <dl>
                   11586:                 <dt><span class="sect2"><a href=
1.38      dillo    11587:                 "#cpp-defines">15.4.1. CPP defines</a></span></dt>
1.51      rillig   11588: 
1.60      rillig   11589:                 <dt><span class="sect2"><a href=
                   11590:                 "#cpp-list-examples">15.4.2. Examples of CPP
                   11591:                 defines for some platforms</a></span></dt>
                   11592: 
                   11593:                 <dt><span class="sect2"><a href="#cpp-list">15.4.3.
1.51      rillig   11594:                 Getting a list of CPP defines</a></span></dt>
1.1       grant    11595:               </dl>
                   11596:             </dd>
                   11597: 
1.30      wiz      11598:             <dt><span class="sect1"><a href=
1.38      dillo    11599:             "#package-specific-actions">15.5. Package specific
1.30      wiz      11600:             actions</a></span></dt>
1.1       grant    11601: 
                   11602:             <dd>
                   11603:               <dl>
                   11604:                 <dt><span class="sect2"><a href=
1.38      dillo    11605:                 "#user-interaction">15.5.1. User
1.2       hubertf  11606:                 interaction</a></span></dt>
1.1       grant    11607: 
                   11608:                 <dt><span class="sect2"><a href=
1.38      dillo    11609:                 "#handling-licenses">15.5.2. Handling
1.1       grant    11610:                 licenses</a></span></dt>
                   11611: 
                   11612:                 <dt><span class="sect2"><a href=
1.38      dillo    11613:                 "#installing-score-files">15.5.3. Installing score
1.1       grant    11614:                 files</a></span></dt>
                   11615: 
                   11616:                 <dt><span class="sect2"><a href=
1.38      dillo    11617:                 "#perl-scripts">15.5.4. Packages containing perl
1.1       grant    11618:                 scripts</a></span></dt>
                   11619: 
                   11620:                 <dt><span class="sect2"><a href=
1.38      dillo    11621:                 "#hardcoded-paths">15.5.5. Packages with hardcoded
1.30      wiz      11622:                 paths to other interpreters</a></span></dt>
1.1       grant    11623: 
                   11624:                 <dt><span class="sect2"><a href=
1.38      dillo    11625:                 "#perl-modules">15.5.6. Packages installing perl
1.1       grant    11626:                 modules</a></span></dt>
                   11627: 
                   11628:                 <dt><span class="sect2"><a href=
1.38      dillo    11629:                 "#faq.info-files">15.5.7. Packages installing info
1.1       grant    11630:                 files</a></span></dt>
                   11631: 
1.57      minskim  11632:                 <dt><span class="sect2"><a href="#manpages">15.5.8.
                   11633:                 Packages installing man pages</a></span></dt>
                   11634: 
1.1       grant    11635:                 <dt><span class="sect2"><a href=
1.57      minskim  11636:                 "#gconf2-data-files">15.5.9. Packages installing
1.30      wiz      11637:                 GConf2 data files</a></span></dt>
1.1       grant    11638: 
                   11639:                 <dt><span class="sect2"><a href=
1.57      minskim  11640:                 "#scrollkeeper-data-files">15.5.10. Packages
1.30      wiz      11641:                 installing scrollkeeper data files</a></span></dt>
1.1       grant    11642: 
                   11643:                 <dt><span class="sect2"><a href=
1.57      minskim  11644:                 "#x11-fonts">15.5.11. Packages installing X11
1.1       grant    11645:                 fonts</a></span></dt>
                   11646: 
                   11647:                 <dt><span class="sect2"><a href=
1.57      minskim  11648:                 "#gtk2-modules">15.5.12. Packages installing GTK2
1.1       grant    11649:                 modules</a></span></dt>
                   11650: 
                   11651:                 <dt><span class="sect2"><a href=
1.57      minskim  11652:                 "#sgml-xml-data">15.5.13. Packages installing SGML
1.30      wiz      11653:                 or XML data</a></span></dt>
1.1       grant    11654: 
                   11655:                 <dt><span class="sect2"><a href=
1.57      minskim  11656:                 "#mime-database">15.5.14. Packages installing
1.1       grant    11657:                 extensions to the MIME database</a></span></dt>
                   11658: 
                   11659:                 <dt><span class="sect2"><a href=
1.57      minskim  11660:                 "#intltool">15.5.15. Packages using
1.1       grant    11661:                 intltool</a></span></dt>
1.18      xtraeme  11662: 
                   11663:                 <dt><span class="sect2"><a href=
1.57      minskim  11664:                 "#startup-scripts">15.5.16. Packages installing
1.30      wiz      11665:                 startup scripts</a></span></dt>
1.57      minskim  11666: 
                   11667:                 <dt><span class="sect2"><a href=
                   11668:                 "#tex-packages">15.5.17. Packages installing TeX
                   11669:                 modules</a></span></dt>
1.1       grant    11670:               </dl>
                   11671:             </dd>
                   11672: 
1.30      wiz      11673:             <dt><span class="sect1"><a href=
1.38      dillo    11674:             "#feedback-to-author">15.6. Feedback to the
1.30      wiz      11675:             author</a></span></dt>
1.1       grant    11676:           </dl>
                   11677:         </div>
                   11678: 
1.63    ! dillo    11679:         <div class="sect1" lang="en">
1.1       grant    11680:           <div class="titlepage">
                   11681:             <div>
                   11682:               <div>
                   11683:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    11684:                 "general-operation"></a>15.1.&nbsp;General
1.1       grant    11685:                 operation</h2>
                   11686:               </div>
                   11687:             </div>
                   11688:           </div>
                   11689: 
1.63    ! dillo    11690:           <div class="sect2" lang="en">
1.1       grant    11691:             <div class="titlepage">
                   11692:               <div>
                   11693:                 <div>
1.30      wiz      11694:                   <h3 class="title"><a name=
1.38      dillo    11695:                   "pulling-vars-from-etc-mk.conf"></a>15.1.1.&nbsp;How
1.30      wiz      11696:                   to pull in variables from /etc/mk.conf</h3>
1.1       grant    11697:                 </div>
                   11698:               </div>
                   11699:             </div>
                   11700: 
                   11701:             <p>The problem with package-defined variables that can
1.14      xtraeme  11702:             be overridden via <code class="varname">MAKECONF</code>
1.45      wiz      11703:             or <code xmlns=
                   11704:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   11705:             "filename">/etc/mk.conf</code> is that <a href=
1.1       grant    11706:             "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   11707:             <span class="citerefentry"><span class=
                   11708:             "refentrytitle">make</span>(1)</span></a> expands a
1.47      reed     11709:             variable as it is used, but evaluates preprocessor-like
1.1       grant    11710:             statements (.if, .ifdef and .ifndef) as they are read.
1.14      xtraeme  11711:             So, to use any variable (which may be set in
1.45      wiz      11712:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   11713:             class="filename">/etc/mk.conf</code>) in one of the
                   11714:             .if* statements, the file <code xmlns=
                   11715:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11716:             "filename">/etc/mk.conf</code> must be included before
1.1       grant    11717:             that .if* statement.</p>
                   11718: 
1.47      reed     11719:             <p>Rather than having a number of ad-hoc ways of
1.45      wiz      11720:             including <code xmlns=
                   11721:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   11722:             "filename">/etc/mk.conf</code>, should it exist, or
                   11723:             <code class="varname">MAKECONF</code>, should it exist,
                   11724:             include the <code xmlns=
                   11725:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   11726:             "filename">pkgsrc/mk/bsd.prefs.mk</code> file in the
                   11727:             package Makefile before any preprocessor-like .if,
                   11728:             .ifdef, or .ifndef statements:</p>
1.1       grant    11729:             <pre class="programlisting">
1.51      rillig   11730:     .include "../../mk/bsd.prefs.mk"
                   11731: 
1.1       grant    11732:     .if defined(USE_MENUS)
1.51      rillig   11733:     # ...
1.1       grant    11734:     .endif
                   11735: </pre>
                   11736: 
1.14      xtraeme  11737:             <p>If you wish to set the <code class=
1.45      wiz      11738:             "varname">CFLAGS</code> variable in <code xmlns=
                   11739:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     11740:             "filename">/etc/mk.conf</code>, please make sure to
1.1       grant    11741:             use:</p>
                   11742:             <pre class="programlisting">
1.51      rillig   11743:     CFLAGS+=  -your -flags
1.1       grant    11744: </pre>
                   11745: 
1.14      xtraeme  11746:             <p>Using <code class="varname">CFLAGS=</code> (i.e.
                   11747:             without the &#8220;<span class="quote">+</span>&#8221;)
                   11748:             may lead to problems with packages that need to add
                   11749:             their own flags. Also, you may want to take a look at
                   11750:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1       grant    11751:             href=
                   11752:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45      wiz      11753:             target="_top"><code xmlns="" class=
                   11754:             "filename">devel/cpuflags</code></a> package if you're
1.20      ben      11755:             interested in optimization for the current CPU.</p>
1.1       grant    11756:           </div>
                   11757: 
1.63    ! dillo    11758:           <div class="sect2" lang="en">
1.1       grant    11759:             <div class="titlepage">
                   11760:               <div>
                   11761:                 <div>
1.31      wiz      11762:                   <h3 class="title"><a name=
1.38      dillo    11763:                   "where-to-install-documentation"></a>15.1.2.&nbsp;Where
1.31      wiz      11764:                   to install documentation</h3>
                   11765:                 </div>
                   11766:               </div>
                   11767:             </div>
                   11768: 
1.45      wiz      11769:             <p>Documentation should be installed into <code xmlns=
                   11770:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.31      wiz      11771:             "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
1.45      wiz      11772:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   11773:             class="filename">${PREFIX}/share/doc/${PKGNAME}</code>
                   11774:             (the latter includes the version number of the
                   11775:             package).</p>
1.31      wiz      11776:           </div>
                   11777: 
1.63    ! dillo    11778:           <div class="sect2" lang="en">
1.31      wiz      11779:             <div class="titlepage">
                   11780:               <div>
                   11781:                 <div>
1.63    ! dillo    11782:                   <h3 class="title"><a name=
1.38      dillo    11783:                   "restricted-packages"></a>15.1.3.&nbsp;Restricted
1.1       grant    11784:                   packages</h3>
                   11785:                 </div>
                   11786:               </div>
                   11787:             </div>
                   11788: 
                   11789:             <p>Some licenses restrict how software may be
                   11790:             re-distributed. In order to satisfy these restrictions,
                   11791:             the package system defines five make variables that can
                   11792:             be set to note these restrictions:</p>
                   11793: 
                   11794:             <div class="itemizedlist">
                   11795:               <ul type="disc">
                   11796:                 <li>
1.14      xtraeme  11797:                   <p><code class="varname">RESTRICTED</code></p>
1.1       grant    11798: 
                   11799:                   <p>This variable should be set whenever a
                   11800:                   restriction exists (regardless of its kind). Set
                   11801:                   this variable to a string containing the reason
                   11802:                   for the restriction.</p>
                   11803:                 </li>
                   11804: 
                   11805:                 <li>
1.14      xtraeme  11806:                   <p><code class=
                   11807:                   "varname">NO_BIN_ON_CDROM</code></p>
1.1       grant    11808: 
                   11809:                   <p>Binaries may not be placed on CD-ROM. Set this
1.14      xtraeme  11810:                   variable to <code class=
                   11811:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    11812:                   package may not be included on a CD-ROM.</p>
                   11813:                 </li>
                   11814: 
                   11815:                 <li>
1.14      xtraeme  11816:                   <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1       grant    11817: 
                   11818:                   <p>Binaries may not be placed on an FTP server.
1.14      xtraeme  11819:                   Set this variable to <code class=
                   11820:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    11821:                   package may not not be made available on the
                   11822:                   Internet.</p>
                   11823:                 </li>
                   11824: 
                   11825:                 <li>
1.14      xtraeme  11826:                   <p><code class=
                   11827:                   "varname">NO_SRC_ON_CDROM</code></p>
1.1       grant    11828: 
                   11829:                   <p>Distfiles may not be placed on CD-ROM. Set
1.14      xtraeme  11830:                   this variable to <code class=
                   11831:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    11832:                   of the source code or other distfile(s) is not
                   11833:                   allowed on CD-ROMs.</p>
                   11834:                 </li>
                   11835: 
                   11836:                 <li>
1.14      xtraeme  11837:                   <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1       grant    11838: 
                   11839:                   <p>Distfiles may not be placed on FTP. Set this
1.14      xtraeme  11840:                   variable to <code class=
                   11841:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    11842:                   of the source code or other distfile(s) via the
                   11843:                   Internet is not allowed.</p>
                   11844:                 </li>
                   11845:               </ul>
                   11846:             </div>
                   11847: 
1.14      xtraeme  11848:             <p>Please note that the use of <code class=
                   11849:             "varname">NO_PACKAGE</code>, <code class=
                   11850:             "varname">IGNORE</code>, <code class=
                   11851:             "varname">NO_CDROM</code>, or other generic make
1.1       grant    11852:             variables to denote restrictions is deprecated, because
                   11853:             they unconditionally prevent users from generating
                   11854:             binary packages!</p>
                   11855:           </div>
                   11856: 
1.63    ! dillo    11857:           <div class="sect2" lang="en">
1.1       grant    11858:             <div class="titlepage">
                   11859:               <div>
                   11860:                 <div>
1.63    ! dillo    11861:                   <h3 class="title"><a name=
1.38      dillo    11862:                   "dependencies"></a>15.1.4.&nbsp;Handling
1.1       grant    11863:                   dependencies</h3>
                   11864:                 </div>
                   11865:               </div>
                   11866:             </div>
                   11867: 
                   11868:             <p>Your package may depend on some other package being
                   11869:             present - and there are various ways of expressing this
1.14      xtraeme  11870:             dependency. pkgsrc supports the <code class=
                   11871:             "varname">BUILD_DEPENDS</code> and <code class=
1.47      reed     11872:             "varname">DEPENDS</code> definitions, the <code class=
                   11873:             "varname">USE_TOOLS</code> definition, as well as
1.45      wiz      11874:             dependencies via <code xmlns=
                   11875:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11876:             "filename">buildlink3.mk</code>, which is the preferred
1.1       grant    11877:             way to handle dependencies, and which uses the
                   11878:             variables named above. See <a href="#buildlink" title=
1.38      dillo    11879:             "Chapter&nbsp;11.&nbsp;Buildlink methodology">Chapter&nbsp;11,
1.1       grant    11880:             <i>Buildlink methodology</i></a> for more
                   11881:             information.</p>
                   11882: 
                   11883:             <p>The basic difference between the two variables is as
1.14      xtraeme  11884:             follows: The <code class="varname">DEPENDS</code>
1.1       grant    11885:             definition registers that pre-requisite in the binary
                   11886:             package so it will be pulled in when the binary package
1.14      xtraeme  11887:             is later installed, whilst the <code class=
                   11888:             "varname">BUILD_DEPENDS</code> definition does not,
1.1       grant    11889:             marking a dependency that is only needed for building
                   11890:             the package.</p>
                   11891: 
                   11892:             <p>This means that if you only need a package present
                   11893:             whilst you are building, it should be noted as a
1.14      xtraeme  11894:             <code class="varname">BUILD_DEPENDS</code>.</p>
1.1       grant    11895: 
1.14      xtraeme  11896:             <p>The format for a <code class=
                   11897:             "varname">BUILD_DEPENDS</code> and a <code class=
                   11898:             "varname">DEPENDS</code> definition is:</p>
1.1       grant    11899:             <pre class="programlisting">
1.51      rillig   11900:     &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
1.1       grant    11901: </pre>
                   11902: 
                   11903:             <p>Please note that the &#8220;<span class=
                   11904:             "quote">pre-req-package-name</span>&#8221; may include
1.18      xtraeme  11905:             any of the wildcard version numbers recognized by
1.1       grant    11906:             <a href=
                   11907:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   11908:             <span class="citerefentry"><span class=
                   11909:             "refentrytitle">pkg_info</span>(1)</span></a>.</p>
                   11910: 
                   11911:             <div class="orderedlist">
                   11912:               <ol type="1">
                   11913:                 <li>
                   11914:                   <p>If your package needs another package's
                   11915:                   binaries or libraries to build or run, and if
1.45      wiz      11916:                   that package has a <code xmlns=
                   11917:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11918:                   "filename">buildlink3.mk</code> file available,
                   11919:                   use it:</p>
1.1       grant    11920:                   <pre class="programlisting">
                   11921:     .include "../../graphics/jpeg/buildlink3.mk"
                   11922: </pre>
                   11923:                 </li>
                   11924: 
                   11925:                 <li>
                   11926:                   <p>If your package needs to use another package
1.45      wiz      11927:                   to build itself and there is no <code xmlns=
                   11928:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11929:                   "filename">buildlink3.mk</code> file available,
                   11930:                   use the <code class=
                   11931:                   "varname">BUILD_DEPENDS</code> definition:</p>
1.1       grant    11932:                   <pre class="programlisting">
1.51      rillig   11933:     BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
1.1       grant    11934: </pre>
                   11935:                 </li>
                   11936: 
                   11937:                 <li>
                   11938:                   <p>If your package needs a library with which to
1.45      wiz      11939:                   link and again there is no <code xmlns=
                   11940:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11941:                   "filename">buildlink3.mk</code> file available,
                   11942:                   this is specified using the <code class=
                   11943:                   "varname">DEPENDS</code> definition. An example
                   11944:                   of this is the <a xmlns=
1.1       grant    11945:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   11946:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45      wiz      11947:                   target="_top"><code xmlns="" class=
                   11948:                   "filename">print/lyx</code></a> package, which
                   11949:                   uses the xpm library, version 3.4j to build:</p>
1.1       grant    11950:                   <pre class="programlisting">
1.51      rillig   11951:     DEPENDS+=       xpm-3.4j:../../graphics/xpm
1.1       grant    11952: </pre>
                   11953: 
                   11954:                   <p>You can also use wildcards in package
                   11955:                   dependences:</p>
                   11956:                   <pre class="programlisting">
1.51      rillig   11957:     DEPENDS+=       xpm-[0-9]*:../../graphics/xpm
1.1       grant    11958: </pre>
                   11959: 
                   11960:                   <p>Note that such wildcard dependencies are
                   11961:                   retained when creating binary packages. The
                   11962:                   dependency is checked when installing the binary
                   11963:                   package and any package which matches the pattern
                   11964:                   will be used. Wildcard dependencies should be
                   11965:                   used with care.</p>
                   11966: 
                   11967:                   <p>The &#8220;<span class=
                   11968:                   "quote">-[0-9]*</span>&#8221; should be used
                   11969:                   instead of &#8220;<span class=
                   11970:                   "quote">-*</span>&#8221; to avoid potentially
                   11971:                   ambiguous matches such as &#8220;<span class=
                   11972:                   "quote">tk-postgresql</span>&#8221; matching a
                   11973:                   &#8220;<span class="quote">tk-*</span>&#8221;
1.14      xtraeme  11974:                   <code class="varname">DEPENDS</code>.</p>
1.1       grant    11975: 
                   11976:                   <p>Wildcards can also be used to specify that a
                   11977:                   package will only build against a certain minimum
                   11978:                   version of a pre-requisite:</p>
                   11979:                   <pre class="programlisting">
1.51      rillig   11980:     DEPENDS+=       tiff&gt;=3.5.4:../../graphics/tiff
1.1       grant    11981: </pre>
                   11982: 
                   11983:                   <p>This means that the package will build against
                   11984:                   version 3.5.4 of the tiff library or newer. Such
                   11985:                   a dependency may be warranted if, for example,
                   11986:                   the API of the library has changed with version
                   11987:                   3.5.4 and a package would not compile against an
                   11988:                   earlier version of tiff.</p>
                   11989: 
                   11990:                   <p>Please note that such dependencies should only
                   11991:                   be updated if a package requires a newer
                   11992:                   pre-requisite, but not to denote recommendations
                   11993:                   such as security updates or ABI changes that do
                   11994:                   not prevent a package from building correctly.
                   11995:                   Such recommendations can be expressed using
1.14      xtraeme  11996:                   <code class="varname">RECOMMENDED</code>:</p>
1.1       grant    11997:                   <pre class="programlisting">
1.51      rillig   11998:     RECOMMENDED+=   tiff&gt;=3.6.1:../../graphics/tiff
1.1       grant    11999: </pre>
                   12000: 
1.14      xtraeme  12001:                   <p>In addition to the above <code class=
                   12002:                   "varname">DEPENDS</code> line, this denotes that
1.1       grant    12003:                   while a package will build against
                   12004:                   tiff&gt;=3.5.4, at least version 3.6.1 is
1.14      xtraeme  12005:                   recommended. <code class=
                   12006:                   "varname">RECOMMENDED</code> entries will be
                   12007:                   turned into dependencies unless explicitly
                   12008:                   ignored (in which case a warning will be
1.36      wiz      12009:                   printed).</p>
                   12010: 
                   12011:                   <p>To ignore these dependency recommendations and
                   12012:                   just use the required <code class=
                   12013:                   "varname">DEPENDS</code>, set <code class=
                   12014:                   "varname">IGNORE_RECOMMENDED=YES</code>. This may
                   12015:                   make it easier and faster to update packages
                   12016:                   built using pkgsrc, since older compatible
                   12017:                   dependencies can continue to be used. This is
                   12018:                   useful for people who watch their rebuilds very
                   12019:                   carefully; it is not very good as a
                   12020:                   general-purpose hammer. If you use it, you need
                   12021:                   to be mindful of possible ABI changes, including
                   12022:                   those from the underlying OS.</p>
                   12023: 
                   12024:                   <p>Packages that are built with recommendations
                   12025:                   ignored may not be uploaded to ftp.NetBSD.org by
                   12026:                   developers and should not be used across
                   12027:                   different systems that may have different
                   12028:                   versions of binary packages installed.</p>
1.1       grant    12029: 
                   12030:                   <p>For security fixes, please update the package
                   12031:                   vulnerabilities file as well as setting
1.14      xtraeme  12032:                   <code class="varname">RECOMMENDED</code>, see
1.1       grant    12033:                   <a href="#security-handling" title=
1.38      dillo    12034:                   "15.1.8.&nbsp;Handling packages with security problems">
1.63    ! dillo    12035:                   Section&nbsp;15.1.8, &#8220;Handling packages
        !          12036:                   with security problems&#8221;</a> for more
1.1       grant    12037:                   information.</p>
                   12038:                 </li>
                   12039: 
                   12040:                 <li>
                   12041:                   <p>If your package needs some executable to be
1.17      sketch   12042:                   able to run correctly and if there's no
1.45      wiz      12043:                   <code xmlns=
                   12044:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12045:                   "filename">buildlink3.mk</code> file, this is
                   12046:                   specified using the <code class=
1.14      xtraeme  12047:                   "varname">DEPENDS</code> variable. The <a xmlns=
1.1       grant    12048:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   12049:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45      wiz      12050:                   target="_top"><code xmlns="" class=
                   12051:                   "filename">print/lyx</code></a> package needs to
                   12052:                   be able to execute the latex binary from the
                   12053:                   teTeX package when it runs, and that is
                   12054:                   specified:</p>
1.1       grant    12055:                   <pre class="programlisting">
1.51      rillig   12056:     DEPENDS+=        teTeX-[0-9]*:../../print/teTeX
1.1       grant    12057: </pre>
                   12058: 
                   12059:                   <p>The comment about wildcard dependencies from
                   12060:                   previous paragraph applies here, too.</p>
                   12061:                 </li>
                   12062:               </ol>
                   12063:             </div>
                   12064: 
                   12065:             <p>If your package needs files from another package to
                   12066:             build, see the first part of the &#8220;<span class=
                   12067:             "quote">do-configure</span>&#8221; target <a xmlns=
                   12068:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12069:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.45      wiz      12070:             target="_top"><code xmlns="" class=
                   12071:             "filename">print/ghostscript5</code></a> package (it
1.20      ben      12072:             relies on the jpeg sources being present in source form
                   12073:             during the build):</p>
1.1       grant    12074:             <pre class="programlisting">
1.51      rillig   12075:     if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then    \
                   12076:         cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} extract; \
1.1       grant    12077:     fi
                   12078: </pre>
                   12079: 
                   12080:             <p>If you build any other packages that way, please
                   12081:             make sure the working files are deleted too when this
                   12082:             package's working files are cleaned up. The easiest way
                   12083:             to do so is by adding a pre-clean target:</p>
                   12084:             <pre class="programlisting">
1.51      rillig   12085:     pre-clean:
                   12086:             cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} clean
1.1       grant    12087: </pre>
                   12088: 
1.14      xtraeme  12089:             <p>Please also note the <code class=
                   12090:             "varname">BUILD_USES_MSGFMT</code> and <code class=
                   12091:             "varname">BUILD_USES_GETTEXT_M4</code> definitions,
                   12092:             which are provided as convenience definitions. The
1.24      wiz      12093:             former works out whether <a href=
                   12094:             "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
                   12095:             <span class="citerefentry"><span class=
                   12096:             "refentrytitle">msgfmt</span>(1)</span></a> is part of
                   12097:             the base system, and, if it isn't, installs the
                   12098:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12099:             href=
1.1       grant    12100:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.45      wiz      12101:             target="_top"><code xmlns="" class=
                   12102:             "filename">devel/gettext</code></a> package. The latter
1.20      ben      12103:             adds a build dependency on either an installed version
                   12104:             of an older gettext package, or if it isn't, installs
                   12105:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12106:             href=
                   12107:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
1.45      wiz      12108:             target="_top"><code xmlns="" class=
                   12109:             "filename">devel/gettext-m4</code></a> package.</p>
1.1       grant    12110:           </div>
                   12111: 
1.63    ! dillo    12112:           <div class="sect2" lang="en">
1.1       grant    12113:             <div class="titlepage">
                   12114:               <div>
                   12115:                 <div>
1.63    ! dillo    12116:                   <h3 class="title"><a name=
1.38      dillo    12117:                   "conflicts"></a>15.1.5.&nbsp;Handling conflicts
1.1       grant    12118:                   with other packages</h3>
                   12119:                 </div>
                   12120:               </div>
                   12121:             </div>
                   12122: 
                   12123:             <p>Your package may conflict with other packages a user
                   12124:             might already have installed on his system, e.g. if
                   12125:             your package installs the same set of files like
                   12126:             another package in our pkgsrc tree.</p>
                   12127: 
1.14      xtraeme  12128:             <p>In this case you can set <code class=
1.47      reed     12129:             "varname">CONFLICTS</code> to a space-separated list of
1.1       grant    12130:             packages (including version string) your package
                   12131:             conflicts with.</p>
                   12132: 
1.47      reed     12133:             <p>For example, <a xmlns=
1.1       grant    12134:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12135:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.45      wiz      12136:             target="_top"><code xmlns="" class=
                   12137:             "filename">x11/Xaw3d</code></a> and <a xmlns=
1.20      ben      12138:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12139:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
1.45      wiz      12140:             target="_top"><code xmlns="" class=
1.47      reed     12141:             "filename">x11/Xaw-Xpm</code></a> install the same
                   12142:             shared library, thus you set in <code xmlns=
1.45      wiz      12143:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      12144:             "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1       grant    12145:             <pre class="programlisting">
1.51      rillig   12146:     CONFLICTS=      Xaw-Xpm-[0-9]*
1.1       grant    12147: </pre>
                   12148: 
1.45      wiz      12149:             <p>and in <code xmlns=
                   12150:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12151:             "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1       grant    12152:             <pre class="programlisting">
1.51      rillig   12153:     CONFLICTS=      Xaw3d-[0-9]*
1.1       grant    12154: </pre>
                   12155: 
                   12156:             <p>Packages will automatically conflict with other
                   12157:             packages with the name prefix and a different version
                   12158:             string. &#8220;<span class=
                   12159:             "quote">Xaw3d-1.5</span>&#8221; e.g. will automatically
                   12160:             conflict with the older version &#8220;<span class=
                   12161:             "quote">Xaw3d-1.3</span>&#8221;.</p>
                   12162:           </div>
                   12163: 
1.63    ! dillo    12164:           <div class="sect2" lang="en">
1.1       grant    12165:             <div class="titlepage">
                   12166:               <div>
                   12167:                 <div>
1.63    ! dillo    12168:                   <h3 class="title"><a name=
1.38      dillo    12169:                   "not-building-packages"></a>15.1.6.&nbsp;Packages
1.30      wiz      12170:                   that cannot or should not be built</h3>
1.1       grant    12171:                 </div>
                   12172:               </div>
                   12173:             </div>
                   12174: 
                   12175:             <p>There are several reasons why a package might be
                   12176:             instructed to not build under certain circumstances. If
                   12177:             the package builds and runs on most platforms, the
1.14      xtraeme  12178:             exceptions should be noted with <code class=
                   12179:             "varname">NOT_FOR_PLATFORM</code>. If the package
                   12180:             builds and runs on a small handful of platforms, set
                   12181:             <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.45      wiz      12182:             Both <code class="varname">ONLY_FOR_PLATFORM</code> and
                   12183:             <code class="varname">NOT_FOR_PLATFORM</code> are OS
                   12184:             triples (OS-version-platform) that can use glob-style
                   12185:             wildcards.</p>
                   12186: 
                   12187:             <p>If the package should be skipped (for example,
                   12188:             because it provides functionality already provided by
                   12189:             the system), set <code class=
1.14      xtraeme  12190:             "varname">PKG_SKIP_REASON</code> to a descriptive
                   12191:             message. If the package should fail because some
                   12192:             preconditions are not met, set <code class=
                   12193:             "varname">PKG_FAIL_REASON</code> to a descriptive
1.1       grant    12194:             message.</p>
                   12195:           </div>
                   12196: 
1.63    ! dillo    12197:           <div class="sect2" lang="en">
1.1       grant    12198:             <div class="titlepage">
                   12199:               <div>
                   12200:                 <div>
1.63    ! dillo    12201:                   <h3 class="title"><a name=
1.38      dillo    12202:                   "undeletable-packages"></a>15.1.7.&nbsp;Packages
1.30      wiz      12203:                   which should not be deleted, once installed</h3>
1.1       grant    12204:                 </div>
                   12205:               </div>
                   12206:             </div>
                   12207: 
                   12208:             <p>To ensure that a package may not be deleted, once it
1.14      xtraeme  12209:             has been installed, the <code class=
                   12210:             "varname">PKG_PRESERVE</code> definition should be set
                   12211:             in the package Makefile. This will be carried into any
1.1       grant    12212:             binary package that is made from this pkgsrc entry. A
                   12213:             &#8220;<span class="quote">preserved</span>&#8221;
                   12214:             package will not be deleted using <a href=
                   12215:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   12216:             <span class="citerefentry"><span class=
                   12217:             "refentrytitle">pkg_delete</span>(1)</span></a> unless
                   12218:             the &#8220;<span class="quote">-f</span>&#8221; option
                   12219:             is used.</p>
                   12220:           </div>
                   12221: 
1.63    ! dillo    12222:           <div class="sect2" lang="en">
1.1       grant    12223:             <div class="titlepage">
                   12224:               <div>
                   12225:                 <div>
1.63    ! dillo    12226:                   <h3 class="title"><a name=
1.38      dillo    12227:                   "security-handling"></a>15.1.8.&nbsp;Handling
1.1       grant    12228:                   packages with security problems</h3>
                   12229:                 </div>
                   12230:               </div>
                   12231:             </div>
                   12232: 
                   12233:             <p>When a vulnerability is found, this should be noted
1.45      wiz      12234:             in <code xmlns=
                   12235:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12236:             "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.43      wiz      12237:             and after committing that file, use
                   12238:             <span><strong class="command">make
                   12239:             upload</strong></span> in the same directory to update
                   12240:             the file on ftp.NetBSD.org.</p>
                   12241: 
                   12242:             <p>After fixing the vulnerability by a patch, its
                   12243:             <code class="varname">PKGREVISION</code> should be
                   12244:             increased (this is of course not necessary if the
                   12245:             problem is fixed by using a newer release of the
1.45      wiz      12246:             software). In addition, if a <code xmlns=
                   12247:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12248:             "filename">buildlink3.mk</code> file exists for an
1.43      wiz      12249:             affected package, a corresponding <code class=
1.14      xtraeme  12250:             "varname">BUILDLINK_RECOMMENDED.<em class=
                   12251:             "replaceable"><code>pkg</code></em></code> entry should
1.43      wiz      12252:             be added or updated in it.</p>
1.1       grant    12253: 
                   12254:             <p>Also, if the fix should be applied to the stable
                   12255:             pkgsrc branch, be sure to submit a pullup request!</p>
1.43      wiz      12256: 
                   12257:             <p>Binary packages already on ftp.NetBSD.org will be
                   12258:             handled semi-automatically by a weekly cron job.</p>
1.1       grant    12259:           </div>
                   12260: 
1.63    ! dillo    12261:           <div class="sect2" lang="en">
1.1       grant    12262:             <div class="titlepage">
                   12263:               <div>
                   12264:                 <div>
1.63    ! dillo    12265:                   <h3 class="title"><a name=
1.38      dillo    12266:                   "compiler-bugs"></a>15.1.9.&nbsp;How to handle
1.1       grant    12267:                   compiler bugs</h3>
                   12268:                 </div>
                   12269:               </div>
                   12270:             </div>
                   12271: 
                   12272:             <p>Some source files trigger bugs in the compiler,
                   12273:             based on combinations of compiler version and
                   12274:             architecture and almost always relation to optimisation
                   12275:             being enabled. Common symptoms are gcc internal errors
                   12276:             or never finishing compiling a file.</p>
                   12277: 
1.47      reed     12278:             <p>Typically, a workaround involves testing the
1.14      xtraeme  12279:             <code class="varname">MACHINE_ARCH</code> and compiler
1.1       grant    12280:             version, disabling optimisation for that
1.14      xtraeme  12281:             file/<code class="varname">MACHINE_ARCH</code>/compiler
1.45      wiz      12282:             combination, and documenting it in <code xmlns=
                   12283:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12284:             "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1       grant    12285:             number of examples!</p>
                   12286:           </div>
                   12287: 
1.63    ! dillo    12288:           <div class="sect2" lang="en">
1.1       grant    12289:             <div class="titlepage">
                   12290:               <div>
                   12291:                 <div>
1.63    ! dillo    12292:                   <h3 class="title"><a name=
        !          12293:                   "bumping-pkgrevision"></a>15.1.10.&nbsp;How to
1.30      wiz      12294:                   handle incrementing versions when fixing an
                   12295:                   existing package</h3>
1.1       grant    12296:                 </div>
                   12297:               </div>
                   12298:             </div>
                   12299: 
                   12300:             <p>When making fixes to an existing package it can be
1.14      xtraeme  12301:             useful to change the version number in <code class=
                   12302:             "varname">PKGNAME</code>. To avoid conflicting with
1.1       grant    12303:             future versions by the original author, a
                   12304:             &#8220;<span class="quote">nb1</span>&#8221;,
                   12305:             &#8220;<span class="quote">nb2</span>&#8221;, ...
                   12306:             suffix can be used on package versions by setting
1.14      xtraeme  12307:             <code class="varname">PKGREVISION=1</code> (2, ...).
                   12308:             The &#8220;<span class="quote">nb</span>&#8221; is
                   12309:             treated like a &#8220;<span class=
                   12310:             "quote">.</span>&#8221; by the pkg tools. e.g.</p>
1.1       grant    12311:             <pre class="programlisting">
1.51      rillig   12312:     DISTNAME=       foo-17.42
                   12313:     PKGREVISION=    9
1.1       grant    12314: </pre>
                   12315: 
1.14      xtraeme  12316:             <p>will result in a <code class=
                   12317:             "varname">PKGNAME</code> of &#8220;<span class=
1.1       grant    12318:             "quote">foo-17.42nb9</span>&#8221;.</p>
                   12319: 
                   12320:             <p>When a new release of the package is released, the
1.14      xtraeme  12321:             <code class="varname">PKGREVISION</code> should be
1.47      reed     12322:             removed, e.g. on a new minor release of the above
1.14      xtraeme  12323:             package, things should be like:</p>
1.1       grant    12324:             <pre class="programlisting">
1.51      rillig   12325:     DISTNAME=       foo-17.43
1.1       grant    12326: </pre>
                   12327:           </div>
                   12328: 
1.63    ! dillo    12329:           <div class="sect2" lang="en">
1.1       grant    12330:             <div class="titlepage">
                   12331:               <div>
                   12332:                 <div>
1.30      wiz      12333:                   <h3 class="title"><a name=
1.38      dillo    12334:                   "portability-of-packages"></a>15.1.11.&nbsp;Portability
1.30      wiz      12335:                   of packages</h3>
1.1       grant    12336:                 </div>
                   12337:               </div>
                   12338:             </div>
                   12339: 
                   12340:             <p>One appealing feature of pkgsrc is that it runs on
                   12341:             many different platforms. As a result, it is important
                   12342:             to ensure, where possible, that packages in pkgsrc are
                   12343:             portable. There are some particular details you should
                   12344:             pay attention to while working on pkgsrc.</p>
                   12345: 
1.63    ! dillo    12346:             <div class="sect3" lang="en">
1.1       grant    12347:               <div class="titlepage">
                   12348:                 <div>
                   12349:                   <div>
1.63    ! dillo    12350:                     <h4 class="title"><a name=
1.38      dillo    12351:                     "install-scripts"></a>15.1.11.1.&nbsp;${INSTALL},
1.1       grant    12352:                     ${INSTALL_DATA_DIR}, ...</h4>
                   12353:                   </div>
                   12354:                 </div>
                   12355:               </div>
                   12356: 
1.14      xtraeme  12357:               <p>The BSD-compatible <span><strong class=
                   12358:               "command">install</strong></span> supplied with some
1.1       grant    12359:               operating systems will not perform more than one
                   12360:               operation at a time. As such, you should call
                   12361:               &#8220;<span class="quote">${INSTALL}</span>&#8221;,
                   12362:               etc. like this:</p>
                   12363:               <pre class="programlisting">
1.51      rillig   12364:     ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   12365:     ${INSTALL_DATA_DIR} ${PREFIX}/dir2
1.1       grant    12366: </pre>
                   12367:             </div>
                   12368:           </div>
                   12369:         </div>
                   12370: 
1.63    ! dillo    12371:         <div class="sect1" lang="en">
1.1       grant    12372:           <div class="titlepage">
                   12373:             <div>
                   12374:               <div>
                   12375:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    12376:                 "downloading-issues"></a>15.2.&nbsp;Possible
1.1       grant    12377:                 downloading issues</h2>
                   12378:               </div>
                   12379:             </div>
                   12380:           </div>
                   12381: 
1.63    ! dillo    12382:           <div class="sect2" lang="en">
1.1       grant    12383:             <div class="titlepage">
                   12384:               <div>
                   12385:                 <div>
1.63    ! dillo    12386:                   <h3 class="title"><a name=
1.38      dillo    12387:                   "no-plain-download"></a>15.2.1.&nbsp;Packages
1.30      wiz      12388:                   whose distfiles aren't available for plain
1.1       grant    12389:                   downloading</h3>
                   12390:                 </div>
                   12391:               </div>
                   12392:             </div>
                   12393: 
                   12394:             <p>If you need to download from a dynamic URL you can
1.14      xtraeme  12395:             set <code class="varname">DYNAMIC_MASTER_SITES</code>
                   12396:             and a <span><strong class="command">make
1.45      wiz      12397:             fetch</strong></span> will call <code xmlns=
                   12398:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12399:             "filename">files/getsite.sh</code> with the name of
                   12400:             each file to download as an argument, expecting it to
                   12401:             output the URL of the directory from which to download
                   12402:             it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12403:             href=
1.1       grant    12404:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.45      wiz      12405:             target="_top"><code xmlns="" class=
                   12406:             "filename">graphics/ns-cult3d</code></a> is an example
                   12407:             of this usage.</p>
1.1       grant    12408: 
                   12409:             <p>If the download can't be automated, because the user
                   12410:             must submit personal information to apply for a
                   12411:             password, or must pay for the source, or whatever, you
1.14      xtraeme  12412:             can set <code class="varname">_FETCH_MESSAGE</code> to
                   12413:             a macro which displays a message explaining the
                   12414:             situation. <code class="varname">_FETCH_MESSAGE</code>
                   12415:             must be executable shell commands, not just a message.
                   12416:             (Generally, it executes <code class=
                   12417:             "varname">${ECHO}</code>). As of this writing, the
1.1       grant    12418:             following packages use this: <a xmlns=
                   12419:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.20      ben      12420:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
1.45      wiz      12421:             target="_top"><code xmlns="" class=
                   12422:             "filename">cad/simian</code></a>, <a xmlns=
1.20      ben      12423:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12424:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
1.45      wiz      12425:             target="_top"><code xmlns="" class=
                   12426:             "filename">devel/ipv6socket</code></a>, <a xmlns=
1.20      ben      12427:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12428:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
1.45      wiz      12429:             target="_top"><code xmlns="" class=
                   12430:             "filename">emulators/vmware-module</code></a>,
                   12431:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12432:             href=
1.20      ben      12433:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
1.45      wiz      12434:             target="_top"><code xmlns="" class=
                   12435:             "filename">fonts/acroread-jpnfont</code></a>, <a xmlns=
1.20      ben      12436:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.43      wiz      12437:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/multimedia/realplayer/README.html"
1.45      wiz      12438:             target="_top"><code xmlns="" class=
                   12439:             "filename">multimedia/realplayer</code></a>, <a xmlns=
1.43      wiz      12440:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.20      ben      12441:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
1.45      wiz      12442:             target="_top"><code xmlns="" class=
                   12443:             "filename">sysutils/storage-manager</code></a>,
                   12444:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12445:             href=
1.20      ben      12446:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
1.45      wiz      12447:             target="_top"><code xmlns="" class=
                   12448:             "filename">www/ap-aolserver</code></a>, <a xmlns=
1.20      ben      12449:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12450:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
1.45      wiz      12451:             target="_top"><code xmlns="" class=
                   12452:             "filename">www/openacs</code></a>. Try to be consistent
1.20      ben      12453:             with them.</p>
1.1       grant    12454:           </div>
                   12455: 
1.63    ! dillo    12456:           <div class="sect2" lang="en">
1.1       grant    12457:             <div class="titlepage">
                   12458:               <div>
                   12459:                 <div>
1.30      wiz      12460:                   <h3 class="title"><a name=
1.38      dillo    12461:                   "modified-distfiles-same-name"></a>15.2.2.&nbsp;How
1.30      wiz      12462:                   to handle modified distfiles with the 'old'
                   12463:                   name</h3>
1.1       grant    12464:                 </div>
                   12465:               </div>
                   12466:             </div>
                   12467: 
                   12468:             <p>Sometimes authors of a software package make some
                   12469:             modifications after the software was released, and they
                   12470:             put up a new distfile without changing the package's
                   12471:             version number. If a package is already in pkgsrc at
1.32      wiz      12472:             that time, the checksum will no longer match. The
                   12473:             contents of the new distfile should be compared against
                   12474:             the old one before changing anything, to make sure the
                   12475:             distfile was really updated on purpose, and that no
                   12476:             trojan horse or so crept in. Then, the correct way to
                   12477:             work around this is to set <code class=
                   12478:             "varname">DIST_SUBDIR</code> to a unique directory
                   12479:             name, usually based on <code class=
                   12480:             "varname">PKGNAME_NOREV</code>. In case this happens
                   12481:             more often, <code class="varname">PKGNAME</code> can be
1.45      wiz      12482:             used (thus including the <code xmlns=
                   12483:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.32      wiz      12484:             "filename">nbX</code> suffix) or a date stamp can be
                   12485:             appended, like <code class=
                   12486:             "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
1.45      wiz      12487:             forget regenerating the <code xmlns=
                   12488:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.32      wiz      12489:             "filename">distinfo</code> file after that, since it
                   12490:             contains the <code class="varname">DIST_SUBDIR</code>
                   12491:             path in the filenames. Furthermore, a mail to the
                   12492:             package's authors seems appropriate telling them that
                   12493:             changing distfiles after releases without changing the
                   12494:             file names is not good practice.</p>
1.1       grant    12495:           </div>
                   12496:         </div>
                   12497: 
1.63    ! dillo    12498:         <div class="sect1" lang="en">
1.1       grant    12499:           <div class="titlepage">
                   12500:             <div>
                   12501:               <div>
                   12502:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    12503:                 "configuration-gotchas"></a>15.3.&nbsp;Configuration
1.1       grant    12504:                 gotchas</h2>
                   12505:               </div>
                   12506:             </div>
                   12507:           </div>
                   12508: 
1.63    ! dillo    12509:           <div class="sect2" lang="en">
1.1       grant    12510:             <div class="titlepage">
                   12511:               <div>
                   12512:                 <div>
1.63    ! dillo    12513:                   <h3 class="title"><a name=
1.38      dillo    12514:                   "fixes.libtool"></a>15.3.1.&nbsp;Shared libraries
1.1       grant    12515:                   - libtool</h3>
                   12516:                 </div>
                   12517:               </div>
                   12518:             </div>
                   12519: 
                   12520:             <p>pkgsrc supports many different machines, with
                   12521:             different object formats like a.out and ELF, and
                   12522:             varying abilities to do shared library and dynamic
                   12523:             loading at all. To accompany this, varying commands and
                   12524:             options have to be passed to the compiler, linker, etc.
                   12525:             to get the Right Thing, which can be pretty annoying
                   12526:             especially if you don't have all the machines at your
                   12527:             hand to test things. The <a xmlns=
                   12528:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12529:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.45      wiz      12530:             target="_top"><code xmlns="" class=
                   12531:             "filename">devel/libtool</code></a> pkg can help here,
                   12532:             as it just &#8220;<span class=
                   12533:             "quote">knows</span>&#8221; how to build both static
                   12534:             and dynamic libraries from a set of source files, thus
1.47      reed     12535:             being platform-independent.</p>
1.1       grant    12536: 
                   12537:             <p>Here's how to use libtool in a pkg in seven simple
                   12538:             steps:</p>
                   12539: 
                   12540:             <div class="orderedlist">
                   12541:               <ol type="1">
                   12542:                 <li>
1.14      xtraeme  12543:                   <p>Add <code class=
                   12544:                   "varname">USE_LIBTOOL=yes</code> to the package
                   12545:                   Makefile.</p>
1.1       grant    12546:                 </li>
                   12547: 
                   12548:                 <li>
                   12549:                   <p>For library objects, use &#8220;<span class=
                   12550:                   "quote">${LIBTOOL} --mode=compile
                   12551:                   ${CC}</span>&#8221; in place of
                   12552:                   &#8220;<span class="quote">${CC}</span>&#8221;.
                   12553:                   You could even add it to the definition of
1.14      xtraeme  12554:                   <code class="varname">CC</code>, if only
                   12555:                   libraries are being built in a given Makefile.
                   12556:                   This one command will build both PIC and non-PIC
                   12557:                   library objects, so you need not have separate
                   12558:                   shared and non-shared library rules.</p>
1.1       grant    12559:                 </li>
                   12560: 
                   12561:                 <li>
                   12562:                   <p>For the linking of the library, remove any
                   12563:                   &#8220;<span class="quote">ar</span>&#8221;,
                   12564:                   &#8220;<span class="quote">ranlib</span>&#8221;,
                   12565:                   and &#8220;<span class="quote">ld
                   12566:                   -Bshareable</span>&#8221; commands, and instead
                   12567:                   use:</p>
                   12568:                   <pre class="programlisting">
1.51      rillig   12569:     ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} \
                   12570:         -rpath ${PREFIX}/lib -version-info major:minor
1.1       grant    12571: </pre>
                   12572: 
                   12573:                   <p>Note that the library is changed to have a
1.45      wiz      12574:                   <code xmlns=
                   12575:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12576:                   "filename">.la</code> extension, and the objects
                   12577:                   are changed to have a <code xmlns=
                   12578:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12579:                   "filename">.lo</code> extension. Change
                   12580:                   <code class="varname">OBJS</code> as necessary.
                   12581:                   This automatically creates all of the
1.45      wiz      12582:                   <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12583:                   class="filename">.a</code>, <code xmlns=
                   12584:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12585:                   "filename">.so.major.minor</code>, and ELF
                   12586:                   symlinks (if necessary) in the build directory.
                   12587:                   Be sure to include &#8220;<span class=
1.1       grant    12588:                   "quote">-version-info</span>&#8221;, especially
                   12589:                   when major and minor are zero, as libtool will
                   12590:                   otherwise strip off the shared library
                   12591:                   version.</p>
                   12592: 
                   12593:                   <p>From the libtool manual:</p>
                   12594:                   <pre class="programlisting">
1.51      rillig   12595:     So, libtool library versions are described by three integers:
1.1       grant    12596: 
1.51      rillig   12597:     CURRENT
                   12598:         The most recent interface number that this library implements.
1.1       grant    12599: 
1.51      rillig   12600:     REVISION
                   12601:         The implementation number of the CURRENT interface.
1.1       grant    12602: 
1.51      rillig   12603:     AGE
                   12604:         The difference between the newest and oldest interfaces that
                   12605:         this library implements.  In other words, the library implements
                   12606:         all the interface numbers in the range from number `CURRENT -
                   12607:         AGE' to `CURRENT'.
1.1       grant    12608:        
1.51      rillig   12609:     If two libraries have identical CURRENT and AGE numbers, then the
                   12610:     dynamic linker chooses the library with the greater REVISION number.
1.1       grant    12611: </pre>
                   12612: 
                   12613:                   <p>The &#8220;<span class=
                   12614:                   "quote">-release</span>&#8221; option will
                   12615:                   produce different results for a.out and ELF
                   12616:                   (excluding symlinks) in only one case. An ELF
                   12617:                   library of the form &#8220;<span class=
                   12618:                   "quote">libfoo-release.so.<span class=
                   12619:                   "emphasis"><em>x</em></span>.<span class=
                   12620:                   "emphasis"><em>y</em></span></span>&#8221; will
                   12621:                   have a symlink of &#8220;<span class=
                   12622:                   "quote">libfoo.so.<span class=
                   12623:                   "emphasis"><em>x</em></span>.<span class=
                   12624:                   "emphasis"><em>y</em></span></span>&#8221; on an
                   12625:                   a.out platform. This is handled
                   12626:                   automatically.</p>
                   12627: 
                   12628:                   <p>The &#8220;<span class="quote">-rpath
                   12629:                   argument</span>&#8221; is the install directory
                   12630:                   of the library being built.</p>
                   12631: 
1.45      wiz      12632:                   <p>In the <code xmlns=
                   12633:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12634:                   "filename">PLIST</code>, include only the
                   12635:                   <code xmlns=
                   12636:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.19      hubertf  12637:                   "filename">.la</code> file, the other files will
                   12638:                   be added automatically.</p>
1.1       grant    12639:                 </li>
                   12640: 
                   12641:                 <li>
1.45      wiz      12642:                   <p>When linking shared object (<code xmlns=
                   12643:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12644:                   "filename">.so</code>) files, i.e. files that are
1.24      wiz      12645:                   loaded via <a href=
                   12646:                   "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
                   12647:                   <span class="citerefentry"><span class=
                   12648:                   "refentrytitle">dlopen</span>(3)</span></a>, NOT
                   12649:                   shared libraries, use &#8220;<span class=
                   12650:                   "quote">-module -avoid-version</span>&#8221; to
                   12651:                   prevent them getting version tacked on.</p>
1.1       grant    12652: 
1.45      wiz      12653:                   <p>The <code xmlns=
                   12654:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12655:                   "filename">PLIST</code> file gets the
                   12656:                   <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12657:                   class="filename">foo.so</code> entry.</p>
1.1       grant    12658:                 </li>
                   12659: 
                   12660:                 <li>
                   12661:                   <p>When linking programs that depend on these
                   12662:                   libraries <span class=
                   12663:                   "emphasis"><em>before</em></span> they are
                   12664:                   installed, preface the <a href=
                   12665:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
                   12666:                   <span class="citerefentry"><span class=
                   12667:                   "refentrytitle">cc</span>(1)</span></a> or
                   12668:                   <a href=
                   12669:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   12670:                   <span class="citerefentry"><span class=
                   12671:                   "refentrytitle">ld</span>(1)</span></a> line with
                   12672:                   &#8220;<span class="quote">${LIBTOOL}
                   12673:                   --mode=link</span>&#8221;, and it will find the
                   12674:                   correct libraries (static or shared), but please
                   12675:                   be aware that libtool will not allow you to
                   12676:                   specify a relative path in -L (such as
                   12677:                   &#8220;<span class=
                   12678:                   "quote">-L../somelib</span>&#8221;), because it
                   12679:                   expects you to change that argument to be the
1.45      wiz      12680:                   <code xmlns=
                   12681:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12682:                   "filename">.la</code> file. e.g.</p>
1.1       grant    12683:                   <pre class="programlisting">
1.51      rillig   12684:     ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
1.1       grant    12685: </pre>
                   12686: 
                   12687:                   <p>should be changed to:</p>
                   12688:                   <pre class="programlisting">
1.51      rillig   12689:     ${LIBTOOL} --mode=link ${CC} -o <em class=
1.14      xtraeme  12690: "replaceable"><code>someprog</code></em> <em class=
                   12691: "replaceable"><code>../somelib/somelib.la</code></em>
1.1       grant    12692: </pre>
                   12693: 
                   12694:                   <p>and it will do the right thing with the
                   12695:                   libraries.</p>
                   12696:                 </li>
                   12697: 
                   12698:                 <li>
                   12699:                   <p>When installing libraries, preface the
                   12700:                   <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   12701:                   <span class="citerefentry"><span class=
                   12702:                   "refentrytitle">install</span>(1)</span></a> or
                   12703:                   <a href=
                   12704:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
                   12705:                   <span class="citerefentry"><span class=
                   12706:                   "refentrytitle">cp</span>(1)</span></a> command
                   12707:                   with &#8220;<span class="quote">${LIBTOOL}
                   12708:                   --mode=install</span>&#8221;, and change the
1.45      wiz      12709:                   library name to <code xmlns=
                   12710:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12711:                   "filename">.la</code>. e.g.</p>
1.1       grant    12712:                   <pre class="programlisting">
1.51      rillig   12713:     ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1       grant    12714: </pre>
                   12715: 
1.45      wiz      12716:                   <p>This will install the static <code xmlns=
                   12717:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12718:                   "filename">.a</code>, shared library, any needed
1.1       grant    12719:                   symlinks, and run <a href=
                   12720:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
                   12721:                   <span class="citerefentry"><span class=
                   12722:                   "refentrytitle">ldconfig</span>(8)</span></a>.</p>
                   12723:                 </li>
                   12724: 
                   12725:                 <li>
1.45      wiz      12726:                   <p>In your <code xmlns=
                   12727:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12728:                   "filename">PLIST</code>, include only the
                   12729:                   <code xmlns=
                   12730:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.23      wiz      12731:                   "filename">.la</code> file (this is a change from
                   12732:                   previous behaviour).</p>
1.1       grant    12733:                 </li>
                   12734:               </ol>
                   12735:             </div>
                   12736:           </div>
                   12737: 
1.63    ! dillo    12738:           <div class="sect2" lang="en">
1.1       grant    12739:             <div class="titlepage">
                   12740:               <div>
                   12741:                 <div>
1.63    ! dillo    12742:                   <h3 class="title"><a name=
1.38      dillo    12743:                   "using-libtool"></a>15.3.2.&nbsp;Using libtool on
1.30      wiz      12744:                   GNU packages that already support libtool</h3>
1.1       grant    12745:                 </div>
                   12746:               </div>
                   12747:             </div>
                   12748: 
1.14      xtraeme  12749:             <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
                   12750:             the package Makefile. This will override the package's
                   12751:             own libtool in most cases. For older libtool using
1.1       grant    12752:             packages, libtool is made by ltconfig script during the
                   12753:             do-configure step; you can check the libtool script
1.14      xtraeme  12754:             location by doing <span><strong class="command">make
                   12755:             configure; find work*/ -name
                   12756:             libtool</strong></span>.</p>
                   12757: 
                   12758:             <p><code class="varname">LIBTOOL_OVERRIDE</code>
                   12759:             specifies which libtool scripts, relative to
                   12760:             <code class="varname">WRKSRC</code>, to override. By
                   12761:             default, it is set to &#8220;<span class=
                   12762:             "quote">libtool */libtool */*/libtool</span>&#8221;. If
                   12763:             this does not match the location of the package's
                   12764:             libtool script(s), set it as appropriate.</p>
1.13      hubertf  12765: 
1.45      wiz      12766:             <p>If you do not need <code xmlns=
                   12767:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12768:             "filename">*.a</code> static libraries built and
                   12769:             installed, then use <code class=
                   12770:             "varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.1       grant    12771: 
1.47      reed     12772:             <p>If your package makes use of the
                   12773:             platform-independent library for loading dynamic shared
                   12774:             objects, that comes with libtool (libltdl), you should
                   12775:             include devel/libltdl/buildlink3.mk.</p>
1.1       grant    12776: 
                   12777:             <p>Some packages use libtool incorrectly so that the
                   12778:             package may not work or build in some circumstances.
                   12779:             Some of the more common errors are:</p>
                   12780: 
                   12781:             <div class="itemizedlist">
                   12782:               <ul type="disc">
                   12783:                 <li>
                   12784:                   <p>The inclusion of a shared object (-module) as
                   12785:                   a dependent library in an executable or library.
                   12786:                   This in itself isn't a problem if one of two
                   12787:                   things has been done:</p>
                   12788: 
                   12789:                   <div class="orderedlist">
                   12790:                     <ol type="1">
                   12791:                       <li>
                   12792:                         <p>The shared object is named correctly,
1.45      wiz      12793:                         i.e. <code xmlns=
                   12794:                         "http://www.w3.org/TR/xhtml1/transitional"
                   12795:                         class="filename">libfoo.la</code>, not
                   12796:                         <code xmlns=
                   12797:                         "http://www.w3.org/TR/xhtml1/transitional"
                   12798:                         class="filename">foo.la</code></p>
1.1       grant    12799:                       </li>
                   12800: 
                   12801:                       <li>
                   12802:                         <p>The -dlopen option is used when linking
                   12803:                         an executable.</p>
                   12804:                       </li>
                   12805:                     </ol>
                   12806:                   </div>
                   12807:                 </li>
                   12808: 
                   12809:                 <li>
                   12810:                   <p>The use of libltdl without the correct calls
                   12811:                   to initialisation routines. The function
                   12812:                   lt_dlinit() should be called and the macro
1.14      xtraeme  12813:                   <code class=
                   12814:                   "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1       grant    12815:                   included in executables.</p>
                   12816:                 </li>
                   12817:               </ul>
                   12818:             </div>
                   12819:           </div>
                   12820: 
1.63    ! dillo    12821:           <div class="sect2" lang="en">
1.1       grant    12822:             <div class="titlepage">
                   12823:               <div>
                   12824:                 <div>
1.63    ! dillo    12825:                   <h3 class="title"><a name=
1.38      dillo    12826:                   "autoconf-automake"></a>15.3.3.&nbsp;GNU
1.1       grant    12827:                   Autoconf/Automake</h3>
                   12828:                 </div>
                   12829:               </div>
                   12830:             </div>
                   12831: 
                   12832:             <p>If a package needs GNU autoconf or automake to be
                   12833:             executed to regenerate the configure script and
                   12834:             Makefile.in makefile templates, then they should be
1.35      jmmv     12835:             executed in a pre-configure target.</p>
1.1       grant    12836: 
                   12837:             <p>For packages that need only autoconf:</p>
                   12838:             <pre class="programlisting">
1.51      rillig   12839:     AUTOCONF_REQD=  2.50            # if default version is not good enough
                   12840:     USE_TOOLS+=     autoconf        # use "autoconf213" for autoconf-2.13
                   12841:     ...
1.1       grant    12842: 
1.51      rillig   12843:     pre-configure:
                   12844:             cd ${WRKSRC}; autoconf
1.1       grant    12845: 
1.51      rillig   12846:     ...
1.1       grant    12847: </pre>
                   12848: 
                   12849:             <p>and for packages that need automake and
                   12850:             autoconf:</p>
                   12851:             <pre class="programlisting">
1.51      rillig   12852:     AUTOMAKE_REQD=  1.7.1           # if default version is not good enough
                   12853:     USE_TOOLS+=     automake        # use "automake14" for automake-1.4
                   12854:     ...
1.1       grant    12855: 
1.51      rillig   12856:     pre-configure:
                   12857:             cd ${WRKSRC};                          \
                   12858:             aclocal; autoheader;                   \
                   12859:             automake -a --foreign -i; autoconf
                   12860: 
                   12861:     ...
1.1       grant    12862: </pre>
                   12863: 
                   12864:             <p>Packages which use GNU Automake will almost
1.35      jmmv     12865:             certainly require GNU Make.</p>
1.1       grant    12866: 
                   12867:             <p>There are times when the configure process makes
                   12868:             additional changes to the generated files, which then
                   12869:             causes the build process to try to re-execute the
                   12870:             automake sequence. This is prevented by touching
                   12871:             various files in the configure stage. If this causes
1.14      xtraeme  12872:             problems with your package you can set <code class=
                   12873:             "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1       grant    12874:             Makefile.</p>
                   12875:           </div>
                   12876:         </div>
                   12877: 
1.63    ! dillo    12878:         <div class="sect1" lang="en">
1.1       grant    12879:           <div class="titlepage">
                   12880:             <div>
                   12881:               <div>
                   12882:                 <h2 class="title" style="clear: both"><a name=
1.55      rillig   12883:                 "fixes-build"></a>15.4.&nbsp;Building the
                   12884:                 package</h2>
1.1       grant    12885:               </div>
                   12886:             </div>
                   12887:           </div>
                   12888: 
1.63    ! dillo    12889:           <div class="sect2" lang="en">
1.1       grant    12890:             <div class="titlepage">
                   12891:               <div>
                   12892:                 <div>
1.63    ! dillo    12893:                   <h3 class="title"><a name=
1.38      dillo    12894:                   "cpp-defines"></a>15.4.1.&nbsp;CPP defines</h3>
1.1       grant    12895:                 </div>
                   12896:               </div>
                   12897:             </div>
                   12898: 
1.55      rillig   12899:             <p>Sometimes you need to compile different code
                   12900:             depending on the target platform. The C preprocessor
                   12901:             has a set of predefined macros that can be queried by
                   12902:             using <code class="varname">#ifdef FOO</code> or
                   12903:             <code class="varname">#if defined(FOO)</code>. Among
                   12904:             these macros are usually ones that describe the target
                   12905:             CPU and operating system. Depending of which of the
                   12906:             macros are defined, you can write code that uses
1.61      rillig   12907:             features unique to a specific platform. Generally you
                   12908:             should rather use the GNU autotools (automake,
                   12909:             autoconf, etc.) to check for specific features (like
                   12910:             the existence of a header file, a function or a
                   12911:             library), but sometimes this is not possible or
                   12912:             desired.</p>
                   12913: 
                   12914:             <p>In that case you can use the predefined macros below
                   12915:             to configure your code to the platform it runs on.
                   12916:             Almost every operating system, hardware architecture
                   12917:             and compiler has its own macro. For example, if the
                   12918:             macros <code class="varname">__GNUC__</code>,
                   12919:             <code class="varname">__i386__</code> and <code class=
1.55      rillig   12920:             "varname">__NetBSD__</code> are all defined, you know
1.61      rillig   12921:             that you are using NetBSD on an i386 compatible CPU,
                   12922:             and your compiler is GCC.</p>
1.55      rillig   12923: 
1.63    ! dillo    12924:             <div class="sect3" lang="en">
1.55      rillig   12925:               <div class="titlepage">
                   12926:                 <div>
                   12927:                   <div>
                   12928:                     <h4 class="title"><a name=
                   12929:                     "fixes-build-cpp-opsys"></a>15.4.1.1.&nbsp;CPP
                   12930:                     defines for operating systems</h4>
                   12931:                   </div>
                   12932:                 </div>
                   12933:               </div>
                   12934: 
                   12935:               <p>To distinguish between 4.4 BSD-derived systems and
                   12936:               the rest of the world, you should use the following
                   12937:               code.</p>
                   12938:               <pre class="programlisting">
1.51      rillig   12939:     #include &lt;sys/param.h&gt;
1.55      rillig   12940:     #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
1.60      rillig   12941:       /* BSD-specific code goes here */
1.55      rillig   12942:     #else
1.60      rillig   12943:       /* non-BSD-specific code goes here */
1.55      rillig   12944:     #endif
1.1       grant    12945: </pre>
                   12946: 
1.55      rillig   12947:               <p>If this distinction is not fine enough, you can
                   12948:               also use the following defines.</p>
                   12949:               <pre class="programlisting">
                   12950:     FreeBSD     __FreeBSD__
1.56      rillig   12951:     DragonFly   __DragonFly__
1.57      minskim  12952:     Interix     __INTERIX
1.55      rillig   12953:     Linux       linux, __linux, __linux__
                   12954:     NetBSD      __NetBSD__
                   12955:     OpenBSD     __OpenBSD__
1.60      rillig   12956:     Solaris     sun, __sun
1.1       grant    12957: </pre>
1.55      rillig   12958:             </div>
1.1       grant    12959: 
1.63    ! dillo    12960:             <div class="sect3" lang="en">
1.55      rillig   12961:               <div class="titlepage">
                   12962:                 <div>
                   12963:                   <div>
1.63    ! dillo    12964:                     <h4 class="title"><a name=
        !          12965:                     "fixes-build-cpp-cpu"></a>15.4.1.2.&nbsp;CPP
1.55      rillig   12966:                     defines for CPUs</h4>
                   12967:                   </div>
                   12968:                 </div>
                   12969:               </div>
                   12970:               <pre class="programlisting">
                   12971:     i386        i386, __i386, __i386__
                   12972:     MIPS        __mips
                   12973:     SPARC       sparc, __sparc
                   12974: </pre>
                   12975:             </div>
                   12976: 
1.63    ! dillo    12977:             <div class="sect3" lang="en">
1.55      rillig   12978:               <div class="titlepage">
                   12979:                 <div>
                   12980:                   <div>
                   12981:                     <h4 class="title"><a name=
                   12982:                     "fixes-build-cpp-compiler"></a>15.4.1.3.&nbsp;CPP
                   12983:                     defines for compilers</h4>
                   12984:                   </div>
                   12985:                 </div>
                   12986:               </div>
                   12987:               <pre class="programlisting">
                   12988:     GCC         __GNUC__ (major version), __GNUC_MINOR__
1.60      rillig   12989:     SunPro      __SUNPRO_C (0x570 for version 5.7)
1.55      rillig   12990: </pre>
                   12991:             </div>
1.1       grant    12992:           </div>
1.51      rillig   12993: 
1.63    ! dillo    12994:           <div class="sect2" lang="en">
1.51      rillig   12995:             <div class="titlepage">
                   12996:               <div>
                   12997:                 <div>
1.63    ! dillo    12998:                   <h3 class="title"><a name=
1.60      rillig   12999:                   "cpp-list-examples"></a>15.4.2.&nbsp;Examples of
                   13000:                   CPP defines for some platforms</h3>
                   13001:                 </div>
                   13002:               </div>
                   13003:             </div>
                   13004: 
                   13005:             <p>The list of the CPP identification macros for
                   13006:             hardware and operating system may depend on the
                   13007:             compiler that is used. The following list contains some
                   13008:             examples that may help you to choose the right ones.
                   13009:             For example, if you want to conditionally compile code
                   13010:             on Solaris, don't use <code class=
                   13011:             "varname">__sun__</code>, as the SunPro compiler does
                   13012:             not define it. Use <code class="varname">__sun</code>
                   13013:             instead.</p>
                   13014: 
                   13015:             <div class="variablelist">
                   13016:               <dl>
1.61      rillig   13017:                 <dt><span class="term">GCC 3.3.3 + SuSE Linux 9.1 +
                   13018:                 i386</span></dt>
                   13019: 
                   13020:                 <dd>
1.62      rillig   13021:                   <p>__ELF__, __gnu_linux__, __i386, __i386__,
1.61      rillig   13022:                   __linux, __linux__, __unix, __unix__, i386,
                   13023:                   linux, unix.</p>
                   13024:                 </dd>
                   13025: 
                   13026:                 <dt><span class="term">GCC 2.95 + NetBSD 1.6.2 +
                   13027:                 i386</span></dt>
                   13028: 
                   13029:                 <dd>
1.62      rillig   13030:                   <p>__ELF__, __NetBSD__, __i386, __i386__,
1.61      rillig   13031:                   i386.</p>
                   13032:                 </dd>
                   13033: 
                   13034:                 <dt><span class="term">GCC 3.3.3 + NetBSD 2.0 +
                   13035:                 i386</span></dt>
1.60      rillig   13036: 
                   13037:                 <dd>
1.62      rillig   13038:                   <p>__ELF__, __NetBSD__, __i386, __i386__,
1.61      rillig   13039:                   i386.</p>
1.60      rillig   13040:                 </dd>
                   13041: 
                   13042:                 <dt><span class="term">GCC 4 + Solaris 8 +
                   13043:                 SPARC</span></dt>
                   13044: 
                   13045:                 <dd>
                   13046:                   <p>__ELF__, __sparc, __sparc__, __sun, __sun__,
                   13047:                   __SVR4, __svr4__, __unix, __unix__, sparc, sun,
                   13048:                   unix.</p>
                   13049:                 </dd>
1.61      rillig   13050: 
                   13051:                 <dt><span class="term">SunPro 5.7 + Solaris 8 +
                   13052:                 SPARC</span></dt>
                   13053: 
                   13054:                 <dd>
                   13055:                   <p>__SVR4, __sparc, __sun, __unix, sparc, sun,
                   13056:                   unix.</p>
                   13057:                 </dd>
1.60      rillig   13058:               </dl>
                   13059:             </div>
                   13060:           </div>
                   13061: 
1.63    ! dillo    13062:           <div class="sect2" lang="en">
1.60      rillig   13063:             <div class="titlepage">
                   13064:               <div>
                   13065:                 <div>
1.63    ! dillo    13066:                   <h3 class="title"><a name=
1.60      rillig   13067:                   "cpp-list"></a>15.4.3.&nbsp;Getting a list of CPP
1.51      rillig   13068:                   defines</h3>
                   13069:                 </div>
                   13070:               </div>
                   13071:             </div>
                   13072: 
1.60      rillig   13073:             <p>If your system uses the GNU C Compiler, you can get
                   13074:             a list of symbols that are defined by default, e.g. to
                   13075:             identify the platform, with the following command:</p>
1.51      rillig   13076:             <pre class="programlisting">
                   13077:     gcc -E -dM - &lt; /dev/null 
                   13078: </pre>
1.60      rillig   13079: 
                   13080:             <p>On other systems you may get the list by using the
                   13081:             system's syscall trace utility (ktrace, truss, strace)
                   13082:             to have a look which arguments are passed to the actual
                   13083:             compiler.</p>
1.51      rillig   13084:           </div>
1.1       grant    13085:         </div>
                   13086: 
1.63    ! dillo    13087:         <div class="sect1" lang="en">
1.1       grant    13088:           <div class="titlepage">
                   13089:             <div>
                   13090:               <div>
                   13091:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    13092:                 "package-specific-actions"></a>15.5.&nbsp;Package
1.1       grant    13093:                 specific actions</h2>
                   13094:               </div>
                   13095:             </div>
                   13096:           </div>
                   13097: 
1.63    ! dillo    13098:           <div class="sect2" lang="en">
1.1       grant    13099:             <div class="titlepage">
                   13100:               <div>
                   13101:                 <div>
1.63    ! dillo    13102:                   <h3 class="title"><a name=
1.38      dillo    13103:                   "user-interaction"></a>15.5.1.&nbsp;User
1.2       hubertf  13104:                   interaction</h3>
1.1       grant    13105:                 </div>
                   13106:               </div>
                   13107:             </div>
                   13108: 
                   13109:             <p>Occasionally, packages require interaction from the
                   13110:             user, and this can be in a number of ways:</p>
                   13111: 
                   13112:             <div class="itemizedlist">
                   13113:               <ul type="disc">
                   13114:                 <li>
                   13115:                   <p>help in fetching the distfiles</p>
                   13116:                 </li>
                   13117: 
                   13118:                 <li>
                   13119:                   <p>help to configure the package before it is
                   13120:                   built</p>
                   13121:                 </li>
                   13122: 
                   13123:                 <li>
                   13124:                   <p>help during the build process</p>
                   13125:                 </li>
                   13126: 
                   13127:                 <li>
                   13128:                   <p>help during the installation of a package</p>
                   13129:                 </li>
                   13130:               </ul>
                   13131:             </div>
                   13132: 
1.14      xtraeme  13133:             <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1       grant    13134:             definition is provided to notify the pkgsrc mechanism
                   13135:             of an interactive stage which will be needed, and this
1.45      wiz      13136:             should be set in the package's <code xmlns=
                   13137:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     13138:             "filename">Makefile</code>, e.g.:</p>
1.1       grant    13139:             <pre class="programlisting">
1.51      rillig   13140:     INTERACTIVE_STAGE=      build
1.1       grant    13141: </pre>
                   13142: 
                   13143:             <p>Multiple interactive stages can be specified:</p>
                   13144:             <pre class="programlisting">
1.51      rillig   13145:     INTERACTIVE_STAGE=      configure install
1.1       grant    13146: </pre>
                   13147:           </div>
                   13148: 
1.63    ! dillo    13149:           <div class="sect2" lang="en">
1.1       grant    13150:             <div class="titlepage">
                   13151:               <div>
                   13152:                 <div>
1.63    ! dillo    13153:                   <h3 class="title"><a name=
1.38      dillo    13154:                   "handling-licenses"></a>15.5.2.&nbsp;Handling
1.1       grant    13155:                   licenses</h3>
                   13156:                 </div>
                   13157:               </div>
                   13158:             </div>
                   13159: 
1.44      gdt      13160:             <p>A package may be covered by a license which the user
                   13161:             has or has not agreed to accept. For these cases,
                   13162:             pkgsrc contains a mechanism to note that a package is
                   13163:             covered by a particular license, and the package cannot
                   13164:             be built unless the user has accepted the license.
                   13165:             (Installation of binary packages are not currently
                   13166:             subject to this mechanism.) Packages with licenses that
                   13167:             are either Open Source according to the Open Source
                   13168:             Initiative or Free according to the Free Software
                   13169:             Foundation will not be marked with a license tag.
                   13170:             Packages with licenses that have not been determined to
                   13171:             meet either definition will be marked with a license
                   13172:             tag referring to the license. This will prevent
                   13173:             building unless pkgsrc is informed that the license is
                   13174:             acceptable, and enables displaying the license.</p>
                   13175: 
                   13176:             <p>The license tag mechanism is intended to address
                   13177:             copyright-related issues surrounding building,
                   13178:             installing and using a package, and not to address
                   13179:             redistribution issues (see <code class=
                   13180:             "varname">RESTRICTED</code> and <code class=
                   13181:             "varname">NO_SRC_ON_FTP</code>, etc.). However, the
                   13182:             above definition of licenses for which tags are not
                   13183:             needed implies that packages with redistribution
                   13184:             restrictions should have tags.</p>
                   13185: 
                   13186:             <p>Denoting that a package is covered by a particular
1.45      wiz      13187:             license is done by placing the license in <code xmlns=
                   13188:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.44      gdt      13189:             "filename">pkgsrc/licenses</code> and setting the
                   13190:             <code class="varname">LICENSE</code> variable to a
                   13191:             string identifying the license, e.g. in <a xmlns=
1.14      xtraeme  13192:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.44      gdt      13193:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/xv/README.html"
1.45      wiz      13194:             target="_top"><code xmlns="" class=
                   13195:             "filename">graphics/xv</code></a>:</p>
1.1       grant    13196:             <pre class="programlisting">
1.51      rillig   13197:     LICENSE=        xv-license
1.1       grant    13198: </pre>
                   13199: 
                   13200:             <p>When trying to build, the user will get a notice
1.44      gdt      13201:             that the package is covered by a license which has not
                   13202:             been accepted:</p>
1.1       grant    13203:             <pre class="programlisting">
1.51      rillig   13204:     <code class="prompt">%</code> <strong class=
1.14      xtraeme  13205: "userinput"><code>make</code></strong>
1.51      rillig   13206:     ===&gt; xv-3.10anb9 has an unacceptable license: xv-license.
                   13207:     ===&gt;     To view the license, enter "/usr/bin/make show-license".
                   13208:     ===&gt;     To indicate acceptance, add this line to your /etc/mk.conf:
                   13209:     ===&gt;     ACCEPTABLE_LICENSES+=xv-license
                   13210:     *** Error code 1
1.1       grant    13211: </pre>
                   13212: 
1.14      xtraeme  13213:             <p>The license can be viewed with <span><strong class=
                   13214:             "command">make show-license</strong></span>, and if it
                   13215:             is considered appropriate, the line printed above can
1.45      wiz      13216:             be added to <code xmlns=
                   13217:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13218:             "filename">/etc/mk.conf</code> to indicate acceptance
                   13219:             of the particular license:</p>
1.1       grant    13220:             <pre class="programlisting">
1.51      rillig   13221:     ACCEPTABLE_LICENSES+=xv-license
1.1       grant    13222: </pre>
                   13223: 
                   13224:             <p>When adding a package with a new license, the
1.45      wiz      13225:             license text should be added to <code xmlns=
                   13226:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13227:             "filename">pkgsrc/licenses</code> for displaying. A
                   13228:             list of known licenses can be seen in this directory as
                   13229:             well as by looking at the list of (commented out)
                   13230:             <code class="varname">ACCEPTABLE_LICENSES</code>
1.45      wiz      13231:             variable settings in <code xmlns=
                   13232:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13233:             "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1       grant    13234: 
1.44      gdt      13235:             <p>The use of <code class=
                   13236:             "varname">LICENSE=shareware</code>, <code class=
                   13237:             "varname">LICENSE=no-commercial-use</code>, and similar
                   13238:             language is deprecated because it does not crisply
                   13239:             refer to a particular license text. Another problem
                   13240:             with such usage is that it does not enable a user to
                   13241:             denote acceptance of the license for a single package
                   13242:             without accepting the same license text for another
                   13243:             package. In particular, this can be inappropriate when
                   13244:             e.g. one accepts a particular license to indicate to
                   13245:             pkgsrc that a fee has been paid.</p>
1.1       grant    13246:           </div>
                   13247: 
1.63    ! dillo    13248:           <div class="sect2" lang="en">
1.1       grant    13249:             <div class="titlepage">
                   13250:               <div>
                   13251:                 <div>
1.30      wiz      13252:                   <h3 class="title"><a name=
1.38      dillo    13253:                   "installing-score-files"></a>15.5.3.&nbsp;Installing
1.30      wiz      13254:                   score files</h3>
1.1       grant    13255:                 </div>
                   13256:               </div>
                   13257:             </div>
                   13258: 
                   13259:             <p>Certain packages, most of them in the games
                   13260:             category, install a score file that allows all users on
                   13261:             the system to record their highscores. In order for
                   13262:             this to work, the binaries need to be installed setgid
                   13263:             and the score files owned by the appropriate group
                   13264:             and/or owner (traditionally the "games" user/group).
                   13265:             The following variables, documented in more detail in
1.45      wiz      13266:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13267:             class="filename">mk/defaults/mk.conf</code>, control
                   13268:             this behaviour: <code class=
1.14      xtraeme  13269:             "varname">SETGIDGAME</code>, <code class=
                   13270:             "varname">GAMEDATAMODE</code>, <code class=
                   13271:             "varname">GAMEGRP</code>, <code class=
                   13272:             "varname">GAMEMODE</code>, <code class=
                   13273:             "varname">GAMEOWN</code>.</p>
1.1       grant    13274: 
                   13275:             <p>Note that per default, setgid installation of games
1.14      xtraeme  13276:             is disabled; setting <code class=
                   13277:             "varname">SETGIDGAME=YES</code> will set all the other
1.1       grant    13278:             variables accordingly.</p>
                   13279: 
                   13280:             <p>A package should therefor never hard code file
1.14      xtraeme  13281:             ownership or access permissions but rely on
                   13282:             <code class="varname">INSTALL_GAME</code> and
                   13283:             <code class="varname">INSTALL_GAME_DATA</code> to set
                   13284:             these correctly.</p>
1.1       grant    13285:           </div>
                   13286: 
1.63    ! dillo    13287:           <div class="sect2" lang="en">
1.1       grant    13288:             <div class="titlepage">
                   13289:               <div>
                   13290:                 <div>
1.63    ! dillo    13291:                   <h3 class="title"><a name=
1.38      dillo    13292:                   "perl-scripts"></a>15.5.4.&nbsp;Packages
1.30      wiz      13293:                   containing perl scripts</h3>
1.1       grant    13294:                 </div>
                   13295:               </div>
                   13296:             </div>
                   13297: 
                   13298:             <p>If your package contains interpreted perl scripts,
1.14      xtraeme  13299:             set <code class="varname">REPLACE_PERL</code> to ensure
                   13300:             that the proper interpreter path is set. <code class=
                   13301:             "varname">REPLACE_PERL</code> should contain a list of
                   13302:             scripts, relative to <code class=
                   13303:             "varname">WRKSRC</code>, that you want adjusted.</p>
1.1       grant    13304:           </div>
                   13305: 
1.63    ! dillo    13306:           <div class="sect2" lang="en">
1.1       grant    13307:             <div class="titlepage">
                   13308:               <div>
                   13309:                 <div>
1.63    ! dillo    13310:                   <h3 class="title"><a name=
1.38      dillo    13311:                   "hardcoded-paths"></a>15.5.5.&nbsp;Packages with
1.1       grant    13312:                   hardcoded paths to other interpreters</h3>
                   13313:                 </div>
                   13314:               </div>
                   13315:             </div>
                   13316: 
                   13317:             <p>Your package may also contain scripts with hardcoded
                   13318:             paths to other interpreters besides (or as well as)
                   13319:             perl. To correct the full pathname to the script
                   13320:             interpreter, you need to set the following definitions
1.45      wiz      13321:             in your <code xmlns=
                   13322:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13323:             "filename">Makefile</code> (we shall use
                   13324:             <span><strong class="command">tclsh</strong></span> in
                   13325:             this example):</p>
1.1       grant    13326:             <pre class="programlisting">
1.51      rillig   13327:     REPLACE_INTERPRETER+=   tcl
                   13328:     _REPLACE.tcl.old=       .*/bin/tclsh
                   13329:     _REPLACE.tcl.new=       ${PREFIX}/bin/tclsh
                   13330:     _REPLACE_FILES.tcl=     # list of tcl scripts which need to be fixed,
                   13331:                             # relative to ${WRKSRC}, just as in REPLACE_PERL
1.1       grant    13332: </pre>
                   13333:           </div>
                   13334: 
1.63    ! dillo    13335:           <div class="sect2" lang="en">
1.1       grant    13336:             <div class="titlepage">
                   13337:               <div>
                   13338:                 <div>
1.63    ! dillo    13339:                   <h3 class="title"><a name=
1.38      dillo    13340:                   "perl-modules"></a>15.5.6.&nbsp;Packages
1.30      wiz      13341:                   installing perl modules</h3>
1.1       grant    13342:                 </div>
                   13343:               </div>
                   13344:             </div>
                   13345: 
                   13346:             <p>Makefiles of packages providing perl5 modules should
1.45      wiz      13347:             include the Makefile fragment <code xmlns=
                   13348:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13349:             "filename">../../lang/perl5/module.mk</code>. It
                   13350:             provides a <span><strong class=
                   13351:             "command">do-configure</strong></span> target for the
                   13352:             standard perl configuration for such modules as well as
                   13353:             various hooks to tune this configuration. See comments
                   13354:             in this file for details.</p>
1.1       grant    13355: 
                   13356:             <p>Perl5 modules will install into different places
                   13357:             depending on the version of perl used during the build
                   13358:             process. To address this, pkgsrc will append lines to
1.45      wiz      13359:             the <code xmlns=
                   13360:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13361:             "filename">PLIST</code> corresponding to the files
                   13362:             listed in the installed <code xmlns=
                   13363:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13364:             "filename">.packlist</code> file generated by most
                   13365:             perl5 modules. This is invoked by defining <code class=
                   13366:             "varname">PERL5_PACKLIST</code> to a space-separated
                   13367:             list of paths to packlist files, e.g.:</p>
1.1       grant    13368:             <pre class="programlisting">
1.51      rillig   13369:     PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
1.1       grant    13370: </pre>
                   13371: 
1.14      xtraeme  13372:             <p>The variables <code class=
                   13373:             "varname">PERL5_SITELIB</code>, <code class=
                   13374:             "varname">PERL5_SITEARCH</code>, and <code class=
                   13375:             "varname">PERL5_ARCHLIB</code> represent the three
1.1       grant    13376:             locations in which perl5 modules may be installed, and
                   13377:             may be used by perl5 packages that don't have a
                   13378:             packlist. These three variables are also substituted
1.45      wiz      13379:             for in the <code xmlns=
                   13380:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13381:             "filename">PLIST</code>.</p>
1.1       grant    13382:           </div>
                   13383: 
1.63    ! dillo    13384:           <div class="sect2" lang="en">
1.1       grant    13385:             <div class="titlepage">
                   13386:               <div>
                   13387:                 <div>
1.63    ! dillo    13388:                   <h3 class="title"><a name=
1.38      dillo    13389:                   "faq.info-files"></a>15.5.7.&nbsp;Packages
1.1       grant    13390:                   installing info files</h3>
                   13391:                 </div>
                   13392:               </div>
                   13393:             </div>
                   13394: 
                   13395:             <p>Some packages install info files or use the
                   13396:             &#8220;<span class="quote">makeinfo</span>&#8221; or
                   13397:             &#8220;<span class="quote">install-info</span>&#8221;
                   13398:             commands. Each of the info files:</p>
                   13399: 
                   13400:             <div class="itemizedlist">
                   13401:               <ul type="disc">
                   13402:                 <li>
                   13403:                   <p>is considered to be installed in the directory
1.45      wiz      13404:                   <code xmlns=
                   13405:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13406:                   "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1       grant    13407:                 </li>
                   13408: 
                   13409:                 <li>
                   13410:                   <p>is registered in the Info directory file
1.45      wiz      13411:                   <code xmlns=
                   13412:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13413:                   "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1       grant    13414:                 </li>
                   13415: 
                   13416:                 <li>
                   13417:                   <p>and must be listed as a filename in the
1.14      xtraeme  13418:                   <code class="varname">INFO_FILES</code> variable
                   13419:                   in the package Makefile.</p>
1.1       grant    13420:                 </li>
                   13421:               </ul>
                   13422:             </div>
                   13423: 
1.14      xtraeme  13424:             <p><code class="varname">INFO_DIR</code> defaults to
1.1       grant    13425:             &#8220;<span class="quote">info</span>&#8221; and can
1.45      wiz      13426:             be overridden in the package Makefile. <code xmlns=
                   13427:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13428:             "filename">INSTALL</code> and <code xmlns=
                   13429:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13430:             "filename">DEINSTALL</code> scripts will be generated
                   13431:             to handle registration of the info files in the Info
1.1       grant    13432:             directory file. The &#8220;<span class=
                   13433:             "quote">install-info</span>&#8221; command used for the
                   13434:             info files registration is either provided by the
                   13435:             system, or by a special purpose package automatically
                   13436:             added as dependency if needed.</p>
                   13437: 
                   13438:             <p>A package which needs the &#8220;<span class=
                   13439:             "quote">makeinfo</span>&#8221; command at build time
1.14      xtraeme  13440:             must define the variable <code class=
                   13441:             "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1       grant    13442:             minimum version of the &#8220;<span class=
                   13443:             "quote">makeinfo</span>&#8221; command is needed it
1.14      xtraeme  13444:             should be noted with the <code class=
                   13445:             "varname">TEXINFO_REQD</code> variable in the package
1.45      wiz      13446:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13447:             class="filename">Makefile</code>. By default, a minimum
                   13448:             version of 3.12 is required. If the system does not
                   13449:             provide a <span><strong class=
1.14      xtraeme  13450:             "command">makeinfo</strong></span> command or if it
                   13451:             does not match the required minimum, a build dependency
                   13452:             on the <a xmlns=
                   13453:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    13454:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.45      wiz      13455:             target="_top"><code xmlns="" class=
                   13456:             "filename">devel/gtexinfo</code></a> package will be
1.20      ben      13457:             added automatically.</p>
1.1       grant    13458: 
                   13459:             <p>The build and installation process of the software
                   13460:             provided by the package should not use the
1.14      xtraeme  13461:             <span><strong class=
                   13462:             "command">install-info</strong></span> command as the
                   13463:             registration of info files is the task of the package
1.45      wiz      13464:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13465:             class="filename">INSTALL</code> script, and it must use
                   13466:             the appropriate <span><strong class=
1.14      xtraeme  13467:             "command">makeinfo</strong></span> command.</p>
1.1       grant    13468: 
1.47      reed     13469:             <p>To achieve this goal, the pkgsrc infrastructure
1.14      xtraeme  13470:             creates overriding scripts for the <span><strong class=
                   13471:             "command">install-info</strong></span> and
                   13472:             <span><strong class="command">makeinfo</strong></span>
                   13473:             commands in a directory listed early in <code class=
                   13474:             "varname">PATH</code>.</p>
1.1       grant    13475: 
1.14      xtraeme  13476:             <p>The script overriding <span><strong class=
                   13477:             "command">install-info</strong></span> has no effect
                   13478:             except the logging of a message. The script overriding
                   13479:             <span><strong class="command">makeinfo</strong></span>
                   13480:             logs a message and according to the value of
                   13481:             <code class="varname">USE_MAKEINFO</code> and
                   13482:             <code class="varname">TEXINFO_REQD</code> either run
                   13483:             the appropriate <span><strong class=
                   13484:             "command">makeinfo</strong></span> command or exit on
                   13485:             error.</p>
1.1       grant    13486:           </div>
                   13487: 
1.63    ! dillo    13488:           <div class="sect2" lang="en">
1.57      minskim  13489:             <div class="titlepage">
                   13490:               <div>
                   13491:                 <div>
1.63    ! dillo    13492:                   <h3 class="title"><a name=
1.57      minskim  13493:                   "manpages"></a>15.5.8.&nbsp;Packages installing
                   13494:                   man pages</h3>
                   13495:                 </div>
                   13496:               </div>
                   13497:             </div>
                   13498: 
                   13499:             <p>Many packages install manual pages. The man pages
                   13500:             are installed under <code class=
                   13501:             "varname">${PREFIX}/${PKGMANDIR}</code> which is
                   13502:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13503:             class="filename">/usr/pkg/man</code> by default.
                   13504:             <code class="varname">PKGMANDIR</code> defaults to
                   13505:             &#8220;<span class="quote">man</span>&#8221;. For
                   13506:             example, you can set <code class=
                   13507:             "varname">PKGMANDIR</code> to &#8220;<span class=
                   13508:             "quote">share/man</span>&#8221; to have man pages
                   13509:             install under <code xmlns=
                   13510:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13511:             "filename">/usr/pkg/share/man/</code> by default.</p>
                   13512: 
                   13513:             <div class="note" style=
                   13514:             "margin-left: 0.5in; margin-right: 0.5in;">
                   13515:               <h3 class="title">Note</h3>
                   13516: 
                   13517:               <p>The support for a custom <code class=
                   13518:               "varname">PKGMANDIR</code> is not complete.</p>
                   13519:             </div>
                   13520: 
                   13521:             <p>The <code xmlns=
                   13522:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13523:             "filename">PLIST</code> files can just use <code xmlns=
                   13524:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13525:             "filename">man/</code> as the top level directory for
                   13526:             the man page file entries and the pkgsrc framework will
                   13527:             convert as needed.</p>
                   13528: 
                   13529:             <p>Packages that are configured with <code class=
                   13530:             "varname">GNU_CONFIGURE</code> set as
                   13531:             &#8220;<span class="quote">yes</span>&#8221;, by
                   13532:             default will use the <code xmlns=
                   13533:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13534:             "filename">./configure</code> --mandir switch to set
                   13535:             where the man pages should be installed. The path is
                   13536:             <code class="varname">GNU_CONFIGURE_MANDIR</code> which
                   13537:             defaults to <code class=
                   13538:             "varname">${PREFIX}/${PKGMANDIR}</code>.</p>
                   13539: 
                   13540:             <p>Packages that use <code class=
                   13541:             "varname">GNU_CONFIGURE</code> but do not use --mandir,
                   13542:             can set <code class=
                   13543:             "varname">CONFIGURE_HAS_MANDIR</code> to
                   13544:             &#8220;<span class="quote">no</span>&#8221;. Or if the
                   13545:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13546:             class="filename">./configure</code> script uses a
                   13547:             non-standard use of --mandir, you can set <code class=
                   13548:             "varname">GNU_CONFIGURE_MANDIR</code> as needed.</p>
                   13549: 
                   13550:             <p>See <a href="#manpage-compression" title=
                   13551:             "10.5.&nbsp;Man page compression">Section&nbsp;10.5,
                   13552:             &#8220;Man page compression&#8221;</a> for information
                   13553:             on installation of compressed manual pages.</p>
                   13554:           </div>
                   13555: 
1.63    ! dillo    13556:           <div class="sect2" lang="en">
1.1       grant    13557:             <div class="titlepage">
                   13558:               <div>
                   13559:                 <div>
1.63    ! dillo    13560:                   <h3 class="title"><a name=
1.57      minskim  13561:                   "gconf2-data-files"></a>15.5.9.&nbsp;Packages
1.30      wiz      13562:                   installing GConf2 data files</h3>
1.1       grant    13563:                 </div>
                   13564:               </div>
                   13565:             </div>
                   13566: 
1.45      wiz      13567:             <p>If a package installs <code xmlns=
                   13568:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13569:             "filename">.schemas</code> or <code xmlns=
                   13570:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13571:             "filename">.entries</code> files, used by GConf2, you
1.1       grant    13572:             need to take some extra steps to make sure they get
                   13573:             registered in the database:</p>
                   13574: 
                   13575:             <div class="orderedlist">
                   13576:               <ol type="1">
                   13577:                 <li>
1.45      wiz      13578:                   <p>Include <code xmlns=
                   13579:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13580:                   "filename">../../devel/GConf2/schemas.mk</code>
1.45      wiz      13581:                   instead of its <code xmlns=
                   13582:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13583:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    13584:                   care of rebuilding the GConf2 database at
                   13585:                   installation and deinstallation time, and tells
                   13586:                   the package where to install GConf2 data files
                   13587:                   using some standard configure arguments. It also
                   13588:                   disallows any access to the database directly
                   13589:                   from the package.</p>
                   13590:                 </li>
                   13591: 
                   13592:                 <li>
                   13593:                   <p>Ensure that the package installs its
1.45      wiz      13594:                   <code xmlns=
                   13595:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13596:                   "filename">.schemas</code> files under
                   13597:                   <code xmlns=
                   13598:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13599:                   "filename">${PREFIX}/share/gconf/schemas</code>.
1.45      wiz      13600:                   If they get installed under <code xmlns=
                   13601:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13602:                   "filename">${PREFIX}/etc</code>, you will need to
1.1       grant    13603:                   manually patch the package.</p>
                   13604:                 </li>
                   13605: 
                   13606:                 <li>
                   13607:                   <p>Check the PLIST and remove any entries under
                   13608:                   the etc/gconf directory, as they will be handled
                   13609:                   automatically. See <a href="#faq.conf" title=
1.38      dillo    13610:                   "7.14.&nbsp;How do I change the location of configuration files?">
                   13611:                   Section&nbsp;7.14, &#8220;How do I change the
1.35      jmmv     13612:                   location of configuration files?&#8221;</a> for
                   13613:                   more information.</p>
1.1       grant    13614:                 </li>
                   13615: 
                   13616:                 <li>
1.14      xtraeme  13617:                   <p>Define the <code class=
                   13618:                   "varname">GCONF2_SCHEMAS</code> variable in your
1.45      wiz      13619:                   <code xmlns=
                   13620:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13621:                   "filename">Makefile</code> with a list of all
                   13622:                   <code xmlns=
                   13623:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13624:                   "filename">.schemas</code> files installed by the
                   13625:                   package, if any. Names must not contain any
                   13626:                   directories in them.</p>
1.1       grant    13627:                 </li>
                   13628: 
                   13629:                 <li>
1.14      xtraeme  13630:                   <p>Define the <code class=
                   13631:                   "varname">GCONF2_ENTRIES</code> variable in your
1.45      wiz      13632:                   <code xmlns=
                   13633:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13634:                   "filename">Makefile</code> with a list of all
                   13635:                   <code xmlns=
                   13636:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13637:                   "filename">.entries</code> files installed by the
                   13638:                   package, if any. Names must not contain any
                   13639:                   directories in them.</p>
1.1       grant    13640:                 </li>
                   13641:               </ol>
                   13642:             </div>
                   13643:           </div>
                   13644: 
1.63    ! dillo    13645:           <div class="sect2" lang="en">
1.1       grant    13646:             <div class="titlepage">
                   13647:               <div>
                   13648:                 <div>
1.30      wiz      13649:                   <h3 class="title"><a name=
1.57      minskim  13650:                   "scrollkeeper-data-files"></a>15.5.10.&nbsp;Packages
1.30      wiz      13651:                   installing scrollkeeper data files</h3>
1.1       grant    13652:                 </div>
                   13653:               </div>
                   13654:             </div>
                   13655: 
1.45      wiz      13656:             <p>If a package installs <code xmlns=
                   13657:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13658:             "filename">.omf</code> files, used by scrollkeeper, you
                   13659:             need to take some extra steps to make sure they get
                   13660:             registered in the database:</p>
1.1       grant    13661: 
                   13662:             <div class="orderedlist">
                   13663:               <ol type="1">
                   13664:                 <li>
1.45      wiz      13665:                   <p>Include <code xmlns=
                   13666:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13667:                   "filename">../../textproc/scrollkeeper/omf.mk</code>
1.45      wiz      13668:                   instead of its <code xmlns=
                   13669:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13670:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    13671:                   care of rebuilding the scrollkeeper database at
                   13672:                   installation and deinstallation time, and
                   13673:                   disallows any access to it directly from the
                   13674:                   package.</p>
                   13675:                 </li>
                   13676: 
                   13677:                 <li>
                   13678:                   <p>Check the PLIST and remove any entries under
1.45      wiz      13679:                   the <code xmlns=
                   13680:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13681:                   "filename">libdata/scrollkeeper</code> directory,
1.1       grant    13682:                   as they will be handled automatically.</p>
                   13683:                 </li>
                   13684: 
                   13685:                 <li>
1.45      wiz      13686:                   <p>Remove the <code xmlns=
                   13687:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13688:                   "filename">share/omf</code> directory from the
                   13689:                   PLIST. It will be handled by scrollkeeper.</p>
1.1       grant    13690:                 </li>
                   13691:               </ol>
                   13692:             </div>
                   13693:           </div>
                   13694: 
1.63    ! dillo    13695:           <div class="sect2" lang="en">
1.1       grant    13696:             <div class="titlepage">
                   13697:               <div>
                   13698:                 <div>
1.63    ! dillo    13699:                   <h3 class="title"><a name=
1.57      minskim  13700:                   "x11-fonts"></a>15.5.11.&nbsp;Packages installing
1.1       grant    13701:                   X11 fonts</h3>
                   13702:                 </div>
                   13703:               </div>
                   13704:             </div>
                   13705: 
                   13706:             <p>If a package installs font files, you will need to
                   13707:             rebuild the fonts database in the directory where they
                   13708:             get installed at installation and deinstallation time.
1.45      wiz      13709:             This can be automatically done by using <code xmlns=
                   13710:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13711:             "filename">mk/fonts.mk</code>, which you need to
1.45      wiz      13712:             include in your <code xmlns=
                   13713:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13714:             "filename">Makefile</code>.</p>
1.1       grant    13715: 
                   13716:             <p>When the file is included, you can list the
1.14      xtraeme  13717:             directories where fonts are installed in the
                   13718:             <code class="varname">FONTS_<em class=
                   13719:             "replaceable"><code>type</code></em>_DIRS</code>
                   13720:             variables, where <em class=
                   13721:             "replaceable"><code>type</code></em> can be one of
                   13722:             &#8220;<span class="quote">TTF</span>&#8221;,
1.1       grant    13723:             &#8220;<span class="quote">TYPE1</span>&#8221; or
                   13724:             &#8220;<span class="quote">X11</span>&#8221;. Also make
1.45      wiz      13725:             sure that the database file <code xmlns=
                   13726:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13727:             "filename">fonts.dir</code> is not listed in the
1.1       grant    13728:             PLIST.</p>
                   13729: 
                   13730:             <p>Note that you should not create new directories for
                   13731:             fonts; instead use the standard ones to avoid that the
                   13732:             user needs to manually configure his X server to find
                   13733:             them.</p>
                   13734:           </div>
                   13735: 
1.63    ! dillo    13736:           <div class="sect2" lang="en">
1.1       grant    13737:             <div class="titlepage">
                   13738:               <div>
                   13739:                 <div>
1.63    ! dillo    13740:                   <h3 class="title"><a name=
1.57      minskim  13741:                   "gtk2-modules"></a>15.5.12.&nbsp;Packages
1.30      wiz      13742:                   installing GTK2 modules</h3>
1.1       grant    13743:                 </div>
                   13744:               </div>
                   13745:             </div>
                   13746: 
1.47      reed     13747:             <p>If a package installs GTK2 immodules or loaders, you
1.1       grant    13748:             need to take some extra steps to get them registered in
                   13749:             the GTK2 database properly:</p>
                   13750: 
                   13751:             <div class="orderedlist">
                   13752:               <ol type="1">
                   13753:                 <li>
1.45      wiz      13754:                   <p>Include <code xmlns=
                   13755:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13756:                   "filename">../../x11/gtk2/modules.mk</code>
1.45      wiz      13757:                   instead of its <code xmlns=
                   13758:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13759:                   "filename">buildlink3.mk</code> file. This takes
                   13760:                   care of rebuilding the database at installation
                   13761:                   and deinstallation time.</p>
1.1       grant    13762:                 </li>
                   13763: 
                   13764:                 <li>
1.14      xtraeme  13765:                   <p>Set <code class=
                   13766:                   "varname">GTK2_IMMODULES=YES</code> if your
                   13767:                   package installs GTK2 immodules.</p>
1.1       grant    13768:                 </li>
                   13769: 
                   13770:                 <li>
1.14      xtraeme  13771:                   <p>Set <code class=
                   13772:                   "varname">GTK2_LOADERS=YES</code> if your package
                   13773:                   installs GTK2 loaders.</p>
1.1       grant    13774:                 </li>
                   13775: 
                   13776:                 <li>
1.47      reed     13777:                   <p>Patch the package to not touch any of the GTK2
1.1       grant    13778:                   databases directly. These are:</p>
                   13779: 
                   13780:                   <div class="itemizedlist">
                   13781:                     <ul type="disc">
                   13782:                       <li>
1.45      wiz      13783:                         <p><code xmlns=
                   13784:                         "http://www.w3.org/TR/xhtml1/transitional"
                   13785:                         class=
1.14      xtraeme  13786:                         "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1       grant    13787:                       </li>
                   13788: 
                   13789:                       <li>
1.45      wiz      13790:                         <p><code xmlns=
                   13791:                         "http://www.w3.org/TR/xhtml1/transitional"
                   13792:                         class=
1.14      xtraeme  13793:                         "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1       grant    13794:                       </li>
                   13795:                     </ul>
                   13796:                   </div>
                   13797:                 </li>
                   13798: 
                   13799:                 <li>
                   13800:                   <p>Check the PLIST and remove any entries under
1.45      wiz      13801:                   the <code xmlns=
                   13802:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13803:                   "filename">libdata/gtk-2.0</code> directory, as
                   13804:                   they will be handled automatically.</p>
1.1       grant    13805:                 </li>
                   13806:               </ol>
                   13807:             </div>
                   13808:           </div>
                   13809: 
1.63    ! dillo    13810:           <div class="sect2" lang="en">
1.1       grant    13811:             <div class="titlepage">
                   13812:               <div>
                   13813:                 <div>
1.63    ! dillo    13814:                   <h3 class="title"><a name=
1.57      minskim  13815:                   "sgml-xml-data"></a>15.5.13.&nbsp;Packages
1.30      wiz      13816:                   installing SGML or XML data</h3>
1.1       grant    13817:                 </div>
                   13818:               </div>
                   13819:             </div>
                   13820: 
                   13821:             <p>If a package installs SGML or XML data files that
                   13822:             need to be registered in system-wide catalogs (like
                   13823:             DTDs, sub-catalogs, etc.), you need to take some extra
                   13824:             steps:</p>
                   13825: 
                   13826:             <div class="orderedlist">
                   13827:               <ol type="1">
                   13828:                 <li>
1.45      wiz      13829:                   <p>Include <code xmlns=
                   13830:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13831:                   "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
1.45      wiz      13832:                   in your <code xmlns=
                   13833:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13834:                   "filename">Makefile</code>, which takes care of
                   13835:                   registering those files in system-wide catalogs
                   13836:                   at installation and deinstallation time.</p>
1.1       grant    13837:                 </li>
                   13838: 
                   13839:                 <li>
1.14      xtraeme  13840:                   <p>Set <code class="varname">SGML_CATALOGS</code>
                   13841:                   to the full path of any SGML catalogs installed
                   13842:                   by the package.</p>
1.1       grant    13843:                 </li>
                   13844: 
                   13845:                 <li>
1.14      xtraeme  13846:                   <p>Set <code class="varname">XML_CATALOGS</code>
                   13847:                   to the full path of any XML catalogs installed by
1.1       grant    13848:                   the package.</p>
                   13849:                 </li>
                   13850: 
                   13851:                 <li>
1.14      xtraeme  13852:                   <p>Set <code class="varname">SGML_ENTRIES</code>
                   13853:                   to individual entries to be added to the SGML
1.1       grant    13854:                   catalog. These come in groups of three strings;
                   13855:                   see xmlcatmgr(1) for more information
                   13856:                   (specifically, arguments recognized by the 'add'
                   13857:                   action). Note that you will normally not use this
                   13858:                   variable.</p>
                   13859:                 </li>
                   13860: 
                   13861:                 <li>
1.14      xtraeme  13862:                   <p>Set <code class="varname">XML_ENTRIES</code>
                   13863:                   to individual entries to be added to the XML
1.1       grant    13864:                   catalog. These come in groups of three strings;
                   13865:                   see xmlcatmgr(1) for more information
                   13866:                   (specifically, arguments recognized by the 'add'
                   13867:                   action). Note that you will normally not use this
                   13868:                   variable.</p>
                   13869:                 </li>
                   13870:               </ol>
                   13871:             </div>
                   13872:           </div>
                   13873: 
1.63    ! dillo    13874:           <div class="sect2" lang="en">
1.1       grant    13875:             <div class="titlepage">
                   13876:               <div>
                   13877:                 <div>
1.63    ! dillo    13878:                   <h3 class="title"><a name=
1.57      minskim  13879:                   "mime-database"></a>15.5.14.&nbsp;Packages
1.30      wiz      13880:                   installing extensions to the MIME database</h3>
1.1       grant    13881:                 </div>
                   13882:               </div>
                   13883:             </div>
                   13884: 
                   13885:             <p>If a package provides extensions to the MIME
1.45      wiz      13886:             database by installing <code xmlns=
                   13887:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13888:             "filename">.xml</code> files inside <code xmlns=
                   13889:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13890:             "filename">${PREFIX}/share/mime/packages</code>, you
                   13891:             need to take some extra steps to ensure that the
                   13892:             database is kept consistent with respect to these new
                   13893:             files:</p>
1.1       grant    13894: 
                   13895:             <div class="orderedlist">
                   13896:               <ol type="1">
                   13897:                 <li>
1.45      wiz      13898:                   <p>Include <code xmlns=
                   13899:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13900:                   "filename">../../databases/shared-mime-info/mimedb.mk</code>
1.45      wiz      13901:                   (avoid using the <code xmlns=
                   13902:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13903:                   "filename">buildlink3.mk</code> file from this
                   13904:                   same directory, which is reserved for inclusion
1.45      wiz      13905:                   from other <code xmlns=
                   13906:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13907:                   "filename">buildlink3.mk</code> files). It takes
                   13908:                   care of rebuilding the MIME database at
                   13909:                   installation and deinstallation time, and
                   13910:                   disallows any access to it directly from the
1.1       grant    13911:                   package.</p>
                   13912:                 </li>
                   13913: 
                   13914:                 <li>
                   13915:                   <p>Check the PLIST and remove any entries under
1.45      wiz      13916:                   the <code xmlns=
                   13917:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13918:                   "filename">share/mime</code> directory,
                   13919:                   <span class="emphasis"><em>except</em></span> for
                   13920:                   files saved under <code xmlns=
                   13921:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13922:                   "filename">share/mime/packages</code>. The former
1.1       grant    13923:                   are handled automatically by the
1.47      reed     13924:                   update-mime-database program, but the latter are
1.1       grant    13925:                   package-dependent and must be removed by the
                   13926:                   package that installed them in the first
                   13927:                   place.</p>
                   13928:                 </li>
                   13929: 
                   13930:                 <li>
1.45      wiz      13931:                   <p>Remove any <code xmlns=
                   13932:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13933:                   "filename">share/mime/*</code> directories from
                   13934:                   the PLIST. They will be handled by the
1.1       grant    13935:                   shared-mime-info package.</p>
                   13936:                 </li>
                   13937:               </ol>
                   13938:             </div>
                   13939:           </div>
                   13940: 
1.63    ! dillo    13941:           <div class="sect2" lang="en">
1.1       grant    13942:             <div class="titlepage">
                   13943:               <div>
                   13944:                 <div>
1.63    ! dillo    13945:                   <h3 class="title"><a name=
1.57      minskim  13946:                   "intltool"></a>15.5.15.&nbsp;Packages using
1.1       grant    13947:                   intltool</h3>
                   13948:                 </div>
                   13949:               </div>
                   13950:             </div>
                   13951: 
                   13952:             <p>If a package uses intltool during its build, include
1.45      wiz      13953:             the <code xmlns=
                   13954:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13955:             "filename">../../textproc/intltool/buildlink3.mk</code>
1.1       grant    13956:             file, which forces it to use the intltool package
                   13957:             provided by pkgsrc, instead of the one bundled with the
                   13958:             distribution file.</p>
                   13959: 
                   13960:             <p>This tracks intltool's build-time dependencies and
                   13961:             uses the latest available version; this way, the
                   13962:             package benefits of any bug fixes that may have
                   13963:             appeared since it was released.</p>
                   13964:           </div>
1.18      xtraeme  13965: 
1.63    ! dillo    13966:           <div class="sect2" lang="en">
1.18      xtraeme  13967:             <div class="titlepage">
                   13968:               <div>
                   13969:                 <div>
1.63    ! dillo    13970:                   <h3 class="title"><a name=
1.57      minskim  13971:                   "startup-scripts"></a>15.5.16.&nbsp;Packages
1.30      wiz      13972:                   installing startup scripts</h3>
1.18      xtraeme  13973:                 </div>
                   13974:               </div>
                   13975:             </div>
                   13976: 
                   13977:             <p>If a package contains a rc.d script, it won't be
                   13978:             copied into the startup directory by default, but you
                   13979:             can enable it, by adding the option <code class=
1.45      wiz      13980:             "varname">PKG_RCD_SCRIPTS=YES</code> in <code xmlns=
                   13981:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.18      xtraeme  13982:             "filename">/etc/mk.conf</code>. This option will copy
1.45      wiz      13983:             the scripts into <code xmlns=
                   13984:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.18      xtraeme  13985:             "filename">/etc/rc.d</code> when a package is
                   13986:             installed, and it will automatically remove the scripts
                   13987:             when the package is deinstalled.</p>
                   13988:           </div>
1.57      minskim  13989: 
1.63    ! dillo    13990:           <div class="sect2" lang="en">
1.57      minskim  13991:             <div class="titlepage">
                   13992:               <div>
                   13993:                 <div>
1.63    ! dillo    13994:                   <h3 class="title"><a name=
1.57      minskim  13995:                   "tex-packages"></a>15.5.17.&nbsp;Packages
                   13996:                   installing TeX modules</h3>
                   13997:                 </div>
                   13998:               </div>
                   13999:             </div>
                   14000: 
                   14001:             <p>If a package installs TeX packages into the texmf
                   14002:             tree, the <code xmlns=
                   14003:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   14004:             "filename">ls-R</code> database of the tree needs to be
                   14005:             updated.</p>
                   14006: 
                   14007:             <div class="note" style=
                   14008:             "margin-left: 0.5in; margin-right: 0.5in;">
                   14009:               <h3 class="title">Note</h3>
                   14010: 
                   14011:               <p>Except the main TeX packages such as teTeX-texmf,
                   14012:               packages should install files into <code class=
                   14013:               "varname">PKG_LOCALTEXMFPREFIX</code>, not
                   14014:               <code class="varname">PKG_TEXMFPREFIX</code>.</p>
                   14015:             </div>
                   14016: 
                   14017:             <div class="orderedlist">
                   14018:               <ol type="1">
                   14019:                 <li>
                   14020:                   <p>Include <code xmlns=
                   14021:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14022:                   "filename">../../print/teTeX/module.mk</code>
                   14023:                   instead of <code xmlns=
                   14024:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14025:                   "filename">../../mk/tex.buildlink3.mk</code>.
                   14026:                   This takes care of rebuilding the <code xmlns=
                   14027:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14028:                   "filename">ls-R</code> database at installation
                   14029:                   and deinstallation time.</p>
                   14030:                 </li>
                   14031: 
                   14032:                 <li>
                   14033:                   <p>If your package installs files into a texmf
                   14034:                   tree other than the one at <code class=
                   14035:                   "varname">PKG_LOCALTEXMFPREFIX</code>, set
                   14036:                   <code class="varname">TEXMFDIRS</code> to the
                   14037:                   list of all texmf trees that need database
                   14038:                   update.</p>
                   14039:                 </li>
                   14040: 
                   14041:                 <li>
                   14042:                   <p>Make sure that none of <code xmlns=
                   14043:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14044:                   "filename">ls-R</code> databases are included in
                   14045:                   <code xmlns=
                   14046:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14047:                   "filename">PLIST</code>, as they will be removed
                   14048:                   only by the teTeX-bin package.</p>
                   14049:                 </li>
                   14050:               </ol>
                   14051:             </div>
                   14052:           </div>
1.1       grant    14053:         </div>
                   14054: 
1.63    ! dillo    14055:         <div class="sect1" lang="en">
1.1       grant    14056:           <div class="titlepage">
                   14057:             <div>
                   14058:               <div>
                   14059:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    14060:                 "feedback-to-author"></a>15.6.&nbsp;Feedback to the
1.30      wiz      14061:                 author</h2>
1.1       grant    14062:               </div>
                   14063:             </div>
                   14064:           </div>
                   14065: 
                   14066:           <p>If you have found any bugs in the package you make
                   14067:           available, if you had to do special steps to make it run
                   14068:           under NetBSD or if you enhanced the software in various
                   14069:           other ways, be sure to report these changes back to the
                   14070:           original author of the program! With that kind of
                   14071:           support, the next release of the program can incorporate
                   14072:           these fixes, and people not using the NetBSD packages
                   14073:           system can win from your efforts.</p>
                   14074: 
                   14075:           <p>Support the idea of free software!</p>
                   14076:         </div>
                   14077:       </div>
                   14078: 
1.63    ! dillo    14079:       <div class="chapter" lang="en">
1.1       grant    14080:         <div class="titlepage">
                   14081:           <div>
                   14082:             <div>
1.63    ! dillo    14083:               <h2 class="title"><a name=
1.38      dillo    14084:               "debug"></a>Chapter&nbsp;16.&nbsp;Debugging</h2>
1.1       grant    14085:             </div>
                   14086:           </div>
                   14087:         </div>
                   14088: 
                   14089:         <p>To check out all the gotchas when building a package,
                   14090:         here are the steps that I do in order to get a package
                   14091:         working. Please note this is basically the same as what was
                   14092:         explained in the previous sections, only with some
                   14093:         debugging aids.</p>
                   14094: 
                   14095:         <div class="itemizedlist">
                   14096:           <ul type="disc">
                   14097:             <li>
1.14      xtraeme  14098:               <p>Be sure to set <code class=
1.45      wiz      14099:               "varname">PKG_DEVELOPER=1</code> in <code xmlns=
                   14100:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14101:               "filename">/etc/mk.conf</code></p>
1.1       grant    14102:             </li>
                   14103: 
                   14104:             <li>
                   14105:               <p>Install <a xmlns=
                   14106:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   14107:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45      wiz      14108:               target="_top"><code xmlns="" class=
                   14109:               "filename">pkgtools/url2pkg</code></a>, create a
1.20      ben      14110:               directory for a new package, change into it, then run
                   14111:               <span><strong class=
                   14112:               "command">url2pkg</strong></span>:</p>
1.1       grant    14113:               <pre class="screen">
1.14      xtraeme  14114: <code class="prompt">%</code> <strong class=
                   14115: "userinput"><code>mkdir /usr/pkgsrc/<em class=
                   14116: "replaceable"><code>category</code></em>/<em class=
                   14117: "replaceable"><code>examplepkg</code></em></code></strong>
                   14118: <code class="prompt">%</code> <strong class=
                   14119: "userinput"><code>cd /usr/pkgsrc/<em class=
                   14120: "replaceable"><code>category</code></em>/<em class=
                   14121: "replaceable"><code>examplepkg</code></em></code></strong>
                   14122: <code class="prompt">%</code> <strong class=
                   14123: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1       grant    14124: </pre>
                   14125:             </li>
                   14126: 
                   14127:             <li>
1.45      wiz      14128:               <p>Edit the <code xmlns=
                   14129:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14130:               "filename">Makefile</code> as requested.</p>
1.1       grant    14131:             </li>
                   14132: 
                   14133:             <li>
1.45      wiz      14134:               <p>Fill in the <code xmlns=
                   14135:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14136:               "filename">DESCR</code> file</p>
1.1       grant    14137:             </li>
                   14138: 
                   14139:             <li>
1.14      xtraeme  14140:               <p>Run <span><strong class="command">make
                   14141:               configure</strong></span></p>
1.1       grant    14142:             </li>
                   14143: 
                   14144:             <li>
                   14145:               <p>Add any dependencies glimpsed from documentation
1.45      wiz      14146:               and the configure step to the package's <code xmlns=
                   14147:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14148:               "filename">Makefile</code>.</p>
1.1       grant    14149:             </li>
                   14150: 
                   14151:             <li>
                   14152:               <p>Make the package compile, doing multiple rounds
                   14153:               of</p>
                   14154:               <pre class="screen">
1.14      xtraeme  14155: <code class="prompt">%</code> <strong class=
                   14156: "userinput"><code>make</code></strong>
                   14157: <code class="prompt">%</code> <strong class=
                   14158: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
                   14159: <code class="prompt">%</code> <strong class=
                   14160: "userinput"><code>mkpatches</code></strong>
                   14161: <code class="prompt">%</code> <strong class=
                   14162: "userinput"><code>patchdiff</code></strong>
                   14163: <code class="prompt">%</code> <strong class=
                   14164: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
                   14165: <code class="prompt">%</code> <strong class=
                   14166: "userinput"><code>make mps</code></strong>
                   14167: <code class="prompt">%</code> <strong class=
                   14168: "userinput"><code>make clean</code></strong>
1.1       grant    14169: </pre>
                   14170: 
                   14171:               <p>Doing as non-root user will ensure that no files
                   14172:               are modified that shouldn't be, especially during the
1.14      xtraeme  14173:               build phase. <span><strong class=
                   14174:               "command">mkpatches</strong></span>,
                   14175:               <span><strong class=
                   14176:               "command">patchdiff</strong></span> and
                   14177:               <span><strong class="command">pkgvi</strong></span>
                   14178:               are from the <a xmlns=
1.1       grant    14179:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   14180:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45      wiz      14181:               target="_top"><code xmlns="" class=
                   14182:               "filename">pkgtools/pkgdiff</code></a> package.</p>
1.1       grant    14183:             </li>
                   14184: 
                   14185:             <li>
1.45      wiz      14186:               <p>Look at the <code xmlns=
                   14187:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14188:               "filename">Makefile</code>, fix if necessary; see
                   14189:               <a href="#components.Makefile" title=
1.38      dillo    14190:               "8.1.&nbsp;Makefile">Section&nbsp;8.1,
1.45      wiz      14191:               &#8220;<code xmlns=
                   14192:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14193:               "filename">Makefile</code>&#8221;</a>.</p>
1.1       grant    14194:             </li>
                   14195: 
                   14196:             <li>
1.45      wiz      14197:               <p>Generate a <code xmlns=
                   14198:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14199:               "filename">PLIST</code>:</p>
1.1       grant    14200:               <pre class="screen">
1.14      xtraeme  14201: <code class="prompt">#</code> <strong class=
                   14202: "userinput"><code>make install</code></strong>
                   14203: <code class="prompt">#</code> <strong class=
                   14204: "userinput"><code>make print-PLIST &gt;PLIST</code></strong>
                   14205: <code class="prompt">#</code> <strong class=
                   14206: "userinput"><code>make deinstall</code></strong>
                   14207: <code class="prompt">#</code> <strong class=
                   14208: "userinput"><code>make install</code></strong>
                   14209: <code class="prompt">#</code> <strong class=
                   14210: "userinput"><code>make deinstall</code></strong>
1.1       grant    14211: </pre>
                   14212: 
1.45      wiz      14213:               <p>You usually need to be <code xmlns=
                   14214:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14215:               "username">root</code> to do this. Look if there are
1.1       grant    14216:               any files left:</p>
                   14217:               <pre class="screen">
1.14      xtraeme  14218: <code class="prompt">#</code> <strong class=
                   14219: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    14220: </pre>
                   14221: 
                   14222:               <p>If this reveals any files that are missing in
1.45      wiz      14223:               <code xmlns=
                   14224:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14225:               "filename">PLIST</code>, add them.</p>
1.1       grant    14226:             </li>
                   14227: 
                   14228:             <li>
1.45      wiz      14229:               <p>Now that the <code xmlns=
                   14230:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14231:               "filename">PLIST</code> is OK, install the package
                   14232:               again and make a binary package:</p>
1.1       grant    14233:               <pre class="screen">
1.14      xtraeme  14234: <code class="prompt">#</code> <strong class=
                   14235: "userinput"><code>make reinstall</code></strong>
                   14236: <code class="prompt">#</code> <strong class=
                   14237: "userinput"><code>make package</code></strong>
1.1       grant    14238: </pre>
                   14239:             </li>
                   14240: 
                   14241:             <li>
                   14242:               <p>Delete the installed package:</p>
                   14243:               <pre class="screen">
1.14      xtraeme  14244: <code class="prompt">#</code> <strong class=
                   14245: "userinput"><code>pkg_delete blub</code></strong>
1.1       grant    14246: </pre>
                   14247:             </li>
                   14248: 
                   14249:             <li>
1.14      xtraeme  14250:               <p>Repeat the above <span><strong class=
                   14251:               "command">make print-PLIST</strong></span> command,
                   14252:               which shouldn't find anything now:</p>
1.1       grant    14253:               <pre class="screen">
1.14      xtraeme  14254: <code class="prompt">#</code> <strong class=
                   14255: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    14256: </pre>
                   14257:             </li>
                   14258: 
                   14259:             <li>
                   14260:               <p>Reinstall the binary package:</p>
                   14261:               <pre class="screen">
1.14      xtraeme  14262: <code class="prompt">#</code> <strong class=
                   14263: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1       grant    14264: </pre>
                   14265:             </li>
                   14266: 
                   14267:             <li>
                   14268:               <p>Play with it. Make sure everything works.</p>
                   14269:             </li>
                   14270: 
                   14271:             <li>
1.14      xtraeme  14272:               <p>Run <span><strong class=
                   14273:               "command">pkglint</strong></span> from <a xmlns=
1.1       grant    14274:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   14275:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45      wiz      14276:               target="_top"><code xmlns="" class=
                   14277:               "filename">pkgtools/pkglint</code></a>, and fix the
1.20      ben      14278:               problems it reports:</p>
1.1       grant    14279:               <pre class="screen">
1.14      xtraeme  14280: <code class="prompt">#</code> <strong class=
                   14281: "userinput"><code>pkglint</code></strong>
1.1       grant    14282: </pre>
                   14283:             </li>
                   14284: 
                   14285:             <li>
                   14286:               <p>Submit (or commit, if you have cvs access); see
                   14287:               <a href="#submit" title=
1.38      dillo    14288:               "Chapter&nbsp;17.&nbsp;Submitting and Committing">Chapter&nbsp;17,
1.1       grant    14289:               <i>Submitting and Committing</i></a>.</p>
                   14290:             </li>
                   14291:           </ul>
                   14292:         </div>
                   14293:       </div>
                   14294: 
1.63    ! dillo    14295:       <div class="chapter" lang="en">
1.1       grant    14296:         <div class="titlepage">
                   14297:           <div>
                   14298:             <div>
1.63    ! dillo    14299:               <h2 class="title"><a name=
1.38      dillo    14300:               "submit"></a>Chapter&nbsp;17.&nbsp;Submitting and
1.1       grant    14301:               Committing</h2>
                   14302:             </div>
                   14303:           </div>
                   14304:         </div>
                   14305: 
                   14306:         <div class="toc">
                   14307:           <p><b>Table of Contents</b></p>
                   14308: 
                   14309:           <dl>
1.30      wiz      14310:             <dt><span class="sect1"><a href=
1.38      dillo    14311:             "#submitting-your-package">17.1. Submitting your
1.30      wiz      14312:             packages</a></span></dt>
1.1       grant    14313: 
1.30      wiz      14314:             <dt><span class="sect1"><a href=
1.41      wiz      14315:             "#general-notes-for-changes">17.2. General notes when
                   14316:             adding, updating, or removing packages</a></span></dt>
                   14317: 
                   14318:             <dt><span class="sect1"><a href=
                   14319:             "#committing-importing">17.3. Committing: Importing a
1.30      wiz      14320:             package into CVS</a></span></dt>
1.1       grant    14321: 
1.30      wiz      14322:             <dt><span class="sect1"><a href=
1.41      wiz      14323:             "#updating-package">17.4. Updating a package to a newer
1.30      wiz      14324:             version</a></span></dt>
1.1       grant    14325: 
1.41      wiz      14326:             <dt><span class="sect1"><a href="#moving-package">17.5.
1.2       hubertf  14327:             Moving a package in pkgsrc</a></span></dt>
1.1       grant    14328:           </dl>
                   14329:         </div>
                   14330: 
1.63    ! dillo    14331:         <div class="sect1" lang="en">
1.1       grant    14332:           <div class="titlepage">
                   14333:             <div>
                   14334:               <div>
                   14335:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    14336:                 "submitting-your-package"></a>17.1.&nbsp;Submitting
1.30      wiz      14337:                 your packages</h2>
1.1       grant    14338:               </div>
                   14339:             </div>
                   14340:           </div>
                   14341: 
                   14342:           <p>You have to separate between binary and
                   14343:           &#8220;<span class="quote">normal</span>&#8221; (source)
                   14344:           packages here:</p>
                   14345: 
                   14346:           <div class="itemizedlist">
                   14347:             <ul type="disc">
                   14348:               <li>
                   14349:                 <p>precompiled binary packages</p>
                   14350: 
                   14351:                 <p>Our policy is that we accept binaries only from
                   14352:                 pkgsrc developers to guarantee that the packages
                   14353:                 don't contain any trojan horses etc. This is not to
1.13      hubertf  14354:                 annoy anyone but rather to protect our users!
1.1       grant    14355:                 You're still free to put up your home-made binary
1.13      hubertf  14356:                 packages and tell the world where to get them.
                   14357:                 NetBSD developers doing bulk builds and wanting to
                   14358:                 upload them please see <a href="#bulk-upload"
1.38      dillo    14359:                 title="6.3.8.&nbsp;Uploading results of a bulk build">
                   14360:                 Section&nbsp;6.3.8, &#8220;Uploading results of a
1.13      hubertf  14361:                 bulk build&#8221;</a>.</p>
1.1       grant    14362:               </li>
                   14363: 
                   14364:               <li>
                   14365:                 <p>packages</p>
                   14366: 
                   14367:                 <p>First, check that your package is complete,
                   14368:                 compiles and runs well; see <a href="#debug" title=
1.38      dillo    14369:                 "Chapter&nbsp;16.&nbsp;Debugging">Chapter&nbsp;16,
1.1       grant    14370:                 <i>Debugging</i></a> and the rest of this document.
1.24      wiz      14371:                 Next, generate an uuencoded gzipped <a href=
                   14372:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   14373:                 <span class="citerefentry"><span class=
                   14374:                 "refentrytitle">tar</span>(1)</span></a> archive,
1.1       grant    14375:                 preferably with all files in a single directory.
1.14      xtraeme  14376:                 Finally, <span><strong class=
                   14377:                 "command">send-pr</strong></span> with category
1.1       grant    14378:                 &#8220;<span class="quote">pkg</span>&#8221;, a
                   14379:                 synopsis which includes the package name and
                   14380:                 version number, a short description of your package
                   14381:                 (contents of the COMMENT variable or DESCR file are
                   14382:                 OK) and attach the archive to your PR.</p>
                   14383: 
                   14384:                 <p>If you want to submit several packages, please
                   14385:                 send a separate PR for each one, it's easier for us
                   14386:                 to track things that way.</p>
                   14387: 
                   14388:                 <p>Alternatively, you can also import new packages
                   14389:                 into pkgsrc-wip (&#8220;<span class="quote">pkgsrc
                   14390:                 work-in-progress</span>&#8221;); see the homepage
                   14391:                 at <a href="http://pkgsrc-wip.sourceforge.net/"
                   14392:                 target=
                   14393:                 "_top">http://pkgsrc-wip.sourceforge.net/</a> for
                   14394:                 details.</p>
                   14395:               </li>
                   14396:             </ul>
                   14397:           </div>
                   14398:         </div>
                   14399: 
1.63    ! dillo    14400:         <div class="sect1" lang="en">
1.1       grant    14401:           <div class="titlepage">
                   14402:             <div>
                   14403:               <div>
                   14404:                 <h2 class="title" style="clear: both"><a name=
1.41      wiz      14405:                 "general-notes-for-changes"></a>17.2.&nbsp;General
                   14406:                 notes when adding, updating, or removing
                   14407:                 packages</h2>
                   14408:               </div>
                   14409:             </div>
                   14410:           </div>
                   14411: 
                   14412:           <p>Please note all package additions, updates, moves, and
1.45      wiz      14413:           removals in <code xmlns=
                   14414:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      14415:           "filename">pkgsrc/doc/CHANGES</code>. It's very important
                   14416:           to keep this file up to date and conforming to the
                   14417:           existing format, because it will be used by scripts to
                   14418:           automatically update pages on <a href=
                   14419:           "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
1.45      wiz      14420:           and other sites. Additionally, check the <code xmlns=
                   14421:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      14422:           "filename">pkgsrc/doc/TODO</code> file and remove the
                   14423:           entry for the package you updated or removed, in case it
                   14424:           was mentioned there.</p>
                   14425: 
                   14426:           <p>There is a make target that helps in creating proper
1.45      wiz      14427:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   14428:           class="filename">CHANGES</code> entries:
1.41      wiz      14429:           <span><strong class="command">make
                   14430:           changes-entry</strong></span>. It uses the optional
                   14431:           <code class="varname">CTYPE</code> and <code class=
                   14432:           "varname">NETBSD_LOGIN_NAME</code> variables. The general
1.45      wiz      14433:           usage is to first make sure that your <code xmlns=
                   14434:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      14435:           "filename">CHANGES</code> file is up-to-date (to avoid
                   14436:           having to resolve conflicts later-on) and then to
                   14437:           <span><strong class="command">cd</strong></span> to the
                   14438:           package directory. For package updates,
                   14439:           <span><strong class="command">make
                   14440:           changes-entry</strong></span> is enough. For new
                   14441:           packages, or package moves or removals, set the
                   14442:           <code class="varname">CTYPE</code> variable on the
                   14443:           command line to "Added", "Moved", or "Removed". You can
                   14444:           set <code class="varname">NETBSD_LOGIN_NAME</code> in
1.45      wiz      14445:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   14446:           class="filename">/etc/mk.conf</code> if your local login
                   14447:           name is not the same as your NetBSD login name. Don't
                   14448:           forget to commit the changes to <code xmlns=
                   14449:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      14450:           "filename">pkgsrc/doc/CHANGES</code>!</p>
                   14451:         </div>
                   14452: 
1.63    ! dillo    14453:         <div class="sect1" lang="en">
1.41      wiz      14454:           <div class="titlepage">
                   14455:             <div>
                   14456:               <div>
                   14457:                 <h2 class="title" style="clear: both"><a name=
                   14458:                 "committing-importing"></a>17.3.&nbsp;Committing:
1.30      wiz      14459:                 Importing a package into CVS</h2>
1.1       grant    14460:               </div>
                   14461:             </div>
                   14462:           </div>
                   14463: 
                   14464:           <p>This section is only of interest for pkgsrc developers
                   14465:           with write access to the pkgsrc repository. Please
                   14466:           remember that cvs imports files relative to the current
                   14467:           working directory, and that the pathname that you give
1.14      xtraeme  14468:           the <span><strong class="command">cvs
                   14469:           import</strong></span> command is so that it knows where
                   14470:           to place the files in the repository. Newly created
                   14471:           packages should be imported with a vendor tag of
                   14472:           &#8220;<span class="quote">TNF</span>&#8221; and a
                   14473:           release tag of &#8220;<span class=
                   14474:           "quote">pkgsrc-base</span>&#8221;, e.g:</p>
1.1       grant    14475:           <pre class="programlisting">
1.51      rillig   14476:     <code class="prompt">$</code> cd .../pkgsrc/category/pkgname
                   14477:     <code class=
                   14478: "prompt">$</code> cvs import pkgsrc/category/pkgname TNF pkgsrc-base
1.1       grant    14479: </pre>
                   14480: 
                   14481:           <p>Remember to move the directory from which you imported
                   14482:           out of the way, or cvs will complain the next time you
                   14483:           &#8220;<span class="quote">cvs update</span>&#8221; your
                   14484:           source tree. Also don't forget to add the new package to
1.45      wiz      14485:           the category's <code xmlns=
                   14486:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14487:           "filename">Makefile</code>.</p>
1.1       grant    14488: 
                   14489:           <p>The commit message of the initial import should
1.45      wiz      14490:           include part of the <code xmlns=
                   14491:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   14492:           "filename">DESCR</code> file, so people reading the
                   14493:           mailing lists know what the package is/does.</p>
1.1       grant    14494: 
                   14495:           <p>For new packages, &#8220;<span class="quote">cvs
                   14496:           import</span>&#8221; is preferred to &#8220;<span class=
                   14497:           "quote">cvs add</span>&#8221; because the former gets
                   14498:           everything with a single command, and provides a
                   14499:           consistent tag.</p>
                   14500:         </div>
                   14501: 
1.63    ! dillo    14502:         <div class="sect1" lang="en">
1.1       grant    14503:           <div class="titlepage">
                   14504:             <div>
                   14505:               <div>
                   14506:                 <h2 class="title" style="clear: both"><a name=
1.41      wiz      14507:                 "updating-package"></a>17.4.&nbsp;Updating a
1.30      wiz      14508:                 package to a newer version</h2>
1.1       grant    14509:               </div>
                   14510:             </div>
                   14511:           </div>
                   14512: 
                   14513:           <p>Please always put a concise, appropriate and relevant
                   14514:           summary of the changes between old and new versions into
                   14515:           the commit log when updating a package. There are various
                   14516:           reasons for this:</p>
                   14517: 
                   14518:           <div class="itemizedlist">
                   14519:             <ul type="disc">
                   14520:               <li>
                   14521:                 <p>A URL is volatile, and can change over time. It
                   14522:                 may go away completely or its information may be
                   14523:                 overwritten by newer information.</p>
                   14524:               </li>
                   14525: 
                   14526:               <li>
                   14527:                 <p>Having the change information between old and
                   14528:                 new versions in our CVS repository is very useful
                   14529:                 for people who use either cvs or anoncvs.</p>
                   14530:               </li>
                   14531: 
                   14532:               <li>
                   14533:                 <p>Having the change information between old and
                   14534:                 new versions in our CVS repository is very useful
                   14535:                 for people who read the pkgsrc-changes mailing
                   14536:                 list, so that they can make tactical decisions
                   14537:                 about when to upgrade the package.</p>
                   14538:               </li>
                   14539:             </ul>
                   14540:           </div>
                   14541: 
1.18      xtraeme  14542:           <p>Please also recognize that, just because a new version
1.1       grant    14543:           of a package has been released, it should not
                   14544:           automatically be upgraded in the CVS repository. We
                   14545:           prefer to be conservative in the packages that are
                   14546:           included in pkgsrc - development or beta packages are not
                   14547:           really the best thing for most places in which pkgsrc is
                   14548:           used. Please use your judgement about what should go into
                   14549:           pkgsrc, and bear in mind that stability is to be
                   14550:           preferred above new and possibly untested features.</p>
                   14551:         </div>
                   14552: 
1.63    ! dillo    14553:         <div class="sect1" lang="en">
1.1       grant    14554:           <div class="titlepage">
                   14555:             <div>
                   14556:               <div>
                   14557:                 <h2 class="title" style="clear: both"><a name=
1.41      wiz      14558:                 "moving-package"></a>17.5.&nbsp;Moving a package in
1.30      wiz      14559:                 pkgsrc</h2>
1.1       grant    14560:               </div>
                   14561:             </div>
                   14562:           </div>
                   14563: 
                   14564:           <div class="orderedlist">
                   14565:             <ol type="1">
                   14566:               <li>
                   14567:                 <p>Make a copy of the directory somewhere else.</p>
                   14568:               </li>
                   14569: 
                   14570:               <li>
                   14571:                 <p>Remove all CVS dirs.</p>
                   14572: 
                   14573:                 <p>Alternatively to the first two steps you can
                   14574:                 also do:</p>
                   14575:                 <pre class="screen">
1.14      xtraeme  14576: <code class="prompt">%</code> <strong class=
                   14577: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1       grant    14578: </pre>
                   14579: 
                   14580:                 <p>and use that for further work.</p>
                   14581:               </li>
                   14582: 
                   14583:               <li>
1.14      xtraeme  14584:                 <p>Fix <code class="varname">CATEGORIES</code> and
                   14585:                 any <code class="varname">DEPENDS</code> paths that
                   14586:                 just did &#8220;<span class=
1.1       grant    14587:                 "quote">../package</span>&#8221; instead of
                   14588:                 &#8220;<span class=
                   14589:                 "quote">../../category/package</span>&#8221;.</p>
                   14590:               </li>
                   14591: 
                   14592:               <li>
1.14      xtraeme  14593:                 <p><span><strong class="command">cvs
                   14594:                 import</strong></span> the modified package in the
                   14595:                 new place.</p>
1.1       grant    14596:               </li>
                   14597: 
                   14598:               <li>
                   14599:                 <p>Check if any package depends on it:</p>
                   14600:                 <pre class="screen">
1.14      xtraeme  14601: <code class="prompt">%</code> <strong class=
                   14602: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   14603: <code class="prompt">%</code> <strong class=
                   14604: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1       grant    14605: </pre>
                   14606:               </li>
                   14607: 
                   14608:               <li>
                   14609:                 <p>Fix paths in packages from step 5 to point to
                   14610:                 new location.</p>
                   14611:               </li>
                   14612: 
                   14613:               <li>
1.14      xtraeme  14614:                 <p><span><strong class="command">cvs rm
                   14615:                 (-f)</strong></span> the package at the old
                   14616:                 location.</p>
1.1       grant    14617:               </li>
                   14618: 
                   14619:               <li>
1.45      wiz      14620:                 <p>Remove from <code xmlns=
                   14621:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14622:                 "filename">oldcategory/Makefile</code>.</p>
1.1       grant    14623:               </li>
                   14624: 
                   14625:               <li>
1.45      wiz      14626:                 <p>Add to <code xmlns=
                   14627:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14628:                 "filename">newcategory/Makefile</code>.</p>
1.1       grant    14629:               </li>
                   14630: 
                   14631:               <li>
                   14632:                 <p>Commit the changed and removed files:</p>
                   14633:                 <pre class="screen">
1.14      xtraeme  14634: <code class="prompt">%</code> <strong class=
                   14635: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1       grant    14636: </pre>
                   14637: 
                   14638:                 <p>(and any packages from step 5, of course).</p>
                   14639:               </li>
                   14640:             </ol>
                   14641:           </div>
                   14642:         </div>
                   14643:       </div>
                   14644:     </div>
                   14645: 
1.63    ! dillo    14646:     <div class="appendix" lang="en">
1.1       grant    14647:       <div class="titlepage">
                   14648:         <div>
                   14649:           <div>
1.63    ! dillo    14650:             <h2 class="title"><a name=
1.46      gdt      14651:             "examples"></a>Appendix&nbsp;A.&nbsp;A simple example
1.1       grant    14652:             package: bison</h2>
                   14653:           </div>
                   14654:         </div>
                   14655:       </div>
                   14656: 
                   14657:       <div class="toc">
                   14658:         <p><b>Table of Contents</b></p>
                   14659: 
                   14660:         <dl>
1.46      gdt      14661:           <dt><span class="sect1"><a href="#example-files">A.1.
1.1       grant    14662:           files</a></span></dt>
                   14663: 
                   14664:           <dd>
                   14665:             <dl>
1.30      wiz      14666:               <dt><span class="sect2"><a href=
1.46      gdt      14667:               "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1       grant    14668: 
1.30      wiz      14669:               <dt><span class="sect2"><a href=
1.46      gdt      14670:               "#example-descr">A.1.2. DESCR</a></span></dt>
1.1       grant    14671: 
1.30      wiz      14672:               <dt><span class="sect2"><a href=
1.46      gdt      14673:               "#example-plist">A.1.3. PLIST</a></span></dt>
1.1       grant    14674: 
1.30      wiz      14675:               <dt><span class="sect2"><a href=
1.46      gdt      14676:               "#checking-package-with-pkglint">A.1.4. Checking a
1.30      wiz      14677:               package with <span><strong class=
1.14      xtraeme  14678:               "command">pkglint</strong></span></a></span></dt>
1.1       grant    14679:             </dl>
                   14680:           </dd>
                   14681: 
1.46      gdt      14682:           <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30      wiz      14683:           Steps for building, installing, packaging</a></span></dt>
1.1       grant    14684:         </dl>
                   14685:       </div>
                   14686: 
                   14687:       <p>We checked to find a piece of software that wasn't in the
                   14688:       packages collection, and picked GNU bison. Quite why someone
1.14      xtraeme  14689:       would want to have <span><strong class=
                   14690:       "command">bison</strong></span> when Berkeley
                   14691:       <span><strong class="command">yacc</strong></span> is already
                   14692:       present in the tree is beyond us, but it's useful for the
                   14693:       purposes of this exercise.</p>
1.1       grant    14694: 
1.63    ! dillo    14695:       <div class="sect1" lang="en">
1.1       grant    14696:         <div class="titlepage">
                   14697:           <div>
                   14698:             <div>
                   14699:               <h2 class="title" style="clear: both"><a name=
1.46      gdt      14700:               "example-files"></a>A.1.&nbsp;files</h2>
1.1       grant    14701:             </div>
                   14702:           </div>
                   14703:         </div>
                   14704: 
1.63    ! dillo    14705:         <div class="sect2" lang="en">
1.1       grant    14706:           <div class="titlepage">
                   14707:             <div>
                   14708:               <div>
1.63    ! dillo    14709:                 <h3 class="title"><a name=
1.46      gdt      14710:                 "example-Makefile"></a>A.1.1.&nbsp;Makefile</h3>
1.1       grant    14711:               </div>
                   14712:             </div>
                   14713:           </div>
                   14714:           <pre class="programlisting">
1.51      rillig   14715:     # $NetBSD$
                   14716:     #
1.1       grant    14717: 
1.51      rillig   14718:     DISTNAME=       bison-1.25
                   14719:     CATEGORIES=     devel
                   14720:     MASTER_SITES=   ${MASTER_SITE_GNU}
1.1       grant    14721: 
1.51      rillig   14722:     MAINTAINER=     thorpej@NetBSD.org
                   14723:     HOMEPAGE=       http://www.gnu.org/software/bison/bison.html
                   14724:     COMMENT=        GNU yacc clone
1.1       grant    14725: 
1.51      rillig   14726:     GNU_CONFIGURE=  yes
                   14727:     INFO_FILES=     bison.info
1.1       grant    14728: 
1.51      rillig   14729:     .include "../../mk/bsd.pkg.mk"
1.1       grant    14730: </pre>
                   14731:         </div>
                   14732: 
1.63    ! dillo    14733:         <div class="sect2" lang="en">
1.1       grant    14734:           <div class="titlepage">
                   14735:             <div>
                   14736:               <div>
1.63    ! dillo    14737:                 <h3 class="title"><a name=
1.46      gdt      14738:                 "example-descr"></a>A.1.2.&nbsp;DESCR</h3>
1.1       grant    14739:               </div>
                   14740:             </div>
                   14741:           </div>
                   14742:           <pre class="programlisting">
1.51      rillig   14743:     GNU version of yacc.  Can make re-entrant parsers, and numerous other
                   14744:     improvements.  Why you would want this when Berkeley <a href=
1.1       grant    14745: "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   14746:     of the NetBSD source tree is beyond me.
1.1       grant    14747: </pre>
                   14748:         </div>
                   14749: 
1.63    ! dillo    14750:         <div class="sect2" lang="en">
1.1       grant    14751:           <div class="titlepage">
                   14752:             <div>
                   14753:               <div>
1.63    ! dillo    14754:                 <h3 class="title"><a name=
1.46      gdt      14755:                 "example-plist"></a>A.1.3.&nbsp;PLIST</h3>
1.1       grant    14756:               </div>
                   14757:             </div>
                   14758:           </div>
                   14759:           <pre class="programlisting">
1.51      rillig   14760:     @comment $NetBSD$
                   14761:     bin/bison
                   14762:     man/man1/bison.1.gz
                   14763:     share/bison.simple
                   14764:     share/bison.hairy
1.1       grant    14765: </pre>
                   14766:         </div>
                   14767: 
1.63    ! dillo    14768:         <div class="sect2" lang="en">
1.1       grant    14769:           <div class="titlepage">
                   14770:             <div>
                   14771:               <div>
1.30      wiz      14772:                 <h3 class="title"><a name=
1.46      gdt      14773:                 "checking-package-with-pkglint"></a>A.1.4.&nbsp;Checking
1.30      wiz      14774:                 a package with <span><strong class=
1.14      xtraeme  14775:                 "command">pkglint</strong></span></h3>
1.1       grant    14776:               </div>
                   14777:             </div>
                   14778:           </div>
                   14779: 
                   14780:           <p>The NetBSD package system comes with <a xmlns=
                   14781:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   14782:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45      wiz      14783:           target="_top"><code xmlns="" class=
                   14784:           "filename">pkgtools/pkglint</code></a> which helps to
                   14785:           check the contents of these files. After installation it
                   14786:           is quite easy to use, just change to the directory of the
1.20      ben      14787:           package you wish to examine and execute
                   14788:           <span><strong class=
                   14789:           "command">pkglint</strong></span>:</p>
1.1       grant    14790:           <pre class="screen">
1.14      xtraeme  14791: <code class="prompt">$</code> <strong class=
                   14792: "userinput"><code>pkglint</code></strong>
1.1       grant    14793: looks fine.
                   14794: </pre>
                   14795: 
                   14796:           <p>Depending on the supplied command line arguments (see
1.60      rillig   14797:           pkglint(1)), more checks will be performed. Use e.g.
                   14798:           <span><strong class="command">pkglint -Call
                   14799:           -Wall</strong></span> for a very thorough check.</p>
1.1       grant    14800:         </div>
                   14801:       </div>
                   14802: 
1.63    ! dillo    14803:       <div class="sect1" lang="en">
1.1       grant    14804:         <div class="titlepage">
                   14805:           <div>
                   14806:             <div>
                   14807:               <h2 class="title" style="clear: both"><a name=
1.46      gdt      14808:               "steps-for-b-i-p"></a>A.2.&nbsp;Steps for building,
1.30      wiz      14809:               installing, packaging</h2>
1.1       grant    14810:             </div>
                   14811:           </div>
                   14812:         </div>
                   14813: 
                   14814:         <p>Create the directory where the package lives, plus any
                   14815:         auxiliary directories:</p>
                   14816:         <pre class="screen">
1.14      xtraeme  14817: <code class="prompt">#</code> <strong class=
                   14818: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
                   14819: <code class="prompt">#</code> <strong class=
                   14820: "userinput"><code>mkdir bison</code></strong>
                   14821: <code class="prompt">#</code> <strong class=
                   14822: "userinput"><code>cd bison</code></strong>
                   14823: <code class="prompt">#</code> <strong class=
                   14824: "userinput"><code>mkdir patches</code></strong>
1.1       grant    14825: </pre>
                   14826: 
1.45      wiz      14827:         <p>Create <code xmlns=
                   14828:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   14829:         "filename">Makefile</code>, <code xmlns=
                   14830:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   14831:         "filename">DESCR</code> and <code xmlns=
                   14832:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14833:         "filename">PLIST</code> (see <a href="#components" title=
1.38      dillo    14834:         "Chapter&nbsp;8.&nbsp;Package components - files, directories and contents">
1.63    ! dillo    14835:         Chapter&nbsp;8, <i>Package components - files, directories
        !          14836:         and contents</i></a>) then continue with fetching the
1.1       grant    14837:         distfile:</p>
                   14838:         <pre class="screen">
1.14      xtraeme  14839: <code class="prompt">#</code> <strong class=
                   14840: "userinput"><code>make fetch</code></strong>
1.1       grant    14841: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   14842: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   14843: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   14844: ftp: Error retrieving file: 500 Internal error
                   14845: 
                   14846: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   14847: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   14848: ftp: Error retrieving file: 500 Internal error
                   14849: 
                   14850: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   14851: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   14852: Successfully retrieved file.
                   14853: </pre>
                   14854: 
1.45      wiz      14855:         <p>Generate the checksum of the distfile into <code xmlns=
                   14856:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14857:         "filename">distinfo</code>:</p>
1.1       grant    14858:         <pre class="screen">
1.14      xtraeme  14859: <code class="prompt">#</code> <strong class=
                   14860: "userinput"><code>make makesum</code></strong>
1.1       grant    14861: </pre>
                   14862: 
                   14863:         <p>Now compile:</p>
                   14864:         <pre class="screen">
1.14      xtraeme  14865: <code class="prompt">#</code> <strong class=
                   14866: "userinput"><code>make</code></strong>
1.1       grant    14867: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   14868: ===&gt;  Extracting for bison-1.25
                   14869: ===&gt;  Patching for bison-1.25
                   14870: ===&gt;   Ignoring empty patch directory
                   14871: ===&gt;  Configuring for bison-1.25
                   14872: creating cache ./config.cache
                   14873: checking for gcc... cc
                   14874: checking whether we are using GNU C... yes
                   14875: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   14876: checking how to run the C preprocessor... cc -E
                   14877: checking for minix/config.h... no
                   14878: checking for POSIXized ISC... no
                   14879: checking whether cross-compiling... no
                   14880: checking for ANSI C header files... yes
                   14881: checking for string.h... yes
                   14882: checking for stdlib.h... yes
                   14883: checking for memory.h... yes
                   14884: checking for working const... yes
                   14885: checking for working alloca.h... no
                   14886: checking for alloca... yes
                   14887: checking for strerror... yes
                   14888: updating cache ./config.cache
                   14889: creating ./config.status
                   14890: creating Makefile
                   14891: ===&gt;  Building for bison-1.25
                   14892: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g LR0.c
                   14893: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g allocate.c
                   14894: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g closure.c
                   14895: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g conflicts.c
                   14896: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g derives.c
                   14897: 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 
                   14898: 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
                   14899: 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
                   14900: 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
                   14901: 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
                   14902: 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
                   14903: 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
                   14904: 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
                   14905: 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
                   14906: 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
                   14907: 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
                   14908: 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
                   14909: 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
                   14910: 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
                   14911: 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
                   14912: 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
                   14913: 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
                   14914: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   14915: rm -f bison.s1
                   14916: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1
                   14917: </pre>
                   14918: 
                   14919:         <p>Everything seems OK, so install the files:</p>
                   14920:         <pre class="screen">
1.14      xtraeme  14921: <code class="prompt">#</code> <strong class=
                   14922: "userinput"><code>make install</code></strong>
1.1       grant    14923: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   14924: ===&gt;  Installing for bison-1.25
                   14925: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   14926: rm -f /usr/pkg/bin/bison
                   14927: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   14928: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   14929: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   14930: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   14931: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   14932: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   14933: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
                   14934: ===&gt;  Registering installation for bison-1.25
                   14935: </pre>
                   14936: 
                   14937:         <p>You can now use bison, and also - if you decide so -
1.14      xtraeme  14938:         remove it with <span><strong class="command">pkg_delete
                   14939:         bison</strong></span>. Should you decide that you want a
                   14940:         binary package, do this now:</p>
1.1       grant    14941:         <pre class="screen">
1.14      xtraeme  14942: <code class="prompt">#</code> <strong class=
                   14943: "userinput"><code>make package</code></strong>
1.1       grant    14944: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   14945: ===&gt;  Building package for bison-1.25
                   14946: Creating package bison-1.25.tgz
                   14947: Registering depends:.
                   14948: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
                   14949: </pre>
                   14950: 
                   14951:         <p>Now that you don't need the source and object files any
                   14952:         more, clean up:</p>
                   14953:         <pre class="screen">
1.14      xtraeme  14954: <code class="prompt">#</code> <strong class=
                   14955: "userinput"><code>make clean</code></strong>
1.1       grant    14956: ===&gt;  Cleaning for bison-1.25
                   14957: </pre>
                   14958:       </div>
                   14959:     </div>
                   14960: 
1.63    ! dillo    14961:     <div class="appendix" lang="en">
1.1       grant    14962:       <div class="titlepage">
                   14963:         <div>
                   14964:           <div>
1.63    ! dillo    14965:             <h2 class="title"><a name=
1.46      gdt      14966:             "logs"></a>Appendix&nbsp;B.&nbsp;Build logs</h2>
1.1       grant    14967:           </div>
                   14968:         </div>
                   14969:       </div>
                   14970: 
                   14971:       <div class="toc">
                   14972:         <p><b>Table of Contents</b></p>
                   14973: 
                   14974:         <dl>
1.46      gdt      14975:           <dt><span class="sect1"><a href="#logs.building">B.1.
1.1       grant    14976:           Building figlet</a></span></dt>
                   14977: 
1.46      gdt      14978:           <dt><span class="sect1"><a href="#logs.package">B.2.
1.1       grant    14979:           Packaging figlet</a></span></dt>
                   14980:         </dl>
                   14981:       </div>
                   14982: 
1.63    ! dillo    14983:       <div class="sect1" lang="en">
1.1       grant    14984:         <div class="titlepage">
                   14985:           <div>
                   14986:             <div>
                   14987:               <h2 class="title" style="clear: both"><a name=
1.46      gdt      14988:               "logs.building"></a>B.1.&nbsp;Building figlet</h2>
1.1       grant    14989:             </div>
                   14990:           </div>
                   14991:         </div>
                   14992:         <pre class="screen">
1.14      xtraeme  14993: <code class="prompt">#</code> <strong class=
                   14994: "userinput"><code>make</code></strong>
1.1       grant    14995: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   14996: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   14997: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   14998: =&gt; [172219 bytes]
                   14999: Connected to ftp.plig.net.
                   15000: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   15001: 331 Guest login ok, send your complete e-mail address as password.
                   15002: 230-You are user #5 of 500 simultaneous users allowed.
                   15003: 230-
                   15004: 230-  ___ _             _ _                   
                   15005: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___ 
                   15006: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   15007: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   15008: 230-         |_|   |_|     |___|         |___|
                   15009: 230-
                   15010: 230-** Welcome to ftp.plig.org **
                   15011: 230-
                   15012: 230-Please note that all transfers from this FTP site are logged. If you
                   15013: 230-do not like this, please disconnect now.
                   15014: 230-
                   15015: 230-This arhive is available via
                   15016: 230-
                   15017: 230-HTTP:  http://ftp.plig.org/
                   15018: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   15019: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   15020: 230-
                   15021: 230-Please email comments, bug reports and requests for packages to be
                   15022: 230-mirrored to ftp-admin@plig.org.   
                   15023: 230-
                   15024: 230-
                   15025: 230 Logged in anonymously.
                   15026: Remote system type is UNIX.
                   15027: Using binary mode to transfer files.
                   15028: 200 Type okay.
                   15029: 250 "/pub" is new cwd.
                   15030: 250-"/pub/figlet" is new cwd.
                   15031: 250-
                   15032: 250-Welcome to the figlet archive at ftp.figlet.org
                   15033: 250-    
                   15034: 250-    ftp://ftp.figlet.org/pub/figlet/
                   15035: 250-
                   15036: 250-The official FIGlet web page is:
                   15037: 250-    http://www.figlet.org/
                   15038: 250-
                   15039: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   15040: 250-contribute a font or something else, you can email us.
                   15041: 250 
                   15042: 250 "/pub/figlet/program" is new cwd.
                   15043: 250 "/pub/figlet/program/unix" is new cwd.
                   15044: local: figlet221.tar.gz remote: figlet221.tar.gz
                   15045: 502 Unimplemented command.
                   15046: 227 Entering Passive Mode (195,40,6,41,246,104)
                   15047: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   15048: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   15049: 226 Transfer completed.
                   15050: 172219 bytes received in 00:02 (75.99 KB/s)
                   15051: 221 Goodbye.
                   15052: =&gt; Checksum OK for figlet221.tar.gz.
                   15053: ===&gt; Extracting for figlet-2.2.1nb2
                   15054: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   15055: ===&gt; Patching for figlet-2.2.1nb2
                   15056: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   15057: ===&gt; Overriding tools for figlet-2.2.1nb2
                   15058: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   15059: ===&gt; Configuring for figlet-2.2.1nb2
                   15060: ===&gt; Building for figlet-2.2.1nb2
                   15061: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   15062: chmod a+x figlet
                   15063: gcc -O2 -o chkfont chkfont.c
                   15064: =&gt; Unwrapping files-to-be-installed.
1.14      xtraeme  15065: <code class="prompt">#</code>
                   15066: <code class="prompt">#</code> <strong class=
                   15067: "userinput"><code>make install</code></strong>
1.1       grant    15068: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   15069: ===&gt; Installing for figlet-2.2.1nb2
                   15070: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   15071: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   15072: mkdir -p /usr/pkg/share/figlet
                   15073: cp figlet /usr/pkg/bin
                   15074: cp chkfont /usr/pkg/bin
                   15075: chmod 555 figlist showfigfonts
                   15076: cp figlist /usr/pkg/bin
                   15077: cp showfigfonts /usr/pkg/bin
                   15078: cp fonts/*.flf /usr/pkg/share/figlet
                   15079: cp fonts/*.flc /usr/pkg/share/figlet
                   15080: cp figlet.6 /usr/pkg/man/man6
                   15081: ===&gt; Registering installation for figlet-2.2.1nb2
1.14      xtraeme  15082: <code class="prompt">#</code>
1.1       grant    15083: </pre>
                   15084:       </div>
                   15085: 
1.63    ! dillo    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.46      gdt      15091:               "logs.package"></a>B.2.&nbsp;Packaging figlet</h2>
1.1       grant    15092:             </div>
                   15093:           </div>
                   15094:         </div>
                   15095:         <pre class="screen">
1.14      xtraeme  15096: <code class="prompt">#</code> <strong class=
                   15097: "userinput"><code>make package</code></strong>
1.1       grant    15098: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   15099: ===&gt; Packaging figlet-2.2.1nb2
                   15100: ===&gt; Building binary package for figlet-2.2.1nb2
                   15101: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   15102: Using SrcDir value of /usr/pkg
                   15103: Registering depends:.  
1.14      xtraeme  15104: <code class="prompt">#</code>
1.1       grant    15105: </pre>
                   15106:       </div>
                   15107:     </div>
                   15108: 
1.63    ! dillo    15109:     <div class="appendix" lang="en">
1.1       grant    15110:       <div class="titlepage">
                   15111:         <div>
                   15112:           <div>
1.63    ! dillo    15113:             <h2 class="title"><a name=
1.46      gdt      15114:             "ftp-layout"></a>Appendix&nbsp;C.&nbsp;Layout of the
1.1       grant    15115:             FTP server's package archive</h2>
                   15116:           </div>
                   15117:         </div>
                   15118:       </div>
                   15119: 
                   15120:       <p>Layout for precompiled binary packages on
                   15121:       ftp.NetBSD.org:</p>
                   15122:       <pre class="programlisting">
1.51      rillig   15123:     /pub/NetBSD/packages/
                   15124:         distfiles/
1.1       grant    15125: 
1.51      rillig   15126:         # Unpacked pkgsrc trees
                   15127:         pkgsrc-current -&gt; /pub/NetBSD/NetBSD-current/pkgsrc
                   15128:         pkgsrc-2003Q4 -&gt; N/A
                   15129:         pkgsrc-2004Q1/pkgsrc
                   15130: 
                   15131:         # pkgsrc archives
                   15132:         pkgsrc-current.tar.gz -&gt; ../NetBSD-current/tar_files/pkgsrc.tar.gz
                   15133:         pkgsrc-2003Q4.tar.gz -&gt; N/A
                   15134:         pkgsrc-2004Q1.tar.gz -&gt; N/A
                   15135: 
                   15136:         # Per pkgsrc-release/OS-release/arch package archives
                   15137:         pkgsrc-2003Q4/
                   15138:             NetBSD-1.6.2/
                   15139:                 i386/
                   15140:                     All/
                   15141:                     archivers/
                   15142:                         foo -&gt; ../All/foo
                   15143:                     ...
                   15144:         pkgsrc-2004Q1/
                   15145:             NetBSD-1.6.2/
                   15146:                 i386/
                   15147:                     All/
                   15148:                     ...
                   15149:             NetBSD-2.0/
                   15150:                 i386/
                   15151:                     All/
                   15152:                     ...
                   15153:             SunOS-5.9/
                   15154:                 sparc/
                   15155:                     All/
                   15156:                     ...
                   15157:                 x86/
                   15158:                     All/
                   15159:                     ...
                   15160: 
                   15161:         # Per os-release package archive convenience links
                   15162:         NetBSD-1.6.2 -&gt; 1.6.2
                   15163:         1.6.2/
                   15164:             i386 -&gt; ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
                   15165:             m68k/
                   15166:                 All/
                   15167:                 archivers/
                   15168:                     foo -&gt; ../All/foo
                   15169:                 ...
                   15170:             amiga -&gt; m68k
                   15171:             atari -&gt; m68k
                   15172:             ...
                   15173: 
                   15174:         2.0 -&gt; NetBSD-2.0       # backward compat, historic
                   15175:         NetBSD-2.0/
                   15176:             i386 -&gt; ../pkgsrc-2004Q1/NetBSD-2.0/i386
                   15177:         SunOS-5.9/
                   15178:             sparc -&gt; ../pkgsrc-2004Q1/SunOS-5.9/sparc
                   15179:             x86 -&gt; ../pkgsrc-2004Q1/SunOS-5.9/x86
1.1       grant    15180: </pre>
                   15181: 
                   15182:       <p>To create:</p>
                   15183: 
                   15184:       <div class="orderedlist">
                   15185:         <ol type="1">
                   15186:           <li>
                   15187:             <p>Run bulk build, see <a href="#bulkbuild" title=
1.63    ! dillo    15188:             "6.3.&nbsp;Doing a bulk build of all packages">Section&nbsp;6.3,
        !          15189:             &#8220;Doing a bulk build of all
1.1       grant    15190:             packages&#8221;</a></p>
                   15191:           </li>
                   15192: 
                   15193:           <li>
                   15194:             <p>Upload /usr/pkgsrc/packages to</p>
                   15195:             <pre class="programlisting">
                   15196:     ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.51      rillig   15197:         pkgsrc-2004Q4/\             # pkgsrc-branch
                   15198:         `uname -s`-`uname -r`/\     # OS &amp; version
                   15199:         `uname -p`                  # architecture
1.1       grant    15200: </pre>
                   15201:           </li>
                   15202: 
                   15203:           <li>
1.14      xtraeme  15204:             <p>If necessary, create a symlink <span><strong class=
                   15205:             "command">ln -s `uname -m` `uname -p`</strong></span>
                   15206:             (amiga -&gt; m68k, ...)</p>
1.1       grant    15207:           </li>
                   15208:         </ol>
                   15209:       </div>
                   15210:     </div>
1.2       hubertf  15211: 
1.63    ! dillo    15212:     <div class="appendix" lang="en">
1.2       hubertf  15213:       <div class="titlepage">
                   15214:         <div>
                   15215:           <div>
1.63    ! dillo    15216:             <h2 class="title"><a name=
1.46      gdt      15217:             "editing"></a>Appendix&nbsp;D.&nbsp;Editing guidelines
1.2       hubertf  15218:             for the pkgsrc guide</h2>
                   15219:           </div>
                   15220:         </div>
                   15221:       </div>
                   15222: 
                   15223:       <div class="toc">
                   15224:         <p><b>Table of Contents</b></p>
                   15225: 
                   15226:         <dl>
1.46      gdt      15227:           <dt><span class="sect1"><a href="#targets">D.1.
1.2       hubertf  15228:           Targets</a></span></dt>
                   15229: 
1.46      gdt      15230:           <dt><span class="sect1"><a href="#procedure">D.2.
1.2       hubertf  15231:           Procedure</a></span></dt>
                   15232:         </dl>
                   15233:       </div>
                   15234: 
                   15235:       <p>This section contains information on editing the pkgsrc
                   15236:       guide itself.</p>
                   15237: 
1.63    ! dillo    15238:       <div class="sect1" lang="en">
1.2       hubertf  15239:         <div class="titlepage">
                   15240:           <div>
                   15241:             <div>
                   15242:               <h2 class="title" style="clear: both"><a name=
1.63    ! dillo    15243:               "targets"></a>D.1.&nbsp;Targets</h2>
1.2       hubertf  15244:             </div>
                   15245:           </div>
                   15246:         </div>
                   15247: 
1.45      wiz      15248:         <p>The pkgsrc guide's source code is stored in <code xmlns=
                   15249:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15250:         "filename">pkgsrc/doc/guide/files</code>, and several files
1.2       hubertf  15251:         are created from it:</p>
                   15252: 
                   15253:         <div class="itemizedlist">
                   15254:           <ul type="disc">
                   15255:             <li>
1.45      wiz      15256:               <p><code xmlns=
                   15257:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.23      wiz      15258:               "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2       hubertf  15259:             </li>
                   15260: 
                   15261:             <li>
1.45      wiz      15262:               <p><code xmlns=
                   15263:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15264:               "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2       hubertf  15265:             </li>
                   15266: 
                   15267:             <li>
1.45      wiz      15268:               <p><code xmlns=
                   15269:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15270:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2       hubertf  15271:               the documentation on the NetBSD website will be built
                   15272:               from pkgsrc and kept up to date on the web server
                   15273:               itself. This means you <span class=
                   15274:               "emphasis"><em>must</em></span> make sure that your
                   15275:               changes haven't broken the build!</p>
                   15276:             </li>
1.6       hubertf  15277: 
                   15278:             <li>
1.45      wiz      15279:               <p><code xmlns=
                   15280:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15281:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6       hubertf  15282:               PDF version of the pkgsrc guide.</p>
                   15283:             </li>
                   15284: 
                   15285:             <li>
1.45      wiz      15286:               <p><code xmlns=
                   15287:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15288:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6       hubertf  15289:               PostScript version of the pkgsrc guide.</p>
                   15290:             </li>
1.2       hubertf  15291:           </ul>
                   15292:         </div>
                   15293:       </div>
                   15294: 
1.63    ! dillo    15295:       <div class="sect1" lang="en">
1.2       hubertf  15296:         <div class="titlepage">
                   15297:           <div>
                   15298:             <div>
                   15299:               <h2 class="title" style="clear: both"><a name=
1.46      gdt      15300:               "procedure"></a>D.2.&nbsp;Procedure</h2>
1.2       hubertf  15301:             </div>
                   15302:           </div>
                   15303:         </div>
                   15304: 
                   15305:         <p>The procedure to edit the pkgsrc guide is:</p>
                   15306: 
                   15307:         <div class="itemizedlist">
                   15308:           <ul type="disc">
                   15309:             <li>
1.6       hubertf  15310:               <p>Make sure you have the packages needed to
                   15311:               re-generate the pkgsrc guide (and other XML-based
                   15312:               NetBSD documentation) installed. These are
1.11      ben      15313:               &#8220;<span class="quote">netbsd-doc</span>&#8221;
1.47      reed     15314:               for creating the ASCII and HTML versions, and
1.6       hubertf  15315:               &#8220;<span class=
1.47      reed     15316:               "quote">netbsd-doc-print</span>&#8221; for the
                   15317:               PostScript and PDF versions. You will need both
1.6       hubertf  15318:               packages installed, to make sure documentation is
                   15319:               consistent across all formats. The packages can be
1.45      wiz      15320:               found in <code xmlns=
                   15321:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15322:               "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
1.45      wiz      15323:               <code xmlns=
                   15324:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15325:               "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6       hubertf  15326:             </li>
                   15327: 
                   15328:             <li>
1.45      wiz      15329:               <p>Edit the XML file(s) in <code xmlns=
                   15330:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15331:               "filename">pkgsrc/doc/guide/files</code>.</p>
1.2       hubertf  15332:             </li>
                   15333: 
                   15334:             <li>
1.14      xtraeme  15335:               <p>Run <span><strong class="command">make extract
                   15336:               &amp;&amp; make do-lint</strong></span> in
1.45      wiz      15337:               <code xmlns=
                   15338:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   15339:               "filename">pkgsrc/doc/guide</code> to check the XML
                   15340:               syntax, and fix it if needed.</p>
1.4       hubertf  15341:             </li>
                   15342: 
                   15343:             <li>
1.14      xtraeme  15344:               <p>Run <span><strong class=
1.45      wiz      15345:               "command">make</strong></span> in <code xmlns=
                   15346:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15347:               "filename">pkgsrc/doc/guide</code> to build the HTML
                   15348:               and ASCII version.</p>
1.2       hubertf  15349:             </li>
                   15350: 
                   15351:             <li>
1.14      xtraeme  15352:               <p>If all is well, run <span><strong class=
                   15353:               "command">make install-doc</strong></span> to put the
1.45      wiz      15354:               generated files into <code xmlns=
                   15355:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15356:               "filename">pkgsrc/doc</code>.</p>
1.2       hubertf  15357:             </li>
                   15358: 
                   15359:             <li>
1.14      xtraeme  15360:               <p><span><strong class="command">cvs commit
                   15361:               pkgsrc/doc/guide/files</strong></span></p>
1.2       hubertf  15362:             </li>
                   15363: 
                   15364:             <li>
1.14      xtraeme  15365:               <p><span><strong class="command">cvs commit -m
                   15366:               re-generate
                   15367:               pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2       hubertf  15368:             </li>
1.4       hubertf  15369: 
                   15370:             <li>
                   15371:               <p>Until the webserver on www.NetBSD.org is really
                   15372:               updated automatically to pick up changes to the
1.14      xtraeme  15373:               pkgsrc guide automatically, also run
1.18      xtraeme  15374:               <span><strong class="command">make install-htdocs
1.14      xtraeme  15375:               HTDOCSDIR=../../../htdocs</strong></span> (or
                   15376:               similar, adjust <code class=
                   15377:               "varname">HTDOCSDIR</code>!).</p>
1.4       hubertf  15378:             </li>
                   15379: 
                   15380:             <li>
1.14      xtraeme  15381:               <p><span><strong class="command">cvs commit
                   15382:               htdocs/Documentation/pkgsrc</strong></span></p>
1.4       hubertf  15383:             </li>
1.2       hubertf  15384:           </ul>
                   15385:         </div>
                   15386:       </div>
                   15387:     </div>
1.1       grant    15388:   </div>
                   15389: </body>
                   15390: </html>

CVSweb <webmaster@jp.NetBSD.org>