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

1.1       grant       1: <html xmlns="http://www.w3.org/1999/xhtml">
                      2: <head>
                      3:   <meta name="generator" content=
1.20      ben         4:   "HTML Tidy for NetBSD (vers 1st August 2004), see www.w3.org" />
1.1       grant       5:   <meta http-equiv="Content-Type" content=
                      6:   "text/html; charset=us-ascii" />
                      7: 
                      8:   <title>The pkgsrc guide</title>
                      9:   <link rel="stylesheet" href="/NetBSD.css" type="text/css" />
                     10:   <meta name="generator" content=
1.23      wiz        11:   "DocBook XSL Stylesheets VX.X.X" />
1.1       grant      12:   <meta name="description" content=
                     13:   "Information about using the NetBSD package system (pkgsrc) from both a user view for installing packages as well as from a pkgsrc developers' view for creating new packages." />
                     14:   </head>
                     15: 
                     16: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084"
                     17: alink="#0000FF">
                     18:   <div class="book" lang="en" xml:lang="en">
                     19:     <div class="titlepage">
                     20:       <div>
                     21:         <div>
1.30      wiz        22:           <h1 class="title"><a name="the-pkgsrc-guide" id=
                     23:           "the-pkgsrc-guide"></a>The pkgsrc guide</h1>
1.1       grant      24:         </div>
                     25: 
                     26:         <div>
1.2       hubertf    27:           <h2 class="subtitle">Documentation on the NetBSD packages
1.1       grant      28:           system</h2>
                     29:         </div>
                     30: 
                     31:         <div>
                     32:           <div class="authorgroup">
                     33:             <div class="author">
                     34:               <h3 class="author"><span class=
                     35:               "firstname">Alistair</span> <span class=
                     36:               "surname">Crooks</span></h3>
                     37: 
                     38:               <div class="affiliation">
                     39:                 <div class="address">
1.14      xtraeme    40:                   <p><code class="email">&lt;<a href=
                     41:                   "mailto:agc@NetBSD.org">agc@NetBSD.org</a>&gt;</code></p>
1.1       grant      42:                 </div>
                     43:               </div>
                     44:             </div>
                     45: 
                     46:             <div class="author">
                     47:               <h3 class="author"><span class=
                     48:               "firstname">Hubert</span> <span class=
                     49:               "surname">Feyrer</span></h3>
                     50: 
                     51:               <div class="affiliation">
                     52:                 <div class="address">
1.14      xtraeme    53:                   <p><code class="email">&lt;<a href=
                     54:                   "mailto:hubertf@NetBSD.org">hubertf@NetBSD.org</a>&gt;</code></p>
1.1       grant      55:                 </div>
                     56:               </div>
                     57:             </div>
1.2       hubertf    58: 
1.3       hubertf    59:             <h3 class="corpauthor">The pkgsrc Developers</h3>
1.1       grant      60:           </div>
                     61:         </div>
                     62: 
                     63:         <div>
                     64:           <p class="copyright">Copyright &#169; 1994-2004 The
                     65:           NetBSD Foundation, Inc</p>
                     66:         </div>
                     67: 
1.23      wiz        68:         <div xmlns="http://www.w3.org/TR/xhtml1/transitional">
1.39      dillo      69:           <p xmlns="" class="pubdate">$NetBSD: pkgsrc.xml,v 1.9
                     70:           2005/06/08 13:59:30 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>
                     91:         <dt><span class="chapter"><a href="#introduction">1.
                     92:         Introduction</a></span></dt>
                     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.2       hubertf   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
                    117:             to get pkgsrc</a></span></dt>
                    118: 
                    119:             <dd>
                    120:               <dl>
1.30      wiz       121:                 <dt><span class="sect1"><a href="#as-tar-file">2.1.
1.1       grant     122:                 As tar file</a></span></dt>
                    123: 
1.30      wiz       124:                 <dt><span class="sect1"><a href="#via-sup">2.2. Via
                    125:                 SUP</a></span></dt>
1.1       grant     126: 
1.30      wiz       127:                 <dt><span class="sect1"><a href="#via-cvs">2.3. Via
                    128:                 CVS</a></span></dt>
1.1       grant     129:               </dl>
                    130:             </dd>
                    131: 
                    132:             <dt><span class="chapter"><a href="#platforms">3. Using
                    133:             pkgsrc on systems other than NetBSD</a></span></dt>
                    134: 
                    135:             <dd>
                    136:               <dl>
1.30      wiz       137:                 <dt><span class="sect1"><a href=
                    138:                 "#bootstrapping-pkgsrc">3.1. Bootstrapping
                    139:                 pkgsrc</a></span></dt>
1.1       grant     140: 
1.30      wiz       141:                 <dt><span class="sect1"><a href=
                    142:                 "#platform-specific-notes">3.2. Platform specific
                    143:                 notes</a></span></dt>
1.1       grant     144: 
                    145:                 <dd>
                    146:                   <dl>
                    147:                     <dt><span class="sect2"><a href=
1.30      wiz       148:                     "#darwin">3.2.1. Darwin (Mac OS
1.1       grant     149:                     X)</a></span></dt>
                    150: 
                    151:                     <dt><span class="sect2"><a href=
1.30      wiz       152:                     "#freebsd">3.2.2. FreeBSD</a></span></dt>
1.1       grant     153: 
                    154:                     <dt><span class="sect2"><a href=
1.30      wiz       155:                     "#interix">3.2.3. Interix</a></span></dt>
1.1       grant     156: 
1.30      wiz       157:                     <dt><span class="sect2"><a href="#irix">3.2.4.
                    158:                     IRIX</a></span></dt>
1.1       grant     159: 
1.30      wiz       160:                     <dt><span class="sect2"><a href="#linux">3.2.5.
                    161:                     Linux</a></span></dt>
1.1       grant     162: 
                    163:                     <dt><span class="sect2"><a href=
1.30      wiz       164:                     "#openbsd">3.2.6. OpenBSD</a></span></dt>
1.22      tv        165: 
                    166:                     <dt><span class="sect2"><a href=
1.30      wiz       167:                     "#solaris">3.2.7. Solaris</a></span></dt>
1.1       grant     168:                   </dl>
                    169:                 </dd>
                    170:               </dl>
                    171:             </dd>
                    172: 
                    173:             <dt><span class="chapter"><a href="#using">4. Using
                    174:             pkgsrc</a></span></dt>
                    175: 
                    176:             <dd>
                    177:               <dl>
                    178:                 <dt><span class="sect1"><a href=
                    179:                 "#getting-started">4.1. Working with binary
                    180:                 packages</a></span></dt>
                    181: 
                    182:                 <dd>
                    183:                   <dl>
                    184:                     <dt><span class="sect2"><a href=
1.30      wiz       185:                     "#where-to-get-binary-packages">4.1.1. Where to
                    186:                     get binary packages</a></span></dt>
1.1       grant     187: 
                    188:                     <dt><span class="sect2"><a href=
1.30      wiz       189:                     "#how-to-use-binary-packages">4.1.2. How to use
                    190:                     binary packages</a></span></dt>
1.1       grant     191: 
                    192:                     <dt><span class="sect2"><a href=
1.30      wiz       193:                     "#a-word-of-warning">4.1.3. A word of
1.1       grant     194:                     warning</a></span></dt>
                    195:                   </dl>
                    196:                 </dd>
                    197: 
1.30      wiz       198:                 <dt><span class="sect1"><a href=
                    199:                 "#building-packages-from-source">4.2. Building
                    200:                 packages from source</a></span></dt>
1.1       grant     201: 
                    202:                 <dd>
                    203:                   <dl>
                    204:                     <dt><span class="sect2"><a href=
1.30      wiz       205:                     "#requirements">4.2.1.
1.1       grant     206:                     Requirements</a></span></dt>
                    207: 
                    208:                     <dt><span class="sect2"><a href=
1.30      wiz       209:                     "#fetching-distfiles">4.2.2. Fetching
1.1       grant     210:                     distfiles</a></span></dt>
                    211: 
                    212:                     <dt><span class="sect2"><a href=
1.30      wiz       213:                     "#how-to-build-and-install">4.2.3. How to build
                    214:                     and install</a></span></dt>
1.1       grant     215: 
                    216:                     <dt><span class="sect2"><a href=
1.30      wiz       217:                     "#selecting-the-compiler">4.2.4. Selecting the
1.1       grant     218:                     compiler</a></span></dt>
                    219:                   </dl>
                    220:                 </dd>
                    221:               </dl>
                    222:             </dd>
                    223: 
1.38      dillo     224:             <dt><span class="chapter"><a href="#configuring">5.
                    225:             Configuring pkgsrc</a></span></dt>
                    226: 
                    227:             <dd>
                    228:               <dl>
                    229:                 <dt><span class="sect1"><a href=
1.42      dillo     230:                 "#selecting-options">5.1. Selecting Build
                    231:                 Options</a></span></dt>
1.38      dillo     232:               </dl>
                    233:             </dd>
                    234: 
                    235:             <dt><span class="chapter"><a href="#binary">6. Creating
1.1       grant     236:             binary packages</a></span></dt>
                    237: 
                    238:             <dd>
                    239:               <dl>
1.30      wiz       240:                 <dt><span class="sect1"><a href=
1.38      dillo     241:                 "#building-a-single-binary-package">6.1. Building a
1.30      wiz       242:                 single binary package</a></span></dt>
1.1       grant     243: 
1.30      wiz       244:                 <dt><span class="sect1"><a href=
1.38      dillo     245:                 "#settings-for-creationg-of-binary-packages">6.2.
1.1       grant     246:                 Settings for creation of binary
                    247:                 packages</a></span></dt>
                    248: 
1.38      dillo     249:                 <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1       grant     250:                 Doing a bulk build of all packages</a></span></dt>
                    251: 
                    252:                 <dd>
                    253:                   <dl>
                    254:                     <dt><span class="sect2"><a href=
1.38      dillo     255:                     "#binary.configuration">6.3.1.
1.1       grant     256:                     Configuration</a></span></dt>
                    257: 
                    258:                     <dt><span class="sect2"><a href=
1.38      dillo     259:                     "#other-environmental-considerations">6.3.2.
1.30      wiz       260:                     Other environmental
1.1       grant     261:                     considerations</a></span></dt>
                    262: 
                    263:                     <dt><span class="sect2"><a href=
1.38      dillo     264:                     "#operation">6.3.3. Operation</a></span></dt>
1.1       grant     265: 
                    266:                     <dt><span class="sect2"><a href=
1.38      dillo     267:                     "#what-it-does">6.3.4. What it
1.1       grant     268:                     does</a></span></dt>
                    269: 
                    270:                     <dt><span class="sect2"><a href=
1.38      dillo     271:                     "#disk-space-requirements">6.3.5. Disk space
1.1       grant     272:                     requirements</a></span></dt>
                    273: 
                    274:                     <dt><span class="sect2"><a href=
1.38      dillo     275:                     "#setting-up-a-sandbox">6.3.6. Setting up a
1.30      wiz       276:                     sandbox for chroot'ed builds</a></span></dt>
1.1       grant     277: 
                    278:                     <dt><span class="sect2"><a href=
1.38      dillo     279:                     "#building-a-partial-set">6.3.7. Building a
1.30      wiz       280:                     partial set of packages</a></span></dt>
1.13      hubertf   281: 
                    282:                     <dt><span class="sect2"><a href=
1.38      dillo     283:                     "#bulk-upload">6.3.8. Uploading results of a
1.13      hubertf   284:                     bulk build</a></span></dt>
1.1       grant     285:                   </dl>
                    286:                 </dd>
                    287: 
1.30      wiz       288:                 <dt><span class="sect1"><a href=
1.38      dillo     289:                 "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30      wiz       290:                 packages collection</a></span></dt>
1.1       grant     291: 
                    292:                 <dd>
                    293:                   <dl>
                    294:                     <dt><span class="sect2"><a href=
1.38      dillo     295:                     "#cdpack-example">6.4.1. Example of
1.1       grant     296:                     cdpack</a></span></dt>
                    297:                   </dl>
                    298:                 </dd>
                    299:               </dl>
                    300:             </dd>
                    301: 
1.38      dillo     302:             <dt><span class="chapter"><a href="#faq">7. Frequently
1.1       grant     303:             Asked Questions</a></span></dt>
                    304: 
                    305:             <dd>
                    306:               <dl>
1.30      wiz       307:                 <dt><span class="sect1"><a href=
1.38      dillo     308:                 "#mailing-list-pointers">7.1. Are there any mailing
1.30      wiz       309:                 lists for pkg-related discussion?</a></span></dt>
1.1       grant     310: 
1.30      wiz       311:                 <dt><span class="sect1"><a href=
1.38      dillo     312:                 "#pkgviews-docs">7.2. Where's the pkgviews
1.30      wiz       313:                 documentation?</a></span></dt>
1.1       grant     314: 
1.5       hubertf   315:                 <dt><span class="sect1"><a href=
1.38      dillo     316:                 "#faq-pkgtools">7.3. Utilities for package
1.5       hubertf   317:                 management (pkgtools)</a></span></dt>
1.1       grant     318: 
1.30      wiz       319:                 <dt><span class="sect1"><a href=
1.38      dillo     320:                 "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30      wiz       321:                 non-root</a></span></dt>
                    322: 
                    323:                 <dt><span class="sect1"><a href=
1.38      dillo     324:                 "#resume-transfers">7.5. How to resume transfers
1.30      wiz       325:                 when fetching distfiles?</a></span></dt>
                    326: 
                    327:                 <dt><span class="sect1"><a href=
1.38      dillo     328:                 "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30      wiz       329:                 XFree86 from pkgsrc?</a></span></dt>
                    330: 
                    331:                 <dt><span class="sect1"><a href=
1.38      dillo     332:                 "#x.org-from-pkgsrc">7.7. How can I install/use
1.30      wiz       333:                 X.org from pkgsrc?</a></span></dt>
1.1       grant     334: 
1.30      wiz       335:                 <dt><span class="sect1"><a href=
1.38      dillo     336:                 "#fetch-behind-firewall">7.8. How to fetch files
1.30      wiz       337:                 from behind a firewall</a></span></dt>
1.1       grant     338: 
1.38      dillo     339:                 <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.14      xtraeme   340:                 How do I tell <span><strong class="command">make
                    341:                 fetch</strong></span> to do passive
1.1       grant     342:                 FTP?</a></span></dt>
                    343: 
1.30      wiz       344:                 <dt><span class="sect1"><a href=
1.38      dillo     345:                 "#fetching-all-distfiles">7.10. How to fetch all
1.30      wiz       346:                 distfiles at once</a></span></dt>
1.1       grant     347: 
1.30      wiz       348:                 <dt><span class="sect1"><a href=
1.38      dillo     349:                 "#tmac.andoc-missing">7.11. What does
1.30      wiz       350:                 &#8220;<span class="quote">Don't know how to make
                    351:                 /usr/share/tmac/tmac.andoc</span>&#8221;
1.14      xtraeme   352:                 mean?</a></span></dt>
1.13      hubertf   353: 
1.30      wiz       354:                 <dt><span class="sect1"><a href=
1.38      dillo     355:                 "#bsd.own.mk-missing">7.12. What does
1.30      wiz       356:                 &#8220;<span class="quote">Could not find
1.14      xtraeme   357:                 bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant     358: 
1.30      wiz       359:                 <dt><span class="sect1"><a href=
1.38      dillo     360:                 "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30      wiz       361:                 pkgsrc</a></span></dt>
1.1       grant     362: 
1.38      dillo     363:                 <dt><span class="sect1"><a href="#faq.conf">7.14.
1.35      jmmv      364:                 How do I change the location of configuration
                    365:                 files?</a></span></dt>
1.1       grant     366: 
                    367:                 <dt><span class="sect1"><a href=
1.38      dillo     368:                 "#audit-packages">7.15. Automated security
1.1       grant     369:                 checks</a></span></dt>
                    370:               </dl>
                    371:             </dd>
                    372:           </dl>
                    373:         </dd>
                    374: 
1.2       hubertf   375:         <dt><span class="part"><a href="#developers-guide">II. The
1.1       grant     376:         pkgsrc developer's guide</a></span></dt>
                    377: 
                    378:         <dd>
                    379:           <dl>
1.38      dillo     380:             <dt><span class="chapter"><a href="#components">8.
1.27      rillig    381:             Package components - files, directories and
                    382:             contents</a></span></dt>
                    383: 
                    384:             <dd>
                    385:               <dl>
                    386:                 <dt><span class="sect1"><a href=
1.38      dillo     387:                 "#components.Makefile">8.1. <code class=
1.27      rillig    388:                 "filename">Makefile</code></a></span></dt>
                    389: 
                    390:                 <dt><span class="sect1"><a href=
1.38      dillo     391:                 "#components.distinfo">8.2. <code class=
1.27      rillig    392:                 "filename">distinfo</code></a></span></dt>
                    393: 
                    394:                 <dt><span class="sect1"><a href=
1.38      dillo     395:                 "#components.patches">8.3.
1.27      rillig    396:                 patches/*</a></span></dt>
                    397: 
1.30      wiz       398:                 <dt><span class="sect1"><a href=
1.38      dillo     399:                 "#other-mandatory-files">8.4. Other mandatory
1.30      wiz       400:                 files</a></span></dt>
1.27      rillig    401: 
                    402:                 <dt><span class="sect1"><a href=
1.38      dillo     403:                 "#components.optional">8.5. Optional
1.27      rillig    404:                 files</a></span></dt>
                    405: 
1.38      dillo     406:                 <dt><span class="sect1"><a href="#work-dir">8.6.
1.27      rillig    407:                 <code class="filename">work*</code></a></span></dt>
                    408: 
1.38      dillo     409:                 <dt><span class="sect1"><a href="#files-dir">8.7.
1.27      rillig    410:                 <code class=
                    411:                 "filename">files/*</code></a></span></dt>
                    412:               </dl>
                    413:             </dd>
                    414: 
1.38      dillo     415:             <dt><span class="chapter"><a href="#makefile">9.
1.25      rillig    416:             Programming in <code class=
                    417:             "filename">Makefile</code>s</a></span></dt>
                    418: 
                    419:             <dd>
                    420:               <dl>
                    421:                 <dt><span class="sect1"><a href=
1.38      dillo     422:                 "#makefile.variables">9.1. <code class=
1.25      rillig    423:                 "filename">Makefile</code>
                    424:                 variables</a></span></dt>
                    425: 
1.27      rillig    426:                 <dd>
                    427:                   <dl>
                    428:                     <dt><span class="sect2"><a href=
1.38      dillo     429:                     "#makefile.variables.names">9.1.1. Naming
1.27      rillig    430:                     conventions</a></span></dt>
                    431:                   </dl>
                    432:                 </dd>
                    433: 
1.25      rillig    434:                 <dt><span class="sect1"><a href=
1.38      dillo     435:                 "#makefile.code">9.2. Code snippets</a></span></dt>
1.25      rillig    436: 
                    437:                 <dd>
                    438:                   <dl>
                    439:                     <dt><span class="sect2"><a href=
1.38      dillo     440:                     "#adding-to-list">9.2.1. Adding things to a
1.25      rillig    441:                     list</a></span></dt>
                    442: 
                    443:                     <dt><span class="sect2"><a href=
1.38      dillo     444:                     "#converting-internal-to-external">9.2.2.
1.30      wiz       445:                     Converting an internal list into an external
                    446:                     list</a></span></dt>
1.25      rillig    447: 
                    448:                     <dt><span class="sect2"><a href=
1.38      dillo     449:                     "#passing-variable-to-shell">9.2.3. Passing
1.30      wiz       450:                     variables to a shell command</a></span></dt>
1.27      rillig    451: 
                    452:                     <dt><span class="sect2"><a href=
1.38      dillo     453:                     "#quoting-guideline">9.2.4. Quoting
1.27      rillig    454:                     guideline</a></span></dt>
                    455: 
                    456:                     <dt><span class="sect2"><a href=
1.38      dillo     457:                     "#bsd-make-bug-workaround">9.2.5. Workaround
1.30      wiz       458:                     for a bug in BSD Make</a></span></dt>
1.25      rillig    459:                   </dl>
                    460:                 </dd>
                    461:               </dl>
                    462:             </dd>
                    463: 
1.38      dillo     464:             <dt><span class="chapter"><a href="#plist">10. PLIST
1.1       grant     465:             issues</a></span></dt>
                    466: 
                    467:             <dd>
                    468:               <dl>
1.38      dillo     469:                 <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.30      wiz       470:                 ID</a></span></dt>
1.1       grant     471: 
1.30      wiz       472:                 <dt><span class="sect1"><a href=
1.38      dillo     473:                 "#automatic-plist-generation">10.2. Semi-automatic
1.30      wiz       474:                 <code class="filename">PLIST</code>
1.14      xtraeme   475:                 generation</a></span></dt>
1.1       grant     476: 
1.38      dillo     477:                 <dt><span class="sect1"><a href=
                    478:                 "#print-PLIST">10.3. Tweaking output of
                    479:                 <span><strong class="command">make
1.14      xtraeme   480:                 print-PLIST</strong></span></a></span></dt>
1.1       grant     481: 
1.38      dillo     482:                 <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1       grant     483:                 Variable substitution in PLIST</a></span></dt>
                    484: 
1.30      wiz       485:                 <dt><span class="sect1"><a href=
1.38      dillo     486:                 "#manpage-compression">10.5.
1.1       grant     487:                 Manpage-compression</a></span></dt>
                    488: 
1.30      wiz       489:                 <dt><span class="sect1"><a href=
1.38      dillo     490:                 "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30      wiz       491:                 <code class=
1.14      xtraeme   492:                 "varname">PLIST_SRC</code></a></span></dt>
1.1       grant     493: 
1.30      wiz       494:                 <dt><span class="sect1"><a href=
1.38      dillo     495:                 "#platform-specific-plist">10.7. Platform specific
1.30      wiz       496:                 and differing PLISTs</a></span></dt>
1.1       grant     497: 
                    498:                 <dt><span class="sect1"><a href=
1.38      dillo     499:                 "#faq.common-dirs">10.8. Sharing directories
                    500:                 between packages</a></span></dt>
1.1       grant     501:               </dl>
                    502:             </dd>
                    503: 
1.38      dillo     504:             <dt><span class="chapter"><a href="#buildlink">11.
1.1       grant     505:             Buildlink methodology</a></span></dt>
                    506: 
                    507:             <dd>
                    508:               <dl>
1.30      wiz       509:                 <dt><span class="sect1"><a href=
1.38      dillo     510:                 "#converting-to-buildlink3">11.1. Converting
1.30      wiz       511:                 packages to use buildlink3</a></span></dt>
1.1       grant     512: 
1.30      wiz       513:                 <dt><span class="sect1"><a href=
1.38      dillo     514:                 "#creating-buildlink3.mk">11.2. Writing
1.30      wiz       515:                 <code class="filename">buildlink3.mk</code>
1.14      xtraeme   516:                 files</a></span></dt>
1.1       grant     517: 
                    518:                 <dd>
                    519:                   <dl>
                    520:                     <dt><span class="sect2"><a href=
1.38      dillo     521:                     "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30      wiz       522:                     buildlink3.mk file</a></span></dt>
1.1       grant     523: 
                    524:                     <dt><span class="sect2"><a href=
1.38      dillo     525:                     "#updating-buildlink-depends">11.2.2. Updating
1.30      wiz       526:                     <code class=
1.14      xtraeme   527:                     "varname">BUILDLINK_DEPENDS.<em class=
                    528:                     "replaceable"><code>pkg</code></em></code> in
                    529:                     <code class="filename">buildlink3.mk</code>
1.1       grant     530:                     files</a></span></dt>
                    531:                   </dl>
                    532:                 </dd>
                    533: 
1.30      wiz       534:                 <dt><span class="sect1"><a href=
1.38      dillo     535:                 "#writing-builtin.mk">11.3. Writing <code class=
1.30      wiz       536:                 "filename">builtin.mk</code> files</a></span></dt>
1.1       grant     537: 
                    538:                 <dd>
                    539:                   <dl>
                    540:                     <dt><span class="sect2"><a href=
1.38      dillo     541:                     "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.30      wiz       542:                     <code class="filename">builtin.mk</code>
1.1       grant     543:                     file</a></span></dt>
                    544: 
                    545:                     <dt><span class="sect2"><a href=
1.38      dillo     546:                     "#native-or-pkgsrc-preference">11.3.2. Global
1.30      wiz       547:                     preferences for native or pkgsrc
                    548:                     software</a></span></dt>
1.1       grant     549:                   </dl>
                    550:                 </dd>
                    551:               </dl>
                    552:             </dd>
                    553: 
1.38      dillo     554:             <dt><span class="chapter"><a href="#pkginstall">12. The
1.35      jmmv      555:             pkginstall framework</a></span></dt>
                    556: 
                    557:             <dd>
                    558:               <dl>
                    559:                 <dt><span class="sect1"><a href=
1.38      dillo     560:                 "#files-and-dirs-outside-prefix">12.1. Files and
1.35      jmmv      561:                 directories outside the installation
                    562:                 prefix</a></span></dt>
                    563: 
                    564:                 <dd>
                    565:                   <dl>
                    566:                     <dt><span class="sect2"><a href=
1.38      dillo     567:                     "#dirs-outside-prefix">12.1.1. Directory
1.35      jmmv      568:                     manipulation</a></span></dt>
                    569: 
                    570:                     <dt><span class="sect2"><a href=
1.38      dillo     571:                     "#files-outside-prefix">12.1.2. File
1.35      jmmv      572:                     manipulation</a></span></dt>
                    573:                   </dl>
                    574:                 </dd>
                    575: 
1.38      dillo     576:                 <dt><span class="sect1"><a href="#conf-files">12.2.
1.35      jmmv      577:                 Configuration files</a></span></dt>
                    578: 
                    579:                 <dd>
                    580:                   <dl>
                    581:                     <dt><span class="sect2"><a href=
1.38      dillo     582:                     "#conf-files-sysconfdir">12.2.1. How
1.35      jmmv      583:                     <code class="varname">PKG_SYSCONFDIR</code> is
                    584:                     set</a></span></dt>
                    585: 
                    586:                     <dt><span class="sect2"><a href=
1.38      dillo     587:                     "#conf-files-configure">12.2.2. Telling the
1.35      jmmv      588:                     software were configuration files
                    589:                     are</a></span></dt>
                    590: 
                    591:                     <dt><span class="sect2"><a href=
1.38      dillo     592:                     "#conf-files-patching">12.2.3. Patching
1.35      jmmv      593:                     installations</a></span></dt>
                    594: 
                    595:                     <dt><span class="sect2"><a href=
1.38      dillo     596:                     "#conf-files-disable">12.2.4. Disabling
1.35      jmmv      597:                     handling of configuration files</a></span></dt>
                    598:                   </dl>
                    599:                 </dd>
                    600: 
                    601:                 <dt><span class="sect1"><a href=
1.38      dillo     602:                 "#rcd-scripts">12.3. System startup
1.35      jmmv      603:                 scripts</a></span></dt>
                    604: 
                    605:                 <dd>
                    606:                   <dl>
                    607:                     <dt><span class="sect2"><a href=
1.38      dillo     608:                     "#rcd-scripts-disable">12.3.1. Disabling
1.35      jmmv      609:                     handling of system startup
                    610:                     scripts</a></span></dt>
                    611:                   </dl>
                    612:                 </dd>
                    613: 
                    614:                 <dt><span class="sect1"><a href=
1.38      dillo     615:                 "#users-and-groups">12.4. System users and
1.35      jmmv      616:                 groups</a></span></dt>
                    617: 
1.38      dillo     618:                 <dt><span class="sect1"><a href="#shells">12.5.
1.35      jmmv      619:                 System shells</a></span></dt>
                    620: 
                    621:                 <dd>
                    622:                   <dl>
                    623:                     <dt><span class="sect2"><a href=
1.38      dillo     624:                     "#shells-disable">12.5.1. Disabling handling of
1.35      jmmv      625:                     configuration files</a></span></dt>
                    626:                   </dl>
                    627:                 </dd>
                    628:               </dl>
                    629:             </dd>
                    630: 
1.38      dillo     631:             <dt><span class="chapter"><a href="#options">13.
1.1       grant     632:             Options handling</a></span></dt>
                    633: 
                    634:             <dd>
                    635:               <dl>
1.30      wiz       636:                 <dt><span class="sect1"><a href=
1.38      dillo     637:                 "#global-default-options">13.1. Global default
1.30      wiz       638:                 options</a></span></dt>
1.1       grant     639: 
1.30      wiz       640:                 <dt><span class="sect1"><a href=
1.38      dillo     641:                 "#converting-to-options">13.2. Converting packages
1.30      wiz       642:                 to use <code class=
1.14      xtraeme   643:                 "filename">bsd.options.mk</code></a></span></dt>
1.1       grant     644:               </dl>
                    645:             </dd>
                    646: 
1.38      dillo     647:             <dt><span class="chapter"><a href="#build">14. The
1.1       grant     648:             build process</a></span></dt>
                    649: 
                    650:             <dd>
                    651:               <dl>
                    652:                 <dt><span class="sect1"><a href=
1.38      dillo     653:                 "#build.prefix">14.1. Program
1.1       grant     654:                 location</a></span></dt>
                    655: 
1.30      wiz       656:                 <dt><span class="sect1"><a href=
1.38      dillo     657:                 "#main-targets">14.2. Main targets</a></span></dt>
1.1       grant     658: 
                    659:                 <dt><span class="sect1"><a href=
1.38      dillo     660:                 "#build.helpful-targets">14.3. Other helpful
1.1       grant     661:                 targets</a></span></dt>
                    662:               </dl>
                    663:             </dd>
                    664: 
1.38      dillo     665:             <dt><span class="chapter"><a href="#fixes">15. Notes on
1.1       grant     666:             fixes for packages</a></span></dt>
                    667: 
                    668:             <dd>
                    669:               <dl>
1.30      wiz       670:                 <dt><span class="sect1"><a href=
1.38      dillo     671:                 "#general-operation">15.1. General
1.30      wiz       672:                 operation</a></span></dt>
1.1       grant     673: 
                    674:                 <dd>
                    675:                   <dl>
                    676:                     <dt><span class="sect2"><a href=
1.38      dillo     677:                     "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30      wiz       678:                     pull in variables from
                    679:                     /etc/mk.conf</a></span></dt>
1.1       grant     680: 
                    681:                     <dt><span class="sect2"><a href=
1.38      dillo     682:                     "#where-to-install-documentation">15.1.2. Where
1.31      wiz       683:                     to install documentation</a></span></dt>
                    684: 
                    685:                     <dt><span class="sect2"><a href=
1.38      dillo     686:                     "#restricted-packages">15.1.3. Restricted
1.1       grant     687:                     packages</a></span></dt>
                    688: 
                    689:                     <dt><span class="sect2"><a href=
1.38      dillo     690:                     "#dependencies">15.1.4. Handling
1.1       grant     691:                     dependencies</a></span></dt>
                    692: 
                    693:                     <dt><span class="sect2"><a href=
1.38      dillo     694:                     "#conflicts">15.1.5. Handling conflicts with
1.1       grant     695:                     other packages</a></span></dt>
                    696: 
                    697:                     <dt><span class="sect2"><a href=
1.38      dillo     698:                     "#not-building-packages">15.1.6. Packages that
1.30      wiz       699:                     cannot or should not be built</a></span></dt>
1.1       grant     700: 
                    701:                     <dt><span class="sect2"><a href=
1.38      dillo     702:                     "#undeletable-packages">15.1.7. Packages which
1.30      wiz       703:                     should not be deleted, once
                    704:                     installed</a></span></dt>
1.1       grant     705: 
                    706:                     <dt><span class="sect2"><a href=
1.38      dillo     707:                     "#security-handling">15.1.8. Handling packages
1.1       grant     708:                     with security problems</a></span></dt>
                    709: 
                    710:                     <dt><span class="sect2"><a href=
1.38      dillo     711:                     "#compiler-bugs">15.1.9. How to handle compiler
1.1       grant     712:                     bugs</a></span></dt>
                    713: 
                    714:                     <dt><span class="sect2"><a href=
1.38      dillo     715:                     "#bumping-pkgrevision">15.1.10. How to handle
1.30      wiz       716:                     incrementing versions when fixing an existing
1.1       grant     717:                     package</a></span></dt>
                    718: 
                    719:                     <dt><span class="sect2"><a href=
1.38      dillo     720:                     "#portability-of-packages">15.1.11. Portability
1.30      wiz       721:                     of packages</a></span></dt>
1.1       grant     722:                   </dl>
                    723:                 </dd>
                    724: 
1.30      wiz       725:                 <dt><span class="sect1"><a href=
1.38      dillo     726:                 "#downloading-issues">15.2. Possible downloading
1.30      wiz       727:                 issues</a></span></dt>
1.1       grant     728: 
                    729:                 <dd>
                    730:                   <dl>
                    731:                     <dt><span class="sect2"><a href=
1.38      dillo     732:                     "#no-plain-download">15.2.1. Packages whose
1.30      wiz       733:                     distfiles aren't available for plain
1.1       grant     734:                     downloading</a></span></dt>
                    735: 
                    736:                     <dt><span class="sect2"><a href=
1.38      dillo     737:                     "#modified-distfiles-same-name">15.2.2. How to
1.30      wiz       738:                     handle modified distfiles with the 'old'
                    739:                     name</a></span></dt>
1.1       grant     740:                   </dl>
                    741:                 </dd>
                    742: 
1.30      wiz       743:                 <dt><span class="sect1"><a href=
1.38      dillo     744:                 "#configuration-gotchas">15.3. Configuration
1.30      wiz       745:                 gotchas</a></span></dt>
1.1       grant     746: 
                    747:                 <dd>
                    748:                   <dl>
                    749:                     <dt><span class="sect2"><a href=
1.38      dillo     750:                     "#fixes.libtool">15.3.1. Shared libraries -
1.1       grant     751:                     libtool</a></span></dt>
                    752: 
                    753:                     <dt><span class="sect2"><a href=
1.38      dillo     754:                     "#using-libtool">15.3.2. Using libtool on GNU
1.1       grant     755:                     packages that already support
                    756:                     libtool</a></span></dt>
                    757: 
                    758:                     <dt><span class="sect2"><a href=
1.38      dillo     759:                     "#autoconf-automake">15.3.3. GNU
1.1       grant     760:                     Autoconf/Automake</a></span></dt>
                    761:                   </dl>
                    762:                 </dd>
                    763: 
1.30      wiz       764:                 <dt><span class="sect1"><a href=
1.38      dillo     765:                 "#building-considerations">15.4. Building
1.30      wiz       766:                 considerations</a></span></dt>
1.1       grant     767: 
                    768:                 <dd>
                    769:                   <dl>
                    770:                     <dt><span class="sect2"><a href=
1.38      dillo     771:                     "#cpp-defines">15.4.1. CPP
1.1       grant     772:                     defines</a></span></dt>
                    773:                   </dl>
                    774:                 </dd>
                    775: 
1.30      wiz       776:                 <dt><span class="sect1"><a href=
1.38      dillo     777:                 "#package-specific-actions">15.5. Package specific
1.30      wiz       778:                 actions</a></span></dt>
1.1       grant     779: 
                    780:                 <dd>
                    781:                   <dl>
                    782:                     <dt><span class="sect2"><a href=
1.38      dillo     783:                     "#user-interaction">15.5.1. User
1.2       hubertf   784:                     interaction</a></span></dt>
1.1       grant     785: 
                    786:                     <dt><span class="sect2"><a href=
1.38      dillo     787:                     "#handling-licenses">15.5.2. Handling
1.1       grant     788:                     licenses</a></span></dt>
                    789: 
                    790:                     <dt><span class="sect2"><a href=
1.38      dillo     791:                     "#installing-score-files">15.5.3. Installing
1.30      wiz       792:                     score files</a></span></dt>
1.1       grant     793: 
                    794:                     <dt><span class="sect2"><a href=
1.38      dillo     795:                     "#perl-scripts">15.5.4. Packages containing
1.30      wiz       796:                     perl scripts</a></span></dt>
1.1       grant     797: 
                    798:                     <dt><span class="sect2"><a href=
1.38      dillo     799:                     "#hardcoded-paths">15.5.5. Packages with
1.30      wiz       800:                     hardcoded paths to other
                    801:                     interpreters</a></span></dt>
1.1       grant     802: 
                    803:                     <dt><span class="sect2"><a href=
1.38      dillo     804:                     "#perl-modules">15.5.6. Packages installing
1.30      wiz       805:                     perl modules</a></span></dt>
1.1       grant     806: 
                    807:                     <dt><span class="sect2"><a href=
1.38      dillo     808:                     "#faq.info-files">15.5.7. Packages installing
1.1       grant     809:                     info files</a></span></dt>
                    810: 
                    811:                     <dt><span class="sect2"><a href=
1.38      dillo     812:                     "#gconf2-data-files">15.5.8. Packages
1.30      wiz       813:                     installing GConf2 data files</a></span></dt>
1.1       grant     814: 
                    815:                     <dt><span class="sect2"><a href=
1.38      dillo     816:                     "#scrollkeeper-data-files">15.5.9. Packages
1.30      wiz       817:                     installing scrollkeeper data
                    818:                     files</a></span></dt>
1.1       grant     819: 
                    820:                     <dt><span class="sect2"><a href=
1.38      dillo     821:                     "#x11-fonts">15.5.10. Packages installing X11
1.1       grant     822:                     fonts</a></span></dt>
                    823: 
                    824:                     <dt><span class="sect2"><a href=
1.38      dillo     825:                     "#gtk2-modules">15.5.11. Packages installing
1.30      wiz       826:                     GTK2 modules</a></span></dt>
1.1       grant     827: 
                    828:                     <dt><span class="sect2"><a href=
1.38      dillo     829:                     "#sgml-xml-data">15.5.12. Packages installing
1.30      wiz       830:                     SGML or XML data</a></span></dt>
1.1       grant     831: 
                    832:                     <dt><span class="sect2"><a href=
1.38      dillo     833:                     "#mime-database">15.5.13. Packages installing
1.1       grant     834:                     extensions to the MIME database</a></span></dt>
                    835: 
                    836:                     <dt><span class="sect2"><a href=
1.38      dillo     837:                     "#intltool">15.5.14. Packages using
1.1       grant     838:                     intltool</a></span></dt>
1.18      xtraeme   839: 
                    840:                     <dt><span class="sect2"><a href=
1.38      dillo     841:                     "#startup-scripts">15.5.15. Packages installing
1.18      xtraeme   842:                     startup scripts</a></span></dt>
1.1       grant     843:                   </dl>
                    844:                 </dd>
                    845: 
1.30      wiz       846:                 <dt><span class="sect1"><a href=
1.38      dillo     847:                 "#feedback-to-author">15.6. Feedback to the
1.30      wiz       848:                 author</a></span></dt>
1.1       grant     849:               </dl>
                    850:             </dd>
                    851: 
1.38      dillo     852:             <dt><span class="chapter"><a href="#debug">16.
1.1       grant     853:             Debugging</a></span></dt>
                    854: 
1.38      dillo     855:             <dt><span class="chapter"><a href="#submit">17.
1.1       grant     856:             Submitting and Committing</a></span></dt>
                    857: 
                    858:             <dd>
                    859:               <dl>
1.30      wiz       860:                 <dt><span class="sect1"><a href=
1.38      dillo     861:                 "#submitting-your-package">17.1. Submitting your
1.30      wiz       862:                 packages</a></span></dt>
1.1       grant     863: 
1.30      wiz       864:                 <dt><span class="sect1"><a href=
1.41      wiz       865:                 "#general-notes-for-changes">17.2. General notes
                    866:                 when adding, updating, or removing
                    867:                 packages</a></span></dt>
                    868: 
                    869:                 <dt><span class="sect1"><a href=
                    870:                 "#committing-importing">17.3. Committing: Importing
1.30      wiz       871:                 a package into CVS</a></span></dt>
1.1       grant     872: 
1.30      wiz       873:                 <dt><span class="sect1"><a href=
1.41      wiz       874:                 "#updating-package">17.4. Updating a package to a
1.30      wiz       875:                 newer version</a></span></dt>
1.1       grant     876: 
1.30      wiz       877:                 <dt><span class="sect1"><a href=
1.41      wiz       878:                 "#moving-package">17.5. Moving a package in
1.30      wiz       879:                 pkgsrc</a></span></dt>
1.1       grant     880:               </dl>
                    881:             </dd>
                    882:           </dl>
                    883:         </dd>
                    884: 
                    885:         <dt><span class="appendix"><a href="#examples">A. A simple
                    886:         example package: bison</a></span></dt>
                    887: 
                    888:         <dd>
                    889:           <dl>
1.30      wiz       890:             <dt><span class="sect1"><a href="#example-files">A.1.
1.1       grant     891:             files</a></span></dt>
                    892: 
                    893:             <dd>
                    894:               <dl>
1.30      wiz       895:                 <dt><span class="sect2"><a href=
                    896:                 "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1       grant     897: 
1.30      wiz       898:                 <dt><span class="sect2"><a href=
                    899:                 "#example-descr">A.1.2. DESCR</a></span></dt>
1.1       grant     900: 
1.30      wiz       901:                 <dt><span class="sect2"><a href=
                    902:                 "#example-plist">A.1.3. PLIST</a></span></dt>
1.1       grant     903: 
1.30      wiz       904:                 <dt><span class="sect2"><a href=
                    905:                 "#checking-package-with-pkglint">A.1.4. Checking a
                    906:                 package with <span><strong class=
1.14      xtraeme   907:                 "command">pkglint</strong></span></a></span></dt>
1.1       grant     908:               </dl>
                    909:             </dd>
                    910: 
1.30      wiz       911:             <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
                    912:             Steps for building, installing,
                    913:             packaging</a></span></dt>
1.1       grant     914:           </dl>
                    915:         </dd>
                    916: 
                    917:         <dt><span class="appendix"><a href="#logs">B. Build
                    918:         logs</a></span></dt>
                    919: 
                    920:         <dd>
                    921:           <dl>
                    922:             <dt><span class="sect1"><a href="#logs.building">B.1.
                    923:             Building figlet</a></span></dt>
                    924: 
                    925:             <dt><span class="sect1"><a href="#logs.package">B.2.
                    926:             Packaging figlet</a></span></dt>
                    927:           </dl>
                    928:         </dd>
                    929: 
                    930:         <dt><span class="appendix"><a href="#ftp-layout">C. Layout
                    931:         of the FTP server's package archive</a></span></dt>
1.2       hubertf   932: 
                    933:         <dt><span class="appendix"><a href="#editing">D. Editing
                    934:         guidelines for the pkgsrc guide</a></span></dt>
                    935: 
                    936:         <dd>
                    937:           <dl>
1.30      wiz       938:             <dt><span class="sect1"><a href="#targets">D.1.
1.2       hubertf   939:             Targets</a></span></dt>
                    940: 
1.30      wiz       941:             <dt><span class="sect1"><a href="#procedure">D.2.
1.2       hubertf   942:             Procedure</a></span></dt>
                    943:           </dl>
                    944:         </dd>
1.1       grant     945:       </dl>
                    946:     </div>
                    947: 
                    948:     <div class="chapter" lang="en" xml:lang="en">
                    949:       <div class="titlepage">
                    950:         <div>
                    951:           <div>
                    952:             <h2 class="title"><a name="introduction" id=
                    953:             "introduction"></a>Chapter&nbsp;1.&nbsp;Introduction</h2>
                    954:           </div>
                    955:         </div>
                    956:       </div>
                    957: 
                    958:       <div class="toc">
                    959:         <p><b>Table of Contents</b></p>
                    960: 
                    961:         <dl>
1.30      wiz       962:           <dt><span class="sect1"><a href=
                    963:           "#introduction-section">1.1. Introduction</a></span></dt>
1.1       grant     964: 
                    965:           <dt><span class="sect1"><a href="#overview">1.2.
                    966:           Overview</a></span></dt>
                    967: 
                    968:           <dt><span class="sect1"><a href="#terminology">1.3.
                    969:           Terminology</a></span></dt>
                    970: 
                    971:           <dt><span class="sect1"><a href="#typography">1.4.
                    972:           Typography</a></span></dt>
                    973:         </dl>
                    974:       </div>
                    975: 
                    976:       <div class="sect1" lang="en" xml:lang="en">
                    977:         <div class="titlepage">
                    978:           <div>
                    979:             <div>
                    980:               <h2 class="title" style="clear: both"><a name=
1.30      wiz       981:               "introduction-section" id=
                    982:               "introduction-section"></a>1.1.&nbsp;Introduction</h2>
1.1       grant     983:             </div>
                    984:           </div>
                    985:         </div>
                    986: 
                    987:         <p>There is a lot of software freely available for Unix
                    988:         based systems, which usually runs on NetBSD and other
                    989:         Unix-flavoured systems, too, sometimes with some
                    990:         modifications. The NetBSD Packages Collection (pkgsrc)
                    991:         incorporates any such changes necessary to make that
                    992:         software run, and makes the installation (and
                    993:         de-installation) of the software package easy by means of a
                    994:         single command.</p>
                    995: 
                    996:         <p>Once the software has been built, it is manipulated with
1.14      xtraeme   997:         the <span><strong class="command">pkg_*</strong></span>
                    998:         tools so that installation and de-installation, printing of
                    999:         an inventory of all installed packages and retrieval of
                   1000:         one-line comments or more verbose descriptions are all
                   1001:         simple.</p>
1.1       grant    1002: 
                   1003:         <p>pkgsrc currently contains several thousand packages,
                   1004:         including:</p>
                   1005: 
                   1006:         <div class="itemizedlist">
                   1007:           <ul type="disc">
                   1008:             <li>
                   1009:               <p><a xmlns=
                   1010:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1011:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.20      ben      1012:               class="pkgname">www/apache</a> - The Apache web
                   1013:               server</p>
1.1       grant    1014:             </li>
                   1015: 
                   1016:             <li>
                   1017:               <p><a xmlns=
                   1018:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1019:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20      ben      1020:               class="pkgname">www/mozilla</a> - The Mozilla web
                   1021:               browser</p>
1.1       grant    1022:             </li>
                   1023: 
                   1024:             <li>
                   1025:               <p><a xmlns=
                   1026:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1027:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.20      ben      1028:               class="pkgname">meta-pkgs/gnome</a> - The GNOME
                   1029:               Desktop Environment</p>
1.1       grant    1030:             </li>
                   1031: 
                   1032:             <li>
                   1033:               <p><a xmlns=
                   1034:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1035:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.20      ben      1036:               class="pkgname">meta-pkgs/kde3</a> - The K Desktop
                   1037:               Environment</p>
1.1       grant    1038:             </li>
                   1039:           </ul>
                   1040:         </div>
                   1041: 
                   1042:         <p>...just to name a few.</p>
                   1043: 
                   1044:         <p>pkgsrc has built-in support for handling varying
                   1045:         dependencies, such as pthreads and X11, and extended
                   1046:         features such as IPv6 support on a range of platforms.</p>
                   1047: 
                   1048:         <p>pkgsrc was derived from FreeBSD's ports system, and
                   1049:         initially developed for NetBSD only. Since then, pkgsrc has
                   1050:         grown a lot, and now supports the following platforms:</p>
                   1051: 
                   1052:         <div class="itemizedlist">
                   1053:           <ul type="disc">
                   1054:             <li>
                   1055:               <p><a href="http://developer.apple.com/darwin/"
                   1056:               target="_top">Darwin</a> (<a href=
                   1057:               "http://www.apple.com/macosx/" target="_top">Mac OS
                   1058:               X</a>)</p>
                   1059:             </li>
                   1060: 
                   1061:             <li>
1.3       hubertf  1062:               <p><a href="http://www.DragonFlyBSD.org/" target=
                   1063:               "_top">DragonFlyBSD</a></p>
                   1064:             </li>
                   1065: 
                   1066:             <li>
1.1       grant    1067:               <p><a href="http://www.FreeBSD.org/" target=
                   1068:               "_top">FreeBSD</a></p>
                   1069:             </li>
                   1070: 
                   1071:             <li>
1.3       hubertf  1072:               <p>Microsoft Windows, via <a href=
                   1073:               "http://www.microsoft.com/windows/sfu/" target=
                   1074:               "_top">Interix</a></p>
1.1       grant    1075:             </li>
                   1076: 
                   1077:             <li>
                   1078:               <p><a href="http://www.sgi.com/software/irix6.5/"
                   1079:               target="_top">IRIX</a></p>
                   1080:             </li>
                   1081: 
                   1082:             <li>
                   1083:               <p><a href="http://www.linux.org/" target=
                   1084:               "_top">Linux</a></p>
                   1085:             </li>
                   1086: 
                   1087:             <li>
                   1088:               <p><a href="http://www.NetBSD.org/" target=
                   1089:               "_top">NetBSD</a> (of course)</p>
                   1090:             </li>
                   1091: 
                   1092:             <li>
1.17      sketch   1093:               <p><a href="http://h30097.www3.hp.com/" target=
                   1094:               "_top">Tru64</a> (Digital UNIX, OSF1)</p>
                   1095:             </li>
                   1096: 
                   1097:             <li>
1.1       grant    1098:               <p><a href="http://www.openbsd.org/" target=
                   1099:               "_top">OpenBSD</a></p>
                   1100:             </li>
                   1101: 
                   1102:             <li>
                   1103:               <p><a href="http://www.sun.com/solaris/" target=
                   1104:               "_top">Solaris</a></p>
                   1105:             </li>
                   1106:           </ul>
                   1107:         </div>
                   1108:       </div>
                   1109: 
                   1110:       <div class="sect1" lang="en" xml:lang="en">
                   1111:         <div class="titlepage">
                   1112:           <div>
                   1113:             <div>
                   1114:               <h2 class="title" style="clear: both"><a name=
                   1115:               "overview" id="overview"></a>1.2.&nbsp;Overview</h2>
                   1116:             </div>
                   1117:           </div>
                   1118:         </div>
                   1119: 
                   1120:         <p>This document is divided into two parts. The first,
                   1121:         <a href="#users-guide" title=
1.2       hubertf  1122:         "Part&nbsp;I.&nbsp;The pkgsrc user's guide">The pkgsrc
                   1123:         user's guide</a>, describes how one can use one of the
                   1124:         packages in the Package Collection, either by installing a
                   1125:         precompiled binary package, or by building one's own copy
                   1126:         using the NetBSD package system. The second part, <a href=
1.1       grant    1127:         "#developers-guide" title=
1.2       hubertf  1128:         "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">The
                   1129:         pkgsrc developer's guide</a>, explains how to prepare a
                   1130:         package so it can be easily built by other NetBSD users
                   1131:         without knowing about the package's building details.</p>
1.1       grant    1132: 
                   1133:         <p>This document is available in various formats:</p>
                   1134: 
                   1135:         <div class="itemizedlist">
                   1136:           <ul type="disc">
                   1137:             <li>
                   1138:               <p><a href="index.html" target="_top">HTML</a></p>
                   1139:             </li>
                   1140: 
                   1141:             <li>
                   1142:               <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
                   1143:             </li>
                   1144: 
                   1145:             <li>
                   1146:               <p><a href="pkgsrc.ps" target="_top">PS</a></p>
                   1147:             </li>
                   1148: 
                   1149:             <li>
                   1150:               <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
                   1151:             </li>
                   1152:           </ul>
                   1153:         </div>
                   1154:       </div>
                   1155: 
                   1156:       <div class="sect1" lang="en" xml:lang="en">
                   1157:         <div class="titlepage">
                   1158:           <div>
                   1159:             <div>
                   1160:               <h2 class="title" style="clear: both"><a name=
                   1161:               "terminology" id=
                   1162:               "terminology"></a>1.3.&nbsp;Terminology</h2>
                   1163:             </div>
                   1164:           </div>
                   1165:         </div>
                   1166: 
                   1167:         <p>There has been a lot of talk about &#8220;<span class=
                   1168:         "quote">ports</span>&#8221;, &#8220;<span class=
                   1169:         "quote">packages</span>&#8221;, etc. so far. Here is a
                   1170:         description of all the terminology used within this
                   1171:         document.</p>
                   1172: 
                   1173:         <div class="variablelist">
                   1174:           <dl>
                   1175:             <dt><span class="term">Package</span></dt>
                   1176: 
                   1177:             <dd>
                   1178:               <p>A set of files and building instructions that
                   1179:               describe what's necessary to build a certain piece of
                   1180:               software using pkgsrc. Packages are traditionally
1.14      xtraeme  1181:               stored under <code class=
                   1182:               "filename">/usr/pkgsrc</code>.</p>
1.1       grant    1183:             </dd>
                   1184: 
                   1185:             <dt><span class="term">The NetBSD package
                   1186:             system</span></dt>
                   1187: 
                   1188:             <dd>
                   1189:               <p>This is the former name of &#8220;<span class=
                   1190:               "quote">pkgsrc</span>&#8221;. It is part of the
1.27      rillig   1191:               NetBSD operating system and can be bootstrapped to
                   1192:               run on non-NetBSD operating systems as well. It
                   1193:               handles building (compiling), installing, and
                   1194:               removing of packages.</p>
1.1       grant    1195:             </dd>
                   1196: 
                   1197:             <dt><span class="term">Distfile</span></dt>
                   1198: 
                   1199:             <dd>
                   1200:               <p>This term describes the file or files that are
                   1201:               provided by the author of the piece of software to
                   1202:               distribute his work. All the changes necessary to
                   1203:               build on NetBSD are reflected in the corresponding
                   1204:               package. Usually the distfile is in the form of a
                   1205:               compressed tar-archive, but other types are possible,
1.14      xtraeme  1206:               too. Distfiles are usually stored below <code class=
                   1207:               "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    1208:             </dd>
                   1209: 
                   1210:             <dt><span class="term">Port</span></dt>
                   1211: 
                   1212:             <dd>
                   1213:               <p>This is the term used by FreeBSD and OpenBSD
                   1214:               people for what we call a package. In NetBSD
                   1215:               terminology, &#8220;<span class=
                   1216:               "quote">port</span>&#8221; refers to a different
                   1217:               architecture.</p>
                   1218:             </dd>
                   1219: 
                   1220:             <dt><span class="term">Precompiled/binary
                   1221:             package</span></dt>
                   1222: 
                   1223:             <dd>
                   1224:               <p>A set of binaries built with pkgsrc from a
1.14      xtraeme  1225:               distfile and stuffed together in a single
                   1226:               <code class="filename">.tgz</code> file so it can be
                   1227:               installed on machines of the same machine
                   1228:               architecture without the need to recompile. Packages
                   1229:               are usually generated in <code class=
                   1230:               "filename">/usr/pkgsrc/packages</code>; there is also
                   1231:               an archive on <a href=
1.1       grant    1232:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
                   1233:               "_top">ftp.NetBSD.org</a>.</p>
                   1234: 
                   1235:               <p>Sometimes, this is referred to by the term
                   1236:               &#8220;<span class="quote">package</span>&#8221; too,
                   1237:               especially in the context of precompiled
                   1238:               packages.</p>
                   1239:             </dd>
                   1240: 
                   1241:             <dt><span class="term">Program</span></dt>
                   1242: 
                   1243:             <dd>
                   1244:               <p>The piece of software to be installed which will
                   1245:               be constructed from all the files in the Distfile by
                   1246:               the actions defined in the corresponding package.</p>
                   1247:             </dd>
                   1248:           </dl>
                   1249:         </div>
                   1250:       </div>
                   1251: 
                   1252:       <div class="sect1" lang="en" xml:lang="en">
                   1253:         <div class="titlepage">
                   1254:           <div>
                   1255:             <div>
                   1256:               <h2 class="title" style="clear: both"><a name=
                   1257:               "typography" id=
                   1258:               "typography"></a>1.4.&nbsp;Typography</h2>
                   1259:             </div>
                   1260:           </div>
                   1261:         </div>
                   1262: 
                   1263:         <p>When giving examples for commands, shell prompts are
                   1264:         used to show if the command should/can be issued as root,
                   1265:         or if &#8220;<span class="quote">normal</span>&#8221; user
1.14      xtraeme  1266:         privileges are sufficient. We use a <code class=
                   1267:         "prompt">#</code> for root's shell prompt, and a
1.27      rillig   1268:         <code class="prompt">%</code> for users' shell prompt,
1.14      xtraeme  1269:         assuming they use the C-shell or tcsh.</p>
1.1       grant    1270:       </div>
                   1271:     </div>
                   1272: 
                   1273:     <div class="part" lang="en" xml:lang="en">
                   1274:       <div class="titlepage">
                   1275:         <div>
                   1276:           <div>
                   1277:             <h1 class="title"><a name="users-guide" id=
1.2       hubertf  1278:             "users-guide"></a>The pkgsrc user's guide</h1>
1.1       grant    1279:           </div>
                   1280:         </div>
                   1281:       </div>
                   1282: 
                   1283:       <div class="toc">
                   1284:         <p><b>Table of Contents</b></p>
                   1285: 
                   1286:         <dl>
                   1287:           <dt><span class="chapter"><a href="#getting">2. Where to
                   1288:           get pkgsrc</a></span></dt>
                   1289: 
                   1290:           <dd>
                   1291:             <dl>
1.30      wiz      1292:               <dt><span class="sect1"><a href="#as-tar-file">2.1.
                   1293:               As tar file</a></span></dt>
1.1       grant    1294: 
1.30      wiz      1295:               <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1       grant    1296:               SUP</a></span></dt>
                   1297: 
1.30      wiz      1298:               <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1       grant    1299:               CVS</a></span></dt>
                   1300:             </dl>
                   1301:           </dd>
                   1302: 
                   1303:           <dt><span class="chapter"><a href="#platforms">3. Using
                   1304:           pkgsrc on systems other than NetBSD</a></span></dt>
                   1305: 
                   1306:           <dd>
                   1307:             <dl>
1.30      wiz      1308:               <dt><span class="sect1"><a href=
                   1309:               "#bootstrapping-pkgsrc">3.1. Bootstrapping
                   1310:               pkgsrc</a></span></dt>
1.1       grant    1311: 
1.30      wiz      1312:               <dt><span class="sect1"><a href=
                   1313:               "#platform-specific-notes">3.2. Platform specific
                   1314:               notes</a></span></dt>
1.1       grant    1315: 
                   1316:               <dd>
                   1317:                 <dl>
1.30      wiz      1318:                   <dt><span class="sect2"><a href="#darwin">3.2.1.
                   1319:                   Darwin (Mac OS X)</a></span></dt>
1.1       grant    1320: 
1.30      wiz      1321:                   <dt><span class="sect2"><a href="#freebsd">3.2.2.
                   1322:                   FreeBSD</a></span></dt>
1.22      tv       1323: 
1.30      wiz      1324:                   <dt><span class="sect2"><a href="#interix">3.2.3.
                   1325:                   Interix</a></span></dt>
1.1       grant    1326: 
1.30      wiz      1327:                   <dt><span class="sect2"><a href="#irix">3.2.4.
                   1328:                   IRIX</a></span></dt>
1.1       grant    1329: 
1.30      wiz      1330:                   <dt><span class="sect2"><a href="#linux">3.2.5.
                   1331:                   Linux</a></span></dt>
1.1       grant    1332: 
1.30      wiz      1333:                   <dt><span class="sect2"><a href="#openbsd">3.2.6.
                   1334:                   OpenBSD</a></span></dt>
1.1       grant    1335: 
1.30      wiz      1336:                   <dt><span class="sect2"><a href="#solaris">3.2.7.
                   1337:                   Solaris</a></span></dt>
1.1       grant    1338:                 </dl>
                   1339:               </dd>
                   1340:             </dl>
                   1341:           </dd>
                   1342: 
                   1343:           <dt><span class="chapter"><a href="#using">4. Using
                   1344:           pkgsrc</a></span></dt>
                   1345: 
                   1346:           <dd>
                   1347:             <dl>
                   1348:               <dt><span class="sect1"><a href=
                   1349:               "#getting-started">4.1. Working with binary
                   1350:               packages</a></span></dt>
                   1351: 
                   1352:               <dd>
                   1353:                 <dl>
                   1354:                   <dt><span class="sect2"><a href=
1.30      wiz      1355:                   "#where-to-get-binary-packages">4.1.1. Where to
                   1356:                   get binary packages</a></span></dt>
1.1       grant    1357: 
                   1358:                   <dt><span class="sect2"><a href=
1.30      wiz      1359:                   "#how-to-use-binary-packages">4.1.2. How to use
                   1360:                   binary packages</a></span></dt>
1.1       grant    1361: 
                   1362:                   <dt><span class="sect2"><a href=
1.30      wiz      1363:                   "#a-word-of-warning">4.1.3. A word of
1.1       grant    1364:                   warning</a></span></dt>
                   1365:                 </dl>
                   1366:               </dd>
                   1367: 
1.30      wiz      1368:               <dt><span class="sect1"><a href=
                   1369:               "#building-packages-from-source">4.2. Building
                   1370:               packages from source</a></span></dt>
1.1       grant    1371: 
                   1372:               <dd>
                   1373:                 <dl>
                   1374:                   <dt><span class="sect2"><a href=
1.30      wiz      1375:                   "#requirements">4.2.1.
                   1376:                   Requirements</a></span></dt>
1.1       grant    1377: 
                   1378:                   <dt><span class="sect2"><a href=
1.30      wiz      1379:                   "#fetching-distfiles">4.2.2. Fetching
1.1       grant    1380:                   distfiles</a></span></dt>
                   1381: 
                   1382:                   <dt><span class="sect2"><a href=
1.30      wiz      1383:                   "#how-to-build-and-install">4.2.3. How to build
                   1384:                   and install</a></span></dt>
1.1       grant    1385: 
                   1386:                   <dt><span class="sect2"><a href=
1.30      wiz      1387:                   "#selecting-the-compiler">4.2.4. Selecting the
1.1       grant    1388:                   compiler</a></span></dt>
                   1389:                 </dl>
                   1390:               </dd>
                   1391:             </dl>
                   1392:           </dd>
                   1393: 
1.38      dillo    1394:           <dt><span class="chapter"><a href="#configuring">5.
                   1395:           Configuring pkgsrc</a></span></dt>
                   1396: 
                   1397:           <dd>
                   1398:             <dl>
                   1399:               <dt><span class="sect1"><a href=
1.42      dillo    1400:               "#selecting-options">5.1. Selecting Build
                   1401:               Options</a></span></dt>
1.38      dillo    1402:             </dl>
                   1403:           </dd>
                   1404: 
                   1405:           <dt><span class="chapter"><a href="#binary">6. Creating
1.1       grant    1406:           binary packages</a></span></dt>
                   1407: 
                   1408:           <dd>
                   1409:             <dl>
1.30      wiz      1410:               <dt><span class="sect1"><a href=
1.38      dillo    1411:               "#building-a-single-binary-package">6.1. Building a
1.30      wiz      1412:               single binary package</a></span></dt>
1.1       grant    1413: 
1.30      wiz      1414:               <dt><span class="sect1"><a href=
1.38      dillo    1415:               "#settings-for-creationg-of-binary-packages">6.2.
1.1       grant    1416:               Settings for creation of binary
                   1417:               packages</a></span></dt>
                   1418: 
1.38      dillo    1419:               <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1       grant    1420:               Doing a bulk build of all packages</a></span></dt>
                   1421: 
                   1422:               <dd>
                   1423:                 <dl>
                   1424:                   <dt><span class="sect2"><a href=
1.38      dillo    1425:                   "#binary.configuration">6.3.1.
1.1       grant    1426:                   Configuration</a></span></dt>
                   1427: 
                   1428:                   <dt><span class="sect2"><a href=
1.38      dillo    1429:                   "#other-environmental-considerations">6.3.2.
1.30      wiz      1430:                   Other environmental
1.1       grant    1431:                   considerations</a></span></dt>
                   1432: 
                   1433:                   <dt><span class="sect2"><a href=
1.38      dillo    1434:                   "#operation">6.3.3. Operation</a></span></dt>
1.1       grant    1435: 
                   1436:                   <dt><span class="sect2"><a href=
1.38      dillo    1437:                   "#what-it-does">6.3.4. What it
1.30      wiz      1438:                   does</a></span></dt>
1.1       grant    1439: 
                   1440:                   <dt><span class="sect2"><a href=
1.38      dillo    1441:                   "#disk-space-requirements">6.3.5. Disk space
1.1       grant    1442:                   requirements</a></span></dt>
                   1443: 
                   1444:                   <dt><span class="sect2"><a href=
1.38      dillo    1445:                   "#setting-up-a-sandbox">6.3.6. Setting up a
1.30      wiz      1446:                   sandbox for chroot'ed builds</a></span></dt>
1.1       grant    1447: 
                   1448:                   <dt><span class="sect2"><a href=
1.38      dillo    1449:                   "#building-a-partial-set">6.3.7. Building a
1.30      wiz      1450:                   partial set of packages</a></span></dt>
1.13      hubertf  1451: 
                   1452:                   <dt><span class="sect2"><a href=
1.38      dillo    1453:                   "#bulk-upload">6.3.8. Uploading results of a bulk
1.13      hubertf  1454:                   build</a></span></dt>
1.1       grant    1455:                 </dl>
                   1456:               </dd>
                   1457: 
1.30      wiz      1458:               <dt><span class="sect1"><a href=
1.38      dillo    1459:               "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30      wiz      1460:               packages collection</a></span></dt>
1.1       grant    1461: 
                   1462:               <dd>
                   1463:                 <dl>
                   1464:                   <dt><span class="sect2"><a href=
1.38      dillo    1465:                   "#cdpack-example">6.4.1. Example of
1.1       grant    1466:                   cdpack</a></span></dt>
                   1467:                 </dl>
                   1468:               </dd>
                   1469:             </dl>
                   1470:           </dd>
                   1471: 
1.38      dillo    1472:           <dt><span class="chapter"><a href="#faq">7. Frequently
1.1       grant    1473:           Asked Questions</a></span></dt>
                   1474: 
                   1475:           <dd>
                   1476:             <dl>
1.30      wiz      1477:               <dt><span class="sect1"><a href=
1.38      dillo    1478:               "#mailing-list-pointers">7.1. Are there any mailing
1.30      wiz      1479:               lists for pkg-related discussion?</a></span></dt>
1.1       grant    1480: 
1.38      dillo    1481:               <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1       grant    1482:               Where's the pkgviews documentation?</a></span></dt>
                   1483: 
1.38      dillo    1484:               <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1       grant    1485:               Utilities for package management
                   1486:               (pkgtools)</a></span></dt>
                   1487: 
1.30      wiz      1488:               <dt><span class="sect1"><a href=
1.38      dillo    1489:               "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30      wiz      1490:               non-root</a></span></dt>
1.1       grant    1491: 
1.30      wiz      1492:               <dt><span class="sect1"><a href=
1.38      dillo    1493:               "#resume-transfers">7.5. How to resume transfers when
1.30      wiz      1494:               fetching distfiles?</a></span></dt>
1.14      xtraeme  1495: 
1.30      wiz      1496:               <dt><span class="sect1"><a href=
1.38      dillo    1497:               "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30      wiz      1498:               XFree86 from pkgsrc?</a></span></dt>
1.1       grant    1499: 
1.30      wiz      1500:               <dt><span class="sect1"><a href=
1.38      dillo    1501:               "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30      wiz      1502:               from pkgsrc?</a></span></dt>
1.1       grant    1503: 
1.30      wiz      1504:               <dt><span class="sect1"><a href=
1.38      dillo    1505:               "#fetch-behind-firewall">7.8. How to fetch files from
1.30      wiz      1506:               behind a firewall</a></span></dt>
1.1       grant    1507: 
1.38      dillo    1508:               <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.30      wiz      1509:               How do I tell <span><strong class="command">make
1.14      xtraeme  1510:               fetch</strong></span> to do passive
1.1       grant    1511:               FTP?</a></span></dt>
                   1512: 
1.30      wiz      1513:               <dt><span class="sect1"><a href=
1.38      dillo    1514:               "#fetching-all-distfiles">7.10. How to fetch all
1.30      wiz      1515:               distfiles at once</a></span></dt>
1.1       grant    1516: 
1.30      wiz      1517:               <dt><span class="sect1"><a href=
1.38      dillo    1518:               "#tmac.andoc-missing">7.11. What does
1.30      wiz      1519:               &#8220;<span class="quote">Don't know how to make
                   1520:               /usr/share/tmac/tmac.andoc</span>&#8221;
1.14      xtraeme  1521:               mean?</a></span></dt>
1.13      hubertf  1522: 
1.30      wiz      1523:               <dt><span class="sect1"><a href=
1.38      dillo    1524:               "#bsd.own.mk-missing">7.12. What does
1.30      wiz      1525:               &#8220;<span class="quote">Could not find
1.14      xtraeme  1526:               bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    1527: 
1.30      wiz      1528:               <dt><span class="sect1"><a href=
1.38      dillo    1529:               "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30      wiz      1530:               pkgsrc</a></span></dt>
1.1       grant    1531: 
1.38      dillo    1532:               <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35      jmmv     1533:               do I change the location of configuration
                   1534:               files?</a></span></dt>
1.1       grant    1535: 
                   1536:               <dt><span class="sect1"><a href=
1.38      dillo    1537:               "#audit-packages">7.15. Automated security
1.1       grant    1538:               checks</a></span></dt>
                   1539:             </dl>
                   1540:           </dd>
                   1541:         </dl>
                   1542:       </div>
                   1543: 
                   1544:       <div class="chapter" lang="en" xml:lang="en">
                   1545:         <div class="titlepage">
                   1546:           <div>
                   1547:             <div>
                   1548:               <h2 class="title"><a name="getting" id=
                   1549:               "getting"></a>Chapter&nbsp;2.&nbsp;Where to get
                   1550:               pkgsrc</h2>
                   1551:             </div>
                   1552:           </div>
                   1553:         </div>
                   1554: 
                   1555:         <div class="toc">
                   1556:           <p><b>Table of Contents</b></p>
                   1557: 
                   1558:           <dl>
1.30      wiz      1559:             <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1       grant    1560:             tar file</a></span></dt>
                   1561: 
1.30      wiz      1562:             <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1       grant    1563:             SUP</a></span></dt>
                   1564: 
1.30      wiz      1565:             <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1       grant    1566:             CVS</a></span></dt>
                   1567:           </dl>
                   1568:         </div>
                   1569: 
                   1570:         <p>There are three ways to get pkgsrc. Either as a tar
                   1571:         file, via SUP, or via CVS. All three ways are described
                   1572:         here.</p>
                   1573: 
                   1574:         <div class="sect1" lang="en" xml:lang="en">
                   1575:           <div class="titlepage">
                   1576:             <div>
                   1577:               <div>
                   1578:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      1579:                 "as-tar-file" id="as-tar-file"></a>2.1.&nbsp;As tar
1.1       grant    1580:                 file</h2>
                   1581:               </div>
                   1582:             </div>
                   1583:           </div>
                   1584: 
                   1585:           <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
                   1586:           file from <a href=
1.11      ben      1587:           "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20      ben      1588:           target="_top">ftp.NetBSD.org</a> and unpack it into
                   1589:           <code class="filename">/usr/pkgsrc</code>.</p>
1.1       grant    1590:         </div>
                   1591: 
                   1592:         <div class="sect1" lang="en" xml:lang="en">
                   1593:           <div class="titlepage">
                   1594:             <div>
                   1595:               <div>
                   1596:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      1597:                 "via-sup" id="via-sup"></a>2.2.&nbsp;Via SUP</h2>
1.1       grant    1598:               </div>
                   1599:             </div>
                   1600:           </div>
                   1601: 
                   1602:           <p>As an alternative to the tar file, you can get pkgsrc
                   1603:           via the Software Update Protocol, SUP. To do so, make
                   1604:           sure your supfile has a line</p>
                   1605:           <pre class="programlisting">
                   1606: release=pkgsrc
                   1607: </pre>
                   1608: 
1.14      xtraeme  1609:           <p>in it, see the examples in <code class=
                   1610:           "filename">/usr/share/examples/supfiles</code>, and that
                   1611:           the <code class="filename">/usr/pkgsrc</code> directory
                   1612:           exists. Then, simply run <span><strong class=
                   1613:           "command">sup -v <em class=
                   1614:           "replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1       grant    1615:         </div>
                   1616: 
                   1617:         <div class="sect1" lang="en" xml:lang="en">
                   1618:           <div class="titlepage">
                   1619:             <div>
                   1620:               <div>
                   1621:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      1622:                 "via-cvs" id="via-cvs"></a>2.3.&nbsp;Via CVS</h2>
1.1       grant    1623:               </div>
                   1624:             </div>
                   1625:           </div>
                   1626: 
                   1627:           <p>To get pkgsrc via CVS, make sure you have
                   1628:           &#8220;<span class="quote">cvs</span>&#8221; installed.
1.27      rillig   1629:           To do an initial (full) checkout of pkgsrc, do the
                   1630:           following steps:</p>
1.1       grant    1631:           <pre class="screen">
1.14      xtraeme  1632: <code class="prompt">%</code> <strong class=
                   1633: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
                   1634: <code class="prompt">%</code> <strong class=
                   1635: "userinput"><code>setenv CVS_RSH ssh</code></strong>
                   1636: <code class="prompt">%</code> <strong class=
                   1637: "userinput"><code>cd /usr</code></strong>
                   1638: <code class="prompt">%</code> <strong class=
                   1639: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
                   1640: </pre>
                   1641: 
                   1642:           <p>This will create the <code class=
                   1643:           "filename">pkgsrc</code> directory in your <code class=
                   1644:           "filename">/usr</code>, and all the package source will
                   1645:           be stored under <code class=
                   1646:           "filename">/usr/pkgsrc</code>. To update pkgsrc after the
                   1647:           initial checkout, make sure you have <code class=
                   1648:           "varname">CVS_RSH</code> set as above, then do:</p>
1.1       grant    1649:           <pre class="screen">
1.14      xtraeme  1650: <code class="prompt">%</code> <strong class=
                   1651: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   1652: <code class="prompt">%</code> <strong class=
                   1653: "userinput"><code>cvs -q update -dP</code></strong>
1.1       grant    1654: </pre>
                   1655: 
                   1656:           <p>Please also note that it is possible to have multiple
                   1657:           copies of the pkgsrc hierarchy in use at any one time -
                   1658:           all work is done relatively within the pkgsrc tree.</p>
                   1659:         </div>
                   1660:       </div>
                   1661: 
                   1662:       <div class="chapter" lang="en" xml:lang="en">
                   1663:         <div class="titlepage">
                   1664:           <div>
                   1665:             <div>
                   1666:               <h2 class="title"><a name="platforms" id=
                   1667:               "platforms"></a>Chapter&nbsp;3.&nbsp;Using pkgsrc on
                   1668:               systems other than NetBSD</h2>
                   1669:             </div>
                   1670:           </div>
                   1671:         </div>
                   1672: 
                   1673:         <div class="toc">
                   1674:           <p><b>Table of Contents</b></p>
                   1675: 
                   1676:           <dl>
1.30      wiz      1677:             <dt><span class="sect1"><a href=
                   1678:             "#bootstrapping-pkgsrc">3.1. Bootstrapping
                   1679:             pkgsrc</a></span></dt>
1.1       grant    1680: 
1.30      wiz      1681:             <dt><span class="sect1"><a href=
                   1682:             "#platform-specific-notes">3.2. Platform specific
                   1683:             notes</a></span></dt>
1.1       grant    1684: 
                   1685:             <dd>
                   1686:               <dl>
1.30      wiz      1687:                 <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1       grant    1688:                 Darwin (Mac OS X)</a></span></dt>
                   1689: 
1.30      wiz      1690:                 <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1       grant    1691:                 FreeBSD</a></span></dt>
                   1692: 
1.30      wiz      1693:                 <dt><span class="sect2"><a href="#interix">3.2.3.
1.1       grant    1694:                 Interix</a></span></dt>
                   1695: 
1.30      wiz      1696:                 <dt><span class="sect2"><a href="#irix">3.2.4.
1.1       grant    1697:                 IRIX</a></span></dt>
                   1698: 
1.30      wiz      1699:                 <dt><span class="sect2"><a href="#linux">3.2.5.
1.22      tv       1700:                 Linux</a></span></dt>
                   1701: 
1.30      wiz      1702:                 <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1       grant    1703:                 OpenBSD</a></span></dt>
                   1704: 
1.30      wiz      1705:                 <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1       grant    1706:                 Solaris</a></span></dt>
                   1707:               </dl>
                   1708:             </dd>
                   1709:           </dl>
                   1710:         </div>
                   1711: 
                   1712:         <div class="sect1" lang="en" xml:lang="en">
                   1713:           <div class="titlepage">
                   1714:             <div>
                   1715:               <div>
                   1716:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      1717:                 "bootstrapping-pkgsrc" id=
                   1718:                 "bootstrapping-pkgsrc"></a>3.1.&nbsp;Bootstrapping
                   1719:                 pkgsrc</h2>
1.1       grant    1720:               </div>
                   1721:             </div>
                   1722:           </div>
                   1723: 
1.27      rillig   1724:           <p>For operating systems other than NetBSD, we provide a
1.1       grant    1725:           bootstrap kit to build the required tools to use pkgsrc
                   1726:           on your platform. Besides support for native NetBSD,
                   1727:           pkgsrc and the bootstrap kit have support for the
                   1728:           following operating systems:</p>
                   1729: 
                   1730:           <div class="itemizedlist">
                   1731:             <ul type="disc">
                   1732:               <li>
                   1733:                 <p>Darwin (Mac OS X)</p>
                   1734:               </li>
                   1735: 
                   1736:               <li>
1.16      grant    1737:                 <p>DragonFlyBSD</p>
                   1738:               </li>
                   1739: 
                   1740:               <li>
1.1       grant    1741:                 <p>FreeBSD</p>
                   1742:               </li>
                   1743: 
                   1744:               <li>
                   1745:                 <p>Interix (Windows 2000, XP, 2003)</p>
                   1746:               </li>
                   1747: 
                   1748:               <li>
                   1749:                 <p>IRIX</p>
                   1750:               </li>
                   1751: 
                   1752:               <li>
                   1753:                 <p>Linux</p>
                   1754:               </li>
                   1755: 
                   1756:               <li>
                   1757:                 <p>OpenBSD</p>
                   1758:               </li>
                   1759: 
                   1760:               <li>
                   1761:                 <p>Solaris</p>
                   1762:               </li>
1.16      grant    1763: 
                   1764:               <li>
                   1765:                 <p>Tru64 (Digital UNIX/OSF1)</p>
                   1766:               </li>
1.1       grant    1767:             </ul>
                   1768:           </div>
                   1769: 
                   1770:           <p>Support for other platforms is under development.</p>
                   1771: 
                   1772:           <p>Installing the bootstrap kit should be as simple
                   1773:           as:</p>
                   1774:           <pre class="screen">
1.14      xtraeme  1775: <code class="prompt">#</code> <strong class=
                   1776: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
                   1777: <code class="prompt">#</code> <strong class=
                   1778: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1779: <code class="prompt">#</code> <strong class=
                   1780: "userinput"><code>./bootstrap</code></strong>
1.1       grant    1781: </pre>
                   1782: 
                   1783:           <p>See <a href="#getting" title=
                   1784:           "Chapter&nbsp;2.&nbsp;Where to get pkgsrc">Chapter 2,
                   1785:           <i>Where to get pkgsrc</i></a> for other ways to get
1.14      xtraeme  1786:           pkgsrc before bootstrapping. The given
                   1787:           <span><strong class="command">bootstrap</strong></span>
                   1788:           command will use the defaults of <code class=
                   1789:           "filename">/usr/pkg</code> for the <span class=
                   1790:           "emphasis"><em>prefix</em></span> where programs will be
                   1791:           installed in, and <code class=
                   1792:           "filename">/var/db/pkg</code> for the package database
1.27      rillig   1793:           directory where pkgsrc will do its internal bookkeeping.
1.1       grant    1794:           However, these can also be set using command-line
1.27      rillig   1795:           arguments.</p>
1.1       grant    1796: 
                   1797:           <p>Binary packages for the pkgsrc tools and an initial
                   1798:           set of packages is available for supported platforms. An
                   1799:           up-to-date list of these can be found on <a href=
                   1800:           "http://www.pkgsrc.org/" target=
                   1801:           "_top">www.pkgsrc.org</a>.</p>
                   1802:         </div>
                   1803: 
                   1804:         <div class="sect1" lang="en" xml:lang="en">
                   1805:           <div class="titlepage">
                   1806:             <div>
                   1807:               <div>
                   1808:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      1809:                 "platform-specific-notes" id=
                   1810:                 "platform-specific-notes"></a>3.2.&nbsp;Platform
1.1       grant    1811:                 specific notes</h2>
                   1812:               </div>
                   1813:             </div>
                   1814:           </div>
                   1815: 
                   1816:           <p>Here are some platform-specific notes you should be
                   1817:           aware of.</p>
                   1818: 
                   1819:           <div class="sect2" lang="en" xml:lang="en">
                   1820:             <div class="titlepage">
                   1821:               <div>
                   1822:                 <div>
1.30      wiz      1823:                   <h3 class="title"><a name="darwin" id=
                   1824:                   "darwin"></a>3.2.1.&nbsp;Darwin (Mac OS X)</h3>
1.1       grant    1825:                 </div>
                   1826:               </div>
                   1827:             </div>
                   1828: 
                   1829:             <p>Darwin 5.x and 6.x are supported. There are two
                   1830:             methods of using pkgsrc on Mac OS X, by using a
                   1831:             <a href="#platform.osx-image" title=
                   1832:             "3.2.1.1.&nbsp;Using a disk image">disk image</a>, or a
                   1833:             <a href="#platform.osx-ufs" title=
                   1834:             "3.2.1.2.&nbsp;Using a UFS partition">UFS
                   1835:             partition</a>.</p>
                   1836: 
                   1837:             <p>Before you start, you will need to download and
                   1838:             install the Mac OS X Developer Tools from Apple's
                   1839:             Developer Connection. See <a href=
                   1840:             "http://developer.apple.com/macosx/" target=
                   1841:             "_top">http://developer.apple.com/macosx/</a> for
                   1842:             details. Also, make sure you install X11 for Mac OS X
                   1843:             and the X11 SDK from <a href=
                   1844:             "http://www.apple.com/macosx/x11/download/" target=
                   1845:             "_top">http://www.apple.com/macosx/x11/download/</a> if
                   1846:             you intend to build packages that use the X11 Window
                   1847:             System.</p>
                   1848: 
                   1849:             <p>If you already have a UFS partition, or have a spare
                   1850:             partition that you can format as UFS, it is recommended
                   1851:             to use that instead of the disk image. It'll be
                   1852:             somewhat faster and will mount automatically at boot
                   1853:             time, where you must manually mount a disk image.</p>
                   1854: 
                   1855:             <div class="note" style=
                   1856:             "margin-left: 0.5in; margin-right: 0.5in;">
                   1857:               <h3 class="title">Note</h3>
                   1858: 
                   1859:               <p>You cannot use a HFS+ file system for pkgsrc,
                   1860:               because pkgsrc currently requires the filesystem to
                   1861:               be case-sensitive, and HFS+ is not.</p>
                   1862:             </div>
                   1863: 
                   1864:             <div class="sect3" lang="en" xml:lang="en">
                   1865:               <div class="titlepage">
                   1866:                 <div>
                   1867:                   <div>
                   1868:                     <h4 class="title"><a name="platform.osx-image"
                   1869:                     id="platform.osx-image"></a>3.2.1.1.&nbsp;Using
                   1870:                     a disk image</h4>
                   1871:                   </div>
                   1872:                 </div>
                   1873:               </div>
                   1874: 
                   1875:               <p>Create the disk image:</p>
                   1876:               <pre class="screen">
1.14      xtraeme  1877: <code class="prompt">#</code> <strong class=
                   1878: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1879: <code class="prompt">#</code> <strong class=
                   1880: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
                   1881: <code class="prompt">#</code> <strong class=
                   1882: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
                   1883: <code class="prompt">#</code> <strong class=
                   1884: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1       grant    1885: </pre>
                   1886: 
                   1887:               <p>That's it!</p>
                   1888:             </div>
                   1889: 
                   1890:             <div class="sect3" lang="en" xml:lang="en">
                   1891:               <div class="titlepage">
                   1892:                 <div>
                   1893:                   <div>
                   1894:                     <h4 class="title"><a name="platform.osx-ufs"
                   1895:                     id="platform.osx-ufs"></a>3.2.1.2.&nbsp;Using a
                   1896:                     UFS partition</h4>
                   1897:                   </div>
                   1898:                 </div>
                   1899:               </div>
                   1900: 
1.14      xtraeme  1901:               <p>By default, <code class="filename">/usr</code>
                   1902:               will be on your root file system, normally HFS+. It
                   1903:               is possible to use the default <span class=
                   1904:               "emphasis"><em>prefix</em></span> of <code class=
                   1905:               "filename">/usr/pkg</code> by symlinking <code class=
                   1906:               "filename">/usr/pkg</code> to a directory on a UFS
                   1907:               file system. Obviously, another symlink is required
                   1908:               if you want to place the package database directory
                   1909:               outside the <span class=
                   1910:               "emphasis"><em>prefix</em></span>. e.g.</p>
1.1       grant    1911:               <pre class="screen">
1.14      xtraeme  1912: <code class="prompt">#</code> <strong class=
1.22      tv       1913: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb --pkgsrcdir /Volumes/ufs/pkgsrc</code></strong>
1.1       grant    1914: </pre>
                   1915: 
                   1916:               <p>If you created your partitions at the time of
                   1917:               installing Mac OS X and formatted the target
                   1918:               partition as UFS, it should automatically mount on
1.14      xtraeme  1919:               <code class="filename">/Volumes/&lt;volume
                   1920:               name&gt;</code> when the machine boots. If you are
1.1       grant    1921:               (re)formatting a partition as UFS, you need to ensure
                   1922:               that the partition map correctly reflects
                   1923:               &#8220;<span class="quote">Apple_UFS</span>&#8221;
                   1924:               and not &#8220;<span class=
                   1925:               "quote">Apple_HFS</span>&#8221;.</p>
                   1926: 
                   1927:               <p>The problem is that none of the disk tools will
                   1928:               let you touch a disk that is booted from. You can
                   1929:               unmount the partition, but even if you newfs it, the
                   1930:               partition type will be incorrect and the automounter
                   1931:               won't mount it. It can be mounted manually, but it
                   1932:               won't appear in Finder.</p>
                   1933: 
                   1934:               <p>You'll need to boot off of the OS X Installation
                   1935:               (User) CD. When the Installation program starts, go
                   1936:               up to the menu and select Disk Utility. Now, you will
                   1937:               be able to select the partition you want to be UFS,
                   1938:               and Format it Apple UFS. Quit the Disk Utility, quit
                   1939:               the installer which will reboot your machine. The new
                   1940:               UFS file system will appear in Finder.</p>
                   1941: 
                   1942:               <p>Be aware that the permissions on the new file
                   1943:               system will be writable by root only.</p>
                   1944: 
                   1945:               <p>This note is as of 10.2 (Jaguar) and applies to
                   1946:               earlier versions. Hopefully Apple will fix Disk
                   1947:               Utility in 10.3 (Panther).</p>
                   1948:             </div>
                   1949:           </div>
                   1950: 
                   1951:           <div class="sect2" lang="en" xml:lang="en">
                   1952:             <div class="titlepage">
                   1953:               <div>
                   1954:                 <div>
1.30      wiz      1955:                   <h3 class="title"><a name="freebsd" id=
                   1956:                   "freebsd"></a>3.2.2.&nbsp;FreeBSD</h3>
1.1       grant    1957:                 </div>
                   1958:               </div>
                   1959:             </div>
                   1960: 
                   1961:             <p>FreeBSD 4.7 and 5.0 have been tested and are
                   1962:             supported, other versions may work.</p>
                   1963: 
                   1964:             <p>Care should be taken so that the tools that this kit
                   1965:             installs do not conflict with the FreeBSD userland
                   1966:             tools. There are several steps:</p>
                   1967: 
                   1968:             <div class="orderedlist">
                   1969:               <ol type="1">
                   1970:                 <li>
                   1971:                   <p>FreeBSD stores its ports pkg database in
1.14      xtraeme  1972:                   <code class="filename">/var/db/pkg</code>. It is
1.1       grant    1973:                   therefore recommended that you choose a different
1.14      xtraeme  1974:                   location (e.g. <code class=
                   1975:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    1976:                   --pkgdbdir option to the bootstrap script.</p>
                   1977:                 </li>
                   1978: 
                   1979:                 <li>
                   1980:                   <p>If you do not intend to use the FreeBSD ports
                   1981:                   tools, it's probably a good idea to move them out
                   1982:                   of the way to avoid confusion, e.g.</p>
                   1983:                   <pre class="screen">
1.14      xtraeme  1984: <code class="prompt">#</code> <strong class=
                   1985: "userinput"><code>cd /usr/sbin</code></strong>
                   1986: <code class="prompt">#</code> <strong class=
                   1987: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   1988: <code class="prompt">#</code> <strong class=
                   1989: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   1990: <code class="prompt">#</code> <strong class=
                   1991: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   1992: <code class="prompt">#</code> <strong class=
                   1993: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    1994: </pre>
                   1995:                 </li>
                   1996: 
                   1997:                 <li>
1.14      xtraeme  1998:                   <p>An example <code class=
                   1999:                   "filename">/etc/mk.conf</code> file will be
                   2000:                   placed in <code class=
                   2001:                   "filename">/etc/mk.conf.example</code> file when
                   2002:                   you use the bootstrap script.</p>
1.1       grant    2003:                 </li>
                   2004:               </ol>
                   2005:             </div>
                   2006:           </div>
                   2007: 
                   2008:           <div class="sect2" lang="en" xml:lang="en">
                   2009:             <div class="titlepage">
                   2010:               <div>
                   2011:                 <div>
1.30      wiz      2012:                   <h3 class="title"><a name="interix" id=
                   2013:                   "interix"></a>3.2.3.&nbsp;Interix</h3>
1.1       grant    2014:                 </div>
                   2015:               </div>
                   2016:             </div>
                   2017: 
                   2018:             <p>Interix is a POSIX compatible subsystem for the
                   2019:             Windows NT kernel, providing a Unix-like environment
                   2020:             with a tighter kernel integration than available with
                   2021:             Cygwin. It is part of the Windows Services for Unix
                   2022:             package, available for free for any licensed copy of
1.22      tv       2023:             Windows 2000, XP (not including XP Home), or 2003. SFU
                   2024:             can be downloaded from <a href=
                   2025:             "http://www.microsoft.com/windows/sfu/" target=
1.1       grant    2026:             "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
                   2027: 
                   2028:             <p>Services for Unix 3.5, current as of this writing,
                   2029:             has been tested. 3.0 or 3.1 may work, but are not
                   2030:             officially supported. (The main difference in 3.0/3.1
                   2031:             is lack of pthreads.)</p>
                   2032: 
                   2033:             <div class="sect3" lang="en" xml:lang="en">
                   2034:               <div class="titlepage">
                   2035:                 <div>
                   2036:                   <div>
                   2037:                     <h4 class="title"><a name=
                   2038:                     "platform.interix-sfu-install" id=
                   2039:                     "platform.interix-sfu-install"></a>3.2.3.1.&nbsp;When
1.2       hubertf  2040:                     installing Interix/SFU</h4>
1.1       grant    2041:                   </div>
                   2042:                 </div>
                   2043:               </div>
                   2044: 
                   2045:               <p>At an absolute minimum, the following packages
                   2046:               must be installed from the Windows Services for Unix
                   2047:               3.5 distribution in order to use pkgsrc:</p>
                   2048: 
                   2049:               <div class="itemizedlist">
                   2050:                 <ul type="disc">
                   2051:                   <li>
                   2052:                     <p>Utilities -&gt; Base Utilities</p>
                   2053:                   </li>
                   2054: 
                   2055:                   <li>
                   2056:                     <p>Interix GNU Components -&gt; (all)</p>
                   2057:                   </li>
                   2058: 
                   2059:                   <li>
                   2060:                     <p>Remote Connectivity</p>
                   2061:                   </li>
                   2062: 
                   2063:                   <li>
                   2064:                     <p>Interix SDK</p>
                   2065:                   </li>
                   2066:                 </ul>
                   2067:               </div>
                   2068: 
                   2069:               <p>When using pkgsrc on Interix, DO NOT install the
                   2070:               Utilities subcomponent "UNIX Perl". That is Perl 5.6
                   2071:               without shared module support, installed to
                   2072:               /usr/local, and will only cause confusion. Instead,
                   2073:               install Perl 5.8 from pkgsrc (or from a binary
                   2074:               package).</p>
                   2075: 
                   2076:               <p>The Remote Connectivity subcomponent "Windows
                   2077:               Remote Shell Service" does not need to be installed,
                   2078:               but Remote Connectivity itself should be installed in
                   2079:               order to have a working inetd.</p>
                   2080: 
                   2081:               <p>Finally, during installation you may be asked
                   2082:               whether to enable setuid behavior for Interix
                   2083:               programs, and whether to make pathnames default to
                   2084:               case-sensitive. Setuid should be enabled, and
                   2085:               case-sensitivity MUST be enabled. (Without
                   2086:               case-sensitivity, a large number of packages
                   2087:               including perl will not build.)</p>
                   2088:             </div>
                   2089: 
                   2090:             <div class="sect3" lang="en" xml:lang="en">
                   2091:               <div class="titlepage">
                   2092:                 <div>
                   2093:                   <div>
                   2094:                     <h4 class="title"><a name=
                   2095:                     "platform.interix-sfu-postinstall" id=
                   2096:                     "platform.interix-sfu-postinstall"></a>3.2.3.2.&nbsp;What
                   2097:                     to do if Interix/SFU is already installed</h4>
                   2098:                   </div>
                   2099:                 </div>
                   2100:               </div>
                   2101: 
                   2102:               <p>If SFU is already installed and you wish to alter
                   2103:               these settings to work with pkgsrc, note the
                   2104:               following things.</p>
                   2105: 
                   2106:               <div class="itemizedlist">
                   2107:                 <ul type="disc">
                   2108:                   <li>
                   2109:                     <p>To uninstall UNIX Perl, use Add/Remove
                   2110:                     Programs, select Microsoft Windows Services for
                   2111:                     UNIX, then click Change. In the installer,
                   2112:                     choose Add or Remove, then uncheck
                   2113:                     Utilities-&gt;UNIX Perl.</p>
                   2114:                   </li>
                   2115: 
                   2116:                   <li>
                   2117:                     <p>To enable case-sensitivity for the
                   2118:                     filesystem, run REGEDIT.EXE, and change the
                   2119:                     following registry key:</p>
                   2120: 
                   2121:                     <p>
                   2122:                     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
                   2123:                     Manager\kernel</p>
                   2124: 
                   2125:                     <p>Set the DWORD value "obcaseinsensitive" to
                   2126:                     0; then reboot.</p>
                   2127:                   </li>
                   2128: 
                   2129:                   <li>
                   2130:                     <p>To enable setuid binaries (optional), run
                   2131:                     REGEDIT.EXE, and change the following registry
                   2132:                     key:</p>
                   2133: 
                   2134:                     <p>
                   2135:                     HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
                   2136:                     for UNIX</p>
                   2137: 
                   2138:                     <p>Set the DWORD value "EnableSetuidBinaries"
                   2139:                     to 1; then reboot.</p>
                   2140:                   </li>
                   2141:                 </ul>
                   2142:               </div>
                   2143:             </div>
                   2144: 
                   2145:             <div class="sect3" lang="en" xml:lang="en">
                   2146:               <div class="titlepage">
                   2147:                 <div>
                   2148:                   <div>
                   2149:                     <h4 class="title"><a name=
                   2150:                     "platform.interix-notes" id=
                   2151:                     "platform.interix-notes"></a>3.2.3.3.&nbsp;Important
                   2152:                     notes for using pkgsrc</h4>
                   2153:                   </div>
                   2154:                 </div>
                   2155:               </div>
                   2156: 
                   2157:               <p>The package imanager (either the pkgsrc "su" user,
                   2158:               or the user running "pkg_add") must be a member of
                   2159:               the local Administrators group. Such a user must also
                   2160:               be used to run the bootstrap. This is slightly
                   2161:               relaxed from the normal pkgsrc requirement of
                   2162:               "root".</p>
                   2163: 
                   2164:               <p>The package manager should use a umask of 002.
                   2165:               "make install" will automatically complain if this is
                   2166:               not the case. This ensures that directories written
                   2167:               in /var/db/pkg are Administrators-group
                   2168:               writeable.</p>
                   2169: 
                   2170:               <p>The popular Interix binary packages from
                   2171:               http://www.interopsystems.com/ use an older version
                   2172:               of pkgsrc's pkg_* tools. Ideally, these should NOT be
                   2173:               used in conjunction with pkgsrc. If you choose to use
                   2174:               them at the same time as the pkgsrc packages, ensure
                   2175:               that you use the proper pkg_* tools for each type of
                   2176:               binary package.</p>
1.22      tv       2177: 
                   2178:               <p>The TERM setting used for DOS-type console windows
                   2179:               (including those invoked by the csh and ksh startup
                   2180:               shortcuts) is "interix". Most systems don't have a
                   2181:               termcap/terminfo entry for it, but the following
                   2182:               .termcap entry provides adequate emulation in most
                   2183:               cases:</p>
                   2184:               <pre class="programlisting">
                   2185: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
                   2186: </pre>
1.1       grant    2187:             </div>
                   2188:           </div>
                   2189: 
                   2190:           <div class="sect2" lang="en" xml:lang="en">
                   2191:             <div class="titlepage">
                   2192:               <div>
                   2193:                 <div>
1.30      wiz      2194:                   <h3 class="title"><a name="irix" id=
                   2195:                   "irix"></a>3.2.4.&nbsp;IRIX</h3>
1.1       grant    2196:                 </div>
                   2197:               </div>
                   2198:             </div>
                   2199: 
                   2200:             <p>You will need a working C compiler, either gcc or
                   2201:             SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14      xtraeme  2202:             the <code class="varname">CC</code> environment
                   2203:             variable according to your preference. If you do not
                   2204:             have a license for the MIPSpro compiler suite, you can
1.1       grant    2205:             download a gcc tardist file from <a href=
                   2206:             "http://freeware.sgi.com/" target=
                   2207:             "_top">http://freeware.sgi.com/</a>.</p>
                   2208: 
                   2209:             <p>Please note that you will need IRIX 6.5.17 or
                   2210:             higher, as this is the earliest version of IRIX
1.24      wiz      2211:             providing support for <a href=
                   2212:             "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
                   2213:             <span class="citerefentry"><span class=
                   2214:             "refentrytitle">if_indextoname</span>(3)</span></a>,
                   2215:             <a href=
                   2216:             "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
                   2217:             <span class="citerefentry"><span class=
                   2218:             "refentrytitle">if_nametoindex</span>(3)</span></a>,
                   2219:             etc.</p>
1.1       grant    2220: 
1.27      rillig   2221:             <p>At this point in time, pkgsrc only supports one ABI
                   2222:             at a time. That is, you can not switch between the old
                   2223:             32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
                   2224:             you start out using "abi=n32", that's what all your
                   2225:             packages will be built with.</p>
1.1       grant    2226: 
                   2227:             <p>Therefore, please make sure that you have no
1.14      xtraeme  2228:             conflicting <code class="varname">CFLAGS</code> in your
                   2229:             environment or the <code class=
                   2230:             "filename">/etc/mk.conf</code>. Particularly, make sure
1.1       grant    2231:             that you do not try to link n32 object files with lib64
1.14      xtraeme  2232:             or vice versa. Check your <code class=
                   2233:             "filename">/etc/compiler.defaults</code>!</p>
1.1       grant    2234: 
                   2235:             <p>If you have the actual pkgsrc tree mounted via NFS
                   2236:             from a different host, please make sure to set
1.14      xtraeme  2237:             <code class="varname">WRKOBJDIR</code> to a local
1.1       grant    2238:             directory, as it appears that IRIX linker occasionally
                   2239:             runs into issues when trying to link over a network
                   2240:             mounted filesystem.</p>
                   2241: 
                   2242:             <p>The bootstrapping process should set all the right
                   2243:             options for programs such as imake(1), but you may want
                   2244:             to set some options depending on your local setup.
1.14      xtraeme  2245:             Please see <code class=
                   2246:             "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27      rillig   2247:             course, your compiler's man pages for details.</p>
1.22      tv       2248: 
                   2249:             <p>If you are using SGI's MIPSPro compiler, please
                   2250:             set</p>
                   2251:             <pre class="programlisting">
                   2252: PKGSRC_COMPILER=mipspro
                   2253: </pre>
                   2254: 
                   2255:             <p>in <code class="filename">/etc/mk.conf</code>.
                   2256:             Otherwise, pkgsrc will assume you are using gcc and may
                   2257:             end up passing invalid flags to the compiler. Note that
                   2258:             bootstrap should create an appropriate <code class=
                   2259:             "filename">mk.conf.example</code> by default.</p>
                   2260: 
                   2261:             <p>If you have both the MIPSPro compiler chain
                   2262:             installed as well as gcc, but want to make sure that
                   2263:             MIPRPro is used, please set your <code class=
                   2264:             "varname">PATH</code> to <span class=
                   2265:             "emphasis"><em>not</em></span> include the location of
                   2266:             gcc (often <code class=
                   2267:             "filename">/usr/freeware/bin</code>), and (important)
                   2268:             pass the '--preserve-path' flag.</p>
1.1       grant    2269:           </div>
                   2270: 
                   2271:           <div class="sect2" lang="en" xml:lang="en">
                   2272:             <div class="titlepage">
                   2273:               <div>
                   2274:                 <div>
1.30      wiz      2275:                   <h3 class="title"><a name="linux" id=
                   2276:                   "linux"></a>3.2.5.&nbsp;Linux</h3>
1.22      tv       2277:                 </div>
                   2278:               </div>
                   2279:             </div>
                   2280: 
                   2281:             <p>Some versions of Linux (for example Debian
                   2282:             GNU/Linux) need either libtermcap or libcurses
                   2283:             (libncurses). Installing the distributions
                   2284:             libncurses-dev package (or equivalent) should fix the
                   2285:             problem.</p>
                   2286: 
                   2287:             <p>pkgsrc supports both gcc (GNU Compiler Collection)
                   2288:             and icc (Intel C++ Compiler). gcc is the default. icc
                   2289:             8.0 and 8.1 on i386 have been tested.</p>
                   2290: 
                   2291:             <p>To bootstrap using icc, assuming the default icc
                   2292:             installation directory:</p>
                   2293:             <pre class="programlisting">
                   2294: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
                   2295:                 ac_cv___attribute__=yes ./bootstrap
                   2296: </pre>
                   2297: 
                   2298:             <div class="note" style=
                   2299:             "margin-left: 0.5in; margin-right: 0.5in;">
                   2300:               <h3 class="title">Note</h3>
                   2301: 
                   2302:               <p>icc 8.1 needs the `-i-static' argument instead of
                   2303:               -static-libcxa.</p>
                   2304:             </div>
                   2305: 
                   2306:             <p>icc supports __attribute__, but the GNU configure
                   2307:             test uses a nested function, which icc does not
                   2308:             support. #undef'ing __attribute__ has the unfortunate
                   2309:             side-effect of breaking many of the Linux header files,
                   2310:             which cannot be compiled properly without
                   2311:             __attribute__. The test must be overridden so that
                   2312:             __attribute__ is assumed supported by the compiler.</p>
                   2313: 
                   2314:             <p>After bootstrapping, you should set <code class=
                   2315:             "varname">PKGSRC_COMPILER</code> in <code class=
                   2316:             "filename">/etc/mk.conf</code>:</p>
                   2317:             <pre class="programlisting">
                   2318: PKGSRC_COMPILER=icc
                   2319: </pre>
                   2320: 
                   2321:             <p>The default installation directory for icc is
                   2322:             <code class="filename">/opt/intel_cc_80</code>, which
                   2323:             is also the pkgsrc default. If you have installed it
                   2324:             into a different directory, set <code class=
                   2325:             "varname">ICCBASE</code> in <code class=
                   2326:             "filename">/etc/mk.conf</code>:</p>
                   2327:             <pre class="programlisting">
                   2328: ICCBASE=/opt/icc
                   2329: </pre>
                   2330: 
                   2331:             <p>pkgsrc uses the static linking method of the runtime
                   2332:             libraries provided by icc, so binaries can be run on
                   2333:             other systems which do not have the shared libraries
                   2334:             installed.</p>
                   2335: 
                   2336:             <p>Libtool, however, extracts a list of libraries from
1.24      wiz      2337:             the <a href=
                   2338:             "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   2339:             <span class="citerefentry"><span class=
                   2340:             "refentrytitle">ld</span>(1)</span></a> command run
                   2341:             when linking a C++ shared library and records it,
                   2342:             throwing away the -Bstatic and -Bdynamic options
                   2343:             interspersed between the libraries. This means that
                   2344:             libtool-linked C++ shared libraries will have a runtime
                   2345:             dependency on the icc libraries until this is fixed in
                   2346:             libtool.</p>
1.22      tv       2347:           </div>
                   2348: 
                   2349:           <div class="sect2" lang="en" xml:lang="en">
                   2350:             <div class="titlepage">
                   2351:               <div>
                   2352:                 <div>
1.30      wiz      2353:                   <h3 class="title"><a name="openbsd" id=
                   2354:                   "openbsd"></a>3.2.6.&nbsp;OpenBSD</h3>
1.1       grant    2355:                 </div>
                   2356:               </div>
                   2357:             </div>
                   2358: 
                   2359:             <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
                   2360: 
                   2361:             <p>Care should be taken so that the tools that this kit
                   2362:             installs do not conflict with the OpenBSD userland
                   2363:             tools. There are several steps:</p>
                   2364: 
                   2365:             <div class="orderedlist">
                   2366:               <ol type="1">
                   2367:                 <li>
                   2368:                   <p>OpenBSD stores its ports pkg database in
1.14      xtraeme  2369:                   <code class="filename">/var/db/pkg</code>. It is
1.1       grant    2370:                   therefore recommended that you choose a different
1.14      xtraeme  2371:                   location (e.g. <code class=
                   2372:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2373:                   --pkgdbdir option to the bootstrap script.</p>
                   2374:                 </li>
                   2375: 
                   2376:                 <li>
                   2377:                   <p>If you do not intend to use the OpenBSD ports
                   2378:                   tools, it's probably a good idea to move them out
                   2379:                   of the way to avoid confusion, e.g.</p>
                   2380:                   <pre class="screen">
1.14      xtraeme  2381: <code class="prompt">#</code> <strong class=
                   2382: "userinput"><code>cd /usr/sbin</code></strong>
                   2383: <code class="prompt">#</code> <strong class=
                   2384: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2385: <code class="prompt">#</code> <strong class=
                   2386: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2387: <code class="prompt">#</code> <strong class=
                   2388: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2389: <code class="prompt">#</code> <strong class=
                   2390: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2391: </pre>
                   2392:                 </li>
                   2393: 
                   2394:                 <li>
1.14      xtraeme  2395:                   <p>An example <code class=
                   2396:                   "filename">/etc/mk.conf</code> file will be
                   2397:                   placed in <code class=
                   2398:                   "filename">/etc/mk.conf.example</code> file when
                   2399:                   you use the bootstrap script. OpenBSD's make
                   2400:                   program uses <code class=
                   2401:                   "filename">/etc/mk.conf</code> as well. You can
1.1       grant    2402:                   work around this by enclosing all the pkgsrc
                   2403:                   specific parts of the file with:</p>
                   2404:                   <pre class="programlisting">
                   2405: .ifdef BSD_PKG_MK
1.11      ben      2406: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
1.1       grant    2407: .else
                   2408: # OpenBSD stuff
                   2409: .endif
                   2410: </pre>
                   2411:                 </li>
                   2412:               </ol>
                   2413:             </div>
                   2414:           </div>
                   2415: 
                   2416:           <div class="sect2" lang="en" xml:lang="en">
                   2417:             <div class="titlepage">
                   2418:               <div>
                   2419:                 <div>
1.30      wiz      2420:                   <h3 class="title"><a name="solaris" id=
                   2421:                   "solaris"></a>3.2.7.&nbsp;Solaris</h3>
1.1       grant    2422:                 </div>
                   2423:               </div>
                   2424:             </div>
                   2425: 
                   2426:             <p>Solaris 2.6 through 9 are supported on both x86 and
                   2427:             sparc. You will need a working C compiler. Both gcc
                   2428:             2.95.3 and Sun WorkShop 5 have been tested.</p>
                   2429: 
                   2430:             <p>The following packages are required on Solaris 8 for
                   2431:             the bootstrap process and to build packages.</p>
                   2432: 
                   2433:             <div class="itemizedlist">
                   2434:               <ul type="disc">
                   2435:                 <li>
                   2436:                   <p>SUNWsprot</p>
                   2437:                 </li>
                   2438: 
                   2439:                 <li>
                   2440:                   <p>SUNWarc</p>
                   2441:                 </li>
                   2442: 
                   2443:                 <li>
                   2444:                   <p>SUNWbtool</p>
                   2445:                 </li>
                   2446: 
                   2447:                 <li>
                   2448:                   <p>SUNWtoo</p>
                   2449:                 </li>
                   2450: 
                   2451:                 <li>
                   2452:                   <p>SUNWlibm</p>
                   2453:                 </li>
                   2454:               </ul>
                   2455:             </div>
                   2456: 
                   2457:             <p>Please note the use of GNU binutils on Solaris is
                   2458:             <span class="emphasis"><em>not</em></span>
                   2459:             supported.</p>
                   2460: 
                   2461:             <div class="sect3" lang="en" xml:lang="en">
                   2462:               <div class="titlepage">
                   2463:                 <div>
                   2464:                   <div>
1.30      wiz      2465:                     <h4 class="title"><a name="solaris-gcc-note"
                   2466:                     id="solaris-gcc-note"></a>3.2.7.1.&nbsp;If you
                   2467:                     are using gcc</h4>
1.1       grant    2468:                   </div>
                   2469:                 </div>
                   2470:               </div>
                   2471: 
                   2472:               <p>It makes life much simpler if you only use the
                   2473:               same gcc consistently for building all packages.</p>
                   2474: 
                   2475:               <p>It is recommended that an external gcc be used
                   2476:               only for bootstrapping, then either build gcc from
                   2477:               <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2478:               href=
                   2479:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.20      ben      2480:               class="pkgname">lang/gcc</a> or install a binary gcc
                   2481:               package, then remove gcc used during
                   2482:               bootstrapping.</p>
1.1       grant    2483: 
                   2484:               <p>Binary packages of gcc can be found through
                   2485:               <a href=
                   2486:               "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20      ben      2487:               target=
                   2488:               "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1       grant    2489:             </div>
                   2490: 
                   2491:             <div class="sect3" lang="en" xml:lang="en">
                   2492:               <div class="titlepage">
                   2493:                 <div>
                   2494:                   <div>
1.30      wiz      2495:                     <h4 class="title"><a name=
                   2496:                     "solaris-sun-workshop-note" id=
                   2497:                     "solaris-sun-workshop-note"></a>3.2.7.2.&nbsp;If
                   2498:                     you are using Sun WorkShop</h4>
1.1       grant    2499:                   </div>
                   2500:                 </div>
                   2501:               </div>
                   2502: 
                   2503:               <p>You will need at least the following packages
                   2504:               installed (from WorkShop 5.0)</p>
                   2505: 
                   2506:               <div class="itemizedlist">
                   2507:                 <ul type="disc">
                   2508:                   <li>
                   2509:                     <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
                   2510:                   </li>
                   2511: 
                   2512:                   <li>
                   2513:                     <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
                   2514:                   </li>
                   2515: 
                   2516:                   <li>
                   2517:                     <p>SPROild - Sun WorkShop Incremental
                   2518:                     Linker</p>
                   2519:                   </li>
                   2520: 
                   2521:                   <li>
                   2522:                     <p>SPROlang - Sun WorkShop Compilers common
                   2523:                     components</p>
                   2524:                   </li>
                   2525:                 </ul>
                   2526:               </div>
                   2527: 
1.14      xtraeme  2528:               <p>You should set <code class="varname">CC</code>,
                   2529:               <code class="varname">CXX</code> and optionally,
                   2530:               <code class="varname">CPP</code> in <code class=
                   2531:               "filename">/etc/mk.conf</code>, eg.</p>
1.1       grant    2532:               <pre class="programlisting">
1.27      rillig   2533: CC=     cc
1.1       grant    2534: CXX=    CC
                   2535: CPP=    /usr/ccs/lib/cpp
                   2536: </pre>
                   2537: 
                   2538:               <p>You may also want to build 64-bit binaries,
                   2539:               eg.</p>
                   2540:               <pre class="programlisting">
                   2541: CFLAGS= -xtarget=ultra -xarch=v9
                   2542: </pre>
                   2543: 
                   2544:               <p>Whichever compiler you use, please ensure the
                   2545:               compiler tools and your $prefix are in your
1.14      xtraeme  2546:               <code class="varname">PATH</code>. This includes
                   2547:               <code class="filename">/usr/ccs/{bin,lib}</code> and
                   2548:               eg. <code class=
                   2549:               "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1       grant    2550:             </div>
                   2551:           </div>
                   2552:         </div>
                   2553:       </div>
                   2554: 
                   2555:       <div class="chapter" lang="en" xml:lang="en">
                   2556:         <div class="titlepage">
                   2557:           <div>
                   2558:             <div>
                   2559:               <h2 class="title"><a name="using" id=
                   2560:               "using"></a>Chapter&nbsp;4.&nbsp;Using pkgsrc</h2>
                   2561:             </div>
                   2562:           </div>
                   2563:         </div>
                   2564: 
                   2565:         <div class="toc">
                   2566:           <p><b>Table of Contents</b></p>
                   2567: 
                   2568:           <dl>
                   2569:             <dt><span class="sect1"><a href="#getting-started">4.1.
                   2570:             Working with binary packages</a></span></dt>
                   2571: 
                   2572:             <dd>
                   2573:               <dl>
1.30      wiz      2574:                 <dt><span class="sect2"><a href=
                   2575:                 "#where-to-get-binary-packages">4.1.1. Where to get
                   2576:                 binary packages</a></span></dt>
1.1       grant    2577: 
1.30      wiz      2578:                 <dt><span class="sect2"><a href=
                   2579:                 "#how-to-use-binary-packages">4.1.2. How to use
                   2580:                 binary packages</a></span></dt>
1.1       grant    2581: 
1.30      wiz      2582:                 <dt><span class="sect2"><a href=
                   2583:                 "#a-word-of-warning">4.1.3. A word of
                   2584:                 warning</a></span></dt>
1.1       grant    2585:               </dl>
                   2586:             </dd>
                   2587: 
1.30      wiz      2588:             <dt><span class="sect1"><a href=
                   2589:             "#building-packages-from-source">4.2. Building packages
                   2590:             from source</a></span></dt>
1.1       grant    2591: 
                   2592:             <dd>
                   2593:               <dl>
1.30      wiz      2594:                 <dt><span class="sect2"><a href=
                   2595:                 "#requirements">4.2.1. Requirements</a></span></dt>
1.1       grant    2596: 
1.30      wiz      2597:                 <dt><span class="sect2"><a href=
                   2598:                 "#fetching-distfiles">4.2.2. Fetching
                   2599:                 distfiles</a></span></dt>
1.1       grant    2600: 
1.30      wiz      2601:                 <dt><span class="sect2"><a href=
                   2602:                 "#how-to-build-and-install">4.2.3. How to build and
                   2603:                 install</a></span></dt>
1.1       grant    2604: 
1.30      wiz      2605:                 <dt><span class="sect2"><a href=
                   2606:                 "#selecting-the-compiler">4.2.4. Selecting the
                   2607:                 compiler</a></span></dt>
1.1       grant    2608:               </dl>
                   2609:             </dd>
                   2610:           </dl>
                   2611:         </div>
                   2612: 
                   2613:         <div class="sect1" lang="en" xml:lang="en">
                   2614:           <div class="titlepage">
                   2615:             <div>
                   2616:               <div>
                   2617:                 <h2 class="title" style="clear: both"><a name=
                   2618:                 "getting-started" id=
                   2619:                 "getting-started"></a>4.1.&nbsp;Working with binary
                   2620:                 packages</h2>
                   2621:               </div>
                   2622:             </div>
                   2623:           </div>
                   2624: 
                   2625:           <p>This section describes how to find, retrieve and
                   2626:           install a precompiled binary package that someone else
                   2627:           already prepared for your type of machine.</p>
                   2628: 
                   2629:           <div class="sect2" lang="en" xml:lang="en">
                   2630:             <div class="titlepage">
                   2631:               <div>
                   2632:                 <div>
1.30      wiz      2633:                   <h3 class="title"><a name=
                   2634:                   "where-to-get-binary-packages" id=
                   2635:                   "where-to-get-binary-packages"></a>4.1.1.&nbsp;Where
                   2636:                   to get binary packages</h3>
1.1       grant    2637:                 </div>
                   2638:               </div>
                   2639:             </div>
                   2640: 
                   2641:             <p>Precompiled packages are stored on ftp.NetBSD.org
1.14      xtraeme  2642:             and its mirrors in the directory <code class=
1.27      rillig   2643:             "filename">/pub/NetBSD/packages/&lt;OSVERSION&gt;/&lt;ARCH&gt;/</code>
                   2644:             for anonymous FTP access. <code class=
                   2645:             "varname">OSVERSION</code> is the NetBSD version
                   2646:             (<span><strong class="command">uname
                   2647:             -r</strong></span>), <code class="varname">ARCH</code>
                   2648:             is the architecture (<span><strong class=
                   2649:             "command">uname -p</strong></span>). In that directory,
                   2650:             there is a subdirectory for each category plus a
                   2651:             subdirectory <code class="filename">All</code> which
                   2652:             includes the actual binaries in <code class=
                   2653:             "filename">.tgz</code> files. The category
                   2654:             subdirectories use symbolic links to those files (this
                   2655:             is the same directory layout as in <code class=
1.14      xtraeme  2656:             "filename">/usr/pkgsrc/packages</code>).</p>
1.1       grant    2657: 
                   2658:             <p>This same directory layout applies for CDROM
                   2659:             distributions, only that the directory may be rooted
1.14      xtraeme  2660:             somewhere else, probably somewhere below <code class=
                   2661:             "filename">/cdrom</code>. Please consult your CDROMs
1.1       grant    2662:             documentation for the exact location.</p>
                   2663:           </div>
                   2664: 
                   2665:           <div class="sect2" lang="en" xml:lang="en">
                   2666:             <div class="titlepage">
                   2667:               <div>
                   2668:                 <div>
1.30      wiz      2669:                   <h3 class="title"><a name=
                   2670:                   "how-to-use-binary-packages" id=
                   2671:                   "how-to-use-binary-packages"></a>4.1.2.&nbsp;How
                   2672:                   to use binary packages</h3>
1.1       grant    2673:                 </div>
                   2674:               </div>
                   2675:             </div>
                   2676: 
                   2677:             <p>If you have the files on a CDROM or downloaded them
1.23      wiz      2678:             to your hard disk, you can install them with the
1.27      rillig   2679:             following command (be sure to <span><strong class=
1.14      xtraeme  2680:             "command">su</strong></span> to root first):</p>
1.1       grant    2681:             <pre class="screen">
1.14      xtraeme  2682: <code class="prompt">#</code> <strong class=
                   2683: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1       grant    2684: </pre>
                   2685: 
                   2686:             <p>If you have FTP access and you don't want to
                   2687:             download the packages via FTP prior to installation,
1.14      xtraeme  2688:             you can do this automatically by giving
                   2689:             <span><strong class="command">pkg_add</strong></span>
                   2690:             an FTP URL:</p>
1.1       grant    2691:             <pre class="screen">
1.14      xtraeme  2692: <code class="prompt">#</code> <strong class=
1.27      rillig   2693: "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    2694: </pre>
                   2695: 
1.27      rillig   2696:             <p>Note that any prerequisite packages needed to run
                   2697:             the package in question will be installed, too,
1.1       grant    2698:             assuming they are present where you install from.</p>
                   2699: 
1.23      wiz      2700:             <p>To save some typing, you can set the <code class=
                   2701:             "varname">PKG_PATH</code> environment variable to a
                   2702:             semicolon separated list of paths (including remote
                   2703:             URLs); trailing slashes are not allowed.</p>
                   2704: 
                   2705:             <p>Additionally to the <code class=
                   2706:             "filename">All</code> directory there exists a
                   2707:             <code class="filename">vulnerable</code> directory to
                   2708:             which binary packages with known vulnerabilities are
                   2709:             moved, since removing them could cause missing
                   2710:             dependencies. To use these packages, add the
                   2711:             <code class="filename">vulnerable</code> directory to
                   2712:             your <code class="varname">PKG_PATH</code>. However,
                   2713:             you should run <a xmlns=
                   2714:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   2715:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
                   2716:             class="pkgname">security/audit-packages</a> regularly,
                   2717:             and especially after installing new packages, and
                   2718:             verify that the vulnerabilities are acceptable for your
                   2719:             configuration. An example <code class=
                   2720:             "varname">PKG_PATH</code> would be: <code class=
1.27      rillig   2721:             "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      2722:             Please note that semicolon (';') is a shell
                   2723:             meta-character, so you'll probably have to quote
                   2724:             it.</p>
                   2725: 
1.1       grant    2726:             <p>After you've installed packages, be sure to have
1.27      rillig   2727:             <code class="filename">/usr/pkg/bin</code> and
                   2728:             <code class="filename">/usr/pkg/sbin</code> in your
1.14      xtraeme  2729:             <code class="varname">PATH</code> so you can actually
                   2730:             start the just installed program.</p>
1.1       grant    2731:           </div>
                   2732: 
                   2733:           <div class="sect2" lang="en" xml:lang="en">
                   2734:             <div class="titlepage">
                   2735:               <div>
                   2736:                 <div>
1.30      wiz      2737:                   <h3 class="title"><a name="a-word-of-warning" id=
                   2738:                   "a-word-of-warning"></a>4.1.3.&nbsp;A word of
1.1       grant    2739:                   warning</h3>
                   2740:                 </div>
                   2741:               </div>
                   2742:             </div>
                   2743: 
                   2744:             <p>Please pay very careful attention to the warnings
                   2745:             expressed in the <a href=
                   2746:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2747:             <span class="citerefentry"><span class=
                   2748:             "refentrytitle">pkg_add</span>(1)</span></a> manual
                   2749:             page about the inherent dangers of installing binary
                   2750:             packages which you did not create yourself, and the
                   2751:             security holes that can be introduced onto your system
                   2752:             by indiscriminate adding of such files.</p>
                   2753:           </div>
                   2754:         </div>
                   2755: 
                   2756:         <div class="sect1" lang="en" xml:lang="en">
                   2757:           <div class="titlepage">
                   2758:             <div>
                   2759:               <div>
                   2760:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      2761:                 "building-packages-from-source" id=
                   2762:                 "building-packages-from-source"></a>4.2.&nbsp;Building
1.1       grant    2763:                 packages from source</h2>
                   2764:               </div>
                   2765:             </div>
                   2766:           </div>
                   2767: 
                   2768:           <p>This assumes that the package is already in pkgsrc. If
                   2769:           it is not, see <a href="#developers-guide" title=
1.2       hubertf  2770:           "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">Part&nbsp;II,
1.27      rillig   2771:           &#8220;The pkgsrc developer's guide&#8221;</a> for
                   2772:           instructions how to create your own packages.</p>
1.1       grant    2773: 
                   2774:           <div class="sect2" lang="en" xml:lang="en">
                   2775:             <div class="titlepage">
                   2776:               <div>
                   2777:                 <div>
1.30      wiz      2778:                   <h3 class="title"><a name="requirements" id=
                   2779:                   "requirements"></a>4.2.1.&nbsp;Requirements</h3>
1.1       grant    2780:                 </div>
                   2781:               </div>
                   2782:             </div>
                   2783: 
                   2784:             <p>To build packages from source on a NetBSD system the
                   2785:             &#8220;<span class="quote">comp</span>&#8221; and the
                   2786:             &#8220;<span class="quote">text</span>&#8221;
                   2787:             distribution sets must be installed. If you want to
                   2788:             build X11 related packages the &#8220;<span class=
                   2789:             "quote">xbase</span>&#8221; and &#8220;<span class=
                   2790:             "quote">xcomp</span>&#8221; distribution sets are
                   2791:             required, too.</p>
                   2792:           </div>
                   2793: 
                   2794:           <div class="sect2" lang="en" xml:lang="en">
                   2795:             <div class="titlepage">
                   2796:               <div>
                   2797:                 <div>
1.30      wiz      2798:                   <h3 class="title"><a name="fetching-distfiles"
                   2799:                   id="fetching-distfiles"></a>4.2.2.&nbsp;Fetching
1.1       grant    2800:                   distfiles</h3>
                   2801:                 </div>
                   2802:               </div>
                   2803:             </div>
                   2804: 
1.27      rillig   2805:             <p>The first step for building a package is downloading
                   2806:             the distfiles (i.e. the unmodified source). If they
                   2807:             have not yet been downloaded, pkgsrc will fetch them
1.1       grant    2808:             automatically.</p>
                   2809: 
                   2810:             <p>You can overwrite some of the major distribution
                   2811:             sites to fit to sites that are close to your own. Have
1.14      xtraeme  2812:             a look at <code class=
                   2813:             "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27      rillig   2814:             some examples &#8212; in particular, look for the
1.14      xtraeme  2815:             <code class="varname">MASTER_SORT</code>, <code class=
                   2816:             "varname">MASTER_SORT_REGEX</code> and <code class=
                   2817:             "varname">INET_COUNTRY</code> definitions. This may
                   2818:             save some of your bandwidth and time.</p>
1.1       grant    2819: 
                   2820:             <p>You can change these settings either in your shell's
                   2821:             environment, or, if you want to keep the settings, by
1.14      xtraeme  2822:             editing the <code class="filename">/etc/mk.conf</code>
1.1       grant    2823:             file, and adding the definitions there.</p>
                   2824: 
                   2825:             <p>If you don't have a permanent Internet connection
                   2826:             and you want to know which files to download,
1.14      xtraeme  2827:             <span><strong class="command">make
                   2828:             fetch-list</strong></span> will tell you what you'll
                   2829:             need. Put these distfiles into <code class=
                   2830:             "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    2831:           </div>
                   2832: 
                   2833:           <div class="sect2" lang="en" xml:lang="en">
                   2834:             <div class="titlepage">
                   2835:               <div>
                   2836:                 <div>
1.30      wiz      2837:                   <h3 class="title"><a name=
                   2838:                   "how-to-build-and-install" id=
                   2839:                   "how-to-build-and-install"></a>4.2.3.&nbsp;How to
                   2840:                   build and install</h3>
1.1       grant    2841:                 </div>
                   2842:               </div>
                   2843:             </div>
                   2844: 
                   2845:             <p>Assuming that the distfile has been fetched (see
                   2846:             previous section), become root and change into the
1.14      xtraeme  2847:             relevant directory and running <span><strong class=
                   2848:             "command">make</strong></span>. For example, type</p>
1.1       grant    2849:             <pre class="screen">
1.14      xtraeme  2850: <code class="prompt">%</code> <strong class=
                   2851: "userinput"><code>cd misc/figlet</code></strong>
                   2852: <code class="prompt">%</code> <strong class=
                   2853: "userinput"><code>make</code></strong>
1.1       grant    2854: </pre>
                   2855: 
                   2856:             <p>at the shell prompt to build the various components
                   2857:             of the package, and</p>
                   2858:             <pre class="screen">
1.14      xtraeme  2859: <code class="prompt">#</code> <strong class=
                   2860: "userinput"><code>make install</code></strong>
1.1       grant    2861: </pre>
                   2862: 
                   2863:             <p>to install the various components into the correct
                   2864:             places on your system. Installing the package on your
                   2865:             system requires you to be root. However, pkgsrc has a
                   2866:             <span class="emphasis"><em>just-in-time-su</em></span>
                   2867:             feature, which allows you to only become root for the
                   2868:             actual installation step</p>
                   2869: 
                   2870:             <p>Taking the figlet utility as an example, we can
                   2871:             install it on our system by building as shown in
                   2872:             <a href="#logs" title=
                   2873:             "Appendix&nbsp;B.&nbsp;Build logs">Appendix B, <i>Build
                   2874:             logs</i></a>.</p>
                   2875: 
                   2876:             <p>The program is installed under the default root of
1.14      xtraeme  2877:             the packages tree - <code class=
                   2878:             "filename">/usr/pkg</code>. Should this not conform to
                   2879:             your tastes, set the <code class=
                   2880:             "varname">LOCALBASE</code> variable in your
1.1       grant    2881:             environment, and it will use that value as the root of
1.14      xtraeme  2882:             your packages tree. So, to use <code class=
                   2883:             "filename">/usr/local</code>, set <code class=
                   2884:             "varname">LOCALBASE=/usr/local</code> in your
1.1       grant    2885:             environment. Please note that you should use a
                   2886:             directory which is dedicated to packages and not shared
1.14      xtraeme  2887:             with other programs (ie, do not try and use
                   2888:             <code class="varname">LOCALBASE=/usr</code>). Also, you
                   2889:             should not try to add any of your own files or
                   2890:             directories (such as <code class=
                   2891:             "filename">src/</code>, <code class=
                   2892:             "filename">obj/</code>, or <code class=
                   2893:             "filename">pkgsrc/</code>) below the <code class=
                   2894:             "varname">LOCALBASE</code> tree. This is to prevent
1.1       grant    2895:             possible conflicts between programs and other files
                   2896:             installed by the package system and whatever else may
                   2897:             have been installed there.</p>
                   2898: 
1.14      xtraeme  2899:             <p>Some packages look in <code class=
                   2900:             "filename">/etc/mk.conf</code> to alter some
1.1       grant    2901:             configuration options at build time. Have a look at
1.14      xtraeme  2902:             <code class=
                   2903:             "filename">pkgsrc/mk/defaults/mk.conf</code> to get an
                   2904:             overview of what will be set there by default.
                   2905:             Environment variables such as <code class=
                   2906:             "varname">LOCALBASE</code> can be set in <code class=
                   2907:             "filename">/etc/mk.conf</code> to save having to
                   2908:             remember to set them each time you want to use
                   2909:             pkgsrc.</p>
1.1       grant    2910: 
                   2911:             <p>Occasionally, people want to &#8220;<span class=
                   2912:             "quote">look under the covers</span>&#8221; to see what
                   2913:             is going on when a package is building or being
                   2914:             installed. This may be for debugging purposes, or out
                   2915:             of simple curiosity. A number of utility values have
                   2916:             been added to help with this.</p>
                   2917: 
                   2918:             <div class="orderedlist">
                   2919:               <ol type="1">
                   2920:                 <li>
                   2921:                   <p>If you invoke the <a href=
                   2922:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2923:                   <span class="citerefentry"><span class=
                   2924:                   "refentrytitle">make</span>(1)</span></a> command
1.14      xtraeme  2925:                   with <code class=
                   2926:                   "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
                   2927:                   amount of information will be displayed. For
                   2928:                   example,</p>
1.1       grant    2929:                   <pre class="screen">
1.14      xtraeme  2930: <strong class=
                   2931: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1       grant    2932: </pre>
                   2933: 
                   2934:                   <p>will show all the commands that are invoked,
                   2935:                   up to and including the &#8220;<span class=
                   2936:                   "quote">patch</span>&#8221; stage.</p>
                   2937:                 </li>
                   2938: 
                   2939:                 <li>
                   2940:                   <p>If you want to know the value of a certain
1.22      tv       2941:                   <a href=
                   2942:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2943:                   <span class="citerefentry"><span class=
                   2944:                   "refentrytitle">make</span>(1)</span></a>
                   2945:                   definition, then the <code class=
1.14      xtraeme  2946:                   "varname">VARNAME</code> definition should be
                   2947:                   used, in conjunction with the show-var target.
                   2948:                   e.g. to show the expansion of the <a href=
1.1       grant    2949:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2950:                   <span class="citerefentry"><span class=
                   2951:                   "refentrytitle">make</span>(1)</span></a>
1.14      xtraeme  2952:                   variable <code class=
1.22      tv       2953:                   "varname">LOCALBASE</code>:</p>
1.1       grant    2954:                   <pre class="screen">
1.14      xtraeme  2955: <code class="prompt">%</code> <strong class=
                   2956: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1       grant    2957: /usr/pkg
1.14      xtraeme  2958: <code class="prompt">%</code>
1.1       grant    2959:           
                   2960: </pre>
                   2961:                 </li>
                   2962:               </ol>
                   2963:             </div>
                   2964: 
                   2965:             <p>If you want to install a binary package that you've
                   2966:             either created yourself (see next section), that you
                   2967:             put into pkgsrc/packages manually or that is located on
1.8       wiz      2968:             a remote FTP server, you can use the "bin-install"
1.1       grant    2969:             target. This target will install a binary package - if
                   2970:             available - via <a href=
                   2971:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2972:             <span class="citerefentry"><span class=
                   2973:             "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14      xtraeme  2974:             <span><strong class="command">make
                   2975:             package</strong></span>. The list of remote FTP sites
                   2976:             searched is kept in the variable <code class=
                   2977:             "varname">BINPKG_SITES</code>, which defaults to
                   2978:             ftp.NetBSD.org. Any flags that should be added to
                   2979:             <a href=
1.1       grant    2980:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2981:             <span class="citerefentry"><span class=
                   2982:             "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14      xtraeme  2983:             into <code class="varname">BIN_INSTALL_FLAGS</code>.
                   2984:             See <code class=
                   2985:             "filename">pkgsrc/mk/defaults/mk.conf</code> for more
                   2986:             details.</p>
1.1       grant    2987: 
                   2988:             <p>A final word of warning: If you setup a system that
1.14      xtraeme  2989:             has a non-standard setting for <code class=
                   2990:             "varname">LOCALBASE</code>, be sure to set that before
1.1       grant    2991:             any packages are installed, as you can not use several
                   2992:             directories for the same purpose. Doing so will result
                   2993:             in pkgsrc not being able to properly detect your
                   2994:             installed packages, and fail miserably. Note also that
                   2995:             precompiled binary packages are usually built with the
1.14      xtraeme  2996:             default <code class="varname">LOCALBASE</code> of
                   2997:             <code class="filename">/usr/pkg</code>, and that you
                   2998:             should <span class="emphasis"><em>not</em></span>
                   2999:             install any if you use a non-standard <code class=
                   3000:             "varname">LOCALBASE</code>.</p>
1.1       grant    3001:           </div>
                   3002: 
                   3003:           <div class="sect2" lang="en" xml:lang="en">
                   3004:             <div class="titlepage">
                   3005:               <div>
                   3006:                 <div>
1.30      wiz      3007:                   <h3 class="title"><a name=
                   3008:                   "selecting-the-compiler" id=
                   3009:                   "selecting-the-compiler"></a>4.2.4.&nbsp;Selecting
                   3010:                   the compiler</h3>
1.1       grant    3011:                 </div>
                   3012:               </div>
                   3013:             </div>
                   3014: 
                   3015:             <p>By default, pkgsrc will use GCC to build packages.
                   3016:             This may be overridden by setting the following
                   3017:             variables in /etc/mk.conf:</p>
                   3018: 
                   3019:             <div class="variablelist">
                   3020:               <dl>
1.14      xtraeme  3021:                 <dt><span class="term"><code class=
                   3022:                 "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1       grant    3023: 
                   3024:                 <dd>
                   3025:                   <p>This is a list of values specifying the chain
                   3026:                   of compilers to invoke when building packages.
                   3027:                   Valid values are:</p>
                   3028: 
                   3029:                   <div class="itemizedlist">
                   3030:                     <ul type="disc">
                   3031:                       <li>
1.14      xtraeme  3032:                         <p><code class="varname">distcc</code>:
1.1       grant    3033:                         distributed C/C++ (chainable)</p>
                   3034:                       </li>
                   3035: 
                   3036:                       <li>
1.14      xtraeme  3037:                         <p><code class="varname">ccache</code>:
1.1       grant    3038:                         compiler cache (chainable)</p>
                   3039:                       </li>
                   3040: 
                   3041:                       <li>
1.14      xtraeme  3042:                         <p><code class="varname">gcc</code>: GNU
                   3043:                         C/C++ Compiler</p>
1.1       grant    3044:                       </li>
                   3045: 
                   3046:                       <li>
1.14      xtraeme  3047:                         <p><code class="varname">mipspro</code>:
1.1       grant    3048:                         Silicon Graphics, Inc. MIPSpro
                   3049:                         (n32/n64)</p>
                   3050:                       </li>
                   3051: 
                   3052:                       <li>
1.14      xtraeme  3053:                         <p><code class="varname">mipspro</code>:
1.1       grant    3054:                         Silicon Graphics, Inc. MIPSpro (o32)</p>
                   3055:                       </li>
                   3056: 
                   3057:                       <li>
1.14      xtraeme  3058:                         <p><code class="varname">sunpro</code>:
1.1       grant    3059:                         Microsystems, Inc. WorkShip/Forte/Sun ONE
                   3060:                         Studio</p>
                   3061:                       </li>
                   3062:                     </ul>
                   3063:                   </div>
                   3064: 
                   3065:                   <p>The default is &#8220;<span class=
1.14      xtraeme  3066:                   "quote"><code class=
                   3067:                   "varname">gcc</code></span>&#8221;. You can use
                   3068:                   <code class="varname">ccache</code> and/or
                   3069:                   <code class="varname">distcc</code> with an
                   3070:                   appropriate <code class=
                   3071:                   "varname">PKGSRC_COMPILER</code> setting, e.g.
                   3072:                   &#8220;<span class="quote"><code class=
                   3073:                   "varname">ccache gcc</code></span>&#8221;. This
1.1       grant    3074:                   variable should always be terminated with a value
                   3075:                   for a real compiler.</p>
                   3076:                 </dd>
                   3077: 
1.14      xtraeme  3078:                 <dt><span class="term"><code class=
                   3079:                 "varname">GCC_REQD</code>:</span></dt>
1.1       grant    3080: 
                   3081:                 <dd>
                   3082:                   <p>This specifies the minimum version of GCC to
                   3083:                   use when building packages. If the system GCC
                   3084:                   doesn't satisfy this requirement, then pkgsrc
                   3085:                   will build and install one of the GCC packages to
                   3086:                   use instead.</p>
                   3087:                 </dd>
                   3088:               </dl>
                   3089:             </div>
                   3090:           </div>
                   3091:         </div>
                   3092:       </div>
                   3093: 
                   3094:       <div class="chapter" lang="en" xml:lang="en">
                   3095:         <div class="titlepage">
                   3096:           <div>
                   3097:             <div>
1.38      dillo    3098:               <h2 class="title"><a name="configuring" id=
                   3099:               "configuring"></a>Chapter&nbsp;5.&nbsp;Configuring
                   3100:               pkgsrc</h2>
                   3101:             </div>
                   3102:           </div>
                   3103:         </div>
                   3104: 
                   3105:         <div class="toc">
                   3106:           <p><b>Table of Contents</b></p>
                   3107: 
                   3108:           <dl>
                   3109:             <dt><span class="sect1"><a href=
1.42      dillo    3110:             "#selecting-options">5.1. Selecting Build
                   3111:             Options</a></span></dt>
1.38      dillo    3112:           </dl>
                   3113:         </div>
                   3114: 
                   3115:         <div class="sect1" lang="en" xml:lang="en">
                   3116:           <div class="titlepage">
                   3117:             <div>
                   3118:               <div>
                   3119:                 <h2 class="title" style="clear: both"><a name=
                   3120:                 "selecting-options" id=
1.42      dillo    3121:                 "selecting-options"></a>5.1.&nbsp;Selecting Build
                   3122:                 Options</h2>
1.38      dillo    3123:               </div>
                   3124:             </div>
                   3125:           </div>
                   3126: 
                   3127:           <p>Some packages have build time options, usually to
                   3128:           select between different dependencies, enable optional
                   3129:           support for big dependencies or enable experimental
                   3130:           features.</p>
                   3131: 
                   3132:           <p>To see which options, if any, a package supports, and
                   3133:           which options are mutually exclusive, run
                   3134:           <span><strong class="command">make
                   3135:           show-options</strong></span>, for example:</p>
                   3136:           <pre class="programlisting">
1.44    ! gdt      3137:       The following options are supported by this package:
        !          3138:       ssl      Enable SSL support.
        !          3139:       Exactly one of the following gecko options is required:
        !          3140:       firefox  Use firefox as gecko rendering engine.
        !          3141:       mozilla  Use mozilla as gecko rendering engine.
        !          3142:       At most one of the following database options may be selected:
        !          3143:       mysql    Enable support for MySQL database.
        !          3144:       pgsql    Enable support for PostgreSQL database.
1.38      dillo    3145: 
1.44    ! gdt      3146:       These options are enabled by default: firefox
        !          3147:       These options are currently enabled: mozilla ssl
        !          3148:     
1.38      dillo    3149: </pre>
                   3150: 
                   3151:           <p>The following variables can be defined in <code class=
                   3152:           "filename">/etc/mk.conf</code> to select which options to
                   3153:           enable for a package: <code class=
                   3154:           "varname">PKG_DEFAULT_OPTIONS</code>, which can be used
                   3155:           to select or disable options for all packages that
                   3156:           support them, and <code class=
                   3157:           "varname">PKG_OPTIONS.<em class=
                   3158:           "replaceable"><code>pkgbase</code></em></code>, which can
                   3159:           be used to select or disable options specifically for
                   3160:           package <em class=
                   3161:           "replaceable"><code>pkgbase</code></em>. Options listed
                   3162:           in these variables are selected, options preceded by
                   3163:           &#8220;<span class="quote">-</span>&#8221; are
                   3164:           disabled.</p>
                   3165: 
1.39      dillo    3166:           <p>The following settings are consulted in the order
                   3167:           given, and the last setting that selects or disables an
                   3168:           option is used:</p>
1.38      dillo    3169: 
                   3170:           <div class="orderedlist">
                   3171:             <ol type="1">
                   3172:               <li>
                   3173:                 <p>the default options as suggested by the package
                   3174:                 maintainer</p>
                   3175:               </li>
                   3176: 
                   3177:               <li>
                   3178:                 <p>the options implied by the settings of legacy
                   3179:                 variables (see below)</p>
                   3180:               </li>
                   3181: 
                   3182:               <li>
                   3183:                 <p><code class=
                   3184:                 "varname">PKG_DEFAULT_OPTIONS</code></p>
                   3185:               </li>
                   3186: 
                   3187:               <li>
                   3188:                 <p><code class="varname">PKG_OPTIONS.<em class=
                   3189:                 "replaceable"><code>pkgbase</code></em></code></p>
                   3190:               </li>
                   3191:             </ol>
                   3192:           </div>
                   3193: 
                   3194:           <p>For groups of mutually exclusive options, the last
                   3195:           option selected is used, all others are automatically
                   3196:           disabled. If an option of the group is explicitly
                   3197:           disabled, the previously selected option, if any, is
                   3198:           used. It is an error if no option from a required group
                   3199:           of options is selected, and building the package will
                   3200:           fail.</p>
                   3201: 
                   3202:           <p>Before the options framework was introduced, build
                   3203:           options were selected by setting a variable in
                   3204:           <code class="filename">/etc/mk.conf</code> for each
                   3205:           option. To ease transition to the options framework for
                   3206:           the user, these legacy variables are converted to the
                   3207:           appropriate options setting automatically. A warning is
                   3208:           issued to prompt the user to update <code class=
                   3209:           "filename">/etc/mk.conf</code> to use the options
                   3210:           framework directly. Support for these legacy variables
                   3211:           will be removed eventually.</p>
                   3212:         </div>
                   3213:       </div>
                   3214: 
                   3215:       <div class="chapter" lang="en" xml:lang="en">
                   3216:         <div class="titlepage">
                   3217:           <div>
                   3218:             <div>
1.1       grant    3219:               <h2 class="title"><a name="binary" id=
1.38      dillo    3220:               "binary"></a>Chapter&nbsp;6.&nbsp;Creating binary
1.1       grant    3221:               packages</h2>
                   3222:             </div>
                   3223:           </div>
                   3224:         </div>
                   3225: 
                   3226:         <div class="toc">
                   3227:           <p><b>Table of Contents</b></p>
                   3228: 
                   3229:           <dl>
1.30      wiz      3230:             <dt><span class="sect1"><a href=
1.38      dillo    3231:             "#building-a-single-binary-package">6.1. Building a
1.30      wiz      3232:             single binary package</a></span></dt>
1.1       grant    3233: 
1.30      wiz      3234:             <dt><span class="sect1"><a href=
1.38      dillo    3235:             "#settings-for-creationg-of-binary-packages">6.2.
1.1       grant    3236:             Settings for creation of binary
                   3237:             packages</a></span></dt>
                   3238: 
1.38      dillo    3239:             <dt><span class="sect1"><a href="#bulkbuild">6.3. Doing
1.1       grant    3240:             a bulk build of all packages</a></span></dt>
                   3241: 
                   3242:             <dd>
                   3243:               <dl>
                   3244:                 <dt><span class="sect2"><a href=
1.38      dillo    3245:                 "#binary.configuration">6.3.1.
1.1       grant    3246:                 Configuration</a></span></dt>
                   3247: 
1.30      wiz      3248:                 <dt><span class="sect2"><a href=
1.38      dillo    3249:                 "#other-environmental-considerations">6.3.2. Other
1.30      wiz      3250:                 environmental considerations</a></span></dt>
1.1       grant    3251: 
1.38      dillo    3252:                 <dt><span class="sect2"><a href="#operation">6.3.3.
1.1       grant    3253:                 Operation</a></span></dt>
                   3254: 
1.30      wiz      3255:                 <dt><span class="sect2"><a href=
1.38      dillo    3256:                 "#what-it-does">6.3.4. What it does</a></span></dt>
1.1       grant    3257: 
1.30      wiz      3258:                 <dt><span class="sect2"><a href=
1.38      dillo    3259:                 "#disk-space-requirements">6.3.5. Disk space
1.30      wiz      3260:                 requirements</a></span></dt>
1.1       grant    3261: 
1.30      wiz      3262:                 <dt><span class="sect2"><a href=
1.38      dillo    3263:                 "#setting-up-a-sandbox">6.3.6. Setting up a sandbox
1.30      wiz      3264:                 for chroot'ed builds</a></span></dt>
1.1       grant    3265: 
1.30      wiz      3266:                 <dt><span class="sect2"><a href=
1.38      dillo    3267:                 "#building-a-partial-set">6.3.7. Building a partial
1.30      wiz      3268:                 set of packages</a></span></dt>
1.13      hubertf  3269: 
                   3270:                 <dt><span class="sect2"><a href=
1.38      dillo    3271:                 "#bulk-upload">6.3.8. Uploading results of a bulk
1.13      hubertf  3272:                 build</a></span></dt>
1.1       grant    3273:               </dl>
                   3274:             </dd>
                   3275: 
1.38      dillo    3276:             <dt><span class="sect1"><a href="#creating-cdroms">6.4.
1.1       grant    3277:             Creating a multiple CD-ROM packages
                   3278:             collection</a></span></dt>
                   3279: 
                   3280:             <dd>
                   3281:               <dl>
1.30      wiz      3282:                 <dt><span class="sect2"><a href=
1.38      dillo    3283:                 "#cdpack-example">6.4.1. Example of
1.30      wiz      3284:                 cdpack</a></span></dt>
1.1       grant    3285:               </dl>
                   3286:             </dd>
                   3287:           </dl>
                   3288:         </div>
                   3289: 
                   3290:         <div class="sect1" lang="en" xml:lang="en">
                   3291:           <div class="titlepage">
                   3292:             <div>
                   3293:               <div>
                   3294:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      3295:                 "building-a-single-binary-package" id=
1.38      dillo    3296:                 "building-a-single-binary-package"></a>6.1.&nbsp;Building
1.30      wiz      3297:                 a single binary package</h2>
1.1       grant    3298:               </div>
                   3299:             </div>
                   3300:           </div>
                   3301: 
                   3302:           <p>Once you have built and installed a package, you can
                   3303:           create a <span class="emphasis"><em>binary
                   3304:           package</em></span> which can be installed on another
                   3305:           system with <a href=
                   3306:           "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3307:           <span class="citerefentry"><span class=
                   3308:           "refentrytitle">pkg_add</span>(1)</span></a> This saves
                   3309:           having to build the same package on a group of hosts and
                   3310:           wasting CPU time. It also provides a simple means for
                   3311:           others to install your package, should you distribute
                   3312:           it.</p>
                   3313: 
                   3314:           <p>To create a binary package, change into the
1.14      xtraeme  3315:           appropriate directory in pkgsrc, and run
                   3316:           <span><strong class="command">make
                   3317:           package</strong></span>:</p>
1.1       grant    3318:           <pre class="screen">
1.14      xtraeme  3319: <code class="prompt">#</code> <strong class=
                   3320: "userinput"><code>cd misc/figlet</code></strong>
                   3321: <code class="prompt">#</code> <strong class=
                   3322: "userinput"><code>make package</code></strong>
1.1       grant    3323: </pre>
                   3324: 
                   3325:           <p>This will build and install your package (if not
                   3326:           already done), and then build a binary package from what
1.14      xtraeme  3327:           was installed. You can then use the <span><strong class=
                   3328:           "command">pkg_*</strong></span> tools to manipulate it.
                   3329:           Binary packages are created by default in <code class=
                   3330:           "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1       grant    3331:           gzipped tar file. See <a href="#logs.package" title=
                   3332:           "B.2.&nbsp;Packaging figlet">Section B.2,
                   3333:           &#8220;Packaging figlet&#8221;</a> for a continuation of
                   3334:           the above <a xmlns=
                   3335:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   3336:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.20      ben      3337:           class="pkgname">misc/figlet</a> example.</p>
1.1       grant    3338: 
                   3339:           <p>See <a href="#submit" title=
1.38      dillo    3340:           "Chapter&nbsp;17.&nbsp;Submitting and Committing">Chapter
                   3341:           17, <i>Submitting and Committing</i></a> for information
1.1       grant    3342:           on how to submit such a binary package.</p>
                   3343:         </div>
                   3344: 
                   3345:         <div class="sect1" lang="en" xml:lang="en">
                   3346:           <div class="titlepage">
                   3347:             <div>
                   3348:               <div>
                   3349:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      3350:                 "settings-for-creationg-of-binary-packages" id=
1.38      dillo    3351:                 "settings-for-creationg-of-binary-packages"></a>6.2.&nbsp;Settings
1.1       grant    3352:                 for creation of binary packages</h2>
                   3353:               </div>
                   3354:             </div>
                   3355:           </div>
                   3356: 
                   3357:           <p>See <a href="#build.helpful-targets" title=
1.38      dillo    3358:           "14.3.&nbsp;Other helpful targets">Section&nbsp;14.3,
1.1       grant    3359:           &#8220;Other helpful targets&#8221;</a>.</p>
                   3360:         </div>
                   3361: 
                   3362:         <div class="sect1" lang="en" xml:lang="en">
                   3363:           <div class="titlepage">
                   3364:             <div>
                   3365:               <div>
                   3366:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    3367:                 "bulkbuild" id="bulkbuild"></a>6.3.&nbsp;Doing a
1.1       grant    3368:                 bulk build of all packages</h2>
                   3369:               </div>
                   3370:             </div>
                   3371:           </div>
                   3372: 
                   3373:           <p>If you want to get a full set of precompiled binary
                   3374:           packages, this section describes how to get them. Beware
                   3375:           that the bulk build will remove all currently installed
1.23      wiz      3376:           packages from your system! Having an FTP server
                   3377:           configured either on the machine doing the bulk builds or
                   3378:           on a nearby NFS server can help to make the packages
                   3379:           available to everyone. See <a href=
1.1       grant    3380:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
                   3381:           <span class="citerefentry"><span class=
                   3382:           "refentrytitle">ftpd</span>(8)</span></a> for more
                   3383:           information. If you use a remote NFS server's storage, be
                   3384:           sure to not actually compile on NFS storage, as this
                   3385:           slows things down a lot.</p>
                   3386: 
                   3387:           <div class="sect2" lang="en" xml:lang="en">
                   3388:             <div class="titlepage">
                   3389:               <div>
                   3390:                 <div>
                   3391:                   <h3 class="title"><a name="binary.configuration"
                   3392:                   id=
1.38      dillo    3393:                   "binary.configuration"></a>6.3.1.&nbsp;Configuration</h3>
1.1       grant    3394:                 </div>
                   3395:               </div>
                   3396:             </div>
                   3397: 
                   3398:             <div class="sect3" lang="en" xml:lang="en">
                   3399:               <div class="titlepage">
                   3400:                 <div>
                   3401:                   <div>
                   3402:                     <h4 class="title"><a name="binary.mk.conf" id=
1.38      dillo    3403:                     "binary.mk.conf"></a>6.3.1.1.&nbsp;/etc/mk.conf</h4>
1.1       grant    3404:                   </div>
                   3405:                 </div>
                   3406:               </div>
                   3407: 
1.23      wiz      3408:               <p>You may want to set variables in <code class=
1.14      xtraeme  3409:               "filename">/etc/mk.conf</code>. Look at <code class=
                   3410:               "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1       grant    3411:               details of the default settings. You will want to
1.14      xtraeme  3412:               ensure that <code class=
                   3413:               "varname">ACCEPTABLE_LICENSES</code> meet your local
                   3414:               policy. As used in this example, <code class=
                   3415:               "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1       grant    3416:               "emphasis"><em>all</em></span> licenses.</p>
                   3417:               <pre class="programlisting">
                   3418: PACKAGES?=      ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
                   3419: WRKOBJDIR?=     /usr/tmp/pkgsrc   # build here instead of in pkgsrc
                   3420: BSDSRCDIR=      /usr/src
                   3421: BSDXSRCDIR=     /usr/xsrc         # for x11/xservers
                   3422: OBJHOSTNAME?=   yes               # use work.`hostname`
                   3423: FAILOVER_FETCH= yes               # insist on the correct checksum
                   3424: PKG_DEVELOPER?= yes
                   3425: _ACCEPTABLE=    yes
                   3426: </pre>
                   3427:             </div>
                   3428: 
                   3429:             <div class="sect3" lang="en" xml:lang="en">
                   3430:               <div class="titlepage">
                   3431:                 <div>
                   3432:                   <div>
1.30      wiz      3433:                     <h4 class="title"><a name="build.conf" id=
1.38      dillo    3434:                     "build.conf"></a>6.3.1.2.&nbsp;<code class=
1.14      xtraeme  3435:                     "filename">build.conf</code></h4>
1.1       grant    3436:                   </div>
                   3437:                 </div>
                   3438:               </div>
                   3439: 
1.14      xtraeme  3440:               <p>In <code class="filename">pkgsrc/mk/bulk</code>,
                   3441:               copy <code class="filename">build.conf-example</code>
                   3442:               to <code class="filename">build.conf</code> and edit
                   3443:               it, following the comments in that file. This is the
1.1       grant    3444:               config file that determines where log files are
                   3445:               generated after the build, where to mail the build
1.23      wiz      3446:               report to, where your pkgsrc tree is located and the
                   3447:               user to which user to <a href=
1.1       grant    3448:               "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
                   3449:               <span class="citerefentry"><span class=
1.23      wiz      3450:               "refentrytitle">su</span>(8)</span></a> to do a
1.14      xtraeme  3451:               <span><strong class="command">cvs
                   3452:               update</strong></span>.</p>
1.1       grant    3453:             </div>
                   3454: 
                   3455:             <div class="sect3" lang="en" xml:lang="en">
                   3456:               <div class="titlepage">
                   3457:                 <div>
                   3458:                   <div>
1.30      wiz      3459:                     <h4 class="title"><a name="pre-build.local" id=
1.38      dillo    3460:                     "pre-build.local"></a>6.3.1.3.&nbsp;<code class="filename">
1.30      wiz      3461:                     pre-build.local</code></h4>
1.1       grant    3462:                   </div>
                   3463:                 </div>
                   3464:               </div>
                   3465: 
                   3466:               <p>It is possible to configure the bulk build to
                   3467:               perform certain site specific tasks at the end of the
1.14      xtraeme  3468:               pre-build stage. If the file <code class=
                   3469:               "filename">pre-build.local</code> exists in
1.23      wiz      3470:               <code class="filename">/usr/pkgsrc/mk/bulk</code>, it
1.24      wiz      3471:               will be executed (as a <a href=
                   3472:               "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
                   3473:               <span class="citerefentry"><span class=
                   3474:               "refentrytitle">sh</span>(1)</span></a> script) at
                   3475:               the end of the usual pre-build stage. An example use
                   3476:               of <code class="filename">pre-build.local</code> is
                   3477:               to have the line:</p>
1.1       grant    3478:               <pre class="screen">
1.14      xtraeme  3479: <code class="prompt">#</code> <strong class=
                   3480: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23      wiz      3481:     &gt; pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1       grant    3482: </pre>
                   3483: 
                   3484:               <p>to prevent the system from trying to build a
                   3485:               particular package which requires nearly 3 GB of disk
                   3486:               space.</p>
                   3487:             </div>
                   3488:           </div>
                   3489: 
                   3490:           <div class="sect2" lang="en" xml:lang="en">
                   3491:             <div class="titlepage">
                   3492:               <div>
                   3493:                 <div>
1.30      wiz      3494:                   <h3 class="title"><a name=
                   3495:                   "other-environmental-considerations" id=
1.38      dillo    3496:                   "other-environmental-considerations"></a>6.3.2.&nbsp;Other
1.30      wiz      3497:                   environmental considerations</h3>
1.1       grant    3498:                 </div>
                   3499:               </div>
                   3500:             </div>
                   3501: 
1.14      xtraeme  3502:             <p>As <code class="filename">/usr/pkg</code> will be
1.1       grant    3503:             completely deleted at the start of bulk builds, make
                   3504:             sure your login shell is placed somewhere else. Either
1.14      xtraeme  3505:             drop it into <code class=
                   3506:             "filename">/usr/local/bin</code> (and adjust your login
                   3507:             shell in the passwd file), or (re-)install it via
                   3508:             <a href=
1.1       grant    3509:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3510:             <span class="citerefentry"><span class=
                   3511:             "refentrytitle">pkg_add</span>(1)</span></a> from
1.14      xtraeme  3512:             <code class="filename">/etc/rc.local</code>, so you can
1.1       grant    3513:             login after a reboot (remember that your current
                   3514:             process won't die if the package is removed, you just
                   3515:             can't start any new instances of the shell any more).
                   3516:             Also, if you use NetBSD earlier than 1.5, or you still
                   3517:             want to use the pkgsrc version of ssh for some reason,
                   3518:             be sure to install ssh before starting it from
1.14      xtraeme  3519:             <code class="filename">rc.local</code>:</p>
1.1       grant    3520:             <pre class="programlisting">
                   3521: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
                   3522: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
                   3523:     /usr/pkg/etc/rc.d/sshd
                   3524: fi
                   3525: </pre>
                   3526: 
                   3527:             <p>Not doing so will result in you being not able to
                   3528:             log in via ssh after the bulk build is finished or if
                   3529:             the machine gets rebooted or crashes. You have been
                   3530:             warned! :)</p>
                   3531:           </div>
                   3532: 
                   3533:           <div class="sect2" lang="en" xml:lang="en">
                   3534:             <div class="titlepage">
                   3535:               <div>
                   3536:                 <div>
1.30      wiz      3537:                   <h3 class="title"><a name="operation" id=
1.38      dillo    3538:                   "operation"></a>6.3.3.&nbsp;Operation</h3>
1.1       grant    3539:                 </div>
                   3540:               </div>
                   3541:             </div>
                   3542: 
                   3543:             <p>Make sure you don't need any of the packages still
                   3544:             installed.</p>
                   3545: 
                   3546:             <div class="warning" style=
                   3547:             "margin-left: 0.5in; margin-right: 0.5in;">
                   3548:               <h3 class="title">Warning</h3>
                   3549: 
                   3550:               <p>During the bulk build, <span class=
                   3551:               "emphasis"><em>all packages will be
                   3552:               removed!</em></span></p>
                   3553:             </div>
                   3554: 
                   3555:             <p>Be sure to remove all other things that might
                   3556:             interfere with builds, like some libs installed in
1.14      xtraeme  3557:             <code class="filename">/usr/local</code>, etc. then
                   3558:             become root and type:</p>
1.1       grant    3559:             <pre class="screen">
1.14      xtraeme  3560: <code class="prompt">#</code> <strong class=
                   3561: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   3562: <code class="prompt">#</code> <strong class=
                   3563: "userinput"><code>sh mk/bulk/build</code></strong>
1.1       grant    3564: </pre>
                   3565: 
                   3566:             <p>If for some reason your last build didn't complete
                   3567:             (power failure, system panic, ...), you can continue it
                   3568:             by running:</p>
                   3569:             <pre class="screen">
1.14      xtraeme  3570: <code class="prompt">#</code> <strong class=
                   3571: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1       grant    3572: </pre>
                   3573: 
                   3574:             <p>At the end of the bulk build, you will get a summary
                   3575:             via mail, and find build logs in the directory
1.14      xtraeme  3576:             specified by <code class="varname">FTP</code> in the
                   3577:             <code class="filename">build.conf</code> file.</p>
1.1       grant    3578:           </div>
                   3579: 
                   3580:           <div class="sect2" lang="en" xml:lang="en">
                   3581:             <div class="titlepage">
                   3582:               <div>
                   3583:                 <div>
1.30      wiz      3584:                   <h3 class="title"><a name="what-it-does" id=
1.38      dillo    3585:                   "what-it-does"></a>6.3.4.&nbsp;What it does</h3>
1.1       grant    3586:                 </div>
                   3587:               </div>
                   3588:             </div>
                   3589: 
                   3590:             <p>The bulk builds consist of three steps:</p>
                   3591: 
                   3592:             <div class="variablelist">
                   3593:               <dl>
                   3594:                 <dt><span class="term">1. pre-build</span></dt>
                   3595: 
                   3596:                 <dd>
                   3597:                   <p>The script updates your pkgsrc tree via
                   3598:                   (anon)cvs, then cleans out any broken distfiles,
                   3599:                   and removes all packages installed.</p>
                   3600:                 </dd>
                   3601: 
                   3602:                 <dt><span class="term">2. the bulk
                   3603:                 build</span></dt>
                   3604: 
                   3605:                 <dd>
                   3606:                   <p>This is basically &#8220;<span class=
                   3607:                   "quote">make bulk-package</span>&#8221; with an
                   3608:                   optimised order in which packages will be built.
                   3609:                   Packages that don't require other packages will
                   3610:                   be built first, and packages with many
                   3611:                   dependencies will be built later.</p>
                   3612:                 </dd>
                   3613: 
                   3614:                 <dt><span class="term">3. post-build</span></dt>
                   3615: 
                   3616:                 <dd>
                   3617:                   <p>Generates a report that's placed in the
1.14      xtraeme  3618:                   directory specified in the <code class=
                   3619:                   "filename">build.conf</code> file named
                   3620:                   <code class="filename">broken.html</code>, a
                   3621:                   short version of that report will also be mailed
                   3622:                   to the build's admin.</p>
1.1       grant    3623:                 </dd>
                   3624:               </dl>
                   3625:             </div>
                   3626: 
                   3627:             <p>During the build, a list of broken packages will be
1.14      xtraeme  3628:             compiled in <code class=
                   3629:             "filename">/usr/pkgsrc/.broken</code> (or <code class=
                   3630:             "filename">.../.broken.${MACHINE}</code> if
                   3631:             <code class="varname">OBJMACHINE</code> is set),
                   3632:             individual build logs of broken builds can be found in
                   3633:             the package's directory. These files are used by the
                   3634:             bulk-targets to mark broken builds to not waste time
                   3635:             trying to rebuild them, and they can be used to debug
                   3636:             these broken package builds later.</p>
1.1       grant    3637:           </div>
                   3638: 
                   3639:           <div class="sect2" lang="en" xml:lang="en">
                   3640:             <div class="titlepage">
                   3641:               <div>
                   3642:                 <div>
1.30      wiz      3643:                   <h3 class="title"><a name=
                   3644:                   "disk-space-requirements" id=
1.38      dillo    3645:                   "disk-space-requirements"></a>6.3.5.&nbsp;Disk
1.30      wiz      3646:                   space requirements</h3>
1.1       grant    3647:                 </div>
                   3648:               </div>
                   3649:             </div>
                   3650: 
                   3651:             <p>Currently, roughly the following requirements are
                   3652:             valid for NetBSD 2.0/i386:</p>
                   3653: 
                   3654:             <div class="itemizedlist">
                   3655:               <ul type="disc">
                   3656:                 <li>
                   3657:                   <p>10 GB - distfiles (NFS ok)</p>
                   3658:                 </li>
                   3659: 
                   3660:                 <li>
                   3661:                   <p>8 GB - full set of all binaries (NFS ok)</p>
                   3662:                 </li>
                   3663: 
                   3664:                 <li>
                   3665:                   <p>5 GB - temp space for compiling (local disk
                   3666:                   recommended)</p>
                   3667:                 </li>
                   3668:               </ul>
                   3669:             </div>
                   3670: 
                   3671:             <p>Note that all pkgs will be de-installed as soon as
                   3672:             they are turned into a binary package, and that sources
                   3673:             are removed, so there is no excessively huge demand to
                   3674:             disk space. Afterwards, if the package is needed again,
                   3675:             it will be installed via <a href=
                   3676:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3677:             <span class="citerefentry"><span class=
                   3678:             "refentrytitle">pkg_add</span>(1)</span></a> instead of
                   3679:             building again, so there are no cycles wasted by
                   3680:             recompiling.</p>
                   3681:           </div>
                   3682: 
                   3683:           <div class="sect2" lang="en" xml:lang="en">
                   3684:             <div class="titlepage">
                   3685:               <div>
                   3686:                 <div>
1.30      wiz      3687:                   <h3 class="title"><a name="setting-up-a-sandbox"
1.38      dillo    3688:                   id="setting-up-a-sandbox"></a>6.3.6.&nbsp;Setting
1.30      wiz      3689:                   up a sandbox for chroot'ed builds</h3>
1.1       grant    3690:                 </div>
                   3691:               </div>
                   3692:             </div>
                   3693: 
1.12      agc      3694:             <p>If you don't want all the packages nuked from a
                   3695:             machine (rendering it useless for anything but pkg
1.23      wiz      3696:             compiling), there is the possibility of doing the
                   3697:             package bulk build inside a chroot environment.</p>
1.12      agc      3698: 
                   3699:             <p>The first step is to set up a chroot sandbox, e.g.
1.14      xtraeme  3700:             <code class="filename">/usr/sandbox</code>. This can be
1.12      agc      3701:             done by using null mounts, or manually.</p>
                   3702: 
1.14      xtraeme  3703:             <p>There is a shell script called <code class=
                   3704:             "filename">pkgsrc/mk/bulk/mksandbox</code> which will
                   3705:             set up the sandbox environment using null mounts. It
                   3706:             will also create a script called <code class=
                   3707:             "filename">sandbox</code> in the root of the sandbox
1.12      agc      3708:             environment, which will allow the null mounts to be
1.14      xtraeme  3709:             activated using the <span><strong class=
                   3710:             "command">sandbox mount</strong></span> command and
                   3711:             deactivated using the <span><strong class=
                   3712:             "command">sandbox umount</strong></span> command.</p>
1.12      agc      3713: 
                   3714:             <p>To set up a sandbox environment by hand, after
                   3715:             extracting all the sets from a NetBSD installation or
1.14      xtraeme  3716:             doing a <span><strong class="command">make distribution
                   3717:             DESTDIR=/usr/sandbox</strong></span> in <code class=
                   3718:             "filename">/usr/src/etc</code>, be sure the following
1.7       wiz      3719:             items are present and properly configured:</p>
1.1       grant    3720: 
                   3721:             <div class="procedure">
                   3722:               <ol type="1">
                   3723:                 <li>
                   3724:                   <p>Kernel</p>
                   3725:                   <pre class="screen">
1.14      xtraeme  3726: <code class="prompt">#</code> <strong class=
                   3727: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1       grant    3728: </pre>
                   3729:                 </li>
                   3730: 
                   3731:                 <li>
1.14      xtraeme  3732:                   <p><code class="filename">/dev/*</code></p>
1.1       grant    3733:                   <pre class="screen">
1.14      xtraeme  3734: <code class="prompt">#</code> <strong class=
                   3735: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1       grant    3736: </pre>
                   3737:                 </li>
                   3738: 
                   3739:                 <li>
1.14      xtraeme  3740:                   <p><code class="filename">/etc/resolv.conf</code>
1.1       grant    3741:                   (for <a xmlns=
                   3742:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3743:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.20      ben      3744:                   class="pkgname">security/smtpd</a> and mail):</p>
1.1       grant    3745:                   <pre class="screen">
1.14      xtraeme  3746: <code class="prompt">#</code> <strong class=
                   3747: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1       grant    3748: </pre>
                   3749:                 </li>
                   3750: 
                   3751:                 <li>
                   3752:                   <p>Working(!) mail config (hostname,
                   3753:                   sendmail.cf):</p>
                   3754:                   <pre class="screen">
1.14      xtraeme  3755: <code class="prompt">#</code> <strong class=
                   3756: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1       grant    3757: </pre>
                   3758:                 </li>
                   3759: 
                   3760:                 <li>
1.14      xtraeme  3761:                   <p><code class="filename">/etc/localtime</code>
                   3762:                   (for <a xmlns=
1.1       grant    3763:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3764:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.20      ben      3765:                   class="pkgname">security/smtpd</a>):</p>
1.1       grant    3766:                   <pre class="screen">
1.14      xtraeme  3767: <code class="prompt">#</code> <strong class=
                   3768: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1       grant    3769: </pre>
                   3770:                 </li>
                   3771: 
                   3772:                 <li>
1.14      xtraeme  3773:                   <p><code class="filename">/usr/src</code> (system
1.1       grant    3774:                   sources, for <a xmlns=
                   3775:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3776:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.20      ben      3777:                   class="pkgname">sysutils/aperture</a>, <a xmlns=
                   3778:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3779:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
                   3780:                   class="pkgname">net/ppp-mppe</a>):</p>
1.1       grant    3781:                   <pre class="screen">
1.14      xtraeme  3782: <code class="prompt">#</code> <strong class=
                   3783: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
                   3784: <code class="prompt">#</code> <strong class=
1.23      wiz      3785: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1       grant    3786: </pre>
                   3787:                 </li>
                   3788: 
                   3789:                 <li>
1.14      xtraeme  3790:                   <p>Create <code class=
                   3791:                   "filename">/var/db/pkg</code> (not part of
                   3792:                   default install):</p>
1.1       grant    3793:                   <pre class="screen">
1.14      xtraeme  3794: <code class="prompt">#</code> <strong class=
                   3795: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1       grant    3796: </pre>
                   3797:                 </li>
                   3798: 
                   3799:                 <li>
1.14      xtraeme  3800:                   <p>Create <code class="filename">/usr/pkg</code>
                   3801:                   (not part of default install):</p>
1.1       grant    3802:                   <pre class="screen">
1.14      xtraeme  3803: <code class="prompt">#</code> <strong class=
                   3804: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1       grant    3805: </pre>
                   3806:                 </li>
                   3807: 
                   3808:                 <li>
1.14      xtraeme  3809:                   <p>Checkout pkgsrc via cvs into <code class=
                   3810:                   "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1       grant    3811:                   <pre class="screen">
1.14      xtraeme  3812: <code class="prompt">#</code> <strong class=
                   3813: "userinput"><code>cd /usr/sandbox/usr</code></strong>
                   3814: <code class="prompt">#</code> <strong class=
                   3815: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1       grant    3816: </pre>
                   3817: 
                   3818:                   <p>Do not mount/link this to the copy of your
                   3819:                   pkgsrc tree you do development in, as this will
                   3820:                   likely cause problems!</p>
                   3821:                 </li>
                   3822: 
                   3823:                 <li>
1.14      xtraeme  3824:                   <p>Make <code class=
                   3825:                   "filename">/usr/sandbox/usr/pkgsrc/packages</code>
                   3826:                   and <code class="filename">.../distfiles</code>
                   3827:                   point somewhere appropriate. NFS- and/or
                   3828:                   nullfs-mounts may come in handy!</p>
1.1       grant    3829:                 </li>
                   3830: 
                   3831:                 <li>
1.14      xtraeme  3832:                   <p>Edit <code class=
                   3833:                   "filename">/etc/mk.conf</code>, see <a href=
                   3834:                   "#binary.mk.conf" title=
1.38      dillo    3835:                   "6.3.1.1.&nbsp;/etc/mk.conf">Section&nbsp;6.3.1.1,
1.1       grant    3836:                   &#8220;/etc/mk.conf&#8221;</a>.</p>
                   3837:                 </li>
                   3838: 
                   3839:                 <li>
1.14      xtraeme  3840:                   <p>Adjust <code class=
                   3841:                   "filename">mk/bulk/build.conf</code> to suit your
1.1       grant    3842:                   needs.</p>
                   3843:                 </li>
                   3844: 
                   3845:                 <li>
1.14      xtraeme  3846:                   <p>If you have set <code class=
                   3847:                   "varname">CVS_USER</code> in <code class=
                   3848:                   "filename">build.conf</code>, make sure that
                   3849:                   account exists and can do a <span><strong class=
                   3850:                   "command">cvs ${CVS_FLAGS} update</strong></span>
1.1       grant    3851:                   properly!</p>
                   3852:                 </li>
                   3853:               </ol>
                   3854:             </div>
                   3855: 
                   3856:             <p>When the chroot sandbox is setup, you can start the
                   3857:             build with the following steps:</p>
                   3858:             <pre class="screen">
1.14      xtraeme  3859: <code class="prompt">#</code> <strong class=
                   3860: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
                   3861: <code class="prompt">#</code> <strong class=
                   3862: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1       grant    3863: </pre>
                   3864: 
                   3865:             <p>This will just jump inside the sandbox and start
                   3866:             building. At the end of the build, mail will be sent
                   3867:             with the results of the build. Created binary pkgs will
1.14      xtraeme  3868:             be in <code class=
                   3869:             "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1       grant    3870:             (wherever that points/mounts to/from).</p>
                   3871:           </div>
                   3872: 
                   3873:           <div class="sect2" lang="en" xml:lang="en">
                   3874:             <div class="titlepage">
                   3875:               <div>
                   3876:                 <div>
1.30      wiz      3877:                   <h3 class="title"><a name=
                   3878:                   "building-a-partial-set" id=
1.38      dillo    3879:                   "building-a-partial-set"></a>6.3.7.&nbsp;Building
1.30      wiz      3880:                   a partial set of packages</h3>
1.1       grant    3881:                 </div>
                   3882:               </div>
                   3883:             </div>
                   3884: 
                   3885:             <p>In addition to building a complete set of all
1.14      xtraeme  3886:             packages in pkgsrc, the <code class=
                   3887:             "filename">pkgsrc/mk/bulk/build</code> script may be
                   3888:             used to build a subset of the packages contained in
                   3889:             pkgsrc. By setting defining <code class=
                   3890:             "varname">SPECIFIC_PKGS</code> in <code class=
                   3891:             "filename">/etc/mk.conf</code>, the variables</p>
1.1       grant    3892: 
                   3893:             <div class="itemizedlist">
                   3894:               <ul type="disc">
                   3895:                 <li>
                   3896:                   <p>SITE_SPECIFIC_PKGS</p>
                   3897:                 </li>
                   3898: 
                   3899:                 <li>
                   3900:                   <p>HOST_SPECIFIC_PKGS</p>
                   3901:                 </li>
                   3902: 
                   3903:                 <li>
                   3904:                   <p>GROUP_SPECIFIC_PKGS</p>
                   3905:                 </li>
                   3906: 
                   3907:                 <li>
                   3908:                   <p>USER_SPECIFIC_PKGS</p>
                   3909:                 </li>
                   3910:               </ul>
                   3911:             </div>
                   3912: 
                   3913:             <p>will define the set of packages which should be
                   3914:             built. The bulk build code will also include any
                   3915:             packages which are needed as dependencies for the
                   3916:             explicitly listed packages.</p>
                   3917: 
                   3918:             <p>One use of this is to do a bulk build with
1.14      xtraeme  3919:             <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1       grant    3920:             sandbox periodically to have a complete set of the
                   3921:             binary packages needed for your site available without
                   3922:             the overhead of building extra packages that are not
                   3923:             needed.</p>
                   3924:           </div>
1.13      hubertf  3925: 
                   3926:           <div class="sect2" lang="en" xml:lang="en">
                   3927:             <div class="titlepage">
                   3928:               <div>
                   3929:                 <div>
                   3930:                   <h3 class="title"><a name="bulk-upload" id=
1.38      dillo    3931:                   "bulk-upload"></a>6.3.8.&nbsp;Uploading results
1.13      hubertf  3932:                   of a bulk build</h3>
                   3933:                 </div>
                   3934:               </div>
                   3935:             </div>
                   3936: 
                   3937:             <p>This section describes how pkgsrc developers can
                   3938:             upload binary pkgs built by bulk builds to
                   3939:             ftp.NetBSD.org.</p>
                   3940: 
1.17      sketch   3941:             <p>If you would like to automatically create checksum
                   3942:             files for the binary packages you intend to upload,
                   3943:             remember to set <code class="varname">MKSUMS=yes</code>
                   3944:             in your <code class=
                   3945:             "filename">mk/bulk/build.conf</code>.</p>
                   3946: 
                   3947:             <p>If you would like to PGP sign the checksum files
                   3948:             (highly recommended!), remember to set <code class=
                   3949:             "varname">SIGN_AS=username@NetBSD.org</code> in your
                   3950:             <code class="filename">mk/bulk/build.conf</code>. This
1.23      wiz      3951:             will prompt you for your GPG password to sign the files
1.17      sketch   3952:             before uploading everything.</p>
                   3953: 
                   3954:             <p>Then, make sure that you have <code class=
1.14      xtraeme  3955:             "varname">RSYNC_DST</code> set properly in your
                   3956:             <code class="filename">mk/bulk/build.conf</code> file,
                   3957:             i.e. adjust it to something like one of the
                   3958:             following:</p>
1.13      hubertf  3959:             <pre class="screen">
                   3960: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   3961: </pre>
                   3962: 
1.23      wiz      3963:             <p>Please use appropviate values for "pkgsrc-200xQy",
1.13      hubertf  3964:             "NetBSD-a.b.c" and "arch" here. If your login on
1.14      xtraeme  3965:             ftp.NetBSD.org is different from <code class=
                   3966:             "varname">CVS_USER</code>, write your login directly
                   3967:             into the variable, e.g. my local account is "feyrer",
                   3968:             but for my login "hubertf", I use:</p>
1.13      hubertf  3969:             <pre class="screen">
                   3970: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   3971: </pre>
                   3972: 
1.14      xtraeme  3973:             <p>A separate <code class="filename">upload</code>
1.13      hubertf  3974:             directory is used here to allow "closing" the directory
                   3975:             during upload. To do so, run the following command on
                   3976:             ftp.NetBSD.org next:</p>
                   3977:             <pre class="screen">
1.14      xtraeme  3978: nbftp% <strong class=
                   3979: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13      hubertf  3980: </pre>
                   3981: 
1.14      xtraeme  3982:             <p>Please note that <code class=
                   3983:             "filename">/pub/NetBSD/packages</code> is only
1.13      hubertf  3984:             appropriate for packages for the NetBSD operating
                   3985:             system. Binary packages for other operating systems
1.14      xtraeme  3986:             should go into <code class=
                   3987:             "filename">/pub/pkgsrc</code>.</p>
1.13      hubertf  3988: 
                   3989:             <p>Before uploading the binary pkgs, ssh authentication
1.23      wiz      3990:             needs to be set up. This example shows how to setup
1.13      hubertf  3991:             temporary keys for the root account <span class=
                   3992:             "emphasis"><em>inside the sandbox</em></span> (assuming
                   3993:             that no keys should be present there usually):</p>
                   3994:             <pre class="screen">
1.14      xtraeme  3995: <code class="prompt">#</code> <strong class=
                   3996: "userinput"><code>chroot /usr/sandbox</code></strong>        
                   3997: chroot-<code class="prompt">#</code> <strong class=
                   3998: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>        
                   3999: chroot-<code class="prompt">#</code> <strong class=
                   4000: "userinput"><code>ssh-keygen -t dsa</code></strong>        
                   4001: chroot-<code class="prompt">#</code> <strong class=
                   4002: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong> 
1.13      hubertf  4003: </pre>
                   4004: 
1.14      xtraeme  4005:             <p>Now take the output of <code class=
                   4006:             "filename">id-dsa.pub</code> and append it to your
                   4007:             <code class="filename">~/.ssh/authorized_keys</code>
1.17      sketch   4008:             file on ftp.NetBSD.org. You can remove the key after
1.14      xtraeme  4009:             the upload is done!</p>
1.13      hubertf  4010: 
                   4011:             <p>Next, test if your ssh connection really works:</p>
                   4012:             <pre class="screen">
1.14      xtraeme  4013: chroot-<code class="prompt">#</code> <strong class=
                   4014: "userinput"><code>ssh ftp.NetBSD.org date</code></strong> 
1.13      hubertf  4015: </pre>
                   4016: 
                   4017:             <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
                   4018: 
                   4019:             <p>Now after all this works, you can exit the sandbox
                   4020:             and start the upload:</p>
                   4021:             <pre class="screen">
1.14      xtraeme  4022: chroot-<code class="prompt">#</code> <strong class=
                   4023: "userinput"><code>exit</code></strong>        
                   4024: <code class="prompt">#</code> <strong class=
                   4025: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>        
                   4026: <code class="prompt">#</code> <strong class=
                   4027: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong> 
1.13      hubertf  4028: </pre>
                   4029: 
                   4030:             <p>The upload process may take quite some time. Use
1.24      wiz      4031:             <a href=
                   4032:             "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
                   4033:             <span class="citerefentry"><span class=
                   4034:             "refentrytitle">ls</span>(1)</span></a> or <a href=
                   4035:             "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
                   4036:             <span class="citerefentry"><span class=
                   4037:             "refentrytitle">du</span>(1)</span></a> on the FTP
                   4038:             server to monitor progress of the upload. The upload
                   4039:             script will take care of not uploading restricted
                   4040:             packages and putting vulnerable packages into the
                   4041:             <code class="filename">vulnerable</code>
                   4042:             subdirectory.</p>
1.13      hubertf  4043: 
                   4044:             <p>After the upload has ended, first thing is to revoke
                   4045:             ssh access:</p>
                   4046:             <pre class="screen">
1.14      xtraeme  4047: nbftp% <strong class=
                   4048: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13      hubertf  4049: Gdd:x! 
                   4050: </pre>
                   4051: 
                   4052:             <p>Use whatever is needed to remove the key you've
                   4053:             entered before! Last, move the uploaded packages out of
1.14      xtraeme  4054:             the <code class="filename">upload</code> directory to
                   4055:             have them accessible to everyone:</p>
1.13      hubertf  4056:             <pre class="screen">
1.14      xtraeme  4057: nbftp% <strong class=
                   4058: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
                   4059: nbftp% <strong class=
                   4060: "userinput"><code>mv upload/* .</code></strong>
                   4061: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
                   4062: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong> 
1.13      hubertf  4063: </pre>
                   4064:           </div>
1.1       grant    4065:         </div>
                   4066: 
                   4067:         <div class="sect1" lang="en" xml:lang="en">
                   4068:           <div class="titlepage">
                   4069:             <div>
                   4070:               <div>
                   4071:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4072:                 "creating-cdroms" id=
1.38      dillo    4073:                 "creating-cdroms"></a>6.4.&nbsp;Creating a multiple
1.30      wiz      4074:                 CD-ROM packages collection</h2>
1.1       grant    4075:               </div>
                   4076:             </div>
                   4077:           </div>
                   4078: 
                   4079:           <p>After your pkgsrc bulk-build has completed, you may
                   4080:           wish to create a CD-ROM set of the resulting binary
                   4081:           packages to assist in installing packages on other
                   4082:           machines. The <a xmlns=
                   4083:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4084:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.20      ben      4085:           class="pkgname">pkgtools/cdpack</a> package provides a
                   4086:           simple tool for creating the ISO 9660 images.
                   4087:           <span><strong class="command">cdpack</strong></span>
                   4088:           arranges the packages on the CD-ROMs in a way that keeps
                   4089:           all the dependencies for given package on the same CD as
                   4090:           that package.</p>
1.1       grant    4091: 
                   4092:           <div class="sect2" lang="en" xml:lang="en">
                   4093:             <div class="titlepage">
                   4094:               <div>
                   4095:                 <div>
1.30      wiz      4096:                   <h3 class="title"><a name="cdpack-example" id=
1.38      dillo    4097:                   "cdpack-example"></a>6.4.1.&nbsp;Example of
1.1       grant    4098:                   cdpack</h3>
                   4099:                 </div>
                   4100:               </div>
                   4101:             </div>
                   4102: 
                   4103:             <p>Complete documentation for cdpack is found in the
                   4104:             cdpack(1) manpage. The following short example assumes
1.14      xtraeme  4105:             that the binary packages are left in <code class=
                   4106:             "filename">/usr/pkgsrc/packages/All</code> and that
                   4107:             sufficient disk space exists in <code class=
                   4108:             "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1       grant    4109:             <pre class="screen">
1.14      xtraeme  4110: <code class="prompt">#</code> <strong class=
                   4111: "userinput"><code>mkdir /u2/images</code></strong>
                   4112: <code class="prompt">#</code> <strong class=
                   4113: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
                   4114: <code class="prompt">#</code> <strong class=
                   4115: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    4116: </pre>
                   4117: 
                   4118:             <p>If you wish to include a common set of files
1.14      xtraeme  4119:             (<code class="filename">COPYRIGHT</code>, <code class=
                   4120:             "filename">README</code>, etc.) on each CD in the
1.1       grant    4121:             collection, then you need to create a directory which
                   4122:             contains these files. e.g.</p>
                   4123:             <pre class="screen">
1.14      xtraeme  4124: <code class="prompt">#</code> <strong class=
                   4125: "userinput"><code>mkdir /tmp/common</code></strong>
                   4126: <code class="prompt">#</code> <strong class=
                   4127: "userinput"><code>echo "This is a README" &gt; /tmp/common/README</code></strong>
                   4128: <code class="prompt">#</code> <strong class=
                   4129: "userinput"><code>echo "Another file" &gt; /tmp/common/COPYING</code></strong>
                   4130: <code class="prompt">#</code> <strong class=
                   4131: "userinput"><code>mkdir /tmp/common/bin</code></strong>
                   4132: <code class="prompt">#</code> <strong class=
                   4133: "userinput"><code>echo "#!/bin/sh" &gt; /tmp/common/bin/myscript</code></strong>
                   4134: <code class="prompt">#</code> <strong class=
                   4135: "userinput"><code>echo "echo Hello world" &gt;&gt; /tmp/common/bin/myscript</code></strong>
                   4136: <code class="prompt">#</code> <strong class=
                   4137: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1       grant    4138: </pre>
                   4139: 
                   4140:             <p>Now create the images:</p>
                   4141:             <pre class="screen">
1.14      xtraeme  4142: <code class="prompt">#</code> <strong class=
                   4143: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    4144: </pre>
                   4145: 
1.14      xtraeme  4146:             <p>Each image will contain <code class=
                   4147:             "filename">README</code>, <code class=
                   4148:             "filename">COPYING</code>, and <code class=
                   4149:             "filename">bin/myscript</code> in their root
1.1       grant    4150:             directories.</p>
                   4151:           </div>
                   4152:         </div>
                   4153:       </div>
                   4154: 
                   4155:       <div class="chapter" lang="en" xml:lang="en">
                   4156:         <div class="titlepage">
                   4157:           <div>
                   4158:             <div>
                   4159:               <h2 class="title"><a name="faq" id=
1.38      dillo    4160:               "faq"></a>Chapter&nbsp;7.&nbsp;Frequently Asked
1.1       grant    4161:               Questions</h2>
                   4162:             </div>
                   4163:           </div>
                   4164:         </div>
                   4165: 
                   4166:         <div class="toc">
                   4167:           <p><b>Table of Contents</b></p>
                   4168: 
                   4169:           <dl>
1.30      wiz      4170:             <dt><span class="sect1"><a href=
1.38      dillo    4171:             "#mailing-list-pointers">7.1. Are there any mailing
1.30      wiz      4172:             lists for pkg-related discussion?</a></span></dt>
1.1       grant    4173: 
1.38      dillo    4174:             <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1       grant    4175:             Where's the pkgviews documentation?</a></span></dt>
                   4176: 
1.38      dillo    4177:             <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1       grant    4178:             Utilities for package management
                   4179:             (pkgtools)</a></span></dt>
                   4180: 
1.38      dillo    4181:             <dt><span class="sect1"><a href="#non-root-pkgsrc">7.4.
1.30      wiz      4182:             How to use pkgsrc as non-root</a></span></dt>
1.1       grant    4183: 
1.30      wiz      4184:             <dt><span class="sect1"><a href=
1.38      dillo    4185:             "#resume-transfers">7.5. How to resume transfers when
1.30      wiz      4186:             fetching distfiles?</a></span></dt>
1.14      xtraeme  4187: 
1.30      wiz      4188:             <dt><span class="sect1"><a href=
1.38      dillo    4189:             "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30      wiz      4190:             XFree86 from pkgsrc?</a></span></dt>
1.1       grant    4191: 
1.30      wiz      4192:             <dt><span class="sect1"><a href=
1.38      dillo    4193:             "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30      wiz      4194:             from pkgsrc?</a></span></dt>
1.1       grant    4195: 
1.30      wiz      4196:             <dt><span class="sect1"><a href=
1.38      dillo    4197:             "#fetch-behind-firewall">7.8. How to fetch files from
1.30      wiz      4198:             behind a firewall</a></span></dt>
1.1       grant    4199: 
1.38      dillo    4200:             <dt><span class="sect1"><a href="#passive-ftp">7.9. How
1.14      xtraeme  4201:             do I tell <span><strong class="command">make
                   4202:             fetch</strong></span> to do passive
                   4203:             FTP?</a></span></dt>
1.1       grant    4204: 
1.30      wiz      4205:             <dt><span class="sect1"><a href=
1.38      dillo    4206:             "#fetching-all-distfiles">7.10. How to fetch all
1.30      wiz      4207:             distfiles at once</a></span></dt>
1.1       grant    4208: 
1.30      wiz      4209:             <dt><span class="sect1"><a href=
1.38      dillo    4210:             "#tmac.andoc-missing">7.11. What does
1.30      wiz      4211:             &#8220;<span class="quote">Don't know how to make
1.14      xtraeme  4212:             /usr/share/tmac/tmac.andoc</span>&#8221;
1.1       grant    4213:             mean?</a></span></dt>
                   4214: 
1.30      wiz      4215:             <dt><span class="sect1"><a href=
1.38      dillo    4216:             "#bsd.own.mk-missing">7.12. What does
1.30      wiz      4217:             &#8220;<span class="quote">Could not find
1.14      xtraeme  4218:             bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    4219: 
1.30      wiz      4220:             <dt><span class="sect1"><a href=
1.38      dillo    4221:             "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30      wiz      4222:             pkgsrc</a></span></dt>
1.1       grant    4223: 
1.38      dillo    4224:             <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35      jmmv     4225:             do I change the location of configuration
                   4226:             files?</a></span></dt>
1.1       grant    4227: 
1.38      dillo    4228:             <dt><span class="sect1"><a href="#audit-packages">7.15.
1.1       grant    4229:             Automated security checks</a></span></dt>
                   4230:           </dl>
                   4231:         </div>
                   4232: 
                   4233:         <p>This section contains hints, tips &amp; tricks on
                   4234:         special things in pkgsrc that we didn't find a better place
                   4235:         for in the previous chapters, and it contains items for
                   4236:         both pkgsrc users and developers.</p>
                   4237: 
                   4238:         <div class="sect1" lang="en" xml:lang="en">
                   4239:           <div class="titlepage">
                   4240:             <div>
                   4241:               <div>
                   4242:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4243:                 "mailing-list-pointers" id=
1.38      dillo    4244:                 "mailing-list-pointers"></a>7.1.&nbsp;Are there any
1.30      wiz      4245:                 mailing lists for pkg-related discussion?</h2>
1.1       grant    4246:               </div>
                   4247:             </div>
                   4248:           </div>
                   4249: 
1.18      xtraeme  4250:           <p>The following mailing lists may be of interest to
                   4251:           pkgsrc users:</p>
                   4252: 
                   4253:           <div class="itemizedlist">
                   4254:             <ul type="disc">
                   4255:               <li>
                   4256:                 <p><a href=
                   4257:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.34      wiz      4258:                 target="_top">pkgsrc-bugs</a>: A list where problem
                   4259:                 reports related to pkgsrc are sent and
                   4260:                 discussed.</p>
1.18      xtraeme  4261:               </li>
                   4262: 
                   4263:               <li>
                   4264:                 <p><a href=
                   4265:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34      wiz      4266:                 target="_top">pkgsrc-bulk</a>: A list where the
1.20      ben      4267:                 results of pkgsrc bulk builds are sent and
1.34      wiz      4268:                 discussed.</p>
1.18      xtraeme  4269:               </li>
                   4270: 
                   4271:               <li>
                   4272:                 <p><a href=
                   4273:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.34      wiz      4274:                 target="_top">pkgsrc-changes</a>: A list where all
                   4275:                 commit messages to pkgsrc are sent.</p>
1.18      xtraeme  4276:               </li>
                   4277: 
                   4278:               <li>
                   4279:                 <p><a href=
                   4280:                 "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.34      wiz      4281:                 target="_top">tech-pkg</a>: A general discussion
                   4282:                 list for all things related to pkgsrc.</p>
1.18      xtraeme  4283:               </li>
                   4284:             </ul>
                   4285:           </div>
                   4286: 
                   4287:           <p>To subscribe, do:</p>
1.1       grant    4288:           <pre class="programlisting">
1.18      xtraeme  4289: <code class="prompt">%</code> echo subscribe <em class=
                   4290: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1       grant    4291: </pre>
                   4292: 
1.18      xtraeme  4293:           <p>Archives for all these mailing lists are available
                   4294:           from <a href="http://mail-index.NetBSD.org/" target=
                   4295:           "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1       grant    4296:         </div>
                   4297: 
                   4298:         <div class="sect1" lang="en" xml:lang="en">
                   4299:           <div class="titlepage">
                   4300:             <div>
                   4301:               <div>
                   4302:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4303:                 "pkgviews-docs" id=
1.38      dillo    4304:                 "pkgviews-docs"></a>7.2.&nbsp;Where's the pkgviews
1.30      wiz      4305:                 documentation?</h2>
1.1       grant    4306:               </div>
                   4307:             </div>
                   4308:           </div>
                   4309: 
                   4310:           <p>Pkgviews is tightly integrated with buildlink. You can
1.14      xtraeme  4311:           find a pkgviews User's guide in <code class=
                   4312:           "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1       grant    4313:         </div>
                   4314: 
                   4315:         <div class="sect1" lang="en" xml:lang="en">
                   4316:           <div class="titlepage">
                   4317:             <div>
                   4318:               <div>
                   4319:                 <h2 class="title" style="clear: both"><a name=
1.5       hubertf  4320:                 "faq-pkgtools" id=
1.38      dillo    4321:                 "faq-pkgtools"></a>7.3.&nbsp;Utilities for package
1.5       hubertf  4322:                 management (pkgtools)</h2>
1.1       grant    4323:               </div>
                   4324:             </div>
                   4325:           </div>
                   4326: 
1.14      xtraeme  4327:           <p>The <code class="filename">pkgsrc/pkgtools</code>
1.1       grant    4328:           directory pkgtools contains a number of useful utilities
                   4329:           for both users and developers of pkgsrc. This section
                   4330:           attempts only to make the reader aware of the utilities
                   4331:           and when they might be useful, and not to duplicate the
                   4332:           documentation that comes with each package.</p>
                   4333: 
                   4334:           <p>Utilities used by pkgsrc (automatically installed when
                   4335:           needed):</p>
                   4336: 
                   4337:           <div class="itemizedlist">
                   4338:             <ul type="disc">
                   4339:               <li>
                   4340:                 <p><a xmlns=
                   4341:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4342:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.34      wiz      4343:                 class="pkgname">pkgtools/x11-links</a>: Symlinks
                   4344:                 for use by buildlink.</p>
1.1       grant    4345:               </li>
                   4346:             </ul>
                   4347:           </div>
                   4348: 
                   4349:           <p>OS tool augmentation (automatically installed when
                   4350:           needed):</p>
                   4351: 
                   4352:           <div class="itemizedlist">
                   4353:             <ul type="disc">
                   4354:               <li>
                   4355:                 <p><a xmlns=
                   4356:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4357:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.34      wiz      4358:                 class="pkgname">pkgtools/digest</a>: Calculates
                   4359:                 various kinds of checksums (including SHA1).</p>
1.1       grant    4360:               </li>
                   4361: 
                   4362:               <li>
                   4363:                 <p><a xmlns=
                   4364:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4365:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.27      rillig   4366:                 class="pkgname">pkgtools/libnbcompat</a>:
1.34      wiz      4367:                 Compatibility library for pkgsrc tools.</p>
1.1       grant    4368:               </li>
                   4369: 
                   4370:               <li>
                   4371:                 <p><a xmlns=
                   4372:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4373:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.34      wiz      4374:                 class="pkgname">pkgtools/mtree</a>: Installed on
                   4375:                 non-BSD systems due to lack of native mtree.</p>
1.1       grant    4376:               </li>
                   4377: 
                   4378:               <li>
                   4379:                 <p><a xmlns=
                   4380:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4381:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20      ben      4382:                 class="pkgname">pkgtools/pkg_install</a>:
1.34      wiz      4383:                 Up-to-date replacement for <code class=
                   4384:                 "filename">/usr/sbin/pkg_install</code>, or for use
                   4385:                 on operating systems where pkg_install is not
                   4386:                 present.</p>
1.1       grant    4387:               </li>
                   4388:             </ul>
                   4389:           </div>
                   4390: 
                   4391:           <p>Utilities used by pkgsrc (not automatically
                   4392:           installed):</p>
                   4393: 
                   4394:           <div class="itemizedlist">
                   4395:             <ul type="disc">
                   4396:               <li>
                   4397:                 <p><a xmlns=
                   4398:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4399:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.34      wiz      4400:                 class="pkgname">pkgtools/pkg_tarup</a>: Create a
1.20      ben      4401:                 binary package from an already-installed package.
1.34      wiz      4402:                 Used by <span><strong class="command">make
                   4403:                 replace</strong></span> to save the old
                   4404:                 package.</p>
1.1       grant    4405:               </li>
                   4406: 
                   4407:               <li>
                   4408:                 <p><a xmlns=
                   4409:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.5       hubertf  4410:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.34      wiz      4411:                 class="pkgname">pkgtools/dfdisk</a>: Adds extra
1.20      ben      4412:                 functionality to pkgsrc, allowing it to fetch
                   4413:                 distfiles from multiple locations. It currently
                   4414:                 supports the following methods: multiple CD-ROMs
                   4415:                 and network FTP/HTTP connections.</p>
1.5       hubertf  4416:               </li>
                   4417: 
                   4418:               <li>
                   4419:                 <p><a xmlns=
                   4420:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    4421:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.34      wiz      4422:                 class="pkgname">pkgtools/xpkgwedge</a>: Put X11
                   4423:                 packages someplace else (enabled by default).</p>
1.1       grant    4424:               </li>
1.5       hubertf  4425: 
                   4426:               <li>
                   4427:                 <p><a xmlns=
                   4428:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4429:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.34      wiz      4430:                 class="pkgname">devel/cpuflags</a>: Determine the
                   4431:                 best compiler flags to optimise code for your
1.20      ben      4432:                 current CPU and compiler.</p>
1.5       hubertf  4433:               </li>
1.1       grant    4434:             </ul>
                   4435:           </div>
                   4436: 
                   4437:           <p>Utilities for keeping track of installed packages,
                   4438:           being up to date, etc:</p>
                   4439: 
                   4440:           <div class="itemizedlist">
                   4441:             <ul type="disc">
                   4442:               <li>
                   4443:                 <p><a xmlns=
                   4444:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4445:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.34      wiz      4446:                 class="pkgname">pkgtools/pkg_chk</a>: Reports on
1.27      rillig   4447:                 packages whose installed versions do not match the
1.34      wiz      4448:                 latest pkgsrc entries.</p>
1.1       grant    4449:               </li>
                   4450: 
                   4451:               <li>
                   4452:                 <p><a xmlns=
                   4453:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4454:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.34      wiz      4455:                 class="pkgname">pkgtools/pkgdep</a>: Makes
1.20      ben      4456:                 dependency graphs of packages, to aid in choosing a
1.34      wiz      4457:                 strategy for updating.</p>
1.1       grant    4458:               </li>
                   4459: 
                   4460:               <li>
                   4461:                 <p><a xmlns=
                   4462:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4463:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.34      wiz      4464:                 class="pkgname">pkgtools/pkgdepgraph</a>: Makes
1.27      rillig   4465:                 graphs from the output of <a xmlns=
                   4466:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4467:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
                   4468:                 class="pkgname">pkgtools/pkgdep</a> (uses
1.34      wiz      4469:                 graphviz).</p>
1.1       grant    4470:               </li>
                   4471: 
                   4472:               <li>
                   4473:                 <p><a xmlns=
                   4474:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4475:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.34      wiz      4476:                 class="pkgname">pkgtools/pkglint</a>: The
1.27      rillig   4477:                 pkglint(1) program checks a pkgsrc entry for
                   4478:                 errors, lintpkgsrc(1) does various checks on the
                   4479:                 complete pkgsrc system.</p>
1.1       grant    4480:               </li>
                   4481: 
                   4482:               <li>
                   4483:                 <p><a xmlns=
                   4484:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4485:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.34      wiz      4486:                 class="pkgname">pkgtools/pkgsurvey</a>: Report what
                   4487:                 packages you have installed.</p>
1.1       grant    4488:               </li>
                   4489:             </ul>
                   4490:           </div>
                   4491: 
                   4492:           <p>Utilities for people maintaining or creating
                   4493:           individual packages:</p>
                   4494: 
                   4495:           <div class="itemizedlist">
                   4496:             <ul type="disc">
                   4497:               <li>
                   4498:                 <p><a xmlns=
                   4499:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4500:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.34      wiz      4501:                 class="pkgname">pkgtools/pkgdiff</a>: Automate
1.20      ben      4502:                 making and maintaining patches for a package
1.34      wiz      4503:                 (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1       grant    4504:               </li>
                   4505: 
                   4506:               <li>
                   4507:                 <p><a xmlns=
                   4508:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4509:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.20      ben      4510:                 class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
                   4511:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4512:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.34      wiz      4513:                 class="pkgname">pkgtools/url2pkg</a>: Aids in
                   4514:                 converting to pkgsrc.</p>
1.1       grant    4515:               </li>
                   4516: 
                   4517:               <li>
                   4518:                 <p><a xmlns=
                   4519:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4520:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.34      wiz      4521:                 class="pkgname">pkgtools/gensolpkg</a>: Convert
                   4522:                 pkgsrc to a Solaris package.</p>
1.1       grant    4523:               </li>
                   4524:             </ul>
                   4525:           </div>
                   4526: 
                   4527:           <p>Utilities for people maintaining pkgsrc (or more
                   4528:           obscure pkg utilities)</p>
                   4529: 
                   4530:           <div class="itemizedlist">
                   4531:             <ul type="disc">
                   4532:               <li>
                   4533:                 <p><a xmlns=
                   4534:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4535:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.34      wiz      4536:                 class="pkgname">pkgtools/pkgconflict</a>: Find
1.20      ben      4537:                 packages that conflict but aren't marked as
1.34      wiz      4538:                 such.</p>
1.1       grant    4539:               </li>
                   4540: 
                   4541:               <li>
                   4542:                 <p><a xmlns=
                   4543:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4544:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.34      wiz      4545:                 class="pkgname">pkgtools/pkg_comp</a>: Build
                   4546:                 packages in a chrooted area.</p>
1.1       grant    4547:               </li>
                   4548: 
                   4549:               <li>
                   4550:                 <p><a xmlns=
                   4551:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4552:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.34      wiz      4553:                 class="pkgname">pkgtools/libkver</a>: Spoof kernel
                   4554:                 version for chrooted cross builds.</p>
1.1       grant    4555:               </li>
                   4556:             </ul>
                   4557:           </div>
                   4558:         </div>
                   4559: 
                   4560:         <div class="sect1" lang="en" xml:lang="en">
                   4561:           <div class="titlepage">
                   4562:             <div>
                   4563:               <div>
                   4564:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4565:                 "non-root-pkgsrc" id=
1.38      dillo    4566:                 "non-root-pkgsrc"></a>7.4.&nbsp;How to use pkgsrc
1.30      wiz      4567:                 as non-root</h2>
1.1       grant    4568:               </div>
                   4569:             </div>
                   4570:           </div>
                   4571: 
                   4572:           <p>If you want to use pkgsrc as non-root user, you can
                   4573:           set some variables to make pkgsrc work under these
1.33      jmmv     4574:           conditions. At the very least, you need to set
                   4575:           <code class="varname">UNPRIVILEGED</code> to
                   4576:           &#8220;<span class="quote">yes</span>&#8221;; this will
                   4577:           turn on unprivileged mode and set multiple related
                   4578:           variables to allow installation of packages as
                   4579:           non-root.</p>
                   4580: 
                   4581:           <p>In case the defaults are not enough, you may want to
                   4582:           tune some other variables used. For example, if the
                   4583:           automatic user/group detection leads to incorrect values
                   4584:           (or not the ones you would like to use), you can change
                   4585:           them by setting <code class=
                   4586:           "varname">UNPRIVILEGED_USER</code> and <code class=
                   4587:           "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
                   4588: 
                   4589:           <p>As regards bootstrapping, please note that the
                   4590:           <span><strong class="command">bootstrap</strong></span>
                   4591:           script will ease non-root configuration when given the
                   4592:           &#8220;<span class=
                   4593:           "quote">--ignore-user-check</span>&#8221; flag, as it
                   4594:           will choose and use multiple default directories under
                   4595:           <code class="filename">~/pkg</code> as the installation
                   4596:           targets. These directories can be overriden by the
                   4597:           &#8220;<span class="quote">--prefix</span>&#8221; flag
                   4598:           provided by the script, as well as some others that allow
                   4599:           finer tuning of the tree layout.</p>
1.14      xtraeme  4600:         </div>
                   4601: 
                   4602:         <div class="sect1" lang="en" xml:lang="en">
                   4603:           <div class="titlepage">
                   4604:             <div>
                   4605:               <div>
                   4606:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4607:                 "resume-transfers" id=
1.38      dillo    4608:                 "resume-transfers"></a>7.5.&nbsp;How to resume
1.30      wiz      4609:                 transfers when fetching distfiles?</h2>
1.14      xtraeme  4610:               </div>
                   4611:             </div>
                   4612:           </div>
                   4613: 
1.15      xtraeme  4614:           <p>By default resuming transfers in pkgsrc is disabled,
                   4615:           but you can enable this feature by adding the option
                   4616:           <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
                   4617:           into <code class="filename">/etc/mk.conf</code>. If,
                   4618:           during a fetch step, an incomplete distfile is found,
                   4619:           pkgsrc will try to resume it.</p>
                   4620: 
                   4621:           <p>You can also use a different program than the default
1.24      wiz      4622:           <a href=
                   4623:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   4624:           <span class="citerefentry"><span class=
                   4625:           "refentrytitle">ftp</span>(1)</span></a> by changing the
                   4626:           <code class="varname">FETCH_CMD</code> variable. Don't
                   4627:           forget to set <code class=
                   4628:           "varname">FETCH_RESUME_ARGS</code> and <code class=
                   4629:           "varname">FETCH_OUTPUT_ARGS</code> if you are not using
                   4630:           default values.</p>
1.14      xtraeme  4631: 
                   4632:           <p>For example, if you want to use <code class=
                   4633:           "filename">wget</code> to resume downloads, you'll have
                   4634:           to use something like:</p>
                   4635:           <pre class="programlisting">
1.34      wiz      4636: FETCH_CMD=wget
                   4637: FETCH_BEFORE_ARGS=--passive-ftp
                   4638: FETCH_RESUME_ARGS=-c
                   4639: FETCH_OUTPUT_ARGS=-O
1.14      xtraeme  4640: </pre>
1.1       grant    4641:         </div>
                   4642: 
                   4643:         <div class="sect1" lang="en" xml:lang="en">
                   4644:           <div class="titlepage">
                   4645:             <div>
                   4646:               <div>
                   4647:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4648:                 "XFree86-from-pkgsrc" id=
1.38      dillo    4649:                 "XFree86-from-pkgsrc"></a>7.6.&nbsp;How can I
1.1       grant    4650:                 install/use XFree86 from pkgsrc?</h2>
                   4651:               </div>
                   4652:             </div>
                   4653:           </div>
                   4654: 
                   4655:           <p>If you want to use XFree86 from pkgsrc instead of your
1.14      xtraeme  4656:           system's own X11 (<code class=
                   4657:           "filename">/usr/X11R6</code>, <code class=
                   4658:           "filename">/usr/openwin</code>, ...), you will have to
                   4659:           add the following line into <code class=
1.15      xtraeme  4660:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4661:           <pre class="programlisting">
1.34      wiz      4662: X11_TYPE=XFree86
1.1       grant    4663: </pre>
                   4664:         </div>
                   4665: 
                   4666:         <div class="sect1" lang="en" xml:lang="en">
                   4667:           <div class="titlepage">
                   4668:             <div>
                   4669:               <div>
                   4670:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4671:                 "x.org-from-pkgsrc" id=
1.38      dillo    4672:                 "x.org-from-pkgsrc"></a>7.7.&nbsp;How can I
1.1       grant    4673:                 install/use X.org from pkgsrc?</h2>
                   4674:               </div>
                   4675:             </div>
                   4676:           </div>
                   4677: 
                   4678:           <p>If you want to use X.org from pkgsrc instead of your
1.14      xtraeme  4679:           system's own X11 (<code class=
                   4680:           "filename">/usr/X11R6</code>, <code class=
                   4681:           "filename">/usr/openwin</code>, ...) you will have to add
                   4682:           the following line into <code class=
1.15      xtraeme  4683:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4684:           <pre class="programlisting">
1.34      wiz      4685: X11_TYPE=xorg
1.1       grant    4686: </pre>
                   4687:         </div>
                   4688: 
                   4689:         <div class="sect1" lang="en" xml:lang="en">
                   4690:           <div class="titlepage">
                   4691:             <div>
                   4692:               <div>
                   4693:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4694:                 "fetch-behind-firewall" id=
1.38      dillo    4695:                 "fetch-behind-firewall"></a>7.8.&nbsp;How to fetch
1.30      wiz      4696:                 files from behind a firewall</h2>
1.1       grant    4697:               </div>
                   4698:             </div>
                   4699:           </div>
                   4700: 
                   4701:           <p>If you are sitting behind a firewall which does not
                   4702:           allow direct connections to Internet hosts (i.e.
                   4703:           non-NAT), you may specify the relevant proxy hosts. This
                   4704:           is done using an environment variable in the form of a
                   4705:           URL e.g. in Amdahl, the machine &#8220;<span class=
                   4706:           "quote">orpheus.amdahl.com</span>&#8221; is one of the
                   4707:           firewalls, and it uses port 80 as the proxy port number.
                   4708:           So the proxy environment variables are:</p>
                   4709:           <pre class="programlisting">
1.34      wiz      4710: ftp_proxy=ftp://orpheus.amdahl.com:80/
1.1       grant    4711: http_proxy=http://orpheus.amdahl.com:80/
                   4712: </pre>
                   4713:         </div>
                   4714: 
                   4715:         <div class="sect1" lang="en" xml:lang="en">
                   4716:           <div class="titlepage">
                   4717:             <div>
                   4718:               <div>
                   4719:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    4720:                 "passive-ftp" id="passive-ftp"></a>7.9.&nbsp;How do
1.30      wiz      4721:                 I tell <span><strong class="command">make
1.14      xtraeme  4722:                 fetch</strong></span> to do passive FTP?</h2>
1.1       grant    4723:               </div>
                   4724:             </div>
                   4725:           </div>
                   4726: 
                   4727:           <p>This depends on which utility is used to retrieve
1.14      xtraeme  4728:           distfiles. From <code class="filename">bsd.pkg.mk</code>,
                   4729:           <code class="varname">FETCH_CMD</code> is assigned the
                   4730:           first available command from the following list:</p>
1.34      wiz      4731: 
                   4732:           <div class="itemizedlist">
                   4733:             <ul type="disc">
                   4734:               <li>
                   4735:                 <p><code class=
                   4736:                 "filename">${LOCALBASE}/bin/ftp</code></p>
                   4737:               </li>
                   4738: 
                   4739:               <li>
                   4740:                 <p><code class="filename">/usr/bin/ftp</code></p>
                   4741:               </li>
                   4742:             </ul>
                   4743:           </div>
1.1       grant    4744: 
                   4745:           <p>On a default NetBSD installation, this will be
1.14      xtraeme  4746:           <code class="filename">/usr/bin/ftp</code>, which
1.1       grant    4747:           automatically tries passive connections first, and falls
                   4748:           back to active connections if the server refuses to do
                   4749:           passive. For the other tools, add the following to your
1.14      xtraeme  4750:           <code class="filename">/etc/mk.conf</code> file:
                   4751:           <code class="varname">PASSIVE_FETCH=1</code>.</p>
1.1       grant    4752: 
1.14      xtraeme  4753:           <p>Having that option present will prevent <code class=
                   4754:           "filename">/usr/bin/ftp</code> from falling back to
                   4755:           active transfers.</p>
1.1       grant    4756:         </div>
                   4757: 
                   4758:         <div class="sect1" lang="en" xml:lang="en">
                   4759:           <div class="titlepage">
                   4760:             <div>
                   4761:               <div>
                   4762:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4763:                 "fetching-all-distfiles" id=
1.38      dillo    4764:                 "fetching-all-distfiles"></a>7.10.&nbsp;How to
1.1       grant    4765:                 fetch all distfiles at once</h2>
                   4766:               </div>
                   4767:             </div>
                   4768:           </div>
                   4769: 
                   4770:           <p>You would like to download all the distfiles in a
                   4771:           single batch from work or university, where you can't run
1.14      xtraeme  4772:           a <span><strong class="command">make
                   4773:           fetch</strong></span>. There is an archive of distfiles
                   4774:           on <a href=
1.1       grant    4775:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
                   4776:           target="_top">ftp.NetBSD.org</a>, but downloading the
                   4777:           entire directory may not be appropriate.</p>
                   4778: 
1.14      xtraeme  4779:           <p>The answer here is to do a <span><strong class=
                   4780:           "command">make fetch-list</strong></span> in <code class=
                   4781:           "filename">/usr/pkgsrc</code> or one of it's
1.1       grant    4782:           subdirectories, carry the resulting list to your machine
1.23      wiz      4783:           at work/school and use it there. If you don't have a
1.24      wiz      4784:           NetBSD-compatible <a href=
                   4785:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   4786:           <span class="citerefentry"><span class=
                   4787:           "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
                   4788:           at work, don't forget to set <code class=
                   4789:           "varname">FETCH_CMD</code> to something that fetches a
                   4790:           URL:</p>
1.1       grant    4791: 
                   4792:           <p>At home:</p>
                   4793:           <pre class="screen">
1.14      xtraeme  4794: <code class="prompt">%</code> <strong class=
                   4795: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   4796: <code class="prompt">%</code> <strong class=
                   4797: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles &gt;/tmp/fetch.sh</code></strong>
                   4798: <code class="prompt">%</code> <strong class=
                   4799: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1       grant    4800: </pre>
                   4801: 
                   4802:           <p>At work:</p>
                   4803:           <pre class="screen">
1.14      xtraeme  4804: <code class="prompt">%</code> <strong class=
                   4805: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1       grant    4806: </pre>
                   4807: 
1.14      xtraeme  4808:           <p>then tar up <code class=
                   4809:           "filename">/tmp/distfiles</code> and take it home.</p>
1.1       grant    4810: 
                   4811:           <p>If you have a machine running NetBSD, and you want to
                   4812:           get <span class="emphasis"><em>all</em></span> distfiles
                   4813:           (even ones that aren't for your machine architecture),
                   4814:           you can do so by using the above-mentioned
1.14      xtraeme  4815:           <span><strong class="command">make
                   4816:           fetch-list</strong></span> approach, or fetch the
                   4817:           distfiles directly by running:</p>
1.1       grant    4818:           <pre class="screen">
1.14      xtraeme  4819: <code class="prompt">%</code> <strong class=
                   4820: "userinput"><code>make mirror-distfiles</code></strong>
1.1       grant    4821: </pre>
                   4822: 
1.14      xtraeme  4823:           <p>If you even decide to ignore <code class=
                   4824:           "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
                   4825:           can get everything by running:</p>
1.1       grant    4826:           <pre class="screen">
1.14      xtraeme  4827: <code class="prompt">%</code> <strong class=
                   4828: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1       grant    4829: </pre>
                   4830:         </div>
                   4831: 
                   4832:         <div class="sect1" lang="en" xml:lang="en">
                   4833:           <div class="titlepage">
                   4834:             <div>
                   4835:               <div>
                   4836:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4837:                 "tmac.andoc-missing" id=
1.38      dillo    4838:                 "tmac.andoc-missing"></a>7.11.&nbsp;What does
1.1       grant    4839:                 &#8220;<span class="quote">Don't know how to make
                   4840:                 /usr/share/tmac/tmac.andoc</span>&#8221; mean?</h2>
                   4841:               </div>
                   4842:             </div>
                   4843:           </div>
                   4844: 
                   4845:           <p>When compiling the <a xmlns=
                   4846:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4847:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20      ben      4848:           class="pkgname">pkgtools/pkg_install</a> package, you get
                   4849:           the error from make that it doesn't know how to make
                   4850:           <code class="filename">/usr/share/tmac/tmac.andoc</code>?
                   4851:           This indicates that you don't have installed the
1.23      wiz      4852:           &#8220;<span class="quote">text</span>&#8221; set (nroff,
                   4853:           ...) from the NetBSD base distribution on your machine.
                   4854:           It is recommended to do that to format manpages.</p>
1.1       grant    4855: 
                   4856:           <p>In the case of the <a xmlns=
                   4857:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4858:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20      ben      4859:           class="pkgname">pkgtools/pkg_install</a> package, you can
                   4860:           get away with setting <code class=
                   4861:           "varname">NOMAN=YES</code> either in the environment or
                   4862:           in <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    4863:         </div>
                   4864: 
                   4865:         <div class="sect1" lang="en" xml:lang="en">
                   4866:           <div class="titlepage">
                   4867:             <div>
                   4868:               <div>
                   4869:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4870:                 "bsd.own.mk-missing" id=
1.38      dillo    4871:                 "bsd.own.mk-missing"></a>7.12.&nbsp;What does
1.1       grant    4872:                 &#8220;<span class="quote">Could not find
                   4873:                 bsd.own.mk</span>&#8221; mean?</h2>
                   4874:               </div>
                   4875:             </div>
                   4876:           </div>
                   4877: 
1.14      xtraeme  4878:           <p>You didn't install the compiler set, <code class=
                   4879:           "filename">comp.tgz</code>, when you installed your
                   4880:           NetBSD machine. Please get it and install it, by
                   4881:           extracting it in <code class="filename">/</code>:</p>
1.1       grant    4882:           <pre class="screen">
1.14      xtraeme  4883: <code class="prompt">#</code> <strong class=
                   4884: "userinput"><code>cd /</code></strong>
                   4885: <code class="prompt">#</code> <strong class=
                   4886: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1       grant    4887: </pre>
                   4888: 
1.14      xtraeme  4889:           <p><code class="filename">comp.tgz</code> is part of
                   4890:           every NetBSD release. Get the one that corresponds to
                   4891:           your release (determine via <span><strong class=
                   4892:           "command">uname -r</strong></span>).</p>
1.1       grant    4893:         </div>
                   4894: 
                   4895:         <div class="sect1" lang="en" xml:lang="en">
                   4896:           <div class="titlepage">
                   4897:             <div>
                   4898:               <div>
                   4899:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4900:                 "using-sudo-with-pkgsrc" id=
1.38      dillo    4901:                 "using-sudo-with-pkgsrc"></a>7.13.&nbsp;Using
1.1       grant    4902:                 'sudo' with pkgsrc</h2>
                   4903:               </div>
                   4904:             </div>
                   4905:           </div>
                   4906: 
                   4907:           <p>When installing packages as non-root user and using
1.24      wiz      4908:           the just-in-time <a href=
                   4909:           "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
                   4910:           <span class="citerefentry"><span class=
                   4911:           "refentrytitle">su</span>(1)</span></a> feature of
                   4912:           pkgsrc, it can become annoying to type in the root
                   4913:           password for each required package installed. To avoid
                   4914:           this, the sudo package can be used, which does password
                   4915:           caching over a limited time. To use it, install sudo
                   4916:           (either as binary package or from <a xmlns=
                   4917:           "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    4918:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.20      ben      4919:           class="pkgname">security/sudo</a>) and then put the
                   4920:           following into your <code class=
                   4921:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4922:           <pre class="programlisting">
1.34      wiz      4923: .if exists(${LOCALBASE}/bin/sudo)
                   4924: SU_CMD=${LOCALBASE}/bin/sudo /bin/sh -c
                   4925: .endif
1.1       grant    4926: </pre>
                   4927:         </div>
                   4928: 
                   4929:         <div class="sect1" lang="en" xml:lang="en">
                   4930:           <div class="titlepage">
                   4931:             <div>
                   4932:               <div>
                   4933:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    4934:                 "faq.conf" id="faq.conf"></a>7.14.&nbsp;How do I
1.35      jmmv     4935:                 change the location of configuration files?</h2>
1.1       grant    4936:               </div>
                   4937:             </div>
                   4938:           </div>
                   4939: 
1.35      jmmv     4940:           <p>As the system administrator, you can choose where
                   4941:           configuration files are installed. The default settings
                   4942:           make all these files go into <code class=
                   4943:           "filename">${PREFIX}/etc</code> or some of its
                   4944:           subdirectories; this may be suboptimal depending on your
                   4945:           expectations (e.g., a read-only, NFS-exported
                   4946:           <code class="varname">PREFIX</code> with a need of
                   4947:           per-machine configuration of the provided packages).</p>
                   4948: 
                   4949:           <p>In order to change the defaults, you can modify the
                   4950:           <code class="varname">PKG_SYSCONFBASE</code> variable (in
                   4951:           <code class="filename">/etc/mk.conf</code>) to point to
                   4952:           your preferred configuration directory; some common
                   4953:           examples include <code class="filename">/etc</code> or
                   4954:           <code class="filename">/etc/pkg</code>.</p>
                   4955: 
                   4956:           <p>Furthermore, you can change this value on a
                   4957:           per-package basis by setting the <code class=
                   4958:           "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   4959:           variable. <code class="varname">PKG_SYSCONFVAR</code>'s
                   4960:           value usually matches the name of the package you would
                   4961:           like to modify, that is, the contents of <code class=
                   4962:           "varname">PKGBASE</code>.</p>
1.1       grant    4963: 
1.35      jmmv     4964:           <p>Note that, after changing these settings, you must
                   4965:           rebuild and reinstall any affected packages.</p>
1.1       grant    4966:         </div>
                   4967: 
                   4968:         <div class="sect1" lang="en" xml:lang="en">
                   4969:           <div class="titlepage">
                   4970:             <div>
                   4971:               <div>
                   4972:                 <h2 class="title" style="clear: both"><a name=
                   4973:                 "audit-packages" id=
1.38      dillo    4974:                 "audit-packages"></a>7.15.&nbsp;Automated security
1.1       grant    4975:                 checks</h2>
                   4976:               </div>
                   4977:             </div>
                   4978:           </div>
                   4979: 
                   4980:           <p>Please be aware that there can often be bugs in
                   4981:           third-party software, and some of these bugs can leave a
                   4982:           machine vulnerable to exploitation by attackers. In an
                   4983:           effort to lessen the exposure, the NetBSD packages team
                   4984:           maintains a database of known-exploits to packages which
                   4985:           have at one time been included in pkgsrc. The database
                   4986:           can be downloaded automatically, and a security audit of
                   4987:           all packages installed on a system can take place. To do
                   4988:           this, install the <a xmlns=
                   4989:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4990:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.20      ben      4991:           class="pkgname">security/audit-packages</a> package. It
                   4992:           has two components:</p>
1.1       grant    4993: 
                   4994:           <div class="orderedlist">
                   4995:             <ol type="1">
                   4996:               <li>
1.34      wiz      4997:                 <p><span><strong class=
                   4998:                 "command">download-vulnerability-list</strong></span>,
1.1       grant    4999:                 an easy way to download a list of the security
                   5000:                 vulnerabilities information. This list is kept up
                   5001:                 to date by the NetBSD security officer and the
                   5002:                 NetBSD packages team, and is distributed from the
                   5003:                 NetBSD ftp server:</p>
                   5004: 
                   5005:                 <p><a href=
                   5006:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20      ben      5007:                 target=
                   5008:                 "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1       grant    5009:               </li>
                   5010: 
                   5011:               <li>
1.34      wiz      5012:                 <p><span><strong class=
                   5013:                 "command">audit-packages</strong></span>, an easy
                   5014:                 way to audit the current machine, checking each
1.1       grant    5015:                 vulnerability which is known. If a vulnerable
                   5016:                 package is installed, it will be shown by output to
                   5017:                 stdout, including a description of the type of
                   5018:                 vulnerability, and a URL containing more
                   5019:                 information.</p>
                   5020:               </li>
                   5021:             </ol>
                   5022:           </div>
                   5023: 
1.23      wiz      5024:           <p>Use of the <a xmlns=
                   5025:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5026:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
                   5027:           class="pkgname">security/audit-packages</a> package is
                   5028:           strongly recommended! After &#8220;<span class=
                   5029:           "quote">audit-packages</span>&#8221; is installed, please
                   5030:           read the package's message, which you can get by running
                   5031:           <strong class="userinput"><code>pkg_info -D
                   5032:           audit-package</code></strong>.</p>
1.1       grant    5033:         </div>
                   5034:       </div>
                   5035:     </div>
                   5036: 
                   5037:     <div class="part" lang="en" xml:lang="en">
                   5038:       <div class="titlepage">
                   5039:         <div>
                   5040:           <div>
                   5041:             <h1 class="title"><a name="developers-guide" id=
1.2       hubertf  5042:             "developers-guide"></a>The pkgsrc developer's
                   5043:             guide</h1>
1.1       grant    5044:           </div>
                   5045:         </div>
                   5046:       </div>
                   5047: 
                   5048:       <div class="toc">
                   5049:         <p><b>Table of Contents</b></p>
                   5050: 
                   5051:         <dl>
1.38      dillo    5052:           <dt><span class="chapter"><a href="#components">8.
1.27      rillig   5053:           Package components - files, directories and
                   5054:           contents</a></span></dt>
                   5055: 
                   5056:           <dd>
                   5057:             <dl>
                   5058:               <dt><span class="sect1"><a href=
1.38      dillo    5059:               "#components.Makefile">8.1. <code class=
1.27      rillig   5060:               "filename">Makefile</code></a></span></dt>
                   5061: 
                   5062:               <dt><span class="sect1"><a href=
1.38      dillo    5063:               "#components.distinfo">8.2. <code class=
1.27      rillig   5064:               "filename">distinfo</code></a></span></dt>
                   5065: 
                   5066:               <dt><span class="sect1"><a href=
1.38      dillo    5067:               "#components.patches">8.3. patches/*</a></span></dt>
1.27      rillig   5068: 
1.30      wiz      5069:               <dt><span class="sect1"><a href=
1.38      dillo    5070:               "#other-mandatory-files">8.4. Other mandatory
1.30      wiz      5071:               files</a></span></dt>
1.27      rillig   5072: 
                   5073:               <dt><span class="sect1"><a href=
1.38      dillo    5074:               "#components.optional">8.5. Optional
1.27      rillig   5075:               files</a></span></dt>
                   5076: 
1.38      dillo    5077:               <dt><span class="sect1"><a href="#work-dir">8.6.
1.27      rillig   5078:               <code class="filename">work*</code></a></span></dt>
                   5079: 
1.38      dillo    5080:               <dt><span class="sect1"><a href="#files-dir">8.7.
1.27      rillig   5081:               <code class="filename">files/*</code></a></span></dt>
                   5082:             </dl>
                   5083:           </dd>
                   5084: 
1.38      dillo    5085:           <dt><span class="chapter"><a href="#makefile">9.
1.25      rillig   5086:           Programming in <code class=
                   5087:           "filename">Makefile</code>s</a></span></dt>
                   5088: 
                   5089:           <dd>
                   5090:             <dl>
                   5091:               <dt><span class="sect1"><a href=
1.38      dillo    5092:               "#makefile.variables">9.1. <code class=
1.25      rillig   5093:               "filename">Makefile</code> variables</a></span></dt>
                   5094: 
1.27      rillig   5095:               <dd>
                   5096:                 <dl>
                   5097:                   <dt><span class="sect2"><a href=
1.38      dillo    5098:                   "#makefile.variables.names">9.1.1. Naming
1.27      rillig   5099:                   conventions</a></span></dt>
                   5100:                 </dl>
                   5101:               </dd>
                   5102: 
1.38      dillo    5103:               <dt><span class="sect1"><a href="#makefile.code">9.2.
1.25      rillig   5104:               Code snippets</a></span></dt>
                   5105: 
                   5106:               <dd>
                   5107:                 <dl>
                   5108:                   <dt><span class="sect2"><a href=
1.38      dillo    5109:                   "#adding-to-list">9.2.1. Adding things to a
1.25      rillig   5110:                   list</a></span></dt>
                   5111: 
                   5112:                   <dt><span class="sect2"><a href=
1.38      dillo    5113:                   "#converting-internal-to-external">9.2.2.
1.30      wiz      5114:                   Converting an internal list into an external
                   5115:                   list</a></span></dt>
1.25      rillig   5116: 
                   5117:                   <dt><span class="sect2"><a href=
1.38      dillo    5118:                   "#passing-variable-to-shell">9.2.3. Passing
1.30      wiz      5119:                   variables to a shell command</a></span></dt>
1.27      rillig   5120: 
                   5121:                   <dt><span class="sect2"><a href=
1.38      dillo    5122:                   "#quoting-guideline">9.2.4. Quoting
1.27      rillig   5123:                   guideline</a></span></dt>
                   5124: 
                   5125:                   <dt><span class="sect2"><a href=
1.38      dillo    5126:                   "#bsd-make-bug-workaround">9.2.5. Workaround for
1.30      wiz      5127:                   a bug in BSD Make</a></span></dt>
1.25      rillig   5128:                 </dl>
                   5129:               </dd>
                   5130:             </dl>
                   5131:           </dd>
                   5132: 
1.38      dillo    5133:           <dt><span class="chapter"><a href="#plist">10. PLIST
1.1       grant    5134:           issues</a></span></dt>
                   5135: 
                   5136:           <dd>
                   5137:             <dl>
1.38      dillo    5138:               <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1       grant    5139:               ID</a></span></dt>
                   5140: 
1.30      wiz      5141:               <dt><span class="sect1"><a href=
1.38      dillo    5142:               "#automatic-plist-generation">10.2. Semi-automatic
1.30      wiz      5143:               <code class="filename">PLIST</code>
1.14      xtraeme  5144:               generation</a></span></dt>
1.1       grant    5145: 
1.38      dillo    5146:               <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14      xtraeme  5147:               Tweaking output of <span><strong class="command">make
                   5148:               print-PLIST</strong></span></a></span></dt>
1.1       grant    5149: 
1.38      dillo    5150:               <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1       grant    5151:               Variable substitution in PLIST</a></span></dt>
                   5152: 
1.30      wiz      5153:               <dt><span class="sect1"><a href=
1.38      dillo    5154:               "#manpage-compression">10.5.
1.1       grant    5155:               Manpage-compression</a></span></dt>
                   5156: 
1.30      wiz      5157:               <dt><span class="sect1"><a href=
1.38      dillo    5158:               "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30      wiz      5159:               <code class=
1.14      xtraeme  5160:               "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    5161: 
1.30      wiz      5162:               <dt><span class="sect1"><a href=
1.38      dillo    5163:               "#platform-specific-plist">10.7. Platform specific
                   5164:               and differing PLISTs</a></span></dt>
1.1       grant    5165: 
                   5166:               <dt><span class="sect1"><a href=
1.38      dillo    5167:               "#faq.common-dirs">10.8. Sharing directories between
1.1       grant    5168:               packages</a></span></dt>
                   5169:             </dl>
                   5170:           </dd>
                   5171: 
1.38      dillo    5172:           <dt><span class="chapter"><a href="#buildlink">11.
1.1       grant    5173:           Buildlink methodology</a></span></dt>
                   5174: 
                   5175:           <dd>
                   5176:             <dl>
1.30      wiz      5177:               <dt><span class="sect1"><a href=
1.38      dillo    5178:               "#converting-to-buildlink3">11.1. Converting packages
1.30      wiz      5179:               to use buildlink3</a></span></dt>
1.1       grant    5180: 
1.30      wiz      5181:               <dt><span class="sect1"><a href=
1.38      dillo    5182:               "#creating-buildlink3.mk">11.2. Writing <code class=
1.30      wiz      5183:               "filename">buildlink3.mk</code> files</a></span></dt>
1.1       grant    5184: 
                   5185:               <dd>
                   5186:                 <dl>
                   5187:                   <dt><span class="sect2"><a href=
1.38      dillo    5188:                   "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30      wiz      5189:                   buildlink3.mk file</a></span></dt>
1.1       grant    5190: 
                   5191:                   <dt><span class="sect2"><a href=
1.38      dillo    5192:                   "#updating-buildlink-depends">11.2.2. Updating
1.30      wiz      5193:                   <code class=
                   5194:                   "varname">BUILDLINK_DEPENDS.<em class="replaceable">
                   5195:                   <code>pkg</code></em></code> in <code class=
                   5196:                   "filename">buildlink3.mk</code>
1.1       grant    5197:                   files</a></span></dt>
                   5198:                 </dl>
                   5199:               </dd>
                   5200: 
1.30      wiz      5201:               <dt><span class="sect1"><a href=
1.38      dillo    5202:               "#writing-builtin.mk">11.3. Writing <code class=
1.30      wiz      5203:               "filename">builtin.mk</code> files</a></span></dt>
1.1       grant    5204: 
                   5205:               <dd>
                   5206:                 <dl>
                   5207:                   <dt><span class="sect2"><a href=
1.38      dillo    5208:                   "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.30      wiz      5209:                   <code class="filename">builtin.mk</code>
                   5210:                   file</a></span></dt>
1.1       grant    5211: 
                   5212:                   <dt><span class="sect2"><a href=
1.38      dillo    5213:                   "#native-or-pkgsrc-preference">11.3.2. Global
1.30      wiz      5214:                   preferences for native or pkgsrc
                   5215:                   software</a></span></dt>
1.1       grant    5216:                 </dl>
                   5217:               </dd>
                   5218:             </dl>
                   5219:           </dd>
                   5220: 
1.38      dillo    5221:           <dt><span class="chapter"><a href="#pkginstall">12. The
1.35      jmmv     5222:           pkginstall framework</a></span></dt>
                   5223: 
                   5224:           <dd>
                   5225:             <dl>
                   5226:               <dt><span class="sect1"><a href=
1.38      dillo    5227:               "#files-and-dirs-outside-prefix">12.1. Files and
1.35      jmmv     5228:               directories outside the installation
                   5229:               prefix</a></span></dt>
                   5230: 
                   5231:               <dd>
                   5232:                 <dl>
                   5233:                   <dt><span class="sect2"><a href=
1.38      dillo    5234:                   "#dirs-outside-prefix">12.1.1. Directory
1.35      jmmv     5235:                   manipulation</a></span></dt>
                   5236: 
                   5237:                   <dt><span class="sect2"><a href=
1.38      dillo    5238:                   "#files-outside-prefix">12.1.2. File
1.35      jmmv     5239:                   manipulation</a></span></dt>
                   5240:                 </dl>
                   5241:               </dd>
                   5242: 
1.38      dillo    5243:               <dt><span class="sect1"><a href="#conf-files">12.2.
1.35      jmmv     5244:               Configuration files</a></span></dt>
                   5245: 
                   5246:               <dd>
                   5247:                 <dl>
                   5248:                   <dt><span class="sect2"><a href=
1.38      dillo    5249:                   "#conf-files-sysconfdir">12.2.1. How <code class=
1.35      jmmv     5250:                   "varname">PKG_SYSCONFDIR</code> is
                   5251:                   set</a></span></dt>
                   5252: 
                   5253:                   <dt><span class="sect2"><a href=
1.38      dillo    5254:                   "#conf-files-configure">12.2.2. Telling the
1.35      jmmv     5255:                   software were configuration files
                   5256:                   are</a></span></dt>
                   5257: 
                   5258:                   <dt><span class="sect2"><a href=
1.38      dillo    5259:                   "#conf-files-patching">12.2.3. Patching
1.35      jmmv     5260:                   installations</a></span></dt>
                   5261: 
                   5262:                   <dt><span class="sect2"><a href=
1.38      dillo    5263:                   "#conf-files-disable">12.2.4. Disabling handling
1.35      jmmv     5264:                   of configuration files</a></span></dt>
                   5265:                 </dl>
                   5266:               </dd>
                   5267: 
1.38      dillo    5268:               <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35      jmmv     5269:               System startup scripts</a></span></dt>
                   5270: 
                   5271:               <dd>
                   5272:                 <dl>
                   5273:                   <dt><span class="sect2"><a href=
1.38      dillo    5274:                   "#rcd-scripts-disable">12.3.1. Disabling handling
1.35      jmmv     5275:                   of system startup scripts</a></span></dt>
                   5276:                 </dl>
                   5277:               </dd>
                   5278: 
                   5279:               <dt><span class="sect1"><a href=
1.38      dillo    5280:               "#users-and-groups">12.4. System users and
1.35      jmmv     5281:               groups</a></span></dt>
                   5282: 
1.38      dillo    5283:               <dt><span class="sect1"><a href="#shells">12.5.
1.35      jmmv     5284:               System shells</a></span></dt>
                   5285: 
                   5286:               <dd>
                   5287:                 <dl>
                   5288:                   <dt><span class="sect2"><a href=
1.38      dillo    5289:                   "#shells-disable">12.5.1. Disabling handling of
1.35      jmmv     5290:                   configuration files</a></span></dt>
                   5291:                 </dl>
                   5292:               </dd>
                   5293:             </dl>
                   5294:           </dd>
                   5295: 
1.38      dillo    5296:           <dt><span class="chapter"><a href="#options">13. Options
1.1       grant    5297:           handling</a></span></dt>
                   5298: 
                   5299:           <dd>
                   5300:             <dl>
1.30      wiz      5301:               <dt><span class="sect1"><a href=
1.38      dillo    5302:               "#global-default-options">13.1. Global default
1.30      wiz      5303:               options</a></span></dt>
1.1       grant    5304: 
1.30      wiz      5305:               <dt><span class="sect1"><a href=
1.38      dillo    5306:               "#converting-to-options">13.2. Converting packages to
1.30      wiz      5307:               use <code class=
1.14      xtraeme  5308:               "filename">bsd.options.mk</code></a></span></dt>
1.1       grant    5309:             </dl>
                   5310:           </dd>
                   5311: 
1.38      dillo    5312:           <dt><span class="chapter"><a href="#build">14. The build
1.1       grant    5313:           process</a></span></dt>
                   5314: 
                   5315:           <dd>
                   5316:             <dl>
1.38      dillo    5317:               <dt><span class="sect1"><a href="#build.prefix">14.1.
1.1       grant    5318:               Program location</a></span></dt>
                   5319: 
1.38      dillo    5320:               <dt><span class="sect1"><a href="#main-targets">14.2.
1.1       grant    5321:               Main targets</a></span></dt>
                   5322: 
                   5323:               <dt><span class="sect1"><a href=
1.38      dillo    5324:               "#build.helpful-targets">14.3. Other helpful
1.1       grant    5325:               targets</a></span></dt>
                   5326:             </dl>
                   5327:           </dd>
                   5328: 
1.38      dillo    5329:           <dt><span class="chapter"><a href="#fixes">15. Notes on
1.1       grant    5330:           fixes for packages</a></span></dt>
                   5331: 
                   5332:           <dd>
                   5333:             <dl>
1.30      wiz      5334:               <dt><span class="sect1"><a href=
1.38      dillo    5335:               "#general-operation">15.1. General
1.30      wiz      5336:               operation</a></span></dt>
1.1       grant    5337: 
                   5338:               <dd>
                   5339:                 <dl>
                   5340:                   <dt><span class="sect2"><a href=
1.38      dillo    5341:                   "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30      wiz      5342:                   pull in variables from
                   5343:                   /etc/mk.conf</a></span></dt>
1.1       grant    5344: 
                   5345:                   <dt><span class="sect2"><a href=
1.38      dillo    5346:                   "#where-to-install-documentation">15.1.2. Where
1.31      wiz      5347:                   to install documentation</a></span></dt>
                   5348: 
                   5349:                   <dt><span class="sect2"><a href=
1.38      dillo    5350:                   "#restricted-packages">15.1.3. Restricted
1.1       grant    5351:                   packages</a></span></dt>
                   5352: 
                   5353:                   <dt><span class="sect2"><a href=
1.38      dillo    5354:                   "#dependencies">15.1.4. Handling
1.1       grant    5355:                   dependencies</a></span></dt>
                   5356: 
                   5357:                   <dt><span class="sect2"><a href=
1.38      dillo    5358:                   "#conflicts">15.1.5. Handling conflicts with
1.1       grant    5359:                   other packages</a></span></dt>
                   5360: 
                   5361:                   <dt><span class="sect2"><a href=
1.38      dillo    5362:                   "#not-building-packages">15.1.6. Packages that
1.30      wiz      5363:                   cannot or should not be built</a></span></dt>
1.1       grant    5364: 
                   5365:                   <dt><span class="sect2"><a href=
1.38      dillo    5366:                   "#undeletable-packages">15.1.7. Packages which
1.30      wiz      5367:                   should not be deleted, once
                   5368:                   installed</a></span></dt>
1.1       grant    5369: 
                   5370:                   <dt><span class="sect2"><a href=
1.38      dillo    5371:                   "#security-handling">15.1.8. Handling packages
1.1       grant    5372:                   with security problems</a></span></dt>
                   5373: 
                   5374:                   <dt><span class="sect2"><a href=
1.38      dillo    5375:                   "#compiler-bugs">15.1.9. How to handle compiler
1.1       grant    5376:                   bugs</a></span></dt>
                   5377: 
                   5378:                   <dt><span class="sect2"><a href=
1.38      dillo    5379:                   "#bumping-pkgrevision">15.1.10. How to handle
1.30      wiz      5380:                   incrementing versions when fixing an existing
1.1       grant    5381:                   package</a></span></dt>
                   5382: 
                   5383:                   <dt><span class="sect2"><a href=
1.38      dillo    5384:                   "#portability-of-packages">15.1.11. Portability
1.30      wiz      5385:                   of packages</a></span></dt>
1.1       grant    5386:                 </dl>
                   5387:               </dd>
                   5388: 
1.30      wiz      5389:               <dt><span class="sect1"><a href=
1.38      dillo    5390:               "#downloading-issues">15.2. Possible downloading
1.30      wiz      5391:               issues</a></span></dt>
1.1       grant    5392: 
                   5393:               <dd>
                   5394:                 <dl>
                   5395:                   <dt><span class="sect2"><a href=
1.38      dillo    5396:                   "#no-plain-download">15.2.1. Packages whose
1.30      wiz      5397:                   distfiles aren't available for plain
1.1       grant    5398:                   downloading</a></span></dt>
                   5399: 
                   5400:                   <dt><span class="sect2"><a href=
1.38      dillo    5401:                   "#modified-distfiles-same-name">15.2.2. How to
1.30      wiz      5402:                   handle modified distfiles with the 'old'
                   5403:                   name</a></span></dt>
1.1       grant    5404:                 </dl>
                   5405:               </dd>
                   5406: 
1.30      wiz      5407:               <dt><span class="sect1"><a href=
1.38      dillo    5408:               "#configuration-gotchas">15.3. Configuration
1.30      wiz      5409:               gotchas</a></span></dt>
1.1       grant    5410: 
                   5411:               <dd>
                   5412:                 <dl>
                   5413:                   <dt><span class="sect2"><a href=
1.38      dillo    5414:                   "#fixes.libtool">15.3.1. Shared libraries -
1.1       grant    5415:                   libtool</a></span></dt>
                   5416: 
                   5417:                   <dt><span class="sect2"><a href=
1.38      dillo    5418:                   "#using-libtool">15.3.2. Using libtool on GNU
1.1       grant    5419:                   packages that already support
                   5420:                   libtool</a></span></dt>
                   5421: 
                   5422:                   <dt><span class="sect2"><a href=
1.38      dillo    5423:                   "#autoconf-automake">15.3.3. GNU
1.1       grant    5424:                   Autoconf/Automake</a></span></dt>
                   5425:                 </dl>
                   5426:               </dd>
                   5427: 
1.30      wiz      5428:               <dt><span class="sect1"><a href=
1.38      dillo    5429:               "#building-considerations">15.4. Building
1.30      wiz      5430:               considerations</a></span></dt>
1.1       grant    5431: 
                   5432:               <dd>
                   5433:                 <dl>
                   5434:                   <dt><span class="sect2"><a href=
1.38      dillo    5435:                   "#cpp-defines">15.4.1. CPP
1.30      wiz      5436:                   defines</a></span></dt>
1.1       grant    5437:                 </dl>
                   5438:               </dd>
                   5439: 
1.30      wiz      5440:               <dt><span class="sect1"><a href=
1.38      dillo    5441:               "#package-specific-actions">15.5. Package specific
1.30      wiz      5442:               actions</a></span></dt>
1.1       grant    5443: 
                   5444:               <dd>
                   5445:                 <dl>
                   5446:                   <dt><span class="sect2"><a href=
1.38      dillo    5447:                   "#user-interaction">15.5.1. User
1.2       hubertf  5448:                   interaction</a></span></dt>
1.1       grant    5449: 
                   5450:                   <dt><span class="sect2"><a href=
1.38      dillo    5451:                   "#handling-licenses">15.5.2. Handling
1.1       grant    5452:                   licenses</a></span></dt>
                   5453: 
                   5454:                   <dt><span class="sect2"><a href=
1.38      dillo    5455:                   "#installing-score-files">15.5.3. Installing
1.30      wiz      5456:                   score files</a></span></dt>
1.1       grant    5457: 
                   5458:                   <dt><span class="sect2"><a href=
1.38      dillo    5459:                   "#perl-scripts">15.5.4. Packages containing perl
1.1       grant    5460:                   scripts</a></span></dt>
                   5461: 
                   5462:                   <dt><span class="sect2"><a href=
1.38      dillo    5463:                   "#hardcoded-paths">15.5.5. Packages with
1.30      wiz      5464:                   hardcoded paths to other
                   5465:                   interpreters</a></span></dt>
1.1       grant    5466: 
                   5467:                   <dt><span class="sect2"><a href=
1.38      dillo    5468:                   "#perl-modules">15.5.6. Packages installing perl
1.1       grant    5469:                   modules</a></span></dt>
                   5470: 
                   5471:                   <dt><span class="sect2"><a href=
1.38      dillo    5472:                   "#faq.info-files">15.5.7. Packages installing
1.1       grant    5473:                   info files</a></span></dt>
                   5474: 
                   5475:                   <dt><span class="sect2"><a href=
1.38      dillo    5476:                   "#gconf2-data-files">15.5.8. Packages installing
1.30      wiz      5477:                   GConf2 data files</a></span></dt>
1.1       grant    5478: 
                   5479:                   <dt><span class="sect2"><a href=
1.38      dillo    5480:                   "#scrollkeeper-data-files">15.5.9. Packages
1.30      wiz      5481:                   installing scrollkeeper data
                   5482:                   files</a></span></dt>
1.1       grant    5483: 
                   5484:                   <dt><span class="sect2"><a href=
1.38      dillo    5485:                   "#x11-fonts">15.5.10. Packages installing X11
1.1       grant    5486:                   fonts</a></span></dt>
                   5487: 
                   5488:                   <dt><span class="sect2"><a href=
1.38      dillo    5489:                   "#gtk2-modules">15.5.11. Packages installing GTK2
1.1       grant    5490:                   modules</a></span></dt>
                   5491: 
                   5492:                   <dt><span class="sect2"><a href=
1.38      dillo    5493:                   "#sgml-xml-data">15.5.12. Packages installing
1.30      wiz      5494:                   SGML or XML data</a></span></dt>
1.1       grant    5495: 
                   5496:                   <dt><span class="sect2"><a href=
1.38      dillo    5497:                   "#mime-database">15.5.13. Packages installing
1.1       grant    5498:                   extensions to the MIME database</a></span></dt>
                   5499: 
                   5500:                   <dt><span class="sect2"><a href=
1.38      dillo    5501:                   "#intltool">15.5.14. Packages using
1.1       grant    5502:                   intltool</a></span></dt>
1.18      xtraeme  5503: 
                   5504:                   <dt><span class="sect2"><a href=
1.38      dillo    5505:                   "#startup-scripts">15.5.15. Packages installing
1.30      wiz      5506:                   startup scripts</a></span></dt>
1.1       grant    5507:                 </dl>
                   5508:               </dd>
                   5509: 
1.30      wiz      5510:               <dt><span class="sect1"><a href=
1.38      dillo    5511:               "#feedback-to-author">15.6. Feedback to the
1.30      wiz      5512:               author</a></span></dt>
1.1       grant    5513:             </dl>
                   5514:           </dd>
                   5515: 
1.38      dillo    5516:           <dt><span class="chapter"><a href="#debug">16.
1.1       grant    5517:           Debugging</a></span></dt>
                   5518: 
1.38      dillo    5519:           <dt><span class="chapter"><a href="#submit">17.
1.1       grant    5520:           Submitting and Committing</a></span></dt>
                   5521: 
                   5522:           <dd>
                   5523:             <dl>
1.30      wiz      5524:               <dt><span class="sect1"><a href=
1.38      dillo    5525:               "#submitting-your-package">17.1. Submitting your
1.30      wiz      5526:               packages</a></span></dt>
1.1       grant    5527: 
1.30      wiz      5528:               <dt><span class="sect1"><a href=
1.41      wiz      5529:               "#general-notes-for-changes">17.2. General notes when
                   5530:               adding, updating, or removing
                   5531:               packages</a></span></dt>
                   5532: 
                   5533:               <dt><span class="sect1"><a href=
                   5534:               "#committing-importing">17.3. Committing: Importing a
1.30      wiz      5535:               package into CVS</a></span></dt>
1.1       grant    5536: 
1.30      wiz      5537:               <dt><span class="sect1"><a href=
1.41      wiz      5538:               "#updating-package">17.4. Updating a package to a
1.30      wiz      5539:               newer version</a></span></dt>
1.1       grant    5540: 
1.30      wiz      5541:               <dt><span class="sect1"><a href=
1.41      wiz      5542:               "#moving-package">17.5. Moving a package in
1.30      wiz      5543:               pkgsrc</a></span></dt>
1.1       grant    5544:             </dl>
                   5545:           </dd>
                   5546:         </dl>
                   5547:       </div>
                   5548: 
                   5549:       <div class="chapter" lang="en" xml:lang="en">
                   5550:         <div class="titlepage">
                   5551:           <div>
                   5552:             <div>
1.27      rillig   5553:               <h2 class="title"><a name="components" id=
1.38      dillo    5554:               "components"></a>Chapter&nbsp;8.&nbsp;Package
1.27      rillig   5555:               components - files, directories and contents</h2>
1.25      rillig   5556:             </div>
                   5557:           </div>
                   5558:         </div>
                   5559: 
                   5560:         <div class="toc">
                   5561:           <p><b>Table of Contents</b></p>
                   5562: 
                   5563:           <dl>
                   5564:             <dt><span class="sect1"><a href=
1.38      dillo    5565:             "#components.Makefile">8.1. <code class=
1.27      rillig   5566:             "filename">Makefile</code></a></span></dt>
                   5567: 
                   5568:             <dt><span class="sect1"><a href=
1.38      dillo    5569:             "#components.distinfo">8.2. <code class=
1.27      rillig   5570:             "filename">distinfo</code></a></span></dt>
                   5571: 
                   5572:             <dt><span class="sect1"><a href=
1.38      dillo    5573:             "#components.patches">8.3. patches/*</a></span></dt>
1.25      rillig   5574: 
1.30      wiz      5575:             <dt><span class="sect1"><a href=
1.38      dillo    5576:             "#other-mandatory-files">8.4. Other mandatory
1.30      wiz      5577:             files</a></span></dt>
1.25      rillig   5578: 
1.27      rillig   5579:             <dt><span class="sect1"><a href=
1.38      dillo    5580:             "#components.optional">8.5. Optional
1.27      rillig   5581:             files</a></span></dt>
1.25      rillig   5582: 
1.38      dillo    5583:             <dt><span class="sect1"><a href="#work-dir">8.6.
1.27      rillig   5584:             <code class="filename">work*</code></a></span></dt>
1.25      rillig   5585: 
1.38      dillo    5586:             <dt><span class="sect1"><a href="#files-dir">8.7.
1.27      rillig   5587:             <code class="filename">files/*</code></a></span></dt>
1.25      rillig   5588:           </dl>
                   5589:         </div>
                   5590: 
1.27      rillig   5591:         <p>Whenever you're preparing a package, there are a number
                   5592:         of files involved which are described in the following
                   5593:         sections.</p>
1.25      rillig   5594: 
                   5595:         <div class="sect1" lang="en" xml:lang="en">
                   5596:           <div class="titlepage">
                   5597:             <div>
                   5598:               <div>
                   5599:                 <h2 class="title" style="clear: both"><a name=
1.27      rillig   5600:                 "components.Makefile" id=
1.38      dillo    5601:                 "components.Makefile"></a>8.1.&nbsp;<code class=
1.27      rillig   5602:                 "filename">Makefile</code></h2>
1.25      rillig   5603:               </div>
                   5604:             </div>
                   5605:           </div>
                   5606: 
1.27      rillig   5607:           <p>Building, installation and creation of a binary
                   5608:           package are all controlled by the package's <code class=
                   5609:           "filename">Makefile</code>. The <code class=
                   5610:           "filename">Makefile</code> describes various things about
                   5611:           a package, for example from where to get it, how to
                   5612:           configure, build, and install it.</p>
                   5613: 
                   5614:           <p>A package <code class="filename">Makefile</code>
                   5615:           contains several sections that describe the package.</p>
1.25      rillig   5616: 
1.27      rillig   5617:           <p>In the first section there are the following
                   5618:           variables, which should appear exactly in the order given
                   5619:           here.</p>
1.25      rillig   5620: 
                   5621:           <div class="itemizedlist">
                   5622:             <ul type="disc">
                   5623:               <li>
1.27      rillig   5624:                 <p><code class="varname">DISTNAME</code> is the
                   5625:                 basename of the distribution file to be downloaded
                   5626:                 from the package's website.</p>
                   5627:               </li>
                   5628: 
                   5629:               <li>
                   5630:                 <p><code class="varname">PKGNAME</code> is the name
                   5631:                 of the package, as used by pkgsrc. You only need to
                   5632:                 provide it if it differs from DISTNAME. Usually it
                   5633:                 is the directory name together with the version
                   5634:                 number. It must match the regular expression
                   5635:                 <code class=
                   5636:                 "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
                   5637:                 that is, it starts with a letter or digit, and
                   5638:                 contains only letters, digits, dashes, underscores,
                   5639:                 dots and plus signs.</p>
1.25      rillig   5640:               </li>
                   5641: 
                   5642:               <li>
1.27      rillig   5643:                 <p><code class="varname">CATEGORIES</code> is a
                   5644:                 list of categories which the package fits in. You
                   5645:                 can choose any of the top-level directories of
                   5646:                 pkgsrc for it.</p>
1.25      rillig   5647:               </li>
                   5648: 
                   5649:               <li>
1.27      rillig   5650:                 <p><code class="varname">MASTER_SITES</code> is a
                   5651:                 list of URLs where the distribution files can be
                   5652:                 downloaded. Each URL must end with a slash.</p>
1.25      rillig   5653:               </li>
                   5654:             </ul>
                   5655:           </div>
                   5656: 
1.27      rillig   5657:           <p>The second section contains the following
                   5658:           variables.</p>
1.25      rillig   5659: 
1.27      rillig   5660:           <div class="itemizedlist">
                   5661:             <ul type="disc">
                   5662:               <li>
                   5663:                 <p><code class="varname">MAINTAINER</code> is the
                   5664:                 mail address of the package's maintainer, which is
                   5665:                 the person you can contact when the package does
                   5666:                 not work.</p>
                   5667:               </li>
1.25      rillig   5668: 
1.27      rillig   5669:               <li>
                   5670:                 <p><code class="varname">HOMEPAGE</code> is a URL
                   5671:                 where users can find more information about the
1.23      wiz      5672:                 package.</p>
                   5673:               </li>
1.1       grant    5674: 
1.23      wiz      5675:               <li>
                   5676:                 <p><code class="varname">COMMENT</code> is a
                   5677:                 one-line comment about the purpose of the
                   5678:                 package.</p>
                   5679:               </li>
                   5680:             </ul>
                   5681:           </div>
1.1       grant    5682: 
1.14      xtraeme  5683:           <p>The <code class="varname">MASTER_SITES</code> may be
                   5684:           set to one of the predefined sites:</p>
1.1       grant    5685:           <pre class="programlisting">
                   5686:         ${MASTER_SITE_APACHE}
1.27      rillig   5687:         ${MASTER_SITE_BACKUP}
                   5688:         ${MASTER_SITE_CYGWIN}
1.1       grant    5689:         ${MASTER_SITE_DEBIAN}
1.27      rillig   5690:         ${MASTER_SITE_FREEBSD}
                   5691:         ${MASTER_SITE_FREEBSD_LOCAL}
1.1       grant    5692:         ${MASTER_SITE_GNOME}
                   5693:         ${MASTER_SITE_GNU}
                   5694:         ${MASTER_SITE_GNUSTEP}
1.9       dillo    5695:         ${MASTER_SITE_IFARCHIVE}
1.1       grant    5696:         ${MASTER_SITE_MOZILLA}
1.27      rillig   5697:         ${MASTER_SITE_OPENOFFICE}
1.1       grant    5698:         ${MASTER_SITE_PERL_CPAN}
1.27      rillig   5699:         ${MASTER_SITE_R_CRAN}
1.1       grant    5700:         ${MASTER_SITE_SOURCEFORGE}
                   5701:         ${MASTER_SITE_SUNSITE}
                   5702:         ${MASTER_SITE_SUSE}
                   5703:         ${MASTER_SITE_TEX_CTAN}
                   5704:         ${MASTER_SITE_XCONTRIB}
1.27      rillig   5705:         ${MASTER_SITE_XEMACS}
                   5706:     
1.1       grant    5707: </pre>
                   5708: 
                   5709:           <p>If one of these predefined sites is chosen, you may
                   5710:           require the ability to specify a subdirectory of that
                   5711:           site. Since these macros may expand to more than one
                   5712:           actual site, you <span class=
                   5713:           "emphasis"><em>must</em></span> use the following
                   5714:           construct to specify a subdirectory:</p>
                   5715:           <pre class="programlisting">
                   5716:         ${MASTER_SITE_GNU:=subdirectory/name/}
                   5717:         ${MASTER_SITE_SOURCEFORGE:=project_name/} 
                   5718: </pre>
                   5719: 
                   5720:           <p>Note the trailing slash after the subdirectory
                   5721:           name.</p>
                   5722: 
                   5723:           <div class="note" style=
                   5724:           "margin-left: 0.5in; margin-right: 0.5in;">
                   5725:             <h3 class="title">Note</h3>
                   5726: 
1.14      xtraeme  5727:             <p><code class="varname">MASTER_SITE_SUBDIR</code> has
                   5728:             been deprecated and <span class="emphasis"><em>should
                   5729:             no longer be used</em></span>.</p>
1.1       grant    5730:           </div>
                   5731: 
1.14      xtraeme  5732:           <p>If the package has multiple <code class=
                   5733:           "varname">DISTFILES</code> or multiple <code class=
                   5734:           "varname">PATCHFILES</code> from different sites, set
                   5735:           <code class="varname">SITES_foo</code> to a list of URI's
1.1       grant    5736:           where file &#8220;<span class="quote">foo</span>&#8221;
                   5737:           may be found. &#8220;<span class=
                   5738:           "quote">foo</span>&#8221; includes the suffix, e.g.</p>
                   5739:           <pre class="programlisting">
                   5740: DISTFILES=      ${DISTNAME}${EXTRACT_SUFX}
                   5741: DISTFILES+=     foo-file.tar.gz
                   5742: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
                   5743:         http://www.somewhereelse.com/mirror/somehow/
                   5744: </pre>
                   5745: 
1.14      xtraeme  5746:           <p>Note that the normal default setting of <code class=
                   5747:           "varname">DISTFILES</code> must be made explicit if you
1.1       grant    5748:           want to add to it (rather than replace it), as you
                   5749:           usually would.</p>
                   5750: 
                   5751:           <p>Currently the following values are available for
1.14      xtraeme  5752:           <code class="varname">CATEGORIES</code>. If more than one
                   5753:           is used, they need to be separated by spaces:</p>
1.1       grant    5754:           <pre class="programlisting">
                   5755: archivers     cross         geography     meta-pkgs     security
                   5756: audio         databases     graphics      misc          shells
                   5757: benchmarks    devel         ham           multimedia    sysutils
                   5758: biology       editors       inputmethod   net           textproc
                   5759: cad           emulators     lang          news          time
                   5760: chat          finance       mail          parallel      wm
                   5761: comms         fonts         math          pkgtools      www
                   5762: converters    games         mbone         print         x11
                   5763: </pre>
                   5764: 
                   5765:           <p>Please pay attention to the following gotchas:</p>
                   5766: 
                   5767:           <div class="itemizedlist">
                   5768:             <ul type="disc">
                   5769:               <li>
1.14      xtraeme  5770:                 <p>Add <code class="varname">MANCOMPRESSED</code>
                   5771:                 if manpages are installed in compressed form by the
                   5772:                 package; see comment in <code class=
                   5773:                 "filename">bsd.pkg.mk</code>.</p>
1.1       grant    5774:               </li>
                   5775: 
                   5776:               <li>
1.14      xtraeme  5777:                 <p>Replace <code class="filename">/usr/local</code>
1.1       grant    5778:                 with &#8220;<span class=
                   5779:                 "quote">${PREFIX}</span>&#8221; in all files (see
                   5780:                 patches, below).</p>
                   5781:               </li>
                   5782: 
                   5783:               <li>
                   5784:                 <p>If the package installs any info files, see
                   5785:                 <a href="#faq.info-files" title=
1.38      dillo    5786:                 "15.5.7.&nbsp;Packages installing info files">Section
                   5787:                 15.5.7, &#8220;Packages installing info
1.1       grant    5788:                 files&#8221;</a>.</p>
                   5789:               </li>
                   5790: 
                   5791:               <li>
1.14      xtraeme  5792:                 <p>Set <code class="varname">MAINTAINER</code> to
                   5793:                 be yourself. If you really can't maintain the
                   5794:                 package for future updates, set it to <code class=
1.1       grant    5795:                 "email">&lt;<a href=
1.14      xtraeme  5796:                 "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>&gt;</code>.</p>
1.1       grant    5797:               </li>
                   5798: 
                   5799:               <li>
                   5800:                 <p>If a home page for the software in question
1.14      xtraeme  5801:                 exists, add the variable <code class=
                   5802:                 "varname">HOMEPAGE</code> right after <code class=
                   5803:                 "varname">MAINTAINER</code>. The value of this
1.1       grant    5804:                 variable should be the URL for the home page.</p>
                   5805:               </li>
                   5806: 
                   5807:               <li>
1.14      xtraeme  5808:                 <p>Be sure to set the <code class=
                   5809:                 "varname">COMMENT</code> variable to a short
1.1       grant    5810:                 description of the package, not containing the
                   5811:                 pkg's name.</p>
                   5812:               </li>
                   5813:             </ul>
                   5814:           </div>
                   5815:         </div>
                   5816: 
                   5817:         <div class="sect1" lang="en" xml:lang="en">
                   5818:           <div class="titlepage">
                   5819:             <div>
                   5820:               <div>
                   5821:                 <h2 class="title" style="clear: both"><a name=
                   5822:                 "components.distinfo" id=
1.38      dillo    5823:                 "components.distinfo"></a>8.2.&nbsp;<code class=
1.14      xtraeme  5824:                 "filename">distinfo</code></h2>
1.1       grant    5825:               </div>
                   5826:             </div>
                   5827:           </div>
                   5828: 
                   5829:           <p>Most important, the mandatory message digest, or
                   5830:           checksum, of all the distfiles needed for the package to
                   5831:           compile, confirming they match the original file
                   5832:           distributed by the author. This ensures that the distfile
                   5833:           retrieved from the Internet has not been corrupted during
                   5834:           transfer or altered by a malign force to introduce a
1.14      xtraeme  5835:           security hole. It is generated using the
                   5836:           <span><strong class="command">make
                   5837:           makesum</strong></span> command. The digest algorithm
                   5838:           used was, at one stage, md5, but that was felt lacking
                   5839:           compared to sha1, and so sha1 is now the default
1.1       grant    5840:           algorithm. The distfile size is also generated and stored
                   5841:           in new distinfo files. The <a xmlns=
                   5842:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5843:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.20      ben      5844:           class="pkgname">pkgtools/digest</a> utility calculates
                   5845:           all of the digests in the distinfo file, and it provides
                   5846:           various different algorithms. At the current time, the
                   5847:           algorithms provided are: <span class=
                   5848:           "emphasis"><em>md5</em></span>, <span class=
                   5849:           "emphasis"><em>rmd160</em></span>, <span class=
                   5850:           "emphasis"><em>sha1</em></span>, <span class=
                   5851:           "emphasis"><em>sha256</em></span>, <span class=
                   5852:           "emphasis"><em>sha384</em></span> and <span class=
                   5853:           "emphasis"><em>sha512</em></span>.</p>
1.1       grant    5854: 
                   5855:           <p>Some packages have different sets of distfiles on a
                   5856:           per architecture basis, for example <a xmlns=
                   5857:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5858:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.20      ben      5859:           class="pkgname">www/navigator</a>). These are kept in the
                   5860:           same distinfo file and care should be taken when
                   5861:           upgrading such a package to ensure distfile information
                   5862:           is not lost.</p>
1.1       grant    5863: 
                   5864:           <p>The message digest/checksum for all the official
1.14      xtraeme  5865:           patches found in the <code class=
                   5866:           "filename">patches/</code> directory (see <a href=
                   5867:           "#components.patches" title=
1.38      dillo    5868:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
1.1       grant    5869:           &#8220;patches/*&#8221;</a>) for the package is also
1.14      xtraeme  5870:           stored in the <code class="filename">distinfo</code>
                   5871:           file. This is a message digest/checksum of all lines in
                   5872:           the patch file except the NetBSD RCS Id. This file is
                   5873:           generated by invoking <span><strong class="command">make
                   5874:           makepatchsum</strong></span> (or <span><strong class=
                   5875:           "command">make mps</strong></span> if you're in a
                   5876:           hurry).</p>
1.1       grant    5877:         </div>
                   5878: 
                   5879:         <div class="sect1" lang="en" xml:lang="en">
                   5880:           <div class="titlepage">
                   5881:             <div>
                   5882:               <div>
                   5883:                 <h2 class="title" style="clear: both"><a name=
                   5884:                 "components.patches" id=
1.38      dillo    5885:                 "components.patches"></a>8.3.&nbsp;patches/*</h2>
1.1       grant    5886:               </div>
                   5887:             </div>
                   5888:           </div>
                   5889: 
                   5890:           <p>This directory contains files that are used by the
                   5891:           <a href=
                   5892:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   5893:           <span class="citerefentry"><span class=
                   5894:           "refentrytitle">patch</span>(1)</span></a> command to
                   5895:           modify the sources as distributed in the distribution
                   5896:           file into a form that will compile and run perfectly on
                   5897:           NetBSD. The files are applied successively in alphabetic
                   5898:           order (as returned by a shell &#8220;<span class=
                   5899:           "quote">patches/patch-*</span>&#8221; glob expansion), so
1.14      xtraeme  5900:           <code class="filename">patch-aa</code> is applied before
                   5901:           <code class="filename">patch-ab</code>, etc.</p>
1.1       grant    5902: 
1.14      xtraeme  5903:           <p>The <code class="filename">patch-*</code> files should
                   5904:           be in <span><strong class="command">diff
                   5905:           -bu</strong></span> format, and apply without a fuzz to
                   5906:           avoid problems. (To force patches to apply with fuzz you
                   5907:           can set <code class=
                   5908:           "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1       grant    5909:           not put changes for more than one file into a single
                   5910:           patch-file, as this will make future modifications more
                   5911:           difficult.</p>
                   5912: 
                   5913:           <p>Similar, a file should be patched at most once, not
                   5914:           several times by several different patches. If a file
                   5915:           needs several patches, they should be combined into one
                   5916:           file.</p>
                   5917: 
                   5918:           <p>One important thing to mention is to pay attention
                   5919:           that no RCS IDs get stored in the patch files, as these
                   5920:           will cause problems when later checked into the NetBSD
1.14      xtraeme  5921:           CVS tree. Use the <span><strong class=
                   5922:           "command">pkgdiff</strong></span> from the <a xmlns=
1.1       grant    5923:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5924:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20      ben      5925:           class="pkgname">pkgtools/pkgdiff</a> package to avoid
                   5926:           these problems.</p>
1.1       grant    5927: 
                   5928:           <p>For even more automation, we recommend using
1.14      xtraeme  5929:           <span><strong class="command">mkpatches</strong></span>
                   5930:           from the same package to make a whole set of patches. You
                   5931:           just have to backup files before you edit them to
                   5932:           <code class="filename">filename.orig</code>, e.g. with
                   5933:           <span><strong class="command">cp -p filename
                   5934:           filename.orig</strong></span> or, easier, by using
                   5935:           <span><strong class="command">pkgvi</strong></span> again
                   5936:           from the same package. If you upgrade a package this way,
                   5937:           you can easily compare the new set of patches with the
                   5938:           previously existing one with <span><strong class=
                   5939:           "command">patchdiff</strong></span>.</p>
1.1       grant    5940: 
                   5941:           <p>When you have finished a package, remember to generate
                   5942:           the checksums for the patch files by using the
1.14      xtraeme  5943:           <span><strong class="command">make
                   5944:           makepatchsum</strong></span> command, see <a href=
                   5945:           "#components.distinfo" title=
1.38      dillo    5946:           "8.2.&nbsp;distinfo">Section&nbsp;8.2,
1.14      xtraeme  5947:           &#8220;<code class="filename">distinfo</code>&#8221;</a>.</p>
1.1       grant    5948: 
                   5949:           <p>Patch files that are distributed by the author or
1.14      xtraeme  5950:           other maintainers can be listed in <code class=
                   5951:           "varname">$PATCHFILES</code>.</p>
1.1       grant    5952: 
                   5953:           <p>If it is desired to store any patches that should not
                   5954:           be committed into pkgsrc, they can be kept outside the
1.14      xtraeme  5955:           pkgsrc tree in the <code class=
                   5956:           "filename">$LOCALPATCHES</code> directory. The directory
1.1       grant    5957:           tree there is expected to have the same
                   5958:           &#8220;<span class="quote">category/package</span>&#8221;
                   5959:           structure as pkgsrc, and patches are expected to be
1.14      xtraeme  5960:           stored inside these dirs (also known as <code class=
                   5961:           "filename">$LOCALPATCHES/$PKGPATH</code>). For example if
                   5962:           you want to keep a private patch for <code class=
                   5963:           "filename">pkgsrc/graphics/png</code>, keep it in
                   5964:           <code class=
                   5965:           "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
                   5966:           files in the named directory are expected to be patch
1.1       grant    5967:           files, and <span class="emphasis"><em>they are applied
                   5968:           after pkgsrc patches are applied</em></span>.</p>
1.27      rillig   5969:         </div>
                   5970: 
                   5971:         <div class="sect1" lang="en" xml:lang="en">
                   5972:           <div class="titlepage">
                   5973:             <div>
                   5974:               <div>
                   5975:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      5976:                 "other-mandatory-files" id=
1.38      dillo    5977:                 "other-mandatory-files"></a>8.4.&nbsp;Other
1.27      rillig   5978:                 mandatory files</h2>
                   5979:               </div>
                   5980:             </div>
                   5981:           </div>
                   5982: 
                   5983:           <div class="variablelist">
                   5984:             <dl>
                   5985:               <dt><span class="term"><code class=
                   5986:               "filename">DESCR</code></span></dt>
                   5987: 
                   5988:               <dd>
                   5989:                 <p>A multi-line description of the piece of
                   5990:                 software. This should include any credits where
                   5991:                 they are due. Please bear in mind that others do
                   5992:                 not share your sense of humour (or spelling
                   5993:                 idiosyncrasies), and that others will read
                   5994:                 everything that you write here.</p>
                   5995:               </dd>
                   5996: 
                   5997:               <dt><span class="term"><code class=
                   5998:               "filename">PLIST</code></span></dt>
                   5999: 
                   6000:               <dd>
                   6001:                 <p>This file governs the files that are installed
                   6002:                 on your system: all the binaries, manual pages,
                   6003:                 etc. There are other directives which may be
                   6004:                 entered in this file, to control the creation and
                   6005:                 deletion of directories, and the location of
                   6006:                 inserted files. See <a href="#plist" title=
1.38      dillo    6007:                 "Chapter&nbsp;10.&nbsp;PLIST issues">Chapter&nbsp;10,
1.27      rillig   6008:                 <i>PLIST issues</i></a> for more information.</p>
                   6009:               </dd>
                   6010:             </dl>
                   6011:           </div>
                   6012:         </div>
                   6013: 
                   6014:         <div class="sect1" lang="en" xml:lang="en">
                   6015:           <div class="titlepage">
                   6016:             <div>
                   6017:               <div>
                   6018:                 <h2 class="title" style="clear: both"><a name=
                   6019:                 "components.optional" id=
1.38      dillo    6020:                 "components.optional"></a>8.5.&nbsp;Optional
1.27      rillig   6021:                 files</h2>
                   6022:               </div>
                   6023:             </div>
                   6024:           </div>
                   6025: 
                   6026:           <div class="variablelist">
                   6027:             <dl>
                   6028:               <dt><span class="term"><code class=
                   6029:               "filename">INSTALL</code></span></dt>
                   6030: 
                   6031:               <dd>
                   6032:                 <p>This shell script is invoked twice by <a href=
                   6033:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   6034:                 <span class="citerefentry"><span class=
                   6035:                 "refentrytitle">pkg_add</span>(1)</span></a>. First
                   6036:                 time after package extraction and before files are
                   6037:                 moved in place, the second time after the files to
                   6038:                 install are moved in place. This can be used to do
                   6039:                 any custom procedures not possible with @exec
                   6040:                 commands in <code class="filename">PLIST</code>.
                   6041:                 See <a href=
                   6042:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   6043:                 <span class="citerefentry"><span class=
                   6044:                 "refentrytitle">pkg_add</span>(1)</span></a> and
                   6045:                 <a href=
                   6046:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   6047:                 <span class="citerefentry"><span class=
                   6048:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   6049:                 more information.</p>
                   6050:               </dd>
                   6051: 
                   6052:               <dt><span class="term"><code class=
                   6053:               "filename">DEINSTALL</code></span></dt>
                   6054: 
                   6055:               <dd>
                   6056:                 <p>This script is executed before and after any
                   6057:                 files are removed. It is this script's
                   6058:                 responsibility to clean up any additional messy
                   6059:                 details around the package's installation, since
                   6060:                 all pkg_delete knows is how to delete the files
                   6061:                 created in the original distribution. See <a href=
                   6062:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   6063:                 <span class="citerefentry"><span class=
                   6064:                 "refentrytitle">pkg_delete</span>(1)</span></a> and
                   6065:                 <a href=
                   6066:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   6067:                 <span class="citerefentry"><span class=
                   6068:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   6069:                 more information.</p>
                   6070:               </dd>
                   6071: 
                   6072:               <dt><span class="term"><code class=
                   6073:               "filename">MESSAGE</code></span></dt>
                   6074: 
                   6075:               <dd>
                   6076:                 <p>Display this file after installation of the
                   6077:                 package. Useful for things like legal notices on
                   6078:                 almost-free software and hints for updating config
                   6079:                 files after installing modules for apache, PHP etc.
                   6080:                 Please note that you can modify variables in it
                   6081:                 easily by using <code class=
                   6082:                 "varname">MESSAGE_SUBST</code> in the package's
                   6083:                 <code class="filename">Makefile</code>:</p>
                   6084:                 <pre class="programlisting">
                   6085: MESSAGE_SUBST+=  SOMEVAR="somevalue"
                   6086: </pre>
                   6087: 
                   6088:                 <p>replaces "${SOMEVAR}" with &#8220;<span class=
                   6089:                 "quote">somevalue</span>&#8221; in <code class=
                   6090:                 "filename">MESSAGE</code>.</p>
                   6091:               </dd>
                   6092:             </dl>
                   6093:           </div>
                   6094:         </div>
                   6095: 
                   6096:         <div class="sect1" lang="en" xml:lang="en">
                   6097:           <div class="titlepage">
                   6098:             <div>
                   6099:               <div>
                   6100:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    6101:                 "work-dir" id="work-dir"></a>8.6.&nbsp;<code class=
1.27      rillig   6102:                 "filename">work*</code></h2>
                   6103:               </div>
                   6104:             </div>
                   6105:           </div>
                   6106: 
                   6107:           <p>When you type <span><strong class=
                   6108:           "command">make</strong></span> the distribution files are
                   6109:           unpacked into this directory. It can be removed by
                   6110:           running <span><strong class="command">make
                   6111:           clean</strong></span>. Besides the sources, this
                   6112:           directory is also used to keep various timestamp
                   6113:           files.</p>
                   6114: 
                   6115:           <p>If a package doesn't create a subdirectory for itself
                   6116:           (like GNU software does, for instance), but extracts
                   6117:           itself in the current directory, you should set
                   6118:           <code class="varname">WRKSRC</code> accordingly, e.g.
                   6119:           <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
                   6120:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
                   6121:           class="pkgname">editors/sam</a> again, but the quick
                   6122:           answer is:</p>
                   6123:           <pre class="programlisting">
                   6124: WRKSRC=             ${WRKDIR}
                   6125: </pre>
                   6126: 
                   6127:           <p>Please note that the old <code class=
                   6128:           "varname">NO_WRKSUBDIR</code> has been deprecated and
                   6129:           should not be used. Also, if your package doesn't create
                   6130:           a subdir with the name of <code class=
                   6131:           "varname">DISTNAME</code> but some different name, set
                   6132:           <code class="varname">WRKSRC</code> to point to the
                   6133:           proper name in <code class="filename">${WRKDIR}</code>.
                   6134:           See <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6135:           href=
                   6136:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
                   6137:           class="pkgname">lang/tcl</a> and <a xmlns=
                   6138:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   6139:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
                   6140:           class="pkgname">x11/tk</a> for examples, and here is
                   6141:           another one:</p>
                   6142:           <pre class="programlisting">
                   6143: WRKSRC=         ${WRKDIR}/${DISTNAME}/unix
                   6144: </pre>
                   6145: 
                   6146:           <p>The name of the working directory created by pkgsrc is
                   6147:           <code class="filename">work</code> by default. If the
                   6148:           same pkgsrc tree should be used on several different
                   6149:           platforms, the variable <code class=
                   6150:           "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
                   6151:           attach the platform to the directory name, e.g.
                   6152:           <code class="filename">work.i386</code> or <code class=
                   6153:           "filename">work.sparc</code>.</p>
                   6154:         </div>
                   6155: 
                   6156:         <div class="sect1" lang="en" xml:lang="en">
                   6157:           <div class="titlepage">
                   6158:             <div>
                   6159:               <div>
                   6160:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      6161:                 "files-dir" id=
1.38      dillo    6162:                 "files-dir"></a>8.7.&nbsp;<code class=
1.27      rillig   6163:                 "filename">files/*</code></h2>
                   6164:               </div>
                   6165:             </div>
                   6166:           </div>
                   6167: 
                   6168:           <p>If you have any files that you wish to be placed in
                   6169:           the package prior to configuration or building, you could
                   6170:           place these files here and use a &#8220;<span class=
                   6171:           "quote">${CP}</span>&#8221; command in the
                   6172:           &#8220;<span class="quote">pre-configure</span>&#8221;
                   6173:           target to achieve this. Alternatively, you could simply
                   6174:           diff the file against <code class=
                   6175:           "filename">/dev/null</code> and use the patch mechanism
                   6176:           to manage the creation of this file.</p>
                   6177:         </div>
                   6178:       </div>
                   6179: 
                   6180:       <div class="chapter" lang="en" xml:lang="en">
                   6181:         <div class="titlepage">
                   6182:           <div>
                   6183:             <div>
                   6184:               <h2 class="title"><a name="makefile" id=
1.38      dillo    6185:               "makefile"></a>Chapter&nbsp;9.&nbsp;Programming in
1.27      rillig   6186:               <code class="filename">Makefile</code>s</h2>
                   6187:             </div>
                   6188:           </div>
                   6189:         </div>
                   6190: 
                   6191:         <div class="toc">
                   6192:           <p><b>Table of Contents</b></p>
                   6193: 
                   6194:           <dl>
                   6195:             <dt><span class="sect1"><a href=
1.38      dillo    6196:             "#makefile.variables">9.1. <code class=
1.27      rillig   6197:             "filename">Makefile</code> variables</a></span></dt>
                   6198: 
                   6199:             <dd>
                   6200:               <dl>
                   6201:                 <dt><span class="sect2"><a href=
1.38      dillo    6202:                 "#makefile.variables.names">9.1.1. Naming
1.27      rillig   6203:                 conventions</a></span></dt>
                   6204:               </dl>
                   6205:             </dd>
                   6206: 
1.38      dillo    6207:             <dt><span class="sect1"><a href="#makefile.code">9.2.
1.27      rillig   6208:             Code snippets</a></span></dt>
                   6209: 
                   6210:             <dd>
                   6211:               <dl>
1.30      wiz      6212:                 <dt><span class="sect2"><a href=
1.38      dillo    6213:                 "#adding-to-list">9.2.1. Adding things to a
1.30      wiz      6214:                 list</a></span></dt>
1.27      rillig   6215: 
1.30      wiz      6216:                 <dt><span class="sect2"><a href=
1.38      dillo    6217:                 "#converting-internal-to-external">9.2.2.
1.27      rillig   6218:                 Converting an internal list into an external
                   6219:                 list</a></span></dt>
                   6220: 
1.30      wiz      6221:                 <dt><span class="sect2"><a href=
1.38      dillo    6222:                 "#passing-variable-to-shell">9.2.3. Passing
1.30      wiz      6223:                 variables to a shell command</a></span></dt>
1.27      rillig   6224: 
1.30      wiz      6225:                 <dt><span class="sect2"><a href=
1.38      dillo    6226:                 "#quoting-guideline">9.2.4. Quoting
1.30      wiz      6227:                 guideline</a></span></dt>
1.27      rillig   6228: 
1.30      wiz      6229:                 <dt><span class="sect2"><a href=
1.38      dillo    6230:                 "#bsd-make-bug-workaround">9.2.5. Workaround for a
1.30      wiz      6231:                 bug in BSD Make</a></span></dt>
1.27      rillig   6232:               </dl>
                   6233:             </dd>
                   6234:           </dl>
                   6235:         </div>
                   6236: 
                   6237:         <p>Pkgsrc consists of many <code class=
                   6238:         "filename">Makefile</code> fragments, each of which forms a
                   6239:         well-defined part of the pkgsrc system. Using the <a href=
                   6240:         "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   6241:         <span class="citerefentry"><span class=
                   6242:         "refentrytitle">make</span>(1)</span></a> system as a
                   6243:         programming language for a big system like pkgsrc requires
                   6244:         some discipline to keep the code correct and
                   6245:         understandable.</p>
                   6246: 
                   6247:         <p>The basic ingredients for <code class=
                   6248:         "filename">Makefile</code> programming are variables (which
                   6249:         are actually macros) and shell commands. Among these shell
                   6250:         commands may even be more complex ones like <a href=
                   6251:         "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
                   6252:         <span class="citerefentry"><span class=
                   6253:         "refentrytitle">awk</span>(1)</span></a> programs. To make
                   6254:         sure that every shell command runs as intended it is
                   6255:         necessary to quote all variables correctly when they are
                   6256:         used.</p>
                   6257: 
                   6258:         <p>This chapter describes some patterns, that appear quite
                   6259:         often in <code class="filename">Makefile</code>s, including
                   6260:         the pitfalls that come along with them.</p>
                   6261: 
                   6262:         <div class="sect1" lang="en" xml:lang="en">
                   6263:           <div class="titlepage">
                   6264:             <div>
                   6265:               <div>
                   6266:                 <h2 class="title" style="clear: both"><a name=
                   6267:                 "makefile.variables" id=
1.38      dillo    6268:                 "makefile.variables"></a>9.1.&nbsp;<code class=
1.27      rillig   6269:                 "filename">Makefile</code> variables</h2>
                   6270:               </div>
                   6271:             </div>
                   6272:           </div>
                   6273: 
                   6274:           <p><code class="filename">Makefile</code> variables
                   6275:           contain strings that can be processed using the five
                   6276:           operators ``='', ``+='', ``?='', ``:='', and ``!='',
                   6277:           which are described in the <a href=
                   6278:           "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   6279:           <span class="citerefentry"><span class=
                   6280:           "refentrytitle">make</span>(1)</span></a> man page.</p>
                   6281: 
                   6282:           <p>When a variable's value is parsed from a <code class=
                   6283:           "filename">Makefile</code>, the hash character ``#'' and
                   6284:           the backslash character ``\'' are handled specially. If a
                   6285:           backslash is followed by a newline, any whitespace
                   6286:           immediately in front of the backslash, the backslash, the
                   6287:           newline, and any whitespace immediately behind the
                   6288:           newline are replaced with a single space. A backspace
                   6289:           character and an immediately following hash character are
                   6290:           replaced with a single hash character. Otherwise the
                   6291:           backslash is passed as is. In a variable assignment, any
                   6292:           hash character that is not preceded by a backslash starts
                   6293:           a comment that continues upto the end of the logical
                   6294:           line.</p>
                   6295: 
                   6296:           <p><span class="emphasis"><em>Note:</em></span> Because
                   6297:           of this parsing algorithm the only way to create a
                   6298:           variable consisting of a single backslash is using the
                   6299:           ``!='' operator, for example: <code class=
                   6300:           "varname">BACKSLASH!=echo "\\"</code>.</p>
                   6301: 
                   6302:           <p>So far for defining variables. The other thing you can
                   6303:           do with variables is evaluating them. A variable is
                   6304:           evaluated when it is part of the right side of the ``:=''
                   6305:           or the ``!='' operator, or directly before executing a
                   6306:           shell command which the variable is part of. In all other
                   6307:           cases <a href=
                   6308:           "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   6309:           <span class="citerefentry"><span class=
                   6310:           "refentrytitle">make</span>(1)</span></a> performs lazy
                   6311:           evaluation, that is, variables are not evaluated until
                   6312:           there's no other way. The ``modifiers'' mentioned in the
                   6313:           man page also evaluate the variable.</p>
                   6314: 
                   6315:           <p>Some of the modifiers split the string into words and
                   6316:           then operate on the words, others operate on the string
                   6317:           as a whole. When a string is splitted into words, it is
                   6318:           splitted as you would expect it from <a href=
                   6319:           "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
                   6320:           <span class="citerefentry"><span class=
                   6321:           "refentrytitle">sh</span>(1)</span></a>.</p>
                   6322: 
                   6323:           <p>No rule without exception&#8212;the
                   6324:           <span><strong class="command">.for</strong></span> loop
                   6325:           does not follow the shell quoting rules but splits at
                   6326:           sequences of whitespace.</p>
                   6327: 
                   6328:           <p>There are several types of variables that should be
                   6329:           handled differently. Strings and two types of lists.</p>
                   6330: 
                   6331:           <div class="itemizedlist">
                   6332:             <ul type="disc">
                   6333:               <li>
                   6334:                 <p><span class="emphasis"><em>Strings</em></span>
                   6335:                 can contain arbitrary characters. Nevertheless you
                   6336:                 should restrict yourself to only using printable
                   6337:                 characters. Examples are <code class=
                   6338:                 "varname">PREFIX</code> and <code class=
                   6339:                 "varname">COMMENT</code>.</p>
                   6340:               </li>
                   6341: 
                   6342:               <li>
                   6343:                 <p><span class="emphasis"><em>Internal
                   6344:                 lists</em></span> are lists that are never exported
                   6345:                 to any shell command. Their elements are separated
                   6346:                 by whitespace. Therefore the elements themselves
                   6347:                 cannot have embedded whitespace. Any other
                   6348:                 characters are allowed. Internal lists can be used
                   6349:                 in <span><strong class=
                   6350:                 "command">.for</strong></span> loops. Examples are
                   6351:                 <code class="varname">DEPENDS</code> and
                   6352:                 <code class="varname">BUILD_DEPENDS</code>.</p>
                   6353:               </li>
                   6354: 
                   6355:               <li>
                   6356:                 <p><span class="emphasis"><em>External
                   6357:                 lists</em></span> are lists that may be exported to
                   6358:                 a shell command. Their elements can contain any
                   6359:                 characters, including whitespace. That's why they
                   6360:                 cannot be used in <span><strong class=
                   6361:                 "command">.for</strong></span> loops. Examples are
                   6362:                 <code class="varname">DISTFILES</code> and
                   6363:                 <code class="varname">MASTER_SITES</code>.</p>
                   6364:               </li>
                   6365:             </ul>
                   6366:           </div>
                   6367: 
                   6368:           <div class="sect2" lang="en" xml:lang="en">
                   6369:             <div class="titlepage">
                   6370:               <div>
                   6371:                 <div>
                   6372:                   <h3 class="title"><a name=
                   6373:                   "makefile.variables.names" id=
1.38      dillo    6374:                   "makefile.variables.names"></a>9.1.1.&nbsp;Naming
1.27      rillig   6375:                   conventions</h3>
                   6376:                 </div>
                   6377:               </div>
                   6378:             </div>
                   6379: 
                   6380:             <div class="itemizedlist">
                   6381:               <ul type="disc">
                   6382:                 <li>
                   6383:                   <p>All variable names starting with an underscore
                   6384:                   are reserved for use by the pkgsrc
                   6385:                   infrastructure. They shall not be used by package
                   6386:                   <code class="filename">Makefile</code>s.</p>
                   6387:                 </li>
                   6388: 
                   6389:                 <li>
                   6390:                   <p>In <span><strong class=
                   6391:                   "command">.for</strong></span> loops you should
                   6392:                   use lowercase variable names for the iteration
                   6393:                   variables.</p>
                   6394:                 </li>
                   6395: 
                   6396:                 <li>
                   6397:                   <p>All list variables should have a ``plural''
                   6398:                   name, e.g. <code class=
                   6399:                   "varname">PKG_OPTIONS</code> or <code class=
                   6400:                   "varname">DISTFILES</code>.</p>
                   6401:                 </li>
                   6402:               </ul>
                   6403:             </div>
                   6404:           </div>
                   6405:         </div>
                   6406: 
                   6407:         <div class="sect1" lang="en" xml:lang="en">
                   6408:           <div class="titlepage">
                   6409:             <div>
                   6410:               <div>
                   6411:                 <h2 class="title" style="clear: both"><a name=
                   6412:                 "makefile.code" id=
1.38      dillo    6413:                 "makefile.code"></a>9.2.&nbsp;Code snippets</h2>
1.27      rillig   6414:               </div>
                   6415:             </div>
                   6416:           </div>
                   6417: 
                   6418:           <p>This section presents you with some code snippets you
                   6419:           should use in your own code. If you don't find anything
                   6420:           appropriate here, you should test your code and add it
                   6421:           here.</p>
                   6422: 
                   6423:           <div class="sect2" lang="en" xml:lang="en">
                   6424:             <div class="titlepage">
                   6425:               <div>
                   6426:                 <div>
1.30      wiz      6427:                   <h3 class="title"><a name="adding-to-list" id=
1.38      dillo    6428:                   "adding-to-list"></a>9.2.1.&nbsp;Adding things to
1.30      wiz      6429:                   a list</h3>
1.27      rillig   6430:                 </div>
                   6431:               </div>
                   6432:             </div>
                   6433:             <pre class="programlisting">
                   6434: STRING=                 foo * bar `date`
                   6435: INT_LIST=               # empty
                   6436: ANOTHER_INT_LIST=       apache-[0-9]*:../../www/apache
                   6437: EXT_LIST=               # empty
                   6438: ANOTHER_EXT_LIST=       a=b c=d
                   6439: 
                   6440: INT_LIST+=              ${STRING}               # 1
                   6441: INT_LIST+=              ${ANOTHER_INT_LIST}     # 2
                   6442: EXT_LIST+=              ${STRING:Q}             # 3
                   6443: EXT_LIST+=              ${ANOTHER_EXT_LIST}     # 4
                   6444:       
                   6445: </pre>
                   6446: 
                   6447:             <p>When you add a string to an external list (example
                   6448:             3), it must be quoted. In all other cases, you must not
                   6449:             add a quoting level. You must not merge internal and
                   6450:             external lists, unless you are sure that all entries
                   6451:             are correctly interpreted in both lists.</p>
                   6452:           </div>
                   6453: 
                   6454:           <div class="sect2" lang="en" xml:lang="en">
                   6455:             <div class="titlepage">
                   6456:               <div>
                   6457:                 <div>
1.30      wiz      6458:                   <h3 class="title"><a name=
                   6459:                   "converting-internal-to-external" id=
1.38      dillo    6460:                   "converting-internal-to-external"></a>9.2.2.&nbsp;Converting
1.30      wiz      6461:                   an internal list into an external list</h3>
1.27      rillig   6462:                 </div>
                   6463:               </div>
                   6464:             </div>
                   6465:             <pre class="programlisting">
                   6466: EXT_LIST=       # empty
                   6467: .for i in ${INT_LIST}
                   6468: EXT_LIST+=      ${i:Q}""
                   6469: .endfor
                   6470:       
                   6471: </pre>
                   6472: 
                   6473:             <p>This code converts the internal list <code class=
                   6474:             "varname">INT_LIST</code> into the external list
                   6475:             <code class="varname">EXT_LIST</code>. As the elements
                   6476:             of an internal list are unquoted they must be quoted
                   6477:             here. The reason for appending <code class=
                   6478:             "varname">""</code> is explained below.</p>
                   6479:           </div>
1.1       grant    6480: 
1.27      rillig   6481:           <div class="sect2" lang="en" xml:lang="en">
                   6482:             <div class="titlepage">
1.1       grant    6483:               <div>
1.27      rillig   6484:                 <div>
1.30      wiz      6485:                   <h3 class="title"><a name=
                   6486:                   "passing-variable-to-shell" id=
1.38      dillo    6487:                   "passing-variable-to-shell"></a>9.2.3.&nbsp;Passing
1.30      wiz      6488:                   variables to a shell command</h3>
1.27      rillig   6489:                 </div>
1.1       grant    6490:               </div>
                   6491:             </div>
1.27      rillig   6492:             <pre class="programlisting">
                   6493: STRING=         foo bar &lt;    &gt; * `date` $$HOME ' "
                   6494: EXT_LIST=       string=${STRING:Q} x=second\ item
                   6495: 
                   6496: all:
                   6497:         echo ${STRING}                  # 1
                   6498:         echo "${STRING}"                # 2
                   6499:         echo "${STRING:Q}"              # 3
                   6500:         echo ${STRING:Q}                # 4
                   6501:         echo x${STRING:Q} | sed 1s,.,,  # 5
                   6502:         env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
                   6503:       
                   6504: </pre>
                   6505: 
                   6506:             <p>Example 1 leads to a syntax error in the shell, as
                   6507:             the characters are just copied.</p>
                   6508: 
                   6509:             <p>Example 2 leads to a syntax error too, and if you
                   6510:             leave out the last " character from <code class=
                   6511:             "varname">${STRING}</code>, <a href=
                   6512:             "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
                   6513:             <span class="citerefentry"><span class=
                   6514:             "refentrytitle">date</span>(1)</span></a> will be
                   6515:             executed. The <code class="varname">$HOME</code> shell
                   6516:             variable would be evaluated, too.</p>
                   6517: 
                   6518:             <p>Example 3 outputs each space character preceded by a
                   6519:             backslash (or not), depending on the implementation of
                   6520:             the <a href=
                   6521:             "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   6522:             <span class="citerefentry"><span class=
                   6523:             "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1       grant    6524: 
1.27      rillig   6525:             <p>Example 4 handles correctly every string that does
                   6526:             not start with a dash. In that case, the result depends
                   6527:             on the implementation of the <a href=
                   6528:             "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   6529:             <span class="citerefentry"><span class=
                   6530:             "refentrytitle">echo</span>(1)</span></a> command. As
                   6531:             long as you can guarantee that your input does not
                   6532:             start with a dash this form is appropriate.</p>
1.1       grant    6533: 
1.27      rillig   6534:             <p>Example 5 handles even the case of a leading dash
                   6535:             correctly.</p>
1.1       grant    6536: 
1.27      rillig   6537:             <p>The <code class="varname">EXT_LIST</code> does not
                   6538:             need to be quoted because the quoting has already be
                   6539:             done when adding elements to the list.</p>
1.1       grant    6540: 
1.27      rillig   6541:             <p>As internal lists shall not be passed to the shell,
                   6542:             there is no example for it.</p>
1.1       grant    6543:           </div>
                   6544: 
1.27      rillig   6545:           <div class="sect2" lang="en" xml:lang="en">
                   6546:             <div class="titlepage">
1.1       grant    6547:               <div>
1.27      rillig   6548:                 <div>
1.30      wiz      6549:                   <h3 class="title"><a name="quoting-guideline" id=
1.38      dillo    6550:                   "quoting-guideline"></a>9.2.4.&nbsp;Quoting
1.27      rillig   6551:                   guideline</h3>
                   6552:                 </div>
1.1       grant    6553:               </div>
                   6554:             </div>
                   6555: 
1.27      rillig   6556:             <p>There are many possible sources of wrongly quoted
                   6557:             variables. This section lists some of the commonly
                   6558:             known ones.</p>
1.1       grant    6559: 
1.27      rillig   6560:             <div class="itemizedlist">
                   6561:               <ul type="disc">
                   6562:                 <li>
                   6563:                   <p>Whenever you use the value of a list, think
                   6564:                   about what happens to leading or trailing
                   6565:                   whitespace. If the list is a well-formed shell
                   6566:                   expression you can apply the <code class=
                   6567:                   "varname">:M*</code> modifier to strip leading
                   6568:                   and trailing whitespace from each word. The
                   6569:                   <code class="varname">:M</code> operator first
                   6570:                   splits its argument according to the rules of the
                   6571:                   shell, and then creates a new list consisting of
                   6572:                   all words that match the shell glob expression
                   6573:                   <code class="varname">*</code>, that is: all. One
                   6574:                   class of situations where this is needed is when
                   6575:                   adding a variable like <code class=
                   6576:                   "varname">CPPFLAGS</code> to <code class=
                   6577:                   "varname">CONFIGURE_ARGS</code>. If the configure
                   6578:                   script invokes other configure scripts it strips
                   6579:                   the leading and trailing whitespace from the
                   6580:                   variable and then passes it to the other
                   6581:                   configure scripts. But these configure scripts
                   6582:                   expect the (child) <code class=
                   6583:                   "varname">CPPFLAGS</code> variable to be the same
                   6584:                   as the parent <code class=
                   6585:                   "varname">CPPFLAGS</code>. That's why we better
                   6586:                   pass the <code class="varname">CPPFLAGS</code>
                   6587:                   value properly trimmed. And here is how we do
                   6588:                   it:</p>
                   6589:                   <pre class="programlisting">
                   6590: CPPFLAGS=               # empty
                   6591: CPPFLAGS+=              -Wundef -DPREFIX=\"${PREFIX:Q}\"
                   6592: CPPFLAGS+=              ${MY_CPPFLAGS}
1.1       grant    6593: 
1.27      rillig   6594: CONFIGURE_ARGS+=        CPPFLAGS=${CPPFLAGS:M*:Q}
1.1       grant    6595: 
1.27      rillig   6596: all:
                   6597:         echo x${CPPFLAGS:Q}x            # leading and trailing whitespace
                   6598:         echo x${CONFIGURE_ARGS}x        # properly trimmed
                   6599:         
                   6600: </pre>
                   6601:                 </li>
1.1       grant    6602: 
1.27      rillig   6603:                 <li>
                   6604:                   <p>The example above contains one bug: The
                   6605:                   <code class="varname">${PREFIX}</code> is a
                   6606:                   properly quoted shell expression, but there is
                   6607:                   the C compiler after it, which also expects a
                   6608:                   properly quoted string (this time in C syntax).
                   6609:                   The version above is therefore only correct if
                   6610:                   <code class="varname">${PREFIX}</code> does not
                   6611:                   have embedded backslashes or double quotes. If
                   6612:                   you want to allow these, you have to add another
                   6613:                   layer of quoting to each variable that is used as
                   6614:                   a C string literal. You cannot use the
                   6615:                   <code class="varname">:Q</code> operator for it,
                   6616:                   as this operator only works for the shell.</p>
                   6617:                 </li>
1.1       grant    6618: 
1.27      rillig   6619:                 <li>
                   6620:                   <p>Whenever a variable can be empty the
                   6621:                   <code class="varname">:Q</code> operator can have
                   6622:                   surprising results. Here are two completely
                   6623:                   different cases which can be solved with the same
                   6624:                   trick.</p>
                   6625:                   <pre class="programlisting">
                   6626: EMPTY=                  # empty
                   6627: empty_test:
                   6628:         for i in a ${EMPTY:Q} c; do \
                   6629:                 echo "$$i"; \
                   6630:         done
                   6631: 
                   6632: for_test:
                   6633: .for i in a:\ a:\test.txt
                   6634:         echo ${i:Q}
                   6635:         echo "foo"
                   6636: .endfor
                   6637:         
1.1       grant    6638: </pre>
                   6639: 
1.27      rillig   6640:                   <p>The first example will only print two of the
                   6641:                   three lines we might have expected. This is
                   6642:                   because <code class="varname">${EMPTY:Q}</code>
                   6643:                   expands to the empty string, which the shell
                   6644:                   cannot see. The workaround is to write
                   6645:                   <code class="varname">${EMPTY:Q}""</code>. This
                   6646:                   pattern can be often found as <code class=
                   6647:                   "varname">${TEST} -z ${VAR:Q}</code> or as
                   6648:                   <code class="varname">${TEST} -f
                   6649:                   ${FNAME:Q}</code> (both of these are wrong).</p>
                   6650: 
                   6651:                   <p>The second example will only print three lines
                   6652:                   instead of four. The first line looks like
                   6653:                   <code class="varname">a:\ echo foo</code>. This
                   6654:                   is because the backslash of the value
                   6655:                   <code class="varname">a:\</code> is interpreted
                   6656:                   as a line-continuation by <a href=
                   6657:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   6658:                   <span class="citerefentry"><span class=
                   6659:                   "refentrytitle">make</span>(1)</span></a>, which
                   6660:                   makes the second line the arguments of the
                   6661:                   <a href=
                   6662:                   "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   6663:                   <span class="citerefentry"><span class=
                   6664:                   "refentrytitle">echo</span>(1)</span></a> command
                   6665:                   from the first line. To avoid this, write
                   6666:                   <code class="varname">${i:Q}""</code>.</p>
                   6667:                 </li>
                   6668:               </ul>
                   6669:             </div>
1.1       grant    6670:           </div>
                   6671: 
1.27      rillig   6672:           <div class="sect2" lang="en" xml:lang="en">
                   6673:             <div class="titlepage">
1.1       grant    6674:               <div>
1.27      rillig   6675:                 <div>
1.30      wiz      6676:                   <h3 class="title"><a name=
                   6677:                   "bsd-make-bug-workaround" id=
1.38      dillo    6678:                   "bsd-make-bug-workaround"></a>9.2.5.&nbsp;Workaround
1.30      wiz      6679:                   for a bug in BSD Make</h3>
1.27      rillig   6680:                 </div>
1.1       grant    6681:               </div>
                   6682:             </div>
                   6683: 
1.27      rillig   6684:             <p>The pkgsrc bmake program does not handle the
                   6685:             following assignment correctly. In case <code class=
                   6686:             "varname">_othervar_</code> contains a ``-'' character,
                   6687:             one of the closing braces is included in <code class=
                   6688:             "varname">${VAR}</code> after this code executes.</p>
                   6689:             <pre class="programlisting">
                   6690:         VAR:= ${VAR:N${_othervar_:C/-//}}
                   6691:       
1.1       grant    6692: </pre>
                   6693: 
1.27      rillig   6694:             <p>For a more complex code snippet and a workaround,
                   6695:             see the package <a xmlns=
                   6696:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   6697:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
                   6698:             class="pkgname">regress/make-quoting</a>, testcase
                   6699:             <code class="varname">bug1</code>.</p>
1.1       grant    6700:           </div>
                   6701:         </div>
                   6702:       </div>
                   6703: 
                   6704:       <div class="chapter" lang="en" xml:lang="en">
                   6705:         <div class="titlepage">
                   6706:           <div>
                   6707:             <div>
                   6708:               <h2 class="title"><a name="plist" id=
1.38      dillo    6709:               "plist"></a>Chapter&nbsp;10.&nbsp;PLIST issues</h2>
1.1       grant    6710:             </div>
                   6711:           </div>
                   6712:         </div>
                   6713: 
                   6714:         <div class="toc">
                   6715:           <p><b>Table of Contents</b></p>
                   6716: 
                   6717:           <dl>
1.38      dillo    6718:             <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1       grant    6719:             ID</a></span></dt>
                   6720: 
1.30      wiz      6721:             <dt><span class="sect1"><a href=
1.38      dillo    6722:             "#automatic-plist-generation">10.2. Semi-automatic
1.30      wiz      6723:             <code class="filename">PLIST</code>
1.14      xtraeme  6724:             generation</a></span></dt>
1.1       grant    6725: 
1.38      dillo    6726:             <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14      xtraeme  6727:             Tweaking output of <span><strong class="command">make
                   6728:             print-PLIST</strong></span></a></span></dt>
1.1       grant    6729: 
1.38      dillo    6730:             <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1       grant    6731:             Variable substitution in PLIST</a></span></dt>
                   6732: 
1.30      wiz      6733:             <dt><span class="sect1"><a href=
1.38      dillo    6734:             "#manpage-compression">10.5.
1.1       grant    6735:             Manpage-compression</a></span></dt>
                   6736: 
1.38      dillo    6737:             <dt><span class="sect1"><a href=
                   6738:             "#using-PLIST_SRC">10.6. Changing PLIST source with
                   6739:             <code class="varname">PLIST_SRC</code></a></span></dt>
1.1       grant    6740: 
1.30      wiz      6741:             <dt><span class="sect1"><a href=
1.38      dillo    6742:             "#platform-specific-plist">10.7. Platform specific and
1.30      wiz      6743:             differing PLISTs</a></span></dt>
1.1       grant    6744: 
1.38      dillo    6745:             <dt><span class="sect1"><a href=
                   6746:             "#faq.common-dirs">10.8. Sharing directories between
                   6747:             packages</a></span></dt>
1.1       grant    6748:           </dl>
                   6749:         </div>
                   6750: 
1.14      xtraeme  6751:         <p>The <code class="filename">PLIST</code> file contains a
1.1       grant    6752:         package's &#8220;<span class="quote">packing
                   6753:         list</span>&#8221;, i.e. a list of files that belong to the
1.14      xtraeme  6754:         package (relative to the <code class=
                   6755:         "filename">${PREFIX}</code> directory it's been installed
                   6756:         in) plus some additional statements - see the <a href=
1.1       grant    6757:         "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   6758:         <span class="citerefentry"><span class=
                   6759:         "refentrytitle">pkg_create</span>(1)</span></a> manpage for
                   6760:         a full list. This chapter addresses some issues that need
1.14      xtraeme  6761:         attention when dealing with the <code class=
                   6762:         "filename">PLIST</code> file (or files, see below!).</p>
1.1       grant    6763: 
                   6764:         <div class="sect1" lang="en" xml:lang="en">
                   6765:           <div class="titlepage">
                   6766:             <div>
                   6767:               <div>
                   6768:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    6769:                 "rcs-id" id="rcs-id"></a>10.1.&nbsp;RCS ID</h2>
1.1       grant    6770:               </div>
                   6771:             </div>
                   6772:           </div>
                   6773: 
                   6774:           <p>Be sure to add a RCS ID line as the first thing in any
1.14      xtraeme  6775:           <code class="filename">PLIST</code> file you write:</p>
1.1       grant    6776:           <pre class="programlisting">
1.17      sketch   6777: @comment $NetBSD$
1.1       grant    6778: </pre>
                   6779:         </div>
                   6780: 
                   6781:         <div class="sect1" lang="en" xml:lang="en">
                   6782:           <div class="titlepage">
                   6783:             <div>
                   6784:               <div>
                   6785:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      6786:                 "automatic-plist-generation" id=
1.38      dillo    6787:                 "automatic-plist-generation"></a>10.2.&nbsp;Semi-automatic
1.14      xtraeme  6788:                 <code class="filename">PLIST</code> generation</h2>
1.1       grant    6789:               </div>
                   6790:             </div>
                   6791:           </div>
                   6792: 
1.14      xtraeme  6793:           <p>You can use the <span><strong class="command">make
                   6794:           print-PLIST</strong></span> command to output a PLIST
                   6795:           that matches any new files since the package was
                   6796:           extracted. See <a href="#build.helpful-targets" title=
1.38      dillo    6797:           "14.3.&nbsp;Other helpful targets">Section&nbsp;14.3,
1.1       grant    6798:           &#8220;Other helpful targets&#8221;</a> for more
                   6799:           information on this target.</p>
                   6800:         </div>
                   6801: 
                   6802:         <div class="sect1" lang="en" xml:lang="en">
                   6803:           <div class="titlepage">
                   6804:             <div>
                   6805:               <div>
                   6806:                 <h2 class="title" style="clear: both"><a name=
                   6807:                 "print-PLIST" id=
1.38      dillo    6808:                 "print-PLIST"></a>10.3.&nbsp;Tweaking output of
1.14      xtraeme  6809:                 <span><strong class="command">make
                   6810:                 print-PLIST</strong></span></h2>
1.1       grant    6811:               </div>
                   6812:             </div>
                   6813:           </div>
                   6814: 
                   6815:           <p>If you have used any of the *-dirs packages, as
                   6816:           explained in <a href="#faq.common-dirs" title=
1.38      dillo    6817:           "10.8.&nbsp;Sharing directories between packages">Section&nbsp;10.8,
1.1       grant    6818:           &#8220;Sharing directories between packages&#8221;</a>,
1.14      xtraeme  6819:           you may have noticed that <span><strong class=
                   6820:           "command">make print-PLIST</strong></span> outputs a set
                   6821:           of <code class="varname">@comment</code>s instead of real
                   6822:           <code class="varname">@dirrm</code> lines. You can also
                   6823:           do this for specific directories and files, so that the
                   6824:           results of that command are very close to reality. This
                   6825:           helps <span class="emphasis"><em>a lot</em></span> during
                   6826:           the update of packages.</p>
                   6827: 
                   6828:           <p>The <code class="varname">PRINT_PLIST_AWK</code>
                   6829:           variable takes a set of AWK patterns and actions that are
                   6830:           used to filter the output of print-PLIST. You can
                   6831:           <span class="emphasis"><em>append</em></span> any chunk
                   6832:           of AWK scripting you like to it, but be careful with
1.1       grant    6833:           quoting.</p>
                   6834: 
1.14      xtraeme  6835:           <p>For example, to get all files inside the <code class=
                   6836:           "filename">libdata/foo</code> directory removed from the
1.1       grant    6837:           resulting PLIST:</p>
                   6838:           <pre class="programlisting">
                   6839:       PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
                   6840:     
                   6841: </pre>
                   6842: 
1.14      xtraeme  6843:           <p>And to get all the <code class="varname">@dirrm</code>
1.1       grant    6844:           lines referring to a specific (shared) directory
1.14      xtraeme  6845:           converted to <code class="varname">@comment</code>s:</p>
1.1       grant    6846:           <pre class="programlisting">
                   6847:       PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
                   6848:     
                   6849: </pre>
                   6850:         </div>
                   6851: 
                   6852:         <div class="sect1" lang="en" xml:lang="en">
                   6853:           <div class="titlepage">
                   6854:             <div>
                   6855:               <div>
                   6856:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    6857:                 "plist.misc" id=
                   6858:                 "plist.misc"></a>10.4.&nbsp;Variable substitution
                   6859:                 in PLIST</h2>
1.1       grant    6860:               </div>
                   6861:             </div>
                   6862:           </div>
                   6863: 
                   6864:           <p>A number of variables are substituted automatically in
                   6865:           PLISTs when a package is installed on a system. This
                   6866:           includes the following variables:</p>
                   6867: 
                   6868:           <div class="variablelist">
                   6869:             <dl>
1.14      xtraeme  6870:               <dt><span class="term"><code class=
                   6871:               "varname">${MACHINE_ARCH}</code>, <code class=
                   6872:               "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1       grant    6873: 
                   6874:               <dd>
                   6875:                 <p>Some packages like emacs and perl embed
                   6876:                 information about which architecture they were
                   6877:                 built on into the pathnames where they install
                   6878:                 their file. To handle this case, PLIST will be
                   6879:                 preprocessed before actually used, and the symbol
1.14      xtraeme  6880:                 &#8220;<span class="quote"><code class=
                   6881:                 "varname">${MACHINE_ARCH}</code></span>&#8221; will
                   6882:                 be replaced by what <span><strong class=
                   6883:                 "command">uname -p</strong></span> gives. The same
                   6884:                 is done if the string <code class=
                   6885:                 "varname">${MACHINE_GNU_ARCH}</code> is embedded in
                   6886:                 PLIST somewhere - use this on packages that have
                   6887:                 GNU autoconf created configure scripts.</p>
1.1       grant    6888: 
                   6889:                 <div class="note" style=
                   6890:                 "margin-left: 0.5in; margin-right: 0.5in;">
                   6891:                   <h3 class="title">Legacy note</h3>
                   6892: 
                   6893:                   <p>There used to be a symbol &#8220;<span class=
1.14      xtraeme  6894:                   "quote"><code class=
                   6895:                   "varname">$ARCH</code></span>&#8221; that was
                   6896:                   replaced by the output of <span><strong class=
                   6897:                   "command">uname -m</strong></span>, but that's no
1.1       grant    6898:                   longer supported and has been removed.</p>
                   6899:                 </div>
                   6900:               </dd>
                   6901: 
1.14      xtraeme  6902:               <dt><span class="term"><code class=
                   6903:               "varname">${OPSYS}</code>, <code class=
                   6904:               "varname">${LOWER_OPSYS}</code>, <code class=
                   6905:               "varname">${OS_VERSION}</code></span></dt>
1.1       grant    6906: 
                   6907:               <dd>
                   6908:                 <p>Some packages want to embed the OS name and
                   6909:                 version into some paths. To do this, use these
1.14      xtraeme  6910:                 variables in the <code class=
                   6911:                 "filename">PLIST</code>:</p>
1.1       grant    6912: 
                   6913:                 <div class="itemizedlist">
                   6914:                   <ul type="disc">
                   6915:                     <li>
1.14      xtraeme  6916:                       <p><code class="varname">${OPSYS}</code> -
                   6917:                       output of &#8220;<span class=
                   6918:                       "quote"><span><strong class="command">uname
                   6919:                       -s</strong></span></span>&#8221;</p>
1.1       grant    6920:                     </li>
                   6921: 
                   6922:                     <li>
1.14      xtraeme  6923:                       <p><code class=
                   6924:                       "varname">${LOWER_OPSYS}</code> - lowercase
                   6925:                       common name (eg. &#8220;<span class=
                   6926:                       "quote">solaris</span>&#8221;)</p>
1.1       grant    6927:                     </li>
                   6928: 
                   6929:                     <li>
1.14      xtraeme  6930:                       <p><code class="varname">${OS_VERSION}</code>
                   6931:                       - &#8220;<span class=
                   6932:                       "quote"><span><strong class="command">uname
                   6933:                       -r</strong></span></span>&#8221;</p>
1.1       grant    6934:                     </li>
                   6935:                   </ul>
                   6936:                 </div>
                   6937:               </dd>
                   6938: 
1.14      xtraeme  6939:               <dt><span class="term"><code class=
                   6940:               "varname">${PKGLOCALEDIR}</code></span></dt>
1.1       grant    6941: 
                   6942:               <dd>
                   6943:                 <p>Packages that install locale files should list
                   6944:                 them in the PLIST as &#8220;<span class=
                   6945:                 "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>&#8221;
                   6946:                 instead of &#8220;<span class=
                   6947:                 "quote">share/locale/de/LC_MESSAGES/...</span>&#8221;.
                   6948:                 This properly handles the fact that different
                   6949:                 operating systems expect locale files to be either
1.14      xtraeme  6950:                 in <code class="filename">share</code> or
                   6951:                 <code class="filename">lib</code> by default.</p>
1.1       grant    6952:               </dd>
                   6953:             </dl>
                   6954:           </div>
                   6955: 
                   6956:           <p>For a complete list of values which are replaced by
1.14      xtraeme  6957:           default, please look in <code class=
                   6958:           "filename">bsd.pkg.mk</code> (and search for <span class=
1.1       grant    6959:           "emphasis"><em>PLIST_SUBST</em></span>).</p>
                   6960: 
                   6961:           <p>If you want to change other variables not listed
                   6962:           above, you can add variables and their expansions to this
1.14      xtraeme  6963:           variable in the following way, similar to <code class=
                   6964:           "varname">MESSAGE_SUBST</code> (see <a href=
1.1       grant    6965:           "#components.optional" title=
1.38      dillo    6966:           "8.5.&nbsp;Optional files">Section&nbsp;8.5,
1.1       grant    6967:           &#8220;Optional files&#8221;</a>):</p>
                   6968:           <pre class="programlisting">
                   6969: PLIST_SUBST+=    SOMEVAR="somevalue"
                   6970: </pre>
                   6971: 
                   6972:           <p>This replaces all occurrences of &#8220;<span class=
                   6973:           "quote">${SOMEVAR}</span>&#8221; in the PLIST with
                   6974:           &#8220;<span class="quote">somevalue</span>&#8221;.</p>
                   6975:         </div>
                   6976: 
                   6977:         <div class="sect1" lang="en" xml:lang="en">
                   6978:           <div class="titlepage">
                   6979:             <div>
                   6980:               <div>
                   6981:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      6982:                 "manpage-compression" id=
1.38      dillo    6983:                 "manpage-compression"></a>10.5.&nbsp;Manpage-compression</h2>
1.1       grant    6984:               </div>
                   6985:             </div>
                   6986:           </div>
                   6987: 
                   6988:           <p>Manpages should be installed in compressed form if
1.14      xtraeme  6989:           <code class="varname">MANZ</code> is set (in <code class=
                   6990:           "filename">bsd.own.mk</code>), and uncompressed
                   6991:           otherwise. To handle this in the <code class=
                   6992:           "filename">PLIST</code> file, the suffix
                   6993:           &#8220;<span class="quote">.gz</span>&#8221; is
                   6994:           appended/removed automatically for manpages according to
                   6995:           <code class="varname">MANZ</code> and <code class=
                   6996:           "varname">MANCOMPRESSED</code> being set or not, see
                   6997:           above for details. This modification of the <code class=
                   6998:           "filename">PLIST</code> file is done on a copy of it, not
                   6999:           <code class="filename">PLIST</code> itself.</p>
1.1       grant    7000:         </div>
                   7001: 
                   7002:         <div class="sect1" lang="en" xml:lang="en">
                   7003:           <div class="titlepage">
                   7004:             <div>
                   7005:               <div>
                   7006:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      7007:                 "using-PLIST_SRC" id=
1.38      dillo    7008:                 "using-PLIST_SRC"></a>10.6.&nbsp;Changing PLIST
1.30      wiz      7009:                 source with <code class=
1.14      xtraeme  7010:                 "varname">PLIST_SRC</code></h2>
1.1       grant    7011:               </div>
                   7012:             </div>
                   7013:           </div>
                   7014: 
1.14      xtraeme  7015:           <p>To use one or more files as source for the
                   7016:           <code class="filename">PLIST</code> used in generating
                   7017:           the binary package, set the variable <code class=
                   7018:           "varname">PLIST_SRC</code> to the names of that file(s).
1.24      wiz      7019:           The files are later concatenated using <a href=
                   7020:           "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
                   7021:           <span class="citerefentry"><span class=
                   7022:           "refentrytitle">cat</span>(1)</span></a>, and order of
                   7023:           things is important.</p>
1.1       grant    7024:         </div>
                   7025: 
                   7026:         <div class="sect1" lang="en" xml:lang="en">
                   7027:           <div class="titlepage">
                   7028:             <div>
                   7029:               <div>
                   7030:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      7031:                 "platform-specific-plist" id=
1.38      dillo    7032:                 "platform-specific-plist"></a>10.7.&nbsp;Platform
1.1       grant    7033:                 specific and differing PLISTs</h2>
                   7034:               </div>
                   7035:             </div>
                   7036:           </div>
                   7037: 
                   7038:           <p>Some packages decide to install a different set of
                   7039:           files based on the operating system being used. These
                   7040:           differences can be automatically handled by using the
                   7041:           following files:</p>
                   7042: 
                   7043:           <div class="itemizedlist">
                   7044:             <ul type="disc">
                   7045:               <li>
1.14      xtraeme  7046:                 <p><code class="filename">PLIST.common</code></p>
1.1       grant    7047:               </li>
                   7048: 
                   7049:               <li>
1.14      xtraeme  7050:                 <p><code class="filename">PLIST.${OPSYS}</code></p>
1.1       grant    7051:               </li>
                   7052: 
                   7053:               <li>
1.14      xtraeme  7054:                 <p><code class=
1.21      ben      7055:                 "filename">PLIST.${MACHINE_ARCH}</code></p>
                   7056:               </li>
                   7057: 
                   7058:               <li>
                   7059:                 <p><code class=
                   7060:                 "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
                   7061:               </li>
                   7062: 
                   7063:               <li>
                   7064:                 <p><code class=
1.14      xtraeme  7065:                 "filename">PLIST.common_end</code></p>
1.1       grant    7066:               </li>
                   7067:             </ul>
                   7068:           </div>
                   7069:         </div>
                   7070: 
                   7071:         <div class="sect1" lang="en" xml:lang="en">
                   7072:           <div class="titlepage">
                   7073:             <div>
                   7074:               <div>
                   7075:                 <h2 class="title" style="clear: both"><a name=
                   7076:                 "faq.common-dirs" id=
1.38      dillo    7077:                 "faq.common-dirs"></a>10.8.&nbsp;Sharing
                   7078:                 directories between packages</h2>
1.1       grant    7079:               </div>
                   7080:             </div>
                   7081:           </div>
                   7082: 
                   7083:           <p>A &#8220;<span class="quote">shared
                   7084:           directory</span>&#8221; is a directory where multiple
                   7085:           (and unrelated) packages install files. These directories
                   7086:           are problematic because you have to add special tricks in
                   7087:           the PLIST to conditionally remove them, or have some
                   7088:           centralized package handle them.</p>
                   7089: 
                   7090:           <p>Within pkgsrc, you'll find both approaches. If a
                   7091:           directory is shared by a few unrelated packages, it's
                   7092:           often not worth to add an extra package to remove it.
                   7093:           Therefore, one simply does:</p>
                   7094:           <pre class="programlisting">
                   7095:       @unexec ${RMDIR} %D/path/to/shared/directory 2&gt;/dev/null || ${TRUE}
                   7096:     
                   7097: </pre>
                   7098: 
                   7099:           <p>in the PLISTs of all affected packages, instead of the
                   7100:           regular "@dirrm" line.</p>
                   7101: 
                   7102:           <p>However, if the directory is shared across many
                   7103:           packages, two different solutions are available:</p>
                   7104: 
                   7105:           <div class="orderedlist">
                   7106:             <ol type="1">
                   7107:               <li>
                   7108:                 <p>If the packages have a common dependency, the
                   7109:                 directory can be removed in that. For example, see
                   7110:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7111:                 href=
                   7112:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.20      ben      7113:                 class="pkgname">textproc/scrollkeeper</a>, which
                   7114:                 removes the shared directory <code class=
                   7115:                 "filename">share/omf</code>.</p>
1.1       grant    7116:               </li>
                   7117: 
                   7118:               <li>
                   7119:                 <p>If the packages using the directory are not
                   7120:                 related at all (they have no common dependencies),
                   7121:                 a *-dirs package is used.</p>
                   7122:               </li>
                   7123:             </ol>
                   7124:           </div>
                   7125: 
                   7126:           <p>From now on, we'll discuss the second solution. To get
                   7127:           an idea of the *-dirs packages available, issue:</p>
                   7128:           <pre class="programlisting">
1.14      xtraeme  7129:       <code class="prompt">%</code> cd .../pkgsrc
                   7130:       <code class="prompt">%</code> ls -d */*-dirs
1.1       grant    7131:     
                   7132: </pre>
                   7133: 
                   7134:           <p>Their use from other packages is very simple. The
1.14      xtraeme  7135:           <code class="varname">USE_DIRS</code> variable takes a
                   7136:           list of package names (without the &#8220;<span class=
1.1       grant    7137:           "quote">-dirs</span>&#8221; part) together with the
                   7138:           required version number (always pick the latest one when
1.34      wiz      7139:           writing new packages).</p>
1.1       grant    7140: 
                   7141:           <p>For example, if a package installs files under
1.14      xtraeme  7142:           <code class="filename">share/applications</code>, it
                   7143:           should have the following line in it:</p>
1.1       grant    7144:           <pre class="programlisting">
                   7145:       USE_DIRS+= xdg-1.1
                   7146:     
                   7147: </pre>
                   7148: 
1.14      xtraeme  7149:           <p>After regenerating the PLIST using
                   7150:           <span><strong class="command">make
                   7151:           print-PLIST</strong></span>, you should get the right
                   7152:           (commented out) lines.</p>
1.1       grant    7153: 
1.14      xtraeme  7154:           <p>Note that, even if your package is using <code class=
                   7155:           "filename">$X11BASE</code>, it must not depend on the
1.1       grant    7156:           *-x11-dirs packages. Just specify the name without that
1.14      xtraeme  7157:           part and pkgsrc (in particular, <code class=
                   7158:           "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1       grant    7159:         </div>
                   7160:       </div>
                   7161: 
                   7162:       <div class="chapter" lang="en" xml:lang="en">
                   7163:         <div class="titlepage">
                   7164:           <div>
                   7165:             <div>
                   7166:               <h2 class="title"><a name="buildlink" id=
1.38      dillo    7167:               "buildlink"></a>Chapter&nbsp;11.&nbsp;Buildlink
1.1       grant    7168:               methodology</h2>
                   7169:             </div>
                   7170:           </div>
                   7171:         </div>
                   7172: 
                   7173:         <div class="toc">
                   7174:           <p><b>Table of Contents</b></p>
                   7175: 
                   7176:           <dl>
1.30      wiz      7177:             <dt><span class="sect1"><a href=
1.38      dillo    7178:             "#converting-to-buildlink3">11.1. Converting packages
1.30      wiz      7179:             to use buildlink3</a></span></dt>
1.1       grant    7180: 
1.30      wiz      7181:             <dt><span class="sect1"><a href=
1.38      dillo    7182:             "#creating-buildlink3.mk">11.2. Writing <code class=
1.30      wiz      7183:             "filename">buildlink3.mk</code> files</a></span></dt>
1.1       grant    7184: 
                   7185:             <dd>
                   7186:               <dl>
1.25      rillig   7187:                 <dt><span class="sect2"><a href=
1.38      dillo    7188:                 "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30      wiz      7189:                 buildlink3.mk file</a></span></dt>
1.1       grant    7190: 
1.25      rillig   7191:                 <dt><span class="sect2"><a href=
1.38      dillo    7192:                 "#updating-buildlink-depends">11.2.2. Updating
1.30      wiz      7193:                 <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14      xtraeme  7194:                 "replaceable"><code>pkg</code></em></code> in
                   7195:                 <code class="filename">buildlink3.mk</code>
1.1       grant    7196:                 files</a></span></dt>
                   7197:               </dl>
                   7198:             </dd>
                   7199: 
1.30      wiz      7200:             <dt><span class="sect1"><a href=
1.38      dillo    7201:             "#writing-builtin.mk">11.3. Writing <code class=
1.30      wiz      7202:             "filename">builtin.mk</code> files</a></span></dt>
1.1       grant    7203: 
                   7204:             <dd>
                   7205:               <dl>
1.25      rillig   7206:                 <dt><span class="sect2"><a href=
1.38      dillo    7207:                 "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.30      wiz      7208:                 <code class="filename">builtin.mk</code>
                   7209:                 file</a></span></dt>
1.1       grant    7210: 
1.25      rillig   7211:                 <dt><span class="sect2"><a href=
1.38      dillo    7212:                 "#native-or-pkgsrc-preference">11.3.2. Global
1.30      wiz      7213:                 preferences for native or pkgsrc
                   7214:                 software</a></span></dt>
1.1       grant    7215:               </dl>
                   7216:             </dd>
                   7217:           </dl>
                   7218:         </div>
                   7219: 
                   7220:         <p>Buildlink is a framework in pkgsrc that controls what
                   7221:         headers and libraries are seen by a package's configure and
                   7222:         build processes. This is implemented in a two step
                   7223:         process:</p>
                   7224: 
                   7225:         <div class="orderedlist">
                   7226:           <ol type="1">
                   7227:             <li>
                   7228:               <p>Symlink headers and libraries for dependencies
1.14      xtraeme  7229:               into <code class="varname">BUILDLINK_DIR</code>,
                   7230:               which by default is a subdirectory of <code class=
                   7231:               "varname">WRKDIR</code>.</p>
1.1       grant    7232:             </li>
                   7233: 
                   7234:             <li>
                   7235:               <p>Create wrapper scripts that are used in place of
1.14      xtraeme  7236:               the normal compiler tools that translate <code class=
                   7237:               "option">-I${LOCALBASE}/include</code> and
                   7238:               <code class="option">-L${LOCALBASE}/lib</code> into
                   7239:               references to <code class=
                   7240:               "varname">BUILDLINK_DIR</code>. The wrapper scripts
                   7241:               also make native compiler on some operating systems
                   7242:               look like GCC, so that packages that expect GCC won't
                   7243:               require modifications to build with those native
                   7244:               compilers.</p>
1.1       grant    7245:             </li>
                   7246:           </ol>
                   7247:         </div>
                   7248: 
                   7249:         <p>This normalizes the environment in which a package is
                   7250:         built so that the package may be built consistently despite
                   7251:         what other software may be installed. Please note that the
1.14      xtraeme  7252:         normal system header and library paths, e.g. <code class=
                   7253:         "filename">/usr/include</code>, <code class=
                   7254:         "filename">/usr/lib</code>, etc., are always searched --
1.1       grant    7255:         buildlink3 is designed to insulate the package build from
                   7256:         non-system-supplied software.</p>
                   7257: 
                   7258:         <div class="sect1" lang="en" xml:lang="en">
                   7259:           <div class="titlepage">
                   7260:             <div>
                   7261:               <div>
                   7262:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      7263:                 "converting-to-buildlink3" id=
1.38      dillo    7264:                 "converting-to-buildlink3"></a>11.1.&nbsp;Converting
1.30      wiz      7265:                 packages to use buildlink3</h2>
1.1       grant    7266:               </div>
                   7267:             </div>
                   7268:           </div>
                   7269: 
                   7270:           <p>The process of converting packages to use the
                   7271:           buildlink3 framework (&#8220;<span class=
                   7272:           "quote">bl3ifying</span>&#8221;) is fairly
                   7273:           straightforward. The things to keep in mind are:</p>
                   7274: 
                   7275:           <div class="orderedlist">
                   7276:             <ol type="1">
                   7277:               <li>
                   7278:                 <p>Ensure that the build always calls the wrapper
                   7279:                 scripts instead of the actual toolchain. Some
                   7280:                 packages are tricky, and the only way to know for
1.14      xtraeme  7281:                 sure is the check <code class=
                   7282:                 "filename">${WRKDIR}/.work.log</code> to see if the
1.1       grant    7283:                 wrappers are being invoked.</p>
                   7284:               </li>
                   7285: 
                   7286:               <li>
1.14      xtraeme  7287:                 <p>Don't override <code class=
                   7288:                 "varname">PREFIX</code> from within the package
                   7289:                 Makefile, e.g. Java VMs, standalone shells, etc.,
                   7290:                 because the code to symlink files into <code class=
                   7291:                 "filename">${BUILDLINK_DIR}</code> looks for files
1.1       grant    7292:                 relative to &#8220;<span class="quote">pkg_info -qp
1.14      xtraeme  7293:                 <em class=
                   7294:                 "replaceable"><code>pkgname</code></em></span>&#8221;.</p>
1.1       grant    7295:               </li>
                   7296: 
                   7297:               <li>
                   7298:                 <p>Remember that <span class=
1.14      xtraeme  7299:                 "emphasis"><em>only</em></span> the <code class=
                   7300:                 "filename">buildlink3.mk</code> files that you list
1.1       grant    7301:                 in a package's Makefile are added as dependencies
                   7302:                 for that package.</p>
                   7303:               </li>
                   7304:             </ol>
                   7305:           </div>
                   7306: 
                   7307:           <p>If a dependency on a particular package is required
                   7308:           for its libraries and headers, then we replace:</p>
                   7309:           <pre class="programlisting">
1.27      rillig   7310: DEPENDS+=   foo&gt;=1.1.0:../../category/foo
1.1       grant    7311: </pre>
                   7312: 
                   7313:           <p>with</p>
                   7314:           <pre class="programlisting">
                   7315: .include "../../category/foo/buildlink3.mk"
                   7316: </pre>
                   7317: 
1.14      xtraeme  7318:           <p>There are several <code class=
                   7319:           "filename">buildlink3.mk</code> files in <code class=
                   7320:           "filename">pkgsrc/mk</code> that handle special package
1.1       grant    7321:           issues:</p>
                   7322: 
                   7323:           <div class="itemizedlist">
                   7324:             <ul type="disc">
                   7325:               <li>
1.14      xtraeme  7326:                 <p><code class="filename">bdb.buildlink3.mk</code>
1.1       grant    7327:                 chooses either the native or a pkgsrc Berkeley DB
1.14      xtraeme  7328:                 implementation based on the values of <code class=
                   7329:                 "varname">BDB_ACCEPTED</code> and <code class=
                   7330:                 "varname">BDB_DEFAULT</code>.</p>
1.1       grant    7331:               </li>
                   7332: 
                   7333:               <li>
1.14      xtraeme  7334:                 <p><code class=
                   7335:                 "filename">curses.buildlink3.mk</code> If the
                   7336:                 system comes with neither Curses nor NCurses, this
                   7337:                 will take care to install the <a xmlns=
                   7338:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    7339:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.20      ben      7340:                 class="pkgname">devel/ncurses</a> package.</p>
1.1       grant    7341:               </li>
                   7342: 
                   7343:               <li>
1.14      xtraeme  7344:                 <p><code class="filename">krb5.buildlink3.mk</code>
                   7345:                 uses the value of <code class=
                   7346:                 "varname">KRB5_ACCEPTED</code> to choose between
1.1       grant    7347:                 adding a dependency on Heimdal or MIT-krb5 for
                   7348:                 packages that require a Kerberos 5
                   7349:                 implementation.</p>
                   7350:               </li>
                   7351: 
                   7352:               <li>
1.14      xtraeme  7353:                 <p><code class=
                   7354:                 "filename">motif.buildlink3.mk</code> checks for a
                   7355:                 system-provided Motif installation or adds a
                   7356:                 dependency on <a xmlns=
1.1       grant    7357:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7358:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.20      ben      7359:                 class="pkgname">x11/lesstif</a> or <a xmlns=
                   7360:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7361:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
                   7362:                 class="pkgname">x11/openmotif</a>;</p>
1.1       grant    7363:               </li>
                   7364: 
                   7365:               <li>
1.14      xtraeme  7366:                 <p><code class=
                   7367:                 "filename">ossaudio.buildlink3.mk</code> defines
                   7368:                 several variables that may be used by packages that
                   7369:                 use the Open Sound System (OSS) API;</p>
1.1       grant    7370:               </li>
                   7371: 
                   7372:               <li>
1.14      xtraeme  7373:                 <p><code class=
                   7374:                 "filename">pgsql.buildlink3.mk</code> will accept
                   7375:                 either Postgres 7.3 or 7.4, whichever is found
                   7376:                 installed. See the file for more information.</p>
1.1       grant    7377:               </li>
                   7378: 
                   7379:               <li>
1.14      xtraeme  7380:                 <p><code class=
                   7381:                 "filename">pthread.buildlink3.mk</code> uses the
                   7382:                 value of <code class="varname">PTHREAD_OPTS</code>
                   7383:                 and checks for native pthreads or adds a dependency
                   7384:                 on <a xmlns=
1.1       grant    7385:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7386:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.20      ben      7387:                 class="pkgname">devel/pth</a> as needed;</p>
1.1       grant    7388:               </li>
                   7389: 
                   7390:               <li>
1.14      xtraeme  7391:                 <p><code class="filename">xaw.buildlink3.mk</code>
                   7392:                 uses the value of <code class=
                   7393:                 "varname">XAW_TYPE</code> to choose a particular
                   7394:                 Athena widgets library.</p>
1.1       grant    7395:               </li>
                   7396:             </ul>
                   7397:           </div>
                   7398: 
1.14      xtraeme  7399:           <p>The comments in those <code class=
                   7400:           "filename">buildlink3.mk</code> files provide a more
1.1       grant    7401:           complete description of how to use them properly.</p>
                   7402:         </div>
                   7403: 
                   7404:         <div class="sect1" lang="en" xml:lang="en">
                   7405:           <div class="titlepage">
                   7406:             <div>
                   7407:               <div>
                   7408:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      7409:                 "creating-buildlink3.mk" id=
1.38      dillo    7410:                 "creating-buildlink3.mk"></a>11.2.&nbsp;Writing
1.14      xtraeme  7411:                 <code class="filename">buildlink3.mk</code>
                   7412:                 files</h2>
1.1       grant    7413:               </div>
                   7414:             </div>
                   7415:           </div>
                   7416: 
1.14      xtraeme  7417:           <p>A package's <code class=
                   7418:           "filename">buildlink3.mk</code> file is included by
                   7419:           Makefiles to indicate the need to compile and link
                   7420:           against header files and libraries provided by the
                   7421:           package. A <code class="filename">buildlink3.mk</code>
                   7422:           file should always provide enough information to add the
                   7423:           correct type of dependency relationship and include any
                   7424:           other <code class="filename">buildlink3.mk</code> files
                   7425:           that it needs to find headers and libraries that it needs
                   7426:           in turn.</p>
1.1       grant    7427: 
1.14      xtraeme  7428:           <p>To generate an initial <code class=
                   7429:           "filename">buildlink3.mk</code> file for further editing,
1.1       grant    7430:           Rene Hexel's <a xmlns=
                   7431:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   7432:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.20      ben      7433:           class="pkgname">pkgtools/createbuildlink</a> package is
                   7434:           highly recommended. For most packages, the following
                   7435:           command will generate a good starting point for
                   7436:           <code class="filename">buildlink3.mk</code> files:</p>
1.1       grant    7437:           <pre class="screen">
1.14      xtraeme  7438: <code class="prompt">%</code> <strong class=
                   7439: "userinput"><code>cd pkgsrc/<em class=
                   7440: "replaceable"><code>category</code></em>/<em class=
                   7441: "replaceable"><code>pkgdir</code></em>
                   7442: <code class=
                   7443: "prompt">%</code> createbuildlink -3 &gt;buildlink3.mk</code></strong>
1.1       grant    7444: </pre>
                   7445: 
                   7446:           <div class="sect2" lang="en" xml:lang="en">
                   7447:             <div class="titlepage">
                   7448:               <div>
                   7449:                 <div>
1.30      wiz      7450:                   <h3 class="title"><a name="anatomy-of-bl3" id=
1.38      dillo    7451:                   "anatomy-of-bl3"></a>11.2.1. Anatomy of a
1.25      rillig   7452:                   buildlink3.mk file</h3>
1.1       grant    7453:                 </div>
                   7454:               </div>
                   7455:             </div>
                   7456: 
1.14      xtraeme  7457:             <p>The following real-life example <code class=
                   7458:             "filename">buildlink3.mk</code> is taken from
                   7459:             <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1       grant    7460:             <pre class="programlisting">
1.17      sketch   7461: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1       grant    7462: 
                   7463: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH}+
                   7464: TIFF_BUILDLINK3_MK:=    ${TIFF_BUILDLINK3_MK}+
                   7465: 
                   7466: .if !empty(BUILDLINK_DEPTH:M+)
                   7467: BUILDLINK_DEPENDS+=     tiff
                   7468: .endif
                   7469: 
                   7470: BUILDLINK_PACKAGES:=    ${BUILDLINK_PACKAGES:Ntiff}
                   7471: BUILDLINK_PACKAGES+=    tiff
                   7472: 
                   7473: .if !empty(TIFF_BUILDLINK3_MK:M+)
                   7474: BUILDLINK_DEPENDS.tiff+=        tiff&gt;=3.6.1
                   7475: BUILDLINK_PKGSRCDIR.tiff?=      ../../graphics/tiff
                   7476: .endif  # TIFF_BUILDLINK3_MK
                   7477: 
                   7478: .include "../../devel/zlib/buildlink3.mk"
                   7479: .include "../../graphics/jpeg/buildlink3.mk"
                   7480: 
                   7481: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH:S/+$//} 
                   7482: </pre>
                   7483: 
1.14      xtraeme  7484:             <p>The header and footer manipulate <code class=
                   7485:             "varname">BUILDLINK_DEPTH</code>, which is common
                   7486:             across all <code class="filename">buildlink3.mk</code>
                   7487:             files and is used to track at what depth we are
                   7488:             including <code class="filename">buildlink3.mk</code>
                   7489:             files.</p>
1.1       grant    7490: 
                   7491:             <p>The first section controls if the dependency on
1.14      xtraeme  7492:             <em class="replaceable"><code>pkg</code></em> is added.
                   7493:             <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1       grant    7494:             global list of packages for which dependencies are
                   7495:             added by buildlink3.</p>
                   7496: 
                   7497:             <p>The second section advises pkgsrc that the
1.14      xtraeme  7498:             <code class="filename">buildlink3.mk</code> file for
                   7499:             <em class="replaceable"><code>pkg</code></em> has been
                   7500:             included at some point. <code class=
                   7501:             "varname">BUILDLINK_PACKAGES</code> is the global list
                   7502:             of packages for which <code class=
                   7503:             "filename">buildlink3.mk</code> files have been
                   7504:             included. It must <span class=
                   7505:             "emphasis"><em>always</em></span> be appended to within
                   7506:             a <code class="filename">buildlink3.mk</code> file.</p>
1.1       grant    7507: 
                   7508:             <p>The third section is protected from multiple
1.14      xtraeme  7509:             inclusion and controls how the dependency on <em class=
                   7510:             "replaceable"><code>pkg</code></em> is added. Several
1.1       grant    7511:             important variables are set in the section:</p>
                   7512: 
                   7513:             <div class="itemizedlist">
                   7514:               <ul type="disc">
                   7515:                 <li>
1.14      xtraeme  7516:                   <p><code class=
                   7517:                   "varname">BUILDLINK_DEPENDS.<em class=
                   7518:                   "replaceable"><code>pkg</code></em></code> is the
                   7519:                   actual dependency recorded in the installed
                   7520:                   package; this should always be set using
                   7521:                   <span><strong class="command">+=</strong></span>
                   7522:                   to ensure that we're appending to any
                   7523:                   pre-existing list of values. This variable should
                   7524:                   be set to the first version of the package that
                   7525:                   had the last change in the major number of a
                   7526:                   shared library or that had a major API
                   7527:                   change.</p>
1.1       grant    7528:                 </li>
                   7529: 
                   7530:                 <li>
1.14      xtraeme  7531:                   <p><code class=
                   7532:                   "varname">BUILDLINK_PKGSRCDIR.<em class=
                   7533:                   "replaceable"><code>pkg</code></em></code> is the
                   7534:                   location of the <em class=
                   7535:                   "replaceable"><code>pkg</code></em> pkgsrc
1.1       grant    7536:                   directory;</p>
                   7537:                 </li>
                   7538: 
                   7539:                 <li>
1.14      xtraeme  7540:                   <p><code class=
                   7541:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   7542:                   "replaceable"><code>pkg</code></em></code> (not
                   7543:                   shown above) controls whether we use <code class=
                   7544:                   "varname">BUILD_DEPENDS</code> or <code class=
                   7545:                   "varname">DEPENDS</code> to add the dependency on
                   7546:                   <em class="replaceable"><code>pkg</code></em>.
                   7547:                   The build dependency is selected by setting
                   7548:                   <code class=
                   7549:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   7550:                   "replaceable"><code>pkg</code></em></code> to
1.1       grant    7551:                   &#8220;<span class="quote">build</span>&#8221;.
                   7552:                   By default, the full dependency is used.</p>
                   7553:                 </li>
                   7554: 
                   7555:                 <li>
1.14      xtraeme  7556:                   <p><code class=
                   7557:                   "varname">BUILDLINK_INCDIRS.<em class=
                   7558:                   "replaceable"><code>pkg</code></em></code> and
                   7559:                   <code class=
                   7560:                   "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
                   7561:                   <code>pkg</code></em></code> (not shown above)
                   7562:                   are lists of subdirectories of <code class=
                   7563:                   "filename">${BUILDLINK_PREFIX.<em class=
                   7564:                   "replaceable"><code>pkg</code></em>}</code> to
                   7565:                   add to the header and library search paths. These
1.1       grant    7566:                   default to &#8220;<span class=
                   7567:                   "quote">include</span>&#8221; and
                   7568:                   &#8220;<span class="quote">lib</span>&#8221;
                   7569:                   respectively.</p>
                   7570:                 </li>
                   7571: 
                   7572:                 <li>
1.14      xtraeme  7573:                   <p><code class=
                   7574:                   "varname">BUILDLINK_CPPFLAGS.<em class=
                   7575:                   "replaceable"><code>pkg</code></em></code> (not
                   7576:                   shown above) is the list of preprocessor flags to
                   7577:                   add to <code class="varname">CPPFLAGS</code>,
                   7578:                   which are passed on to the configure and build
                   7579:                   phases. The &#8220;<span class=
                   7580:                   "quote">-I</span>&#8221; option should be avoided
                   7581:                   and instead be handled using <code class=
                   7582:                   "varname">BUILDLINK_INCDIRS.<em class=
                   7583:                   "replaceable"><code>pkg</code></em></code> as
                   7584:                   above.</p>
1.1       grant    7585:                 </li>
                   7586:               </ul>
                   7587:             </div>
                   7588: 
                   7589:             <p>The following variables are all optionally defined
                   7590:             within this second section (protected against multiple
                   7591:             inclusion) and control which package files are
1.14      xtraeme  7592:             symlinked into <code class=
                   7593:             "filename">${BUILDLINK_DIR}</code> and how their names
1.1       grant    7594:             are transformed during the symlinking:</p>
                   7595: 
                   7596:             <div class="itemizedlist">
                   7597:               <ul type="disc">
                   7598:                 <li>
1.14      xtraeme  7599:                   <p><code class=
                   7600:                   "varname">BUILDLINK_FILES.<em class=
                   7601:                   "replaceable"><code>pkg</code></em></code> (not
                   7602:                   shown above) is a shell glob pattern relative to
                   7603:                   <code class=
                   7604:                   "filename">${BUILDLINK_PREFIX.<em class=
                   7605:                   "replaceable"><code>pkg</code></em>}</code> to be
                   7606:                   symlinked into <code class=
                   7607:                   "filename">${BUILDLINK_DIR}</code>, e.g.
                   7608:                   <code class="filename">include/*.h</code>.</p>
1.1       grant    7609:                 </li>
                   7610: 
                   7611:                 <li>
1.14      xtraeme  7612:                   <p><code class=
                   7613:                   "varname">BUILDLINK_FILES_CMD.<em class=
                   7614:                   "replaceable"><code>pkg</code></em></code> (not
                   7615:                   shown above) is a shell pipeline that outputs to
                   7616:                   stdout a list of files relative to <code class=
                   7617:                   "filename">${BUILDLINK_PREFIX.<em class=
                   7618:                   "replaceable"><code>pkg</code></em>}</code>. The
1.1       grant    7619:                   resulting files are to be symlinked into
1.14      xtraeme  7620:                   <code class="filename">${BUILDLINK_DIR}</code>.
                   7621:                   By default, this takes the <code class=
                   7622:                   "filename">+CONTENTS</code> of a <em class=
                   7623:                   "replaceable"><code>pkg</code></em> and filters
                   7624:                   it through <code class=
                   7625:                   "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
                   7626:                   "replaceable"><code>pkg</code></em>}</code>.</p>
1.1       grant    7627:                 </li>
                   7628: 
                   7629:                 <li>
1.14      xtraeme  7630:                   <p><code class=
                   7631:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   7632:                   "replaceable"><code>pkg</code></em></code> (not
                   7633:                   shown above) is a filter command that filters
                   7634:                   <code class="filename">+CONTENTS</code> input
                   7635:                   into a list of files relative to <code class=
                   7636:                   "filename">${BUILDLINK_PREFIX.<em class=
                   7637:                   "replaceable"><code>pkg</code></em>}</code> on
                   7638:                   stdout. By default for overwrite packages,
                   7639:                   <code class=
                   7640:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   7641:                   "replaceable"><code>pkg</code></em></code>
                   7642:                   outputs the contents of the <code class=
                   7643:                   "filename">include</code> and <code class=
                   7644:                   "filename">lib</code> directories in the package
                   7645:                   <code class="filename">+CONTENTS</code>, and for
                   7646:                   pkgviews packages, it outputs any libtool
                   7647:                   archives in <code class="filename">lib</code>
1.1       grant    7648:                   directories.</p>
                   7649:                 </li>
                   7650: 
                   7651:                 <li>
1.14      xtraeme  7652:                   <p><code class=
                   7653:                   "varname">BUILDLINK_TRANSFORM.<em class=
                   7654:                   "replaceable"><code>pkg</code></em></code> (not
                   7655:                   shown above) is a list of sed arguments used to
1.1       grant    7656:                   transform the name of the source filename into a
1.14      xtraeme  7657:                   destination filename, e.g. <span><strong class=
1.1       grant    7658:                   "command">-e
1.14      xtraeme  7659:                   "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1       grant    7660:                 </li>
                   7661:               </ul>
                   7662:             </div>
                   7663: 
1.14      xtraeme  7664:             <p>The last section includes any <code class=
                   7665:             "filename">buildlink3.mk</code> needed for <em class=
                   7666:             "replaceable"><code>pkg</code></em>'s library
                   7667:             dependencies. Including these <code class=
                   7668:             "filename">buildlink3.mk</code> files means that the
                   7669:             headers and libraries for these dependencies are also
                   7670:             symlinked into <code class=
                   7671:             "filename">${BUILDLINK_DIR}</code> whenever the
                   7672:             <em class="replaceable"><code>pkg</code></em>
                   7673:             <code class="filename">buildlink3.mk</code> file is
                   7674:             included.</p>
1.1       grant    7675:           </div>
                   7676: 
                   7677:           <div class="sect2" lang="en" xml:lang="en">
                   7678:             <div class="titlepage">
                   7679:               <div>
                   7680:                 <div>
1.30      wiz      7681:                   <h3 class="title"><a name=
                   7682:                   "updating-buildlink-depends" id=
1.38      dillo    7683:                   "updating-buildlink-depends"></a>11.2.2. Updating
1.30      wiz      7684:                   <code class=
                   7685:                   "varname">BUILDLINK_DEPENDS.<em class="replaceable">
                   7686:                   <code>pkg</code></em></code> in <code class=
                   7687:                   "filename">buildlink3.mk</code> files</h3>
1.1       grant    7688:                 </div>
                   7689:               </div>
                   7690:             </div>
                   7691: 
                   7692:             <p>There are two situations that require increasing the
1.14      xtraeme  7693:             dependency listed in <code class=
                   7694:             "varname">BUILDLINK_DEPENDS.<em class=
                   7695:             "replaceable"><code>pkg</code></em></code> after a
                   7696:             package update:</p>
1.1       grant    7697: 
                   7698:             <div class="orderedlist">
                   7699:               <ol type="1">
                   7700:                 <li>
                   7701:                   <p>if the sonames (major number of the library
                   7702:                   version) of any installed shared libraries
                   7703:                   change;</p>
                   7704:                 </li>
                   7705: 
                   7706:                 <li>
                   7707:                   <p>if the API or interface to the header files
                   7708:                   change.</p>
                   7709:                 </li>
                   7710:               </ol>
                   7711:             </div>
                   7712: 
1.14      xtraeme  7713:             <p>In these cases, <code class=
                   7714:             "varname">BUILDLINK_DEPENDS.<em class=
                   7715:             "replaceable"><code>pkg</code></em></code> should be
                   7716:             adjusted to require at least the new package version.
                   7717:             In some cases, the packages that depend on this new
                   7718:             version may need their <code class=
                   7719:             "varname">PKGREVISION</code>s increased and, if they
                   7720:             have <code class="filename">buildlink3.mk</code> files,
                   7721:             their <code class=
                   7722:             "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>
                   7723:             pkg</code></em></code> adjusted, too. This is needed so
                   7724:             that binary packages made using it will require the
                   7725:             correct package dependency and not settle for an older
                   7726:             one which will not contain the necessary shared
                   7727:             libraries.</p>
1.1       grant    7728: 
                   7729:             <p>Please take careful consideration before adjusting
1.14      xtraeme  7730:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   7731:             "replaceable"><code>pkg</code></em></code> as we don't
                   7732:             want to cause unneeded package deletions and rebuilds.
                   7733:             In many cases, new versions of packages work just fine
                   7734:             with older dependencies. See <a href="#dependencies"
1.38      dillo    7735:             title="15.1.4.&nbsp;Handling dependencies">Section
                   7736:             15.1.4, &#8220;Handling dependencies&#8221;</a> for
1.36      wiz      7737:             more information about dependencies on other packages,
1.25      rillig   7738:             including the <code class=
                   7739:             "varname">BUILDLINK_RECOMMENDED</code> and <code class=
                   7740:             "varname">RECOMMENDED</code> definitions.</p>
1.1       grant    7741:           </div>
                   7742:         </div>
                   7743: 
                   7744:         <div class="sect1" lang="en" xml:lang="en">
                   7745:           <div class="titlepage">
                   7746:             <div>
                   7747:               <div>
                   7748:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      7749:                 "writing-builtin.mk" id=
1.38      dillo    7750:                 "writing-builtin.mk"></a>11.3.&nbsp;Writing
1.14      xtraeme  7751:                 <code class="filename">builtin.mk</code> files</h2>
1.1       grant    7752:               </div>
                   7753:             </div>
                   7754:           </div>
                   7755: 
                   7756:           <p>Some packages in pkgsrc install headers and libraries
                   7757:           that coincide with headers and libraries present in the
1.14      xtraeme  7758:           base system. Aside from a <code class=
                   7759:           "filename">buildlink3.mk</code> file, these packages
                   7760:           should also include a <code class=
                   7761:           "filename">builtin.mk</code> file that includes the
                   7762:           necessary checks to decide whether using the built-in
                   7763:           software or the pkgsrc software is appropriate.</p>
1.1       grant    7764: 
                   7765:           <p>The only requirements of a builtin.mk file for
1.14      xtraeme  7766:           <em class="replaceable"><code>pkg</code></em> are:</p>
1.1       grant    7767: 
                   7768:           <div class="orderedlist">
                   7769:             <ol type="1">
                   7770:               <li>
1.14      xtraeme  7771:                 <p>It should set <code class=
                   7772:                 "varname">USE_BUILTIN.<em class=
                   7773:                 "replaceable"><code>pkg</code></em></code> to
                   7774:                 either &#8220;<span class="quote">yes</span>&#8221;
                   7775:                 or &#8220;<span class="quote">no</span>&#8221;
                   7776:                 after it is included.</p>
1.1       grant    7777:               </li>
                   7778: 
                   7779:               <li>
                   7780:                 <p>It should <span class=
                   7781:                 "emphasis"><em>not</em></span> override any
1.14      xtraeme  7782:                 <code class="varname">USE_BUILTIN.<em class=
                   7783:                 "replaceable"><code>pkg</code></em></code> which is
                   7784:                 already set before the <code class=
                   7785:                 "filename">builtin.mk</code> file is included.</p>
1.1       grant    7786:               </li>
                   7787: 
                   7788:               <li>
                   7789:                 <p>It should be written to allow multiple
                   7790:                 inclusion. This is <span class=
                   7791:                 "emphasis"><em>very</em></span> important and takes
1.14      xtraeme  7792:                 careful attention to <code class=
                   7793:                 "filename">Makefile</code> coding.</p>
1.1       grant    7794:               </li>
                   7795:             </ol>
                   7796:           </div>
                   7797: 
                   7798:           <div class="sect2" lang="en" xml:lang="en">
                   7799:             <div class="titlepage">
                   7800:               <div>
                   7801:                 <div>
1.30      wiz      7802:                   <h3 class="title"><a name="anatomy-of-builtin.mk"
                   7803:                   id=
1.38      dillo    7804:                   "anatomy-of-builtin.mk"></a>11.3.1.&nbsp;Anatomy
1.30      wiz      7805:                   of a <code class="filename">builtin.mk</code>
1.14      xtraeme  7806:                   file</h3>
1.1       grant    7807:                 </div>
                   7808:               </div>
                   7809:             </div>
                   7810: 
                   7811:             <p>The following is the recommended template for
                   7812:             builtin.mk files:</p>
                   7813:             <pre class="programlisting">
                   7814: .if !defined(IS_BUILTIN.foo)
                   7815: #
                   7816: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
                   7817: # genuinely exists in the system or not.
                   7818: #
                   7819: IS_BUILTIN.foo?=        no
                   7820: 
                   7821: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
                   7822: # version can be determined.
                   7823: #
                   7824: .  if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
                   7825: BUILTIN_PKG.foo?=       foo-1.0
                   7826: .  endif
                   7827: .endif  # IS_BUILTIN.foo
                   7828: 
                   7829: .if !defined(USE_BUILTIN.foo)
                   7830: USE_BUILTIN.foo?=       ${IS_BUILTIN.foo}
                   7831: .  if defined(BUILTIN_PKG.foo)
                   7832: .    for _depend_ in ${BUILDLINK_DEPENDS.foo}
                   7833: .      if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
                   7834: USE_BUILTIN.foo!=                                                       \
                   7835:       if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then     \
                   7836:               ${ECHO} "yes";                                            \
                   7837:       else                                                              \
                   7838:               ${ECHO} "no";                                             \
                   7839:       fi
                   7840: .      endif
                   7841: .    endfor
                   7842: .  endif
                   7843: .endif  # USE_BUILTIN.foo
                   7844: 
                   7845: CHECK_BUILTIN.foo?=     no
                   7846: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
                   7847: #
                   7848: # Here we place code that depends on whether USE_BUILTIN.foo is set to
                   7849: # "yes" or "no".
                   7850: #
                   7851: .endif  # CHECK_BUILTIN.foo
                   7852:       
                   7853: </pre>
                   7854: 
1.14      xtraeme  7855:             <p>The first section sets <code class=
                   7856:             "varname">IS_BUILTIN.<em class=
                   7857:             "replaceable"><code>pkg</code></em></code> depending on
                   7858:             if <em class="replaceable"><code>pkg</code></em> really
                   7859:             exists in the base system. This should not be a base
                   7860:             system software with similar functionality to
                   7861:             <em class="replaceable"><code>pkg</code></em>; it
                   7862:             should only be &#8220;<span class=
                   7863:             "quote">yes</span>&#8221; if the actual package is
                   7864:             included as part of the base system. This variable is
                   7865:             only used internally within the <code class=
                   7866:             "filename">builtin.mk</code> file.</p>
                   7867: 
                   7868:             <p>The second section sets <code class=
                   7869:             "varname">BUILTIN_PKG.<em class=
                   7870:             "replaceable"><code>pkg</code></em></code> to the
                   7871:             version of <em class=
                   7872:             "replaceable"><code>pkg</code></em> in the base system
                   7873:             if it exists (if <code class=
                   7874:             "varname">IS_BUILTIN.<em class=
                   7875:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    7876:             &#8220;<span class="quote">yes</span>&#8221;). This
1.14      xtraeme  7877:             variable is only used internally within the
                   7878:             <code class="filename">builtin.mk</code> file.</p>
1.1       grant    7879: 
1.14      xtraeme  7880:             <p>The third section sets <code class=
                   7881:             "varname">USE_BUILTIN.<em class=
                   7882:             "replaceable"><code>pkg</code></em></code> and is
                   7883:             <span class="emphasis"><em>required</em></span> in all
                   7884:             <code class="filename">builtin.mk</code> files. The
                   7885:             code in this section must make the determination
                   7886:             whether the built-in software is adequate to satisfy
                   7887:             the dependencies listed in <code class=
                   7888:             "varname">BUILDLINK_DEPENDS.<em class=
                   7889:             "replaceable"><code>pkg</code></em></code>. This is
                   7890:             typically done by comparing <code class=
                   7891:             "varname">BUILTIN_PKG.<em class=
                   7892:             "replaceable"><code>pkg</code></em></code> against each
                   7893:             of the dependencies in <code class=
                   7894:             "varname">BUILDLINK_DEPENDS.<em class=
                   7895:             "replaceable"><code>pkg</code></em></code>.
                   7896:             <code class="varname">USE_BUILTIN.<em class=
                   7897:             "replaceable"><code>pkg</code></em></code> <span class=
1.1       grant    7898:             "emphasis"><em>must</em></span> be set to the correct
1.14      xtraeme  7899:             value by the end of the <code class=
                   7900:             "filename">builtin.mk</code> file. Note that
                   7901:             <code class="varname">USE_BUILTIN.<em class=
                   7902:             "replaceable"><code>pkg</code></em></code> may be
1.1       grant    7903:             &#8220;<span class="quote">yes</span>&#8221; even if
1.14      xtraeme  7904:             <code class="varname">IS_BUILTIN.<em class=
                   7905:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    7906:             &#8220;<span class="quote">no</span>&#8221; because we
                   7907:             may make the determination that the built-in version of
                   7908:             the software is similar enough to be used as a
                   7909:             replacement.</p>
                   7910: 
1.14      xtraeme  7911:             <p>The last section is guarded by <code class=
                   7912:             "varname">CHECK_BUILTIN.<em class=
                   7913:             "replaceable"><code>pkg</code></em></code>, and
                   7914:             includes code that uses the value of <code class=
                   7915:             "varname">USE_BUILTIN.<em class=
                   7916:             "replaceable"><code>pkg</code></em></code> set in the
                   7917:             previous section. This typically includes, e.g., adding
1.1       grant    7918:             additional dependency restrictions and listing
1.14      xtraeme  7919:             additional files to symlink into <code class=
                   7920:             "filename">${BUILDLINK_DIR}</code> (via <code class=
                   7921:             "varname">BUILDLINK_FILES.<em class=
                   7922:             "replaceable"><code>pkg</code></em></code>).</p>
1.1       grant    7923:           </div>
                   7924: 
                   7925:           <div class="sect2" lang="en" xml:lang="en">
                   7926:             <div class="titlepage">
                   7927:               <div>
                   7928:                 <div>
1.30      wiz      7929:                   <h3 class="title"><a name=
                   7930:                   "native-or-pkgsrc-preference" id=
1.38      dillo    7931:                   "native-or-pkgsrc-preference"></a>11.3.2.&nbsp;Global
1.30      wiz      7932:                   preferences for native or pkgsrc software</h3>
1.1       grant    7933:                 </div>
                   7934:               </div>
                   7935:             </div>
                   7936: 
                   7937:             <p>When building packages, it's possible to choose
                   7938:             whether to set a global preference for using either the
                   7939:             built-in (native) version or the pkgsrc version of
                   7940:             software to satisfy a dependency. This is controlled by
1.14      xtraeme  7941:             setting <code class="varname">PREFER_PKGSRC</code> and
                   7942:             <code class="varname">PREFER_NATIVE</code>. These
                   7943:             variables take values of either &#8220;<span class=
1.1       grant    7944:             "quote">yes</span>&#8221;, &#8220;<span class=
                   7945:             "quote">no</span>&#8221;, or a list of packages.
1.14      xtraeme  7946:             <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
                   7947:             to use the pkgsrc versions of software, while
                   7948:             <code class="varname">PREFER_NATIVE</code> tells pkgsrc
                   7949:             to use the built-in versions. Preferences are
                   7950:             determined by the most specific instance of the package
                   7951:             in either <code class="varname">PREFER_PKGSRC</code> or
                   7952:             <code class="varname">PREFER_NATIVE</code>. If a
                   7953:             package is specified in neither or in both variables,
                   7954:             then <code class="varname">PREFER_PKGSRC</code> has
                   7955:             precedence over <code class=
                   7956:             "varname">PREFER_NATIVE</code>. For example, to require
                   7957:             using pkgsrc versions of software for all but the most
                   7958:             basic bits on a NetBSD system, you can set:</p>
1.1       grant    7959:             <pre class="programlisting">
                   7960:         PREFER_PKGSRC=  yes
                   7961:         PREFER_NATIVE=  getopt skey tcp_wrappers
                   7962:       
                   7963: </pre>
                   7964: 
                   7965:             <p>A package <span class=
1.14      xtraeme  7966:             "emphasis"><em>must</em></span> have a <code class=
                   7967:             "filename">builtin.mk</code> file to be listed in
                   7968:             <code class="varname">PREFER_NATIVE</code>, otherwise
                   7969:             it is simply ignored in that list.</p>
1.1       grant    7970:           </div>
                   7971:         </div>
                   7972:       </div>
                   7973: 
                   7974:       <div class="chapter" lang="en" xml:lang="en">
                   7975:         <div class="titlepage">
                   7976:           <div>
                   7977:             <div>
1.35      jmmv     7978:               <h2 class="title"><a name="pkginstall" id=
1.38      dillo    7979:               "pkginstall"></a>Chapter&nbsp;12.&nbsp;The pkginstall
1.35      jmmv     7980:               framework</h2>
1.1       grant    7981:             </div>
                   7982:           </div>
                   7983:         </div>
                   7984: 
                   7985:         <div class="toc">
                   7986:           <p><b>Table of Contents</b></p>
                   7987: 
                   7988:           <dl>
1.30      wiz      7989:             <dt><span class="sect1"><a href=
1.38      dillo    7990:             "#files-and-dirs-outside-prefix">12.1. Files and
1.35      jmmv     7991:             directories outside the installation
                   7992:             prefix</a></span></dt>
                   7993: 
                   7994:             <dd>
                   7995:               <dl>
                   7996:                 <dt><span class="sect2"><a href=
1.38      dillo    7997:                 "#dirs-outside-prefix">12.1.1. Directory
1.35      jmmv     7998:                 manipulation</a></span></dt>
                   7999: 
                   8000:                 <dt><span class="sect2"><a href=
1.38      dillo    8001:                 "#files-outside-prefix">12.1.2. File
1.35      jmmv     8002:                 manipulation</a></span></dt>
                   8003:               </dl>
                   8004:             </dd>
                   8005: 
1.38      dillo    8006:             <dt><span class="sect1"><a href="#conf-files">12.2.
1.35      jmmv     8007:             Configuration files</a></span></dt>
                   8008: 
                   8009:             <dd>
                   8010:               <dl>
                   8011:                 <dt><span class="sect2"><a href=
1.38      dillo    8012:                 "#conf-files-sysconfdir">12.2.1. How <code class=
1.35      jmmv     8013:                 "varname">PKG_SYSCONFDIR</code> is
                   8014:                 set</a></span></dt>
                   8015: 
                   8016:                 <dt><span class="sect2"><a href=
1.38      dillo    8017:                 "#conf-files-configure">12.2.2. Telling the
1.35      jmmv     8018:                 software were configuration files
                   8019:                 are</a></span></dt>
                   8020: 
                   8021:                 <dt><span class="sect2"><a href=
1.38      dillo    8022:                 "#conf-files-patching">12.2.3. Patching
1.35      jmmv     8023:                 installations</a></span></dt>
                   8024: 
                   8025:                 <dt><span class="sect2"><a href=
1.38      dillo    8026:                 "#conf-files-disable">12.2.4. Disabling handling of
1.35      jmmv     8027:                 configuration files</a></span></dt>
                   8028:               </dl>
                   8029:             </dd>
                   8030: 
1.38      dillo    8031:             <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35      jmmv     8032:             System startup scripts</a></span></dt>
                   8033: 
                   8034:             <dd>
                   8035:               <dl>
                   8036:                 <dt><span class="sect2"><a href=
1.38      dillo    8037:                 "#rcd-scripts-disable">12.3.1. Disabling handling
1.35      jmmv     8038:                 of system startup scripts</a></span></dt>
                   8039:               </dl>
                   8040:             </dd>
1.1       grant    8041: 
1.30      wiz      8042:             <dt><span class="sect1"><a href=
1.38      dillo    8043:             "#users-and-groups">12.4. System users and
1.35      jmmv     8044:             groups</a></span></dt>
                   8045: 
1.38      dillo    8046:             <dt><span class="sect1"><a href="#shells">12.5. System
1.35      jmmv     8047:             shells</a></span></dt>
                   8048: 
                   8049:             <dd>
                   8050:               <dl>
                   8051:                 <dt><span class="sect2"><a href=
1.38      dillo    8052:                 "#shells-disable">12.5.1. Disabling handling of
1.35      jmmv     8053:                 configuration files</a></span></dt>
                   8054:               </dl>
                   8055:             </dd>
1.1       grant    8056:           </dl>
                   8057:         </div>
                   8058: 
1.35      jmmv     8059:         <p>This chapter describes the framework known as
                   8060:         <code class="literal">pkginstall</code>, whose key features
                   8061:         are:</p>
                   8062: 
                   8063:         <div class="itemizedlist">
                   8064:           <ul type="disc">
                   8065:             <li>
                   8066:               <p>Generic installation and manipulation of
                   8067:               directories and files outside the pkgsrc-handled
                   8068:               tree, <code class="varname">LOCALBASE</code>.</p>
                   8069:             </li>
                   8070: 
                   8071:             <li>
                   8072:               <p>Automatic handling of configuration files during
                   8073:               installation, provided that packages are correctly
                   8074:               designed.</p>
                   8075:             </li>
                   8076: 
                   8077:             <li>
                   8078:               <p>Generation and installation of system startup
                   8079:               scripts.</p>
                   8080:             </li>
                   8081: 
                   8082:             <li>
                   8083:               <p>Registration of system users and groups.</p>
                   8084:             </li>
                   8085: 
                   8086:             <li>
                   8087:               <p>Registration of system shells.</p>
                   8088:             </li>
                   8089:           </ul>
                   8090:         </div>
                   8091: 
                   8092:         <p>The following sections inspect each of the above points
                   8093:         in detail. Note that, in order to use any of the described
                   8094:         functionalities, you must add the following to your
                   8095:         package's <code class="filename">Makefile</code>:</p>
                   8096:         <pre class="programlisting">
                   8097: USE_PKGINSTALL=YES
                   8098: </pre>
                   8099: 
                   8100:         <p>You may be thinking that many of the things described
                   8101:         here could be easily done with simple code in the package's
                   8102:         post-installation target (<code class=
                   8103:         "literal">post-install</code>). <span class=
                   8104:         "emphasis"><em>This is incorrect</em></span>, as the code
                   8105:         in them is only executed when building from source.
                   8106:         Machines using binary packages could not benefit from it at
                   8107:         all (as the code itself could be unavailable). Therefore,
                   8108:         the only way to achieve any of the items described above is
                   8109:         by means of the installation scripts, which are
                   8110:         automatically generated by pkginstall.</p>
1.1       grant    8111: 
                   8112:         <div class="sect1" lang="en" xml:lang="en">
                   8113:           <div class="titlepage">
                   8114:             <div>
                   8115:               <div>
                   8116:                 <h2 class="title" style="clear: both"><a name=
1.35      jmmv     8117:                 "files-and-dirs-outside-prefix" id=
1.38      dillo    8118:                 "files-and-dirs-outside-prefix"></a>12.1. Files and
1.35      jmmv     8119:                 directories outside the installation prefix</h2>
1.1       grant    8120:               </div>
                   8121:             </div>
                   8122:           </div>
                   8123: 
1.35      jmmv     8124:           <p>As you already know, the <code class=
                   8125:           "filename">PLIST</code> file holds a list of files and
                   8126:           directories that belong to a package. The names used in
                   8127:           it are relative to the installation prefix (<code class=
                   8128:           "filename">${PREFIX}</code>), which means that it cannot
                   8129:           register files outside this directory (absolute path
                   8130:           names are not allowed). Despite this restriction, some
                   8131:           packages need to install files outside this location;
                   8132:           e.g., under <code class="filename">${VARBASE}</code> or
                   8133:           <code class="filename">${PKG_SYSCONFDIR}</code>.</p>
                   8134: 
                   8135:           <p>The only way to achieve this is to create such files
                   8136:           during installation time by using the installation
                   8137:           scripts. These scripts can run arbitrary commands, so
                   8138:           they have the potential to create and manage files
                   8139:           anywhere in the filesystem. Here is where pkginstall
                   8140:           comes into play: it provides generic scripts to abstract
                   8141:           the manipulation of such files and directories based on
                   8142:           variables set in the package's <code class=
                   8143:           "filename">Makefile</code>. The rest of this section
                   8144:           describes which these variables are.</p>
1.1       grant    8145: 
1.35      jmmv     8146:           <div class="sect2" lang="en" xml:lang="en">
                   8147:             <div class="titlepage">
1.1       grant    8148:               <div>
1.35      jmmv     8149:                 <div>
                   8150:                   <h3 class="title"><a name="dirs-outside-prefix"
1.38      dillo    8151:                   id="dirs-outside-prefix"></a>12.1.1. Directory
1.35      jmmv     8152:                   manipulation</h3>
                   8153:                 </div>
1.1       grant    8154:               </div>
                   8155:             </div>
                   8156: 
1.35      jmmv     8157:             <p>The following variables can be set to request the
                   8158:             creation of directories anywhere in the filesystem:</p>
1.27      rillig   8159: 
1.35      jmmv     8160:             <div class="itemizedlist">
                   8161:               <ul type="disc">
                   8162:                 <li>
                   8163:                   <p><code class="varname">MAKE_DIRS</code> and
                   8164:                   <code class="varname">OWN_DIRS</code> contain a
                   8165:                   list of directories that should be created and
                   8166:                   should attempt to be destroyed by the
                   8167:                   installation scripts. The difference between the
                   8168:                   two is that the latter prompts the administrator
                   8169:                   to remove any directories that may be left after
                   8170:                   deinstallation (because they were not empty),
                   8171:                   while the former does not.</p>
                   8172:                 </li>
1.1       grant    8173: 
1.35      jmmv     8174:                 <li>
                   8175:                   <p><code class="varname">MAKE_DIRS_PERMS</code>
                   8176:                   and <code class="varname">OWN_DIRS_PERMS</code>
                   8177:                   contain a list of tuples describing which
                   8178:                   directories should be created and should attempt
                   8179:                   to be destroyed by the installation scripts. Each
                   8180:                   tuple holds the following values, separated by
                   8181:                   spaces: the directory name, its owner, its group
                   8182:                   and its numerical mode. For example:</p>
                   8183:                   <pre class="programlisting">
                   8184: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
                   8185: </pre>
1.1       grant    8186: 
1.35      jmmv     8187:                   <p>The difference between the two is exactly the
                   8188:                   same as their non-<code class=
                   8189:                   "varname">PERMS</code> counterparts.</p>
                   8190:                 </li>
                   8191:               </ul>
                   8192:             </div>
                   8193:           </div>
                   8194: 
                   8195:           <div class="sect2" lang="en" xml:lang="en">
                   8196:             <div class="titlepage">
                   8197:               <div>
                   8198:                 <div>
                   8199:                   <h3 class="title"><a name="files-outside-prefix"
1.38      dillo    8200:                   id="files-outside-prefix"></a>12.1.2. File
1.35      jmmv     8201:                   manipulation</h3>
                   8202:                 </div>
                   8203:               </div>
                   8204:             </div>
                   8205: 
                   8206:             <p>Creating non-empty files outside the installation
                   8207:             prefix is tricky because the <code class=
                   8208:             "filename">PLIST</code> forces all files to be inside
                   8209:             it. To overcome this problem, the only solution is to
                   8210:             extract the file in the known place (i.e., inside the
                   8211:             installation prefix) and copy it to the appropriate
                   8212:             location during installation (done by the installation
                   8213:             scripts generated by pkginstall). We will call the
                   8214:             former the <span class="emphasis"><em>master
                   8215:             file</em></span> in the following paragraphs, which
                   8216:             describe the variables that can be used to
                   8217:             automatically and consistently handle files outside the
                   8218:             installation prefix:</p>
                   8219: 
                   8220:             <div class="itemizedlist">
                   8221:               <ul type="disc">
                   8222:                 <li>
                   8223:                   <p><code class="varname">CONF_FILES</code> and
                   8224:                   <code class="varname">SUPPORT_FILES</code> are
                   8225:                   pairs of master and target files. During
                   8226:                   installation time, the master file is copied to
                   8227:                   the target one if and only if the latter does not
                   8228:                   exist. Upon deinstallation, the target file is
                   8229:                   removed provided that it was not modified by the
                   8230:                   installation.</p>
                   8231: 
                   8232:                   <p>The difference between the two is that the
                   8233:                   latter prompts the administrator to remove any
                   8234:                   files that may be left after deinstallation
                   8235:                   (because they were not empty), while the former
                   8236:                   does not.</p>
                   8237:                 </li>
                   8238: 
                   8239:                 <li>
                   8240:                   <p><code class="varname">CONF_FILES_PERMS</code>
                   8241:                   and <code class=
                   8242:                   "varname">SUPPORT_FILES_PERMS</code> contain
                   8243:                   tuples describing master files as well as their
                   8244:                   target locations. For each of them, it also
                   8245:                   specifies their owner, their group and their
                   8246:                   numeric permissions, in this order. For
                   8247:                   example:</p>
                   8248:                   <pre class="programlisting">
                   8249: SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
                   8250: </pre>
                   8251: 
                   8252:                   <p>The difference between the two is exactly the
                   8253:                   same as their non-<code class=
                   8254:                   "varname">PERMS</code> counterparts.</p>
                   8255:                 </li>
                   8256:               </ul>
                   8257:             </div>
                   8258:           </div>
                   8259:         </div>
                   8260: 
                   8261:         <div class="sect1" lang="en" xml:lang="en">
                   8262:           <div class="titlepage">
                   8263:             <div>
                   8264:               <div>
                   8265:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8266:                 "conf-files" id="conf-files"></a>12.2.
1.35      jmmv     8267:                 Configuration files</h2>
                   8268:               </div>
                   8269:             </div>
                   8270:           </div>
                   8271: 
                   8272:           <p>Configuration files are special in the sense that they
                   8273:           are installed in their own specific directory,
                   8274:           <code class="varname">PKG_SYSCONFDIR</code>, and need
                   8275:           special treatment during installation (most of which is
                   8276:           automated by pkginstall). The main concept you must bear
1.36      wiz      8277:           in mind is that files marked as configuration files are
1.35      jmmv     8278:           automatically copied to the right place (somewhere inside
                   8279:           <code class="varname">PKG_SYSCONFDIR</code>) during
                   8280:           installation <span class="emphasis"><em>if and only
                   8281:           if</em></span> they didn't exist before. Similarly, they
                   8282:           will not be removed if they have local modifications.
1.36      wiz      8283:           This ensures that administrators never lose any custom
1.35      jmmv     8284:           changes they may have made.</p>
                   8285: 
                   8286:           <div class="sect2" lang="en" xml:lang="en">
                   8287:             <div class="titlepage">
                   8288:               <div>
                   8289:                 <div>
                   8290:                   <h3 class="title"><a name="conf-files-sysconfdir"
1.38      dillo    8291:                   id="conf-files-sysconfdir"></a>12.2.1. How
1.35      jmmv     8292:                   <code class="varname">PKG_SYSCONFDIR</code> is
                   8293:                   set</h3>
                   8294:                 </div>
                   8295:               </div>
                   8296:             </div>
                   8297: 
                   8298:             <p>As said before, the <code class=
                   8299:             "varname">PKG_SYSCONFDIR</code> variable specifies
                   8300:             where configuration files shall be installed. Its
                   8301:             contents are set based upon the following
                   8302:             variables:</p>
                   8303: 
                   8304:             <div class="itemizedlist">
                   8305:               <ul type="disc">
                   8306:                 <li>
                   8307:                   <p><code class="varname">PKG_SYSCONFBASE</code>:
                   8308:                   The configuration's root directory. Defaults to
                   8309:                   <code class="filename">${PREFIX}/etc</code>
1.36      wiz      8310:                   although it may be overridden by the user to
                   8311:                   point to his preferred location (e.g.,
                   8312:                   <code class="filename">/etc</code>, <code class=
1.35      jmmv     8313:                   "filename">/etc/pkg</code>, etc.). Packages must
                   8314:                   not use it directly.</p>
                   8315:                 </li>
                   8316: 
                   8317:                 <li>
                   8318:                   <p><code class=
                   8319:                   "varname">PKG_SYSCONFSUBDIR</code>: A
                   8320:                   subdirectory of <code class=
                   8321:                   "varname">PKG_SYSCONFBASE</code> under which the
                   8322:                   configuration files for the package being built
                   8323:                   shall be installed. The definition of this
                   8324:                   variable only makes sense in the package's
                   8325:                   <code class="filename">Makefile</code> (i.e., it
                   8326:                   is not user customizable).</p>
                   8327: 
                   8328:                   <p>As an example, consider the Apache package,
                   8329:                   <a xmlns=
                   8330:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   8331:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
                   8332:                   class="pkgname">www/apache2</a>, which places its
                   8333:                   configuration files under the <code class=
                   8334:                   "filename">httpd/</code> subdirectory of
                   8335:                   <code class="varname">PKG_SYSCONFBASE</code>.
                   8336:                   This should be set in the package Makefile.</p>
                   8337:                 </li>
                   8338: 
                   8339:                 <li>
                   8340:                   <p><code class="varname">PKG_SYSCONFVAR</code>:
                   8341:                   Specifies the name of the variable that holds
                   8342:                   this package's configuration directory (if
                   8343:                   different from <code class=
                   8344:                   "varname">PKG_SYSCONFBASE</code>). It defaults to
                   8345:                   <code class="varname">PKGBASE</code>'s value, and
                   8346:                   is always prefixed with <code class=
                   8347:                   "literal">PKG_SYSCONFDIR</code>.</p>
                   8348:                 </li>
                   8349: 
                   8350:                 <li>
                   8351:                   <p><code class=
                   8352:                   "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
                   8353:                   Holds the directory where the configuration files
                   8354:                   for the package identified by <code class=
                   8355:                   "varname">PKG_SYSCONFVAR</code>'s shall be
                   8356:                   placed.</p>
                   8357:                 </li>
                   8358:               </ul>
                   8359:             </div>
                   8360: 
                   8361:             <p>Based on the above variables, pkginstall determines
                   8362:             the value of <code class=
                   8363:             "varname">PKG_SYSCONFDIR</code>, which is the
                   8364:             <span class="emphasis"><em>only</em></span> variable
                   8365:             that can be used within a package to refer to its
                   8366:             configuration directory. The algorithm used to set its
                   8367:             value is basically the following:</p>
                   8368: 
                   8369:             <div class="orderedlist">
                   8370:               <ol type="1">
                   8371:                 <li>
                   8372:                   <p>If <code class=
                   8373:                   "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   8374:                   is set, its value is used.</p>
                   8375:                 </li>
                   8376: 
                   8377:                 <li>
                   8378:                   <p>If the previous variable is not defined but
                   8379:                   <code class="varname">PKG_SYSCONFSUBDIR</code> is
                   8380:                   set in the package's <code class=
                   8381:                   "filename">Makefile</code>, the resulting value
                   8382:                   is <code class=
                   8383:                   "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
                   8384:                 </li>
                   8385: 
                   8386:                 <li>
                   8387:                   <p>Otherwise, it is set to <code class=
                   8388:                   "filename">${PKG_SYSCONFBASE}</code>.</p>
                   8389:                 </li>
                   8390:               </ol>
                   8391:             </div>
                   8392: 
                   8393:             <p>It is worth mentioning that <code class=
                   8394:             "filename">${PKG_SYSCONFDIR}</code> is automatically
                   8395:             added to <code class="filename">OWN_DIRS</code>. See
                   8396:             <a href="#dirs-outside-prefix" title=
1.38      dillo    8397:             "12.1.1.&nbsp;Directory manipulation">Section 12.1.1,
1.35      jmmv     8398:             &#8220;Directory manipulation&#8221;</a> what this
                   8399:             means.</p>
                   8400:           </div>
                   8401: 
                   8402:           <div class="sect2" lang="en" xml:lang="en">
                   8403:             <div class="titlepage">
                   8404:               <div>
                   8405:                 <div>
                   8406:                   <h3 class="title"><a name="conf-files-configure"
1.38      dillo    8407:                   id="conf-files-configure"></a>12.2.2. Telling the
1.35      jmmv     8408:                   software were configuration files are</h3>
                   8409:                 </div>
                   8410:               </div>
                   8411:             </div>
                   8412: 
                   8413:             <p>Given that pkgsrc (and users!) expect configuration
                   8414:             files to be in a known place, you need to teach each
1.36      wiz      8415:             package where it shall install its files. In some cases
1.35      jmmv     8416:             you will have to patch the package Makefiles to achieve
                   8417:             it. If you are lucky, though, it may be as easy as
                   8418:             passing an extra flag to the configuration script; this
                   8419:             is the case of GNU Autoconf generated files:</p>
                   8420:             <pre class="programlisting">
                   8421: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
                   8422: </pre>
                   8423: 
                   8424:             <p>Note that this specifies where the package has to
                   8425:             <span class="emphasis"><em>look for</em></span> its
                   8426:             configuration files, not where they will be originally
                   8427:             installed (although the difference is never explicit,
                   8428:             unfortunately).</p>
                   8429:           </div>
                   8430: 
                   8431:           <div class="sect2" lang="en" xml:lang="en">
                   8432:             <div class="titlepage">
                   8433:               <div>
                   8434:                 <div>
                   8435:                   <h3 class="title"><a name="conf-files-patching"
1.38      dillo    8436:                   id="conf-files-patching"></a>12.2.3. Patching
1.35      jmmv     8437:                   installations</h3>
                   8438:                 </div>
                   8439:               </div>
                   8440:             </div>
                   8441: 
                   8442:             <p>As said before, pkginstall automatically handles
                   8443:             configuration files. This means that <span class=
                   8444:             "strong"><strong>the packages themselves must not touch
                   8445:             the contents of <code class=
                   8446:             "filename">${PKG_SYSCONFDIR}</code>
1.36      wiz      8447:             directly</strong></span>. Bad news is that many
                   8448:             software installation scripts will, out of the box,
                   8449:             mess with the contents of that directory. So what is
                   8450:             the correct procedure to fix this issue?</p>
1.35      jmmv     8451: 
                   8452:             <p>You must teach the package (usually by manually
                   8453:             patching it) to install any configuration files under
                   8454:             the examples hierarchy, <code class=
                   8455:             "filename">share/examples/${PKGBASE}/</code>. This way,
                   8456:             the <code class="filename">PLIST</code> registers them
                   8457:             and the administrator always has the original copies
                   8458:             available.</p>
                   8459: 
                   8460:             <p>Once the required configuration files are in place
                   8461:             (i.e., under the examples hierarchy), the pkginstall
                   8462:             framework can use them as master copies during the
                   8463:             package installation to update what is in <code class=
                   8464:             "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
                   8465:             the variables <code class="varname">CONF_FILES</code>
                   8466:             and <code class="varname">CONF_FILES_PERMS</code> are
                   8467:             used. Check out <a href="#files-outside-prefix" title=
1.38      dillo    8468:             "12.1.2.&nbsp;File manipulation">Section 12.1.2,
1.35      jmmv     8469:             &#8220;File manipulation&#8221;</a> for information
                   8470:             about their syntax and their purpose. Here is an
                   8471:             example, taken from the <a xmlns=
                   8472:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8473:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
                   8474:             class="pkgname">mail/mutt</a> package:</p>
                   8475:             <pre class="programlisting">
                   8476: EGDIR=        ${PREFIX}/share/doc/mutt/samples
                   8477: CONF_FILES=   ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
                   8478: </pre>
                   8479: 
                   8480:             <p>Note that the <code class="varname">EGDIR</code>
                   8481:             variable is specific to that package and has no meaning
                   8482:             outside it.</p>
                   8483:           </div>
                   8484: 
                   8485:           <div class="sect2" lang="en" xml:lang="en">
                   8486:             <div class="titlepage">
                   8487:               <div>
                   8488:                 <div>
                   8489:                   <h3 class="title"><a name="conf-files-disable"
1.38      dillo    8490:                   id="conf-files-disable"></a>12.2.4. Disabling
1.35      jmmv     8491:                   handling of configuration files</h3>
                   8492:                 </div>
                   8493:               </div>
                   8494:             </div>
                   8495: 
                   8496:             <p>The automatic copying of config files can be toggled
                   8497:             by setting the environment variable <code class=
                   8498:             "varname">PKG_CONFIG</code> prior to package
                   8499:             installation.</p>
                   8500:           </div>
                   8501:         </div>
                   8502: 
                   8503:         <div class="sect1" lang="en" xml:lang="en">
                   8504:           <div class="titlepage">
                   8505:             <div>
                   8506:               <div>
                   8507:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8508:                 "rcd-scripts" id="rcd-scripts"></a>12.3. System
1.35      jmmv     8509:                 startup scripts</h2>
                   8510:               </div>
                   8511:             </div>
                   8512:           </div>
                   8513: 
                   8514:           <p>System startup scripts are special files because they
                   8515:           must be installed in a place known by the underlying OS,
                   8516:           usually outside the installation prefix. Therefore, the
                   8517:           same rules described in <a href=
                   8518:           "#files-and-dirs-outside-prefix" title=
1.38      dillo    8519:           "12.1.&nbsp;Files and directories outside the installation prefix">
                   8520:           Section 12.1, &#8220;Files and directories outside the
1.35      jmmv     8521:           installation prefix&#8221;</a> apply, and the same
                   8522:           solutions can be used. However, pkginstall provides a
1.36      wiz      8523:           special mechanism to handle these files.</p>
1.35      jmmv     8524: 
                   8525:           <p>In order to provide system startup scripts, the
                   8526:           package has to:</p>
                   8527: 
                   8528:           <div class="orderedlist">
                   8529:             <ol type="1">
                   8530:               <li>
                   8531:                 <p>Store the script inside <code class=
                   8532:                 "filename">${FILESDIR}</code>, with the
                   8533:                 <code class="literal">.sh</code> suffix appended.
                   8534:                 Considering the <a xmlns=
                   8535:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8536:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
                   8537:                 class="pkgname">print/cups</a> package as an
1.36      wiz      8538:                 example, it has a <code class=
1.35      jmmv     8539:                 "filename">cupsd.sh</code> in its files
                   8540:                 directory.</p>
                   8541:               </li>
                   8542: 
                   8543:               <li>
                   8544:                 <p>Tell pkginstall to handle it, appending the name
                   8545:                 of the script, without its extension, to the
                   8546:                 <code class="varname">RCD_SCRIPTS</code> variable.
                   8547:                 Continuing the previous example:</p>
                   8548:                 <pre class="programlisting">
                   8549: RCD_SCRIPTS+= cupsd
                   8550: </pre>
                   8551:               </li>
                   8552:             </ol>
                   8553:           </div>
                   8554: 
                   8555:           <p>Once this is done, pkginstall will do the following
                   8556:           steps for each script in an automated fashion:</p>
                   8557: 
                   8558:           <div class="orderedlist">
                   8559:             <ol type="1">
                   8560:               <li>
                   8561:                 <p>Process the file found in the files directory
                   8562:                 applying all the substitutions described in the
                   8563:                 <code class="filename">FILES_SUBST</code>
                   8564:                 variable.</p>
                   8565:               </li>
                   8566: 
                   8567:               <li>
                   8568:                 <p>Copy the script from the files directory to the
                   8569:                 examples hierarchy, <code class=
                   8570:                 "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36      wiz      8571:                 Note that this master file must be explicitly
1.35      jmmv     8572:                 registered in the <code class=
                   8573:                 "filename">PLIST</code>.</p>
                   8574:               </li>
                   8575: 
                   8576:               <li>
                   8577:                 <p>Add code to the installation scripts to copy the
                   8578:                 startup script from the examples hierarchy into the
                   8579:                 system-wide startup scripts directory.</p>
                   8580:               </li>
                   8581:             </ol>
                   8582:           </div>
                   8583: 
                   8584:           <div class="sect2" lang="en" xml:lang="en">
                   8585:             <div class="titlepage">
                   8586:               <div>
                   8587:                 <div>
                   8588:                   <h3 class="title"><a name="rcd-scripts-disable"
1.38      dillo    8589:                   id="rcd-scripts-disable"></a>12.3.1. Disabling
1.35      jmmv     8590:                   handling of system startup scripts</h3>
                   8591:                 </div>
                   8592:               </div>
                   8593:             </div>
                   8594: 
                   8595:             <p>The automatic copying of config files can be toggled
                   8596:             by setting the environment variable <code class=
                   8597:             "varname">PKG_RCD_SCRIPTS</code> prior to package
                   8598:             installation. Note that the scripts will be always
                   8599:             copied inside the examples hierarchy, <code class=
                   8600:             "filename">${PREFIX}/share/examples/rc.d/</code>, no
                   8601:             matter what the value of this variable is.</p>
                   8602:           </div>
                   8603:         </div>
                   8604: 
                   8605:         <div class="sect1" lang="en" xml:lang="en">
                   8606:           <div class="titlepage">
                   8607:             <div>
                   8608:               <div>
                   8609:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8610:                 "users-and-groups" id="users-and-groups"></a>12.4.
1.35      jmmv     8611:                 System users and groups</h2>
                   8612:               </div>
                   8613:             </div>
                   8614:           </div>
                   8615: 
                   8616:           <p>If a package needs to create special users and/or
                   8617:           groups during installation, it can do so by using the
                   8618:           pkginstall framework.</p>
                   8619: 
                   8620:           <p>Users can be created by adding entries to the
                   8621:           <code class="varname">PKG_USERS</code> variable. Each
                   8622:           entry has the following syntax, which mimics <code class=
                   8623:           "filename">/etc/passwd</code>:</p>
                   8624:           <pre class="programlisting">
                   8625: user:group[:[userid][:[descr][:[home][:shell]]]]
                   8626: </pre>
                   8627: 
                   8628:           <p>Only the user and group are required; everything else
                   8629:           is optional, but the colons must be in the right places
                   8630:           when specifying optional bits. By default, a new user
                   8631:           will have home directory <code class=
                   8632:           "filename">/nonexistent</code>, and login shell
                   8633:           <code class="filename">/sbin/nologin</code> unless they
                   8634:           are specified as part of the user element. Note that if
                   8635:           the description contains spaces, then spaces should be
                   8636:           double backslash-escaped, as in:</p>
                   8637:           <pre class="programlisting">
                   8638: foo:foogrp::The\\ Foomister
                   8639: </pre>
                   8640: 
                   8641:           <p>Similarly, groups can be created using the
                   8642:           <code class="varname">PKG_GROUPS</code> variable, whose
                   8643:           syntax is:</p>
                   8644:           <pre class="programlisting">
                   8645: group[:groupid]
                   8646: </pre>
                   8647: 
                   8648:           <p>As before, only the group name is required; the
                   8649:           numeric identifier is optional.</p>
                   8650:         </div>
                   8651: 
                   8652:         <div class="sect1" lang="en" xml:lang="en">
                   8653:           <div class="titlepage">
                   8654:             <div>
                   8655:               <div>
                   8656:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8657:                 "shells" id="shells"></a>12.5. System shells</h2>
1.35      jmmv     8658:               </div>
                   8659:             </div>
                   8660:           </div>
                   8661: 
                   8662:           <p>Packages that install system shells should register
                   8663:           them in the shell database, <code class=
                   8664:           "filename">/etc/shells</code>, to make things easier to
                   8665:           the administrator. This must be done from the
                   8666:           installation scripts to keep binary packages working on
                   8667:           any system. pkginstall provides an easy way to accomplish
                   8668:           this task.</p>
                   8669: 
                   8670:           <p>When a package provides a shell interpreter, it has to
                   8671:           set the <code class="varname">PKG_SHELL</code> variable
                   8672:           to its absolute file name. This will add some hooks to
                   8673:           the installation scripts to handle it. Consider the
                   8674:           following example, taken from <a xmlns=
                   8675:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   8676:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
                   8677:           class="pkgname">shells/zsh</a>:</p>
                   8678:           <pre class="programlisting">
                   8679: USE_PKGINSTALL= YES
                   8680: PKG_SHELL=      ${PREFIX}/bin/zsh
                   8681: </pre>
                   8682: 
                   8683:           <div class="sect2" lang="en" xml:lang="en">
                   8684:             <div class="titlepage">
                   8685:               <div>
                   8686:                 <div>
                   8687:                   <h3 class="title"><a name="shells-disable" id=
1.38      dillo    8688:                   "shells-disable"></a>12.5.1. Disabling handling
1.35      jmmv     8689:                   of configuration files</h3>
                   8690:                 </div>
                   8691:               </div>
                   8692:             </div>
                   8693: 
                   8694:             <p>The automatic registration of shell interpreters can
                   8695:             be disabled by the administrator by setting the
                   8696:             <code class="filename">PKG_REGISTER_SHELLS</code>
                   8697:             environment variable to <code class=
                   8698:             "literal">NO</code>.</p>
                   8699:           </div>
                   8700:         </div>
                   8701:       </div>
                   8702: 
                   8703:       <div class="chapter" lang="en" xml:lang="en">
                   8704:         <div class="titlepage">
                   8705:           <div>
                   8706:             <div>
                   8707:               <h2 class="title"><a name="options" id=
1.38      dillo    8708:               "options"></a>Chapter&nbsp;13.&nbsp;Options
1.35      jmmv     8709:               handling</h2>
                   8710:             </div>
                   8711:           </div>
                   8712:         </div>
                   8713: 
                   8714:         <div class="toc">
                   8715:           <p><b>Table of Contents</b></p>
                   8716: 
                   8717:           <dl>
                   8718:             <dt><span class="sect1"><a href=
1.38      dillo    8719:             "#global-default-options">13.1. Global default
1.35      jmmv     8720:             options</a></span></dt>
                   8721: 
                   8722:             <dt><span class="sect1"><a href=
1.38      dillo    8723:             "#converting-to-options">13.2. Converting packages to
1.35      jmmv     8724:             use <code class=
                   8725:             "filename">bsd.options.mk</code></a></span></dt>
                   8726:           </dl>
                   8727:         </div>
                   8728: 
                   8729:         <p>Many packages have the ability to be built to support
                   8730:         different sets of features. <code class=
                   8731:         "filename">bsd.options.mk</code> is a framework in pkgsrc
                   8732:         that provides generic handling of those options that
                   8733:         determine different ways in which the packages can be
                   8734:         built. It's possible for the user to specify exactly which
                   8735:         sets of options will be built into a package or to allow a
                   8736:         set of global default options apply.</p>
                   8737: 
                   8738:         <div class="sect1" lang="en" xml:lang="en">
                   8739:           <div class="titlepage">
                   8740:             <div>
                   8741:               <div>
                   8742:                 <h2 class="title" style="clear: both"><a name=
                   8743:                 "global-default-options" id=
1.38      dillo    8744:                 "global-default-options"></a>13.1.&nbsp;Global
1.35      jmmv     8745:                 default options</h2>
                   8746:               </div>
                   8747:             </div>
                   8748:           </div>
                   8749: 
                   8750:           <p>Global default options are listed in <code class=
                   8751:           "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
                   8752:           the options that should be built into every package if
                   8753:           that option is supported. This variable should be set in
                   8754:           <code class="filename">/etc/mk.conf</code>.</p>
                   8755:         </div>
                   8756: 
                   8757:         <div class="sect1" lang="en" xml:lang="en">
                   8758:           <div class="titlepage">
                   8759:             <div>
                   8760:               <div>
                   8761:                 <h2 class="title" style="clear: both"><a name=
                   8762:                 "converting-to-options" id=
1.38      dillo    8763:                 "converting-to-options"></a>13.2.&nbsp;Converting
1.35      jmmv     8764:                 packages to use <code class=
                   8765:                 "filename">bsd.options.mk</code></h2>
                   8766:               </div>
                   8767:             </div>
                   8768:           </div>
                   8769: 
                   8770:           <p>The following example shows how <code class=
                   8771:           "filename">bsd.options.mk</code> should be used by the
                   8772:           hypothetical ``wibble'' package, either in the package
                   8773:           <code class="filename">Makefile</code>, or in a file,
                   8774:           e.g. <code class="filename">options.mk</code>, that is
                   8775:           included by the main package <code class=
                   8776:           "filename">Makefile</code>.</p>
                   8777:           <pre class="programlisting">
1.37      dillo    8778: PKG_OPTIONS_VAR=                PKG_OPTIONS.wibble
                   8779: PKG_SUPPORTED_OPTIONS=          wibble-foo ldap
                   8780: PKG_OPTIONAL_GROUPS=            database
                   8781: PKG_GROUP.database=             mysql pgsql
                   8782: PKG_SUGGESTED_OPTIONS=          wibble-foo
                   8783: PKG_OPTIONS_LEGACY_VARS+=       WIBBLE_USE_OPENLDAP:ldap
                   8784: PKG_OPTIONS_LEGACY_OPTS+=       foo:wibble-foo
                   8785: 
                   8786: .include "../../mk/bsd.prefs.mk"
                   8787: 
                   8788: # this package was previously named wibble2
                   8789: .if defined(PKG_OPTIONS.wibble2)
                   8790: PKG_LEGACY_OPTIONS+=  ${PKG_OPTIONS.wibble2}
1.40      dillo    8791: PKG_OPTIONS_DEPRECATED_WARNINGS+="Deprecated variable PKG_OPTIONS.wibble2 used, use "${PKG_OPTIONS_VAR:Q}" instead."
1.37      dillo    8792: .endif
1.35      jmmv     8793: 
                   8794: .include "../../mk/bsd.options.mk"
                   8795: 
                   8796: # Package-specific option-handling
                   8797: 
                   8798: ###
1.37      dillo    8799: ### FOO support
                   8800: ###
                   8801: .if !empty(PKG_OPTIONS:Mwibble-foo)
                   8802: CONFIGURE_ARGS+=        --enable-foo
                   8803: .endif
                   8804: 
                   8805: ###
1.35      jmmv     8806: ### LDAP support
                   8807: ###
                   8808: .if !empty(PKG_OPTIONS:Mldap)
                   8809: .  include "../../databases/openldap/buildlink3.mk"
1.37      dillo    8810: CONFIGURE_ARGS+=        --enable-ldap=${BUILDLINK_PREFIX.openldap}
1.35      jmmv     8811: .endif
1.1       grant    8812: 
                   8813: ###
1.37      dillo    8814: ### database support
1.1       grant    8815: ###
1.37      dillo    8816: .if !empty(PKG_OPTIONS:Mmysql)
                   8817: .  include "../../mk/mysql.buildlink3.mk"
                   8818: .endif
                   8819: .if !empty(PKG_OPTIONS:Mpgsql)
                   8820: .  include "../../mk/pgsql.buildlink3.mk"
1.1       grant    8821: .endif
                   8822: </pre>
                   8823: 
1.28      rillig   8824:           <p>The first section contains the information about which
                   8825:           build options are supported by the package, and any
1.1       grant    8826:           default options settings if needed.</p>
                   8827: 
                   8828:           <div class="orderedlist">
                   8829:             <ol type="1">
                   8830:               <li>
1.14      xtraeme  8831:                 <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27      rillig   8832:                 the name of the <a href=
1.1       grant    8833:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   8834:                 <span class="citerefentry"><span class=
1.27      rillig   8835:                 "refentrytitle">make</span>(1)</span></a> variable
1.37      dillo    8836:                 that the user can set to override the default
                   8837:                 options. It should be set to &#8220;<span class=
                   8838:                 "quote">PKG_OPTIONS.<em class=
1.38      dillo    8839:                 "replaceable"><code>pkgbase</code></em></span>&#8221;.</p>
1.1       grant    8840:               </li>
                   8841: 
                   8842:               <li>
1.14      xtraeme  8843:                 <p><code class=
                   8844:                 "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37      dillo    8845:                 build options supported by the package.</p>
                   8846:               </li>
                   8847: 
                   8848:               <li>
                   8849:                 <p><code class=
                   8850:                 "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
                   8851:                 list of names of groups of mutually exclusive
                   8852:                 options. The options in each group are listed in
                   8853:                 <code class="varname">PKG_OPTIONS_GROUP.<em class=
                   8854:                 "replaceable"><code>groupname</code></em></code>.
                   8855:                 The most specific setting of any option from the
                   8856:                 group takes precedence over all other options in
                   8857:                 the group. Options from the groups will be
                   8858:                 automatically added to <code class=
                   8859:                 "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
                   8860:               </li>
                   8861: 
                   8862:               <li>
                   8863:                 <p><code class=
                   8864:                 "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
                   8865:                 like <code class=
                   8866:                 "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
                   8867:                 building the packages will fail if no option from
                   8868:                 the group is selected.</p>
1.1       grant    8869:               </li>
                   8870: 
                   8871:               <li>
1.27      rillig   8872:                 <p><code class=
1.44    ! gdt      8873:                 "varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a
        !          8874:                 list of names of sets of options. At least one
        !          8875:                 option from each set must be selected. The options
        !          8876:                 in each set are listed in <code class=
        !          8877:                 "varname">PKG_OPTIONS_SET.<em class=
        !          8878:                 "replaceable"><code>setname</code></em></code>.
        !          8879:                 Options from the sets will be automatically added
        !          8880:                 to <code class=
        !          8881:                 "varname">PKG_SUPPORTED_OPTIONS</code>. Building
        !          8882:                 the package will fail if no option from the set is
        !          8883:                 selected.</p>
        !          8884:               </li>
        !          8885: 
        !          8886:               <li>
        !          8887:                 <p><code class=
1.27      rillig   8888:                 "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
                   8889:                 build options which are enabled by default.</p>
                   8890:               </li>
                   8891: 
                   8892:               <li>
1.37      dillo    8893:                 <p><code class=
                   8894:                 "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
                   8895:                 of &#8220;<span class="quote"><em class=
                   8896:                 "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable">
                   8897:                 <code>option</code></em></span>&#8221; pairs that
                   8898:                 map legacy <code class=
                   8899:                 "filename">/etc/mk.conf</code> variables to their
                   8900:                 option counterparts. Pairs should be added with
                   8901:                 &#8220;<span class="quote">+=</span>&#8221; to keep
                   8902:                 the listing of global legacy variables. A warning
                   8903:                 will be issued if the user uses a legacy
                   8904:                 variable.</p>
                   8905:               </li>
1.1       grant    8906: 
1.37      dillo    8907:               <li>
                   8908:                 <p><code class=
                   8909:                 "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
                   8910:                 of &#8220;<span class="quote"><em class=
                   8911:                 "replaceable"><code>old-option</code></em>:<em class="replaceable">
                   8912:                 <code>new-option</code></em></span>&#8221; pairs
                   8913:                 that map options that have been renamed to their
                   8914:                 new counterparts. Pairs should be added with
                   8915:                 &#8220;<span class="quote">+=</span>&#8221; to keep
                   8916:                 the listing of global legacy options. A warning
                   8917:                 will be issued if the user uses a legacy
                   8918:                 option.</p>
                   8919:               </li>
1.1       grant    8920: 
1.37      dillo    8921:               <li>
                   8922:                 <p><code class="varname">PKG_LEGACY_OPTIONS</code>
                   8923:                 is a list of options implied by deprecated
                   8924:                 variables used. This can be used for cases that
                   8925:                 neither <code class=
                   8926:                 "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
                   8927:                 <code class=
                   8928:                 "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
                   8929:                 handle, e. g. when <code class=
                   8930:                 "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1       grant    8931:               </li>
                   8932: 
                   8933:               <li>
1.37      dillo    8934:                 <p><code class=
                   8935:                 "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
                   8936:                 a list of warnings about deprecated variables or
                   8937:                 options used, and what to use instead.</p>
1.1       grant    8938:               </li>
1.28      rillig   8939:             </ol>
1.1       grant    8940:           </div>
                   8941: 
1.37      dillo    8942:           <p>A package should never modify <code class=
                   8943:           "varname">PKG_DEFAULT_OPTIONS</code> or the variable
                   8944:           named in <code class="varname">PKG_OPTIONS_VAR</code>.
                   8945:           These are strictly user-settable. To suggest a default
                   8946:           set of options, use <code class=
                   8947:           "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
                   8948: 
1.42      dillo    8949:           <p><code class="varname">PKG_OPTIONS_VAR</code> must be
                   8950:           defined before including <code class=
                   8951:           "filename">bsd.options.mk</code>. If none of <code class=
1.37      dillo    8952:           "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
                   8953:           "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
                   8954:           <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
1.42      dillo    8955:           are defined (as can happen with platform specific options
                   8956:           if none of them is supported on the current platform),
                   8957:           <code class="varname">PKG_OPTIONS</code> is set to the
                   8958:           empty list and the package is otherwise treated as not
                   8959:           using the options framework.</p>
1.37      dillo    8960: 
                   8961:           <p>After the inclusion of <code class=
                   8962:           "filename">bsd.options.mk</code>, the variable
1.28      rillig   8963:           <code class="varname">PKG_OPTIONS</code> contains the
1.37      dillo    8964:           list of selected build options, properly filtered to
1.28      rillig   8965:           remove unsupported and duplicate options.</p>
                   8966: 
1.1       grant    8967:           <p>The remaining sections contain the logic that is
1.37      dillo    8968:           specific to each option. The correct way to check for an
                   8969:           option is to check whether it is listed in <code class=
                   8970:           "varname">PKG_OPTIONS</code>:</p>
                   8971:           <pre class="programlisting">
                   8972: .if !empty(PKG_OPTIONS:M<em class=
                   8973: "replaceable"><code>option</code></em>)
                   8974: </pre>
                   8975: 
                   8976:           <p>If another package already has an option with the same
                   8977:           meaning, use the same name. For options applicable to
                   8978:           multiple packages (like enabling support for a library),
                   8979:           use short option names (like the name of the library).
                   8980:           For options specific to this package, prefix the name
                   8981:           with <code class="varname"><em class=
                   8982:           "replaceable"><code>pkgname</code></em>-</code>. Document
                   8983:           the option and its meaning in <code class=
                   8984:           "filename">mk/defaults/options.description</code>.</p>
1.1       grant    8985:         </div>
                   8986:       </div>
                   8987: 
                   8988:       <div class="chapter" lang="en" xml:lang="en">
                   8989:         <div class="titlepage">
                   8990:           <div>
                   8991:             <div>
                   8992:               <h2 class="title"><a name="build" id=
1.38      dillo    8993:               "build"></a>Chapter&nbsp;14.&nbsp;The build
1.1       grant    8994:               process</h2>
                   8995:             </div>
                   8996:           </div>
                   8997:         </div>
                   8998: 
                   8999:         <div class="toc">
                   9000:           <p><b>Table of Contents</b></p>
                   9001: 
                   9002:           <dl>
1.38      dillo    9003:             <dt><span class="sect1"><a href="#build.prefix">14.1.
1.1       grant    9004:             Program location</a></span></dt>
                   9005: 
1.38      dillo    9006:             <dt><span class="sect1"><a href="#main-targets">14.2.
1.30      wiz      9007:             Main targets</a></span></dt>
1.1       grant    9008: 
                   9009:             <dt><span class="sect1"><a href=
1.38      dillo    9010:             "#build.helpful-targets">14.3. Other helpful
1.1       grant    9011:             targets</a></span></dt>
                   9012:           </dl>
                   9013:         </div>
                   9014: 
                   9015:         <p>The basic steps for building a program are always the
                   9016:         same. First the program's source (<span class=
                   9017:         "emphasis"><em>distfile</em></span>) must be brought to the
                   9018:         local system and then extracted. After any patches to
                   9019:         compile properly on NetBSD are applied, the software can be
                   9020:         configured, then built (usually by compiling), and finally
                   9021:         the generated binaries, etc. can be put into place on the
                   9022:         system. These are exactly the steps performed by the NetBSD
                   9023:         package system, which is implemented as a series of targets
1.14      xtraeme  9024:         in a central Makefile, <code class=
                   9025:         "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1       grant    9026: 
                   9027:         <div class="sect1" lang="en" xml:lang="en">
                   9028:           <div class="titlepage">
                   9029:             <div>
                   9030:               <div>
                   9031:                 <h2 class="title" style="clear: both"><a name=
                   9032:                 "build.prefix" id=
1.38      dillo    9033:                 "build.prefix"></a>14.1.&nbsp;Program location</h2>
1.1       grant    9034:               </div>
                   9035:             </div>
                   9036:           </div>
                   9037: 
                   9038:           <p>Before outlining the process performed by the NetBSD
                   9039:           package system in the next section, here's a brief
                   9040:           discussion on where programs are installed, and which
                   9041:           variables influence this.</p>
                   9042: 
1.14      xtraeme  9043:           <p>The automatic variable <code class=
                   9044:           "varname">PREFIX</code> indicates where all files of the
                   9045:           final program shall be installed. It is usually set to
                   9046:           <code class="varname">LOCALBASE</code> (<code class=
                   9047:           "filename">/usr/pkg</code>), or <code class=
                   9048:           "varname">CROSSBASE</code> for pkgs in the
1.1       grant    9049:           &#8220;<span class="quote">cross</span>&#8221; category.
1.14      xtraeme  9050:           The value of <code class="varname">PREFIX</code> needs to
                   9051:           be put into the various places in the program's source
                   9052:           where paths to these files are encoded. See <a href=
1.1       grant    9053:           "#components.patches" title=
1.38      dillo    9054:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
1.1       grant    9055:           &#8220;patches/*&#8221;</a> and <a href="#fixes.libtool"
                   9056:           title=
1.38      dillo    9057:           "15.3.1.&nbsp;Shared libraries - libtool">Section&nbsp;15.3.1,
1.1       grant    9058:           &#8220;Shared libraries - libtool&#8221;</a> for more
                   9059:           details.</p>
                   9060: 
                   9061:           <p>When choosing which of these variables to use, follow
                   9062:           the following rules:</p>
                   9063: 
                   9064:           <div class="itemizedlist">
                   9065:             <ul type="disc">
                   9066:               <li>
1.14      xtraeme  9067:                 <p><code class="varname">PREFIX</code> always
                   9068:                 points to the location where the current pkg will
                   9069:                 be installed. When referring to a pkg's own
1.1       grant    9070:                 installation path, use &#8220;<span class=
                   9071:                 "quote">${PREFIX}</span>&#8221;.</p>
                   9072:               </li>
                   9073: 
                   9074:               <li>
1.14      xtraeme  9075:                 <p><code class="varname">LOCALBASE</code> is where
                   9076:                 all non-X11 pkgs are installed. If you need to
1.1       grant    9077:                 construct a -I or -L argument to the compiler to
                   9078:                 find includes and libraries installed by another
                   9079:                 non-X11 pkg, use &#8220;<span class=
                   9080:                 "quote">${LOCALBASE}</span>&#8221;.</p>
                   9081:               </li>
                   9082: 
                   9083:               <li>
1.14      xtraeme  9084:                 <p><code class="varname">X11BASE</code> is where
                   9085:                 the actual X11 distribution (from xsrc, etc.) is
1.1       grant    9086:                 installed. When looking for <span class=
                   9087:                 "emphasis"><em>standard</em></span> X11 includes
                   9088:                 (not those installed by a pkg), use
                   9089:                 &#8220;<span class=
                   9090:                 "quote">${X11BASE}</span>&#8221;.</p>
                   9091:               </li>
                   9092: 
                   9093:               <li>
                   9094:                 <p>X11 based are special in that they may be
1.14      xtraeme  9095:                 installed in either <code class=
                   9096:                 "varname">X11BASE</code> or <code class=
                   9097:                 "varname">LOCALBASE</code>.</p>
1.1       grant    9098: 
                   9099:                 <p>Usually, X11 packages should be installed under
1.14      xtraeme  9100:                 <code class="varname">LOCALBASE</code> whenever
1.34      wiz      9101:                 possible. Note that you will need to include
                   9102:                 <code class=
                   9103:                 "filename">../../mk/x11.buildlink3.mk</code> in
                   9104:                 them to request the presence of X11 and to get the
                   9105:                 right compilation flags.</p>
1.1       grant    9106: 
                   9107:                 <p>Even though, there are some packages that cannot
1.14      xtraeme  9108:                 be installed under <code class=
                   9109:                 "varname">LOCALBASE</code>: those that come with
1.1       grant    9110:                 app-defaults files. These packages are special and
1.14      xtraeme  9111:                 they must be placed under <code class=
                   9112:                 "varname">X11BASE</code>. To accomplish this, set
                   9113:                 either <code class="varname">USE_X11BASE</code> or
                   9114:                 <code class="varname">USE_IMAKE</code> in your
1.1       grant    9115:                 package.</p>
                   9116: 
1.34      wiz      9117:                 <p>Some notes: If you need to find includes or
1.14      xtraeme  9118:                 libraries installed by a pkg that has <code class=
                   9119:                 "varname">USE_IMAKE</code> or <code class=
                   9120:                 "varname">USE_X11BASE</code> in its pkg
                   9121:                 <code class="filename">Makefile</code>, you need to
1.34      wiz      9122:                 look in <span class="emphasis"><em>both</em></span>
1.14      xtraeme  9123:                 <code class="filename">${X11BASE}</code> and
                   9124:                 <code class="filename">${LOCALBASE}</code>. To
                   9125:                 force installation of all X11 packages in
                   9126:                 <code class="varname">LOCALBASE</code>, the
                   9127:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9128:                 href=
1.1       grant    9129:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.34      wiz      9130:                 class="pkgname">pkgtools/xpkgwedge</a> package is
                   9131:                 enabled by default.</p>
1.1       grant    9132:               </li>
                   9133: 
                   9134:               <li>
1.14      xtraeme  9135:                 <p><code class="varname">X11PREFIX</code> should be
1.1       grant    9136:                 used to refer to the installed location of an X11
1.14      xtraeme  9137:                 package. <code class="varname">X11PREFIX</code>
                   9138:                 will be set to <code class="varname">X11BASE</code>
                   9139:                 if xpkgwedge is not installed, and to <code class=
                   9140:                 "varname">LOCALBASE</code> if xpkgwedge is
1.1       grant    9141:                 installed.</p>
                   9142:               </li>
                   9143: 
                   9144:               <li>
                   9145:                 <p>If xpkgwedge is installed, it is possible to
1.14      xtraeme  9146:                 have some packages installed in <code class=
                   9147:                 "varname">X11BASE</code> and some in <code class=
                   9148:                 "varname">LOCALBASE</code>. To determine the prefix
                   9149:                 of an installed package, the <code class=
                   9150:                 "varname">EVAL_PREFIX</code> definition can be
                   9151:                 used. It takes pairs in the format
                   9152:                 &#8220;<span class=
1.1       grant    9153:                 "quote">DIRNAME=&lt;package&gt;</span>&#8221;, and
1.24      wiz      9154:                 the <a href=
                   9155:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   9156:                 <span class="citerefentry"><span class=
                   9157:                 "refentrytitle">make</span>(1)</span></a> variable
                   9158:                 <code class="varname">DIRNAME</code> will be set to
                   9159:                 the prefix of the installed package
                   9160:                 &lt;package&gt;, or &#8220;<span class=
1.1       grant    9161:                 "quote">${X11PREFIX}</span>&#8221; if the package
                   9162:                 is not installed.</p>
                   9163: 
                   9164:                 <p>This is best illustrated by example.</p>
                   9165: 
1.14      xtraeme  9166:                 <p>The following lines are taken from <code class=
                   9167:                 "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1       grant    9168:                 <pre class="programlisting">
1.14      xtraeme  9169: EVAL_PREFIX+=           GTKDIR=gtk+
1.1       grant    9170: CONFIGURE_ARGS+=        --with-guile-prefix=${LOCALBASE}        \
                   9171:                         --with-gtk-prefix="${GTKDIR}"           \
                   9172:                         --enable-multibyte
                   9173: </pre>
                   9174: 
                   9175:                 <p>Specific defaults can be defined for the
1.14      xtraeme  9176:                 packages evaluated using <code class=
                   9177:                 "varname">EVAL_PREFIX</code>, by using a definition
1.1       grant    9178:                 of the form:</p>
                   9179:                 <pre class="programlisting">
                   9180: GTKDIR_DEFAULT= ${LOCALBASE}
                   9181: </pre>
                   9182: 
1.14      xtraeme  9183:                 <p>where <code class="varname">GTKDIR</code>
1.1       grant    9184:                 corresponds to the first definition in the
1.14      xtraeme  9185:                 <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1       grant    9186:               </li>
                   9187: 
                   9188:               <li>
1.14      xtraeme  9189:                 <p>Within <code class="filename">${PREFIX}</code>,
1.24      wiz      9190:                 packages should install files according to <a href=
                   9191:                 "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
                   9192:                 <span class="citerefentry"><span class=
                   9193:                 "refentrytitle">hier</span>(7)</span></a>, with the
                   9194:                 exception that manual pages go into <code class=
                   9195:                 "filename">${PREFIX}/man</code>, not <code class=
1.14      xtraeme  9196:                 "filename">${PREFIX}/share/man</code>.</p>
1.1       grant    9197:               </li>
                   9198:             </ul>
                   9199:           </div>
                   9200:         </div>
                   9201: 
                   9202:         <div class="sect1" lang="en" xml:lang="en">
                   9203:           <div class="titlepage">
                   9204:             <div>
                   9205:               <div>
                   9206:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      9207:                 "main-targets" id=
1.38      dillo    9208:                 "main-targets"></a>14.2.&nbsp;Main targets</h2>
1.1       grant    9209:               </div>
                   9210:             </div>
                   9211:           </div>
                   9212: 
                   9213:           <p>The main targets used during the build process defined
1.14      xtraeme  9214:           in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1       grant    9215: 
                   9216:           <div class="variablelist">
                   9217:             <dl>
                   9218:               <dt><span class="term">fetch</span></dt>
                   9219: 
                   9220:               <dd>
                   9221:                 <p>This will check if the file(s) given in the
1.14      xtraeme  9222:                 variables <code class="varname">DISTFILES</code>
                   9223:                 and <code class="varname">PATCHFILES</code> (as
                   9224:                 defined in the package's Makefile) are present on
                   9225:                 the local system in <code class=
                   9226:                 "filename">/usr/pkgsrc/distfiles</code>. If they
                   9227:                 are not present, an attempt will be made to fetch
                   9228:                 them using commands of the form:</p>
1.1       grant    9229:                 <pre class="programlisting">
                   9230: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
                   9231: </pre>
                   9232: 
                   9233:                 <p>where ${site} varies through several
1.14      xtraeme  9234:                 possibilities in turn: first, <code class=
                   9235:                 "varname">MASTER_SITE_OVERRIDE</code> is tried,
                   9236:                 then the sites specified in either <code class=
                   9237:                 "varname">SITES_file</code> if defined, else
                   9238:                 <code class="varname">MASTER_SITES</code> or
                   9239:                 <code class="varname">PATCH_SITES</code>, as
                   9240:                 applies, then finally the value of <code class=
                   9241:                 "varname">MASTER_SITE_BACKUP</code>. The order of
                   9242:                 all except the first can be optionally sorted by
                   9243:                 the user, via setting either <code class=
                   9244:                 "varname">MASTER_SORT_AWK</code> or <code class=
                   9245:                 "varname">MASTER_SORT_REGEX</code>.</p>
1.1       grant    9246:               </dd>
                   9247: 
                   9248:               <dt><span class="term">checksum</span></dt>
                   9249: 
                   9250:               <dd>
                   9251:                 <p>After the distfile(s) are fetched, their
                   9252:                 checksum is generated and compared with the
                   9253:                 checksums stored in the distinfo file. If the
                   9254:                 checksums don't match, the build is aborted. This
                   9255:                 is to ensure the same distfile is used for
                   9256:                 building, and that the distfile wasn't changed,
                   9257:                 e.g. by some malign force, deliberately changed
                   9258:                 distfiles on the master distribution site or
                   9259:                 network lossage.</p>
                   9260:               </dd>
                   9261: 
                   9262:               <dt><span class="term">extract</span></dt>
                   9263: 
                   9264:               <dd>
                   9265:                 <p>When the distfiles are present on the local
                   9266:                 system, they need to be extracted, as they are
                   9267:                 usually in the form of some compressed archive
1.14      xtraeme  9268:                 format, most commonly <code class=
                   9269:                 "filename">.tar.gz</code>.</p>
1.1       grant    9270: 
                   9271:                 <p>If only some of the distfiles need to be
                   9272:                 uncompressed, the files to be uncompressed should
1.14      xtraeme  9273:                 be put into <code class=
                   9274:                 "varname">EXTRACT_ONLY</code>.</p>
1.1       grant    9275: 
1.14      xtraeme  9276:                 <p>If the distfiles are not in <code class=
                   9277:                 "filename">.tar.gz</code> format, they can be
                   9278:                 extracted by setting either <code class=
                   9279:                 "varname">EXTRACT_SUFX</code>, or <code class=
                   9280:                 "varname">EXTRACT_CMD</code>, <code class=
                   9281:                 "varname">EXTRACT_BEFORE_ARGS</code> and
                   9282:                 <code class="varname">EXTRACT_AFTER_ARGS</code>. In
                   9283:                 the former case, pkgsrc knows how to extract a
                   9284:                 number of suffixes (<code class=
                   9285:                 "filename">.tar.gz</code>, <code class=
                   9286:                 "filename">.tgz</code>, <code class=
                   9287:                 "filename">.tar.gz2</code>, <code class=
                   9288:                 "filename">.tbz</code>, <code class=
                   9289:                 "filename">.tar.Z</code>, <code class=
                   9290:                 "filename">.tar</code>, <code class=
                   9291:                 "filename">.shar.gz</code>, <code class=
                   9292:                 "filename">.shar.bz2</code>, <code class=
                   9293:                 "filename">.shar.Z</code>, <code class=
                   9294:                 "filename">.shar</code>, <code class=
                   9295:                 "filename">.Z</code>, <code class=
                   9296:                 "filename">.bz2</code> and <code class=
                   9297:                 "filename">.gz</code>; see the definition of the
                   9298:                 various <code class="varname">DECOMPRESS_CMD</code>
                   9299:                 variables <code class="filename">bsd.pkg.mk</code>
                   9300:                 for a complete list). Here's an example on how to
                   9301:                 use the other variables for a program that comes
                   9302:                 with a compressed shell archive whose name ends in
                   9303:                 <code class="filename">.msg.gz</code>:</p>
1.1       grant    9304:                 <pre class="programlisting">
                   9305:      EXTRACT_SUFX=   .msg.gz
                   9306:      EXTRACT_CMD=            zcat
                   9307:      EXTRACT_BEFORE_ARGS=
                   9308:      EXTRACT_AFTER_ARGS=     |sh
                   9309: </pre>
                   9310:               </dd>
                   9311: 
                   9312:               <dt><span class="term">patch</span></dt>
                   9313: 
                   9314:               <dd>
                   9315:                 <p>After extraction, all the patches named by the
1.14      xtraeme  9316:                 <code class="varname">PATCHFILES</code>, those
                   9317:                 present in the patches subdirectory of the package
                   9318:                 as well as in $LOCALPATCHES/$PKGPATH (e.g.
                   9319:                 <code class=
                   9320:                 "filename">/usr/local/patches/graphics/png</code>)
                   9321:                 are applied. Patchfiles ending in <code class=
                   9322:                 "filename">.Z</code> or <code class=
                   9323:                 "filename">.gz</code> are uncompressed before they
                   9324:                 are applied, files ending in <code class=
                   9325:                 "filename">.orig</code> or <code class=
                   9326:                 "filename">.rej</code> are ignored. Any special
1.24      wiz      9327:                 options to <a href=
                   9328:                 "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   9329:                 <span class="citerefentry"><span class=
                   9330:                 "refentrytitle">patch</span>(1)</span></a> can be
                   9331:                 handed in <code class=
1.14      xtraeme  9332:                 "varname">PATCH_DIST_ARGS</code>. See <a href=
                   9333:                 "#components.patches" title=
1.38      dillo    9334:                 "8.3.&nbsp;patches/*">Section&nbsp;8.3,
1.1       grant    9335:                 &#8220;patches/*&#8221;</a> for more details.</p>
                   9336: 
1.24      wiz      9337:                 <p>By default <a href=
                   9338:                 "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   9339:                 <span class="citerefentry"><span class=
                   9340:                 "refentrytitle">patch</span>(1)</span></a> is given
                   9341:                 special args to make it fail if the patches apply
                   9342:                 with some lines of fuzz. Please fix (regen) the
                   9343:                 patches so that they apply cleanly. The rationale
                   9344:                 behind this is that patches that don't apply
                   9345:                 cleanly may end up being applied in the wrong
                   9346:                 place, and cause severe harm there.</p>
1.1       grant    9347:               </dd>
                   9348: 
                   9349:               <dt><span class="term">configure</span></dt>
                   9350: 
                   9351:               <dd>
                   9352:                 <p>Most pieces of software need information on the
                   9353:                 header files, system calls, and library routines
                   9354:                 which are available in NetBSD. This is the process
                   9355:                 known as configuration, and is usually automated.
                   9356:                 In most cases, a script is supplied with the
                   9357:                 source, and its invocation results in generation of
                   9358:                 header files, Makefiles, etc.</p>
                   9359: 
                   9360:                 <p>If the program's distfile contains its own
                   9361:                 configure script, this can be invoked by setting
1.14      xtraeme  9362:                 <code class="varname">HAS_CONFIGURE</code>. If the
1.1       grant    9363:                 configure script is a GNU autoconf script,
1.14      xtraeme  9364:                 <code class="varname">GNU_CONFIGURE</code> should
                   9365:                 be specified instead. In either case, any arguments
                   9366:                 to the configure script can be specified in the
                   9367:                 <code class="varname">CONFIGURE_ARGS</code>
                   9368:                 variable, and the configure script's name can be
                   9369:                 set in <code class=
                   9370:                 "varname">CONFIGURE_SCRIPT</code> if it differs
                   9371:                 from the default &#8220;<span class=
1.1       grant    9372:                 "quote">configure</span>&#8221;. Here's an example
                   9373:                 from the <a xmlns=
                   9374:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   9375:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.20      ben      9376:                 class="pkgname">sysutils/top</a> package:</p>
1.1       grant    9377:                 <pre class="programlisting">
                   9378: HAS_CONFIGURE=          yes
                   9379: CONFIGURE_SCRIPT=       Configure
                   9380: CONFIGURE_ARGS+=        netbsd13
                   9381: </pre>
                   9382: 
                   9383:                 <p>If the program uses an Imakefile for
                   9384:                 configuration, the appropriate steps can be invoked
1.14      xtraeme  9385:                 by setting <code class="varname">USE_IMAKE</code>
                   9386:                 to &#8220;<span class="quote">YES</span>&#8221;.
                   9387:                 (If you only want the package installed in
                   9388:                 <code class="varname">$X11PREFIX</code> but xmkmf
                   9389:                 not being run, set <code class=
                   9390:                 "varname">USE_X11BASE</code> instead!)</p>
1.1       grant    9391:               </dd>
                   9392: 
                   9393:               <dt><span class="term">build</span></dt>
                   9394: 
                   9395:               <dd>
                   9396:                 <p>Once configuration has taken place, the software
1.14      xtraeme  9397:                 will be built by invoking <code class=
                   9398:                 "varname">$MAKE_PROGRAM</code> on <code class=
                   9399:                 "varname">$MAKEFILE</code> with <code class=
                   9400:                 "varname">$BUILD_TARGET</code> as the target to
                   9401:                 build. The default <code class=
                   9402:                 "varname">MAKE_PROGRAM</code> is
                   9403:                 &#8220;<span class="quote">gmake</span>&#8221; if
1.29      rillig   9404:                 <code class="varname">USE_TOOLS</code> contains
                   9405:                 &#8220;<span class="quote">gmake</span>&#8221;,
1.1       grant    9406:                 &#8220;<span class="quote">make</span>&#8221;
1.14      xtraeme  9407:                 otherwise. <code class="varname">MAKEFILE</code> is
                   9408:                 set to &#8220;<span class=
1.1       grant    9409:                 "quote">Makefile</span>&#8221; by default, and
1.14      xtraeme  9410:                 <code class="varname">BUILD_TARGET</code> defaults
                   9411:                 to &#8220;<span class="quote">all</span>&#8221;.
                   9412:                 Any of these variables can be set in the package's
1.1       grant    9413:                 Makefile to change the default build process.</p>
                   9414:               </dd>
                   9415: 
                   9416:               <dt><span class="term">install</span></dt>
                   9417: 
                   9418:               <dd>
                   9419:                 <p>Once the build stage has completed, the final
                   9420:                 step is to install the software in public
                   9421:                 directories, so users can access the programs and
1.14      xtraeme  9422:                 files. As in the build-target, <code class=
                   9423:                 "varname">$MAKE_PROGRAM</code> is invoked on
                   9424:                 <code class="varname">$MAKEFILE</code> here, but
                   9425:                 with the <code class=
                   9426:                 "varname">$INSTALL_TARGET</code> instead, the
                   9427:                 latter defaulting to &#8220;<span class=
                   9428:                 "quote">install</span>&#8221; (plus
                   9429:                 &#8220;<span class=
                   9430:                 "quote">install.man</span>&#8221;, if <code class=
                   9431:                 "varname">USE_IMAKE</code> is set).</p>
1.1       grant    9432:               </dd>
                   9433:             </dl>
                   9434:           </div>
                   9435: 
                   9436:           <p>If no target is specified, the default is
                   9437:           &#8220;<span class="quote">build</span>&#8221;. If a
                   9438:           subsequent stage is requested, all prior stages are made:
1.14      xtraeme  9439:           e.g. <span><strong class="command">make
                   9440:           build</strong></span> will also perform the equivalent
                   9441:           of:</p>
1.1       grant    9442:           <pre class="programlisting">
                   9443: make fetch
                   9444: make checksum
                   9445: make extract
                   9446: make patch
                   9447: make configure
                   9448: make build
                   9449: </pre>
                   9450:         </div>
                   9451: 
                   9452:         <div class="sect1" lang="en" xml:lang="en">
                   9453:           <div class="titlepage">
                   9454:             <div>
                   9455:               <div>
                   9456:                 <h2 class="title" style="clear: both"><a name=
                   9457:                 "build.helpful-targets" id=
1.38      dillo    9458:                 "build.helpful-targets"></a>14.3.&nbsp;Other
1.1       grant    9459:                 helpful targets</h2>
                   9460:               </div>
                   9461:             </div>
                   9462:           </div>
                   9463: 
                   9464:           <div class="variablelist">
                   9465:             <dl>
                   9466:               <dt><span class="term">pre/post-*</span></dt>
                   9467: 
                   9468:               <dd>
                   9469:                 <p>For any of the main targets described in the
                   9470:                 previous section, two auxiliary targets exist with
                   9471:                 &#8220;<span class="quote">pre-</span>&#8221; and
                   9472:                 &#8220;<span class="quote">post-</span>&#8221; used
                   9473:                 as a prefix for the main target's name. These
                   9474:                 targets are invoked before and after the main
                   9475:                 target is called, allowing extra configuration or
                   9476:                 installation steps be performed from a package's
                   9477:                 Makefile, for example, which a program's configure
                   9478:                 script or install target omitted.</p>
                   9479:               </dd>
                   9480: 
                   9481:               <dt><span class="term">do-*</span></dt>
                   9482: 
                   9483:               <dd>
                   9484:                 <p>Should one of the main targets do the wrong
                   9485:                 thing, and should there be no variable to fix this,
                   9486:                 you can redefine it with the do-* target. (Note
                   9487:                 that redefining the target itself instead of the
                   9488:                 do-* target is a bad idea, as the pre-* and post-*
                   9489:                 targets won't be called anymore, etc.) You will not
                   9490:                 usually need to do this.</p>
                   9491:               </dd>
                   9492: 
                   9493:               <dt><span class="term">reinstall</span></dt>
                   9494: 
                   9495:               <dd>
1.14      xtraeme  9496:                 <p>If you did a <span><strong class="command">make
                   9497:                 install</strong></span> and you noticed some file
                   9498:                 was not installed properly, you can repeat the
1.1       grant    9499:                 installation with this target, which will ignore
                   9500:                 the &#8220;<span class="quote">already
                   9501:                 installed</span>&#8221; flag.</p>
                   9502:               </dd>
                   9503: 
                   9504:               <dt><span class="term">deinstall</span></dt>
                   9505: 
                   9506:               <dd>
1.24      wiz      9507:                 <p>This target does a <a href=
                   9508:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   9509:                 <span class="citerefentry"><span class=
                   9510:                 "refentrytitle">pkg_delete</span>(1)</span></a> in
                   9511:                 the current directory, effectively de-installing
                   9512:                 the package. The following variables can be used to
                   9513:                 tune the behaviour:</p>
1.1       grant    9514: 
                   9515:                 <div class="variablelist">
                   9516:                   <dl>
1.14      xtraeme  9517:                     <dt><span class="term"><code class=
                   9518:                     "varname">PKG_VERBOSE</code></span></dt>
1.1       grant    9519: 
                   9520:                     <dd>
                   9521:                       <p>Add a "-v" to the <a href=
                   9522:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   9523:                       <span class="citerefentry"><span class=
                   9524:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   9525:                       command.</p>
                   9526:                     </dd>
                   9527: 
1.14      xtraeme  9528:                     <dt><span class="term"><code class=
                   9529:                     "varname">DEINSTALLDEPENDS</code></span></dt>
1.1       grant    9530: 
                   9531:                     <dd>
                   9532:                       <p>Remove all packages that require (depend
                   9533:                       on) the given package. This can be used to
                   9534:                       remove any packages that may have been pulled
                   9535:                       in by a given package, e.g. if
1.14      xtraeme  9536:                       <span><strong class="command">make deinstall
                   9537:                       DEINSTALLDEPENDS=1</strong></span> is done in
                   9538:                       <code class="filename">pkgsrc/x11/kde</code>,
1.1       grant    9539:                       this is likely to remove whole KDE. Works by
                   9540:                       adding &#8220;<span class=
                   9541:                       "quote">-R</span>&#8221; to the <a href=
                   9542:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   9543:                       <span class="citerefentry"><span class=
                   9544:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   9545:                       command line.</p>
                   9546:                     </dd>
                   9547:                   </dl>
                   9548:                 </div>
                   9549:               </dd>
                   9550: 
                   9551:               <dt><span class="term">update</span></dt>
                   9552: 
                   9553:               <dd>
                   9554:                 <p>This target causes the current package to be
                   9555:                 updated to the latest version. The package and all
                   9556:                 depending packages first get de-installed, then
                   9557:                 current versions of the corresponding packages get
                   9558:                 compiled and installed. This is similar to manually
                   9559:                 noting which packages are currently installed, then
1.14      xtraeme  9560:                 performing a series of <span><strong class=
                   9561:                 "command">make deinstall</strong></span> and
                   9562:                 <span><strong class="command">make
                   9563:                 install</strong></span> (or whatever <code class=
                   9564:                 "varname">UPDATE_TARGET</code> is set to) for these
                   9565:                 packages.</p>
1.1       grant    9566: 
                   9567:                 <p>You can use the &#8220;<span class=
                   9568:                 "quote">update</span>&#8221; target to resume
1.14      xtraeme  9569:                 package updating in case a previous
                   9570:                 <span><strong class="command">make
                   9571:                 update</strong></span> was interrupted for some
                   9572:                 reason. However, in this case, make sure you don't
                   9573:                 call <span><strong class="command">make
                   9574:                 clean</strong></span> or otherwise remove the list
                   9575:                 of dependent packages in <code class=
                   9576:                 "varname">WRKDIR</code>. Otherwise you lose the
1.1       grant    9577:                 ability to automatically update the current package
                   9578:                 along with the dependent packages you have
                   9579:                 installed.</p>
                   9580: 
1.14      xtraeme  9581:                 <p>Resuming an interrupted <span><strong class=
                   9582:                 "command">make update</strong></span> will only
                   9583:                 work as long as the package tree remains unchanged.
                   9584:                 If the source code for one of the packages to be
                   9585:                 updated has been changed, resuming
                   9586:                 <span><strong class="command">make
                   9587:                 update</strong></span> will most certainly
                   9588:                 fail!</p>
1.1       grant    9589: 
                   9590:                 <p>The following variables can be used either on
1.14      xtraeme  9591:                 the command line or in <code class=
                   9592:                 "filename">/etc/mk.conf</code> to alter the
                   9593:                 behaviour of <span><strong class="command">make
                   9594:                 update</strong></span>:</p>
1.1       grant    9595: 
                   9596:                 <div class="variablelist">
                   9597:                   <dl>
1.14      xtraeme  9598:                     <dt><span class="term"><code class=
                   9599:                     "varname">UPDATE_TARGET</code></span></dt>
1.1       grant    9600: 
                   9601:                     <dd>
                   9602:                       <p>Install target to recursively use for the
                   9603:                       updated package and the dependent packages.
1.14      xtraeme  9604:                       Defaults to <code class=
                   9605:                       "varname">DEPENDS_TARGET</code> if set,
1.1       grant    9606:                       &#8220;<span class=
                   9607:                       "quote">install</span>&#8221; otherwise for
1.14      xtraeme  9608:                       <span><strong class="command">make
                   9609:                       update</strong></span>. e.g.
                   9610:                       <span><strong class="command">make update
                   9611:                       UPDATE_TARGET=package</strong></span></p>
1.1       grant    9612:                     </dd>
                   9613: 
1.14      xtraeme  9614:                     <dt><span class="term"><code class=
                   9615:                     "varname">NOCLEAN</code></span></dt>
1.1       grant    9616: 
                   9617:                     <dd>
                   9618:                       <p>Don't clean up after updating. Useful if
                   9619:                       you want to leave the work sources of the
                   9620:                       updated packages around for inspection or
                   9621:                       other purposes. Be sure you eventually clean
                   9622:                       up the source tree (see the
                   9623:                       &#8220;<span class=
                   9624:                       "quote">clean-update</span>&#8221; target
                   9625:                       below) or you may run into troubles with old
                   9626:                       source code still lying around on your next
1.14      xtraeme  9627:                       <span><strong class=
                   9628:                       "command">make</strong></span> or
                   9629:                       <span><strong class="command">make
                   9630:                       update</strong></span>.</p>
1.1       grant    9631:                     </dd>
                   9632: 
1.14      xtraeme  9633:                     <dt><span class="term"><code class=
                   9634:                     "varname">REINSTALL</code></span></dt>
1.1       grant    9635: 
                   9636:                     <dd>
                   9637:                       <p>Deinstall each package before installing
1.14      xtraeme  9638:                       (making <code class=
                   9639:                       "varname">DEPENDS_TARGET</code>). This may be
1.1       grant    9640:                       necessary if the &#8220;<span class=
                   9641:                       "quote">clean-update</span>&#8221; target
                   9642:                       (see below) was called after interrupting a
1.14      xtraeme  9643:                       running <span><strong class="command">make
                   9644:                       update</strong></span>.</p>
1.1       grant    9645:                     </dd>
                   9646: 
1.14      xtraeme  9647:                     <dt><span class="term"><code class=
                   9648:                     "varname">DEPENDS_TARGET</code></span></dt>
1.1       grant    9649: 
                   9650:                     <dd>
                   9651:                       <p>Allows you to disable recursion and
                   9652:                       hardcode the target for packages. The default
                   9653:                       is &#8220;<span class=
                   9654:                       "quote">update</span>&#8221; for the update
                   9655:                       target, facilitating a recursive update of
1.14      xtraeme  9656:                       prerequisite packages. Only set <code class=
                   9657:                       "varname">DEPENDS_TARGET</code> if you want
                   9658:                       to disable recursive updates. Use
                   9659:                       <code class="varname">UPDATE_TARGET</code>
                   9660:                       instead to just set a specific target for
                   9661:                       each package to be installed during
                   9662:                       <span><strong class="command">make
                   9663:                       update</strong></span> (see above).</p>
1.1       grant    9664:                     </dd>
                   9665:                   </dl>
                   9666:                 </div>
                   9667:               </dd>
                   9668: 
                   9669:               <dt><span class="term">clean-update</span></dt>
                   9670: 
                   9671:               <dd>
                   9672:                 <p>Clean the source tree for all packages that
1.14      xtraeme  9673:                 would get updated if <span><strong class=
                   9674:                 "command">make update</strong></span> was called
                   9675:                 from the current directory. This target should not
                   9676:                 be used if the current package (or any of its
                   9677:                 depending packages) have already been de-installed
                   9678:                 (e.g., after calling <span><strong class=
                   9679:                 "command">make update</strong></span>) or you may
                   9680:                 lose some packages you intended to update. As a
                   9681:                 rule of thumb: only use this target <span class=
                   9682:                 "emphasis"><em>before</em></span> the first time
                   9683:                 you run <span><strong class="command">make
                   9684:                 update</strong></span> and only if you have a dirty
                   9685:                 package tree (e.g., if you used <code class=
                   9686:                 "varname">NOCLEAN</code>).</p>
1.1       grant    9687: 
                   9688:                 <p>If you unsure about whether your tree is clean
1.14      xtraeme  9689:                 you can either perform a <span><strong class=
                   9690:                 "command">make clean</strong></span> at the top of
                   9691:                 the tree, or use the following sequence of commands
1.1       grant    9692:                 from the directory of the package you want to
                   9693:                 update (<span class=
                   9694:                 "emphasis"><em>before</em></span> running
1.14      xtraeme  9695:                 <span><strong class="command">make
                   9696:                 update</strong></span> for the first time,
                   9697:                 otherwise you lose all the packages you wanted to
                   9698:                 update!):</p>
1.1       grant    9699:                 <pre class="screen">
1.14      xtraeme  9700: <code class="prompt">#</code> <strong class=
                   9701: "userinput"><code>make clean-update</code></strong>
                   9702: <code class="prompt">#</code> <strong class=
                   9703: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
                   9704: <code class="prompt">#</code> <strong class=
                   9705: "userinput"><code>make update</code></strong>
1.1       grant    9706: </pre>
                   9707: 
                   9708:                 <p>The following variables can be used either on
1.14      xtraeme  9709:                 the command line or in <code class=
                   9710:                 "filename">/etc/mk.conf</code> to alter the
                   9711:                 behaviour of <span><strong class="command">make
                   9712:                 clean-update</strong></span>:</p>
1.1       grant    9713: 
                   9714:                 <div class="variablelist">
                   9715:                   <dl>
1.14      xtraeme  9716:                     <dt><span class="term"><code class=
                   9717:                     "varname">CLEAR_DIRLIST</code></span></dt>
1.1       grant    9718: 
                   9719:                     <dd>
1.14      xtraeme  9720:                       <p>After <span><strong class="command">make
                   9721:                       clean</strong></span>, do not reconstruct the
                   9722:                       list of directories to update for this
                   9723:                       package. Only use this if
                   9724:                       <span><strong class="command">make
                   9725:                       update</strong></span> successfully installed
                   9726:                       all packages you wanted to update. Normally,
                   9727:                       this is done automatically on
                   9728:                       <span><strong class="command">make
                   9729:                       update</strong></span>, but may have been
                   9730:                       suppressed by the <code class=
                   9731:                       "varname">NOCLEAN</code> variable (see
1.1       grant    9732:                       above).</p>
                   9733:                     </dd>
                   9734:                   </dl>
                   9735:                 </div>
                   9736:               </dd>
                   9737: 
                   9738:               <dt><span class="term">info</span></dt>
                   9739: 
                   9740:               <dd>
                   9741:                 <p>This target invokes <a href=
                   9742:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   9743:                 <span class="citerefentry"><span class=
                   9744:                 "refentrytitle">pkg_info</span>(1)</span></a> for
                   9745:                 the current package. You can use this to check
                   9746:                 which version of a package is installed.</p>
                   9747:               </dd>
                   9748: 
                   9749:               <dt><span class="term">readme</span></dt>
                   9750: 
                   9751:               <dd>
1.14      xtraeme  9752:                 <p>This target generates a <code class=
                   9753:                 "filename">README.html</code> file, which can be
1.1       grant    9754:                 viewed using a browser such as <a xmlns=
                   9755:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   9756:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20      ben      9757:                 class="pkgname">www/mozilla</a> or <a xmlns=
                   9758:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   9759:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
                   9760:                 class="pkgname">www/links</a>. The generated files
                   9761:                 contain references to any packages which are in the
                   9762:                 <code class="varname">PACKAGES</code> directory on
                   9763:                 the local host. The generated files can be made to
                   9764:                 refer to URLs based on <code class=
                   9765:                 "varname">FTP_PKG_URL_HOST</code> and <code class=
                   9766:                 "varname">FTP_PKG_URL_DIR</code>. For example, if I
                   9767:                 wanted to generate <code class=
                   9768:                 "filename">README.html</code> files which pointed
                   9769:                 to binary packages on the local machine, in the
                   9770:                 directory <code class=
                   9771:                 "filename">/usr/packages</code>, set <code class=
                   9772:                 "varname">FTP_PKG_URL_HOST=file://localhost</code>
                   9773:                 and <code class=
                   9774:                 "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
                   9775:                 <code class="varname">${PACKAGES}</code> directory
                   9776:                 and its subdirectories will be searched for all the
                   9777:                 binary packages.</p>
1.1       grant    9778:               </dd>
                   9779: 
                   9780:               <dt><span class="term">readme-all</span></dt>
                   9781: 
                   9782:               <dd>
1.14      xtraeme  9783:                 <p>Use this target to create a file <code class=
                   9784:                 "filename">README-all.html</code> which contains a
1.1       grant    9785:                 list of all packages currently available in the
                   9786:                 NetBSD Packages Collection, together with the
                   9787:                 category they belong to and a short description.
1.14      xtraeme  9788:                 This file is compiled from the <code class=
                   9789:                 "filename">pkgsrc/*/README.html</code> files, so be
1.1       grant    9790:                 sure to run this <span class=
1.14      xtraeme  9791:                 "emphasis"><em>after</em></span> a
                   9792:                 <span><strong class="command">make
                   9793:                 readme</strong></span>.</p>
1.1       grant    9794:               </dd>
                   9795: 
                   9796:               <dt><span class="term">cdrom-readme</span></dt>
                   9797: 
                   9798:               <dd>
                   9799:                 <p>This is very much the same as the
                   9800:                 &#8220;<span class="quote">readme</span>&#8221;
                   9801:                 target (see above), but is to be used when
                   9802:                 generating a pkgsrc tree to be written to a CD-ROM.
1.14      xtraeme  9803:                 This target also produces <code class=
                   9804:                 "filename">README.html</code> files, and can be
                   9805:                 made to refer to URLs based on <code class=
                   9806:                 "varname">CDROM_PKG_URL_HOST</code> and
                   9807:                 <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1       grant    9808:               </dd>
                   9809: 
                   9810:               <dt><span class="term">show-distfiles</span></dt>
                   9811: 
                   9812:               <dd>
                   9813:                 <p>This target shows which distfiles and patchfiles
1.14      xtraeme  9814:                 are needed to build the package. (<code class=
                   9815:                 "varname">DISTFILES</code> and <code class=
                   9816:                 "varname">PATCHFILES</code>, but not <code class=
                   9817:                 "filename">patches/*</code>)</p>
1.1       grant    9818:               </dd>
                   9819: 
                   9820:               <dt><span class="term">show-downlevel</span></dt>
                   9821: 
                   9822:               <dd>
                   9823:                 <p>This target shows nothing if the package is not
                   9824:                 installed. If a version of this package is
                   9825:                 installed, but is not the version provided in this
                   9826:                 version of pkgsrc, then a warning message is
                   9827:                 displayed. This target can be used to show which of
                   9828:                 your installed packages are downlevel, and so the
                   9829:                 old versions can be deleted, and the current ones
                   9830:                 added.</p>
                   9831:               </dd>
                   9832: 
                   9833:               <dt><span class="term">show-pkgsrc-dir</span></dt>
                   9834: 
                   9835:               <dd>
                   9836:                 <p>This target shows the directory in the pkgsrc
                   9837:                 hierarchy from which the package can be built and
                   9838:                 installed. This may not be the same directory as
                   9839:                 the one from which the package was installed. This
                   9840:                 target is intended to be used by people who may
                   9841:                 wish to upgrade many packages on a single host, and
                   9842:                 can be invoked from the top-level pkgsrc Makefile
                   9843:                 by using the &#8220;<span class=
                   9844:                 "quote">show-host-specific-pkgs</span>&#8221;
                   9845:                 target.</p>
                   9846:               </dd>
                   9847: 
                   9848:               <dt><span class=
                   9849:               "term">show-installed-depends</span></dt>
                   9850: 
                   9851:               <dd>
                   9852:                 <p>This target shows which installed packages match
1.14      xtraeme  9853:                 the current package's <code class=
                   9854:                 "varname">DEPENDS</code>. Useful if out of date
1.1       grant    9855:                 dependencies are causing build problems.</p>
                   9856:               </dd>
                   9857: 
                   9858:               <dt><span class="term">check-shlibs</span></dt>
                   9859: 
                   9860:               <dd>
                   9861:                 <p>After a package is installed, check all its
                   9862:                 binaries and (on ELF platforms) shared libraries to
                   9863:                 see if they find the shared libs they need. Run by
1.14      xtraeme  9864:                 default if <code class=
                   9865:                 "varname">PKG_DEVELOPER</code> is set in
                   9866:                 <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    9867:               </dd>
                   9868: 
                   9869:               <dt><span class="term">print-PLIST</span></dt>
                   9870: 
                   9871:               <dd>
                   9872:                 <p>After a &#8220;<span class="quote">make
                   9873:                 install</span>&#8221; from a new or upgraded pkg,
                   9874:                 this prints out an attempt to generate a new
1.14      xtraeme  9875:                 <code class="filename">PLIST</code> from a
                   9876:                 <span><strong class="command">find -newer
                   9877:                 work/.extract_done</strong></span>. An attempt is
                   9878:                 made to care for shared libs etc., but it is
1.1       grant    9879:                 <span class="emphasis"><em>strongly</em></span>
                   9880:                 recommended to review the result before putting it
1.14      xtraeme  9881:                 into <code class="filename">PLIST</code>. On
                   9882:                 upgrades, it's useful to diff the output of this
                   9883:                 command against an already existing <code class=
                   9884:                 "filename">PLIST</code> file.</p>
1.1       grant    9885: 
1.24      wiz      9886:                 <p>If the package installs files via <a href=
                   9887:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   9888:                 <span class="citerefentry"><span class=
                   9889:                 "refentrytitle">tar</span>(1)</span></a> or other
                   9890:                 methods that don't update file access times, be
                   9891:                 sure to add these files manually to your
1.14      xtraeme  9892:                 <code class="filename">PLIST</code>, as the
1.1       grant    9893:                 &#8220;<span class="quote">find
                   9894:                 -newer</span>&#8221; command used by this target
                   9895:                 won't catch them!</p>
                   9896: 
                   9897:                 <p>See <a href="#print-PLIST" title=
1.38      dillo    9898:                 "10.3.&nbsp;Tweaking output of make print-PLIST">Section&nbsp;10.3,
1.14      xtraeme  9899:                 &#8220;Tweaking output of <span><strong class=
                   9900:                 "command">make
                   9901:                 print-PLIST</strong></span>&#8221;</a> for more
                   9902:                 information on this target.</p>
1.1       grant    9903:               </dd>
                   9904: 
                   9905:               <dt><span class="term">bulk-package</span></dt>
                   9906: 
                   9907:               <dd>
                   9908:                 <p>Used to do bulk builds. If an appropriate binary
                   9909:                 package already exists, no action is taken. If not,
                   9910:                 this target will compile, install and package it
1.14      xtraeme  9911:                 (and it's depends, if <code class=
                   9912:                 "varname">PKG_DEPENDS</code> is set properly. See
1.1       grant    9913:                 <a href="#binary.configuration" title=
1.38      dillo    9914:                 "6.3.1.&nbsp;Configuration">Section&nbsp;6.3.1,
1.1       grant    9915:                 &#8220;Configuration&#8221;</a>. After creating the
                   9916:                 binary package, the sources, the just-installed
                   9917:                 package and it's required packages are removed,
                   9918:                 preserving free disk space.</p>
                   9919: 
                   9920:                 <p><span class="emphasis"><em>Beware that this
                   9921:                 target may deinstall all packages installed on a
                   9922:                 system!</em></span></p>
                   9923:               </dd>
                   9924: 
                   9925:               <dt><span class="term">bulk-install</span></dt>
                   9926: 
                   9927:               <dd>
                   9928:                 <p>Used during bulk-installs to install required
                   9929:                 packages. If an upto-date binary package is
                   9930:                 available, it will be installed via <a href=
                   9931:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   9932:                 <span class="citerefentry"><span class=
                   9933:                 "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14      xtraeme  9934:                 not, <span><strong class="command">make
                   9935:                 bulk-package</strong></span> will be executed, but
                   9936:                 the installed binary not be removed.</p>
1.1       grant    9937: 
                   9938:                 <p>A binary package is considered
                   9939:                 &#8220;<span class="quote">upto-date</span>&#8221;
                   9940:                 to be installed via <a href=
                   9941:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   9942:                 <span class="citerefentry"><span class=
                   9943:                 "refentrytitle">pkg_add</span>(1)</span></a>
                   9944:                 if:</p>
                   9945: 
                   9946:                 <div class="itemizedlist">
                   9947:                   <ul type="disc">
                   9948:                     <li>
1.14      xtraeme  9949:                       <p>None of the package's files (<code class=
                   9950:                       "filename">Makefile</code>, ...) were
                   9951:                       modified since it was built.</p>
1.1       grant    9952:                     </li>
                   9953: 
                   9954:                     <li>
                   9955:                       <p>None of the package's required (binary)
                   9956:                       packages were modified since it was
                   9957:                       built.</p>
                   9958:                     </li>
                   9959:                   </ul>
                   9960:                 </div>
                   9961: 
                   9962:                 <p><span class="emphasis"><em>Beware that this
                   9963:                 target may deinstall all packages installed on a
                   9964:                 system!</em></span></p>
                   9965:               </dd>
                   9966:             </dl>
                   9967:           </div>
                   9968:         </div>
                   9969:       </div>
                   9970: 
                   9971:       <div class="chapter" lang="en" xml:lang="en">
                   9972:         <div class="titlepage">
                   9973:           <div>
                   9974:             <div>
                   9975:               <h2 class="title"><a name="fixes" id=
1.38      dillo    9976:               "fixes"></a>Chapter&nbsp;15.&nbsp;Notes on fixes for
1.1       grant    9977:               packages</h2>
                   9978:             </div>
                   9979:           </div>
                   9980:         </div>
                   9981: 
                   9982:         <div class="toc">
                   9983:           <p><b>Table of Contents</b></p>
                   9984: 
                   9985:           <dl>
1.30      wiz      9986:             <dt><span class="sect1"><a href=
1.38      dillo    9987:             "#general-operation">15.1. General
1.30      wiz      9988:             operation</a></span></dt>
1.1       grant    9989: 
                   9990:             <dd>
                   9991:               <dl>
                   9992:                 <dt><span class="sect2"><a href=
1.38      dillo    9993:                 "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30      wiz      9994:                 pull in variables from /etc/mk.conf</a></span></dt>
1.1       grant    9995: 
                   9996:                 <dt><span class="sect2"><a href=
1.38      dillo    9997:                 "#where-to-install-documentation">15.1.2. Where to
1.31      wiz      9998:                 install documentation</a></span></dt>
                   9999: 
                   10000:                 <dt><span class="sect2"><a href=
1.38      dillo    10001:                 "#restricted-packages">15.1.3. Restricted
1.1       grant    10002:                 packages</a></span></dt>
                   10003: 
                   10004:                 <dt><span class="sect2"><a href=
1.38      dillo    10005:                 "#dependencies">15.1.4. Handling
1.1       grant    10006:                 dependencies</a></span></dt>
                   10007: 
                   10008:                 <dt><span class="sect2"><a href=
1.38      dillo    10009:                 "#conflicts">15.1.5. Handling conflicts with other
1.1       grant    10010:                 packages</a></span></dt>
                   10011: 
                   10012:                 <dt><span class="sect2"><a href=
1.38      dillo    10013:                 "#not-building-packages">15.1.6. Packages that
1.30      wiz      10014:                 cannot or should not be built</a></span></dt>
1.1       grant    10015: 
                   10016:                 <dt><span class="sect2"><a href=
1.38      dillo    10017:                 "#undeletable-packages">15.1.7. Packages which
1.30      wiz      10018:                 should not be deleted, once
                   10019:                 installed</a></span></dt>
1.1       grant    10020: 
                   10021:                 <dt><span class="sect2"><a href=
1.38      dillo    10022:                 "#security-handling">15.1.8. Handling packages with
1.1       grant    10023:                 security problems</a></span></dt>
                   10024: 
                   10025:                 <dt><span class="sect2"><a href=
1.38      dillo    10026:                 "#compiler-bugs">15.1.9. How to handle compiler
1.1       grant    10027:                 bugs</a></span></dt>
                   10028: 
                   10029:                 <dt><span class="sect2"><a href=
1.38      dillo    10030:                 "#bumping-pkgrevision">15.1.10. How to handle
1.30      wiz      10031:                 incrementing versions when fixing an existing
1.1       grant    10032:                 package</a></span></dt>
                   10033: 
                   10034:                 <dt><span class="sect2"><a href=
1.38      dillo    10035:                 "#portability-of-packages">15.1.11. Portability of
1.1       grant    10036:                 packages</a></span></dt>
                   10037:               </dl>
                   10038:             </dd>
                   10039: 
1.30      wiz      10040:             <dt><span class="sect1"><a href=
1.38      dillo    10041:             "#downloading-issues">15.2. Possible downloading
1.30      wiz      10042:             issues</a></span></dt>
1.1       grant    10043: 
                   10044:             <dd>
                   10045:               <dl>
                   10046:                 <dt><span class="sect2"><a href=
1.38      dillo    10047:                 "#no-plain-download">15.2.1. Packages whose
1.30      wiz      10048:                 distfiles aren't available for plain
1.1       grant    10049:                 downloading</a></span></dt>
                   10050: 
                   10051:                 <dt><span class="sect2"><a href=
1.38      dillo    10052:                 "#modified-distfiles-same-name">15.2.2. How to
1.30      wiz      10053:                 handle modified distfiles with the 'old'
                   10054:                 name</a></span></dt>
1.1       grant    10055:               </dl>
                   10056:             </dd>
                   10057: 
1.30      wiz      10058:             <dt><span class="sect1"><a href=
1.38      dillo    10059:             "#configuration-gotchas">15.3. Configuration
1.30      wiz      10060:             gotchas</a></span></dt>
1.1       grant    10061: 
                   10062:             <dd>
                   10063:               <dl>
                   10064:                 <dt><span class="sect2"><a href=
1.38      dillo    10065:                 "#fixes.libtool">15.3.1. Shared libraries -
1.1       grant    10066:                 libtool</a></span></dt>
                   10067: 
                   10068:                 <dt><span class="sect2"><a href=
1.38      dillo    10069:                 "#using-libtool">15.3.2. Using libtool on GNU
1.30      wiz      10070:                 packages that already support
                   10071:                 libtool</a></span></dt>
1.1       grant    10072: 
                   10073:                 <dt><span class="sect2"><a href=
1.38      dillo    10074:                 "#autoconf-automake">15.3.3. GNU
1.1       grant    10075:                 Autoconf/Automake</a></span></dt>
                   10076:               </dl>
                   10077:             </dd>
                   10078: 
1.30      wiz      10079:             <dt><span class="sect1"><a href=
1.38      dillo    10080:             "#building-considerations">15.4. Building
1.30      wiz      10081:             considerations</a></span></dt>
1.1       grant    10082: 
                   10083:             <dd>
                   10084:               <dl>
                   10085:                 <dt><span class="sect2"><a href=
1.38      dillo    10086:                 "#cpp-defines">15.4.1. CPP defines</a></span></dt>
1.1       grant    10087:               </dl>
                   10088:             </dd>
                   10089: 
1.30      wiz      10090:             <dt><span class="sect1"><a href=
1.38      dillo    10091:             "#package-specific-actions">15.5. Package specific
1.30      wiz      10092:             actions</a></span></dt>
1.1       grant    10093: 
                   10094:             <dd>
                   10095:               <dl>
                   10096:                 <dt><span class="sect2"><a href=
1.38      dillo    10097:                 "#user-interaction">15.5.1. User
1.2       hubertf  10098:                 interaction</a></span></dt>
1.1       grant    10099: 
                   10100:                 <dt><span class="sect2"><a href=
1.38      dillo    10101:                 "#handling-licenses">15.5.2. Handling
1.1       grant    10102:                 licenses</a></span></dt>
                   10103: 
                   10104:                 <dt><span class="sect2"><a href=
1.38      dillo    10105:                 "#installing-score-files">15.5.3. Installing score
1.1       grant    10106:                 files</a></span></dt>
                   10107: 
                   10108:                 <dt><span class="sect2"><a href=
1.38      dillo    10109:                 "#perl-scripts">15.5.4. Packages containing perl
1.1       grant    10110:                 scripts</a></span></dt>
                   10111: 
                   10112:                 <dt><span class="sect2"><a href=
1.38      dillo    10113:                 "#hardcoded-paths">15.5.5. Packages with hardcoded
1.30      wiz      10114:                 paths to other interpreters</a></span></dt>
1.1       grant    10115: 
                   10116:                 <dt><span class="sect2"><a href=
1.38      dillo    10117:                 "#perl-modules">15.5.6. Packages installing perl
1.1       grant    10118:                 modules</a></span></dt>
                   10119: 
                   10120:                 <dt><span class="sect2"><a href=
1.38      dillo    10121:                 "#faq.info-files">15.5.7. Packages installing info
1.1       grant    10122:                 files</a></span></dt>
                   10123: 
                   10124:                 <dt><span class="sect2"><a href=
1.38      dillo    10125:                 "#gconf2-data-files">15.5.8. Packages installing
1.30      wiz      10126:                 GConf2 data files</a></span></dt>
1.1       grant    10127: 
                   10128:                 <dt><span class="sect2"><a href=
1.38      dillo    10129:                 "#scrollkeeper-data-files">15.5.9. Packages
1.30      wiz      10130:                 installing scrollkeeper data files</a></span></dt>
1.1       grant    10131: 
                   10132:                 <dt><span class="sect2"><a href=
1.38      dillo    10133:                 "#x11-fonts">15.5.10. Packages installing X11
1.1       grant    10134:                 fonts</a></span></dt>
                   10135: 
                   10136:                 <dt><span class="sect2"><a href=
1.38      dillo    10137:                 "#gtk2-modules">15.5.11. Packages installing GTK2
1.1       grant    10138:                 modules</a></span></dt>
                   10139: 
                   10140:                 <dt><span class="sect2"><a href=
1.38      dillo    10141:                 "#sgml-xml-data">15.5.12. Packages installing SGML
1.30      wiz      10142:                 or XML data</a></span></dt>
1.1       grant    10143: 
                   10144:                 <dt><span class="sect2"><a href=
1.38      dillo    10145:                 "#mime-database">15.5.13. Packages installing
1.1       grant    10146:                 extensions to the MIME database</a></span></dt>
                   10147: 
                   10148:                 <dt><span class="sect2"><a href=
1.38      dillo    10149:                 "#intltool">15.5.14. Packages using
1.1       grant    10150:                 intltool</a></span></dt>
1.18      xtraeme  10151: 
                   10152:                 <dt><span class="sect2"><a href=
1.38      dillo    10153:                 "#startup-scripts">15.5.15. Packages installing
1.30      wiz      10154:                 startup scripts</a></span></dt>
1.1       grant    10155:               </dl>
                   10156:             </dd>
                   10157: 
1.30      wiz      10158:             <dt><span class="sect1"><a href=
1.38      dillo    10159:             "#feedback-to-author">15.6. Feedback to the
1.30      wiz      10160:             author</a></span></dt>
1.1       grant    10161:           </dl>
                   10162:         </div>
                   10163: 
                   10164:         <div class="sect1" lang="en" xml:lang="en">
                   10165:           <div class="titlepage">
                   10166:             <div>
                   10167:               <div>
                   10168:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      10169:                 "general-operation" id=
1.38      dillo    10170:                 "general-operation"></a>15.1.&nbsp;General
1.1       grant    10171:                 operation</h2>
                   10172:               </div>
                   10173:             </div>
                   10174:           </div>
                   10175: 
                   10176:           <div class="sect2" lang="en" xml:lang="en">
                   10177:             <div class="titlepage">
                   10178:               <div>
                   10179:                 <div>
1.30      wiz      10180:                   <h3 class="title"><a name=
                   10181:                   "pulling-vars-from-etc-mk.conf" id=
1.38      dillo    10182:                   "pulling-vars-from-etc-mk.conf"></a>15.1.1.&nbsp;How
1.30      wiz      10183:                   to pull in variables from /etc/mk.conf</h3>
1.1       grant    10184:                 </div>
                   10185:               </div>
                   10186:             </div>
                   10187: 
                   10188:             <p>The problem with package-defined variables that can
1.14      xtraeme  10189:             be overridden via <code class="varname">MAKECONF</code>
                   10190:             or <code class="filename">/etc/mk.conf</code> is that
                   10191:             <a href=
1.1       grant    10192:             "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   10193:             <span class="citerefentry"><span class=
                   10194:             "refentrytitle">make</span>(1)</span></a> expands a
                   10195:             variable as it is used, but evaluates preprocessor like
                   10196:             statements (.if, .ifdef and .ifndef) as they are read.
1.14      xtraeme  10197:             So, to use any variable (which may be set in
                   10198:             <code class="filename">/etc/mk.conf</code>) in one of
                   10199:             the .if* statements, the file <code class=
                   10200:             "filename">/etc/mk.conf</code> must be included before
1.1       grant    10201:             that .if* statement.</p>
                   10202: 
                   10203:             <p>Rather than have a number of ad-hoc ways of
1.14      xtraeme  10204:             including <code class="filename">/etc/mk.conf</code>,
                   10205:             should it exist, or <code class=
                   10206:             "varname">MAKECONF</code>, should it exist, include the
                   10207:             <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
                   10208:             file in the package Makefile before any
                   10209:             preprocessor-like .if, .ifdef, or .ifndef
                   10210:             statements:</p>
1.1       grant    10211:             <pre class="programlisting">
                   10212: .include "../../mk/bsd.prefs.mk"
                   10213:     
                   10214:     .if defined(USE_MENUS)
                   10215:       ...
                   10216:     .endif
                   10217: </pre>
                   10218: 
1.14      xtraeme  10219:             <p>If you wish to set the <code class=
                   10220:             "varname">CFLAGS</code> variable in <code class=
                   10221:             "filename">/etc/mk.conf</code> please make sure to
1.1       grant    10222:             use:</p>
                   10223:             <pre class="programlisting">
                   10224: CFLAGS+=  -your -flags
                   10225: </pre>
                   10226: 
1.14      xtraeme  10227:             <p>Using <code class="varname">CFLAGS=</code> (i.e.
                   10228:             without the &#8220;<span class="quote">+</span>&#8221;)
                   10229:             may lead to problems with packages that need to add
                   10230:             their own flags. Also, you may want to take a look at
                   10231:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1       grant    10232:             href=
                   10233:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.20      ben      10234:             class="pkgname">devel/cpuflags</a> package if you're
                   10235:             interested in optimization for the current CPU.</p>
1.1       grant    10236:           </div>
                   10237: 
                   10238:           <div class="sect2" lang="en" xml:lang="en">
                   10239:             <div class="titlepage">
                   10240:               <div>
                   10241:                 <div>
1.31      wiz      10242:                   <h3 class="title"><a name=
                   10243:                   "where-to-install-documentation" id=
1.38      dillo    10244:                   "where-to-install-documentation"></a>15.1.2.&nbsp;Where
1.31      wiz      10245:                   to install documentation</h3>
                   10246:                 </div>
                   10247:               </div>
                   10248:             </div>
                   10249: 
                   10250:             <p>Documentation should be installed into <code class=
                   10251:             "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
                   10252:             <code class=
                   10253:             "filename">${PREFIX}/share/doc/${PKGNAME}</code> (the
                   10254:             latter includes the version number of the package).</p>
                   10255:           </div>
                   10256: 
                   10257:           <div class="sect2" lang="en" xml:lang="en">
                   10258:             <div class="titlepage">
                   10259:               <div>
                   10260:                 <div>
1.30      wiz      10261:                   <h3 class="title"><a name="restricted-packages"
                   10262:                   id=
1.38      dillo    10263:                   "restricted-packages"></a>15.1.3.&nbsp;Restricted
1.1       grant    10264:                   packages</h3>
                   10265:                 </div>
                   10266:               </div>
                   10267:             </div>
                   10268: 
                   10269:             <p>Some licenses restrict how software may be
                   10270:             re-distributed. In order to satisfy these restrictions,
                   10271:             the package system defines five make variables that can
                   10272:             be set to note these restrictions:</p>
                   10273: 
                   10274:             <div class="itemizedlist">
                   10275:               <ul type="disc">
                   10276:                 <li>
1.14      xtraeme  10277:                   <p><code class="varname">RESTRICTED</code></p>
1.1       grant    10278: 
                   10279:                   <p>This variable should be set whenever a
                   10280:                   restriction exists (regardless of its kind). Set
                   10281:                   this variable to a string containing the reason
                   10282:                   for the restriction.</p>
                   10283:                 </li>
                   10284: 
                   10285:                 <li>
1.14      xtraeme  10286:                   <p><code class=
                   10287:                   "varname">NO_BIN_ON_CDROM</code></p>
1.1       grant    10288: 
                   10289:                   <p>Binaries may not be placed on CD-ROM. Set this
1.14      xtraeme  10290:                   variable to <code class=
                   10291:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    10292:                   package may not be included on a CD-ROM.</p>
                   10293:                 </li>
                   10294: 
                   10295:                 <li>
1.14      xtraeme  10296:                   <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1       grant    10297: 
                   10298:                   <p>Binaries may not be placed on an FTP server.
1.14      xtraeme  10299:                   Set this variable to <code class=
                   10300:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    10301:                   package may not not be made available on the
                   10302:                   Internet.</p>
                   10303:                 </li>
                   10304: 
                   10305:                 <li>
1.14      xtraeme  10306:                   <p><code class=
                   10307:                   "varname">NO_SRC_ON_CDROM</code></p>
1.1       grant    10308: 
                   10309:                   <p>Distfiles may not be placed on CD-ROM. Set
1.14      xtraeme  10310:                   this variable to <code class=
                   10311:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    10312:                   of the source code or other distfile(s) is not
                   10313:                   allowed on CD-ROMs.</p>
                   10314:                 </li>
                   10315: 
                   10316:                 <li>
1.14      xtraeme  10317:                   <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1       grant    10318: 
                   10319:                   <p>Distfiles may not be placed on FTP. Set this
1.14      xtraeme  10320:                   variable to <code class=
                   10321:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    10322:                   of the source code or other distfile(s) via the
                   10323:                   Internet is not allowed.</p>
                   10324:                 </li>
                   10325:               </ul>
                   10326:             </div>
                   10327: 
1.14      xtraeme  10328:             <p>Please note that the use of <code class=
                   10329:             "varname">NO_PACKAGE</code>, <code class=
                   10330:             "varname">IGNORE</code>, <code class=
                   10331:             "varname">NO_CDROM</code>, or other generic make
1.1       grant    10332:             variables to denote restrictions is deprecated, because
                   10333:             they unconditionally prevent users from generating
                   10334:             binary packages!</p>
                   10335:           </div>
                   10336: 
                   10337:           <div class="sect2" lang="en" xml:lang="en">
                   10338:             <div class="titlepage">
                   10339:               <div>
                   10340:                 <div>
                   10341:                   <h3 class="title"><a name="dependencies" id=
1.38      dillo    10342:                   "dependencies"></a>15.1.4.&nbsp;Handling
1.1       grant    10343:                   dependencies</h3>
                   10344:                 </div>
                   10345:               </div>
                   10346:             </div>
                   10347: 
                   10348:             <p>Your package may depend on some other package being
                   10349:             present - and there are various ways of expressing this
1.14      xtraeme  10350:             dependency. pkgsrc supports the <code class=
                   10351:             "varname">BUILD_DEPENDS</code> and <code class=
                   10352:             "varname">DEPENDS</code> definitions, as well as
                   10353:             dependencies via <code class=
                   10354:             "filename">buildlink3.mk</code>, which is the preferred
1.1       grant    10355:             way to handle dependencies, and which uses the
                   10356:             variables named above. See <a href="#buildlink" title=
1.38      dillo    10357:             "Chapter&nbsp;11.&nbsp;Buildlink methodology">Chapter&nbsp;11,
1.1       grant    10358:             <i>Buildlink methodology</i></a> for more
                   10359:             information.</p>
                   10360: 
                   10361:             <p>The basic difference between the two variables is as
1.14      xtraeme  10362:             follows: The <code class="varname">DEPENDS</code>
1.1       grant    10363:             definition registers that pre-requisite in the binary
                   10364:             package so it will be pulled in when the binary package
1.14      xtraeme  10365:             is later installed, whilst the <code class=
                   10366:             "varname">BUILD_DEPENDS</code> definition does not,
1.1       grant    10367:             marking a dependency that is only needed for building
                   10368:             the package.</p>
                   10369: 
                   10370:             <p>This means that if you only need a package present
                   10371:             whilst you are building, it should be noted as a
1.14      xtraeme  10372:             <code class="varname">BUILD_DEPENDS</code>.</p>
1.1       grant    10373: 
1.14      xtraeme  10374:             <p>The format for a <code class=
                   10375:             "varname">BUILD_DEPENDS</code> and a <code class=
                   10376:             "varname">DEPENDS</code> definition is:</p>
1.1       grant    10377:             <pre class="programlisting">
                   10378: &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
                   10379: </pre>
                   10380: 
                   10381:             <p>Please note that the &#8220;<span class=
                   10382:             "quote">pre-req-package-name</span>&#8221; may include
1.18      xtraeme  10383:             any of the wildcard version numbers recognized by
1.1       grant    10384:             <a href=
                   10385:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   10386:             <span class="citerefentry"><span class=
                   10387:             "refentrytitle">pkg_info</span>(1)</span></a>.</p>
                   10388: 
                   10389:             <div class="orderedlist">
                   10390:               <ol type="1">
                   10391:                 <li>
                   10392:                   <p>If your package needs another package's
                   10393:                   binaries or libraries to build or run, and if
1.14      xtraeme  10394:                   that package has a <code class=
                   10395:                   "filename">buildlink3.mk</code> file available,
                   10396:                   use it:</p>
1.1       grant    10397:                   <pre class="programlisting">
                   10398:     .include "../../graphics/jpeg/buildlink3.mk"
                   10399:     
                   10400: </pre>
                   10401:                 </li>
                   10402: 
                   10403:                 <li>
                   10404:                   <p>If your package needs to use another package
1.14      xtraeme  10405:                   to build itself and there is no <code class=
                   10406:                   "filename">buildlink3.mk</code> file available,
                   10407:                   use the <code class=
                   10408:                   "varname">BUILD_DEPENDS</code> definition:</p>
1.1       grant    10409:                   <pre class="programlisting">
                   10410: BUILD_DEPENDS+=  autoconf-2.13:../../devel/autoconf
                   10411: </pre>
                   10412:                 </li>
                   10413: 
                   10414:                 <li>
                   10415:                   <p>If your package needs a library with which to
1.14      xtraeme  10416:                   link and again there is no <code class=
                   10417:                   "filename">buildlink3.mk</code> file available,
                   10418:                   this is specified using the <code class=
                   10419:                   "varname">DEPENDS</code> definition. An example
                   10420:                   of this is the <a xmlns=
1.1       grant    10421:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   10422:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20      ben      10423:                   class="pkgname">print/lyx</a> package, which uses
                   10424:                   the xpm library, version 3.4j to build:</p>
1.1       grant    10425:                   <pre class="programlisting">
                   10426: DEPENDS+=       xpm-3.4j:../../graphics/xpm
                   10427: </pre>
                   10428: 
                   10429:                   <p>You can also use wildcards in package
                   10430:                   dependences:</p>
                   10431:                   <pre class="programlisting">
                   10432: DEPENDS+=       xpm-[0-9]*:../../graphics/xpm
                   10433: </pre>
                   10434: 
                   10435:                   <p>Note that such wildcard dependencies are
                   10436:                   retained when creating binary packages. The
                   10437:                   dependency is checked when installing the binary
                   10438:                   package and any package which matches the pattern
                   10439:                   will be used. Wildcard dependencies should be
                   10440:                   used with care.</p>
                   10441: 
                   10442:                   <p>The &#8220;<span class=
                   10443:                   "quote">-[0-9]*</span>&#8221; should be used
                   10444:                   instead of &#8220;<span class=
                   10445:                   "quote">-*</span>&#8221; to avoid potentially
                   10446:                   ambiguous matches such as &#8220;<span class=
                   10447:                   "quote">tk-postgresql</span>&#8221; matching a
                   10448:                   &#8220;<span class="quote">tk-*</span>&#8221;
1.14      xtraeme  10449:                   <code class="varname">DEPENDS</code>.</p>
1.1       grant    10450: 
                   10451:                   <p>Wildcards can also be used to specify that a
                   10452:                   package will only build against a certain minimum
                   10453:                   version of a pre-requisite:</p>
                   10454:                   <pre class="programlisting">
                   10455: DEPENDS+=       tiff&gt;=3.5.4:../../graphics/tiff
                   10456: </pre>
                   10457: 
                   10458:                   <p>This means that the package will build against
                   10459:                   version 3.5.4 of the tiff library or newer. Such
                   10460:                   a dependency may be warranted if, for example,
                   10461:                   the API of the library has changed with version
                   10462:                   3.5.4 and a package would not compile against an
                   10463:                   earlier version of tiff.</p>
                   10464: 
                   10465:                   <p>Please note that such dependencies should only
                   10466:                   be updated if a package requires a newer
                   10467:                   pre-requisite, but not to denote recommendations
                   10468:                   such as security updates or ABI changes that do
                   10469:                   not prevent a package from building correctly.
                   10470:                   Such recommendations can be expressed using
1.14      xtraeme  10471:                   <code class="varname">RECOMMENDED</code>:</p>
1.1       grant    10472:                   <pre class="programlisting">
                   10473: RECOMMENDED+=   tiff&gt;=3.6.1:../../graphics/tiff
                   10474: </pre>
                   10475: 
1.14      xtraeme  10476:                   <p>In addition to the above <code class=
                   10477:                   "varname">DEPENDS</code> line, this denotes that
1.1       grant    10478:                   while a package will build against
                   10479:                   tiff&gt;=3.5.4, at least version 3.6.1 is
1.14      xtraeme  10480:                   recommended. <code class=
                   10481:                   "varname">RECOMMENDED</code> entries will be
                   10482:                   turned into dependencies unless explicitly
                   10483:                   ignored (in which case a warning will be
1.36      wiz      10484:                   printed).</p>
                   10485: 
                   10486:                   <p>To ignore these dependency recommendations and
                   10487:                   just use the required <code class=
                   10488:                   "varname">DEPENDS</code>, set <code class=
                   10489:                   "varname">IGNORE_RECOMMENDED=YES</code>. This may
                   10490:                   make it easier and faster to update packages
                   10491:                   built using pkgsrc, since older compatible
                   10492:                   dependencies can continue to be used. This is
                   10493:                   useful for people who watch their rebuilds very
                   10494:                   carefully; it is not very good as a
                   10495:                   general-purpose hammer. If you use it, you need
                   10496:                   to be mindful of possible ABI changes, including
                   10497:                   those from the underlying OS.</p>
                   10498: 
                   10499:                   <p>Packages that are built with recommendations
                   10500:                   ignored may not be uploaded to ftp.NetBSD.org by
                   10501:                   developers and should not be used across
                   10502:                   different systems that may have different
                   10503:                   versions of binary packages installed.</p>
1.1       grant    10504: 
                   10505:                   <p>For security fixes, please update the package
                   10506:                   vulnerabilities file as well as setting
1.14      xtraeme  10507:                   <code class="varname">RECOMMENDED</code>, see
1.1       grant    10508:                   <a href="#security-handling" title=
1.38      dillo    10509:                   "15.1.8.&nbsp;Handling packages with security problems">
                   10510:                   Section 15.1.8, &#8220;Handling packages with
1.1       grant    10511:                   security problems&#8221;</a> for more
                   10512:                   information.</p>
                   10513:                 </li>
                   10514: 
                   10515:                 <li>
                   10516:                   <p>If your package needs some executable to be
1.17      sketch   10517:                   able to run correctly and if there's no
1.14      xtraeme  10518:                   <code class="filename">buildlink3.mk</code> file,
                   10519:                   this is specified using the <code class=
                   10520:                   "varname">DEPENDS</code> variable. The <a xmlns=
1.1       grant    10521:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   10522:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20      ben      10523:                   class="pkgname">print/lyx</a> package needs to be
                   10524:                   able to execute the latex binary from the teTeX
                   10525:                   package when it runs, and that is specified:</p>
1.1       grant    10526:                   <pre class="programlisting">
                   10527: DEPENDS+=        teTeX-[0-9]*:../../print/teTeX
                   10528: </pre>
                   10529: 
                   10530:                   <p>The comment about wildcard dependencies from
                   10531:                   previous paragraph applies here, too.</p>
                   10532:                 </li>
                   10533:               </ol>
                   10534:             </div>
                   10535: 
                   10536:             <p>If your package needs files from another package to
                   10537:             build, see the first part of the &#8220;<span class=
                   10538:             "quote">do-configure</span>&#8221; target <a xmlns=
                   10539:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10540:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.20      ben      10541:             class="pkgname">print/ghostscript5</a> package (it
                   10542:             relies on the jpeg sources being present in source form
                   10543:             during the build):</p>
1.1       grant    10544:             <pre class="programlisting">
                   10545: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
                   10546:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} extract;              \
                   10547:     fi
                   10548: </pre>
                   10549: 
                   10550:             <p>If you build any other packages that way, please
                   10551:             make sure the working files are deleted too when this
                   10552:             package's working files are cleaned up. The easiest way
                   10553:             to do so is by adding a pre-clean target:</p>
                   10554:             <pre class="programlisting">
                   10555: pre-clean:
                   10556:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} clean
                   10557: </pre>
                   10558: 
1.14      xtraeme  10559:             <p>Please also note the <code class=
                   10560:             "varname">BUILD_USES_MSGFMT</code> and <code class=
                   10561:             "varname">BUILD_USES_GETTEXT_M4</code> definitions,
                   10562:             which are provided as convenience definitions. The
1.24      wiz      10563:             former works out whether <a href=
                   10564:             "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
                   10565:             <span class="citerefentry"><span class=
                   10566:             "refentrytitle">msgfmt</span>(1)</span></a> is part of
                   10567:             the base system, and, if it isn't, installs the
                   10568:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10569:             href=
1.1       grant    10570:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.20      ben      10571:             class="pkgname">devel/gettext</a> package. The latter
                   10572:             adds a build dependency on either an installed version
                   10573:             of an older gettext package, or if it isn't, installs
                   10574:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10575:             href=
                   10576:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
                   10577:             class="pkgname">devel/gettext-m4</a> package.</p>
1.1       grant    10578:           </div>
                   10579: 
                   10580:           <div class="sect2" lang="en" xml:lang="en">
                   10581:             <div class="titlepage">
                   10582:               <div>
                   10583:                 <div>
1.30      wiz      10584:                   <h3 class="title"><a name="conflicts" id=
1.38      dillo    10585:                   "conflicts"></a>15.1.5.&nbsp;Handling conflicts
1.1       grant    10586:                   with other packages</h3>
                   10587:                 </div>
                   10588:               </div>
                   10589:             </div>
                   10590: 
                   10591:             <p>Your package may conflict with other packages a user
                   10592:             might already have installed on his system, e.g. if
                   10593:             your package installs the same set of files like
                   10594:             another package in our pkgsrc tree.</p>
                   10595: 
1.14      xtraeme  10596:             <p>In this case you can set <code class=
                   10597:             "varname">CONFLICTS</code> to a space separated list of
1.1       grant    10598:             packages (including version string) your package
                   10599:             conflicts with.</p>
                   10600: 
                   10601:             <p>For example <a xmlns=
                   10602:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10603:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.20      ben      10604:             class="pkgname">x11/Xaw3d</a> and <a xmlns=
                   10605:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10606:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
                   10607:             class="pkgname">x11/Xaw-Xpm</a> install provide the
                   10608:             same shared library, thus you set in <code class=
                   10609:             "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1       grant    10610:             <pre class="programlisting">
                   10611: CONFLICTS=      Xaw-Xpm-[0-9]*
                   10612: </pre>
                   10613: 
1.14      xtraeme  10614:             <p>and in <code class=
                   10615:             "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1       grant    10616:             <pre class="programlisting">
                   10617: CONFLICTS=      Xaw3d-[0-9]*
                   10618: </pre>
                   10619: 
                   10620:             <p>Packages will automatically conflict with other
                   10621:             packages with the name prefix and a different version
                   10622:             string. &#8220;<span class=
                   10623:             "quote">Xaw3d-1.5</span>&#8221; e.g. will automatically
                   10624:             conflict with the older version &#8220;<span class=
                   10625:             "quote">Xaw3d-1.3</span>&#8221;.</p>
                   10626:           </div>
                   10627: 
                   10628:           <div class="sect2" lang="en" xml:lang="en">
                   10629:             <div class="titlepage">
                   10630:               <div>
                   10631:                 <div>
1.30      wiz      10632:                   <h3 class="title"><a name="not-building-packages"
                   10633:                   id=
1.38      dillo    10634:                   "not-building-packages"></a>15.1.6.&nbsp;Packages
1.30      wiz      10635:                   that cannot or should not be built</h3>
1.1       grant    10636:                 </div>
                   10637:               </div>
                   10638:             </div>
                   10639: 
                   10640:             <p>There are several reasons why a package might be
                   10641:             instructed to not build under certain circumstances. If
                   10642:             the package builds and runs on most platforms, the
1.14      xtraeme  10643:             exceptions should be noted with <code class=
                   10644:             "varname">NOT_FOR_PLATFORM</code>. If the package
                   10645:             builds and runs on a small handful of platforms, set
                   10646:             <code class="varname">ONLY_FOR_PLATFORM</code> instead.
                   10647:             If the package should be skipped (for example, because
                   10648:             it provides functionality already provided by the
                   10649:             system), set <code class=
                   10650:             "varname">PKG_SKIP_REASON</code> to a descriptive
                   10651:             message. If the package should fail because some
                   10652:             preconditions are not met, set <code class=
                   10653:             "varname">PKG_FAIL_REASON</code> to a descriptive
1.1       grant    10654:             message.</p>
                   10655: 
1.14      xtraeme  10656:             <p><code class="varname">IGNORE</code> is deprecated
1.1       grant    10657:             because it didn't provide enough information to
                   10658:             determine whether the build should fail.</p>
                   10659:           </div>
                   10660: 
                   10661:           <div class="sect2" lang="en" xml:lang="en">
                   10662:             <div class="titlepage">
                   10663:               <div>
                   10664:                 <div>
1.30      wiz      10665:                   <h3 class="title"><a name="undeletable-packages"
                   10666:                   id=
1.38      dillo    10667:                   "undeletable-packages"></a>15.1.7.&nbsp;Packages
1.30      wiz      10668:                   which should not be deleted, once installed</h3>
1.1       grant    10669:                 </div>
                   10670:               </div>
                   10671:             </div>
                   10672: 
                   10673:             <p>To ensure that a package may not be deleted, once it
1.14      xtraeme  10674:             has been installed, the <code class=
                   10675:             "varname">PKG_PRESERVE</code> definition should be set
                   10676:             in the package Makefile. This will be carried into any
1.1       grant    10677:             binary package that is made from this pkgsrc entry. A
                   10678:             &#8220;<span class="quote">preserved</span>&#8221;
                   10679:             package will not be deleted using <a href=
                   10680:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   10681:             <span class="citerefentry"><span class=
                   10682:             "refentrytitle">pkg_delete</span>(1)</span></a> unless
                   10683:             the &#8220;<span class="quote">-f</span>&#8221; option
                   10684:             is used.</p>
                   10685:           </div>
                   10686: 
                   10687:           <div class="sect2" lang="en" xml:lang="en">
                   10688:             <div class="titlepage">
                   10689:               <div>
                   10690:                 <div>
                   10691:                   <h3 class="title"><a name="security-handling" id=
1.38      dillo    10692:                   "security-handling"></a>15.1.8.&nbsp;Handling
1.1       grant    10693:                   packages with security problems</h3>
                   10694:                 </div>
                   10695:               </div>
                   10696:             </div>
                   10697: 
                   10698:             <p>When a vulnerability is found, this should be noted
1.14      xtraeme  10699:             in <code class=
                   10700:             "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.43      wiz      10701:             and after committing that file, use
                   10702:             <span><strong class="command">make
                   10703:             upload</strong></span> in the same directory to update
                   10704:             the file on ftp.NetBSD.org.</p>
                   10705: 
                   10706:             <p>After fixing the vulnerability by a patch, its
                   10707:             <code class="varname">PKGREVISION</code> should be
                   10708:             increased (this is of course not necessary if the
                   10709:             problem is fixed by using a newer release of the
                   10710:             software). In addition, if a <code class=
1.14      xtraeme  10711:             "filename">buildlink3.mk</code> file exists for an
1.43      wiz      10712:             affected package, a corresponding <code class=
1.14      xtraeme  10713:             "varname">BUILDLINK_RECOMMENDED.<em class=
                   10714:             "replaceable"><code>pkg</code></em></code> entry should
1.43      wiz      10715:             be added or updated in it.</p>
1.1       grant    10716: 
                   10717:             <p>Also, if the fix should be applied to the stable
                   10718:             pkgsrc branch, be sure to submit a pullup request!</p>
1.43      wiz      10719: 
                   10720:             <p>Binary packages already on ftp.NetBSD.org will be
                   10721:             handled semi-automatically by a weekly cron job.</p>
1.1       grant    10722:           </div>
                   10723: 
                   10724:           <div class="sect2" lang="en" xml:lang="en">
                   10725:             <div class="titlepage">
                   10726:               <div>
                   10727:                 <div>
1.30      wiz      10728:                   <h3 class="title"><a name="compiler-bugs" id=
1.38      dillo    10729:                   "compiler-bugs"></a>15.1.9.&nbsp;How to handle
1.1       grant    10730:                   compiler bugs</h3>
                   10731:                 </div>
                   10732:               </div>
                   10733:             </div>
                   10734: 
                   10735:             <p>Some source files trigger bugs in the compiler,
                   10736:             based on combinations of compiler version and
                   10737:             architecture and almost always relation to optimisation
                   10738:             being enabled. Common symptoms are gcc internal errors
                   10739:             or never finishing compiling a file.</p>
                   10740: 
                   10741:             <p>Typically a workaround involves testing the
1.14      xtraeme  10742:             <code class="varname">MACHINE_ARCH</code> and compiler
1.1       grant    10743:             version, disabling optimisation for that
1.14      xtraeme  10744:             file/<code class="varname">MACHINE_ARCH</code>/compiler
                   10745:             combination, and documenting it in <code class=
                   10746:             "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1       grant    10747:             number of examples!</p>
                   10748:           </div>
                   10749: 
                   10750:           <div class="sect2" lang="en" xml:lang="en">
                   10751:             <div class="titlepage">
                   10752:               <div>
                   10753:                 <div>
1.30      wiz      10754:                   <h3 class="title"><a name="bumping-pkgrevision"
1.38      dillo    10755:                   id="bumping-pkgrevision"></a>15.1.10.&nbsp;How to
1.30      wiz      10756:                   handle incrementing versions when fixing an
                   10757:                   existing package</h3>
1.1       grant    10758:                 </div>
                   10759:               </div>
                   10760:             </div>
                   10761: 
                   10762:             <p>When making fixes to an existing package it can be
1.14      xtraeme  10763:             useful to change the version number in <code class=
                   10764:             "varname">PKGNAME</code>. To avoid conflicting with
1.1       grant    10765:             future versions by the original author, a
                   10766:             &#8220;<span class="quote">nb1</span>&#8221;,
                   10767:             &#8220;<span class="quote">nb2</span>&#8221;, ...
                   10768:             suffix can be used on package versions by setting
1.14      xtraeme  10769:             <code class="varname">PKGREVISION=1</code> (2, ...).
                   10770:             The &#8220;<span class="quote">nb</span>&#8221; is
                   10771:             treated like a &#8220;<span class=
                   10772:             "quote">.</span>&#8221; by the pkg tools. e.g.</p>
1.1       grant    10773:             <pre class="programlisting">
                   10774:   DISTNAME= foo-17.42
                   10775:     PKGREVISION=  9
                   10776: </pre>
                   10777: 
1.14      xtraeme  10778:             <p>will result in a <code class=
                   10779:             "varname">PKGNAME</code> of &#8220;<span class=
1.1       grant    10780:             "quote">foo-17.42nb9</span>&#8221;.</p>
                   10781: 
                   10782:             <p>When a new release of the package is released, the
1.14      xtraeme  10783:             <code class="varname">PKGREVISION</code> should be
                   10784:             removed. e.g. on a new minor release of the above
                   10785:             package, things should be like:</p>
1.1       grant    10786:             <pre class="programlisting">
                   10787: DISTNAME=   foo-17.43
                   10788: </pre>
                   10789:           </div>
                   10790: 
                   10791:           <div class="sect2" lang="en" xml:lang="en">
                   10792:             <div class="titlepage">
                   10793:               <div>
                   10794:                 <div>
1.30      wiz      10795:                   <h3 class="title"><a name=
                   10796:                   "portability-of-packages" id=
1.38      dillo    10797:                   "portability-of-packages"></a>15.1.11.&nbsp;Portability
1.30      wiz      10798:                   of packages</h3>
1.1       grant    10799:                 </div>
                   10800:               </div>
                   10801:             </div>
                   10802: 
                   10803:             <p>One appealing feature of pkgsrc is that it runs on
                   10804:             many different platforms. As a result, it is important
                   10805:             to ensure, where possible, that packages in pkgsrc are
                   10806:             portable. There are some particular details you should
                   10807:             pay attention to while working on pkgsrc.</p>
                   10808: 
                   10809:             <div class="sect3" lang="en" xml:lang="en">
                   10810:               <div class="titlepage">
                   10811:                 <div>
                   10812:                   <div>
1.30      wiz      10813:                     <h4 class="title"><a name="install-scripts" id=
1.38      dillo    10814:                     "install-scripts"></a>15.1.11.1.&nbsp;${INSTALL},
1.1       grant    10815:                     ${INSTALL_DATA_DIR}, ...</h4>
                   10816:                   </div>
                   10817:                 </div>
                   10818:               </div>
                   10819: 
1.14      xtraeme  10820:               <p>The BSD-compatible <span><strong class=
                   10821:               "command">install</strong></span> supplied with some
1.1       grant    10822:               operating systems will not perform more than one
                   10823:               operation at a time. As such, you should call
                   10824:               &#8220;<span class="quote">${INSTALL}</span>&#8221;,
                   10825:               etc. like this:</p>
                   10826:               <pre class="programlisting">
                   10827: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   10828: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
                   10829: </pre>
                   10830:             </div>
                   10831:           </div>
                   10832:         </div>
                   10833: 
                   10834:         <div class="sect1" lang="en" xml:lang="en">
                   10835:           <div class="titlepage">
                   10836:             <div>
                   10837:               <div>
                   10838:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      10839:                 "downloading-issues" id=
1.38      dillo    10840:                 "downloading-issues"></a>15.2.&nbsp;Possible
1.1       grant    10841:                 downloading issues</h2>
                   10842:               </div>
                   10843:             </div>
                   10844:           </div>
                   10845: 
                   10846:           <div class="sect2" lang="en" xml:lang="en">
                   10847:             <div class="titlepage">
                   10848:               <div>
                   10849:                 <div>
1.30      wiz      10850:                   <h3 class="title"><a name="no-plain-download" id=
1.38      dillo    10851:                   "no-plain-download"></a>15.2.1.&nbsp;Packages
1.30      wiz      10852:                   whose distfiles aren't available for plain
1.1       grant    10853:                   downloading</h3>
                   10854:                 </div>
                   10855:               </div>
                   10856:             </div>
                   10857: 
                   10858:             <p>If you need to download from a dynamic URL you can
1.14      xtraeme  10859:             set <code class="varname">DYNAMIC_MASTER_SITES</code>
                   10860:             and a <span><strong class="command">make
                   10861:             fetch</strong></span> will call <code class=
                   10862:             "filename">files/getsite.sh</code> with the name of
                   10863:             each file to download as an argument, expecting it to
                   10864:             output the URL of the directory from which to download
                   10865:             it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10866:             href=
1.1       grant    10867:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.20      ben      10868:             class="pkgname">graphics/ns-cult3d</a> is an example of
                   10869:             this usage.</p>
1.1       grant    10870: 
                   10871:             <p>If the download can't be automated, because the user
                   10872:             must submit personal information to apply for a
                   10873:             password, or must pay for the source, or whatever, you
1.14      xtraeme  10874:             can set <code class="varname">_FETCH_MESSAGE</code> to
                   10875:             a macro which displays a message explaining the
                   10876:             situation. <code class="varname">_FETCH_MESSAGE</code>
                   10877:             must be executable shell commands, not just a message.
                   10878:             (Generally, it executes <code class=
                   10879:             "varname">${ECHO}</code>). As of this writing, the
1.1       grant    10880:             following packages use this: <a xmlns=
                   10881:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.20      ben      10882:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
                   10883:             class="pkgname">cad/simian</a>, <a xmlns=
                   10884:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10885:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
                   10886:             class="pkgname">devel/ipv6socket</a>, <a xmlns=
                   10887:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10888:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
                   10889:             class="pkgname">emulators/vmware-module</a>, <a xmlns=
                   10890:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10891:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
                   10892:             class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
                   10893:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.43      wiz      10894:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/multimedia/realplayer/README.html"
                   10895:             class="pkgname">multimedia/realplayer</a>, <a xmlns=
                   10896:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.20      ben      10897:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
                   10898:             class="pkgname">sysutils/storage-manager</a>, <a xmlns=
                   10899:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10900:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
                   10901:             class="pkgname">www/ap-aolserver</a>, <a xmlns=
                   10902:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10903:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
                   10904:             class="pkgname">www/openacs</a>. Try to be consistent
                   10905:             with them.</p>
1.1       grant    10906:           </div>
                   10907: 
                   10908:           <div class="sect2" lang="en" xml:lang="en">
                   10909:             <div class="titlepage">
                   10910:               <div>
                   10911:                 <div>
1.30      wiz      10912:                   <h3 class="title"><a name=
                   10913:                   "modified-distfiles-same-name" id=
1.38      dillo    10914:                   "modified-distfiles-same-name"></a>15.2.2.&nbsp;How
1.30      wiz      10915:                   to handle modified distfiles with the 'old'
                   10916:                   name</h3>
1.1       grant    10917:                 </div>
                   10918:               </div>
                   10919:             </div>
                   10920: 
                   10921:             <p>Sometimes authors of a software package make some
                   10922:             modifications after the software was released, and they
                   10923:             put up a new distfile without changing the package's
                   10924:             version number. If a package is already in pkgsrc at
1.32      wiz      10925:             that time, the checksum will no longer match. The
                   10926:             contents of the new distfile should be compared against
                   10927:             the old one before changing anything, to make sure the
                   10928:             distfile was really updated on purpose, and that no
                   10929:             trojan horse or so crept in. Then, the correct way to
                   10930:             work around this is to set <code class=
                   10931:             "varname">DIST_SUBDIR</code> to a unique directory
                   10932:             name, usually based on <code class=
                   10933:             "varname">PKGNAME_NOREV</code>. In case this happens
                   10934:             more often, <code class="varname">PKGNAME</code> can be
                   10935:             used (thus including the <code class=
                   10936:             "filename">nbX</code> suffix) or a date stamp can be
                   10937:             appended, like <code class=
                   10938:             "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
                   10939:             forget regenerating the <code class=
                   10940:             "filename">distinfo</code> file after that, since it
                   10941:             contains the <code class="varname">DIST_SUBDIR</code>
                   10942:             path in the filenames. Furthermore, a mail to the
                   10943:             package's authors seems appropriate telling them that
                   10944:             changing distfiles after releases without changing the
                   10945:             file names is not good practice.</p>
1.1       grant    10946:           </div>
                   10947:         </div>
                   10948: 
                   10949:         <div class="sect1" lang="en" xml:lang="en">
                   10950:           <div class="titlepage">
                   10951:             <div>
                   10952:               <div>
                   10953:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      10954:                 "configuration-gotchas" id=
1.38      dillo    10955:                 "configuration-gotchas"></a>15.3.&nbsp;Configuration
1.1       grant    10956:                 gotchas</h2>
                   10957:               </div>
                   10958:             </div>
                   10959:           </div>
                   10960: 
                   10961:           <div class="sect2" lang="en" xml:lang="en">
                   10962:             <div class="titlepage">
                   10963:               <div>
                   10964:                 <div>
                   10965:                   <h3 class="title"><a name="fixes.libtool" id=
1.38      dillo    10966:                   "fixes.libtool"></a>15.3.1.&nbsp;Shared libraries
1.1       grant    10967:                   - libtool</h3>
                   10968:                 </div>
                   10969:               </div>
                   10970:             </div>
                   10971: 
                   10972:             <p>pkgsrc supports many different machines, with
                   10973:             different object formats like a.out and ELF, and
                   10974:             varying abilities to do shared library and dynamic
                   10975:             loading at all. To accompany this, varying commands and
                   10976:             options have to be passed to the compiler, linker, etc.
                   10977:             to get the Right Thing, which can be pretty annoying
                   10978:             especially if you don't have all the machines at your
                   10979:             hand to test things. The <a xmlns=
                   10980:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10981:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.20      ben      10982:             class="pkgname">devel/libtool</a> pkg can help here, as
                   10983:             it just &#8220;<span class="quote">knows</span>&#8221;
                   10984:             how to build both static and dynamic libraries from a
                   10985:             set of source files, thus being platform
                   10986:             independent.</p>
1.1       grant    10987: 
                   10988:             <p>Here's how to use libtool in a pkg in seven simple
                   10989:             steps:</p>
                   10990: 
                   10991:             <div class="orderedlist">
                   10992:               <ol type="1">
                   10993:                 <li>
1.14      xtraeme  10994:                   <p>Add <code class=
                   10995:                   "varname">USE_LIBTOOL=yes</code> to the package
                   10996:                   Makefile.</p>
1.1       grant    10997:                 </li>
                   10998: 
                   10999:                 <li>
                   11000:                   <p>For library objects, use &#8220;<span class=
                   11001:                   "quote">${LIBTOOL} --mode=compile
                   11002:                   ${CC}</span>&#8221; in place of
                   11003:                   &#8220;<span class="quote">${CC}</span>&#8221;.
                   11004:                   You could even add it to the definition of
1.14      xtraeme  11005:                   <code class="varname">CC</code>, if only
                   11006:                   libraries are being built in a given Makefile.
                   11007:                   This one command will build both PIC and non-PIC
                   11008:                   library objects, so you need not have separate
                   11009:                   shared and non-shared library rules.</p>
1.1       grant    11010:                 </li>
                   11011: 
                   11012:                 <li>
                   11013:                   <p>For the linking of the library, remove any
                   11014:                   &#8220;<span class="quote">ar</span>&#8221;,
                   11015:                   &#8220;<span class="quote">ranlib</span>&#8221;,
                   11016:                   and &#8220;<span class="quote">ld
                   11017:                   -Bshareable</span>&#8221; commands, and instead
                   11018:                   use:</p>
                   11019:                   <pre class="programlisting">
                   11020: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
                   11021: </pre>
                   11022: 
                   11023:                   <p>Note that the library is changed to have a
1.14      xtraeme  11024:                   <code class="filename">.la</code> extension, and
                   11025:                   the objects are changed to have a <code class=
                   11026:                   "filename">.lo</code> extension. Change
                   11027:                   <code class="varname">OBJS</code> as necessary.
                   11028:                   This automatically creates all of the
                   11029:                   <code class="filename">.a</code>, <code class=
                   11030:                   "filename">.so.major.minor</code>, and ELF
                   11031:                   symlinks (if necessary) in the build directory.
                   11032:                   Be sure to include &#8220;<span class=
1.1       grant    11033:                   "quote">-version-info</span>&#8221;, especially
                   11034:                   when major and minor are zero, as libtool will
                   11035:                   otherwise strip off the shared library
                   11036:                   version.</p>
                   11037: 
                   11038:                   <p>From the libtool manual:</p>
                   11039:                   <pre class="programlisting">
                   11040:      So, libtool library versions are described by three integers:
                   11041: 
                   11042: CURRENT
                   11043:        The most recent interface number that this library implements.
                   11044: 
                   11045: REVISION
                   11046:        The implementation number of the CURRENT interface.
                   11047: 
                   11048: AGE
                   11049:        The difference between the newest and oldest interfaces that this
                   11050:        library implements.  In other words, the library implements all the
                   11051:        interface numbers in the range from number `CURRENT - AGE' to
                   11052:        `CURRENT'.
                   11053:        
                   11054:      If two libraries have identical CURRENT and AGE numbers, then the
                   11055: dynamic linker chooses the library with the greater REVISION number. 
                   11056: </pre>
                   11057: 
                   11058:                   <p>The &#8220;<span class=
                   11059:                   "quote">-release</span>&#8221; option will
                   11060:                   produce different results for a.out and ELF
                   11061:                   (excluding symlinks) in only one case. An ELF
                   11062:                   library of the form &#8220;<span class=
                   11063:                   "quote">libfoo-release.so.<span class=
                   11064:                   "emphasis"><em>x</em></span>.<span class=
                   11065:                   "emphasis"><em>y</em></span></span>&#8221; will
                   11066:                   have a symlink of &#8220;<span class=
                   11067:                   "quote">libfoo.so.<span class=
                   11068:                   "emphasis"><em>x</em></span>.<span class=
                   11069:                   "emphasis"><em>y</em></span></span>&#8221; on an
                   11070:                   a.out platform. This is handled
                   11071:                   automatically.</p>
                   11072: 
                   11073:                   <p>The &#8220;<span class="quote">-rpath
                   11074:                   argument</span>&#8221; is the install directory
                   11075:                   of the library being built.</p>
                   11076: 
1.14      xtraeme  11077:                   <p>In the <code class="filename">PLIST</code>,
1.19      hubertf  11078:                   include only the <code class=
                   11079:                   "filename">.la</code> file, the other files will
                   11080:                   be added automatically.</p>
1.1       grant    11081:                 </li>
                   11082: 
                   11083:                 <li>
1.14      xtraeme  11084:                   <p>When linking shared object (<code class=
                   11085:                   "filename">.so</code>) files, i.e. files that are
1.24      wiz      11086:                   loaded via <a href=
                   11087:                   "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
                   11088:                   <span class="citerefentry"><span class=
                   11089:                   "refentrytitle">dlopen</span>(3)</span></a>, NOT
                   11090:                   shared libraries, use &#8220;<span class=
                   11091:                   "quote">-module -avoid-version</span>&#8221; to
                   11092:                   prevent them getting version tacked on.</p>
1.1       grant    11093: 
1.14      xtraeme  11094:                   <p>The <code class="filename">PLIST</code> file
                   11095:                   gets the <code class="filename">foo.so</code>
                   11096:                   entry.</p>
1.1       grant    11097:                 </li>
                   11098: 
                   11099:                 <li>
                   11100:                   <p>When linking programs that depend on these
                   11101:                   libraries <span class=
                   11102:                   "emphasis"><em>before</em></span> they are
                   11103:                   installed, preface the <a href=
                   11104:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
                   11105:                   <span class="citerefentry"><span class=
                   11106:                   "refentrytitle">cc</span>(1)</span></a> or
                   11107:                   <a href=
                   11108:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   11109:                   <span class="citerefentry"><span class=
                   11110:                   "refentrytitle">ld</span>(1)</span></a> line with
                   11111:                   &#8220;<span class="quote">${LIBTOOL}
                   11112:                   --mode=link</span>&#8221;, and it will find the
                   11113:                   correct libraries (static or shared), but please
                   11114:                   be aware that libtool will not allow you to
                   11115:                   specify a relative path in -L (such as
                   11116:                   &#8220;<span class=
                   11117:                   "quote">-L../somelib</span>&#8221;), because it
                   11118:                   expects you to change that argument to be the
1.14      xtraeme  11119:                   <code class="filename">.la</code> file. e.g.</p>
1.1       grant    11120:                   <pre class="programlisting">
                   11121: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
                   11122: </pre>
                   11123: 
                   11124:                   <p>should be changed to:</p>
                   11125:                   <pre class="programlisting">
1.14      xtraeme  11126: ${LIBTOOL} --mode=link ${CC} -o <em class=
                   11127: "replaceable"><code>someprog</code></em> <em class=
                   11128: "replaceable"><code>../somelib/somelib.la</code></em>
1.1       grant    11129: </pre>
                   11130: 
                   11131:                   <p>and it will do the right thing with the
                   11132:                   libraries.</p>
                   11133:                 </li>
                   11134: 
                   11135:                 <li>
                   11136:                   <p>When installing libraries, preface the
                   11137:                   <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   11138:                   <span class="citerefentry"><span class=
                   11139:                   "refentrytitle">install</span>(1)</span></a> or
                   11140:                   <a href=
                   11141:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
                   11142:                   <span class="citerefentry"><span class=
                   11143:                   "refentrytitle">cp</span>(1)</span></a> command
                   11144:                   with &#8220;<span class="quote">${LIBTOOL}
                   11145:                   --mode=install</span>&#8221;, and change the
1.14      xtraeme  11146:                   library name to <code class=
                   11147:                   "filename">.la</code>. e.g.</p>
1.1       grant    11148:                   <pre class="programlisting">
                   11149: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
                   11150: </pre>
                   11151: 
1.14      xtraeme  11152:                   <p>This will install the static <code class=
                   11153:                   "filename">.a</code>, shared library, any needed
1.1       grant    11154:                   symlinks, and run <a href=
                   11155:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
                   11156:                   <span class="citerefentry"><span class=
                   11157:                   "refentrytitle">ldconfig</span>(8)</span></a>.</p>
                   11158:                 </li>
                   11159: 
                   11160:                 <li>
1.14      xtraeme  11161:                   <p>In your <code class="filename">PLIST</code>,
1.23      wiz      11162:                   include only the <code class=
                   11163:                   "filename">.la</code> file (this is a change from
                   11164:                   previous behaviour).</p>
1.1       grant    11165:                 </li>
                   11166:               </ol>
                   11167:             </div>
                   11168:           </div>
                   11169: 
                   11170:           <div class="sect2" lang="en" xml:lang="en">
                   11171:             <div class="titlepage">
                   11172:               <div>
                   11173:                 <div>
1.30      wiz      11174:                   <h3 class="title"><a name="using-libtool" id=
1.38      dillo    11175:                   "using-libtool"></a>15.3.2.&nbsp;Using libtool on
1.30      wiz      11176:                   GNU packages that already support libtool</h3>
1.1       grant    11177:                 </div>
                   11178:               </div>
                   11179:             </div>
                   11180: 
1.14      xtraeme  11181:             <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
                   11182:             the package Makefile. This will override the package's
                   11183:             own libtool in most cases. For older libtool using
1.1       grant    11184:             packages, libtool is made by ltconfig script during the
                   11185:             do-configure step; you can check the libtool script
1.14      xtraeme  11186:             location by doing <span><strong class="command">make
                   11187:             configure; find work*/ -name
                   11188:             libtool</strong></span>.</p>
                   11189: 
                   11190:             <p><code class="varname">LIBTOOL_OVERRIDE</code>
                   11191:             specifies which libtool scripts, relative to
                   11192:             <code class="varname">WRKSRC</code>, to override. By
                   11193:             default, it is set to &#8220;<span class=
                   11194:             "quote">libtool */libtool */*/libtool</span>&#8221;. If
                   11195:             this does not match the location of the package's
                   11196:             libtool script(s), set it as appropriate.</p>
1.13      hubertf  11197: 
1.14      xtraeme  11198:             <p>If you do not need <code class="filename">*.a</code>
1.1       grant    11199:             static libraries built and installed, then use
1.14      xtraeme  11200:             <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1       grant    11201:             instead.</p>
                   11202: 
                   11203:             <p>If your package makes use of the platform
                   11204:             independent library for loading dynamic shared objects,
                   11205:             that comes with libtool (libltdl), you should include
1.22      tv       11206:             devel/libltdl/buildlink3.mk.</p>
1.1       grant    11207: 
                   11208:             <p>Some packages use libtool incorrectly so that the
                   11209:             package may not work or build in some circumstances.
                   11210:             Some of the more common errors are:</p>
                   11211: 
                   11212:             <div class="itemizedlist">
                   11213:               <ul type="disc">
                   11214:                 <li>
                   11215:                   <p>The inclusion of a shared object (-module) as
                   11216:                   a dependent library in an executable or library.
                   11217:                   This in itself isn't a problem if one of two
                   11218:                   things has been done:</p>
                   11219: 
                   11220:                   <div class="orderedlist">
                   11221:                     <ol type="1">
                   11222:                       <li>
                   11223:                         <p>The shared object is named correctly,
1.14      xtraeme  11224:                         i.e. <code class=
                   11225:                         "filename">libfoo.la</code>, not
                   11226:                         <code class="filename">foo.la</code></p>
1.1       grant    11227:                       </li>
                   11228: 
                   11229:                       <li>
                   11230:                         <p>The -dlopen option is used when linking
                   11231:                         an executable.</p>
                   11232:                       </li>
                   11233:                     </ol>
                   11234:                   </div>
                   11235:                 </li>
                   11236: 
                   11237:                 <li>
                   11238:                   <p>The use of libltdl without the correct calls
                   11239:                   to initialisation routines. The function
                   11240:                   lt_dlinit() should be called and the macro
1.14      xtraeme  11241:                   <code class=
                   11242:                   "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1       grant    11243:                   included in executables.</p>
                   11244:                 </li>
                   11245:               </ul>
                   11246:             </div>
                   11247:           </div>
                   11248: 
                   11249:           <div class="sect2" lang="en" xml:lang="en">
                   11250:             <div class="titlepage">
                   11251:               <div>
                   11252:                 <div>
1.30      wiz      11253:                   <h3 class="title"><a name="autoconf-automake" id=
1.38      dillo    11254:                   "autoconf-automake"></a>15.3.3.&nbsp;GNU
1.1       grant    11255:                   Autoconf/Automake</h3>
                   11256:                 </div>
                   11257:               </div>
                   11258:             </div>
                   11259: 
                   11260:             <p>If a package needs GNU autoconf or automake to be
                   11261:             executed to regenerate the configure script and
                   11262:             Makefile.in makefile templates, then they should be
1.35      jmmv     11263:             executed in a pre-configure target.</p>
1.1       grant    11264: 
                   11265:             <p>For packages that need only autoconf:</p>
                   11266:             <pre class="programlisting">
1.35      jmmv     11267: AUTOCONF_REQD=    2.50     # if default version is not good enough
                   11268: USE_TOOLS+=     autoconf   # use "autoconf213" for autoconf-2.13
1.1       grant    11269: ...
                   11270: 
                   11271: pre-configure:
1.35      jmmv     11272:           cd ${WRKSRC}; autoconf
1.1       grant    11273: 
                   11274: ...
                   11275: </pre>
                   11276: 
                   11277:             <p>and for packages that need automake and
                   11278:             autoconf:</p>
                   11279:             <pre class="programlisting">
1.35      jmmv     11280: AUTOMAKE_REQD=  1.7.1      # if default version is not good enough
1.36      wiz      11281: USE_TOOLS+=     automake   # use "automake14" for automake-1.4
1.1       grant    11282: ...
                   11283: 
                   11284: pre-configure:
                   11285:           cd ${WRKSRC};                                           \
1.35      jmmv     11286:           aclocal; autoheader;                                    \
                   11287:           automake -a --foreign -i; autoconf
1.1       grant    11288: 
                   11289: ...
                   11290: </pre>
                   11291: 
                   11292:             <p>Packages which use GNU Automake will almost
1.35      jmmv     11293:             certainly require GNU Make.</p>
1.1       grant    11294: 
                   11295:             <p>There are times when the configure process makes
                   11296:             additional changes to the generated files, which then
                   11297:             causes the build process to try to re-execute the
                   11298:             automake sequence. This is prevented by touching
                   11299:             various files in the configure stage. If this causes
1.14      xtraeme  11300:             problems with your package you can set <code class=
                   11301:             "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1       grant    11302:             Makefile.</p>
                   11303:           </div>
                   11304:         </div>
                   11305: 
                   11306:         <div class="sect1" lang="en" xml:lang="en">
                   11307:           <div class="titlepage">
                   11308:             <div>
                   11309:               <div>
                   11310:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      11311:                 "building-considerations" id=
1.38      dillo    11312:                 "building-considerations"></a>15.4.&nbsp;Building
1.1       grant    11313:                 considerations</h2>
                   11314:               </div>
                   11315:             </div>
                   11316:           </div>
                   11317: 
                   11318:           <div class="sect2" lang="en" xml:lang="en">
                   11319:             <div class="titlepage">
                   11320:               <div>
                   11321:                 <div>
1.30      wiz      11322:                   <h3 class="title"><a name="cpp-defines" id=
1.38      dillo    11323:                   "cpp-defines"></a>15.4.1.&nbsp;CPP defines</h3>
1.1       grant    11324:                 </div>
                   11325:               </div>
                   11326:             </div>
                   11327: 
                   11328:             <p>To port an application to NetBSD, it's usually
                   11329:             necessary for the compiler to be able to judge the
                   11330:             system on which it's compiling, and we use definitions
                   11331:             so that the C pre-processor can do this.</p>
                   11332: 
                   11333:             <p>To test whether you are working on a 4.4 BSD-derived
                   11334:             system, you should use the BSD definition, which is
1.14      xtraeme  11335:             defined in <code class=
                   11336:             "filename">&lt;sys/param.h&gt;</code> on said
1.1       grant    11337:             systems.</p>
                   11338:             <pre class="programlisting">
                   11339: #include &lt;sys/param.h&gt;
                   11340: </pre>
                   11341: 
                   11342:             <p>and then you can surround the BSD-specific parts of
                   11343:             your package's C/C++ code using this conditional:</p>
                   11344:             <pre class="programlisting">
                   11345: #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
                   11346:     ...
                   11347: #endif
                   11348: </pre>
                   11349: 
                   11350:             <p>Please use the &#8220;<span class=
                   11351:             "quote">__NetBSD__</span>&#8221; definition sparingly -
                   11352:             it should only apply to features of NetBSD that are not
                   11353:             present in other 4.4-lite derived BSDs.</p>
                   11354:           </div>
                   11355:         </div>
                   11356: 
                   11357:         <div class="sect1" lang="en" xml:lang="en">
                   11358:           <div class="titlepage">
                   11359:             <div>
                   11360:               <div>
                   11361:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      11362:                 "package-specific-actions" id=
1.38      dillo    11363:                 "package-specific-actions"></a>15.5.&nbsp;Package
1.1       grant    11364:                 specific actions</h2>
                   11365:               </div>
                   11366:             </div>
                   11367:           </div>
                   11368: 
                   11369:           <div class="sect2" lang="en" xml:lang="en">
                   11370:             <div class="titlepage">
                   11371:               <div>
                   11372:                 <div>
1.30      wiz      11373:                   <h3 class="title"><a name="user-interaction" id=
1.38      dillo    11374:                   "user-interaction"></a>15.5.1.&nbsp;User
1.2       hubertf  11375:                   interaction</h3>
1.1       grant    11376:                 </div>
                   11377:               </div>
                   11378:             </div>
                   11379: 
                   11380:             <p>Occasionally, packages require interaction from the
                   11381:             user, and this can be in a number of ways:</p>
                   11382: 
                   11383:             <div class="itemizedlist">
                   11384:               <ul type="disc">
                   11385:                 <li>
                   11386:                   <p>help in fetching the distfiles</p>
                   11387:                 </li>
                   11388: 
                   11389:                 <li>
                   11390:                   <p>help to configure the package before it is
                   11391:                   built</p>
                   11392:                 </li>
                   11393: 
                   11394:                 <li>
                   11395:                   <p>help during the build process</p>
                   11396:                 </li>
                   11397: 
                   11398:                 <li>
                   11399:                   <p>help during the installation of a package</p>
                   11400:                 </li>
                   11401:               </ul>
                   11402:             </div>
                   11403: 
1.14      xtraeme  11404:             <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1       grant    11405:             definition is provided to notify the pkgsrc mechanism
                   11406:             of an interactive stage which will be needed, and this
1.14      xtraeme  11407:             should be set in the package's <code class=
                   11408:             "filename">Makefile</code>. e.g.</p>
1.1       grant    11409:             <pre class="programlisting">
                   11410: INTERACTIVE_STAGE= build
                   11411: </pre>
                   11412: 
                   11413:             <p>Multiple interactive stages can be specified:</p>
                   11414:             <pre class="programlisting">
                   11415: INTERACTIVE_STAGE= configure install
                   11416: </pre>
                   11417:           </div>
                   11418: 
                   11419:           <div class="sect2" lang="en" xml:lang="en">
                   11420:             <div class="titlepage">
                   11421:               <div>
                   11422:                 <div>
1.30      wiz      11423:                   <h3 class="title"><a name="handling-licenses" id=
1.38      dillo    11424:                   "handling-licenses"></a>15.5.2.&nbsp;Handling
1.1       grant    11425:                   licenses</h3>
                   11426:                 </div>
                   11427:               </div>
                   11428:             </div>
                   11429: 
1.44    ! gdt      11430:             <p>A package may be covered by a license which the user
        !          11431:             has or has not agreed to accept. For these cases,
        !          11432:             pkgsrc contains a mechanism to note that a package is
        !          11433:             covered by a particular license, and the package cannot
        !          11434:             be built unless the user has accepted the license.
        !          11435:             (Installation of binary packages are not currently
        !          11436:             subject to this mechanism.) Packages with licenses that
        !          11437:             are either Open Source according to the Open Source
        !          11438:             Initiative or Free according to the Free Software
        !          11439:             Foundation will not be marked with a license tag.
        !          11440:             Packages with licenses that have not been determined to
        !          11441:             meet either definition will be marked with a license
        !          11442:             tag referring to the license. This will prevent
        !          11443:             building unless pkgsrc is informed that the license is
        !          11444:             acceptable, and enables displaying the license.</p>
        !          11445: 
        !          11446:             <p>The license tag mechanism is intended to address
        !          11447:             copyright-related issues surrounding building,
        !          11448:             installing and using a package, and not to address
        !          11449:             redistribution issues (see <code class=
        !          11450:             "varname">RESTRICTED</code> and <code class=
        !          11451:             "varname">NO_SRC_ON_FTP</code>, etc.). However, the
        !          11452:             above definition of licenses for which tags are not
        !          11453:             needed implies that packages with redistribution
        !          11454:             restrictions should have tags.</p>
        !          11455: 
        !          11456:             <p>Denoting that a package is covered by a particular
        !          11457:             license is done by placing the license in <code class=
        !          11458:             "filename">pkgsrc/licenses</code> and setting the
        !          11459:             <code class="varname">LICENSE</code> variable to a
        !          11460:             string identifying the license, e.g. in <a xmlns=
1.14      xtraeme  11461:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.44    ! gdt      11462:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/xv/README.html"
        !          11463:             class="pkgname">graphics/xv</a>:</p>
1.1       grant    11464:             <pre class="programlisting">
1.44    ! gdt      11465: LICENSE=        xv-license
1.1       grant    11466: </pre>
                   11467: 
                   11468:             <p>When trying to build, the user will get a notice
1.44    ! gdt      11469:             that the package is covered by a license which has not
        !          11470:             been accepted:</p>
1.1       grant    11471:             <pre class="programlisting">
1.14      xtraeme  11472: <code class="prompt">%</code> <strong class=
                   11473: "userinput"><code>make</code></strong>
1.44    ! gdt      11474: ===&gt; xv-3.10anb9 has an unacceptable license: xv-license.
1.1       grant    11475: ===&gt;     To view the license, enter "/usr/bin/make show-license".
1.44    ! gdt      11476: ===&gt;     To indicate acceptance, add this line to your /etc/mk.conf:
        !          11477: ===&gt;     ACCEPTABLE_LICENSES+=xv-license
1.1       grant    11478: *** Error code 1
                   11479: </pre>
                   11480: 
1.14      xtraeme  11481:             <p>The license can be viewed with <span><strong class=
                   11482:             "command">make show-license</strong></span>, and if it
                   11483:             is considered appropriate, the line printed above can
                   11484:             be added to <code class="filename">/etc/mk.conf</code>
                   11485:             to indicate acceptance of the particular license:</p>
1.1       grant    11486:             <pre class="programlisting">
1.44    ! gdt      11487: ACCEPTABLE_LICENSES+=xv-license
1.1       grant    11488: </pre>
                   11489: 
                   11490:             <p>When adding a package with a new license, the
1.14      xtraeme  11491:             license text should be added to <code class=
                   11492:             "filename">pkgsrc/licenses</code> for displaying. A
                   11493:             list of known licenses can be seen in this directory as
                   11494:             well as by looking at the list of (commented out)
                   11495:             <code class="varname">ACCEPTABLE_LICENSES</code>
                   11496:             variable settings in <code class=
                   11497:             "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1       grant    11498: 
1.44    ! gdt      11499:             <p>The use of <code class=
        !          11500:             "varname">LICENSE=shareware</code>, <code class=
        !          11501:             "varname">LICENSE=no-commercial-use</code>, and similar
        !          11502:             language is deprecated because it does not crisply
        !          11503:             refer to a particular license text. Another problem
        !          11504:             with such usage is that it does not enable a user to
        !          11505:             denote acceptance of the license for a single package
        !          11506:             without accepting the same license text for another
        !          11507:             package. In particular, this can be inappropriate when
        !          11508:             e.g. one accepts a particular license to indicate to
        !          11509:             pkgsrc that a fee has been paid.</p>
1.1       grant    11510:           </div>
                   11511: 
                   11512:           <div class="sect2" lang="en" xml:lang="en">
                   11513:             <div class="titlepage">
                   11514:               <div>
                   11515:                 <div>
1.30      wiz      11516:                   <h3 class="title"><a name=
                   11517:                   "installing-score-files" id=
1.38      dillo    11518:                   "installing-score-files"></a>15.5.3.&nbsp;Installing
1.30      wiz      11519:                   score files</h3>
1.1       grant    11520:                 </div>
                   11521:               </div>
                   11522:             </div>
                   11523: 
                   11524:             <p>Certain packages, most of them in the games
                   11525:             category, install a score file that allows all users on
                   11526:             the system to record their highscores. In order for
                   11527:             this to work, the binaries need to be installed setgid
                   11528:             and the score files owned by the appropriate group
                   11529:             and/or owner (traditionally the "games" user/group).
                   11530:             The following variables, documented in more detail in
1.14      xtraeme  11531:             <code class="filename">mk/defaults/mk.conf</code>,
                   11532:             control this behaviour: <code class=
                   11533:             "varname">SETGIDGAME</code>, <code class=
                   11534:             "varname">GAMEDATAMODE</code>, <code class=
                   11535:             "varname">GAMEGRP</code>, <code class=
                   11536:             "varname">GAMEMODE</code>, <code class=
                   11537:             "varname">GAMEOWN</code>.</p>
1.1       grant    11538: 
                   11539:             <p>Note that per default, setgid installation of games
1.14      xtraeme  11540:             is disabled; setting <code class=
                   11541:             "varname">SETGIDGAME=YES</code> will set all the other
1.1       grant    11542:             variables accordingly.</p>
                   11543: 
                   11544:             <p>A package should therefor never hard code file
1.14      xtraeme  11545:             ownership or access permissions but rely on
                   11546:             <code class="varname">INSTALL_GAME</code> and
                   11547:             <code class="varname">INSTALL_GAME_DATA</code> to set
                   11548:             these correctly.</p>
1.1       grant    11549:           </div>
                   11550: 
                   11551:           <div class="sect2" lang="en" xml:lang="en">
                   11552:             <div class="titlepage">
                   11553:               <div>
                   11554:                 <div>
1.30      wiz      11555:                   <h3 class="title"><a name="perl-scripts" id=
1.38      dillo    11556:                   "perl-scripts"></a>15.5.4.&nbsp;Packages
1.30      wiz      11557:                   containing perl scripts</h3>
1.1       grant    11558:                 </div>
                   11559:               </div>
                   11560:             </div>
                   11561: 
                   11562:             <p>If your package contains interpreted perl scripts,
1.14      xtraeme  11563:             set <code class="varname">REPLACE_PERL</code> to ensure
                   11564:             that the proper interpreter path is set. <code class=
                   11565:             "varname">REPLACE_PERL</code> should contain a list of
                   11566:             scripts, relative to <code class=
                   11567:             "varname">WRKSRC</code>, that you want adjusted.</p>
1.1       grant    11568:           </div>
                   11569: 
                   11570:           <div class="sect2" lang="en" xml:lang="en">
                   11571:             <div class="titlepage">
                   11572:               <div>
                   11573:                 <div>
1.30      wiz      11574:                   <h3 class="title"><a name="hardcoded-paths" id=
1.38      dillo    11575:                   "hardcoded-paths"></a>15.5.5.&nbsp;Packages with
1.1       grant    11576:                   hardcoded paths to other interpreters</h3>
                   11577:                 </div>
                   11578:               </div>
                   11579:             </div>
                   11580: 
                   11581:             <p>Your package may also contain scripts with hardcoded
                   11582:             paths to other interpreters besides (or as well as)
                   11583:             perl. To correct the full pathname to the script
                   11584:             interpreter, you need to set the following definitions
1.14      xtraeme  11585:             in your <code class="filename">Makefile</code> (we
                   11586:             shall use <span><strong class=
                   11587:             "command">tclsh</strong></span> in this example):</p>
1.1       grant    11588:             <pre class="programlisting">
                   11589:   REPLACE_INTERPRETER+=     tcl
                   11590:     _REPLACE.tcl.old=     .*/bin/tclsh
                   11591:     _REPLACE.tcl.new=     ${PREFIX}/bin/tclsh
                   11592:     _REPLACE_FILES.tcl=   ...list of tcl scripts which need to be fixed,
                   11593:                           relative to ${WRKSRC}, just as in REPLACE_PERL
                   11594: </pre>
                   11595:           </div>
                   11596: 
                   11597:           <div class="sect2" lang="en" xml:lang="en">
                   11598:             <div class="titlepage">
                   11599:               <div>
                   11600:                 <div>
1.30      wiz      11601:                   <h3 class="title"><a name="perl-modules" id=
1.38      dillo    11602:                   "perl-modules"></a>15.5.6.&nbsp;Packages
1.30      wiz      11603:                   installing perl modules</h3>
1.1       grant    11604:                 </div>
                   11605:               </div>
                   11606:             </div>
                   11607: 
                   11608:             <p>Makefiles of packages providing perl5 modules should
1.14      xtraeme  11609:             include the Makefile fragment <code class=
                   11610:             "filename">../../lang/perl5/module.mk</code>. It
                   11611:             provides a <span><strong class=
                   11612:             "command">do-configure</strong></span> target for the
                   11613:             standard perl configuration for such modules as well as
                   11614:             various hooks to tune this configuration. See comments
                   11615:             in this file for details.</p>
1.1       grant    11616: 
                   11617:             <p>Perl5 modules will install into different places
                   11618:             depending on the version of perl used during the build
                   11619:             process. To address this, pkgsrc will append lines to
1.14      xtraeme  11620:             the <code class="filename">PLIST</code> corresponding
                   11621:             to the files listed in the installed <code class=
                   11622:             "filename">.packlist</code> file generated by most
                   11623:             perl5 modules. This is invoked by defining <code class=
                   11624:             "varname">PERL5_PACKLIST</code> to a space-separated
                   11625:             list of paths to packlist files, e.g.:</p>
1.1       grant    11626:             <pre class="programlisting">
                   11627: PERL5_PACKLIST=   ${PERL5_SITEARCH}/auto/Pg/.packlist
                   11628: </pre>
                   11629: 
1.14      xtraeme  11630:             <p>The variables <code class=
                   11631:             "varname">PERL5_SITELIB</code>, <code class=
                   11632:             "varname">PERL5_SITEARCH</code>, and <code class=
                   11633:             "varname">PERL5_ARCHLIB</code> represent the three
1.1       grant    11634:             locations in which perl5 modules may be installed, and
                   11635:             may be used by perl5 packages that don't have a
                   11636:             packlist. These three variables are also substituted
1.14      xtraeme  11637:             for in the <code class="filename">PLIST</code>.</p>
1.1       grant    11638:           </div>
                   11639: 
                   11640:           <div class="sect2" lang="en" xml:lang="en">
                   11641:             <div class="titlepage">
                   11642:               <div>
                   11643:                 <div>
                   11644:                   <h3 class="title"><a name="faq.info-files" id=
1.38      dillo    11645:                   "faq.info-files"></a>15.5.7.&nbsp;Packages
1.1       grant    11646:                   installing info files</h3>
                   11647:                 </div>
                   11648:               </div>
                   11649:             </div>
                   11650: 
                   11651:             <p>Some packages install info files or use the
                   11652:             &#8220;<span class="quote">makeinfo</span>&#8221; or
                   11653:             &#8220;<span class="quote">install-info</span>&#8221;
                   11654:             commands. Each of the info files:</p>
                   11655: 
                   11656:             <div class="itemizedlist">
                   11657:               <ul type="disc">
                   11658:                 <li>
                   11659:                   <p>is considered to be installed in the directory
1.14      xtraeme  11660:                   <code class=
                   11661:                   "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1       grant    11662:                 </li>
                   11663: 
                   11664:                 <li>
                   11665:                   <p>is registered in the Info directory file
1.14      xtraeme  11666:                   <code class=
                   11667:                   "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1       grant    11668:                 </li>
                   11669: 
                   11670:                 <li>
                   11671:                   <p>and must be listed as a filename in the
1.14      xtraeme  11672:                   <code class="varname">INFO_FILES</code> variable
                   11673:                   in the package Makefile.</p>
1.1       grant    11674:                 </li>
                   11675:               </ul>
                   11676:             </div>
                   11677: 
1.14      xtraeme  11678:             <p><code class="varname">INFO_DIR</code> defaults to
1.1       grant    11679:             &#8220;<span class="quote">info</span>&#8221; and can
1.14      xtraeme  11680:             be overridden in the package Makefile. <code class=
                   11681:             "filename">INSTALL</code> and <code class=
                   11682:             "filename">DEINSTALL</code> scripts will be generated
                   11683:             to handle registration of the info files in the Info
1.1       grant    11684:             directory file. The &#8220;<span class=
                   11685:             "quote">install-info</span>&#8221; command used for the
                   11686:             info files registration is either provided by the
                   11687:             system, or by a special purpose package automatically
                   11688:             added as dependency if needed.</p>
                   11689: 
                   11690:             <p>A package which needs the &#8220;<span class=
                   11691:             "quote">makeinfo</span>&#8221; command at build time
1.14      xtraeme  11692:             must define the variable <code class=
                   11693:             "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1       grant    11694:             minimum version of the &#8220;<span class=
                   11695:             "quote">makeinfo</span>&#8221; command is needed it
1.14      xtraeme  11696:             should be noted with the <code class=
                   11697:             "varname">TEXINFO_REQD</code> variable in the package
                   11698:             <code class="filename">Makefile</code>. By default, a
1.1       grant    11699:             minimum version of 3.12 is required. If the system does
1.14      xtraeme  11700:             not provide a <span><strong class=
                   11701:             "command">makeinfo</strong></span> command or if it
                   11702:             does not match the required minimum, a build dependency
                   11703:             on the <a xmlns=
                   11704:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    11705:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.20      ben      11706:             class="pkgname">devel/gtexinfo</a> package will be
                   11707:             added automatically.</p>
1.1       grant    11708: 
                   11709:             <p>The build and installation process of the software
                   11710:             provided by the package should not use the
1.14      xtraeme  11711:             <span><strong class=
                   11712:             "command">install-info</strong></span> command as the
                   11713:             registration of info files is the task of the package
                   11714:             <code class="filename">INSTALL</code> script, and it
                   11715:             must use the appropriate <span><strong class=
                   11716:             "command">makeinfo</strong></span> command.</p>
1.1       grant    11717: 
                   11718:             <p>To achieve this goal the pkgsrc infrastructure
1.14      xtraeme  11719:             creates overriding scripts for the <span><strong class=
                   11720:             "command">install-info</strong></span> and
                   11721:             <span><strong class="command">makeinfo</strong></span>
                   11722:             commands in a directory listed early in <code class=
                   11723:             "varname">PATH</code>.</p>
1.1       grant    11724: 
1.14      xtraeme  11725:             <p>The script overriding <span><strong class=
                   11726:             "command">install-info</strong></span> has no effect
                   11727:             except the logging of a message. The script overriding
                   11728:             <span><strong class="command">makeinfo</strong></span>
                   11729:             logs a message and according to the value of
                   11730:             <code class="varname">USE_MAKEINFO</code> and
                   11731:             <code class="varname">TEXINFO_REQD</code> either run
                   11732:             the appropriate <span><strong class=
                   11733:             "command">makeinfo</strong></span> command or exit on
                   11734:             error.</p>
1.1       grant    11735:           </div>
                   11736: 
                   11737:           <div class="sect2" lang="en" xml:lang="en">
                   11738:             <div class="titlepage">
                   11739:               <div>
                   11740:                 <div>
1.30      wiz      11741:                   <h3 class="title"><a name="gconf2-data-files" id=
1.38      dillo    11742:                   "gconf2-data-files"></a>15.5.8.&nbsp;Packages
1.30      wiz      11743:                   installing GConf2 data files</h3>
1.1       grant    11744:                 </div>
                   11745:               </div>
                   11746:             </div>
                   11747: 
1.14      xtraeme  11748:             <p>If a package installs <code class=
                   11749:             "filename">.schemas</code> or <code class=
                   11750:             "filename">.entries</code> files, used by GConf2, you
1.1       grant    11751:             need to take some extra steps to make sure they get
                   11752:             registered in the database:</p>
                   11753: 
                   11754:             <div class="orderedlist">
                   11755:               <ol type="1">
                   11756:                 <li>
1.14      xtraeme  11757:                   <p>Include <code class=
                   11758:                   "filename">../../devel/GConf2/schemas.mk</code>
                   11759:                   instead of its <code class=
                   11760:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    11761:                   care of rebuilding the GConf2 database at
                   11762:                   installation and deinstallation time, and tells
                   11763:                   the package where to install GConf2 data files
                   11764:                   using some standard configure arguments. It also
                   11765:                   disallows any access to the database directly
                   11766:                   from the package.</p>
                   11767:                 </li>
                   11768: 
                   11769:                 <li>
                   11770:                   <p>Ensure that the package installs its
1.14      xtraeme  11771:                   <code class="filename">.schemas</code> files
                   11772:                   under <code class=
                   11773:                   "filename">${PREFIX}/share/gconf/schemas</code>.
                   11774:                   If they get installed under <code class=
                   11775:                   "filename">${PREFIX}/etc</code>, you will need to
1.1       grant    11776:                   manually patch the package.</p>
                   11777:                 </li>
                   11778: 
                   11779:                 <li>
                   11780:                   <p>Check the PLIST and remove any entries under
                   11781:                   the etc/gconf directory, as they will be handled
                   11782:                   automatically. See <a href="#faq.conf" title=
1.38      dillo    11783:                   "7.14.&nbsp;How do I change the location of configuration files?">
                   11784:                   Section&nbsp;7.14, &#8220;How do I change the
1.35      jmmv     11785:                   location of configuration files?&#8221;</a> for
                   11786:                   more information.</p>
1.1       grant    11787:                 </li>
                   11788: 
                   11789:                 <li>
1.14      xtraeme  11790:                   <p>Define the <code class=
                   11791:                   "varname">GCONF2_SCHEMAS</code> variable in your
                   11792:                   <code class="filename">Makefile</code> with a
                   11793:                   list of all <code class=
                   11794:                   "filename">.schemas</code> files installed by the
                   11795:                   package, if any. Names must not contain any
                   11796:                   directories in them.</p>
1.1       grant    11797:                 </li>
                   11798: 
                   11799:                 <li>
1.14      xtraeme  11800:                   <p>Define the <code class=
                   11801:                   "varname">GCONF2_ENTRIES</code> variable in your
                   11802:                   <code class="filename">Makefile</code> with a
                   11803:                   list of all <code class=
                   11804:                   "filename">.entries</code> files installed by the
                   11805:                   package, if any. Names must not contain any
                   11806:                   directories in them.</p>
1.1       grant    11807:                 </li>
                   11808:               </ol>
                   11809:             </div>
                   11810:           </div>
                   11811: 
                   11812:           <div class="sect2" lang="en" xml:lang="en">
                   11813:             <div class="titlepage">
                   11814:               <div>
                   11815:                 <div>
1.30      wiz      11816:                   <h3 class="title"><a name=
                   11817:                   "scrollkeeper-data-files" id=
1.38      dillo    11818:                   "scrollkeeper-data-files"></a>15.5.9.&nbsp;Packages
1.30      wiz      11819:                   installing scrollkeeper data files</h3>
1.1       grant    11820:                 </div>
                   11821:               </div>
                   11822:             </div>
                   11823: 
1.14      xtraeme  11824:             <p>If a package installs <code class=
                   11825:             "filename">.omf</code> files, used by scrollkeeper, you
                   11826:             need to take some extra steps to make sure they get
                   11827:             registered in the database:</p>
1.1       grant    11828: 
                   11829:             <div class="orderedlist">
                   11830:               <ol type="1">
                   11831:                 <li>
1.14      xtraeme  11832:                   <p>Include <code class=
                   11833:                   "filename">../../textproc/scrollkeeper/omf.mk</code>
                   11834:                   instead of its <code class=
                   11835:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    11836:                   care of rebuilding the scrollkeeper database at
                   11837:                   installation and deinstallation time, and
                   11838:                   disallows any access to it directly from the
                   11839:                   package.</p>
                   11840:                 </li>
                   11841: 
                   11842:                 <li>
                   11843:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  11844:                   the <code class=
                   11845:                   "filename">libdata/scrollkeeper</code> directory,
1.1       grant    11846:                   as they will be handled automatically.</p>
                   11847:                 </li>
                   11848: 
                   11849:                 <li>
1.14      xtraeme  11850:                   <p>Remove the <code class=
                   11851:                   "filename">share/omf</code> directory from the
                   11852:                   PLIST. It will be handled by scrollkeeper.</p>
1.1       grant    11853:                 </li>
                   11854:               </ol>
                   11855:             </div>
                   11856:           </div>
                   11857: 
                   11858:           <div class="sect2" lang="en" xml:lang="en">
                   11859:             <div class="titlepage">
                   11860:               <div>
                   11861:                 <div>
1.30      wiz      11862:                   <h3 class="title"><a name="x11-fonts" id=
1.38      dillo    11863:                   "x11-fonts"></a>15.5.10.&nbsp;Packages installing
1.1       grant    11864:                   X11 fonts</h3>
                   11865:                 </div>
                   11866:               </div>
                   11867:             </div>
                   11868: 
                   11869:             <p>If a package installs font files, you will need to
                   11870:             rebuild the fonts database in the directory where they
                   11871:             get installed at installation and deinstallation time.
1.14      xtraeme  11872:             This can be automatically done by using <code class=
                   11873:             "filename">mk/fonts.mk</code>, which you need to
                   11874:             include in your <code class=
                   11875:             "filename">Makefile</code>.</p>
1.1       grant    11876: 
                   11877:             <p>When the file is included, you can list the
1.14      xtraeme  11878:             directories where fonts are installed in the
                   11879:             <code class="varname">FONTS_<em class=
                   11880:             "replaceable"><code>type</code></em>_DIRS</code>
                   11881:             variables, where <em class=
                   11882:             "replaceable"><code>type</code></em> can be one of
                   11883:             &#8220;<span class="quote">TTF</span>&#8221;,
1.1       grant    11884:             &#8220;<span class="quote">TYPE1</span>&#8221; or
                   11885:             &#8220;<span class="quote">X11</span>&#8221;. Also make
1.14      xtraeme  11886:             sure that the database file <code class=
                   11887:             "filename">fonts.dir</code> is not listed in the
1.1       grant    11888:             PLIST.</p>
                   11889: 
                   11890:             <p>Note that you should not create new directories for
                   11891:             fonts; instead use the standard ones to avoid that the
                   11892:             user needs to manually configure his X server to find
                   11893:             them.</p>
                   11894:           </div>
                   11895: 
                   11896:           <div class="sect2" lang="en" xml:lang="en">
                   11897:             <div class="titlepage">
                   11898:               <div>
                   11899:                 <div>
1.30      wiz      11900:                   <h3 class="title"><a name="gtk2-modules" id=
1.38      dillo    11901:                   "gtk2-modules"></a>15.5.11.&nbsp;Packages
1.30      wiz      11902:                   installing GTK2 modules</h3>
1.1       grant    11903:                 </div>
                   11904:               </div>
                   11905:             </div>
                   11906: 
                   11907:             <p>If a package installs gtk2 immodules or loaders, you
                   11908:             need to take some extra steps to get them registered in
                   11909:             the GTK2 database properly:</p>
                   11910: 
                   11911:             <div class="orderedlist">
                   11912:               <ol type="1">
                   11913:                 <li>
1.14      xtraeme  11914:                   <p>Include <code class=
                   11915:                   "filename">../../x11/gtk2/modules.mk</code>
                   11916:                   instead of its <code class=
                   11917:                   "filename">buildlink3.mk</code> file. This takes
                   11918:                   care of rebuilding the database at installation
                   11919:                   and deinstallation time.</p>
1.1       grant    11920:                 </li>
                   11921: 
                   11922:                 <li>
1.14      xtraeme  11923:                   <p>Set <code class=
                   11924:                   "varname">GTK2_IMMODULES=YES</code> if your
                   11925:                   package installs GTK2 immodules.</p>
1.1       grant    11926:                 </li>
                   11927: 
                   11928:                 <li>
1.14      xtraeme  11929:                   <p>Set <code class=
                   11930:                   "varname">GTK2_LOADERS=YES</code> if your package
                   11931:                   installs GTK2 loaders.</p>
1.1       grant    11932:                 </li>
                   11933: 
                   11934:                 <li>
                   11935:                   <p>Patch the package to not touch any of the gtk2
                   11936:                   databases directly. These are:</p>
                   11937: 
                   11938:                   <div class="itemizedlist">
                   11939:                     <ul type="disc">
                   11940:                       <li>
1.14      xtraeme  11941:                         <p><code class=
                   11942:                         "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1       grant    11943:                       </li>
                   11944: 
                   11945:                       <li>
1.14      xtraeme  11946:                         <p><code class=
                   11947:                         "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1       grant    11948:                       </li>
                   11949:                     </ul>
                   11950:                   </div>
                   11951:                 </li>
                   11952: 
                   11953:                 <li>
                   11954:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  11955:                   the <code class="filename">libdata/gtk-2.0</code>
1.1       grant    11956:                   directory, as they will be handled
                   11957:                   automatically.</p>
                   11958:                 </li>
                   11959:               </ol>
                   11960:             </div>
                   11961:           </div>
                   11962: 
                   11963:           <div class="sect2" lang="en" xml:lang="en">
                   11964:             <div class="titlepage">
                   11965:               <div>
                   11966:                 <div>
1.30      wiz      11967:                   <h3 class="title"><a name="sgml-xml-data" id=
1.38      dillo    11968:                   "sgml-xml-data"></a>15.5.12.&nbsp;Packages
1.30      wiz      11969:                   installing SGML or XML data</h3>
1.1       grant    11970:                 </div>
                   11971:               </div>
                   11972:             </div>
                   11973: 
                   11974:             <p>If a package installs SGML or XML data files that
                   11975:             need to be registered in system-wide catalogs (like
                   11976:             DTDs, sub-catalogs, etc.), you need to take some extra
                   11977:             steps:</p>
                   11978: 
                   11979:             <div class="orderedlist">
                   11980:               <ol type="1">
                   11981:                 <li>
1.14      xtraeme  11982:                   <p>Include <code class=
                   11983:                   "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
                   11984:                   in your <code class="filename">Makefile</code>,
                   11985:                   which takes care of registering those files in
1.1       grant    11986:                   system-wide catalogs at installation and
                   11987:                   deinstallation time.</p>
                   11988:                 </li>
                   11989: 
                   11990:                 <li>
1.14      xtraeme  11991:                   <p>Set <code class="varname">SGML_CATALOGS</code>
                   11992:                   to the full path of any SGML catalogs installed
                   11993:                   by the package.</p>
1.1       grant    11994:                 </li>
                   11995: 
                   11996:                 <li>
1.14      xtraeme  11997:                   <p>Set <code class="varname">XML_CATALOGS</code>
                   11998:                   to the full path of any XML catalogs installed by
1.1       grant    11999:                   the package.</p>
                   12000:                 </li>
                   12001: 
                   12002:                 <li>
1.14      xtraeme  12003:                   <p>Set <code class="varname">SGML_ENTRIES</code>
                   12004:                   to individual entries to be added to the SGML
1.1       grant    12005:                   catalog. These come in groups of three strings;
                   12006:                   see xmlcatmgr(1) for more information
                   12007:                   (specifically, arguments recognized by the 'add'
                   12008:                   action). Note that you will normally not use this
                   12009:                   variable.</p>
                   12010:                 </li>
                   12011: 
                   12012:                 <li>
1.14      xtraeme  12013:                   <p>Set <code class="varname">XML_ENTRIES</code>
                   12014:                   to individual entries to be added to the XML
1.1       grant    12015:                   catalog. These come in groups of three strings;
                   12016:                   see xmlcatmgr(1) for more information
                   12017:                   (specifically, arguments recognized by the 'add'
                   12018:                   action). Note that you will normally not use this
                   12019:                   variable.</p>
                   12020:                 </li>
                   12021:               </ol>
                   12022:             </div>
                   12023:           </div>
                   12024: 
                   12025:           <div class="sect2" lang="en" xml:lang="en">
                   12026:             <div class="titlepage">
                   12027:               <div>
                   12028:                 <div>
1.30      wiz      12029:                   <h3 class="title"><a name="mime-database" id=
1.38      dillo    12030:                   "mime-database"></a>15.5.13.&nbsp;Packages
1.30      wiz      12031:                   installing extensions to the MIME database</h3>
1.1       grant    12032:                 </div>
                   12033:               </div>
                   12034:             </div>
                   12035: 
                   12036:             <p>If a package provides extensions to the MIME
1.14      xtraeme  12037:             database by installing <code class=
                   12038:             "filename">.xml</code> files inside <code class=
                   12039:             "filename">${PREFIX}/share/mime/packages</code>, you
                   12040:             need to take some extra steps to ensure that the
                   12041:             database is kept consistent with respect to these new
                   12042:             files:</p>
1.1       grant    12043: 
                   12044:             <div class="orderedlist">
                   12045:               <ol type="1">
                   12046:                 <li>
1.14      xtraeme  12047:                   <p>Include <code class=
                   12048:                   "filename">../../databases/shared-mime-info/mimedb.mk</code>
                   12049:                   (avoid using the <code class=
                   12050:                   "filename">buildlink3.mk</code> file from this
                   12051:                   same directory, which is reserved for inclusion
                   12052:                   from other <code class=
                   12053:                   "filename">buildlink3.mk</code> files). It takes
                   12054:                   care of rebuilding the MIME database at
                   12055:                   installation and deinstallation time, and
                   12056:                   disallows any access to it directly from the
1.1       grant    12057:                   package.</p>
                   12058:                 </li>
                   12059: 
                   12060:                 <li>
                   12061:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  12062:                   the <code class="filename">share/mime</code>
1.1       grant    12063:                   directory, <span class=
                   12064:                   "emphasis"><em>except</em></span> for files saved
1.14      xtraeme  12065:                   under <code class=
                   12066:                   "filename">share/mime/packages</code>. The former
1.1       grant    12067:                   are handled automatically by the
                   12068:                   update-mime-database program, but the later are
                   12069:                   package-dependent and must be removed by the
                   12070:                   package that installed them in the first
                   12071:                   place.</p>
                   12072:                 </li>
                   12073: 
                   12074:                 <li>
1.14      xtraeme  12075:                   <p>Remove any <code class=
                   12076:                   "filename">share/mime/*</code> directories from
                   12077:                   the PLIST. They will be handled by the
1.1       grant    12078:                   shared-mime-info package.</p>
                   12079:                 </li>
                   12080:               </ol>
                   12081:             </div>
                   12082:           </div>
                   12083: 
                   12084:           <div class="sect2" lang="en" xml:lang="en">
                   12085:             <div class="titlepage">
                   12086:               <div>
                   12087:                 <div>
1.30      wiz      12088:                   <h3 class="title"><a name="intltool" id=
1.38      dillo    12089:                   "intltool"></a>15.5.14.&nbsp;Packages using
1.1       grant    12090:                   intltool</h3>
                   12091:                 </div>
                   12092:               </div>
                   12093:             </div>
                   12094: 
                   12095:             <p>If a package uses intltool during its build, include
1.14      xtraeme  12096:             the <code class=
                   12097:             "filename">../../textproc/intltool/buildlink3.mk</code>
1.1       grant    12098:             file, which forces it to use the intltool package
                   12099:             provided by pkgsrc, instead of the one bundled with the
                   12100:             distribution file.</p>
                   12101: 
                   12102:             <p>This tracks intltool's build-time dependencies and
                   12103:             uses the latest available version; this way, the
                   12104:             package benefits of any bug fixes that may have
                   12105:             appeared since it was released.</p>
                   12106:           </div>
1.18      xtraeme  12107: 
                   12108:           <div class="sect2" lang="en" xml:lang="en">
                   12109:             <div class="titlepage">
                   12110:               <div>
                   12111:                 <div>
1.30      wiz      12112:                   <h3 class="title"><a name="startup-scripts" id=
1.38      dillo    12113:                   "startup-scripts"></a>15.5.15.&nbsp;Packages
1.30      wiz      12114:                   installing startup scripts</h3>
1.18      xtraeme  12115:                 </div>
                   12116:               </div>
                   12117:             </div>
                   12118: 
                   12119:             <p>If a package contains a rc.d script, it won't be
                   12120:             copied into the startup directory by default, but you
                   12121:             can enable it, by adding the option <code class=
                   12122:             "varname">PKG_RCD_SCRIPTS=YES</code> in <code class=
                   12123:             "filename">/etc/mk.conf</code>. This option will copy
                   12124:             the scripts into <code class=
                   12125:             "filename">/etc/rc.d</code> when a package is
                   12126:             installed, and it will automatically remove the scripts
                   12127:             when the package is deinstalled.</p>
                   12128:           </div>
1.1       grant    12129:         </div>
                   12130: 
                   12131:         <div class="sect1" lang="en" xml:lang="en">
                   12132:           <div class="titlepage">
                   12133:             <div>
                   12134:               <div>
                   12135:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      12136:                 "feedback-to-author" id=
1.38      dillo    12137:                 "feedback-to-author"></a>15.6.&nbsp;Feedback to the
1.30      wiz      12138:                 author</h2>
1.1       grant    12139:               </div>
                   12140:             </div>
                   12141:           </div>
                   12142: 
                   12143:           <p>If you have found any bugs in the package you make
                   12144:           available, if you had to do special steps to make it run
                   12145:           under NetBSD or if you enhanced the software in various
                   12146:           other ways, be sure to report these changes back to the
                   12147:           original author of the program! With that kind of
                   12148:           support, the next release of the program can incorporate
                   12149:           these fixes, and people not using the NetBSD packages
                   12150:           system can win from your efforts.</p>
                   12151: 
                   12152:           <p>Support the idea of free software!</p>
                   12153:         </div>
                   12154:       </div>
                   12155: 
                   12156:       <div class="chapter" lang="en" xml:lang="en">
                   12157:         <div class="titlepage">
                   12158:           <div>
                   12159:             <div>
                   12160:               <h2 class="title"><a name="debug" id=
1.38      dillo    12161:               "debug"></a>Chapter&nbsp;16.&nbsp;Debugging</h2>
1.1       grant    12162:             </div>
                   12163:           </div>
                   12164:         </div>
                   12165: 
                   12166:         <p>To check out all the gotchas when building a package,
                   12167:         here are the steps that I do in order to get a package
                   12168:         working. Please note this is basically the same as what was
                   12169:         explained in the previous sections, only with some
                   12170:         debugging aids.</p>
                   12171: 
                   12172:         <div class="itemizedlist">
                   12173:           <ul type="disc">
                   12174:             <li>
1.14      xtraeme  12175:               <p>Be sure to set <code class=
                   12176:               "varname">PKG_DEVELOPER=1</code> in <code class=
                   12177:               "filename">/etc/mk.conf</code></p>
1.1       grant    12178:             </li>
                   12179: 
                   12180:             <li>
                   12181:               <p>Install <a xmlns=
                   12182:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   12183:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.20      ben      12184:               class="pkgname">pkgtools/url2pkg</a>, create a
                   12185:               directory for a new package, change into it, then run
                   12186:               <span><strong class=
                   12187:               "command">url2pkg</strong></span>:</p>
1.1       grant    12188:               <pre class="screen">
1.14      xtraeme  12189: <code class="prompt">%</code> <strong class=
                   12190: "userinput"><code>mkdir /usr/pkgsrc/<em class=
                   12191: "replaceable"><code>category</code></em>/<em class=
                   12192: "replaceable"><code>examplepkg</code></em></code></strong>
                   12193: <code class="prompt">%</code> <strong class=
                   12194: "userinput"><code>cd /usr/pkgsrc/<em class=
                   12195: "replaceable"><code>category</code></em>/<em class=
                   12196: "replaceable"><code>examplepkg</code></em></code></strong>
                   12197: <code class="prompt">%</code> <strong class=
                   12198: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1       grant    12199: </pre>
                   12200:             </li>
                   12201: 
                   12202:             <li>
1.14      xtraeme  12203:               <p>Edit the <code class="filename">Makefile</code> as
1.1       grant    12204:               requested.</p>
                   12205:             </li>
                   12206: 
                   12207:             <li>
1.14      xtraeme  12208:               <p>Fill in the <code class="filename">DESCR</code>
1.1       grant    12209:               file</p>
                   12210:             </li>
                   12211: 
                   12212:             <li>
1.14      xtraeme  12213:               <p>Run <span><strong class="command">make
                   12214:               configure</strong></span></p>
1.1       grant    12215:             </li>
                   12216: 
                   12217:             <li>
                   12218:               <p>Add any dependencies glimpsed from documentation
1.14      xtraeme  12219:               and the configure step to the package's <code class=
                   12220:               "filename">Makefile</code>.</p>
1.1       grant    12221:             </li>
                   12222: 
                   12223:             <li>
                   12224:               <p>Make the package compile, doing multiple rounds
                   12225:               of</p>
                   12226:               <pre class="screen">
1.14      xtraeme  12227: <code class="prompt">%</code> <strong class=
                   12228: "userinput"><code>make</code></strong>
                   12229: <code class="prompt">%</code> <strong class=
                   12230: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
                   12231: <code class="prompt">%</code> <strong class=
                   12232: "userinput"><code>mkpatches</code></strong>
                   12233: <code class="prompt">%</code> <strong class=
                   12234: "userinput"><code>patchdiff</code></strong>
                   12235: <code class="prompt">%</code> <strong class=
                   12236: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
                   12237: <code class="prompt">%</code> <strong class=
                   12238: "userinput"><code>make mps</code></strong>
                   12239: <code class="prompt">%</code> <strong class=
                   12240: "userinput"><code>make clean</code></strong>
1.1       grant    12241: </pre>
                   12242: 
                   12243:               <p>Doing as non-root user will ensure that no files
                   12244:               are modified that shouldn't be, especially during the
1.14      xtraeme  12245:               build phase. <span><strong class=
                   12246:               "command">mkpatches</strong></span>,
                   12247:               <span><strong class=
                   12248:               "command">patchdiff</strong></span> and
                   12249:               <span><strong class="command">pkgvi</strong></span>
                   12250:               are from the <a xmlns=
1.1       grant    12251:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   12252:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20      ben      12253:               class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1       grant    12254:             </li>
                   12255: 
                   12256:             <li>
1.14      xtraeme  12257:               <p>Look at the <code class=
                   12258:               "filename">Makefile</code>, fix if necessary; see
                   12259:               <a href="#components.Makefile" title=
1.38      dillo    12260:               "8.1.&nbsp;Makefile">Section&nbsp;8.1,
1.14      xtraeme  12261:               &#8220;<code class=
                   12262:               "filename">Makefile</code>&#8221;</a>.</p>
1.1       grant    12263:             </li>
                   12264: 
                   12265:             <li>
1.14      xtraeme  12266:               <p>Generate a <code class=
                   12267:               "filename">PLIST</code>:</p>
1.1       grant    12268:               <pre class="screen">
1.14      xtraeme  12269: <code class="prompt">#</code> <strong class=
                   12270: "userinput"><code>make install</code></strong>
                   12271: <code class="prompt">#</code> <strong class=
                   12272: "userinput"><code>make print-PLIST &gt;PLIST</code></strong>
                   12273: <code class="prompt">#</code> <strong class=
                   12274: "userinput"><code>make deinstall</code></strong>
                   12275: <code class="prompt">#</code> <strong class=
                   12276: "userinput"><code>make install</code></strong>
                   12277: <code class="prompt">#</code> <strong class=
                   12278: "userinput"><code>make deinstall</code></strong>
1.1       grant    12279: </pre>
                   12280: 
1.14      xtraeme  12281:               <p>You usually need to be <code class=
                   12282:               "username">root</code> to do this. Look if there are
1.1       grant    12283:               any files left:</p>
                   12284:               <pre class="screen">
1.14      xtraeme  12285: <code class="prompt">#</code> <strong class=
                   12286: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    12287: </pre>
                   12288: 
                   12289:               <p>If this reveals any files that are missing in
1.14      xtraeme  12290:               <code class="filename">PLIST</code>, add them.</p>
1.1       grant    12291:             </li>
                   12292: 
                   12293:             <li>
1.14      xtraeme  12294:               <p>Now that the <code class="filename">PLIST</code>
                   12295:               is OK, install the package again and make a binary
1.1       grant    12296:               package:</p>
                   12297:               <pre class="screen">
1.14      xtraeme  12298: <code class="prompt">#</code> <strong class=
                   12299: "userinput"><code>make reinstall</code></strong>
                   12300: <code class="prompt">#</code> <strong class=
                   12301: "userinput"><code>make package</code></strong>
1.1       grant    12302: </pre>
                   12303:             </li>
                   12304: 
                   12305:             <li>
                   12306:               <p>Delete the installed package:</p>
                   12307:               <pre class="screen">
1.14      xtraeme  12308: <code class="prompt">#</code> <strong class=
                   12309: "userinput"><code>pkg_delete blub</code></strong>
1.1       grant    12310: </pre>
                   12311:             </li>
                   12312: 
                   12313:             <li>
1.14      xtraeme  12314:               <p>Repeat the above <span><strong class=
                   12315:               "command">make print-PLIST</strong></span> command,
                   12316:               which shouldn't find anything now:</p>
1.1       grant    12317:               <pre class="screen">
1.14      xtraeme  12318: <code class="prompt">#</code> <strong class=
                   12319: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    12320: </pre>
                   12321:             </li>
                   12322: 
                   12323:             <li>
                   12324:               <p>Reinstall the binary package:</p>
                   12325:               <pre class="screen">
1.14      xtraeme  12326: <code class="prompt">#</code> <strong class=
                   12327: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1       grant    12328: </pre>
                   12329:             </li>
                   12330: 
                   12331:             <li>
                   12332:               <p>Play with it. Make sure everything works.</p>
                   12333:             </li>
                   12334: 
                   12335:             <li>
1.14      xtraeme  12336:               <p>Run <span><strong class=
                   12337:               "command">pkglint</strong></span> from <a xmlns=
1.1       grant    12338:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   12339:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20      ben      12340:               class="pkgname">pkgtools/pkglint</a>, and fix the
                   12341:               problems it reports:</p>
1.1       grant    12342:               <pre class="screen">
1.14      xtraeme  12343: <code class="prompt">#</code> <strong class=
                   12344: "userinput"><code>pkglint</code></strong>
1.1       grant    12345: </pre>
                   12346:             </li>
                   12347: 
                   12348:             <li>
                   12349:               <p>Submit (or commit, if you have cvs access); see
                   12350:               <a href="#submit" title=
1.38      dillo    12351:               "Chapter&nbsp;17.&nbsp;Submitting and Committing">Chapter&nbsp;17,
1.1       grant    12352:               <i>Submitting and Committing</i></a>.</p>
                   12353:             </li>
                   12354:           </ul>
                   12355:         </div>
                   12356:       </div>
                   12357: 
                   12358:       <div class="chapter" lang="en" xml:lang="en">
                   12359:         <div class="titlepage">
                   12360:           <div>
                   12361:             <div>
                   12362:               <h2 class="title"><a name="submit" id=
1.38      dillo    12363:               "submit"></a>Chapter&nbsp;17.&nbsp;Submitting and
1.1       grant    12364:               Committing</h2>
                   12365:             </div>
                   12366:           </div>
                   12367:         </div>
                   12368: 
                   12369:         <div class="toc">
                   12370:           <p><b>Table of Contents</b></p>
                   12371: 
                   12372:           <dl>
1.30      wiz      12373:             <dt><span class="sect1"><a href=
1.38      dillo    12374:             "#submitting-your-package">17.1. Submitting your
1.30      wiz      12375:             packages</a></span></dt>
1.1       grant    12376: 
1.30      wiz      12377:             <dt><span class="sect1"><a href=
1.41      wiz      12378:             "#general-notes-for-changes">17.2. General notes when
                   12379:             adding, updating, or removing packages</a></span></dt>
                   12380: 
                   12381:             <dt><span class="sect1"><a href=
                   12382:             "#committing-importing">17.3. Committing: Importing a
1.30      wiz      12383:             package into CVS</a></span></dt>
1.1       grant    12384: 
1.30      wiz      12385:             <dt><span class="sect1"><a href=
1.41      wiz      12386:             "#updating-package">17.4. Updating a package to a newer
1.30      wiz      12387:             version</a></span></dt>
1.1       grant    12388: 
1.41      wiz      12389:             <dt><span class="sect1"><a href="#moving-package">17.5.
1.2       hubertf  12390:             Moving a package in pkgsrc</a></span></dt>
1.1       grant    12391:           </dl>
                   12392:         </div>
                   12393: 
                   12394:         <div class="sect1" lang="en" xml:lang="en">
                   12395:           <div class="titlepage">
                   12396:             <div>
                   12397:               <div>
                   12398:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      12399:                 "submitting-your-package" id=
1.38      dillo    12400:                 "submitting-your-package"></a>17.1.&nbsp;Submitting
1.30      wiz      12401:                 your packages</h2>
1.1       grant    12402:               </div>
                   12403:             </div>
                   12404:           </div>
                   12405: 
                   12406:           <p>You have to separate between binary and
                   12407:           &#8220;<span class="quote">normal</span>&#8221; (source)
                   12408:           packages here:</p>
                   12409: 
                   12410:           <div class="itemizedlist">
                   12411:             <ul type="disc">
                   12412:               <li>
                   12413:                 <p>precompiled binary packages</p>
                   12414: 
                   12415:                 <p>Our policy is that we accept binaries only from
                   12416:                 pkgsrc developers to guarantee that the packages
                   12417:                 don't contain any trojan horses etc. This is not to
1.13      hubertf  12418:                 annoy anyone but rather to protect our users!
1.1       grant    12419:                 You're still free to put up your home-made binary
1.13      hubertf  12420:                 packages and tell the world where to get them.
                   12421:                 NetBSD developers doing bulk builds and wanting to
                   12422:                 upload them please see <a href="#bulk-upload"
1.38      dillo    12423:                 title="6.3.8.&nbsp;Uploading results of a bulk build">
                   12424:                 Section&nbsp;6.3.8, &#8220;Uploading results of a
1.13      hubertf  12425:                 bulk build&#8221;</a>.</p>
1.1       grant    12426:               </li>
                   12427: 
                   12428:               <li>
                   12429:                 <p>packages</p>
                   12430: 
                   12431:                 <p>First, check that your package is complete,
                   12432:                 compiles and runs well; see <a href="#debug" title=
1.38      dillo    12433:                 "Chapter&nbsp;16.&nbsp;Debugging">Chapter&nbsp;16,
1.1       grant    12434:                 <i>Debugging</i></a> and the rest of this document.
1.24      wiz      12435:                 Next, generate an uuencoded gzipped <a href=
                   12436:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   12437:                 <span class="citerefentry"><span class=
                   12438:                 "refentrytitle">tar</span>(1)</span></a> archive,
1.1       grant    12439:                 preferably with all files in a single directory.
1.14      xtraeme  12440:                 Finally, <span><strong class=
                   12441:                 "command">send-pr</strong></span> with category
1.1       grant    12442:                 &#8220;<span class="quote">pkg</span>&#8221;, a
                   12443:                 synopsis which includes the package name and
                   12444:                 version number, a short description of your package
                   12445:                 (contents of the COMMENT variable or DESCR file are
                   12446:                 OK) and attach the archive to your PR.</p>
                   12447: 
                   12448:                 <p>If you want to submit several packages, please
                   12449:                 send a separate PR for each one, it's easier for us
                   12450:                 to track things that way.</p>
                   12451: 
                   12452:                 <p>Alternatively, you can also import new packages
                   12453:                 into pkgsrc-wip (&#8220;<span class="quote">pkgsrc
                   12454:                 work-in-progress</span>&#8221;); see the homepage
                   12455:                 at <a href="http://pkgsrc-wip.sourceforge.net/"
                   12456:                 target=
                   12457:                 "_top">http://pkgsrc-wip.sourceforge.net/</a> for
                   12458:                 details.</p>
                   12459:               </li>
                   12460:             </ul>
                   12461:           </div>
                   12462:         </div>
                   12463: 
                   12464:         <div class="sect1" lang="en" xml:lang="en">
                   12465:           <div class="titlepage">
                   12466:             <div>
                   12467:               <div>
                   12468:                 <h2 class="title" style="clear: both"><a name=
1.41      wiz      12469:                 "general-notes-for-changes" id=
                   12470:                 "general-notes-for-changes"></a>17.2.&nbsp;General
                   12471:                 notes when adding, updating, or removing
                   12472:                 packages</h2>
                   12473:               </div>
                   12474:             </div>
                   12475:           </div>
                   12476: 
                   12477:           <p>Please note all package additions, updates, moves, and
                   12478:           removals in <code class=
                   12479:           "filename">pkgsrc/doc/CHANGES</code>. It's very important
                   12480:           to keep this file up to date and conforming to the
                   12481:           existing format, because it will be used by scripts to
                   12482:           automatically update pages on <a href=
                   12483:           "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
                   12484:           and other sites. Additionally, check the <code class=
                   12485:           "filename">pkgsrc/doc/TODO</code> file and remove the
                   12486:           entry for the package you updated or removed, in case it
                   12487:           was mentioned there.</p>
                   12488: 
                   12489:           <p>There is a make target that helps in creating proper
                   12490:           <code class="filename">CHANGES</code> entries:
                   12491:           <span><strong class="command">make
                   12492:           changes-entry</strong></span>. It uses the optional
                   12493:           <code class="varname">CTYPE</code> and <code class=
                   12494:           "varname">NETBSD_LOGIN_NAME</code> variables. The general
                   12495:           usage is to first make sure that your <code class=
                   12496:           "filename">CHANGES</code> file is up-to-date (to avoid
                   12497:           having to resolve conflicts later-on) and then to
                   12498:           <span><strong class="command">cd</strong></span> to the
                   12499:           package directory. For package updates,
                   12500:           <span><strong class="command">make
                   12501:           changes-entry</strong></span> is enough. For new
                   12502:           packages, or package moves or removals, set the
                   12503:           <code class="varname">CTYPE</code> variable on the
                   12504:           command line to "Added", "Moved", or "Removed". You can
                   12505:           set <code class="varname">NETBSD_LOGIN_NAME</code> in
                   12506:           <code class="filename">/etc/mk.conf</code> if your local
                   12507:           login name is not the same as your NetBSD login name.
                   12508:           Don't forget to commit the changes to <code class=
                   12509:           "filename">pkgsrc/doc/CHANGES</code>!</p>
                   12510:         </div>
                   12511: 
                   12512:         <div class="sect1" lang="en" xml:lang="en">
                   12513:           <div class="titlepage">
                   12514:             <div>
                   12515:               <div>
                   12516:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      12517:                 "committing-importing" id=
1.41      wiz      12518:                 "committing-importing"></a>17.3.&nbsp;Committing:
1.30      wiz      12519:                 Importing a package into CVS</h2>
1.1       grant    12520:               </div>
                   12521:             </div>
                   12522:           </div>
                   12523: 
                   12524:           <p>This section is only of interest for pkgsrc developers
                   12525:           with write access to the pkgsrc repository. Please
                   12526:           remember that cvs imports files relative to the current
                   12527:           working directory, and that the pathname that you give
1.14      xtraeme  12528:           the <span><strong class="command">cvs
                   12529:           import</strong></span> command is so that it knows where
                   12530:           to place the files in the repository. Newly created
                   12531:           packages should be imported with a vendor tag of
                   12532:           &#8220;<span class="quote">TNF</span>&#8221; and a
                   12533:           release tag of &#8220;<span class=
                   12534:           "quote">pkgsrc-base</span>&#8221;, e.g:</p>
1.1       grant    12535:           <pre class="programlisting">
                   12536:   % cd .../pkgsrc/category/pkgname
                   12537:   % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
                   12538: </pre>
                   12539: 
                   12540:           <p>Remember to move the directory from which you imported
                   12541:           out of the way, or cvs will complain the next time you
                   12542:           &#8220;<span class="quote">cvs update</span>&#8221; your
                   12543:           source tree. Also don't forget to add the new package to
1.14      xtraeme  12544:           the category's <code class=
                   12545:           "filename">Makefile</code>.</p>
1.1       grant    12546: 
                   12547:           <p>The commit message of the initial import should
1.14      xtraeme  12548:           include part of the <code class="filename">DESCR</code>
                   12549:           file, so people reading the mailing lists know what the
                   12550:           package is/does.</p>
1.1       grant    12551: 
                   12552:           <p>For new packages, &#8220;<span class="quote">cvs
                   12553:           import</span>&#8221; is preferred to &#8220;<span class=
                   12554:           "quote">cvs add</span>&#8221; because the former gets
                   12555:           everything with a single command, and provides a
                   12556:           consistent tag.</p>
                   12557:         </div>
                   12558: 
                   12559:         <div class="sect1" lang="en" xml:lang="en">
                   12560:           <div class="titlepage">
                   12561:             <div>
                   12562:               <div>
                   12563:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      12564:                 "updating-package" id=
1.41      wiz      12565:                 "updating-package"></a>17.4.&nbsp;Updating a
1.30      wiz      12566:                 package to a newer version</h2>
1.1       grant    12567:               </div>
                   12568:             </div>
                   12569:           </div>
                   12570: 
                   12571:           <p>Please always put a concise, appropriate and relevant
                   12572:           summary of the changes between old and new versions into
                   12573:           the commit log when updating a package. There are various
                   12574:           reasons for this:</p>
                   12575: 
                   12576:           <div class="itemizedlist">
                   12577:             <ul type="disc">
                   12578:               <li>
                   12579:                 <p>A URL is volatile, and can change over time. It
                   12580:                 may go away completely or its information may be
                   12581:                 overwritten by newer information.</p>
                   12582:               </li>
                   12583: 
                   12584:               <li>
                   12585:                 <p>Having the change information between old and
                   12586:                 new versions in our CVS repository is very useful
                   12587:                 for people who use either cvs or anoncvs.</p>
                   12588:               </li>
                   12589: 
                   12590:               <li>
                   12591:                 <p>Having the change information between old and
                   12592:                 new versions in our CVS repository is very useful
                   12593:                 for people who read the pkgsrc-changes mailing
                   12594:                 list, so that they can make tactical decisions
                   12595:                 about when to upgrade the package.</p>
                   12596:               </li>
                   12597:             </ul>
                   12598:           </div>
                   12599: 
1.18      xtraeme  12600:           <p>Please also recognize that, just because a new version
1.1       grant    12601:           of a package has been released, it should not
                   12602:           automatically be upgraded in the CVS repository. We
                   12603:           prefer to be conservative in the packages that are
                   12604:           included in pkgsrc - development or beta packages are not
                   12605:           really the best thing for most places in which pkgsrc is
                   12606:           used. Please use your judgement about what should go into
                   12607:           pkgsrc, and bear in mind that stability is to be
                   12608:           preferred above new and possibly untested features.</p>
                   12609:         </div>
                   12610: 
                   12611:         <div class="sect1" lang="en" xml:lang="en">
                   12612:           <div class="titlepage">
                   12613:             <div>
                   12614:               <div>
                   12615:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      12616:                 "moving-package" id=
1.41      wiz      12617:                 "moving-package"></a>17.5.&nbsp;Moving a package in
1.30      wiz      12618:                 pkgsrc</h2>
1.1       grant    12619:               </div>
                   12620:             </div>
                   12621:           </div>
                   12622: 
                   12623:           <div class="orderedlist">
                   12624:             <ol type="1">
                   12625:               <li>
                   12626:                 <p>Make a copy of the directory somewhere else.</p>
                   12627:               </li>
                   12628: 
                   12629:               <li>
                   12630:                 <p>Remove all CVS dirs.</p>
                   12631: 
                   12632:                 <p>Alternatively to the first two steps you can
                   12633:                 also do:</p>
                   12634:                 <pre class="screen">
1.14      xtraeme  12635: <code class="prompt">%</code> <strong class=
                   12636: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1       grant    12637: </pre>
                   12638: 
                   12639:                 <p>and use that for further work.</p>
                   12640:               </li>
                   12641: 
                   12642:               <li>
1.14      xtraeme  12643:                 <p>Fix <code class="varname">CATEGORIES</code> and
                   12644:                 any <code class="varname">DEPENDS</code> paths that
                   12645:                 just did &#8220;<span class=
1.1       grant    12646:                 "quote">../package</span>&#8221; instead of
                   12647:                 &#8220;<span class=
                   12648:                 "quote">../../category/package</span>&#8221;.</p>
                   12649:               </li>
                   12650: 
                   12651:               <li>
1.14      xtraeme  12652:                 <p><span><strong class="command">cvs
                   12653:                 import</strong></span> the modified package in the
                   12654:                 new place.</p>
1.1       grant    12655:               </li>
                   12656: 
                   12657:               <li>
                   12658:                 <p>Check if any package depends on it:</p>
                   12659:                 <pre class="screen">
1.14      xtraeme  12660: <code class="prompt">%</code> <strong class=
                   12661: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   12662: <code class="prompt">%</code> <strong class=
                   12663: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1       grant    12664: </pre>
                   12665:               </li>
                   12666: 
                   12667:               <li>
                   12668:                 <p>Fix paths in packages from step 5 to point to
                   12669:                 new location.</p>
                   12670:               </li>
                   12671: 
                   12672:               <li>
1.14      xtraeme  12673:                 <p><span><strong class="command">cvs rm
                   12674:                 (-f)</strong></span> the package at the old
                   12675:                 location.</p>
1.1       grant    12676:               </li>
                   12677: 
                   12678:               <li>
1.14      xtraeme  12679:                 <p>Remove from <code class=
                   12680:                 "filename">oldcategory/Makefile</code>.</p>
1.1       grant    12681:               </li>
                   12682: 
                   12683:               <li>
1.14      xtraeme  12684:                 <p>Add to <code class=
                   12685:                 "filename">newcategory/Makefile</code>.</p>
1.1       grant    12686:               </li>
                   12687: 
                   12688:               <li>
                   12689:                 <p>Commit the changed and removed files:</p>
                   12690:                 <pre class="screen">
1.14      xtraeme  12691: <code class="prompt">%</code> <strong class=
                   12692: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1       grant    12693: </pre>
                   12694: 
                   12695:                 <p>(and any packages from step 5, of course).</p>
                   12696:               </li>
                   12697:             </ol>
                   12698:           </div>
                   12699:         </div>
                   12700:       </div>
                   12701:     </div>
                   12702: 
                   12703:     <div class="appendix" lang="en" xml:lang="en">
                   12704:       <div class="titlepage">
                   12705:         <div>
                   12706:           <div>
                   12707:             <h2 class="title"><a name="examples" id=
                   12708:             "examples"></a>Appendix&nbsp;A.&nbsp;A simple example
                   12709:             package: bison</h2>
                   12710:           </div>
                   12711:         </div>
                   12712:       </div>
                   12713: 
                   12714:       <div class="toc">
                   12715:         <p><b>Table of Contents</b></p>
                   12716: 
                   12717:         <dl>
1.30      wiz      12718:           <dt><span class="sect1"><a href="#example-files">A.1.
1.1       grant    12719:           files</a></span></dt>
                   12720: 
                   12721:           <dd>
                   12722:             <dl>
1.30      wiz      12723:               <dt><span class="sect2"><a href=
                   12724:               "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1       grant    12725: 
1.30      wiz      12726:               <dt><span class="sect2"><a href=
                   12727:               "#example-descr">A.1.2. DESCR</a></span></dt>
1.1       grant    12728: 
1.30      wiz      12729:               <dt><span class="sect2"><a href=
                   12730:               "#example-plist">A.1.3. PLIST</a></span></dt>
1.1       grant    12731: 
1.30      wiz      12732:               <dt><span class="sect2"><a href=
                   12733:               "#checking-package-with-pkglint">A.1.4. Checking a
                   12734:               package with <span><strong class=
1.14      xtraeme  12735:               "command">pkglint</strong></span></a></span></dt>
1.1       grant    12736:             </dl>
                   12737:           </dd>
                   12738: 
1.30      wiz      12739:           <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
                   12740:           Steps for building, installing, packaging</a></span></dt>
1.1       grant    12741:         </dl>
                   12742:       </div>
                   12743: 
                   12744:       <p>We checked to find a piece of software that wasn't in the
                   12745:       packages collection, and picked GNU bison. Quite why someone
1.14      xtraeme  12746:       would want to have <span><strong class=
                   12747:       "command">bison</strong></span> when Berkeley
                   12748:       <span><strong class="command">yacc</strong></span> is already
                   12749:       present in the tree is beyond us, but it's useful for the
                   12750:       purposes of this exercise.</p>
1.1       grant    12751: 
                   12752:       <div class="sect1" lang="en" xml:lang="en">
                   12753:         <div class="titlepage">
                   12754:           <div>
                   12755:             <div>
                   12756:               <h2 class="title" style="clear: both"><a name=
1.30      wiz      12757:               "example-files" id=
                   12758:               "example-files"></a>A.1.&nbsp;files</h2>
1.1       grant    12759:             </div>
                   12760:           </div>
                   12761:         </div>
                   12762: 
                   12763:         <div class="sect2" lang="en" xml:lang="en">
                   12764:           <div class="titlepage">
                   12765:             <div>
                   12766:               <div>
1.30      wiz      12767:                 <h3 class="title"><a name="example-Makefile" id=
                   12768:                 "example-Makefile"></a>A.1.1.&nbsp;Makefile</h3>
1.1       grant    12769:               </div>
                   12770:             </div>
                   12771:           </div>
                   12772:           <pre class="programlisting">
1.17      sketch   12773: # $NetBSD$
1.1       grant    12774: #
                   12775: 
                   12776: DISTNAME=       bison-1.25
                   12777: CATEGORIES=     devel
                   12778: MASTER_SITES=   ${MASTER_SITE_GNU}
                   12779: 
                   12780: MAINTAINER=     thorpej@NetBSD.org
                   12781: HOMEPAGE=       http://www.gnu.org/software/bison/bison.html
                   12782: COMMENT=        GNU yacc clone
                   12783: 
                   12784: GNU_CONFIGURE=  yes
                   12785: INFO_FILES=     bison.info
                   12786: 
                   12787: .include "../../mk/bsd.pkg.mk"
                   12788: </pre>
                   12789:         </div>
                   12790: 
                   12791:         <div class="sect2" lang="en" xml:lang="en">
                   12792:           <div class="titlepage">
                   12793:             <div>
                   12794:               <div>
1.30      wiz      12795:                 <h3 class="title"><a name="example-descr" id=
                   12796:                 "example-descr"></a>A.1.2.&nbsp;DESCR</h3>
1.1       grant    12797:               </div>
                   12798:             </div>
                   12799:           </div>
                   12800:           <pre class="programlisting">
                   12801: GNU version of yacc.  Can make re-entrant parsers, and numerous other
                   12802: improvements.  Why you would want this when Berkeley <a href=
                   12803: "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
                   12804: of the NetBSD source tree is beyond me.
                   12805: </pre>
                   12806:         </div>
                   12807: 
                   12808:         <div class="sect2" lang="en" xml:lang="en">
                   12809:           <div class="titlepage">
                   12810:             <div>
                   12811:               <div>
1.30      wiz      12812:                 <h3 class="title"><a name="example-plist" id=
                   12813:                 "example-plist"></a>A.1.3.&nbsp;PLIST</h3>
1.1       grant    12814:               </div>
                   12815:             </div>
                   12816:           </div>
                   12817:           <pre class="programlisting">
1.17      sketch   12818: @comment $NetBSD$
1.1       grant    12819: bin/bison
                   12820: man/man1/bison.1.gz
                   12821: share/bison.simple
                   12822: share/bison.hairy
                   12823: </pre>
                   12824:         </div>
                   12825: 
                   12826:         <div class="sect2" lang="en" xml:lang="en">
                   12827:           <div class="titlepage">
                   12828:             <div>
                   12829:               <div>
1.30      wiz      12830:                 <h3 class="title"><a name=
                   12831:                 "checking-package-with-pkglint" id=
                   12832:                 "checking-package-with-pkglint"></a>A.1.4.&nbsp;Checking
                   12833:                 a package with <span><strong class=
1.14      xtraeme  12834:                 "command">pkglint</strong></span></h3>
1.1       grant    12835:               </div>
                   12836:             </div>
                   12837:           </div>
                   12838: 
                   12839:           <p>The NetBSD package system comes with <a xmlns=
                   12840:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   12841:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20      ben      12842:           class="pkgname">pkgtools/pkglint</a> which helps to check
                   12843:           the contents of these files. After installation it is
                   12844:           quite easy to use, just change to the directory of the
                   12845:           package you wish to examine and execute
                   12846:           <span><strong class=
                   12847:           "command">pkglint</strong></span>:</p>
1.1       grant    12848:           <pre class="screen">
1.14      xtraeme  12849: <code class="prompt">$</code> <strong class=
                   12850: "userinput"><code>pkglint</code></strong>
1.1       grant    12851: looks fine.
                   12852: </pre>
                   12853: 
                   12854:           <p>Depending on the supplied command line arguments (see
                   12855:           pkglint(1)) more verbose checks will be performed. Use
1.14      xtraeme  12856:           e.g. <span><strong class="command">pkglint
                   12857:           -v</strong></span> for a very verbose check.</p>
1.1       grant    12858:         </div>
                   12859:       </div>
                   12860: 
                   12861:       <div class="sect1" lang="en" xml:lang="en">
                   12862:         <div class="titlepage">
                   12863:           <div>
                   12864:             <div>
                   12865:               <h2 class="title" style="clear: both"><a name=
1.30      wiz      12866:               "steps-for-b-i-p" id=
                   12867:               "steps-for-b-i-p"></a>A.2.&nbsp;Steps for building,
                   12868:               installing, packaging</h2>
1.1       grant    12869:             </div>
                   12870:           </div>
                   12871:         </div>
                   12872: 
                   12873:         <p>Create the directory where the package lives, plus any
                   12874:         auxiliary directories:</p>
                   12875:         <pre class="screen">
1.14      xtraeme  12876: <code class="prompt">#</code> <strong class=
                   12877: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
                   12878: <code class="prompt">#</code> <strong class=
                   12879: "userinput"><code>mkdir bison</code></strong>
                   12880: <code class="prompt">#</code> <strong class=
                   12881: "userinput"><code>cd bison</code></strong>
                   12882: <code class="prompt">#</code> <strong class=
                   12883: "userinput"><code>mkdir patches</code></strong>
1.1       grant    12884: </pre>
                   12885: 
1.14      xtraeme  12886:         <p>Create <code class="filename">Makefile</code>,
                   12887:         <code class="filename">DESCR</code> and <code class=
                   12888:         "filename">PLIST</code> (see <a href="#components" title=
1.38      dillo    12889:         "Chapter&nbsp;8.&nbsp;Package components - files, directories and contents">
                   12890:         Chapter 8, <i>Package components - files, directories and
1.1       grant    12891:         contents</i></a>) then continue with fetching the
                   12892:         distfile:</p>
                   12893:         <pre class="screen">
1.14      xtraeme  12894: <code class="prompt">#</code> <strong class=
                   12895: "userinput"><code>make fetch</code></strong>
1.1       grant    12896: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   12897: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   12898: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   12899: ftp: Error retrieving file: 500 Internal error
                   12900: 
                   12901: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   12902: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   12903: ftp: Error retrieving file: 500 Internal error
                   12904: 
                   12905: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   12906: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   12907: Successfully retrieved file.
                   12908: </pre>
                   12909: 
1.14      xtraeme  12910:         <p>Generate the checksum of the distfile into <code class=
                   12911:         "filename">distinfo</code>:</p>
1.1       grant    12912:         <pre class="screen">
1.14      xtraeme  12913: <code class="prompt">#</code> <strong class=
                   12914: "userinput"><code>make makesum</code></strong>
1.1       grant    12915: </pre>
                   12916: 
                   12917:         <p>Now compile:</p>
                   12918:         <pre class="screen">
1.14      xtraeme  12919: <code class="prompt">#</code> <strong class=
                   12920: "userinput"><code>make</code></strong>
1.1       grant    12921: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   12922: ===&gt;  Extracting for bison-1.25
                   12923: ===&gt;  Patching for bison-1.25
                   12924: ===&gt;   Ignoring empty patch directory
                   12925: ===&gt;  Configuring for bison-1.25
                   12926: creating cache ./config.cache
                   12927: checking for gcc... cc
                   12928: checking whether we are using GNU C... yes
                   12929: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   12930: checking how to run the C preprocessor... cc -E
                   12931: checking for minix/config.h... no
                   12932: checking for POSIXized ISC... no
                   12933: checking whether cross-compiling... no
                   12934: checking for ANSI C header files... yes
                   12935: checking for string.h... yes
                   12936: checking for stdlib.h... yes
                   12937: checking for memory.h... yes
                   12938: checking for working const... yes
                   12939: checking for working alloca.h... no
                   12940: checking for alloca... yes
                   12941: checking for strerror... yes
                   12942: updating cache ./config.cache
                   12943: creating ./config.status
                   12944: creating Makefile
                   12945: ===&gt;  Building for bison-1.25
                   12946: 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
                   12947: 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
                   12948: 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
                   12949: 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
                   12950: 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
                   12951: 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 
                   12952: 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
                   12953: 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
                   12954: 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
                   12955: 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
                   12956: 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
                   12957: 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
                   12958: 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
                   12959: 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
                   12960: 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
                   12961: 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
                   12962: 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
                   12963: 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
                   12964: 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
                   12965: 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
                   12966: 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
                   12967: 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
                   12968: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   12969: rm -f bison.s1
                   12970: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1
                   12971: </pre>
                   12972: 
                   12973:         <p>Everything seems OK, so install the files:</p>
                   12974:         <pre class="screen">
1.14      xtraeme  12975: <code class="prompt">#</code> <strong class=
                   12976: "userinput"><code>make install</code></strong>
1.1       grant    12977: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   12978: ===&gt;  Installing for bison-1.25
                   12979: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   12980: rm -f /usr/pkg/bin/bison
                   12981: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   12982: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   12983: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   12984: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   12985: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   12986: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   12987: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
                   12988: ===&gt;  Registering installation for bison-1.25
                   12989: </pre>
                   12990: 
                   12991:         <p>You can now use bison, and also - if you decide so -
1.14      xtraeme  12992:         remove it with <span><strong class="command">pkg_delete
                   12993:         bison</strong></span>. Should you decide that you want a
                   12994:         binary package, do this now:</p>
1.1       grant    12995:         <pre class="screen">
1.14      xtraeme  12996: <code class="prompt">#</code> <strong class=
                   12997: "userinput"><code>make package</code></strong>
1.1       grant    12998: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   12999: ===&gt;  Building package for bison-1.25
                   13000: Creating package bison-1.25.tgz
                   13001: Registering depends:.
                   13002: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
                   13003: </pre>
                   13004: 
                   13005:         <p>Now that you don't need the source and object files any
                   13006:         more, clean up:</p>
                   13007:         <pre class="screen">
1.14      xtraeme  13008: <code class="prompt">#</code> <strong class=
                   13009: "userinput"><code>make clean</code></strong>
1.1       grant    13010: ===&gt;  Cleaning for bison-1.25
                   13011: </pre>
                   13012:       </div>
                   13013:     </div>
                   13014: 
                   13015:     <div class="appendix" lang="en" xml:lang="en">
                   13016:       <div class="titlepage">
                   13017:         <div>
                   13018:           <div>
                   13019:             <h2 class="title"><a name="logs" id=
                   13020:             "logs"></a>Appendix&nbsp;B.&nbsp;Build logs</h2>
                   13021:           </div>
                   13022:         </div>
                   13023:       </div>
                   13024: 
                   13025:       <div class="toc">
                   13026:         <p><b>Table of Contents</b></p>
                   13027: 
                   13028:         <dl>
                   13029:           <dt><span class="sect1"><a href="#logs.building">B.1.
                   13030:           Building figlet</a></span></dt>
                   13031: 
                   13032:           <dt><span class="sect1"><a href="#logs.package">B.2.
                   13033:           Packaging figlet</a></span></dt>
                   13034:         </dl>
                   13035:       </div>
                   13036: 
                   13037:       <div class="sect1" lang="en" xml:lang="en">
                   13038:         <div class="titlepage">
                   13039:           <div>
                   13040:             <div>
                   13041:               <h2 class="title" style="clear: both"><a name=
                   13042:               "logs.building" id=
                   13043:               "logs.building"></a>B.1.&nbsp;Building figlet</h2>
                   13044:             </div>
                   13045:           </div>
                   13046:         </div>
                   13047:         <pre class="screen">
1.14      xtraeme  13048: <code class="prompt">#</code> <strong class=
                   13049: "userinput"><code>make</code></strong>
1.1       grant    13050: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   13051: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   13052: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   13053: =&gt; [172219 bytes]
                   13054: Connected to ftp.plig.net.
                   13055: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   13056: 331 Guest login ok, send your complete e-mail address as password.
                   13057: 230-You are user #5 of 500 simultaneous users allowed.
                   13058: 230-
                   13059: 230-  ___ _             _ _                   
                   13060: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___ 
                   13061: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   13062: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   13063: 230-         |_|   |_|     |___|         |___|
                   13064: 230-
                   13065: 230-** Welcome to ftp.plig.org **
                   13066: 230-
                   13067: 230-Please note that all transfers from this FTP site are logged. If you
                   13068: 230-do not like this, please disconnect now.
                   13069: 230-
                   13070: 230-This arhive is available via
                   13071: 230-
                   13072: 230-HTTP:  http://ftp.plig.org/
                   13073: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   13074: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   13075: 230-
                   13076: 230-Please email comments, bug reports and requests for packages to be
                   13077: 230-mirrored to ftp-admin@plig.org.   
                   13078: 230-
                   13079: 230-
                   13080: 230 Logged in anonymously.
                   13081: Remote system type is UNIX.
                   13082: Using binary mode to transfer files.
                   13083: 200 Type okay.
                   13084: 250 "/pub" is new cwd.
                   13085: 250-"/pub/figlet" is new cwd.
                   13086: 250-
                   13087: 250-Welcome to the figlet archive at ftp.figlet.org
                   13088: 250-    
                   13089: 250-    ftp://ftp.figlet.org/pub/figlet/
                   13090: 250-
                   13091: 250-The official FIGlet web page is:
                   13092: 250-    http://www.figlet.org/
                   13093: 250-
                   13094: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   13095: 250-contribute a font or something else, you can email us.
                   13096: 250 
                   13097: 250 "/pub/figlet/program" is new cwd.
                   13098: 250 "/pub/figlet/program/unix" is new cwd.
                   13099: local: figlet221.tar.gz remote: figlet221.tar.gz
                   13100: 502 Unimplemented command.
                   13101: 227 Entering Passive Mode (195,40,6,41,246,104)
                   13102: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   13103: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   13104: 226 Transfer completed.
                   13105: 172219 bytes received in 00:02 (75.99 KB/s)
                   13106: 221 Goodbye.
                   13107: =&gt; Checksum OK for figlet221.tar.gz.
                   13108: ===&gt; Extracting for figlet-2.2.1nb2
                   13109: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   13110: ===&gt; Patching for figlet-2.2.1nb2
                   13111: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   13112: ===&gt; Overriding tools for figlet-2.2.1nb2
                   13113: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   13114: ===&gt; Configuring for figlet-2.2.1nb2
                   13115: ===&gt; Building for figlet-2.2.1nb2
                   13116: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   13117: chmod a+x figlet
                   13118: gcc -O2 -o chkfont chkfont.c
                   13119: =&gt; Unwrapping files-to-be-installed.
1.14      xtraeme  13120: <code class="prompt">#</code>
                   13121: <code class="prompt">#</code> <strong class=
                   13122: "userinput"><code>make install</code></strong>
1.1       grant    13123: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   13124: ===&gt; Installing for figlet-2.2.1nb2
                   13125: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   13126: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   13127: mkdir -p /usr/pkg/share/figlet
                   13128: cp figlet /usr/pkg/bin
                   13129: cp chkfont /usr/pkg/bin
                   13130: chmod 555 figlist showfigfonts
                   13131: cp figlist /usr/pkg/bin
                   13132: cp showfigfonts /usr/pkg/bin
                   13133: cp fonts/*.flf /usr/pkg/share/figlet
                   13134: cp fonts/*.flc /usr/pkg/share/figlet
                   13135: cp figlet.6 /usr/pkg/man/man6
                   13136: ===&gt; Registering installation for figlet-2.2.1nb2
1.14      xtraeme  13137: <code class="prompt">#</code>
1.1       grant    13138: </pre>
                   13139:       </div>
                   13140: 
                   13141:       <div class="sect1" lang="en" xml:lang="en">
                   13142:         <div class="titlepage">
                   13143:           <div>
                   13144:             <div>
                   13145:               <h2 class="title" style="clear: both"><a name=
                   13146:               "logs.package" id=
                   13147:               "logs.package"></a>B.2.&nbsp;Packaging figlet</h2>
                   13148:             </div>
                   13149:           </div>
                   13150:         </div>
                   13151:         <pre class="screen">
1.14      xtraeme  13152: <code class="prompt">#</code> <strong class=
                   13153: "userinput"><code>make package</code></strong>
1.1       grant    13154: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   13155: ===&gt; Packaging figlet-2.2.1nb2
                   13156: ===&gt; Building binary package for figlet-2.2.1nb2
                   13157: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   13158: Using SrcDir value of /usr/pkg
                   13159: Registering depends:.  
1.14      xtraeme  13160: <code class="prompt">#</code>
1.1       grant    13161: </pre>
                   13162:       </div>
                   13163:     </div>
                   13164: 
                   13165:     <div class="appendix" lang="en" xml:lang="en">
                   13166:       <div class="titlepage">
                   13167:         <div>
                   13168:           <div>
                   13169:             <h2 class="title"><a name="ftp-layout" id=
                   13170:             "ftp-layout"></a>Appendix&nbsp;C.&nbsp;Layout of the
                   13171:             FTP server's package archive</h2>
                   13172:           </div>
                   13173:         </div>
                   13174:       </div>
                   13175: 
                   13176:       <p>Layout for precompiled binary packages on
                   13177:       ftp.NetBSD.org:</p>
                   13178:       <pre class="programlisting">
                   13179: /pub/NetBSD/packages/
                   13180:                 distfiles/
                   13181: 
                   13182:                 # Unpacked pkgsrc trees
                   13183:                 pkgsrc-current -&gt; /pub/NetBSD/NetBSD-current/pkgsrc
                   13184:                 pkgsrc-2003Q4 -&gt; N/A
                   13185:                 pkgsrc-2004Q1/pkgsrc
                   13186: 
                   13187:                 # pkgsrc archives
                   13188:                 pkgsrc-current.tar.gz -&gt; ../NetBSD-current/tar_files/pkgsrc.tar.gz
                   13189:                 pkgsrc-2003Q4.tar.gz -&gt; N/A
                   13190:                 pkgsrc-2004Q1.tar.gz -&gt; N/A
                   13191: 
                   13192:                 # Per pkgsrc-release/OS-release/arch package archives
                   13193:                 pkgsrc-2003Q4/
                   13194:                         NetBSD-1.6.2/
                   13195:                                 i386/
                   13196:                                         All/
                   13197:                                         archivers/
                   13198:                                                 foo -&gt; ../All/foo
                   13199:                                         ...
                   13200:                 pkgsrc-2004Q1/
                   13201:                         NetBSD-1.6.2/
                   13202:                                 i386/
                   13203:                                         All/
                   13204:                                         ...
                   13205:                         NetBSD-2.0/
                   13206:                                 i386/
                   13207:                                         All/
                   13208:                                         ...
                   13209:                         SunOS-5.9/
                   13210:                                 sparc/
                   13211:                                         All/
                   13212:                                         ...
                   13213:                                 x86/
                   13214:                                         All/
                   13215:                                         ...
                   13216: 
                   13217:                 # Per os-release package archive convenience links
                   13218:                 NetBSD-1.6.2 -&gt; 1.6.2
                   13219:                 1.6.2/
                   13220:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
                   13221:                         m68k/
                   13222:                                 All/
                   13223:                                 archivers/
                   13224:                                         foo -&gt; ../All/foo
                   13225:                                 ...
                   13226:                         amiga -&gt; m68k
                   13227:                         atari -&gt; m68k
                   13228:                         ...
                   13229: 
                   13230:                 2.0 -&gt; NetBSD-2.0       # backward compat, historic
                   13231:                 NetBSD-2.0/
                   13232:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-2.0/i386
                   13233:                 SunOS-5.9/
                   13234:                         sparc -&gt; ../pkgsrc-2004Q1/SunOS-5.9/sparc
                   13235:                         x86 -&gt; ../pkgsrc-2004Q1/SunOS-5.9/x86
                   13236:                         
                   13237: </pre>
                   13238: 
                   13239:       <p>To create:</p>
                   13240: 
                   13241:       <div class="orderedlist">
                   13242:         <ol type="1">
                   13243:           <li>
                   13244:             <p>Run bulk build, see <a href="#bulkbuild" title=
1.38      dillo    13245:             "6.3.&nbsp;Doing a bulk build of all packages">Section
                   13246:             6.3, &#8220;Doing a bulk build of all
1.1       grant    13247:             packages&#8221;</a></p>
                   13248:           </li>
                   13249: 
                   13250:           <li>
                   13251:             <p>Upload /usr/pkgsrc/packages to</p>
                   13252:             <pre class="programlisting">
                   13253:     ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13      hubertf  13254:         pkgsrc-2004Q4/\                         # pkgsrc-branch
1.1       grant    13255:         `uname -s`-`uname -r`/                  # OS &amp; version
                   13256:         `uname -p`                              # architecture
                   13257:        
                   13258: </pre>
                   13259:           </li>
                   13260: 
                   13261:           <li>
1.14      xtraeme  13262:             <p>If necessary, create a symlink <span><strong class=
                   13263:             "command">ln -s `uname -m` `uname -p`</strong></span>
                   13264:             (amiga -&gt; m68k, ...)</p>
1.1       grant    13265:           </li>
                   13266:         </ol>
                   13267:       </div>
                   13268:     </div>
1.2       hubertf  13269: 
                   13270:     <div class="appendix" lang="en" xml:lang="en">
                   13271:       <div class="titlepage">
                   13272:         <div>
                   13273:           <div>
                   13274:             <h2 class="title"><a name="editing" id=
                   13275:             "editing"></a>Appendix&nbsp;D.&nbsp;Editing guidelines
                   13276:             for the pkgsrc guide</h2>
                   13277:           </div>
                   13278:         </div>
                   13279:       </div>
                   13280: 
                   13281:       <div class="toc">
                   13282:         <p><b>Table of Contents</b></p>
                   13283: 
                   13284:         <dl>
1.30      wiz      13285:           <dt><span class="sect1"><a href="#targets">D.1.
1.2       hubertf  13286:           Targets</a></span></dt>
                   13287: 
1.30      wiz      13288:           <dt><span class="sect1"><a href="#procedure">D.2.
1.2       hubertf  13289:           Procedure</a></span></dt>
                   13290:         </dl>
                   13291:       </div>
                   13292: 
                   13293:       <p>This section contains information on editing the pkgsrc
                   13294:       guide itself.</p>
                   13295: 
                   13296:       <div class="sect1" lang="en" xml:lang="en">
                   13297:         <div class="titlepage">
                   13298:           <div>
                   13299:             <div>
                   13300:               <h2 class="title" style="clear: both"><a name=
1.30      wiz      13301:               "targets" id="targets"></a>D.1.&nbsp;Targets</h2>
1.2       hubertf  13302:             </div>
                   13303:           </div>
                   13304:         </div>
                   13305: 
1.14      xtraeme  13306:         <p>The pkgsrc guide's source code is stored in <code class=
                   13307:         "filename">pkgsrc/doc/guide/files</code>, and several files
1.2       hubertf  13308:         are created from it:</p>
                   13309: 
                   13310:         <div class="itemizedlist">
                   13311:           <ul type="disc">
                   13312:             <li>
1.14      xtraeme  13313:               <p><code class=
1.23      wiz      13314:               "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2       hubertf  13315:             </li>
                   13316: 
                   13317:             <li>
1.14      xtraeme  13318:               <p><code class=
                   13319:               "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2       hubertf  13320:             </li>
                   13321: 
                   13322:             <li>
1.14      xtraeme  13323:               <p><code class=
                   13324:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2       hubertf  13325:               the documentation on the NetBSD website will be built
                   13326:               from pkgsrc and kept up to date on the web server
                   13327:               itself. This means you <span class=
                   13328:               "emphasis"><em>must</em></span> make sure that your
                   13329:               changes haven't broken the build!</p>
                   13330:             </li>
1.6       hubertf  13331: 
                   13332:             <li>
1.14      xtraeme  13333:               <p><code class=
                   13334:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6       hubertf  13335:               PDF version of the pkgsrc guide.</p>
                   13336:             </li>
                   13337: 
                   13338:             <li>
1.14      xtraeme  13339:               <p><code class=
                   13340:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6       hubertf  13341:               PostScript version of the pkgsrc guide.</p>
                   13342:             </li>
1.2       hubertf  13343:           </ul>
                   13344:         </div>
                   13345:       </div>
                   13346: 
                   13347:       <div class="sect1" lang="en" xml:lang="en">
                   13348:         <div class="titlepage">
                   13349:           <div>
                   13350:             <div>
                   13351:               <h2 class="title" style="clear: both"><a name=
1.30      wiz      13352:               "procedure" id=
                   13353:               "procedure"></a>D.2.&nbsp;Procedure</h2>
1.2       hubertf  13354:             </div>
                   13355:           </div>
                   13356:         </div>
                   13357: 
                   13358:         <p>The procedure to edit the pkgsrc guide is:</p>
                   13359: 
                   13360:         <div class="itemizedlist">
                   13361:           <ul type="disc">
                   13362:             <li>
1.6       hubertf  13363:               <p>Make sure you have the packages needed to
                   13364:               re-generate the pkgsrc guide (and other XML-based
                   13365:               NetBSD documentation) installed. These are
1.11      ben      13366:               &#8220;<span class="quote">netbsd-doc</span>&#8221;
1.6       hubertf  13367:               for creating the ASCII- and HTML-version, and
                   13368:               &#8220;<span class=
1.11      ben      13369:               "quote">netbsd-doc-print</span>&#8221;for the
1.6       hubertf  13370:               PostScript- and PDF version. You will need both
                   13371:               packages installed, to make sure documentation is
                   13372:               consistent across all formats. The packages can be
1.14      xtraeme  13373:               found in <code class=
                   13374:               "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
                   13375:               <code class=
                   13376:               "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6       hubertf  13377:             </li>
                   13378: 
                   13379:             <li>
1.14      xtraeme  13380:               <p>Edit the XML file(s) in <code class=
                   13381:               "filename">pkgsrc/doc/guide/files</code>.</p>
1.2       hubertf  13382:             </li>
                   13383: 
                   13384:             <li>
1.14      xtraeme  13385:               <p>Run <span><strong class="command">make extract
                   13386:               &amp;&amp; make do-lint</strong></span> in
                   13387:               <code class="filename">pkgsrc/doc/guide</code> to
                   13388:               check the XML syntax, and fix it if needed.</p>
1.4       hubertf  13389:             </li>
                   13390: 
                   13391:             <li>
1.14      xtraeme  13392:               <p>Run <span><strong class=
                   13393:               "command">make</strong></span> in <code class=
                   13394:               "filename">pkgsrc/doc/guide</code> to build the HTML
                   13395:               and ASCII version.</p>
1.2       hubertf  13396:             </li>
                   13397: 
                   13398:             <li>
1.14      xtraeme  13399:               <p>If all is well, run <span><strong class=
                   13400:               "command">make install-doc</strong></span> to put the
                   13401:               generated files into <code class=
                   13402:               "filename">pkgsrc/doc</code>.</p>
1.2       hubertf  13403:             </li>
                   13404: 
                   13405:             <li>
1.14      xtraeme  13406:               <p><span><strong class="command">cvs commit
                   13407:               pkgsrc/doc/guide/files</strong></span></p>
1.2       hubertf  13408:             </li>
                   13409: 
                   13410:             <li>
1.14      xtraeme  13411:               <p><span><strong class="command">cvs commit -m
                   13412:               re-generate
                   13413:               pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2       hubertf  13414:             </li>
1.4       hubertf  13415: 
                   13416:             <li>
                   13417:               <p>Until the webserver on www.NetBSD.org is really
                   13418:               updated automatically to pick up changes to the
1.14      xtraeme  13419:               pkgsrc guide automatically, also run
1.18      xtraeme  13420:               <span><strong class="command">make install-htdocs
1.14      xtraeme  13421:               HTDOCSDIR=../../../htdocs</strong></span> (or
                   13422:               similar, adjust <code class=
                   13423:               "varname">HTDOCSDIR</code>!).</p>
1.4       hubertf  13424:             </li>
                   13425: 
                   13426:             <li>
1.14      xtraeme  13427:               <p><span><strong class="command">cvs commit
                   13428:               htdocs/Documentation/pkgsrc</strong></span></p>
1.4       hubertf  13429:             </li>
1.2       hubertf  13430:           </ul>
                   13431:         </div>
                   13432:       </div>
                   13433:     </div>
1.1       grant    13434:   </div>
                   13435: </body>
                   13436: </html>

CVSweb <webmaster@jp.NetBSD.org>