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

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.36      wiz        69:           <p xmlns="" class="pubdate">$NetBSD: pkgsrc.xml,v 1.8
                     70:           2005/06/03 12:27:48 jmmv 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: 
                    224:             <dt><span class="chapter"><a href="#binary">5. Creating
                    225:             binary packages</a></span></dt>
                    226: 
                    227:             <dd>
                    228:               <dl>
1.30      wiz       229:                 <dt><span class="sect1"><a href=
                    230:                 "#building-a-single-binary-package">5.1. Building a
                    231:                 single binary package</a></span></dt>
1.1       grant     232: 
1.30      wiz       233:                 <dt><span class="sect1"><a href=
                    234:                 "#settings-for-creationg-of-binary-packages">5.2.
1.1       grant     235:                 Settings for creation of binary
                    236:                 packages</a></span></dt>
                    237: 
                    238:                 <dt><span class="sect1"><a href="#bulkbuild">5.3.
                    239:                 Doing a bulk build of all packages</a></span></dt>
                    240: 
                    241:                 <dd>
                    242:                   <dl>
                    243:                     <dt><span class="sect2"><a href=
                    244:                     "#binary.configuration">5.3.1.
                    245:                     Configuration</a></span></dt>
                    246: 
                    247:                     <dt><span class="sect2"><a href=
1.30      wiz       248:                     "#other-environmental-considerations">5.3.2.
                    249:                     Other environmental
1.1       grant     250:                     considerations</a></span></dt>
                    251: 
                    252:                     <dt><span class="sect2"><a href=
1.30      wiz       253:                     "#operation">5.3.3. Operation</a></span></dt>
1.1       grant     254: 
                    255:                     <dt><span class="sect2"><a href=
1.30      wiz       256:                     "#what-it-does">5.3.4. What it
1.1       grant     257:                     does</a></span></dt>
                    258: 
                    259:                     <dt><span class="sect2"><a href=
1.30      wiz       260:                     "#disk-space-requirements">5.3.5. Disk space
1.1       grant     261:                     requirements</a></span></dt>
                    262: 
                    263:                     <dt><span class="sect2"><a href=
1.30      wiz       264:                     "#setting-up-a-sandbox">5.3.6. Setting up a
                    265:                     sandbox for chroot'ed builds</a></span></dt>
1.1       grant     266: 
                    267:                     <dt><span class="sect2"><a href=
1.30      wiz       268:                     "#building-a-partial-set">5.3.7. Building a
                    269:                     partial set of packages</a></span></dt>
1.13      hubertf   270: 
                    271:                     <dt><span class="sect2"><a href=
                    272:                     "#bulk-upload">5.3.8. Uploading results of a
                    273:                     bulk build</a></span></dt>
1.1       grant     274:                   </dl>
                    275:                 </dd>
                    276: 
1.30      wiz       277:                 <dt><span class="sect1"><a href=
                    278:                 "#creating-cdroms">5.4. Creating a multiple CD-ROM
                    279:                 packages collection</a></span></dt>
1.1       grant     280: 
                    281:                 <dd>
                    282:                   <dl>
                    283:                     <dt><span class="sect2"><a href=
1.30      wiz       284:                     "#cdpack-example">5.4.1. Example of
1.1       grant     285:                     cdpack</a></span></dt>
                    286:                   </dl>
                    287:                 </dd>
                    288:               </dl>
                    289:             </dd>
                    290: 
                    291:             <dt><span class="chapter"><a href="#faq">6. Frequently
                    292:             Asked Questions</a></span></dt>
                    293: 
                    294:             <dd>
                    295:               <dl>
1.30      wiz       296:                 <dt><span class="sect1"><a href=
                    297:                 "#mailing-list-pointers">6.1. Are there any mailing
                    298:                 lists for pkg-related discussion?</a></span></dt>
1.1       grant     299: 
1.30      wiz       300:                 <dt><span class="sect1"><a href=
                    301:                 "#pkgviews-docs">6.2. Where's the pkgviews
                    302:                 documentation?</a></span></dt>
1.1       grant     303: 
1.5       hubertf   304:                 <dt><span class="sect1"><a href=
                    305:                 "#faq-pkgtools">6.3. Utilities for package
                    306:                 management (pkgtools)</a></span></dt>
1.1       grant     307: 
1.30      wiz       308:                 <dt><span class="sect1"><a href=
                    309:                 "#non-root-pkgsrc">6.4. How to use pkgsrc as
                    310:                 non-root</a></span></dt>
                    311: 
                    312:                 <dt><span class="sect1"><a href=
                    313:                 "#resume-transfers">6.5. How to resume transfers
                    314:                 when fetching distfiles?</a></span></dt>
                    315: 
                    316:                 <dt><span class="sect1"><a href=
                    317:                 "#XFree86-from-pkgsrc">6.6. How can I install/use
                    318:                 XFree86 from pkgsrc?</a></span></dt>
                    319: 
                    320:                 <dt><span class="sect1"><a href=
                    321:                 "#x.org-from-pkgsrc">6.7. How can I install/use
                    322:                 X.org from pkgsrc?</a></span></dt>
1.1       grant     323: 
1.30      wiz       324:                 <dt><span class="sect1"><a href=
                    325:                 "#fetch-behind-firewall">6.8. How to fetch files
                    326:                 from behind a firewall</a></span></dt>
1.1       grant     327: 
1.30      wiz       328:                 <dt><span class="sect1"><a href="#passive-ftp">6.9.
1.14      xtraeme   329:                 How do I tell <span><strong class="command">make
                    330:                 fetch</strong></span> to do passive
1.1       grant     331:                 FTP?</a></span></dt>
                    332: 
1.30      wiz       333:                 <dt><span class="sect1"><a href=
                    334:                 "#fetching-all-distfiles">6.10. How to fetch all
                    335:                 distfiles at once</a></span></dt>
1.1       grant     336: 
1.30      wiz       337:                 <dt><span class="sect1"><a href=
                    338:                 "#tmac.andoc-missing">6.11. What does
                    339:                 &#8220;<span class="quote">Don't know how to make
                    340:                 /usr/share/tmac/tmac.andoc</span>&#8221;
1.14      xtraeme   341:                 mean?</a></span></dt>
1.13      hubertf   342: 
1.30      wiz       343:                 <dt><span class="sect1"><a href=
                    344:                 "#bsd.own.mk-missing">6.12. What does
                    345:                 &#8220;<span class="quote">Could not find
1.14      xtraeme   346:                 bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant     347: 
1.30      wiz       348:                 <dt><span class="sect1"><a href=
                    349:                 "#using-sudo-with-pkgsrc">6.13. Using 'sudo' with
                    350:                 pkgsrc</a></span></dt>
1.1       grant     351: 
1.14      xtraeme   352:                 <dt><span class="sect1"><a href="#faq.conf">6.14.
1.35      jmmv      353:                 How do I change the location of configuration
                    354:                 files?</a></span></dt>
1.1       grant     355: 
                    356:                 <dt><span class="sect1"><a href=
1.14      xtraeme   357:                 "#audit-packages">6.15. Automated security
1.1       grant     358:                 checks</a></span></dt>
                    359:               </dl>
                    360:             </dd>
                    361:           </dl>
                    362:         </dd>
                    363: 
1.2       hubertf   364:         <dt><span class="part"><a href="#developers-guide">II. The
1.1       grant     365:         pkgsrc developer's guide</a></span></dt>
                    366: 
                    367:         <dd>
                    368:           <dl>
1.27      rillig    369:             <dt><span class="chapter"><a href="#components">7.
                    370:             Package components - files, directories and
                    371:             contents</a></span></dt>
                    372: 
                    373:             <dd>
                    374:               <dl>
                    375:                 <dt><span class="sect1"><a href=
                    376:                 "#components.Makefile">7.1. <code class=
                    377:                 "filename">Makefile</code></a></span></dt>
                    378: 
                    379:                 <dt><span class="sect1"><a href=
                    380:                 "#components.distinfo">7.2. <code class=
                    381:                 "filename">distinfo</code></a></span></dt>
                    382: 
                    383:                 <dt><span class="sect1"><a href=
                    384:                 "#components.patches">7.3.
                    385:                 patches/*</a></span></dt>
                    386: 
1.30      wiz       387:                 <dt><span class="sect1"><a href=
                    388:                 "#other-mandatory-files">7.4. Other mandatory
                    389:                 files</a></span></dt>
1.27      rillig    390: 
                    391:                 <dt><span class="sect1"><a href=
                    392:                 "#components.optional">7.5. Optional
                    393:                 files</a></span></dt>
                    394: 
1.30      wiz       395:                 <dt><span class="sect1"><a href="#work-dir">7.6.
1.27      rillig    396:                 <code class="filename">work*</code></a></span></dt>
                    397: 
1.30      wiz       398:                 <dt><span class="sect1"><a href="#files-dir">7.7.
1.27      rillig    399:                 <code class=
                    400:                 "filename">files/*</code></a></span></dt>
                    401:               </dl>
                    402:             </dd>
                    403: 
                    404:             <dt><span class="chapter"><a href="#makefile">8.
1.25      rillig    405:             Programming in <code class=
                    406:             "filename">Makefile</code>s</a></span></dt>
                    407: 
                    408:             <dd>
                    409:               <dl>
                    410:                 <dt><span class="sect1"><a href=
1.27      rillig    411:                 "#makefile.variables">8.1. <code class=
1.25      rillig    412:                 "filename">Makefile</code>
                    413:                 variables</a></span></dt>
                    414: 
1.27      rillig    415:                 <dd>
                    416:                   <dl>
                    417:                     <dt><span class="sect2"><a href=
                    418:                     "#makefile.variables.names">8.1.1. Naming
                    419:                     conventions</a></span></dt>
                    420:                   </dl>
                    421:                 </dd>
                    422: 
1.25      rillig    423:                 <dt><span class="sect1"><a href=
1.27      rillig    424:                 "#makefile.code">8.2. Code snippets</a></span></dt>
1.25      rillig    425: 
                    426:                 <dd>
                    427:                   <dl>
                    428:                     <dt><span class="sect2"><a href=
1.30      wiz       429:                     "#adding-to-list">8.2.1. Adding things to a
1.25      rillig    430:                     list</a></span></dt>
                    431: 
                    432:                     <dt><span class="sect2"><a href=
1.30      wiz       433:                     "#converting-internal-to-external">8.2.2.
                    434:                     Converting an internal list into an external
                    435:                     list</a></span></dt>
1.25      rillig    436: 
                    437:                     <dt><span class="sect2"><a href=
1.30      wiz       438:                     "#passing-variable-to-shell">8.2.3. Passing
                    439:                     variables to a shell command</a></span></dt>
1.27      rillig    440: 
                    441:                     <dt><span class="sect2"><a href=
1.30      wiz       442:                     "#quoting-guideline">8.2.4. Quoting
1.27      rillig    443:                     guideline</a></span></dt>
                    444: 
                    445:                     <dt><span class="sect2"><a href=
1.30      wiz       446:                     "#bsd-make-bug-workaround">8.2.5. Workaround
                    447:                     for a bug in BSD Make</a></span></dt>
1.25      rillig    448:                   </dl>
                    449:                 </dd>
                    450:               </dl>
                    451:             </dd>
                    452: 
                    453:             <dt><span class="chapter"><a href="#plist">9. PLIST
1.1       grant     454:             issues</a></span></dt>
                    455: 
                    456:             <dd>
                    457:               <dl>
1.30      wiz       458:                 <dt><span class="sect1"><a href="#rcs-id">9.1. RCS
                    459:                 ID</a></span></dt>
1.1       grant     460: 
1.30      wiz       461:                 <dt><span class="sect1"><a href=
                    462:                 "#automatic-plist-generation">9.2. Semi-automatic
                    463:                 <code class="filename">PLIST</code>
1.14      xtraeme   464:                 generation</a></span></dt>
1.1       grant     465: 
1.25      rillig    466:                 <dt><span class="sect1"><a href="#print-PLIST">9.3.
1.14      xtraeme   467:                 Tweaking output of <span><strong class=
                    468:                 "command">make
                    469:                 print-PLIST</strong></span></a></span></dt>
1.1       grant     470: 
1.25      rillig    471:                 <dt><span class="sect1"><a href="#plist.misc">9.4.
1.1       grant     472:                 Variable substitution in PLIST</a></span></dt>
                    473: 
1.30      wiz       474:                 <dt><span class="sect1"><a href=
                    475:                 "#manpage-compression">9.5.
1.1       grant     476:                 Manpage-compression</a></span></dt>
                    477: 
1.30      wiz       478:                 <dt><span class="sect1"><a href=
                    479:                 "#using-PLIST_SRC">9.6. Changing PLIST source with
                    480:                 <code class=
1.14      xtraeme   481:                 "varname">PLIST_SRC</code></a></span></dt>
1.1       grant     482: 
1.30      wiz       483:                 <dt><span class="sect1"><a href=
                    484:                 "#platform-specific-plist">9.7. Platform specific
                    485:                 and differing PLISTs</a></span></dt>
1.1       grant     486: 
                    487:                 <dt><span class="sect1"><a href=
1.25      rillig    488:                 "#faq.common-dirs">9.8. Sharing directories between
1.1       grant     489:                 packages</a></span></dt>
                    490:               </dl>
                    491:             </dd>
                    492: 
1.25      rillig    493:             <dt><span class="chapter"><a href="#buildlink">10.
1.1       grant     494:             Buildlink methodology</a></span></dt>
                    495: 
                    496:             <dd>
                    497:               <dl>
1.30      wiz       498:                 <dt><span class="sect1"><a href=
                    499:                 "#converting-to-buildlink3">10.1. Converting
                    500:                 packages to use buildlink3</a></span></dt>
1.1       grant     501: 
1.30      wiz       502:                 <dt><span class="sect1"><a href=
                    503:                 "#creating-buildlink3.mk">10.2. Writing
                    504:                 <code class="filename">buildlink3.mk</code>
1.14      xtraeme   505:                 files</a></span></dt>
1.1       grant     506: 
                    507:                 <dd>
                    508:                   <dl>
                    509:                     <dt><span class="sect2"><a href=
1.30      wiz       510:                     "#anatomy-of-bl3">10.2.1. Anatomy of a
                    511:                     buildlink3.mk file</a></span></dt>
1.1       grant     512: 
                    513:                     <dt><span class="sect2"><a href=
1.30      wiz       514:                     "#updating-buildlink-depends">10.2.2. Updating
                    515:                     <code class=
1.14      xtraeme   516:                     "varname">BUILDLINK_DEPENDS.<em class=
                    517:                     "replaceable"><code>pkg</code></em></code> in
                    518:                     <code class="filename">buildlink3.mk</code>
1.1       grant     519:                     files</a></span></dt>
                    520:                   </dl>
                    521:                 </dd>
                    522: 
1.30      wiz       523:                 <dt><span class="sect1"><a href=
                    524:                 "#writing-builtin.mk">10.3. Writing <code class=
                    525:                 "filename">builtin.mk</code> files</a></span></dt>
1.1       grant     526: 
                    527:                 <dd>
                    528:                   <dl>
                    529:                     <dt><span class="sect2"><a href=
1.30      wiz       530:                     "#anatomy-of-builtin.mk">10.3.1. Anatomy of a
                    531:                     <code class="filename">builtin.mk</code>
1.1       grant     532:                     file</a></span></dt>
                    533: 
                    534:                     <dt><span class="sect2"><a href=
1.30      wiz       535:                     "#native-or-pkgsrc-preference">10.3.2. Global
                    536:                     preferences for native or pkgsrc
                    537:                     software</a></span></dt>
1.1       grant     538:                   </dl>
                    539:                 </dd>
                    540:               </dl>
                    541:             </dd>
                    542: 
1.35      jmmv      543:             <dt><span class="chapter"><a href="#pkginstall">11. The
                    544:             pkginstall framework</a></span></dt>
                    545: 
                    546:             <dd>
                    547:               <dl>
                    548:                 <dt><span class="sect1"><a href=
                    549:                 "#files-and-dirs-outside-prefix">11.1. Files and
                    550:                 directories outside the installation
                    551:                 prefix</a></span></dt>
                    552: 
                    553:                 <dd>
                    554:                   <dl>
                    555:                     <dt><span class="sect2"><a href=
                    556:                     "#dirs-outside-prefix">11.1.1. Directory
                    557:                     manipulation</a></span></dt>
                    558: 
                    559:                     <dt><span class="sect2"><a href=
                    560:                     "#files-outside-prefix">11.1.2. File
                    561:                     manipulation</a></span></dt>
                    562:                   </dl>
                    563:                 </dd>
                    564: 
                    565:                 <dt><span class="sect1"><a href="#conf-files">11.2.
                    566:                 Configuration files</a></span></dt>
                    567: 
                    568:                 <dd>
                    569:                   <dl>
                    570:                     <dt><span class="sect2"><a href=
                    571:                     "#conf-files-sysconfdir">11.2.1. How
                    572:                     <code class="varname">PKG_SYSCONFDIR</code> is
                    573:                     set</a></span></dt>
                    574: 
                    575:                     <dt><span class="sect2"><a href=
                    576:                     "#conf-files-configure">11.2.2. Telling the
                    577:                     software were configuration files
                    578:                     are</a></span></dt>
                    579: 
                    580:                     <dt><span class="sect2"><a href=
                    581:                     "#conf-files-patching">11.2.3. Patching
                    582:                     installations</a></span></dt>
                    583: 
                    584:                     <dt><span class="sect2"><a href=
                    585:                     "#conf-files-disable">11.2.4. Disabling
                    586:                     handling of configuration files</a></span></dt>
                    587:                   </dl>
                    588:                 </dd>
                    589: 
                    590:                 <dt><span class="sect1"><a href=
                    591:                 "#rcd-scripts">11.3. System startup
                    592:                 scripts</a></span></dt>
                    593: 
                    594:                 <dd>
                    595:                   <dl>
                    596:                     <dt><span class="sect2"><a href=
                    597:                     "#rcd-scripts-disable">11.3.1. Disabling
                    598:                     handling of system startup
                    599:                     scripts</a></span></dt>
                    600:                   </dl>
                    601:                 </dd>
                    602: 
                    603:                 <dt><span class="sect1"><a href=
                    604:                 "#users-and-groups">11.4. System users and
                    605:                 groups</a></span></dt>
                    606: 
                    607:                 <dt><span class="sect1"><a href="#shells">11.5.
                    608:                 System shells</a></span></dt>
                    609: 
                    610:                 <dd>
                    611:                   <dl>
                    612:                     <dt><span class="sect2"><a href=
                    613:                     "#shells-disable">11.5.1. Disabling handling of
                    614:                     configuration files</a></span></dt>
                    615:                   </dl>
                    616:                 </dd>
                    617:               </dl>
                    618:             </dd>
                    619: 
                    620:             <dt><span class="chapter"><a href="#options">12.
1.1       grant     621:             Options handling</a></span></dt>
                    622: 
                    623:             <dd>
                    624:               <dl>
1.30      wiz       625:                 <dt><span class="sect1"><a href=
1.35      jmmv      626:                 "#global-default-options">12.1. Global default
1.30      wiz       627:                 options</a></span></dt>
1.1       grant     628: 
1.30      wiz       629:                 <dt><span class="sect1"><a href=
1.35      jmmv      630:                 "#converting-to-options">12.2. Converting packages
1.30      wiz       631:                 to use <code class=
1.14      xtraeme   632:                 "filename">bsd.options.mk</code></a></span></dt>
1.1       grant     633:               </dl>
                    634:             </dd>
                    635: 
1.35      jmmv      636:             <dt><span class="chapter"><a href="#build">13. The
1.1       grant     637:             build process</a></span></dt>
                    638: 
                    639:             <dd>
                    640:               <dl>
                    641:                 <dt><span class="sect1"><a href=
1.35      jmmv      642:                 "#build.prefix">13.1. Program
1.1       grant     643:                 location</a></span></dt>
                    644: 
1.30      wiz       645:                 <dt><span class="sect1"><a href=
1.35      jmmv      646:                 "#main-targets">13.2. Main targets</a></span></dt>
1.1       grant     647: 
                    648:                 <dt><span class="sect1"><a href=
1.35      jmmv      649:                 "#build.helpful-targets">13.3. Other helpful
1.1       grant     650:                 targets</a></span></dt>
                    651:               </dl>
                    652:             </dd>
                    653: 
1.35      jmmv      654:             <dt><span class="chapter"><a href="#fixes">14. Notes on
1.1       grant     655:             fixes for packages</a></span></dt>
                    656: 
                    657:             <dd>
                    658:               <dl>
1.30      wiz       659:                 <dt><span class="sect1"><a href=
1.35      jmmv      660:                 "#general-operation">14.1. General
1.30      wiz       661:                 operation</a></span></dt>
1.1       grant     662: 
                    663:                 <dd>
                    664:                   <dl>
                    665:                     <dt><span class="sect2"><a href=
1.35      jmmv      666:                     "#pulling-vars-from-etc-mk.conf">14.1.1. How to
1.30      wiz       667:                     pull in variables from
                    668:                     /etc/mk.conf</a></span></dt>
1.1       grant     669: 
                    670:                     <dt><span class="sect2"><a href=
1.35      jmmv      671:                     "#where-to-install-documentation">14.1.2. Where
1.31      wiz       672:                     to install documentation</a></span></dt>
                    673: 
                    674:                     <dt><span class="sect2"><a href=
1.35      jmmv      675:                     "#restricted-packages">14.1.3. Restricted
1.1       grant     676:                     packages</a></span></dt>
                    677: 
                    678:                     <dt><span class="sect2"><a href=
1.35      jmmv      679:                     "#dependencies">14.1.4. Handling
1.1       grant     680:                     dependencies</a></span></dt>
                    681: 
                    682:                     <dt><span class="sect2"><a href=
1.35      jmmv      683:                     "#conflicts">14.1.5. Handling conflicts with
1.1       grant     684:                     other packages</a></span></dt>
                    685: 
                    686:                     <dt><span class="sect2"><a href=
1.35      jmmv      687:                     "#not-building-packages">14.1.6. Packages that
1.30      wiz       688:                     cannot or should not be built</a></span></dt>
1.1       grant     689: 
                    690:                     <dt><span class="sect2"><a href=
1.35      jmmv      691:                     "#undeletable-packages">14.1.7. Packages which
1.30      wiz       692:                     should not be deleted, once
                    693:                     installed</a></span></dt>
1.1       grant     694: 
                    695:                     <dt><span class="sect2"><a href=
1.35      jmmv      696:                     "#security-handling">14.1.8. Handling packages
1.1       grant     697:                     with security problems</a></span></dt>
                    698: 
                    699:                     <dt><span class="sect2"><a href=
1.35      jmmv      700:                     "#compiler-bugs">14.1.9. How to handle compiler
1.1       grant     701:                     bugs</a></span></dt>
                    702: 
                    703:                     <dt><span class="sect2"><a href=
1.35      jmmv      704:                     "#bumping-pkgrevision">14.1.10. How to handle
1.30      wiz       705:                     incrementing versions when fixing an existing
1.1       grant     706:                     package</a></span></dt>
                    707: 
                    708:                     <dt><span class="sect2"><a href=
1.35      jmmv      709:                     "#portability-of-packages">14.1.11. Portability
1.30      wiz       710:                     of packages</a></span></dt>
1.1       grant     711:                   </dl>
                    712:                 </dd>
                    713: 
1.30      wiz       714:                 <dt><span class="sect1"><a href=
1.35      jmmv      715:                 "#downloading-issues">14.2. Possible downloading
1.30      wiz       716:                 issues</a></span></dt>
1.1       grant     717: 
                    718:                 <dd>
                    719:                   <dl>
                    720:                     <dt><span class="sect2"><a href=
1.35      jmmv      721:                     "#no-plain-download">14.2.1. Packages whose
1.30      wiz       722:                     distfiles aren't available for plain
1.1       grant     723:                     downloading</a></span></dt>
                    724: 
                    725:                     <dt><span class="sect2"><a href=
1.35      jmmv      726:                     "#modified-distfiles-same-name">14.2.2. How to
1.30      wiz       727:                     handle modified distfiles with the 'old'
                    728:                     name</a></span></dt>
1.1       grant     729:                   </dl>
                    730:                 </dd>
                    731: 
1.30      wiz       732:                 <dt><span class="sect1"><a href=
1.35      jmmv      733:                 "#configuration-gotchas">14.3. Configuration
1.30      wiz       734:                 gotchas</a></span></dt>
1.1       grant     735: 
                    736:                 <dd>
                    737:                   <dl>
                    738:                     <dt><span class="sect2"><a href=
1.35      jmmv      739:                     "#fixes.libtool">14.3.1. Shared libraries -
1.1       grant     740:                     libtool</a></span></dt>
                    741: 
                    742:                     <dt><span class="sect2"><a href=
1.35      jmmv      743:                     "#using-libtool">14.3.2. Using libtool on GNU
1.1       grant     744:                     packages that already support
                    745:                     libtool</a></span></dt>
                    746: 
                    747:                     <dt><span class="sect2"><a href=
1.35      jmmv      748:                     "#autoconf-automake">14.3.3. GNU
1.1       grant     749:                     Autoconf/Automake</a></span></dt>
                    750:                   </dl>
                    751:                 </dd>
                    752: 
1.30      wiz       753:                 <dt><span class="sect1"><a href=
1.35      jmmv      754:                 "#building-considerations">14.4. Building
1.30      wiz       755:                 considerations</a></span></dt>
1.1       grant     756: 
                    757:                 <dd>
                    758:                   <dl>
                    759:                     <dt><span class="sect2"><a href=
1.35      jmmv      760:                     "#cpp-defines">14.4.1. CPP
1.1       grant     761:                     defines</a></span></dt>
                    762:                   </dl>
                    763:                 </dd>
                    764: 
1.30      wiz       765:                 <dt><span class="sect1"><a href=
1.35      jmmv      766:                 "#package-specific-actions">14.5. Package specific
1.30      wiz       767:                 actions</a></span></dt>
1.1       grant     768: 
                    769:                 <dd>
                    770:                   <dl>
                    771:                     <dt><span class="sect2"><a href=
1.35      jmmv      772:                     "#user-interaction">14.5.1. User
1.2       hubertf   773:                     interaction</a></span></dt>
1.1       grant     774: 
                    775:                     <dt><span class="sect2"><a href=
1.35      jmmv      776:                     "#handling-licenses">14.5.2. Handling
1.1       grant     777:                     licenses</a></span></dt>
                    778: 
                    779:                     <dt><span class="sect2"><a href=
1.35      jmmv      780:                     "#installing-score-files">14.5.3. Installing
1.30      wiz       781:                     score files</a></span></dt>
1.1       grant     782: 
                    783:                     <dt><span class="sect2"><a href=
1.35      jmmv      784:                     "#perl-scripts">14.5.4. Packages containing
1.30      wiz       785:                     perl scripts</a></span></dt>
1.1       grant     786: 
                    787:                     <dt><span class="sect2"><a href=
1.35      jmmv      788:                     "#hardcoded-paths">14.5.5. Packages with
1.30      wiz       789:                     hardcoded paths to other
                    790:                     interpreters</a></span></dt>
1.1       grant     791: 
                    792:                     <dt><span class="sect2"><a href=
1.35      jmmv      793:                     "#perl-modules">14.5.6. Packages installing
1.30      wiz       794:                     perl modules</a></span></dt>
1.1       grant     795: 
                    796:                     <dt><span class="sect2"><a href=
1.35      jmmv      797:                     "#faq.info-files">14.5.7. Packages installing
1.1       grant     798:                     info files</a></span></dt>
                    799: 
                    800:                     <dt><span class="sect2"><a href=
1.35      jmmv      801:                     "#gconf2-data-files">14.5.8. Packages
1.30      wiz       802:                     installing GConf2 data files</a></span></dt>
1.1       grant     803: 
                    804:                     <dt><span class="sect2"><a href=
1.35      jmmv      805:                     "#scrollkeeper-data-files">14.5.9. Packages
1.30      wiz       806:                     installing scrollkeeper data
                    807:                     files</a></span></dt>
1.1       grant     808: 
                    809:                     <dt><span class="sect2"><a href=
1.35      jmmv      810:                     "#x11-fonts">14.5.10. Packages installing X11
1.1       grant     811:                     fonts</a></span></dt>
                    812: 
                    813:                     <dt><span class="sect2"><a href=
1.35      jmmv      814:                     "#gtk2-modules">14.5.11. Packages installing
1.30      wiz       815:                     GTK2 modules</a></span></dt>
1.1       grant     816: 
                    817:                     <dt><span class="sect2"><a href=
1.35      jmmv      818:                     "#sgml-xml-data">14.5.12. Packages installing
1.30      wiz       819:                     SGML or XML data</a></span></dt>
1.1       grant     820: 
                    821:                     <dt><span class="sect2"><a href=
1.35      jmmv      822:                     "#mime-database">14.5.13. Packages installing
1.1       grant     823:                     extensions to the MIME database</a></span></dt>
                    824: 
                    825:                     <dt><span class="sect2"><a href=
1.35      jmmv      826:                     "#intltool">14.5.14. Packages using
1.1       grant     827:                     intltool</a></span></dt>
1.18      xtraeme   828: 
                    829:                     <dt><span class="sect2"><a href=
1.35      jmmv      830:                     "#startup-scripts">14.5.15. Packages installing
1.18      xtraeme   831:                     startup scripts</a></span></dt>
1.1       grant     832:                   </dl>
                    833:                 </dd>
                    834: 
1.30      wiz       835:                 <dt><span class="sect1"><a href=
1.35      jmmv      836:                 "#feedback-to-author">14.6. Feedback to the
1.30      wiz       837:                 author</a></span></dt>
1.1       grant     838:               </dl>
                    839:             </dd>
                    840: 
1.35      jmmv      841:             <dt><span class="chapter"><a href="#debug">15.
1.1       grant     842:             Debugging</a></span></dt>
                    843: 
1.35      jmmv      844:             <dt><span class="chapter"><a href="#submit">16.
1.1       grant     845:             Submitting and Committing</a></span></dt>
                    846: 
                    847:             <dd>
                    848:               <dl>
1.30      wiz       849:                 <dt><span class="sect1"><a href=
1.35      jmmv      850:                 "#submitting-your-package">16.1. Submitting your
1.30      wiz       851:                 packages</a></span></dt>
1.1       grant     852: 
1.30      wiz       853:                 <dt><span class="sect1"><a href=
1.35      jmmv      854:                 "#committing-importing">16.2. Committing: Importing
1.30      wiz       855:                 a package into CVS</a></span></dt>
1.1       grant     856: 
1.30      wiz       857:                 <dt><span class="sect1"><a href=
1.35      jmmv      858:                 "#updating-package">16.3. Updating a package to a
1.30      wiz       859:                 newer version</a></span></dt>
1.1       grant     860: 
1.30      wiz       861:                 <dt><span class="sect1"><a href=
1.35      jmmv      862:                 "#moving-package">16.4. Moving a package in
1.30      wiz       863:                 pkgsrc</a></span></dt>
1.1       grant     864:               </dl>
                    865:             </dd>
                    866:           </dl>
                    867:         </dd>
                    868: 
                    869:         <dt><span class="appendix"><a href="#examples">A. A simple
                    870:         example package: bison</a></span></dt>
                    871: 
                    872:         <dd>
                    873:           <dl>
1.30      wiz       874:             <dt><span class="sect1"><a href="#example-files">A.1.
1.1       grant     875:             files</a></span></dt>
                    876: 
                    877:             <dd>
                    878:               <dl>
1.30      wiz       879:                 <dt><span class="sect2"><a href=
                    880:                 "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1       grant     881: 
1.30      wiz       882:                 <dt><span class="sect2"><a href=
                    883:                 "#example-descr">A.1.2. DESCR</a></span></dt>
1.1       grant     884: 
1.30      wiz       885:                 <dt><span class="sect2"><a href=
                    886:                 "#example-plist">A.1.3. PLIST</a></span></dt>
1.1       grant     887: 
1.30      wiz       888:                 <dt><span class="sect2"><a href=
                    889:                 "#checking-package-with-pkglint">A.1.4. Checking a
                    890:                 package with <span><strong class=
1.14      xtraeme   891:                 "command">pkglint</strong></span></a></span></dt>
1.1       grant     892:               </dl>
                    893:             </dd>
                    894: 
1.30      wiz       895:             <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
                    896:             Steps for building, installing,
                    897:             packaging</a></span></dt>
1.1       grant     898:           </dl>
                    899:         </dd>
                    900: 
                    901:         <dt><span class="appendix"><a href="#logs">B. Build
                    902:         logs</a></span></dt>
                    903: 
                    904:         <dd>
                    905:           <dl>
                    906:             <dt><span class="sect1"><a href="#logs.building">B.1.
                    907:             Building figlet</a></span></dt>
                    908: 
                    909:             <dt><span class="sect1"><a href="#logs.package">B.2.
                    910:             Packaging figlet</a></span></dt>
                    911:           </dl>
                    912:         </dd>
                    913: 
                    914:         <dt><span class="appendix"><a href="#ftp-layout">C. Layout
                    915:         of the FTP server's package archive</a></span></dt>
1.2       hubertf   916: 
                    917:         <dt><span class="appendix"><a href="#editing">D. Editing
                    918:         guidelines for the pkgsrc guide</a></span></dt>
                    919: 
                    920:         <dd>
                    921:           <dl>
1.30      wiz       922:             <dt><span class="sect1"><a href="#targets">D.1.
1.2       hubertf   923:             Targets</a></span></dt>
                    924: 
1.30      wiz       925:             <dt><span class="sect1"><a href="#procedure">D.2.
1.2       hubertf   926:             Procedure</a></span></dt>
                    927:           </dl>
                    928:         </dd>
1.1       grant     929:       </dl>
                    930:     </div>
                    931: 
                    932:     <div class="chapter" lang="en" xml:lang="en">
                    933:       <div class="titlepage">
                    934:         <div>
                    935:           <div>
                    936:             <h2 class="title"><a name="introduction" id=
                    937:             "introduction"></a>Chapter&nbsp;1.&nbsp;Introduction</h2>
                    938:           </div>
                    939:         </div>
                    940:       </div>
                    941: 
                    942:       <div class="toc">
                    943:         <p><b>Table of Contents</b></p>
                    944: 
                    945:         <dl>
1.30      wiz       946:           <dt><span class="sect1"><a href=
                    947:           "#introduction-section">1.1. Introduction</a></span></dt>
1.1       grant     948: 
                    949:           <dt><span class="sect1"><a href="#overview">1.2.
                    950:           Overview</a></span></dt>
                    951: 
                    952:           <dt><span class="sect1"><a href="#terminology">1.3.
                    953:           Terminology</a></span></dt>
                    954: 
                    955:           <dt><span class="sect1"><a href="#typography">1.4.
                    956:           Typography</a></span></dt>
                    957:         </dl>
                    958:       </div>
                    959: 
                    960:       <div class="sect1" lang="en" xml:lang="en">
                    961:         <div class="titlepage">
                    962:           <div>
                    963:             <div>
                    964:               <h2 class="title" style="clear: both"><a name=
1.30      wiz       965:               "introduction-section" id=
                    966:               "introduction-section"></a>1.1.&nbsp;Introduction</h2>
1.1       grant     967:             </div>
                    968:           </div>
                    969:         </div>
                    970: 
                    971:         <p>There is a lot of software freely available for Unix
                    972:         based systems, which usually runs on NetBSD and other
                    973:         Unix-flavoured systems, too, sometimes with some
                    974:         modifications. The NetBSD Packages Collection (pkgsrc)
                    975:         incorporates any such changes necessary to make that
                    976:         software run, and makes the installation (and
                    977:         de-installation) of the software package easy by means of a
                    978:         single command.</p>
                    979: 
                    980:         <p>Once the software has been built, it is manipulated with
1.14      xtraeme   981:         the <span><strong class="command">pkg_*</strong></span>
                    982:         tools so that installation and de-installation, printing of
                    983:         an inventory of all installed packages and retrieval of
                    984:         one-line comments or more verbose descriptions are all
                    985:         simple.</p>
1.1       grant     986: 
                    987:         <p>pkgsrc currently contains several thousand packages,
                    988:         including:</p>
                    989: 
                    990:         <div class="itemizedlist">
                    991:           <ul type="disc">
                    992:             <li>
                    993:               <p><a xmlns=
                    994:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    995:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.20      ben       996:               class="pkgname">www/apache</a> - The Apache web
                    997:               server</p>
1.1       grant     998:             </li>
                    999: 
                   1000:             <li>
                   1001:               <p><a xmlns=
                   1002:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1003:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20      ben      1004:               class="pkgname">www/mozilla</a> - The Mozilla web
                   1005:               browser</p>
1.1       grant    1006:             </li>
                   1007: 
                   1008:             <li>
                   1009:               <p><a xmlns=
                   1010:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1011:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.20      ben      1012:               class="pkgname">meta-pkgs/gnome</a> - The GNOME
                   1013:               Desktop Environment</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/meta-pkgs/kde3/README.html"
1.20      ben      1020:               class="pkgname">meta-pkgs/kde3</a> - The K Desktop
                   1021:               Environment</p>
1.1       grant    1022:             </li>
                   1023:           </ul>
                   1024:         </div>
                   1025: 
                   1026:         <p>...just to name a few.</p>
                   1027: 
                   1028:         <p>pkgsrc has built-in support for handling varying
                   1029:         dependencies, such as pthreads and X11, and extended
                   1030:         features such as IPv6 support on a range of platforms.</p>
                   1031: 
                   1032:         <p>pkgsrc was derived from FreeBSD's ports system, and
                   1033:         initially developed for NetBSD only. Since then, pkgsrc has
                   1034:         grown a lot, and now supports the following platforms:</p>
                   1035: 
                   1036:         <div class="itemizedlist">
                   1037:           <ul type="disc">
                   1038:             <li>
                   1039:               <p><a href="http://developer.apple.com/darwin/"
                   1040:               target="_top">Darwin</a> (<a href=
                   1041:               "http://www.apple.com/macosx/" target="_top">Mac OS
                   1042:               X</a>)</p>
                   1043:             </li>
                   1044: 
                   1045:             <li>
1.3       hubertf  1046:               <p><a href="http://www.DragonFlyBSD.org/" target=
                   1047:               "_top">DragonFlyBSD</a></p>
                   1048:             </li>
                   1049: 
                   1050:             <li>
1.1       grant    1051:               <p><a href="http://www.FreeBSD.org/" target=
                   1052:               "_top">FreeBSD</a></p>
                   1053:             </li>
                   1054: 
                   1055:             <li>
1.3       hubertf  1056:               <p>Microsoft Windows, via <a href=
                   1057:               "http://www.microsoft.com/windows/sfu/" target=
                   1058:               "_top">Interix</a></p>
1.1       grant    1059:             </li>
                   1060: 
                   1061:             <li>
                   1062:               <p><a href="http://www.sgi.com/software/irix6.5/"
                   1063:               target="_top">IRIX</a></p>
                   1064:             </li>
                   1065: 
                   1066:             <li>
                   1067:               <p><a href="http://www.linux.org/" target=
                   1068:               "_top">Linux</a></p>
                   1069:             </li>
                   1070: 
                   1071:             <li>
                   1072:               <p><a href="http://www.NetBSD.org/" target=
                   1073:               "_top">NetBSD</a> (of course)</p>
                   1074:             </li>
                   1075: 
                   1076:             <li>
1.17      sketch   1077:               <p><a href="http://h30097.www3.hp.com/" target=
                   1078:               "_top">Tru64</a> (Digital UNIX, OSF1)</p>
                   1079:             </li>
                   1080: 
                   1081:             <li>
1.1       grant    1082:               <p><a href="http://www.openbsd.org/" target=
                   1083:               "_top">OpenBSD</a></p>
                   1084:             </li>
                   1085: 
                   1086:             <li>
                   1087:               <p><a href="http://www.sun.com/solaris/" target=
                   1088:               "_top">Solaris</a></p>
                   1089:             </li>
                   1090:           </ul>
                   1091:         </div>
                   1092:       </div>
                   1093: 
                   1094:       <div class="sect1" lang="en" xml:lang="en">
                   1095:         <div class="titlepage">
                   1096:           <div>
                   1097:             <div>
                   1098:               <h2 class="title" style="clear: both"><a name=
                   1099:               "overview" id="overview"></a>1.2.&nbsp;Overview</h2>
                   1100:             </div>
                   1101:           </div>
                   1102:         </div>
                   1103: 
                   1104:         <p>This document is divided into two parts. The first,
                   1105:         <a href="#users-guide" title=
1.2       hubertf  1106:         "Part&nbsp;I.&nbsp;The pkgsrc user's guide">The pkgsrc
                   1107:         user's guide</a>, describes how one can use one of the
                   1108:         packages in the Package Collection, either by installing a
                   1109:         precompiled binary package, or by building one's own copy
                   1110:         using the NetBSD package system. The second part, <a href=
1.1       grant    1111:         "#developers-guide" title=
1.2       hubertf  1112:         "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">The
                   1113:         pkgsrc developer's guide</a>, explains how to prepare a
                   1114:         package so it can be easily built by other NetBSD users
                   1115:         without knowing about the package's building details.</p>
1.1       grant    1116: 
                   1117:         <p>This document is available in various formats:</p>
                   1118: 
                   1119:         <div class="itemizedlist">
                   1120:           <ul type="disc">
                   1121:             <li>
                   1122:               <p><a href="index.html" target="_top">HTML</a></p>
                   1123:             </li>
                   1124: 
                   1125:             <li>
                   1126:               <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
                   1127:             </li>
                   1128: 
                   1129:             <li>
                   1130:               <p><a href="pkgsrc.ps" target="_top">PS</a></p>
                   1131:             </li>
                   1132: 
                   1133:             <li>
                   1134:               <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
                   1135:             </li>
                   1136:           </ul>
                   1137:         </div>
                   1138:       </div>
                   1139: 
                   1140:       <div class="sect1" lang="en" xml:lang="en">
                   1141:         <div class="titlepage">
                   1142:           <div>
                   1143:             <div>
                   1144:               <h2 class="title" style="clear: both"><a name=
                   1145:               "terminology" id=
                   1146:               "terminology"></a>1.3.&nbsp;Terminology</h2>
                   1147:             </div>
                   1148:           </div>
                   1149:         </div>
                   1150: 
                   1151:         <p>There has been a lot of talk about &#8220;<span class=
                   1152:         "quote">ports</span>&#8221;, &#8220;<span class=
                   1153:         "quote">packages</span>&#8221;, etc. so far. Here is a
                   1154:         description of all the terminology used within this
                   1155:         document.</p>
                   1156: 
                   1157:         <div class="variablelist">
                   1158:           <dl>
                   1159:             <dt><span class="term">Package</span></dt>
                   1160: 
                   1161:             <dd>
                   1162:               <p>A set of files and building instructions that
                   1163:               describe what's necessary to build a certain piece of
                   1164:               software using pkgsrc. Packages are traditionally
1.14      xtraeme  1165:               stored under <code class=
                   1166:               "filename">/usr/pkgsrc</code>.</p>
1.1       grant    1167:             </dd>
                   1168: 
                   1169:             <dt><span class="term">The NetBSD package
                   1170:             system</span></dt>
                   1171: 
                   1172:             <dd>
                   1173:               <p>This is the former name of &#8220;<span class=
                   1174:               "quote">pkgsrc</span>&#8221;. It is part of the
1.27      rillig   1175:               NetBSD operating system and can be bootstrapped to
                   1176:               run on non-NetBSD operating systems as well. It
                   1177:               handles building (compiling), installing, and
                   1178:               removing of packages.</p>
1.1       grant    1179:             </dd>
                   1180: 
                   1181:             <dt><span class="term">Distfile</span></dt>
                   1182: 
                   1183:             <dd>
                   1184:               <p>This term describes the file or files that are
                   1185:               provided by the author of the piece of software to
                   1186:               distribute his work. All the changes necessary to
                   1187:               build on NetBSD are reflected in the corresponding
                   1188:               package. Usually the distfile is in the form of a
                   1189:               compressed tar-archive, but other types are possible,
1.14      xtraeme  1190:               too. Distfiles are usually stored below <code class=
                   1191:               "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    1192:             </dd>
                   1193: 
                   1194:             <dt><span class="term">Port</span></dt>
                   1195: 
                   1196:             <dd>
                   1197:               <p>This is the term used by FreeBSD and OpenBSD
                   1198:               people for what we call a package. In NetBSD
                   1199:               terminology, &#8220;<span class=
                   1200:               "quote">port</span>&#8221; refers to a different
                   1201:               architecture.</p>
                   1202:             </dd>
                   1203: 
                   1204:             <dt><span class="term">Precompiled/binary
                   1205:             package</span></dt>
                   1206: 
                   1207:             <dd>
                   1208:               <p>A set of binaries built with pkgsrc from a
1.14      xtraeme  1209:               distfile and stuffed together in a single
                   1210:               <code class="filename">.tgz</code> file so it can be
                   1211:               installed on machines of the same machine
                   1212:               architecture without the need to recompile. Packages
                   1213:               are usually generated in <code class=
                   1214:               "filename">/usr/pkgsrc/packages</code>; there is also
                   1215:               an archive on <a href=
1.1       grant    1216:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
                   1217:               "_top">ftp.NetBSD.org</a>.</p>
                   1218: 
                   1219:               <p>Sometimes, this is referred to by the term
                   1220:               &#8220;<span class="quote">package</span>&#8221; too,
                   1221:               especially in the context of precompiled
                   1222:               packages.</p>
                   1223:             </dd>
                   1224: 
                   1225:             <dt><span class="term">Program</span></dt>
                   1226: 
                   1227:             <dd>
                   1228:               <p>The piece of software to be installed which will
                   1229:               be constructed from all the files in the Distfile by
                   1230:               the actions defined in the corresponding package.</p>
                   1231:             </dd>
                   1232:           </dl>
                   1233:         </div>
                   1234:       </div>
                   1235: 
                   1236:       <div class="sect1" lang="en" xml:lang="en">
                   1237:         <div class="titlepage">
                   1238:           <div>
                   1239:             <div>
                   1240:               <h2 class="title" style="clear: both"><a name=
                   1241:               "typography" id=
                   1242:               "typography"></a>1.4.&nbsp;Typography</h2>
                   1243:             </div>
                   1244:           </div>
                   1245:         </div>
                   1246: 
                   1247:         <p>When giving examples for commands, shell prompts are
                   1248:         used to show if the command should/can be issued as root,
                   1249:         or if &#8220;<span class="quote">normal</span>&#8221; user
1.14      xtraeme  1250:         privileges are sufficient. We use a <code class=
                   1251:         "prompt">#</code> for root's shell prompt, and a
1.27      rillig   1252:         <code class="prompt">%</code> for users' shell prompt,
1.14      xtraeme  1253:         assuming they use the C-shell or tcsh.</p>
1.1       grant    1254:       </div>
                   1255:     </div>
                   1256: 
                   1257:     <div class="part" lang="en" xml:lang="en">
                   1258:       <div class="titlepage">
                   1259:         <div>
                   1260:           <div>
                   1261:             <h1 class="title"><a name="users-guide" id=
1.2       hubertf  1262:             "users-guide"></a>The pkgsrc user's guide</h1>
1.1       grant    1263:           </div>
                   1264:         </div>
                   1265:       </div>
                   1266: 
                   1267:       <div class="toc">
                   1268:         <p><b>Table of Contents</b></p>
                   1269: 
                   1270:         <dl>
                   1271:           <dt><span class="chapter"><a href="#getting">2. Where to
                   1272:           get pkgsrc</a></span></dt>
                   1273: 
                   1274:           <dd>
                   1275:             <dl>
1.30      wiz      1276:               <dt><span class="sect1"><a href="#as-tar-file">2.1.
                   1277:               As tar file</a></span></dt>
1.1       grant    1278: 
1.30      wiz      1279:               <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1       grant    1280:               SUP</a></span></dt>
                   1281: 
1.30      wiz      1282:               <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1       grant    1283:               CVS</a></span></dt>
                   1284:             </dl>
                   1285:           </dd>
                   1286: 
                   1287:           <dt><span class="chapter"><a href="#platforms">3. Using
                   1288:           pkgsrc on systems other than NetBSD</a></span></dt>
                   1289: 
                   1290:           <dd>
                   1291:             <dl>
1.30      wiz      1292:               <dt><span class="sect1"><a href=
                   1293:               "#bootstrapping-pkgsrc">3.1. Bootstrapping
                   1294:               pkgsrc</a></span></dt>
1.1       grant    1295: 
1.30      wiz      1296:               <dt><span class="sect1"><a href=
                   1297:               "#platform-specific-notes">3.2. Platform specific
                   1298:               notes</a></span></dt>
1.1       grant    1299: 
                   1300:               <dd>
                   1301:                 <dl>
1.30      wiz      1302:                   <dt><span class="sect2"><a href="#darwin">3.2.1.
                   1303:                   Darwin (Mac OS X)</a></span></dt>
1.1       grant    1304: 
1.30      wiz      1305:                   <dt><span class="sect2"><a href="#freebsd">3.2.2.
                   1306:                   FreeBSD</a></span></dt>
1.22      tv       1307: 
1.30      wiz      1308:                   <dt><span class="sect2"><a href="#interix">3.2.3.
                   1309:                   Interix</a></span></dt>
1.1       grant    1310: 
1.30      wiz      1311:                   <dt><span class="sect2"><a href="#irix">3.2.4.
                   1312:                   IRIX</a></span></dt>
1.1       grant    1313: 
1.30      wiz      1314:                   <dt><span class="sect2"><a href="#linux">3.2.5.
                   1315:                   Linux</a></span></dt>
1.1       grant    1316: 
1.30      wiz      1317:                   <dt><span class="sect2"><a href="#openbsd">3.2.6.
                   1318:                   OpenBSD</a></span></dt>
1.1       grant    1319: 
1.30      wiz      1320:                   <dt><span class="sect2"><a href="#solaris">3.2.7.
                   1321:                   Solaris</a></span></dt>
1.1       grant    1322:                 </dl>
                   1323:               </dd>
                   1324:             </dl>
                   1325:           </dd>
                   1326: 
                   1327:           <dt><span class="chapter"><a href="#using">4. Using
                   1328:           pkgsrc</a></span></dt>
                   1329: 
                   1330:           <dd>
                   1331:             <dl>
                   1332:               <dt><span class="sect1"><a href=
                   1333:               "#getting-started">4.1. Working with binary
                   1334:               packages</a></span></dt>
                   1335: 
                   1336:               <dd>
                   1337:                 <dl>
                   1338:                   <dt><span class="sect2"><a href=
1.30      wiz      1339:                   "#where-to-get-binary-packages">4.1.1. Where to
                   1340:                   get binary packages</a></span></dt>
1.1       grant    1341: 
                   1342:                   <dt><span class="sect2"><a href=
1.30      wiz      1343:                   "#how-to-use-binary-packages">4.1.2. How to use
                   1344:                   binary packages</a></span></dt>
1.1       grant    1345: 
                   1346:                   <dt><span class="sect2"><a href=
1.30      wiz      1347:                   "#a-word-of-warning">4.1.3. A word of
1.1       grant    1348:                   warning</a></span></dt>
                   1349:                 </dl>
                   1350:               </dd>
                   1351: 
1.30      wiz      1352:               <dt><span class="sect1"><a href=
                   1353:               "#building-packages-from-source">4.2. Building
                   1354:               packages from source</a></span></dt>
1.1       grant    1355: 
                   1356:               <dd>
                   1357:                 <dl>
                   1358:                   <dt><span class="sect2"><a href=
1.30      wiz      1359:                   "#requirements">4.2.1.
                   1360:                   Requirements</a></span></dt>
1.1       grant    1361: 
                   1362:                   <dt><span class="sect2"><a href=
1.30      wiz      1363:                   "#fetching-distfiles">4.2.2. Fetching
1.1       grant    1364:                   distfiles</a></span></dt>
                   1365: 
                   1366:                   <dt><span class="sect2"><a href=
1.30      wiz      1367:                   "#how-to-build-and-install">4.2.3. How to build
                   1368:                   and install</a></span></dt>
1.1       grant    1369: 
                   1370:                   <dt><span class="sect2"><a href=
1.30      wiz      1371:                   "#selecting-the-compiler">4.2.4. Selecting the
1.1       grant    1372:                   compiler</a></span></dt>
                   1373:                 </dl>
                   1374:               </dd>
                   1375:             </dl>
                   1376:           </dd>
                   1377: 
                   1378:           <dt><span class="chapter"><a href="#binary">5. Creating
                   1379:           binary packages</a></span></dt>
                   1380: 
                   1381:           <dd>
                   1382:             <dl>
1.30      wiz      1383:               <dt><span class="sect1"><a href=
                   1384:               "#building-a-single-binary-package">5.1. Building a
                   1385:               single binary package</a></span></dt>
1.1       grant    1386: 
1.30      wiz      1387:               <dt><span class="sect1"><a href=
                   1388:               "#settings-for-creationg-of-binary-packages">5.2.
1.1       grant    1389:               Settings for creation of binary
                   1390:               packages</a></span></dt>
                   1391: 
                   1392:               <dt><span class="sect1"><a href="#bulkbuild">5.3.
                   1393:               Doing a bulk build of all packages</a></span></dt>
                   1394: 
                   1395:               <dd>
                   1396:                 <dl>
                   1397:                   <dt><span class="sect2"><a href=
                   1398:                   "#binary.configuration">5.3.1.
                   1399:                   Configuration</a></span></dt>
                   1400: 
                   1401:                   <dt><span class="sect2"><a href=
1.30      wiz      1402:                   "#other-environmental-considerations">5.3.2.
                   1403:                   Other environmental
1.1       grant    1404:                   considerations</a></span></dt>
                   1405: 
                   1406:                   <dt><span class="sect2"><a href=
1.30      wiz      1407:                   "#operation">5.3.3. Operation</a></span></dt>
1.1       grant    1408: 
                   1409:                   <dt><span class="sect2"><a href=
1.30      wiz      1410:                   "#what-it-does">5.3.4. What it
                   1411:                   does</a></span></dt>
1.1       grant    1412: 
                   1413:                   <dt><span class="sect2"><a href=
1.30      wiz      1414:                   "#disk-space-requirements">5.3.5. Disk space
1.1       grant    1415:                   requirements</a></span></dt>
                   1416: 
                   1417:                   <dt><span class="sect2"><a href=
1.30      wiz      1418:                   "#setting-up-a-sandbox">5.3.6. Setting up a
                   1419:                   sandbox for chroot'ed builds</a></span></dt>
1.1       grant    1420: 
                   1421:                   <dt><span class="sect2"><a href=
1.30      wiz      1422:                   "#building-a-partial-set">5.3.7. Building a
                   1423:                   partial set of packages</a></span></dt>
1.13      hubertf  1424: 
                   1425:                   <dt><span class="sect2"><a href=
                   1426:                   "#bulk-upload">5.3.8. Uploading results of a bulk
                   1427:                   build</a></span></dt>
1.1       grant    1428:                 </dl>
                   1429:               </dd>
                   1430: 
1.30      wiz      1431:               <dt><span class="sect1"><a href=
                   1432:               "#creating-cdroms">5.4. Creating a multiple CD-ROM
                   1433:               packages collection</a></span></dt>
1.1       grant    1434: 
                   1435:               <dd>
                   1436:                 <dl>
                   1437:                   <dt><span class="sect2"><a href=
1.30      wiz      1438:                   "#cdpack-example">5.4.1. Example of
1.1       grant    1439:                   cdpack</a></span></dt>
                   1440:                 </dl>
                   1441:               </dd>
                   1442:             </dl>
                   1443:           </dd>
                   1444: 
                   1445:           <dt><span class="chapter"><a href="#faq">6. Frequently
                   1446:           Asked Questions</a></span></dt>
                   1447: 
                   1448:           <dd>
                   1449:             <dl>
1.30      wiz      1450:               <dt><span class="sect1"><a href=
                   1451:               "#mailing-list-pointers">6.1. Are there any mailing
                   1452:               lists for pkg-related discussion?</a></span></dt>
1.1       grant    1453: 
1.30      wiz      1454:               <dt><span class="sect1"><a href="#pkgviews-docs">6.2.
1.1       grant    1455:               Where's the pkgviews documentation?</a></span></dt>
                   1456: 
1.5       hubertf  1457:               <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1       grant    1458:               Utilities for package management
                   1459:               (pkgtools)</a></span></dt>
                   1460: 
1.30      wiz      1461:               <dt><span class="sect1"><a href=
                   1462:               "#non-root-pkgsrc">6.4. How to use pkgsrc as
                   1463:               non-root</a></span></dt>
1.1       grant    1464: 
1.30      wiz      1465:               <dt><span class="sect1"><a href=
                   1466:               "#resume-transfers">6.5. How to resume transfers when
                   1467:               fetching distfiles?</a></span></dt>
1.14      xtraeme  1468: 
1.30      wiz      1469:               <dt><span class="sect1"><a href=
                   1470:               "#XFree86-from-pkgsrc">6.6. How can I install/use
                   1471:               XFree86 from pkgsrc?</a></span></dt>
1.1       grant    1472: 
1.30      wiz      1473:               <dt><span class="sect1"><a href=
                   1474:               "#x.org-from-pkgsrc">6.7. How can I install/use X.org
                   1475:               from pkgsrc?</a></span></dt>
1.1       grant    1476: 
1.30      wiz      1477:               <dt><span class="sect1"><a href=
                   1478:               "#fetch-behind-firewall">6.8. How to fetch files from
                   1479:               behind a firewall</a></span></dt>
1.1       grant    1480: 
1.30      wiz      1481:               <dt><span class="sect1"><a href="#passive-ftp">6.9.
                   1482:               How do I tell <span><strong class="command">make
1.14      xtraeme  1483:               fetch</strong></span> to do passive
1.1       grant    1484:               FTP?</a></span></dt>
                   1485: 
1.30      wiz      1486:               <dt><span class="sect1"><a href=
                   1487:               "#fetching-all-distfiles">6.10. How to fetch all
                   1488:               distfiles at once</a></span></dt>
1.1       grant    1489: 
1.30      wiz      1490:               <dt><span class="sect1"><a href=
                   1491:               "#tmac.andoc-missing">6.11. What does
                   1492:               &#8220;<span class="quote">Don't know how to make
                   1493:               /usr/share/tmac/tmac.andoc</span>&#8221;
1.14      xtraeme  1494:               mean?</a></span></dt>
1.13      hubertf  1495: 
1.30      wiz      1496:               <dt><span class="sect1"><a href=
                   1497:               "#bsd.own.mk-missing">6.12. What does
                   1498:               &#8220;<span class="quote">Could not find
1.14      xtraeme  1499:               bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    1500: 
1.30      wiz      1501:               <dt><span class="sect1"><a href=
                   1502:               "#using-sudo-with-pkgsrc">6.13. Using 'sudo' with
                   1503:               pkgsrc</a></span></dt>
1.1       grant    1504: 
1.35      jmmv     1505:               <dt><span class="sect1"><a href="#faq.conf">6.14. How
                   1506:               do I change the location of configuration
                   1507:               files?</a></span></dt>
1.1       grant    1508: 
                   1509:               <dt><span class="sect1"><a href=
1.14      xtraeme  1510:               "#audit-packages">6.15. Automated security
1.1       grant    1511:               checks</a></span></dt>
                   1512:             </dl>
                   1513:           </dd>
                   1514:         </dl>
                   1515:       </div>
                   1516: 
                   1517:       <div class="chapter" lang="en" xml:lang="en">
                   1518:         <div class="titlepage">
                   1519:           <div>
                   1520:             <div>
                   1521:               <h2 class="title"><a name="getting" id=
                   1522:               "getting"></a>Chapter&nbsp;2.&nbsp;Where to get
                   1523:               pkgsrc</h2>
                   1524:             </div>
                   1525:           </div>
                   1526:         </div>
                   1527: 
                   1528:         <div class="toc">
                   1529:           <p><b>Table of Contents</b></p>
                   1530: 
                   1531:           <dl>
1.30      wiz      1532:             <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1       grant    1533:             tar file</a></span></dt>
                   1534: 
1.30      wiz      1535:             <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1       grant    1536:             SUP</a></span></dt>
                   1537: 
1.30      wiz      1538:             <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1       grant    1539:             CVS</a></span></dt>
                   1540:           </dl>
                   1541:         </div>
                   1542: 
                   1543:         <p>There are three ways to get pkgsrc. Either as a tar
                   1544:         file, via SUP, or via CVS. All three ways are described
                   1545:         here.</p>
                   1546: 
                   1547:         <div class="sect1" lang="en" xml:lang="en">
                   1548:           <div class="titlepage">
                   1549:             <div>
                   1550:               <div>
                   1551:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      1552:                 "as-tar-file" id="as-tar-file"></a>2.1.&nbsp;As tar
1.1       grant    1553:                 file</h2>
                   1554:               </div>
                   1555:             </div>
                   1556:           </div>
                   1557: 
                   1558:           <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
                   1559:           file from <a href=
1.11      ben      1560:           "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20      ben      1561:           target="_top">ftp.NetBSD.org</a> and unpack it into
                   1562:           <code class="filename">/usr/pkgsrc</code>.</p>
1.1       grant    1563:         </div>
                   1564: 
                   1565:         <div class="sect1" lang="en" xml:lang="en">
                   1566:           <div class="titlepage">
                   1567:             <div>
                   1568:               <div>
                   1569:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      1570:                 "via-sup" id="via-sup"></a>2.2.&nbsp;Via SUP</h2>
1.1       grant    1571:               </div>
                   1572:             </div>
                   1573:           </div>
                   1574: 
                   1575:           <p>As an alternative to the tar file, you can get pkgsrc
                   1576:           via the Software Update Protocol, SUP. To do so, make
                   1577:           sure your supfile has a line</p>
                   1578:           <pre class="programlisting">
                   1579: release=pkgsrc
                   1580: </pre>
                   1581: 
1.14      xtraeme  1582:           <p>in it, see the examples in <code class=
                   1583:           "filename">/usr/share/examples/supfiles</code>, and that
                   1584:           the <code class="filename">/usr/pkgsrc</code> directory
                   1585:           exists. Then, simply run <span><strong class=
                   1586:           "command">sup -v <em class=
                   1587:           "replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1       grant    1588:         </div>
                   1589: 
                   1590:         <div class="sect1" lang="en" xml:lang="en">
                   1591:           <div class="titlepage">
                   1592:             <div>
                   1593:               <div>
                   1594:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      1595:                 "via-cvs" id="via-cvs"></a>2.3.&nbsp;Via CVS</h2>
1.1       grant    1596:               </div>
                   1597:             </div>
                   1598:           </div>
                   1599: 
                   1600:           <p>To get pkgsrc via CVS, make sure you have
                   1601:           &#8220;<span class="quote">cvs</span>&#8221; installed.
1.27      rillig   1602:           To do an initial (full) checkout of pkgsrc, do the
                   1603:           following steps:</p>
1.1       grant    1604:           <pre class="screen">
1.14      xtraeme  1605: <code class="prompt">%</code> <strong class=
                   1606: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
                   1607: <code class="prompt">%</code> <strong class=
                   1608: "userinput"><code>setenv CVS_RSH ssh</code></strong>
                   1609: <code class="prompt">%</code> <strong class=
                   1610: "userinput"><code>cd /usr</code></strong>
                   1611: <code class="prompt">%</code> <strong class=
                   1612: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
                   1613: </pre>
                   1614: 
                   1615:           <p>This will create the <code class=
                   1616:           "filename">pkgsrc</code> directory in your <code class=
                   1617:           "filename">/usr</code>, and all the package source will
                   1618:           be stored under <code class=
                   1619:           "filename">/usr/pkgsrc</code>. To update pkgsrc after the
                   1620:           initial checkout, make sure you have <code class=
                   1621:           "varname">CVS_RSH</code> set as above, then do:</p>
1.1       grant    1622:           <pre class="screen">
1.14      xtraeme  1623: <code class="prompt">%</code> <strong class=
                   1624: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   1625: <code class="prompt">%</code> <strong class=
                   1626: "userinput"><code>cvs -q update -dP</code></strong>
1.1       grant    1627: </pre>
                   1628: 
                   1629:           <p>Please also note that it is possible to have multiple
                   1630:           copies of the pkgsrc hierarchy in use at any one time -
                   1631:           all work is done relatively within the pkgsrc tree.</p>
                   1632:         </div>
                   1633:       </div>
                   1634: 
                   1635:       <div class="chapter" lang="en" xml:lang="en">
                   1636:         <div class="titlepage">
                   1637:           <div>
                   1638:             <div>
                   1639:               <h2 class="title"><a name="platforms" id=
                   1640:               "platforms"></a>Chapter&nbsp;3.&nbsp;Using pkgsrc on
                   1641:               systems other than NetBSD</h2>
                   1642:             </div>
                   1643:           </div>
                   1644:         </div>
                   1645: 
                   1646:         <div class="toc">
                   1647:           <p><b>Table of Contents</b></p>
                   1648: 
                   1649:           <dl>
1.30      wiz      1650:             <dt><span class="sect1"><a href=
                   1651:             "#bootstrapping-pkgsrc">3.1. Bootstrapping
                   1652:             pkgsrc</a></span></dt>
1.1       grant    1653: 
1.30      wiz      1654:             <dt><span class="sect1"><a href=
                   1655:             "#platform-specific-notes">3.2. Platform specific
                   1656:             notes</a></span></dt>
1.1       grant    1657: 
                   1658:             <dd>
                   1659:               <dl>
1.30      wiz      1660:                 <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1       grant    1661:                 Darwin (Mac OS X)</a></span></dt>
                   1662: 
1.30      wiz      1663:                 <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1       grant    1664:                 FreeBSD</a></span></dt>
                   1665: 
1.30      wiz      1666:                 <dt><span class="sect2"><a href="#interix">3.2.3.
1.1       grant    1667:                 Interix</a></span></dt>
                   1668: 
1.30      wiz      1669:                 <dt><span class="sect2"><a href="#irix">3.2.4.
1.1       grant    1670:                 IRIX</a></span></dt>
                   1671: 
1.30      wiz      1672:                 <dt><span class="sect2"><a href="#linux">3.2.5.
1.22      tv       1673:                 Linux</a></span></dt>
                   1674: 
1.30      wiz      1675:                 <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1       grant    1676:                 OpenBSD</a></span></dt>
                   1677: 
1.30      wiz      1678:                 <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1       grant    1679:                 Solaris</a></span></dt>
                   1680:               </dl>
                   1681:             </dd>
                   1682:           </dl>
                   1683:         </div>
                   1684: 
                   1685:         <div class="sect1" lang="en" xml:lang="en">
                   1686:           <div class="titlepage">
                   1687:             <div>
                   1688:               <div>
                   1689:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      1690:                 "bootstrapping-pkgsrc" id=
                   1691:                 "bootstrapping-pkgsrc"></a>3.1.&nbsp;Bootstrapping
                   1692:                 pkgsrc</h2>
1.1       grant    1693:               </div>
                   1694:             </div>
                   1695:           </div>
                   1696: 
1.27      rillig   1697:           <p>For operating systems other than NetBSD, we provide a
1.1       grant    1698:           bootstrap kit to build the required tools to use pkgsrc
                   1699:           on your platform. Besides support for native NetBSD,
                   1700:           pkgsrc and the bootstrap kit have support for the
                   1701:           following operating systems:</p>
                   1702: 
                   1703:           <div class="itemizedlist">
                   1704:             <ul type="disc">
                   1705:               <li>
                   1706:                 <p>Darwin (Mac OS X)</p>
                   1707:               </li>
                   1708: 
                   1709:               <li>
1.16      grant    1710:                 <p>DragonFlyBSD</p>
                   1711:               </li>
                   1712: 
                   1713:               <li>
1.1       grant    1714:                 <p>FreeBSD</p>
                   1715:               </li>
                   1716: 
                   1717:               <li>
                   1718:                 <p>Interix (Windows 2000, XP, 2003)</p>
                   1719:               </li>
                   1720: 
                   1721:               <li>
                   1722:                 <p>IRIX</p>
                   1723:               </li>
                   1724: 
                   1725:               <li>
                   1726:                 <p>Linux</p>
                   1727:               </li>
                   1728: 
                   1729:               <li>
                   1730:                 <p>OpenBSD</p>
                   1731:               </li>
                   1732: 
                   1733:               <li>
                   1734:                 <p>Solaris</p>
                   1735:               </li>
1.16      grant    1736: 
                   1737:               <li>
                   1738:                 <p>Tru64 (Digital UNIX/OSF1)</p>
                   1739:               </li>
1.1       grant    1740:             </ul>
                   1741:           </div>
                   1742: 
                   1743:           <p>Support for other platforms is under development.</p>
                   1744: 
                   1745:           <p>Installing the bootstrap kit should be as simple
                   1746:           as:</p>
                   1747:           <pre class="screen">
1.14      xtraeme  1748: <code class="prompt">#</code> <strong class=
                   1749: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
                   1750: <code class="prompt">#</code> <strong class=
                   1751: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1752: <code class="prompt">#</code> <strong class=
                   1753: "userinput"><code>./bootstrap</code></strong>
1.1       grant    1754: </pre>
                   1755: 
                   1756:           <p>See <a href="#getting" title=
                   1757:           "Chapter&nbsp;2.&nbsp;Where to get pkgsrc">Chapter 2,
                   1758:           <i>Where to get pkgsrc</i></a> for other ways to get
1.14      xtraeme  1759:           pkgsrc before bootstrapping. The given
                   1760:           <span><strong class="command">bootstrap</strong></span>
                   1761:           command will use the defaults of <code class=
                   1762:           "filename">/usr/pkg</code> for the <span class=
                   1763:           "emphasis"><em>prefix</em></span> where programs will be
                   1764:           installed in, and <code class=
                   1765:           "filename">/var/db/pkg</code> for the package database
1.27      rillig   1766:           directory where pkgsrc will do its internal bookkeeping.
1.1       grant    1767:           However, these can also be set using command-line
1.27      rillig   1768:           arguments.</p>
1.1       grant    1769: 
                   1770:           <p>Binary packages for the pkgsrc tools and an initial
                   1771:           set of packages is available for supported platforms. An
                   1772:           up-to-date list of these can be found on <a href=
                   1773:           "http://www.pkgsrc.org/" target=
                   1774:           "_top">www.pkgsrc.org</a>.</p>
                   1775:         </div>
                   1776: 
                   1777:         <div class="sect1" lang="en" xml:lang="en">
                   1778:           <div class="titlepage">
                   1779:             <div>
                   1780:               <div>
                   1781:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      1782:                 "platform-specific-notes" id=
                   1783:                 "platform-specific-notes"></a>3.2.&nbsp;Platform
1.1       grant    1784:                 specific notes</h2>
                   1785:               </div>
                   1786:             </div>
                   1787:           </div>
                   1788: 
                   1789:           <p>Here are some platform-specific notes you should be
                   1790:           aware of.</p>
                   1791: 
                   1792:           <div class="sect2" lang="en" xml:lang="en">
                   1793:             <div class="titlepage">
                   1794:               <div>
                   1795:                 <div>
1.30      wiz      1796:                   <h3 class="title"><a name="darwin" id=
                   1797:                   "darwin"></a>3.2.1.&nbsp;Darwin (Mac OS X)</h3>
1.1       grant    1798:                 </div>
                   1799:               </div>
                   1800:             </div>
                   1801: 
                   1802:             <p>Darwin 5.x and 6.x are supported. There are two
                   1803:             methods of using pkgsrc on Mac OS X, by using a
                   1804:             <a href="#platform.osx-image" title=
                   1805:             "3.2.1.1.&nbsp;Using a disk image">disk image</a>, or a
                   1806:             <a href="#platform.osx-ufs" title=
                   1807:             "3.2.1.2.&nbsp;Using a UFS partition">UFS
                   1808:             partition</a>.</p>
                   1809: 
                   1810:             <p>Before you start, you will need to download and
                   1811:             install the Mac OS X Developer Tools from Apple's
                   1812:             Developer Connection. See <a href=
                   1813:             "http://developer.apple.com/macosx/" target=
                   1814:             "_top">http://developer.apple.com/macosx/</a> for
                   1815:             details. Also, make sure you install X11 for Mac OS X
                   1816:             and the X11 SDK from <a href=
                   1817:             "http://www.apple.com/macosx/x11/download/" target=
                   1818:             "_top">http://www.apple.com/macosx/x11/download/</a> if
                   1819:             you intend to build packages that use the X11 Window
                   1820:             System.</p>
                   1821: 
                   1822:             <p>If you already have a UFS partition, or have a spare
                   1823:             partition that you can format as UFS, it is recommended
                   1824:             to use that instead of the disk image. It'll be
                   1825:             somewhat faster and will mount automatically at boot
                   1826:             time, where you must manually mount a disk image.</p>
                   1827: 
                   1828:             <div class="note" style=
                   1829:             "margin-left: 0.5in; margin-right: 0.5in;">
                   1830:               <h3 class="title">Note</h3>
                   1831: 
                   1832:               <p>You cannot use a HFS+ file system for pkgsrc,
                   1833:               because pkgsrc currently requires the filesystem to
                   1834:               be case-sensitive, and HFS+ is not.</p>
                   1835:             </div>
                   1836: 
                   1837:             <div class="sect3" lang="en" xml:lang="en">
                   1838:               <div class="titlepage">
                   1839:                 <div>
                   1840:                   <div>
                   1841:                     <h4 class="title"><a name="platform.osx-image"
                   1842:                     id="platform.osx-image"></a>3.2.1.1.&nbsp;Using
                   1843:                     a disk image</h4>
                   1844:                   </div>
                   1845:                 </div>
                   1846:               </div>
                   1847: 
                   1848:               <p>Create the disk image:</p>
                   1849:               <pre class="screen">
1.14      xtraeme  1850: <code class="prompt">#</code> <strong class=
                   1851: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1852: <code class="prompt">#</code> <strong class=
                   1853: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
                   1854: <code class="prompt">#</code> <strong class=
                   1855: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
                   1856: <code class="prompt">#</code> <strong class=
                   1857: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1       grant    1858: </pre>
                   1859: 
                   1860:               <p>That's it!</p>
                   1861:             </div>
                   1862: 
                   1863:             <div class="sect3" lang="en" xml:lang="en">
                   1864:               <div class="titlepage">
                   1865:                 <div>
                   1866:                   <div>
                   1867:                     <h4 class="title"><a name="platform.osx-ufs"
                   1868:                     id="platform.osx-ufs"></a>3.2.1.2.&nbsp;Using a
                   1869:                     UFS partition</h4>
                   1870:                   </div>
                   1871:                 </div>
                   1872:               </div>
                   1873: 
1.14      xtraeme  1874:               <p>By default, <code class="filename">/usr</code>
                   1875:               will be on your root file system, normally HFS+. It
                   1876:               is possible to use the default <span class=
                   1877:               "emphasis"><em>prefix</em></span> of <code class=
                   1878:               "filename">/usr/pkg</code> by symlinking <code class=
                   1879:               "filename">/usr/pkg</code> to a directory on a UFS
                   1880:               file system. Obviously, another symlink is required
                   1881:               if you want to place the package database directory
                   1882:               outside the <span class=
                   1883:               "emphasis"><em>prefix</em></span>. e.g.</p>
1.1       grant    1884:               <pre class="screen">
1.14      xtraeme  1885: <code class="prompt">#</code> <strong class=
1.22      tv       1886: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb --pkgsrcdir /Volumes/ufs/pkgsrc</code></strong>
1.1       grant    1887: </pre>
                   1888: 
                   1889:               <p>If you created your partitions at the time of
                   1890:               installing Mac OS X and formatted the target
                   1891:               partition as UFS, it should automatically mount on
1.14      xtraeme  1892:               <code class="filename">/Volumes/&lt;volume
                   1893:               name&gt;</code> when the machine boots. If you are
1.1       grant    1894:               (re)formatting a partition as UFS, you need to ensure
                   1895:               that the partition map correctly reflects
                   1896:               &#8220;<span class="quote">Apple_UFS</span>&#8221;
                   1897:               and not &#8220;<span class=
                   1898:               "quote">Apple_HFS</span>&#8221;.</p>
                   1899: 
                   1900:               <p>The problem is that none of the disk tools will
                   1901:               let you touch a disk that is booted from. You can
                   1902:               unmount the partition, but even if you newfs it, the
                   1903:               partition type will be incorrect and the automounter
                   1904:               won't mount it. It can be mounted manually, but it
                   1905:               won't appear in Finder.</p>
                   1906: 
                   1907:               <p>You'll need to boot off of the OS X Installation
                   1908:               (User) CD. When the Installation program starts, go
                   1909:               up to the menu and select Disk Utility. Now, you will
                   1910:               be able to select the partition you want to be UFS,
                   1911:               and Format it Apple UFS. Quit the Disk Utility, quit
                   1912:               the installer which will reboot your machine. The new
                   1913:               UFS file system will appear in Finder.</p>
                   1914: 
                   1915:               <p>Be aware that the permissions on the new file
                   1916:               system will be writable by root only.</p>
                   1917: 
                   1918:               <p>This note is as of 10.2 (Jaguar) and applies to
                   1919:               earlier versions. Hopefully Apple will fix Disk
                   1920:               Utility in 10.3 (Panther).</p>
                   1921:             </div>
                   1922:           </div>
                   1923: 
                   1924:           <div class="sect2" lang="en" xml:lang="en">
                   1925:             <div class="titlepage">
                   1926:               <div>
                   1927:                 <div>
1.30      wiz      1928:                   <h3 class="title"><a name="freebsd" id=
                   1929:                   "freebsd"></a>3.2.2.&nbsp;FreeBSD</h3>
1.1       grant    1930:                 </div>
                   1931:               </div>
                   1932:             </div>
                   1933: 
                   1934:             <p>FreeBSD 4.7 and 5.0 have been tested and are
                   1935:             supported, other versions may work.</p>
                   1936: 
                   1937:             <p>Care should be taken so that the tools that this kit
                   1938:             installs do not conflict with the FreeBSD userland
                   1939:             tools. There are several steps:</p>
                   1940: 
                   1941:             <div class="orderedlist">
                   1942:               <ol type="1">
                   1943:                 <li>
                   1944:                   <p>FreeBSD stores its ports pkg database in
1.14      xtraeme  1945:                   <code class="filename">/var/db/pkg</code>. It is
1.1       grant    1946:                   therefore recommended that you choose a different
1.14      xtraeme  1947:                   location (e.g. <code class=
                   1948:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    1949:                   --pkgdbdir option to the bootstrap script.</p>
                   1950:                 </li>
                   1951: 
                   1952:                 <li>
                   1953:                   <p>If you do not intend to use the FreeBSD ports
                   1954:                   tools, it's probably a good idea to move them out
                   1955:                   of the way to avoid confusion, e.g.</p>
                   1956:                   <pre class="screen">
1.14      xtraeme  1957: <code class="prompt">#</code> <strong class=
                   1958: "userinput"><code>cd /usr/sbin</code></strong>
                   1959: <code class="prompt">#</code> <strong class=
                   1960: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   1961: <code class="prompt">#</code> <strong class=
                   1962: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   1963: <code class="prompt">#</code> <strong class=
                   1964: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   1965: <code class="prompt">#</code> <strong class=
                   1966: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    1967: </pre>
                   1968:                 </li>
                   1969: 
                   1970:                 <li>
1.14      xtraeme  1971:                   <p>An example <code class=
                   1972:                   "filename">/etc/mk.conf</code> file will be
                   1973:                   placed in <code class=
                   1974:                   "filename">/etc/mk.conf.example</code> file when
                   1975:                   you use the bootstrap script.</p>
1.1       grant    1976:                 </li>
                   1977:               </ol>
                   1978:             </div>
                   1979:           </div>
                   1980: 
                   1981:           <div class="sect2" lang="en" xml:lang="en">
                   1982:             <div class="titlepage">
                   1983:               <div>
                   1984:                 <div>
1.30      wiz      1985:                   <h3 class="title"><a name="interix" id=
                   1986:                   "interix"></a>3.2.3.&nbsp;Interix</h3>
1.1       grant    1987:                 </div>
                   1988:               </div>
                   1989:             </div>
                   1990: 
                   1991:             <p>Interix is a POSIX compatible subsystem for the
                   1992:             Windows NT kernel, providing a Unix-like environment
                   1993:             with a tighter kernel integration than available with
                   1994:             Cygwin. It is part of the Windows Services for Unix
                   1995:             package, available for free for any licensed copy of
1.22      tv       1996:             Windows 2000, XP (not including XP Home), or 2003. SFU
                   1997:             can be downloaded from <a href=
                   1998:             "http://www.microsoft.com/windows/sfu/" target=
1.1       grant    1999:             "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
                   2000: 
                   2001:             <p>Services for Unix 3.5, current as of this writing,
                   2002:             has been tested. 3.0 or 3.1 may work, but are not
                   2003:             officially supported. (The main difference in 3.0/3.1
                   2004:             is lack of pthreads.)</p>
                   2005: 
                   2006:             <div class="sect3" lang="en" xml:lang="en">
                   2007:               <div class="titlepage">
                   2008:                 <div>
                   2009:                   <div>
                   2010:                     <h4 class="title"><a name=
                   2011:                     "platform.interix-sfu-install" id=
                   2012:                     "platform.interix-sfu-install"></a>3.2.3.1.&nbsp;When
1.2       hubertf  2013:                     installing Interix/SFU</h4>
1.1       grant    2014:                   </div>
                   2015:                 </div>
                   2016:               </div>
                   2017: 
                   2018:               <p>At an absolute minimum, the following packages
                   2019:               must be installed from the Windows Services for Unix
                   2020:               3.5 distribution in order to use pkgsrc:</p>
                   2021: 
                   2022:               <div class="itemizedlist">
                   2023:                 <ul type="disc">
                   2024:                   <li>
                   2025:                     <p>Utilities -&gt; Base Utilities</p>
                   2026:                   </li>
                   2027: 
                   2028:                   <li>
                   2029:                     <p>Interix GNU Components -&gt; (all)</p>
                   2030:                   </li>
                   2031: 
                   2032:                   <li>
                   2033:                     <p>Remote Connectivity</p>
                   2034:                   </li>
                   2035: 
                   2036:                   <li>
                   2037:                     <p>Interix SDK</p>
                   2038:                   </li>
                   2039:                 </ul>
                   2040:               </div>
                   2041: 
                   2042:               <p>When using pkgsrc on Interix, DO NOT install the
                   2043:               Utilities subcomponent "UNIX Perl". That is Perl 5.6
                   2044:               without shared module support, installed to
                   2045:               /usr/local, and will only cause confusion. Instead,
                   2046:               install Perl 5.8 from pkgsrc (or from a binary
                   2047:               package).</p>
                   2048: 
                   2049:               <p>The Remote Connectivity subcomponent "Windows
                   2050:               Remote Shell Service" does not need to be installed,
                   2051:               but Remote Connectivity itself should be installed in
                   2052:               order to have a working inetd.</p>
                   2053: 
                   2054:               <p>Finally, during installation you may be asked
                   2055:               whether to enable setuid behavior for Interix
                   2056:               programs, and whether to make pathnames default to
                   2057:               case-sensitive. Setuid should be enabled, and
                   2058:               case-sensitivity MUST be enabled. (Without
                   2059:               case-sensitivity, a large number of packages
                   2060:               including perl will not build.)</p>
                   2061:             </div>
                   2062: 
                   2063:             <div class="sect3" lang="en" xml:lang="en">
                   2064:               <div class="titlepage">
                   2065:                 <div>
                   2066:                   <div>
                   2067:                     <h4 class="title"><a name=
                   2068:                     "platform.interix-sfu-postinstall" id=
                   2069:                     "platform.interix-sfu-postinstall"></a>3.2.3.2.&nbsp;What
                   2070:                     to do if Interix/SFU is already installed</h4>
                   2071:                   </div>
                   2072:                 </div>
                   2073:               </div>
                   2074: 
                   2075:               <p>If SFU is already installed and you wish to alter
                   2076:               these settings to work with pkgsrc, note the
                   2077:               following things.</p>
                   2078: 
                   2079:               <div class="itemizedlist">
                   2080:                 <ul type="disc">
                   2081:                   <li>
                   2082:                     <p>To uninstall UNIX Perl, use Add/Remove
                   2083:                     Programs, select Microsoft Windows Services for
                   2084:                     UNIX, then click Change. In the installer,
                   2085:                     choose Add or Remove, then uncheck
                   2086:                     Utilities-&gt;UNIX Perl.</p>
                   2087:                   </li>
                   2088: 
                   2089:                   <li>
                   2090:                     <p>To enable case-sensitivity for the
                   2091:                     filesystem, run REGEDIT.EXE, and change the
                   2092:                     following registry key:</p>
                   2093: 
                   2094:                     <p>
                   2095:                     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
                   2096:                     Manager\kernel</p>
                   2097: 
                   2098:                     <p>Set the DWORD value "obcaseinsensitive" to
                   2099:                     0; then reboot.</p>
                   2100:                   </li>
                   2101: 
                   2102:                   <li>
                   2103:                     <p>To enable setuid binaries (optional), run
                   2104:                     REGEDIT.EXE, and change the following registry
                   2105:                     key:</p>
                   2106: 
                   2107:                     <p>
                   2108:                     HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
                   2109:                     for UNIX</p>
                   2110: 
                   2111:                     <p>Set the DWORD value "EnableSetuidBinaries"
                   2112:                     to 1; then reboot.</p>
                   2113:                   </li>
                   2114:                 </ul>
                   2115:               </div>
                   2116:             </div>
                   2117: 
                   2118:             <div class="sect3" lang="en" xml:lang="en">
                   2119:               <div class="titlepage">
                   2120:                 <div>
                   2121:                   <div>
                   2122:                     <h4 class="title"><a name=
                   2123:                     "platform.interix-notes" id=
                   2124:                     "platform.interix-notes"></a>3.2.3.3.&nbsp;Important
                   2125:                     notes for using pkgsrc</h4>
                   2126:                   </div>
                   2127:                 </div>
                   2128:               </div>
                   2129: 
                   2130:               <p>The package imanager (either the pkgsrc "su" user,
                   2131:               or the user running "pkg_add") must be a member of
                   2132:               the local Administrators group. Such a user must also
                   2133:               be used to run the bootstrap. This is slightly
                   2134:               relaxed from the normal pkgsrc requirement of
                   2135:               "root".</p>
                   2136: 
                   2137:               <p>The package manager should use a umask of 002.
                   2138:               "make install" will automatically complain if this is
                   2139:               not the case. This ensures that directories written
                   2140:               in /var/db/pkg are Administrators-group
                   2141:               writeable.</p>
                   2142: 
                   2143:               <p>The popular Interix binary packages from
                   2144:               http://www.interopsystems.com/ use an older version
                   2145:               of pkgsrc's pkg_* tools. Ideally, these should NOT be
                   2146:               used in conjunction with pkgsrc. If you choose to use
                   2147:               them at the same time as the pkgsrc packages, ensure
                   2148:               that you use the proper pkg_* tools for each type of
                   2149:               binary package.</p>
1.22      tv       2150: 
                   2151:               <p>The TERM setting used for DOS-type console windows
                   2152:               (including those invoked by the csh and ksh startup
                   2153:               shortcuts) is "interix". Most systems don't have a
                   2154:               termcap/terminfo entry for it, but the following
                   2155:               .termcap entry provides adequate emulation in most
                   2156:               cases:</p>
                   2157:               <pre class="programlisting">
                   2158: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
                   2159: </pre>
1.1       grant    2160:             </div>
                   2161:           </div>
                   2162: 
                   2163:           <div class="sect2" lang="en" xml:lang="en">
                   2164:             <div class="titlepage">
                   2165:               <div>
                   2166:                 <div>
1.30      wiz      2167:                   <h3 class="title"><a name="irix" id=
                   2168:                   "irix"></a>3.2.4.&nbsp;IRIX</h3>
1.1       grant    2169:                 </div>
                   2170:               </div>
                   2171:             </div>
                   2172: 
                   2173:             <p>You will need a working C compiler, either gcc or
                   2174:             SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14      xtraeme  2175:             the <code class="varname">CC</code> environment
                   2176:             variable according to your preference. If you do not
                   2177:             have a license for the MIPSpro compiler suite, you can
1.1       grant    2178:             download a gcc tardist file from <a href=
                   2179:             "http://freeware.sgi.com/" target=
                   2180:             "_top">http://freeware.sgi.com/</a>.</p>
                   2181: 
                   2182:             <p>Please note that you will need IRIX 6.5.17 or
                   2183:             higher, as this is the earliest version of IRIX
1.24      wiz      2184:             providing support for <a href=
                   2185:             "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
                   2186:             <span class="citerefentry"><span class=
                   2187:             "refentrytitle">if_indextoname</span>(3)</span></a>,
                   2188:             <a href=
                   2189:             "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
                   2190:             <span class="citerefentry"><span class=
                   2191:             "refentrytitle">if_nametoindex</span>(3)</span></a>,
                   2192:             etc.</p>
1.1       grant    2193: 
1.27      rillig   2194:             <p>At this point in time, pkgsrc only supports one ABI
                   2195:             at a time. That is, you can not switch between the old
                   2196:             32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
                   2197:             you start out using "abi=n32", that's what all your
                   2198:             packages will be built with.</p>
1.1       grant    2199: 
                   2200:             <p>Therefore, please make sure that you have no
1.14      xtraeme  2201:             conflicting <code class="varname">CFLAGS</code> in your
                   2202:             environment or the <code class=
                   2203:             "filename">/etc/mk.conf</code>. Particularly, make sure
1.1       grant    2204:             that you do not try to link n32 object files with lib64
1.14      xtraeme  2205:             or vice versa. Check your <code class=
                   2206:             "filename">/etc/compiler.defaults</code>!</p>
1.1       grant    2207: 
                   2208:             <p>If you have the actual pkgsrc tree mounted via NFS
                   2209:             from a different host, please make sure to set
1.14      xtraeme  2210:             <code class="varname">WRKOBJDIR</code> to a local
1.1       grant    2211:             directory, as it appears that IRIX linker occasionally
                   2212:             runs into issues when trying to link over a network
                   2213:             mounted filesystem.</p>
                   2214: 
                   2215:             <p>The bootstrapping process should set all the right
                   2216:             options for programs such as imake(1), but you may want
                   2217:             to set some options depending on your local setup.
1.14      xtraeme  2218:             Please see <code class=
                   2219:             "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27      rillig   2220:             course, your compiler's man pages for details.</p>
1.22      tv       2221: 
                   2222:             <p>If you are using SGI's MIPSPro compiler, please
                   2223:             set</p>
                   2224:             <pre class="programlisting">
                   2225: PKGSRC_COMPILER=mipspro
                   2226: </pre>
                   2227: 
                   2228:             <p>in <code class="filename">/etc/mk.conf</code>.
                   2229:             Otherwise, pkgsrc will assume you are using gcc and may
                   2230:             end up passing invalid flags to the compiler. Note that
                   2231:             bootstrap should create an appropriate <code class=
                   2232:             "filename">mk.conf.example</code> by default.</p>
                   2233: 
                   2234:             <p>If you have both the MIPSPro compiler chain
                   2235:             installed as well as gcc, but want to make sure that
                   2236:             MIPRPro is used, please set your <code class=
                   2237:             "varname">PATH</code> to <span class=
                   2238:             "emphasis"><em>not</em></span> include the location of
                   2239:             gcc (often <code class=
                   2240:             "filename">/usr/freeware/bin</code>), and (important)
                   2241:             pass the '--preserve-path' flag.</p>
1.1       grant    2242:           </div>
                   2243: 
                   2244:           <div class="sect2" lang="en" xml:lang="en">
                   2245:             <div class="titlepage">
                   2246:               <div>
                   2247:                 <div>
1.30      wiz      2248:                   <h3 class="title"><a name="linux" id=
                   2249:                   "linux"></a>3.2.5.&nbsp;Linux</h3>
1.22      tv       2250:                 </div>
                   2251:               </div>
                   2252:             </div>
                   2253: 
                   2254:             <p>Some versions of Linux (for example Debian
                   2255:             GNU/Linux) need either libtermcap or libcurses
                   2256:             (libncurses). Installing the distributions
                   2257:             libncurses-dev package (or equivalent) should fix the
                   2258:             problem.</p>
                   2259: 
                   2260:             <p>pkgsrc supports both gcc (GNU Compiler Collection)
                   2261:             and icc (Intel C++ Compiler). gcc is the default. icc
                   2262:             8.0 and 8.1 on i386 have been tested.</p>
                   2263: 
                   2264:             <p>To bootstrap using icc, assuming the default icc
                   2265:             installation directory:</p>
                   2266:             <pre class="programlisting">
                   2267: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
                   2268:                 ac_cv___attribute__=yes ./bootstrap
                   2269: </pre>
                   2270: 
                   2271:             <div class="note" style=
                   2272:             "margin-left: 0.5in; margin-right: 0.5in;">
                   2273:               <h3 class="title">Note</h3>
                   2274: 
                   2275:               <p>icc 8.1 needs the `-i-static' argument instead of
                   2276:               -static-libcxa.</p>
                   2277:             </div>
                   2278: 
                   2279:             <p>icc supports __attribute__, but the GNU configure
                   2280:             test uses a nested function, which icc does not
                   2281:             support. #undef'ing __attribute__ has the unfortunate
                   2282:             side-effect of breaking many of the Linux header files,
                   2283:             which cannot be compiled properly without
                   2284:             __attribute__. The test must be overridden so that
                   2285:             __attribute__ is assumed supported by the compiler.</p>
                   2286: 
                   2287:             <p>After bootstrapping, you should set <code class=
                   2288:             "varname">PKGSRC_COMPILER</code> in <code class=
                   2289:             "filename">/etc/mk.conf</code>:</p>
                   2290:             <pre class="programlisting">
                   2291: PKGSRC_COMPILER=icc
                   2292: </pre>
                   2293: 
                   2294:             <p>The default installation directory for icc is
                   2295:             <code class="filename">/opt/intel_cc_80</code>, which
                   2296:             is also the pkgsrc default. If you have installed it
                   2297:             into a different directory, set <code class=
                   2298:             "varname">ICCBASE</code> in <code class=
                   2299:             "filename">/etc/mk.conf</code>:</p>
                   2300:             <pre class="programlisting">
                   2301: ICCBASE=/opt/icc
                   2302: </pre>
                   2303: 
                   2304:             <p>pkgsrc uses the static linking method of the runtime
                   2305:             libraries provided by icc, so binaries can be run on
                   2306:             other systems which do not have the shared libraries
                   2307:             installed.</p>
                   2308: 
                   2309:             <p>Libtool, however, extracts a list of libraries from
1.24      wiz      2310:             the <a href=
                   2311:             "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   2312:             <span class="citerefentry"><span class=
                   2313:             "refentrytitle">ld</span>(1)</span></a> command run
                   2314:             when linking a C++ shared library and records it,
                   2315:             throwing away the -Bstatic and -Bdynamic options
                   2316:             interspersed between the libraries. This means that
                   2317:             libtool-linked C++ shared libraries will have a runtime
                   2318:             dependency on the icc libraries until this is fixed in
                   2319:             libtool.</p>
1.22      tv       2320:           </div>
                   2321: 
                   2322:           <div class="sect2" lang="en" xml:lang="en">
                   2323:             <div class="titlepage">
                   2324:               <div>
                   2325:                 <div>
1.30      wiz      2326:                   <h3 class="title"><a name="openbsd" id=
                   2327:                   "openbsd"></a>3.2.6.&nbsp;OpenBSD</h3>
1.1       grant    2328:                 </div>
                   2329:               </div>
                   2330:             </div>
                   2331: 
                   2332:             <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
                   2333: 
                   2334:             <p>Care should be taken so that the tools that this kit
                   2335:             installs do not conflict with the OpenBSD userland
                   2336:             tools. There are several steps:</p>
                   2337: 
                   2338:             <div class="orderedlist">
                   2339:               <ol type="1">
                   2340:                 <li>
                   2341:                   <p>OpenBSD stores its ports pkg database in
1.14      xtraeme  2342:                   <code class="filename">/var/db/pkg</code>. It is
1.1       grant    2343:                   therefore recommended that you choose a different
1.14      xtraeme  2344:                   location (e.g. <code class=
                   2345:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2346:                   --pkgdbdir option to the bootstrap script.</p>
                   2347:                 </li>
                   2348: 
                   2349:                 <li>
                   2350:                   <p>If you do not intend to use the OpenBSD ports
                   2351:                   tools, it's probably a good idea to move them out
                   2352:                   of the way to avoid confusion, e.g.</p>
                   2353:                   <pre class="screen">
1.14      xtraeme  2354: <code class="prompt">#</code> <strong class=
                   2355: "userinput"><code>cd /usr/sbin</code></strong>
                   2356: <code class="prompt">#</code> <strong class=
                   2357: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2358: <code class="prompt">#</code> <strong class=
                   2359: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2360: <code class="prompt">#</code> <strong class=
                   2361: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2362: <code class="prompt">#</code> <strong class=
                   2363: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2364: </pre>
                   2365:                 </li>
                   2366: 
                   2367:                 <li>
1.14      xtraeme  2368:                   <p>An example <code class=
                   2369:                   "filename">/etc/mk.conf</code> file will be
                   2370:                   placed in <code class=
                   2371:                   "filename">/etc/mk.conf.example</code> file when
                   2372:                   you use the bootstrap script. OpenBSD's make
                   2373:                   program uses <code class=
                   2374:                   "filename">/etc/mk.conf</code> as well. You can
1.1       grant    2375:                   work around this by enclosing all the pkgsrc
                   2376:                   specific parts of the file with:</p>
                   2377:                   <pre class="programlisting">
                   2378: .ifdef BSD_PKG_MK
1.11      ben      2379: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
1.1       grant    2380: .else
                   2381: # OpenBSD stuff
                   2382: .endif
                   2383: </pre>
                   2384:                 </li>
                   2385:               </ol>
                   2386:             </div>
                   2387:           </div>
                   2388: 
                   2389:           <div class="sect2" lang="en" xml:lang="en">
                   2390:             <div class="titlepage">
                   2391:               <div>
                   2392:                 <div>
1.30      wiz      2393:                   <h3 class="title"><a name="solaris" id=
                   2394:                   "solaris"></a>3.2.7.&nbsp;Solaris</h3>
1.1       grant    2395:                 </div>
                   2396:               </div>
                   2397:             </div>
                   2398: 
                   2399:             <p>Solaris 2.6 through 9 are supported on both x86 and
                   2400:             sparc. You will need a working C compiler. Both gcc
                   2401:             2.95.3 and Sun WorkShop 5 have been tested.</p>
                   2402: 
                   2403:             <p>The following packages are required on Solaris 8 for
                   2404:             the bootstrap process and to build packages.</p>
                   2405: 
                   2406:             <div class="itemizedlist">
                   2407:               <ul type="disc">
                   2408:                 <li>
                   2409:                   <p>SUNWsprot</p>
                   2410:                 </li>
                   2411: 
                   2412:                 <li>
                   2413:                   <p>SUNWarc</p>
                   2414:                 </li>
                   2415: 
                   2416:                 <li>
                   2417:                   <p>SUNWbtool</p>
                   2418:                 </li>
                   2419: 
                   2420:                 <li>
                   2421:                   <p>SUNWtoo</p>
                   2422:                 </li>
                   2423: 
                   2424:                 <li>
                   2425:                   <p>SUNWlibm</p>
                   2426:                 </li>
                   2427:               </ul>
                   2428:             </div>
                   2429: 
                   2430:             <p>Please note the use of GNU binutils on Solaris is
                   2431:             <span class="emphasis"><em>not</em></span>
                   2432:             supported.</p>
                   2433: 
                   2434:             <div class="sect3" lang="en" xml:lang="en">
                   2435:               <div class="titlepage">
                   2436:                 <div>
                   2437:                   <div>
1.30      wiz      2438:                     <h4 class="title"><a name="solaris-gcc-note"
                   2439:                     id="solaris-gcc-note"></a>3.2.7.1.&nbsp;If you
                   2440:                     are using gcc</h4>
1.1       grant    2441:                   </div>
                   2442:                 </div>
                   2443:               </div>
                   2444: 
                   2445:               <p>It makes life much simpler if you only use the
                   2446:               same gcc consistently for building all packages.</p>
                   2447: 
                   2448:               <p>It is recommended that an external gcc be used
                   2449:               only for bootstrapping, then either build gcc from
                   2450:               <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2451:               href=
                   2452:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.20      ben      2453:               class="pkgname">lang/gcc</a> or install a binary gcc
                   2454:               package, then remove gcc used during
                   2455:               bootstrapping.</p>
1.1       grant    2456: 
                   2457:               <p>Binary packages of gcc can be found through
                   2458:               <a href=
                   2459:               "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20      ben      2460:               target=
                   2461:               "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1       grant    2462:             </div>
                   2463: 
                   2464:             <div class="sect3" lang="en" xml:lang="en">
                   2465:               <div class="titlepage">
                   2466:                 <div>
                   2467:                   <div>
1.30      wiz      2468:                     <h4 class="title"><a name=
                   2469:                     "solaris-sun-workshop-note" id=
                   2470:                     "solaris-sun-workshop-note"></a>3.2.7.2.&nbsp;If
                   2471:                     you are using Sun WorkShop</h4>
1.1       grant    2472:                   </div>
                   2473:                 </div>
                   2474:               </div>
                   2475: 
                   2476:               <p>You will need at least the following packages
                   2477:               installed (from WorkShop 5.0)</p>
                   2478: 
                   2479:               <div class="itemizedlist">
                   2480:                 <ul type="disc">
                   2481:                   <li>
                   2482:                     <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
                   2483:                   </li>
                   2484: 
                   2485:                   <li>
                   2486:                     <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
                   2487:                   </li>
                   2488: 
                   2489:                   <li>
                   2490:                     <p>SPROild - Sun WorkShop Incremental
                   2491:                     Linker</p>
                   2492:                   </li>
                   2493: 
                   2494:                   <li>
                   2495:                     <p>SPROlang - Sun WorkShop Compilers common
                   2496:                     components</p>
                   2497:                   </li>
                   2498:                 </ul>
                   2499:               </div>
                   2500: 
1.14      xtraeme  2501:               <p>You should set <code class="varname">CC</code>,
                   2502:               <code class="varname">CXX</code> and optionally,
                   2503:               <code class="varname">CPP</code> in <code class=
                   2504:               "filename">/etc/mk.conf</code>, eg.</p>
1.1       grant    2505:               <pre class="programlisting">
1.27      rillig   2506: CC=     cc
1.1       grant    2507: CXX=    CC
                   2508: CPP=    /usr/ccs/lib/cpp
                   2509: </pre>
                   2510: 
                   2511:               <p>You may also want to build 64-bit binaries,
                   2512:               eg.</p>
                   2513:               <pre class="programlisting">
                   2514: CFLAGS= -xtarget=ultra -xarch=v9
                   2515: </pre>
                   2516: 
                   2517:               <p>Whichever compiler you use, please ensure the
                   2518:               compiler tools and your $prefix are in your
1.14      xtraeme  2519:               <code class="varname">PATH</code>. This includes
                   2520:               <code class="filename">/usr/ccs/{bin,lib}</code> and
                   2521:               eg. <code class=
                   2522:               "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1       grant    2523:             </div>
                   2524:           </div>
                   2525:         </div>
                   2526:       </div>
                   2527: 
                   2528:       <div class="chapter" lang="en" xml:lang="en">
                   2529:         <div class="titlepage">
                   2530:           <div>
                   2531:             <div>
                   2532:               <h2 class="title"><a name="using" id=
                   2533:               "using"></a>Chapter&nbsp;4.&nbsp;Using pkgsrc</h2>
                   2534:             </div>
                   2535:           </div>
                   2536:         </div>
                   2537: 
                   2538:         <div class="toc">
                   2539:           <p><b>Table of Contents</b></p>
                   2540: 
                   2541:           <dl>
                   2542:             <dt><span class="sect1"><a href="#getting-started">4.1.
                   2543:             Working with binary packages</a></span></dt>
                   2544: 
                   2545:             <dd>
                   2546:               <dl>
1.30      wiz      2547:                 <dt><span class="sect2"><a href=
                   2548:                 "#where-to-get-binary-packages">4.1.1. Where to get
                   2549:                 binary packages</a></span></dt>
1.1       grant    2550: 
1.30      wiz      2551:                 <dt><span class="sect2"><a href=
                   2552:                 "#how-to-use-binary-packages">4.1.2. How to use
                   2553:                 binary packages</a></span></dt>
1.1       grant    2554: 
1.30      wiz      2555:                 <dt><span class="sect2"><a href=
                   2556:                 "#a-word-of-warning">4.1.3. A word of
                   2557:                 warning</a></span></dt>
1.1       grant    2558:               </dl>
                   2559:             </dd>
                   2560: 
1.30      wiz      2561:             <dt><span class="sect1"><a href=
                   2562:             "#building-packages-from-source">4.2. Building packages
                   2563:             from source</a></span></dt>
1.1       grant    2564: 
                   2565:             <dd>
                   2566:               <dl>
1.30      wiz      2567:                 <dt><span class="sect2"><a href=
                   2568:                 "#requirements">4.2.1. Requirements</a></span></dt>
1.1       grant    2569: 
1.30      wiz      2570:                 <dt><span class="sect2"><a href=
                   2571:                 "#fetching-distfiles">4.2.2. Fetching
                   2572:                 distfiles</a></span></dt>
1.1       grant    2573: 
1.30      wiz      2574:                 <dt><span class="sect2"><a href=
                   2575:                 "#how-to-build-and-install">4.2.3. How to build and
                   2576:                 install</a></span></dt>
1.1       grant    2577: 
1.30      wiz      2578:                 <dt><span class="sect2"><a href=
                   2579:                 "#selecting-the-compiler">4.2.4. Selecting the
                   2580:                 compiler</a></span></dt>
1.1       grant    2581:               </dl>
                   2582:             </dd>
                   2583:           </dl>
                   2584:         </div>
                   2585: 
                   2586:         <div class="sect1" lang="en" xml:lang="en">
                   2587:           <div class="titlepage">
                   2588:             <div>
                   2589:               <div>
                   2590:                 <h2 class="title" style="clear: both"><a name=
                   2591:                 "getting-started" id=
                   2592:                 "getting-started"></a>4.1.&nbsp;Working with binary
                   2593:                 packages</h2>
                   2594:               </div>
                   2595:             </div>
                   2596:           </div>
                   2597: 
                   2598:           <p>This section describes how to find, retrieve and
                   2599:           install a precompiled binary package that someone else
                   2600:           already prepared for your type of machine.</p>
                   2601: 
                   2602:           <div class="sect2" lang="en" xml:lang="en">
                   2603:             <div class="titlepage">
                   2604:               <div>
                   2605:                 <div>
1.30      wiz      2606:                   <h3 class="title"><a name=
                   2607:                   "where-to-get-binary-packages" id=
                   2608:                   "where-to-get-binary-packages"></a>4.1.1.&nbsp;Where
                   2609:                   to get binary packages</h3>
1.1       grant    2610:                 </div>
                   2611:               </div>
                   2612:             </div>
                   2613: 
                   2614:             <p>Precompiled packages are stored on ftp.NetBSD.org
1.14      xtraeme  2615:             and its mirrors in the directory <code class=
1.27      rillig   2616:             "filename">/pub/NetBSD/packages/&lt;OSVERSION&gt;/&lt;ARCH&gt;/</code>
                   2617:             for anonymous FTP access. <code class=
                   2618:             "varname">OSVERSION</code> is the NetBSD version
                   2619:             (<span><strong class="command">uname
                   2620:             -r</strong></span>), <code class="varname">ARCH</code>
                   2621:             is the architecture (<span><strong class=
                   2622:             "command">uname -p</strong></span>). In that directory,
                   2623:             there is a subdirectory for each category plus a
                   2624:             subdirectory <code class="filename">All</code> which
                   2625:             includes the actual binaries in <code class=
                   2626:             "filename">.tgz</code> files. The category
                   2627:             subdirectories use symbolic links to those files (this
                   2628:             is the same directory layout as in <code class=
1.14      xtraeme  2629:             "filename">/usr/pkgsrc/packages</code>).</p>
1.1       grant    2630: 
                   2631:             <p>This same directory layout applies for CDROM
                   2632:             distributions, only that the directory may be rooted
1.14      xtraeme  2633:             somewhere else, probably somewhere below <code class=
                   2634:             "filename">/cdrom</code>. Please consult your CDROMs
1.1       grant    2635:             documentation for the exact location.</p>
                   2636:           </div>
                   2637: 
                   2638:           <div class="sect2" lang="en" xml:lang="en">
                   2639:             <div class="titlepage">
                   2640:               <div>
                   2641:                 <div>
1.30      wiz      2642:                   <h3 class="title"><a name=
                   2643:                   "how-to-use-binary-packages" id=
                   2644:                   "how-to-use-binary-packages"></a>4.1.2.&nbsp;How
                   2645:                   to use binary packages</h3>
1.1       grant    2646:                 </div>
                   2647:               </div>
                   2648:             </div>
                   2649: 
                   2650:             <p>If you have the files on a CDROM or downloaded them
1.23      wiz      2651:             to your hard disk, you can install them with the
1.27      rillig   2652:             following command (be sure to <span><strong class=
1.14      xtraeme  2653:             "command">su</strong></span> to root first):</p>
1.1       grant    2654:             <pre class="screen">
1.14      xtraeme  2655: <code class="prompt">#</code> <strong class=
                   2656: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1       grant    2657: </pre>
                   2658: 
                   2659:             <p>If you have FTP access and you don't want to
                   2660:             download the packages via FTP prior to installation,
1.14      xtraeme  2661:             you can do this automatically by giving
                   2662:             <span><strong class="command">pkg_add</strong></span>
                   2663:             an FTP URL:</p>
1.1       grant    2664:             <pre class="screen">
1.14      xtraeme  2665: <code class="prompt">#</code> <strong class=
1.27      rillig   2666: "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    2667: </pre>
                   2668: 
1.27      rillig   2669:             <p>Note that any prerequisite packages needed to run
                   2670:             the package in question will be installed, too,
1.1       grant    2671:             assuming they are present where you install from.</p>
                   2672: 
1.23      wiz      2673:             <p>To save some typing, you can set the <code class=
                   2674:             "varname">PKG_PATH</code> environment variable to a
                   2675:             semicolon separated list of paths (including remote
                   2676:             URLs); trailing slashes are not allowed.</p>
                   2677: 
                   2678:             <p>Additionally to the <code class=
                   2679:             "filename">All</code> directory there exists a
                   2680:             <code class="filename">vulnerable</code> directory to
                   2681:             which binary packages with known vulnerabilities are
                   2682:             moved, since removing them could cause missing
                   2683:             dependencies. To use these packages, add the
                   2684:             <code class="filename">vulnerable</code> directory to
                   2685:             your <code class="varname">PKG_PATH</code>. However,
                   2686:             you should run <a xmlns=
                   2687:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   2688:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
                   2689:             class="pkgname">security/audit-packages</a> regularly,
                   2690:             and especially after installing new packages, and
                   2691:             verify that the vulnerabilities are acceptable for your
                   2692:             configuration. An example <code class=
                   2693:             "varname">PKG_PATH</code> would be: <code class=
1.27      rillig   2694:             "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      2695:             Please note that semicolon (';') is a shell
                   2696:             meta-character, so you'll probably have to quote
                   2697:             it.</p>
                   2698: 
1.1       grant    2699:             <p>After you've installed packages, be sure to have
1.27      rillig   2700:             <code class="filename">/usr/pkg/bin</code> and
                   2701:             <code class="filename">/usr/pkg/sbin</code> in your
1.14      xtraeme  2702:             <code class="varname">PATH</code> so you can actually
                   2703:             start the just installed program.</p>
1.1       grant    2704:           </div>
                   2705: 
                   2706:           <div class="sect2" lang="en" xml:lang="en">
                   2707:             <div class="titlepage">
                   2708:               <div>
                   2709:                 <div>
1.30      wiz      2710:                   <h3 class="title"><a name="a-word-of-warning" id=
                   2711:                   "a-word-of-warning"></a>4.1.3.&nbsp;A word of
1.1       grant    2712:                   warning</h3>
                   2713:                 </div>
                   2714:               </div>
                   2715:             </div>
                   2716: 
                   2717:             <p>Please pay very careful attention to the warnings
                   2718:             expressed in the <a href=
                   2719:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2720:             <span class="citerefentry"><span class=
                   2721:             "refentrytitle">pkg_add</span>(1)</span></a> manual
                   2722:             page about the inherent dangers of installing binary
                   2723:             packages which you did not create yourself, and the
                   2724:             security holes that can be introduced onto your system
                   2725:             by indiscriminate adding of such files.</p>
                   2726:           </div>
                   2727:         </div>
                   2728: 
                   2729:         <div class="sect1" lang="en" xml:lang="en">
                   2730:           <div class="titlepage">
                   2731:             <div>
                   2732:               <div>
                   2733:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      2734:                 "building-packages-from-source" id=
                   2735:                 "building-packages-from-source"></a>4.2.&nbsp;Building
1.1       grant    2736:                 packages from source</h2>
                   2737:               </div>
                   2738:             </div>
                   2739:           </div>
                   2740: 
                   2741:           <p>This assumes that the package is already in pkgsrc. If
                   2742:           it is not, see <a href="#developers-guide" title=
1.2       hubertf  2743:           "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">Part&nbsp;II,
1.27      rillig   2744:           &#8220;The pkgsrc developer's guide&#8221;</a> for
                   2745:           instructions how to create your own packages.</p>
1.1       grant    2746: 
                   2747:           <div class="sect2" lang="en" xml:lang="en">
                   2748:             <div class="titlepage">
                   2749:               <div>
                   2750:                 <div>
1.30      wiz      2751:                   <h3 class="title"><a name="requirements" id=
                   2752:                   "requirements"></a>4.2.1.&nbsp;Requirements</h3>
1.1       grant    2753:                 </div>
                   2754:               </div>
                   2755:             </div>
                   2756: 
                   2757:             <p>To build packages from source on a NetBSD system the
                   2758:             &#8220;<span class="quote">comp</span>&#8221; and the
                   2759:             &#8220;<span class="quote">text</span>&#8221;
                   2760:             distribution sets must be installed. If you want to
                   2761:             build X11 related packages the &#8220;<span class=
                   2762:             "quote">xbase</span>&#8221; and &#8220;<span class=
                   2763:             "quote">xcomp</span>&#8221; distribution sets are
                   2764:             required, too.</p>
                   2765:           </div>
                   2766: 
                   2767:           <div class="sect2" lang="en" xml:lang="en">
                   2768:             <div class="titlepage">
                   2769:               <div>
                   2770:                 <div>
1.30      wiz      2771:                   <h3 class="title"><a name="fetching-distfiles"
                   2772:                   id="fetching-distfiles"></a>4.2.2.&nbsp;Fetching
1.1       grant    2773:                   distfiles</h3>
                   2774:                 </div>
                   2775:               </div>
                   2776:             </div>
                   2777: 
1.27      rillig   2778:             <p>The first step for building a package is downloading
                   2779:             the distfiles (i.e. the unmodified source). If they
                   2780:             have not yet been downloaded, pkgsrc will fetch them
1.1       grant    2781:             automatically.</p>
                   2782: 
                   2783:             <p>You can overwrite some of the major distribution
                   2784:             sites to fit to sites that are close to your own. Have
1.14      xtraeme  2785:             a look at <code class=
                   2786:             "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27      rillig   2787:             some examples &#8212; in particular, look for the
1.14      xtraeme  2788:             <code class="varname">MASTER_SORT</code>, <code class=
                   2789:             "varname">MASTER_SORT_REGEX</code> and <code class=
                   2790:             "varname">INET_COUNTRY</code> definitions. This may
                   2791:             save some of your bandwidth and time.</p>
1.1       grant    2792: 
                   2793:             <p>You can change these settings either in your shell's
                   2794:             environment, or, if you want to keep the settings, by
1.14      xtraeme  2795:             editing the <code class="filename">/etc/mk.conf</code>
1.1       grant    2796:             file, and adding the definitions there.</p>
                   2797: 
                   2798:             <p>If you don't have a permanent Internet connection
                   2799:             and you want to know which files to download,
1.14      xtraeme  2800:             <span><strong class="command">make
                   2801:             fetch-list</strong></span> will tell you what you'll
                   2802:             need. Put these distfiles into <code class=
                   2803:             "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    2804:           </div>
                   2805: 
                   2806:           <div class="sect2" lang="en" xml:lang="en">
                   2807:             <div class="titlepage">
                   2808:               <div>
                   2809:                 <div>
1.30      wiz      2810:                   <h3 class="title"><a name=
                   2811:                   "how-to-build-and-install" id=
                   2812:                   "how-to-build-and-install"></a>4.2.3.&nbsp;How to
                   2813:                   build and install</h3>
1.1       grant    2814:                 </div>
                   2815:               </div>
                   2816:             </div>
                   2817: 
                   2818:             <p>Assuming that the distfile has been fetched (see
                   2819:             previous section), become root and change into the
1.14      xtraeme  2820:             relevant directory and running <span><strong class=
                   2821:             "command">make</strong></span>. For example, type</p>
1.1       grant    2822:             <pre class="screen">
1.14      xtraeme  2823: <code class="prompt">%</code> <strong class=
                   2824: "userinput"><code>cd misc/figlet</code></strong>
                   2825: <code class="prompt">%</code> <strong class=
                   2826: "userinput"><code>make</code></strong>
1.1       grant    2827: </pre>
                   2828: 
                   2829:             <p>at the shell prompt to build the various components
                   2830:             of the package, and</p>
                   2831:             <pre class="screen">
1.14      xtraeme  2832: <code class="prompt">#</code> <strong class=
                   2833: "userinput"><code>make install</code></strong>
1.1       grant    2834: </pre>
                   2835: 
                   2836:             <p>to install the various components into the correct
                   2837:             places on your system. Installing the package on your
                   2838:             system requires you to be root. However, pkgsrc has a
                   2839:             <span class="emphasis"><em>just-in-time-su</em></span>
                   2840:             feature, which allows you to only become root for the
                   2841:             actual installation step</p>
                   2842: 
                   2843:             <p>Taking the figlet utility as an example, we can
                   2844:             install it on our system by building as shown in
                   2845:             <a href="#logs" title=
                   2846:             "Appendix&nbsp;B.&nbsp;Build logs">Appendix B, <i>Build
                   2847:             logs</i></a>.</p>
                   2848: 
                   2849:             <p>The program is installed under the default root of
1.14      xtraeme  2850:             the packages tree - <code class=
                   2851:             "filename">/usr/pkg</code>. Should this not conform to
                   2852:             your tastes, set the <code class=
                   2853:             "varname">LOCALBASE</code> variable in your
1.1       grant    2854:             environment, and it will use that value as the root of
1.14      xtraeme  2855:             your packages tree. So, to use <code class=
                   2856:             "filename">/usr/local</code>, set <code class=
                   2857:             "varname">LOCALBASE=/usr/local</code> in your
1.1       grant    2858:             environment. Please note that you should use a
                   2859:             directory which is dedicated to packages and not shared
1.14      xtraeme  2860:             with other programs (ie, do not try and use
                   2861:             <code class="varname">LOCALBASE=/usr</code>). Also, you
                   2862:             should not try to add any of your own files or
                   2863:             directories (such as <code class=
                   2864:             "filename">src/</code>, <code class=
                   2865:             "filename">obj/</code>, or <code class=
                   2866:             "filename">pkgsrc/</code>) below the <code class=
                   2867:             "varname">LOCALBASE</code> tree. This is to prevent
1.1       grant    2868:             possible conflicts between programs and other files
                   2869:             installed by the package system and whatever else may
                   2870:             have been installed there.</p>
                   2871: 
1.14      xtraeme  2872:             <p>Some packages look in <code class=
                   2873:             "filename">/etc/mk.conf</code> to alter some
1.1       grant    2874:             configuration options at build time. Have a look at
1.14      xtraeme  2875:             <code class=
                   2876:             "filename">pkgsrc/mk/defaults/mk.conf</code> to get an
                   2877:             overview of what will be set there by default.
                   2878:             Environment variables such as <code class=
                   2879:             "varname">LOCALBASE</code> can be set in <code class=
                   2880:             "filename">/etc/mk.conf</code> to save having to
                   2881:             remember to set them each time you want to use
                   2882:             pkgsrc.</p>
1.1       grant    2883: 
                   2884:             <p>Occasionally, people want to &#8220;<span class=
                   2885:             "quote">look under the covers</span>&#8221; to see what
                   2886:             is going on when a package is building or being
                   2887:             installed. This may be for debugging purposes, or out
                   2888:             of simple curiosity. A number of utility values have
                   2889:             been added to help with this.</p>
                   2890: 
                   2891:             <div class="orderedlist">
                   2892:               <ol type="1">
                   2893:                 <li>
                   2894:                   <p>If you invoke the <a href=
                   2895:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2896:                   <span class="citerefentry"><span class=
                   2897:                   "refentrytitle">make</span>(1)</span></a> command
1.14      xtraeme  2898:                   with <code class=
                   2899:                   "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
                   2900:                   amount of information will be displayed. For
                   2901:                   example,</p>
1.1       grant    2902:                   <pre class="screen">
1.14      xtraeme  2903: <strong class=
                   2904: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1       grant    2905: </pre>
                   2906: 
                   2907:                   <p>will show all the commands that are invoked,
                   2908:                   up to and including the &#8220;<span class=
                   2909:                   "quote">patch</span>&#8221; stage.</p>
                   2910:                 </li>
                   2911: 
                   2912:                 <li>
                   2913:                   <p>If you want to know the value of a certain
1.22      tv       2914:                   <a href=
                   2915:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2916:                   <span class="citerefentry"><span class=
                   2917:                   "refentrytitle">make</span>(1)</span></a>
                   2918:                   definition, then the <code class=
1.14      xtraeme  2919:                   "varname">VARNAME</code> definition should be
                   2920:                   used, in conjunction with the show-var target.
                   2921:                   e.g. to show the expansion of the <a href=
1.1       grant    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>
1.14      xtraeme  2925:                   variable <code class=
1.22      tv       2926:                   "varname">LOCALBASE</code>:</p>
1.1       grant    2927:                   <pre class="screen">
1.14      xtraeme  2928: <code class="prompt">%</code> <strong class=
                   2929: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1       grant    2930: /usr/pkg
1.14      xtraeme  2931: <code class="prompt">%</code>
1.1       grant    2932:           
                   2933: </pre>
                   2934:                 </li>
                   2935:               </ol>
                   2936:             </div>
                   2937: 
                   2938:             <p>If you want to install a binary package that you've
                   2939:             either created yourself (see next section), that you
                   2940:             put into pkgsrc/packages manually or that is located on
1.8       wiz      2941:             a remote FTP server, you can use the "bin-install"
1.1       grant    2942:             target. This target will install a binary package - if
                   2943:             available - via <a href=
                   2944:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2945:             <span class="citerefentry"><span class=
                   2946:             "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14      xtraeme  2947:             <span><strong class="command">make
                   2948:             package</strong></span>. The list of remote FTP sites
                   2949:             searched is kept in the variable <code class=
                   2950:             "varname">BINPKG_SITES</code>, which defaults to
                   2951:             ftp.NetBSD.org. Any flags that should be added to
                   2952:             <a href=
1.1       grant    2953:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2954:             <span class="citerefentry"><span class=
                   2955:             "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14      xtraeme  2956:             into <code class="varname">BIN_INSTALL_FLAGS</code>.
                   2957:             See <code class=
                   2958:             "filename">pkgsrc/mk/defaults/mk.conf</code> for more
                   2959:             details.</p>
1.1       grant    2960: 
                   2961:             <p>A final word of warning: If you setup a system that
1.14      xtraeme  2962:             has a non-standard setting for <code class=
                   2963:             "varname">LOCALBASE</code>, be sure to set that before
1.1       grant    2964:             any packages are installed, as you can not use several
                   2965:             directories for the same purpose. Doing so will result
                   2966:             in pkgsrc not being able to properly detect your
                   2967:             installed packages, and fail miserably. Note also that
                   2968:             precompiled binary packages are usually built with the
1.14      xtraeme  2969:             default <code class="varname">LOCALBASE</code> of
                   2970:             <code class="filename">/usr/pkg</code>, and that you
                   2971:             should <span class="emphasis"><em>not</em></span>
                   2972:             install any if you use a non-standard <code class=
                   2973:             "varname">LOCALBASE</code>.</p>
1.1       grant    2974:           </div>
                   2975: 
                   2976:           <div class="sect2" lang="en" xml:lang="en">
                   2977:             <div class="titlepage">
                   2978:               <div>
                   2979:                 <div>
1.30      wiz      2980:                   <h3 class="title"><a name=
                   2981:                   "selecting-the-compiler" id=
                   2982:                   "selecting-the-compiler"></a>4.2.4.&nbsp;Selecting
                   2983:                   the compiler</h3>
1.1       grant    2984:                 </div>
                   2985:               </div>
                   2986:             </div>
                   2987: 
                   2988:             <p>By default, pkgsrc will use GCC to build packages.
                   2989:             This may be overridden by setting the following
                   2990:             variables in /etc/mk.conf:</p>
                   2991: 
                   2992:             <div class="variablelist">
                   2993:               <dl>
1.14      xtraeme  2994:                 <dt><span class="term"><code class=
                   2995:                 "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1       grant    2996: 
                   2997:                 <dd>
                   2998:                   <p>This is a list of values specifying the chain
                   2999:                   of compilers to invoke when building packages.
                   3000:                   Valid values are:</p>
                   3001: 
                   3002:                   <div class="itemizedlist">
                   3003:                     <ul type="disc">
                   3004:                       <li>
1.14      xtraeme  3005:                         <p><code class="varname">distcc</code>:
1.1       grant    3006:                         distributed C/C++ (chainable)</p>
                   3007:                       </li>
                   3008: 
                   3009:                       <li>
1.14      xtraeme  3010:                         <p><code class="varname">ccache</code>:
1.1       grant    3011:                         compiler cache (chainable)</p>
                   3012:                       </li>
                   3013: 
                   3014:                       <li>
1.14      xtraeme  3015:                         <p><code class="varname">gcc</code>: GNU
                   3016:                         C/C++ Compiler</p>
1.1       grant    3017:                       </li>
                   3018: 
                   3019:                       <li>
1.14      xtraeme  3020:                         <p><code class="varname">mipspro</code>:
1.1       grant    3021:                         Silicon Graphics, Inc. MIPSpro
                   3022:                         (n32/n64)</p>
                   3023:                       </li>
                   3024: 
                   3025:                       <li>
1.14      xtraeme  3026:                         <p><code class="varname">mipspro</code>:
1.1       grant    3027:                         Silicon Graphics, Inc. MIPSpro (o32)</p>
                   3028:                       </li>
                   3029: 
                   3030:                       <li>
1.14      xtraeme  3031:                         <p><code class="varname">sunpro</code>:
1.1       grant    3032:                         Microsystems, Inc. WorkShip/Forte/Sun ONE
                   3033:                         Studio</p>
                   3034:                       </li>
                   3035:                     </ul>
                   3036:                   </div>
                   3037: 
                   3038:                   <p>The default is &#8220;<span class=
1.14      xtraeme  3039:                   "quote"><code class=
                   3040:                   "varname">gcc</code></span>&#8221;. You can use
                   3041:                   <code class="varname">ccache</code> and/or
                   3042:                   <code class="varname">distcc</code> with an
                   3043:                   appropriate <code class=
                   3044:                   "varname">PKGSRC_COMPILER</code> setting, e.g.
                   3045:                   &#8220;<span class="quote"><code class=
                   3046:                   "varname">ccache gcc</code></span>&#8221;. This
1.1       grant    3047:                   variable should always be terminated with a value
                   3048:                   for a real compiler.</p>
                   3049:                 </dd>
                   3050: 
1.14      xtraeme  3051:                 <dt><span class="term"><code class=
                   3052:                 "varname">GCC_REQD</code>:</span></dt>
1.1       grant    3053: 
                   3054:                 <dd>
                   3055:                   <p>This specifies the minimum version of GCC to
                   3056:                   use when building packages. If the system GCC
                   3057:                   doesn't satisfy this requirement, then pkgsrc
                   3058:                   will build and install one of the GCC packages to
                   3059:                   use instead.</p>
                   3060:                 </dd>
                   3061:               </dl>
                   3062:             </div>
                   3063:           </div>
                   3064:         </div>
                   3065:       </div>
                   3066: 
                   3067:       <div class="chapter" lang="en" xml:lang="en">
                   3068:         <div class="titlepage">
                   3069:           <div>
                   3070:             <div>
                   3071:               <h2 class="title"><a name="binary" id=
                   3072:               "binary"></a>Chapter&nbsp;5.&nbsp;Creating binary
                   3073:               packages</h2>
                   3074:             </div>
                   3075:           </div>
                   3076:         </div>
                   3077: 
                   3078:         <div class="toc">
                   3079:           <p><b>Table of Contents</b></p>
                   3080: 
                   3081:           <dl>
1.30      wiz      3082:             <dt><span class="sect1"><a href=
                   3083:             "#building-a-single-binary-package">5.1. Building a
                   3084:             single binary package</a></span></dt>
1.1       grant    3085: 
1.30      wiz      3086:             <dt><span class="sect1"><a href=
                   3087:             "#settings-for-creationg-of-binary-packages">5.2.
1.1       grant    3088:             Settings for creation of binary
                   3089:             packages</a></span></dt>
                   3090: 
                   3091:             <dt><span class="sect1"><a href="#bulkbuild">5.3. Doing
                   3092:             a bulk build of all packages</a></span></dt>
                   3093: 
                   3094:             <dd>
                   3095:               <dl>
                   3096:                 <dt><span class="sect2"><a href=
                   3097:                 "#binary.configuration">5.3.1.
                   3098:                 Configuration</a></span></dt>
                   3099: 
1.30      wiz      3100:                 <dt><span class="sect2"><a href=
                   3101:                 "#other-environmental-considerations">5.3.2. Other
                   3102:                 environmental considerations</a></span></dt>
1.1       grant    3103: 
1.30      wiz      3104:                 <dt><span class="sect2"><a href="#operation">5.3.3.
1.1       grant    3105:                 Operation</a></span></dt>
                   3106: 
1.30      wiz      3107:                 <dt><span class="sect2"><a href=
                   3108:                 "#what-it-does">5.3.4. What it does</a></span></dt>
1.1       grant    3109: 
1.30      wiz      3110:                 <dt><span class="sect2"><a href=
                   3111:                 "#disk-space-requirements">5.3.5. Disk space
                   3112:                 requirements</a></span></dt>
1.1       grant    3113: 
1.30      wiz      3114:                 <dt><span class="sect2"><a href=
                   3115:                 "#setting-up-a-sandbox">5.3.6. Setting up a sandbox
                   3116:                 for chroot'ed builds</a></span></dt>
1.1       grant    3117: 
1.30      wiz      3118:                 <dt><span class="sect2"><a href=
                   3119:                 "#building-a-partial-set">5.3.7. Building a partial
                   3120:                 set of packages</a></span></dt>
1.13      hubertf  3121: 
                   3122:                 <dt><span class="sect2"><a href=
                   3123:                 "#bulk-upload">5.3.8. Uploading results of a bulk
                   3124:                 build</a></span></dt>
1.1       grant    3125:               </dl>
                   3126:             </dd>
                   3127: 
1.30      wiz      3128:             <dt><span class="sect1"><a href="#creating-cdroms">5.4.
1.1       grant    3129:             Creating a multiple CD-ROM packages
                   3130:             collection</a></span></dt>
                   3131: 
                   3132:             <dd>
                   3133:               <dl>
1.30      wiz      3134:                 <dt><span class="sect2"><a href=
                   3135:                 "#cdpack-example">5.4.1. Example of
                   3136:                 cdpack</a></span></dt>
1.1       grant    3137:               </dl>
                   3138:             </dd>
                   3139:           </dl>
                   3140:         </div>
                   3141: 
                   3142:         <div class="sect1" lang="en" xml:lang="en">
                   3143:           <div class="titlepage">
                   3144:             <div>
                   3145:               <div>
                   3146:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      3147:                 "building-a-single-binary-package" id=
                   3148:                 "building-a-single-binary-package"></a>5.1.&nbsp;Building
                   3149:                 a single binary package</h2>
1.1       grant    3150:               </div>
                   3151:             </div>
                   3152:           </div>
                   3153: 
                   3154:           <p>Once you have built and installed a package, you can
                   3155:           create a <span class="emphasis"><em>binary
                   3156:           package</em></span> which can be installed on another
                   3157:           system with <a href=
                   3158:           "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3159:           <span class="citerefentry"><span class=
                   3160:           "refentrytitle">pkg_add</span>(1)</span></a> This saves
                   3161:           having to build the same package on a group of hosts and
                   3162:           wasting CPU time. It also provides a simple means for
                   3163:           others to install your package, should you distribute
                   3164:           it.</p>
                   3165: 
                   3166:           <p>To create a binary package, change into the
1.14      xtraeme  3167:           appropriate directory in pkgsrc, and run
                   3168:           <span><strong class="command">make
                   3169:           package</strong></span>:</p>
1.1       grant    3170:           <pre class="screen">
1.14      xtraeme  3171: <code class="prompt">#</code> <strong class=
                   3172: "userinput"><code>cd misc/figlet</code></strong>
                   3173: <code class="prompt">#</code> <strong class=
                   3174: "userinput"><code>make package</code></strong>
1.1       grant    3175: </pre>
                   3176: 
                   3177:           <p>This will build and install your package (if not
                   3178:           already done), and then build a binary package from what
1.14      xtraeme  3179:           was installed. You can then use the <span><strong class=
                   3180:           "command">pkg_*</strong></span> tools to manipulate it.
                   3181:           Binary packages are created by default in <code class=
                   3182:           "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1       grant    3183:           gzipped tar file. See <a href="#logs.package" title=
                   3184:           "B.2.&nbsp;Packaging figlet">Section B.2,
                   3185:           &#8220;Packaging figlet&#8221;</a> for a continuation of
                   3186:           the above <a xmlns=
                   3187:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   3188:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.20      ben      3189:           class="pkgname">misc/figlet</a> example.</p>
1.1       grant    3190: 
                   3191:           <p>See <a href="#submit" title=
1.35      jmmv     3192:           "Chapter&nbsp;16.&nbsp;Submitting and Committing">Chapter
                   3193:           16, <i>Submitting and Committing</i></a> for information
1.1       grant    3194:           on how to submit such a binary package.</p>
                   3195:         </div>
                   3196: 
                   3197:         <div class="sect1" lang="en" xml:lang="en">
                   3198:           <div class="titlepage">
                   3199:             <div>
                   3200:               <div>
                   3201:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      3202:                 "settings-for-creationg-of-binary-packages" id=
                   3203:                 "settings-for-creationg-of-binary-packages"></a>5.2.&nbsp;Settings
1.1       grant    3204:                 for creation of binary packages</h2>
                   3205:               </div>
                   3206:             </div>
                   3207:           </div>
                   3208: 
                   3209:           <p>See <a href="#build.helpful-targets" title=
1.35      jmmv     3210:           "13.3.&nbsp;Other helpful targets">Section&nbsp;13.3,
1.1       grant    3211:           &#8220;Other helpful targets&#8221;</a>.</p>
                   3212:         </div>
                   3213: 
                   3214:         <div class="sect1" lang="en" xml:lang="en">
                   3215:           <div class="titlepage">
                   3216:             <div>
                   3217:               <div>
                   3218:                 <h2 class="title" style="clear: both"><a name=
                   3219:                 "bulkbuild" id="bulkbuild"></a>5.3.&nbsp;Doing a
                   3220:                 bulk build of all packages</h2>
                   3221:               </div>
                   3222:             </div>
                   3223:           </div>
                   3224: 
                   3225:           <p>If you want to get a full set of precompiled binary
                   3226:           packages, this section describes how to get them. Beware
                   3227:           that the bulk build will remove all currently installed
1.23      wiz      3228:           packages from your system! Having an FTP server
                   3229:           configured either on the machine doing the bulk builds or
                   3230:           on a nearby NFS server can help to make the packages
                   3231:           available to everyone. See <a href=
1.1       grant    3232:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
                   3233:           <span class="citerefentry"><span class=
                   3234:           "refentrytitle">ftpd</span>(8)</span></a> for more
                   3235:           information. If you use a remote NFS server's storage, be
                   3236:           sure to not actually compile on NFS storage, as this
                   3237:           slows things down a lot.</p>
                   3238: 
                   3239:           <div class="sect2" lang="en" xml:lang="en">
                   3240:             <div class="titlepage">
                   3241:               <div>
                   3242:                 <div>
                   3243:                   <h3 class="title"><a name="binary.configuration"
                   3244:                   id=
                   3245:                   "binary.configuration"></a>5.3.1.&nbsp;Configuration</h3>
                   3246:                 </div>
                   3247:               </div>
                   3248:             </div>
                   3249: 
                   3250:             <div class="sect3" lang="en" xml:lang="en">
                   3251:               <div class="titlepage">
                   3252:                 <div>
                   3253:                   <div>
                   3254:                     <h4 class="title"><a name="binary.mk.conf" id=
                   3255:                     "binary.mk.conf"></a>5.3.1.1.&nbsp;/etc/mk.conf</h4>
                   3256:                   </div>
                   3257:                 </div>
                   3258:               </div>
                   3259: 
1.23      wiz      3260:               <p>You may want to set variables in <code class=
1.14      xtraeme  3261:               "filename">/etc/mk.conf</code>. Look at <code class=
                   3262:               "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1       grant    3263:               details of the default settings. You will want to
1.14      xtraeme  3264:               ensure that <code class=
                   3265:               "varname">ACCEPTABLE_LICENSES</code> meet your local
                   3266:               policy. As used in this example, <code class=
                   3267:               "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1       grant    3268:               "emphasis"><em>all</em></span> licenses.</p>
                   3269:               <pre class="programlisting">
                   3270: PACKAGES?=      ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
                   3271: WRKOBJDIR?=     /usr/tmp/pkgsrc   # build here instead of in pkgsrc
                   3272: BSDSRCDIR=      /usr/src
                   3273: BSDXSRCDIR=     /usr/xsrc         # for x11/xservers
                   3274: OBJHOSTNAME?=   yes               # use work.`hostname`
                   3275: FAILOVER_FETCH= yes               # insist on the correct checksum
                   3276: PKG_DEVELOPER?= yes
                   3277: _ACCEPTABLE=    yes
                   3278: </pre>
                   3279:             </div>
                   3280: 
                   3281:             <div class="sect3" lang="en" xml:lang="en">
                   3282:               <div class="titlepage">
                   3283:                 <div>
                   3284:                   <div>
1.30      wiz      3285:                     <h4 class="title"><a name="build.conf" id=
                   3286:                     "build.conf"></a>5.3.1.2.&nbsp;<code class=
1.14      xtraeme  3287:                     "filename">build.conf</code></h4>
1.1       grant    3288:                   </div>
                   3289:                 </div>
                   3290:               </div>
                   3291: 
1.14      xtraeme  3292:               <p>In <code class="filename">pkgsrc/mk/bulk</code>,
                   3293:               copy <code class="filename">build.conf-example</code>
                   3294:               to <code class="filename">build.conf</code> and edit
                   3295:               it, following the comments in that file. This is the
1.1       grant    3296:               config file that determines where log files are
                   3297:               generated after the build, where to mail the build
1.23      wiz      3298:               report to, where your pkgsrc tree is located and the
                   3299:               user to which user to <a href=
1.1       grant    3300:               "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
                   3301:               <span class="citerefentry"><span class=
1.23      wiz      3302:               "refentrytitle">su</span>(8)</span></a> to do a
1.14      xtraeme  3303:               <span><strong class="command">cvs
                   3304:               update</strong></span>.</p>
1.1       grant    3305:             </div>
                   3306: 
                   3307:             <div class="sect3" lang="en" xml:lang="en">
                   3308:               <div class="titlepage">
                   3309:                 <div>
                   3310:                   <div>
1.30      wiz      3311:                     <h4 class="title"><a name="pre-build.local" id=
                   3312:                     "pre-build.local"></a>5.3.1.3.&nbsp;<code class="filename">
                   3313:                     pre-build.local</code></h4>
1.1       grant    3314:                   </div>
                   3315:                 </div>
                   3316:               </div>
                   3317: 
                   3318:               <p>It is possible to configure the bulk build to
                   3319:               perform certain site specific tasks at the end of the
1.14      xtraeme  3320:               pre-build stage. If the file <code class=
                   3321:               "filename">pre-build.local</code> exists in
1.23      wiz      3322:               <code class="filename">/usr/pkgsrc/mk/bulk</code>, it
1.24      wiz      3323:               will be executed (as a <a href=
                   3324:               "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
                   3325:               <span class="citerefentry"><span class=
                   3326:               "refentrytitle">sh</span>(1)</span></a> script) at
                   3327:               the end of the usual pre-build stage. An example use
                   3328:               of <code class="filename">pre-build.local</code> is
                   3329:               to have the line:</p>
1.1       grant    3330:               <pre class="screen">
1.14      xtraeme  3331: <code class="prompt">#</code> <strong class=
                   3332: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23      wiz      3333:     &gt; pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1       grant    3334: </pre>
                   3335: 
                   3336:               <p>to prevent the system from trying to build a
                   3337:               particular package which requires nearly 3 GB of disk
                   3338:               space.</p>
                   3339:             </div>
                   3340:           </div>
                   3341: 
                   3342:           <div class="sect2" lang="en" xml:lang="en">
                   3343:             <div class="titlepage">
                   3344:               <div>
                   3345:                 <div>
1.30      wiz      3346:                   <h3 class="title"><a name=
                   3347:                   "other-environmental-considerations" id=
                   3348:                   "other-environmental-considerations"></a>5.3.2.&nbsp;Other
                   3349:                   environmental considerations</h3>
1.1       grant    3350:                 </div>
                   3351:               </div>
                   3352:             </div>
                   3353: 
1.14      xtraeme  3354:             <p>As <code class="filename">/usr/pkg</code> will be
1.1       grant    3355:             completely deleted at the start of bulk builds, make
                   3356:             sure your login shell is placed somewhere else. Either
1.14      xtraeme  3357:             drop it into <code class=
                   3358:             "filename">/usr/local/bin</code> (and adjust your login
                   3359:             shell in the passwd file), or (re-)install it via
                   3360:             <a href=
1.1       grant    3361:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3362:             <span class="citerefentry"><span class=
                   3363:             "refentrytitle">pkg_add</span>(1)</span></a> from
1.14      xtraeme  3364:             <code class="filename">/etc/rc.local</code>, so you can
1.1       grant    3365:             login after a reboot (remember that your current
                   3366:             process won't die if the package is removed, you just
                   3367:             can't start any new instances of the shell any more).
                   3368:             Also, if you use NetBSD earlier than 1.5, or you still
                   3369:             want to use the pkgsrc version of ssh for some reason,
                   3370:             be sure to install ssh before starting it from
1.14      xtraeme  3371:             <code class="filename">rc.local</code>:</p>
1.1       grant    3372:             <pre class="programlisting">
                   3373: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
                   3374: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
                   3375:     /usr/pkg/etc/rc.d/sshd
                   3376: fi
                   3377: </pre>
                   3378: 
                   3379:             <p>Not doing so will result in you being not able to
                   3380:             log in via ssh after the bulk build is finished or if
                   3381:             the machine gets rebooted or crashes. You have been
                   3382:             warned! :)</p>
                   3383:           </div>
                   3384: 
                   3385:           <div class="sect2" lang="en" xml:lang="en">
                   3386:             <div class="titlepage">
                   3387:               <div>
                   3388:                 <div>
1.30      wiz      3389:                   <h3 class="title"><a name="operation" id=
                   3390:                   "operation"></a>5.3.3.&nbsp;Operation</h3>
1.1       grant    3391:                 </div>
                   3392:               </div>
                   3393:             </div>
                   3394: 
                   3395:             <p>Make sure you don't need any of the packages still
                   3396:             installed.</p>
                   3397: 
                   3398:             <div class="warning" style=
                   3399:             "margin-left: 0.5in; margin-right: 0.5in;">
                   3400:               <h3 class="title">Warning</h3>
                   3401: 
                   3402:               <p>During the bulk build, <span class=
                   3403:               "emphasis"><em>all packages will be
                   3404:               removed!</em></span></p>
                   3405:             </div>
                   3406: 
                   3407:             <p>Be sure to remove all other things that might
                   3408:             interfere with builds, like some libs installed in
1.14      xtraeme  3409:             <code class="filename">/usr/local</code>, etc. then
                   3410:             become root and type:</p>
1.1       grant    3411:             <pre class="screen">
1.14      xtraeme  3412: <code class="prompt">#</code> <strong class=
                   3413: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   3414: <code class="prompt">#</code> <strong class=
                   3415: "userinput"><code>sh mk/bulk/build</code></strong>
1.1       grant    3416: </pre>
                   3417: 
                   3418:             <p>If for some reason your last build didn't complete
                   3419:             (power failure, system panic, ...), you can continue it
                   3420:             by running:</p>
                   3421:             <pre class="screen">
1.14      xtraeme  3422: <code class="prompt">#</code> <strong class=
                   3423: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1       grant    3424: </pre>
                   3425: 
                   3426:             <p>At the end of the bulk build, you will get a summary
                   3427:             via mail, and find build logs in the directory
1.14      xtraeme  3428:             specified by <code class="varname">FTP</code> in the
                   3429:             <code class="filename">build.conf</code> file.</p>
1.1       grant    3430:           </div>
                   3431: 
                   3432:           <div class="sect2" lang="en" xml:lang="en">
                   3433:             <div class="titlepage">
                   3434:               <div>
                   3435:                 <div>
1.30      wiz      3436:                   <h3 class="title"><a name="what-it-does" id=
                   3437:                   "what-it-does"></a>5.3.4.&nbsp;What it does</h3>
1.1       grant    3438:                 </div>
                   3439:               </div>
                   3440:             </div>
                   3441: 
                   3442:             <p>The bulk builds consist of three steps:</p>
                   3443: 
                   3444:             <div class="variablelist">
                   3445:               <dl>
                   3446:                 <dt><span class="term">1. pre-build</span></dt>
                   3447: 
                   3448:                 <dd>
                   3449:                   <p>The script updates your pkgsrc tree via
                   3450:                   (anon)cvs, then cleans out any broken distfiles,
                   3451:                   and removes all packages installed.</p>
                   3452:                 </dd>
                   3453: 
                   3454:                 <dt><span class="term">2. the bulk
                   3455:                 build</span></dt>
                   3456: 
                   3457:                 <dd>
                   3458:                   <p>This is basically &#8220;<span class=
                   3459:                   "quote">make bulk-package</span>&#8221; with an
                   3460:                   optimised order in which packages will be built.
                   3461:                   Packages that don't require other packages will
                   3462:                   be built first, and packages with many
                   3463:                   dependencies will be built later.</p>
                   3464:                 </dd>
                   3465: 
                   3466:                 <dt><span class="term">3. post-build</span></dt>
                   3467: 
                   3468:                 <dd>
                   3469:                   <p>Generates a report that's placed in the
1.14      xtraeme  3470:                   directory specified in the <code class=
                   3471:                   "filename">build.conf</code> file named
                   3472:                   <code class="filename">broken.html</code>, a
                   3473:                   short version of that report will also be mailed
                   3474:                   to the build's admin.</p>
1.1       grant    3475:                 </dd>
                   3476:               </dl>
                   3477:             </div>
                   3478: 
                   3479:             <p>During the build, a list of broken packages will be
1.14      xtraeme  3480:             compiled in <code class=
                   3481:             "filename">/usr/pkgsrc/.broken</code> (or <code class=
                   3482:             "filename">.../.broken.${MACHINE}</code> if
                   3483:             <code class="varname">OBJMACHINE</code> is set),
                   3484:             individual build logs of broken builds can be found in
                   3485:             the package's directory. These files are used by the
                   3486:             bulk-targets to mark broken builds to not waste time
                   3487:             trying to rebuild them, and they can be used to debug
                   3488:             these broken package builds later.</p>
1.1       grant    3489:           </div>
                   3490: 
                   3491:           <div class="sect2" lang="en" xml:lang="en">
                   3492:             <div class="titlepage">
                   3493:               <div>
                   3494:                 <div>
1.30      wiz      3495:                   <h3 class="title"><a name=
                   3496:                   "disk-space-requirements" id=
                   3497:                   "disk-space-requirements"></a>5.3.5.&nbsp;Disk
                   3498:                   space requirements</h3>
1.1       grant    3499:                 </div>
                   3500:               </div>
                   3501:             </div>
                   3502: 
                   3503:             <p>Currently, roughly the following requirements are
                   3504:             valid for NetBSD 2.0/i386:</p>
                   3505: 
                   3506:             <div class="itemizedlist">
                   3507:               <ul type="disc">
                   3508:                 <li>
                   3509:                   <p>10 GB - distfiles (NFS ok)</p>
                   3510:                 </li>
                   3511: 
                   3512:                 <li>
                   3513:                   <p>8 GB - full set of all binaries (NFS ok)</p>
                   3514:                 </li>
                   3515: 
                   3516:                 <li>
                   3517:                   <p>5 GB - temp space for compiling (local disk
                   3518:                   recommended)</p>
                   3519:                 </li>
                   3520:               </ul>
                   3521:             </div>
                   3522: 
                   3523:             <p>Note that all pkgs will be de-installed as soon as
                   3524:             they are turned into a binary package, and that sources
                   3525:             are removed, so there is no excessively huge demand to
                   3526:             disk space. Afterwards, if the package is needed again,
                   3527:             it will be installed via <a href=
                   3528:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3529:             <span class="citerefentry"><span class=
                   3530:             "refentrytitle">pkg_add</span>(1)</span></a> instead of
                   3531:             building again, so there are no cycles wasted by
                   3532:             recompiling.</p>
                   3533:           </div>
                   3534: 
                   3535:           <div class="sect2" lang="en" xml:lang="en">
                   3536:             <div class="titlepage">
                   3537:               <div>
                   3538:                 <div>
1.30      wiz      3539:                   <h3 class="title"><a name="setting-up-a-sandbox"
                   3540:                   id="setting-up-a-sandbox"></a>5.3.6.&nbsp;Setting
                   3541:                   up a sandbox for chroot'ed builds</h3>
1.1       grant    3542:                 </div>
                   3543:               </div>
                   3544:             </div>
                   3545: 
1.12      agc      3546:             <p>If you don't want all the packages nuked from a
                   3547:             machine (rendering it useless for anything but pkg
1.23      wiz      3548:             compiling), there is the possibility of doing the
                   3549:             package bulk build inside a chroot environment.</p>
1.12      agc      3550: 
                   3551:             <p>The first step is to set up a chroot sandbox, e.g.
1.14      xtraeme  3552:             <code class="filename">/usr/sandbox</code>. This can be
1.12      agc      3553:             done by using null mounts, or manually.</p>
                   3554: 
1.14      xtraeme  3555:             <p>There is a shell script called <code class=
                   3556:             "filename">pkgsrc/mk/bulk/mksandbox</code> which will
                   3557:             set up the sandbox environment using null mounts. It
                   3558:             will also create a script called <code class=
                   3559:             "filename">sandbox</code> in the root of the sandbox
1.12      agc      3560:             environment, which will allow the null mounts to be
1.14      xtraeme  3561:             activated using the <span><strong class=
                   3562:             "command">sandbox mount</strong></span> command and
                   3563:             deactivated using the <span><strong class=
                   3564:             "command">sandbox umount</strong></span> command.</p>
1.12      agc      3565: 
                   3566:             <p>To set up a sandbox environment by hand, after
                   3567:             extracting all the sets from a NetBSD installation or
1.14      xtraeme  3568:             doing a <span><strong class="command">make distribution
                   3569:             DESTDIR=/usr/sandbox</strong></span> in <code class=
                   3570:             "filename">/usr/src/etc</code>, be sure the following
1.7       wiz      3571:             items are present and properly configured:</p>
1.1       grant    3572: 
                   3573:             <div class="procedure">
                   3574:               <ol type="1">
                   3575:                 <li>
                   3576:                   <p>Kernel</p>
                   3577:                   <pre class="screen">
1.14      xtraeme  3578: <code class="prompt">#</code> <strong class=
                   3579: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1       grant    3580: </pre>
                   3581:                 </li>
                   3582: 
                   3583:                 <li>
1.14      xtraeme  3584:                   <p><code class="filename">/dev/*</code></p>
1.1       grant    3585:                   <pre class="screen">
1.14      xtraeme  3586: <code class="prompt">#</code> <strong class=
                   3587: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1       grant    3588: </pre>
                   3589:                 </li>
                   3590: 
                   3591:                 <li>
1.14      xtraeme  3592:                   <p><code class="filename">/etc/resolv.conf</code>
1.1       grant    3593:                   (for <a xmlns=
                   3594:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3595:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.20      ben      3596:                   class="pkgname">security/smtpd</a> and mail):</p>
1.1       grant    3597:                   <pre class="screen">
1.14      xtraeme  3598: <code class="prompt">#</code> <strong class=
                   3599: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1       grant    3600: </pre>
                   3601:                 </li>
                   3602: 
                   3603:                 <li>
                   3604:                   <p>Working(!) mail config (hostname,
                   3605:                   sendmail.cf):</p>
                   3606:                   <pre class="screen">
1.14      xtraeme  3607: <code class="prompt">#</code> <strong class=
                   3608: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1       grant    3609: </pre>
                   3610:                 </li>
                   3611: 
                   3612:                 <li>
1.14      xtraeme  3613:                   <p><code class="filename">/etc/localtime</code>
                   3614:                   (for <a xmlns=
1.1       grant    3615:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3616:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.20      ben      3617:                   class="pkgname">security/smtpd</a>):</p>
1.1       grant    3618:                   <pre class="screen">
1.14      xtraeme  3619: <code class="prompt">#</code> <strong class=
                   3620: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1       grant    3621: </pre>
                   3622:                 </li>
                   3623: 
                   3624:                 <li>
1.14      xtraeme  3625:                   <p><code class="filename">/usr/src</code> (system
1.1       grant    3626:                   sources, for <a xmlns=
                   3627:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3628:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.20      ben      3629:                   class="pkgname">sysutils/aperture</a>, <a xmlns=
                   3630:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3631:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
                   3632:                   class="pkgname">net/ppp-mppe</a>):</p>
1.1       grant    3633:                   <pre class="screen">
1.14      xtraeme  3634: <code class="prompt">#</code> <strong class=
                   3635: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
                   3636: <code class="prompt">#</code> <strong class=
1.23      wiz      3637: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1       grant    3638: </pre>
                   3639:                 </li>
                   3640: 
                   3641:                 <li>
1.14      xtraeme  3642:                   <p>Create <code class=
                   3643:                   "filename">/var/db/pkg</code> (not part of
                   3644:                   default install):</p>
1.1       grant    3645:                   <pre class="screen">
1.14      xtraeme  3646: <code class="prompt">#</code> <strong class=
                   3647: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1       grant    3648: </pre>
                   3649:                 </li>
                   3650: 
                   3651:                 <li>
1.14      xtraeme  3652:                   <p>Create <code class="filename">/usr/pkg</code>
                   3653:                   (not part of default install):</p>
1.1       grant    3654:                   <pre class="screen">
1.14      xtraeme  3655: <code class="prompt">#</code> <strong class=
                   3656: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1       grant    3657: </pre>
                   3658:                 </li>
                   3659: 
                   3660:                 <li>
1.14      xtraeme  3661:                   <p>Checkout pkgsrc via cvs into <code class=
                   3662:                   "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1       grant    3663:                   <pre class="screen">
1.14      xtraeme  3664: <code class="prompt">#</code> <strong class=
                   3665: "userinput"><code>cd /usr/sandbox/usr</code></strong>
                   3666: <code class="prompt">#</code> <strong class=
                   3667: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1       grant    3668: </pre>
                   3669: 
                   3670:                   <p>Do not mount/link this to the copy of your
                   3671:                   pkgsrc tree you do development in, as this will
                   3672:                   likely cause problems!</p>
                   3673:                 </li>
                   3674: 
                   3675:                 <li>
1.14      xtraeme  3676:                   <p>Make <code class=
                   3677:                   "filename">/usr/sandbox/usr/pkgsrc/packages</code>
                   3678:                   and <code class="filename">.../distfiles</code>
                   3679:                   point somewhere appropriate. NFS- and/or
                   3680:                   nullfs-mounts may come in handy!</p>
1.1       grant    3681:                 </li>
                   3682: 
                   3683:                 <li>
1.14      xtraeme  3684:                   <p>Edit <code class=
                   3685:                   "filename">/etc/mk.conf</code>, see <a href=
                   3686:                   "#binary.mk.conf" title=
1.1       grant    3687:                   "5.3.1.1.&nbsp;/etc/mk.conf">Section&nbsp;5.3.1.1,
                   3688:                   &#8220;/etc/mk.conf&#8221;</a>.</p>
                   3689:                 </li>
                   3690: 
                   3691:                 <li>
1.14      xtraeme  3692:                   <p>Adjust <code class=
                   3693:                   "filename">mk/bulk/build.conf</code> to suit your
1.1       grant    3694:                   needs.</p>
                   3695:                 </li>
                   3696: 
                   3697:                 <li>
1.14      xtraeme  3698:                   <p>If you have set <code class=
                   3699:                   "varname">CVS_USER</code> in <code class=
                   3700:                   "filename">build.conf</code>, make sure that
                   3701:                   account exists and can do a <span><strong class=
                   3702:                   "command">cvs ${CVS_FLAGS} update</strong></span>
1.1       grant    3703:                   properly!</p>
                   3704:                 </li>
                   3705:               </ol>
                   3706:             </div>
                   3707: 
                   3708:             <p>When the chroot sandbox is setup, you can start the
                   3709:             build with the following steps:</p>
                   3710:             <pre class="screen">
1.14      xtraeme  3711: <code class="prompt">#</code> <strong class=
                   3712: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
                   3713: <code class="prompt">#</code> <strong class=
                   3714: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1       grant    3715: </pre>
                   3716: 
                   3717:             <p>This will just jump inside the sandbox and start
                   3718:             building. At the end of the build, mail will be sent
                   3719:             with the results of the build. Created binary pkgs will
1.14      xtraeme  3720:             be in <code class=
                   3721:             "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1       grant    3722:             (wherever that points/mounts to/from).</p>
                   3723:           </div>
                   3724: 
                   3725:           <div class="sect2" lang="en" xml:lang="en">
                   3726:             <div class="titlepage">
                   3727:               <div>
                   3728:                 <div>
1.30      wiz      3729:                   <h3 class="title"><a name=
                   3730:                   "building-a-partial-set" id=
                   3731:                   "building-a-partial-set"></a>5.3.7.&nbsp;Building
                   3732:                   a partial set of packages</h3>
1.1       grant    3733:                 </div>
                   3734:               </div>
                   3735:             </div>
                   3736: 
                   3737:             <p>In addition to building a complete set of all
1.14      xtraeme  3738:             packages in pkgsrc, the <code class=
                   3739:             "filename">pkgsrc/mk/bulk/build</code> script may be
                   3740:             used to build a subset of the packages contained in
                   3741:             pkgsrc. By setting defining <code class=
                   3742:             "varname">SPECIFIC_PKGS</code> in <code class=
                   3743:             "filename">/etc/mk.conf</code>, the variables</p>
1.1       grant    3744: 
                   3745:             <div class="itemizedlist">
                   3746:               <ul type="disc">
                   3747:                 <li>
                   3748:                   <p>SITE_SPECIFIC_PKGS</p>
                   3749:                 </li>
                   3750: 
                   3751:                 <li>
                   3752:                   <p>HOST_SPECIFIC_PKGS</p>
                   3753:                 </li>
                   3754: 
                   3755:                 <li>
                   3756:                   <p>GROUP_SPECIFIC_PKGS</p>
                   3757:                 </li>
                   3758: 
                   3759:                 <li>
                   3760:                   <p>USER_SPECIFIC_PKGS</p>
                   3761:                 </li>
                   3762:               </ul>
                   3763:             </div>
                   3764: 
                   3765:             <p>will define the set of packages which should be
                   3766:             built. The bulk build code will also include any
                   3767:             packages which are needed as dependencies for the
                   3768:             explicitly listed packages.</p>
                   3769: 
                   3770:             <p>One use of this is to do a bulk build with
1.14      xtraeme  3771:             <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1       grant    3772:             sandbox periodically to have a complete set of the
                   3773:             binary packages needed for your site available without
                   3774:             the overhead of building extra packages that are not
                   3775:             needed.</p>
                   3776:           </div>
1.13      hubertf  3777: 
                   3778:           <div class="sect2" lang="en" xml:lang="en">
                   3779:             <div class="titlepage">
                   3780:               <div>
                   3781:                 <div>
                   3782:                   <h3 class="title"><a name="bulk-upload" id=
                   3783:                   "bulk-upload"></a>5.3.8.&nbsp;Uploading results
                   3784:                   of a bulk build</h3>
                   3785:                 </div>
                   3786:               </div>
                   3787:             </div>
                   3788: 
                   3789:             <p>This section describes how pkgsrc developers can
                   3790:             upload binary pkgs built by bulk builds to
                   3791:             ftp.NetBSD.org.</p>
                   3792: 
1.17      sketch   3793:             <p>If you would like to automatically create checksum
                   3794:             files for the binary packages you intend to upload,
                   3795:             remember to set <code class="varname">MKSUMS=yes</code>
                   3796:             in your <code class=
                   3797:             "filename">mk/bulk/build.conf</code>.</p>
                   3798: 
                   3799:             <p>If you would like to PGP sign the checksum files
                   3800:             (highly recommended!), remember to set <code class=
                   3801:             "varname">SIGN_AS=username@NetBSD.org</code> in your
                   3802:             <code class="filename">mk/bulk/build.conf</code>. This
1.23      wiz      3803:             will prompt you for your GPG password to sign the files
1.17      sketch   3804:             before uploading everything.</p>
                   3805: 
                   3806:             <p>Then, make sure that you have <code class=
1.14      xtraeme  3807:             "varname">RSYNC_DST</code> set properly in your
                   3808:             <code class="filename">mk/bulk/build.conf</code> file,
                   3809:             i.e. adjust it to something like one of the
                   3810:             following:</p>
1.13      hubertf  3811:             <pre class="screen">
                   3812: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   3813: </pre>
                   3814: 
1.23      wiz      3815:             <p>Please use appropviate values for "pkgsrc-200xQy",
1.13      hubertf  3816:             "NetBSD-a.b.c" and "arch" here. If your login on
1.14      xtraeme  3817:             ftp.NetBSD.org is different from <code class=
                   3818:             "varname">CVS_USER</code>, write your login directly
                   3819:             into the variable, e.g. my local account is "feyrer",
                   3820:             but for my login "hubertf", I use:</p>
1.13      hubertf  3821:             <pre class="screen">
                   3822: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   3823: </pre>
                   3824: 
1.14      xtraeme  3825:             <p>A separate <code class="filename">upload</code>
1.13      hubertf  3826:             directory is used here to allow "closing" the directory
                   3827:             during upload. To do so, run the following command on
                   3828:             ftp.NetBSD.org next:</p>
                   3829:             <pre class="screen">
1.14      xtraeme  3830: nbftp% <strong class=
                   3831: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13      hubertf  3832: </pre>
                   3833: 
1.14      xtraeme  3834:             <p>Please note that <code class=
                   3835:             "filename">/pub/NetBSD/packages</code> is only
1.13      hubertf  3836:             appropriate for packages for the NetBSD operating
                   3837:             system. Binary packages for other operating systems
1.14      xtraeme  3838:             should go into <code class=
                   3839:             "filename">/pub/pkgsrc</code>.</p>
1.13      hubertf  3840: 
                   3841:             <p>Before uploading the binary pkgs, ssh authentication
1.23      wiz      3842:             needs to be set up. This example shows how to setup
1.13      hubertf  3843:             temporary keys for the root account <span class=
                   3844:             "emphasis"><em>inside the sandbox</em></span> (assuming
                   3845:             that no keys should be present there usually):</p>
                   3846:             <pre class="screen">
1.14      xtraeme  3847: <code class="prompt">#</code> <strong class=
                   3848: "userinput"><code>chroot /usr/sandbox</code></strong>        
                   3849: chroot-<code class="prompt">#</code> <strong class=
                   3850: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>        
                   3851: chroot-<code class="prompt">#</code> <strong class=
                   3852: "userinput"><code>ssh-keygen -t dsa</code></strong>        
                   3853: chroot-<code class="prompt">#</code> <strong class=
                   3854: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong> 
1.13      hubertf  3855: </pre>
                   3856: 
1.14      xtraeme  3857:             <p>Now take the output of <code class=
                   3858:             "filename">id-dsa.pub</code> and append it to your
                   3859:             <code class="filename">~/.ssh/authorized_keys</code>
1.17      sketch   3860:             file on ftp.NetBSD.org. You can remove the key after
1.14      xtraeme  3861:             the upload is done!</p>
1.13      hubertf  3862: 
                   3863:             <p>Next, test if your ssh connection really works:</p>
                   3864:             <pre class="screen">
1.14      xtraeme  3865: chroot-<code class="prompt">#</code> <strong class=
                   3866: "userinput"><code>ssh ftp.NetBSD.org date</code></strong> 
1.13      hubertf  3867: </pre>
                   3868: 
                   3869:             <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
                   3870: 
                   3871:             <p>Now after all this works, you can exit the sandbox
                   3872:             and start the upload:</p>
                   3873:             <pre class="screen">
1.14      xtraeme  3874: chroot-<code class="prompt">#</code> <strong class=
                   3875: "userinput"><code>exit</code></strong>        
                   3876: <code class="prompt">#</code> <strong class=
                   3877: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>        
                   3878: <code class="prompt">#</code> <strong class=
                   3879: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong> 
1.13      hubertf  3880: </pre>
                   3881: 
                   3882:             <p>The upload process may take quite some time. Use
1.24      wiz      3883:             <a href=
                   3884:             "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
                   3885:             <span class="citerefentry"><span class=
                   3886:             "refentrytitle">ls</span>(1)</span></a> or <a href=
                   3887:             "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
                   3888:             <span class="citerefentry"><span class=
                   3889:             "refentrytitle">du</span>(1)</span></a> on the FTP
                   3890:             server to monitor progress of the upload. The upload
                   3891:             script will take care of not uploading restricted
                   3892:             packages and putting vulnerable packages into the
                   3893:             <code class="filename">vulnerable</code>
                   3894:             subdirectory.</p>
1.13      hubertf  3895: 
                   3896:             <p>After the upload has ended, first thing is to revoke
                   3897:             ssh access:</p>
                   3898:             <pre class="screen">
1.14      xtraeme  3899: nbftp% <strong class=
                   3900: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13      hubertf  3901: Gdd:x! 
                   3902: </pre>
                   3903: 
                   3904:             <p>Use whatever is needed to remove the key you've
                   3905:             entered before! Last, move the uploaded packages out of
1.14      xtraeme  3906:             the <code class="filename">upload</code> directory to
                   3907:             have them accessible to everyone:</p>
1.13      hubertf  3908:             <pre class="screen">
1.14      xtraeme  3909: nbftp% <strong class=
                   3910: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
                   3911: nbftp% <strong class=
                   3912: "userinput"><code>mv upload/* .</code></strong>
                   3913: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
                   3914: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong> 
1.13      hubertf  3915: </pre>
                   3916:           </div>
1.1       grant    3917:         </div>
                   3918: 
                   3919:         <div class="sect1" lang="en" xml:lang="en">
                   3920:           <div class="titlepage">
                   3921:             <div>
                   3922:               <div>
                   3923:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      3924:                 "creating-cdroms" id=
                   3925:                 "creating-cdroms"></a>5.4.&nbsp;Creating a multiple
                   3926:                 CD-ROM packages collection</h2>
1.1       grant    3927:               </div>
                   3928:             </div>
                   3929:           </div>
                   3930: 
                   3931:           <p>After your pkgsrc bulk-build has completed, you may
                   3932:           wish to create a CD-ROM set of the resulting binary
                   3933:           packages to assist in installing packages on other
                   3934:           machines. The <a xmlns=
                   3935:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   3936:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.20      ben      3937:           class="pkgname">pkgtools/cdpack</a> package provides a
                   3938:           simple tool for creating the ISO 9660 images.
                   3939:           <span><strong class="command">cdpack</strong></span>
                   3940:           arranges the packages on the CD-ROMs in a way that keeps
                   3941:           all the dependencies for given package on the same CD as
                   3942:           that package.</p>
1.1       grant    3943: 
                   3944:           <div class="sect2" lang="en" xml:lang="en">
                   3945:             <div class="titlepage">
                   3946:               <div>
                   3947:                 <div>
1.30      wiz      3948:                   <h3 class="title"><a name="cdpack-example" id=
                   3949:                   "cdpack-example"></a>5.4.1.&nbsp;Example of
1.1       grant    3950:                   cdpack</h3>
                   3951:                 </div>
                   3952:               </div>
                   3953:             </div>
                   3954: 
                   3955:             <p>Complete documentation for cdpack is found in the
                   3956:             cdpack(1) manpage. The following short example assumes
1.14      xtraeme  3957:             that the binary packages are left in <code class=
                   3958:             "filename">/usr/pkgsrc/packages/All</code> and that
                   3959:             sufficient disk space exists in <code class=
                   3960:             "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1       grant    3961:             <pre class="screen">
1.14      xtraeme  3962: <code class="prompt">#</code> <strong class=
                   3963: "userinput"><code>mkdir /u2/images</code></strong>
                   3964: <code class="prompt">#</code> <strong class=
                   3965: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
                   3966: <code class="prompt">#</code> <strong class=
                   3967: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    3968: </pre>
                   3969: 
                   3970:             <p>If you wish to include a common set of files
1.14      xtraeme  3971:             (<code class="filename">COPYRIGHT</code>, <code class=
                   3972:             "filename">README</code>, etc.) on each CD in the
1.1       grant    3973:             collection, then you need to create a directory which
                   3974:             contains these files. e.g.</p>
                   3975:             <pre class="screen">
1.14      xtraeme  3976: <code class="prompt">#</code> <strong class=
                   3977: "userinput"><code>mkdir /tmp/common</code></strong>
                   3978: <code class="prompt">#</code> <strong class=
                   3979: "userinput"><code>echo "This is a README" &gt; /tmp/common/README</code></strong>
                   3980: <code class="prompt">#</code> <strong class=
                   3981: "userinput"><code>echo "Another file" &gt; /tmp/common/COPYING</code></strong>
                   3982: <code class="prompt">#</code> <strong class=
                   3983: "userinput"><code>mkdir /tmp/common/bin</code></strong>
                   3984: <code class="prompt">#</code> <strong class=
                   3985: "userinput"><code>echo "#!/bin/sh" &gt; /tmp/common/bin/myscript</code></strong>
                   3986: <code class="prompt">#</code> <strong class=
                   3987: "userinput"><code>echo "echo Hello world" &gt;&gt; /tmp/common/bin/myscript</code></strong>
                   3988: <code class="prompt">#</code> <strong class=
                   3989: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1       grant    3990: </pre>
                   3991: 
                   3992:             <p>Now create the images:</p>
                   3993:             <pre class="screen">
1.14      xtraeme  3994: <code class="prompt">#</code> <strong class=
                   3995: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    3996: </pre>
                   3997: 
1.14      xtraeme  3998:             <p>Each image will contain <code class=
                   3999:             "filename">README</code>, <code class=
                   4000:             "filename">COPYING</code>, and <code class=
                   4001:             "filename">bin/myscript</code> in their root
1.1       grant    4002:             directories.</p>
                   4003:           </div>
                   4004:         </div>
                   4005:       </div>
                   4006: 
                   4007:       <div class="chapter" lang="en" xml:lang="en">
                   4008:         <div class="titlepage">
                   4009:           <div>
                   4010:             <div>
                   4011:               <h2 class="title"><a name="faq" id=
                   4012:               "faq"></a>Chapter&nbsp;6.&nbsp;Frequently Asked
                   4013:               Questions</h2>
                   4014:             </div>
                   4015:           </div>
                   4016:         </div>
                   4017: 
                   4018:         <div class="toc">
                   4019:           <p><b>Table of Contents</b></p>
                   4020: 
                   4021:           <dl>
1.30      wiz      4022:             <dt><span class="sect1"><a href=
                   4023:             "#mailing-list-pointers">6.1. Are there any mailing
                   4024:             lists for pkg-related discussion?</a></span></dt>
1.1       grant    4025: 
1.30      wiz      4026:             <dt><span class="sect1"><a href="#pkgviews-docs">6.2.
1.1       grant    4027:             Where's the pkgviews documentation?</a></span></dt>
                   4028: 
1.5       hubertf  4029:             <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1       grant    4030:             Utilities for package management
                   4031:             (pkgtools)</a></span></dt>
                   4032: 
1.30      wiz      4033:             <dt><span class="sect1"><a href="#non-root-pkgsrc">6.4.
                   4034:             How to use pkgsrc as non-root</a></span></dt>
1.1       grant    4035: 
1.30      wiz      4036:             <dt><span class="sect1"><a href=
                   4037:             "#resume-transfers">6.5. How to resume transfers when
                   4038:             fetching distfiles?</a></span></dt>
1.14      xtraeme  4039: 
1.30      wiz      4040:             <dt><span class="sect1"><a href=
                   4041:             "#XFree86-from-pkgsrc">6.6. How can I install/use
                   4042:             XFree86 from pkgsrc?</a></span></dt>
1.1       grant    4043: 
1.30      wiz      4044:             <dt><span class="sect1"><a href=
                   4045:             "#x.org-from-pkgsrc">6.7. How can I install/use X.org
                   4046:             from pkgsrc?</a></span></dt>
1.1       grant    4047: 
1.30      wiz      4048:             <dt><span class="sect1"><a href=
                   4049:             "#fetch-behind-firewall">6.8. How to fetch files from
                   4050:             behind a firewall</a></span></dt>
1.1       grant    4051: 
1.30      wiz      4052:             <dt><span class="sect1"><a href="#passive-ftp">6.9. How
1.14      xtraeme  4053:             do I tell <span><strong class="command">make
                   4054:             fetch</strong></span> to do passive
                   4055:             FTP?</a></span></dt>
1.1       grant    4056: 
1.30      wiz      4057:             <dt><span class="sect1"><a href=
                   4058:             "#fetching-all-distfiles">6.10. How to fetch all
                   4059:             distfiles at once</a></span></dt>
1.1       grant    4060: 
1.30      wiz      4061:             <dt><span class="sect1"><a href=
                   4062:             "#tmac.andoc-missing">6.11. What does
                   4063:             &#8220;<span class="quote">Don't know how to make
1.14      xtraeme  4064:             /usr/share/tmac/tmac.andoc</span>&#8221;
1.1       grant    4065:             mean?</a></span></dt>
                   4066: 
1.30      wiz      4067:             <dt><span class="sect1"><a href=
                   4068:             "#bsd.own.mk-missing">6.12. What does
                   4069:             &#8220;<span class="quote">Could not find
1.14      xtraeme  4070:             bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    4071: 
1.30      wiz      4072:             <dt><span class="sect1"><a href=
                   4073:             "#using-sudo-with-pkgsrc">6.13. Using 'sudo' with
                   4074:             pkgsrc</a></span></dt>
1.1       grant    4075: 
1.35      jmmv     4076:             <dt><span class="sect1"><a href="#faq.conf">6.14. How
                   4077:             do I change the location of configuration
                   4078:             files?</a></span></dt>
1.1       grant    4079: 
1.14      xtraeme  4080:             <dt><span class="sect1"><a href="#audit-packages">6.15.
1.1       grant    4081:             Automated security checks</a></span></dt>
                   4082:           </dl>
                   4083:         </div>
                   4084: 
                   4085:         <p>This section contains hints, tips &amp; tricks on
                   4086:         special things in pkgsrc that we didn't find a better place
                   4087:         for in the previous chapters, and it contains items for
                   4088:         both pkgsrc users and developers.</p>
                   4089: 
                   4090:         <div class="sect1" lang="en" xml:lang="en">
                   4091:           <div class="titlepage">
                   4092:             <div>
                   4093:               <div>
                   4094:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4095:                 "mailing-list-pointers" id=
                   4096:                 "mailing-list-pointers"></a>6.1.&nbsp;Are there any
                   4097:                 mailing lists for pkg-related discussion?</h2>
1.1       grant    4098:               </div>
                   4099:             </div>
                   4100:           </div>
                   4101: 
1.18      xtraeme  4102:           <p>The following mailing lists may be of interest to
                   4103:           pkgsrc users:</p>
                   4104: 
                   4105:           <div class="itemizedlist">
                   4106:             <ul type="disc">
                   4107:               <li>
                   4108:                 <p><a href=
                   4109:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.34      wiz      4110:                 target="_top">pkgsrc-bugs</a>: A list where problem
                   4111:                 reports related to pkgsrc are sent and
                   4112:                 discussed.</p>
1.18      xtraeme  4113:               </li>
                   4114: 
                   4115:               <li>
                   4116:                 <p><a href=
                   4117:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34      wiz      4118:                 target="_top">pkgsrc-bulk</a>: A list where the
1.20      ben      4119:                 results of pkgsrc bulk builds are sent and
1.34      wiz      4120:                 discussed.</p>
1.18      xtraeme  4121:               </li>
                   4122: 
                   4123:               <li>
                   4124:                 <p><a href=
                   4125:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.34      wiz      4126:                 target="_top">pkgsrc-changes</a>: A list where all
                   4127:                 commit messages to pkgsrc are sent.</p>
1.18      xtraeme  4128:               </li>
                   4129: 
                   4130:               <li>
                   4131:                 <p><a href=
                   4132:                 "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.34      wiz      4133:                 target="_top">tech-pkg</a>: A general discussion
                   4134:                 list for all things related to pkgsrc.</p>
1.18      xtraeme  4135:               </li>
                   4136:             </ul>
                   4137:           </div>
                   4138: 
                   4139:           <p>To subscribe, do:</p>
1.1       grant    4140:           <pre class="programlisting">
1.18      xtraeme  4141: <code class="prompt">%</code> echo subscribe <em class=
                   4142: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1       grant    4143: </pre>
                   4144: 
1.18      xtraeme  4145:           <p>Archives for all these mailing lists are available
                   4146:           from <a href="http://mail-index.NetBSD.org/" target=
                   4147:           "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1       grant    4148:         </div>
                   4149: 
                   4150:         <div class="sect1" lang="en" xml:lang="en">
                   4151:           <div class="titlepage">
                   4152:             <div>
                   4153:               <div>
                   4154:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4155:                 "pkgviews-docs" id=
                   4156:                 "pkgviews-docs"></a>6.2.&nbsp;Where's the pkgviews
                   4157:                 documentation?</h2>
1.1       grant    4158:               </div>
                   4159:             </div>
                   4160:           </div>
                   4161: 
                   4162:           <p>Pkgviews is tightly integrated with buildlink. You can
1.14      xtraeme  4163:           find a pkgviews User's guide in <code class=
                   4164:           "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1       grant    4165:         </div>
                   4166: 
                   4167:         <div class="sect1" lang="en" xml:lang="en">
                   4168:           <div class="titlepage">
                   4169:             <div>
                   4170:               <div>
                   4171:                 <h2 class="title" style="clear: both"><a name=
1.5       hubertf  4172:                 "faq-pkgtools" id=
                   4173:                 "faq-pkgtools"></a>6.3.&nbsp;Utilities for package
                   4174:                 management (pkgtools)</h2>
1.1       grant    4175:               </div>
                   4176:             </div>
                   4177:           </div>
                   4178: 
1.14      xtraeme  4179:           <p>The <code class="filename">pkgsrc/pkgtools</code>
1.1       grant    4180:           directory pkgtools contains a number of useful utilities
                   4181:           for both users and developers of pkgsrc. This section
                   4182:           attempts only to make the reader aware of the utilities
                   4183:           and when they might be useful, and not to duplicate the
                   4184:           documentation that comes with each package.</p>
                   4185: 
                   4186:           <p>Utilities used by pkgsrc (automatically installed when
                   4187:           needed):</p>
                   4188: 
                   4189:           <div class="itemizedlist">
                   4190:             <ul type="disc">
                   4191:               <li>
                   4192:                 <p><a xmlns=
                   4193:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4194:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.34      wiz      4195:                 class="pkgname">pkgtools/x11-links</a>: Symlinks
                   4196:                 for use by buildlink.</p>
1.1       grant    4197:               </li>
                   4198:             </ul>
                   4199:           </div>
                   4200: 
                   4201:           <p>OS tool augmentation (automatically installed when
                   4202:           needed):</p>
                   4203: 
                   4204:           <div class="itemizedlist">
                   4205:             <ul type="disc">
                   4206:               <li>
                   4207:                 <p><a xmlns=
                   4208:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4209:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.34      wiz      4210:                 class="pkgname">pkgtools/digest</a>: Calculates
                   4211:                 various kinds of checksums (including SHA1).</p>
1.1       grant    4212:               </li>
                   4213: 
                   4214:               <li>
                   4215:                 <p><a xmlns=
                   4216:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4217:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.27      rillig   4218:                 class="pkgname">pkgtools/libnbcompat</a>:
1.34      wiz      4219:                 Compatibility library for pkgsrc tools.</p>
1.1       grant    4220:               </li>
                   4221: 
                   4222:               <li>
                   4223:                 <p><a xmlns=
                   4224:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4225:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.34      wiz      4226:                 class="pkgname">pkgtools/mtree</a>: Installed on
                   4227:                 non-BSD systems due to lack of native mtree.</p>
1.1       grant    4228:               </li>
                   4229: 
                   4230:               <li>
                   4231:                 <p><a xmlns=
                   4232:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4233:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20      ben      4234:                 class="pkgname">pkgtools/pkg_install</a>:
1.34      wiz      4235:                 Up-to-date replacement for <code class=
                   4236:                 "filename">/usr/sbin/pkg_install</code>, or for use
                   4237:                 on operating systems where pkg_install is not
                   4238:                 present.</p>
1.1       grant    4239:               </li>
                   4240:             </ul>
                   4241:           </div>
                   4242: 
                   4243:           <p>Utilities used by pkgsrc (not automatically
                   4244:           installed):</p>
                   4245: 
                   4246:           <div class="itemizedlist">
                   4247:             <ul type="disc">
                   4248:               <li>
                   4249:                 <p><a xmlns=
                   4250:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4251:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.34      wiz      4252:                 class="pkgname">pkgtools/pkg_tarup</a>: Create a
1.20      ben      4253:                 binary package from an already-installed package.
1.34      wiz      4254:                 Used by <span><strong class="command">make
                   4255:                 replace</strong></span> to save the old
                   4256:                 package.</p>
1.1       grant    4257:               </li>
                   4258: 
                   4259:               <li>
                   4260:                 <p><a xmlns=
                   4261:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.5       hubertf  4262:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.34      wiz      4263:                 class="pkgname">pkgtools/dfdisk</a>: Adds extra
1.20      ben      4264:                 functionality to pkgsrc, allowing it to fetch
                   4265:                 distfiles from multiple locations. It currently
                   4266:                 supports the following methods: multiple CD-ROMs
                   4267:                 and network FTP/HTTP connections.</p>
1.5       hubertf  4268:               </li>
                   4269: 
                   4270:               <li>
                   4271:                 <p><a xmlns=
                   4272:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    4273:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.34      wiz      4274:                 class="pkgname">pkgtools/xpkgwedge</a>: Put X11
                   4275:                 packages someplace else (enabled by default).</p>
1.1       grant    4276:               </li>
1.5       hubertf  4277: 
                   4278:               <li>
                   4279:                 <p><a xmlns=
                   4280:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4281:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.34      wiz      4282:                 class="pkgname">devel/cpuflags</a>: Determine the
                   4283:                 best compiler flags to optimise code for your
1.20      ben      4284:                 current CPU and compiler.</p>
1.5       hubertf  4285:               </li>
1.1       grant    4286:             </ul>
                   4287:           </div>
                   4288: 
                   4289:           <p>Utilities for keeping track of installed packages,
                   4290:           being up to date, etc:</p>
                   4291: 
                   4292:           <div class="itemizedlist">
                   4293:             <ul type="disc">
                   4294:               <li>
                   4295:                 <p><a xmlns=
                   4296:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4297:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.34      wiz      4298:                 class="pkgname">pkgtools/pkg_chk</a>: Reports on
1.27      rillig   4299:                 packages whose installed versions do not match the
1.34      wiz      4300:                 latest pkgsrc entries.</p>
1.1       grant    4301:               </li>
                   4302: 
                   4303:               <li>
                   4304:                 <p><a xmlns=
                   4305:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4306:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.34      wiz      4307:                 class="pkgname">pkgtools/pkgdep</a>: Makes
1.20      ben      4308:                 dependency graphs of packages, to aid in choosing a
1.34      wiz      4309:                 strategy for updating.</p>
1.1       grant    4310:               </li>
                   4311: 
                   4312:               <li>
                   4313:                 <p><a xmlns=
                   4314:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4315:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.34      wiz      4316:                 class="pkgname">pkgtools/pkgdepgraph</a>: Makes
1.27      rillig   4317:                 graphs from the output of <a xmlns=
                   4318:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4319:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
                   4320:                 class="pkgname">pkgtools/pkgdep</a> (uses
1.34      wiz      4321:                 graphviz).</p>
1.1       grant    4322:               </li>
                   4323: 
                   4324:               <li>
                   4325:                 <p><a xmlns=
                   4326:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4327:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.34      wiz      4328:                 class="pkgname">pkgtools/pkglint</a>: The
1.27      rillig   4329:                 pkglint(1) program checks a pkgsrc entry for
                   4330:                 errors, lintpkgsrc(1) does various checks on the
                   4331:                 complete pkgsrc system.</p>
1.1       grant    4332:               </li>
                   4333: 
                   4334:               <li>
                   4335:                 <p><a xmlns=
                   4336:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4337:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.34      wiz      4338:                 class="pkgname">pkgtools/pkgsurvey</a>: Report what
                   4339:                 packages you have installed.</p>
1.1       grant    4340:               </li>
                   4341:             </ul>
                   4342:           </div>
                   4343: 
                   4344:           <p>Utilities for people maintaining or creating
                   4345:           individual packages:</p>
                   4346: 
                   4347:           <div class="itemizedlist">
                   4348:             <ul type="disc">
                   4349:               <li>
                   4350:                 <p><a xmlns=
                   4351:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4352:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.34      wiz      4353:                 class="pkgname">pkgtools/pkgdiff</a>: Automate
1.20      ben      4354:                 making and maintaining patches for a package
1.34      wiz      4355:                 (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1       grant    4356:               </li>
                   4357: 
                   4358:               <li>
                   4359:                 <p><a xmlns=
                   4360:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4361:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.20      ben      4362:                 class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
                   4363:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4364:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.34      wiz      4365:                 class="pkgname">pkgtools/url2pkg</a>: Aids in
                   4366:                 converting to pkgsrc.</p>
1.1       grant    4367:               </li>
                   4368: 
                   4369:               <li>
                   4370:                 <p><a xmlns=
                   4371:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4372:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.34      wiz      4373:                 class="pkgname">pkgtools/gensolpkg</a>: Convert
                   4374:                 pkgsrc to a Solaris package.</p>
1.1       grant    4375:               </li>
                   4376:             </ul>
                   4377:           </div>
                   4378: 
                   4379:           <p>Utilities for people maintaining pkgsrc (or more
                   4380:           obscure pkg utilities)</p>
                   4381: 
                   4382:           <div class="itemizedlist">
                   4383:             <ul type="disc">
                   4384:               <li>
                   4385:                 <p><a xmlns=
                   4386:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4387:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.34      wiz      4388:                 class="pkgname">pkgtools/pkgconflict</a>: Find
1.20      ben      4389:                 packages that conflict but aren't marked as
1.34      wiz      4390:                 such.</p>
1.1       grant    4391:               </li>
                   4392: 
                   4393:               <li>
                   4394:                 <p><a xmlns=
                   4395:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4396:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.34      wiz      4397:                 class="pkgname">pkgtools/pkg_comp</a>: Build
                   4398:                 packages in a chrooted area.</p>
1.1       grant    4399:               </li>
                   4400: 
                   4401:               <li>
                   4402:                 <p><a xmlns=
                   4403:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4404:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.34      wiz      4405:                 class="pkgname">pkgtools/libkver</a>: Spoof kernel
                   4406:                 version for chrooted cross builds.</p>
1.1       grant    4407:               </li>
                   4408:             </ul>
                   4409:           </div>
                   4410:         </div>
                   4411: 
                   4412:         <div class="sect1" lang="en" xml:lang="en">
                   4413:           <div class="titlepage">
                   4414:             <div>
                   4415:               <div>
                   4416:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4417:                 "non-root-pkgsrc" id=
                   4418:                 "non-root-pkgsrc"></a>6.4.&nbsp;How to use pkgsrc
                   4419:                 as non-root</h2>
1.1       grant    4420:               </div>
                   4421:             </div>
                   4422:           </div>
                   4423: 
                   4424:           <p>If you want to use pkgsrc as non-root user, you can
                   4425:           set some variables to make pkgsrc work under these
1.33      jmmv     4426:           conditions. At the very least, you need to set
                   4427:           <code class="varname">UNPRIVILEGED</code> to
                   4428:           &#8220;<span class="quote">yes</span>&#8221;; this will
                   4429:           turn on unprivileged mode and set multiple related
                   4430:           variables to allow installation of packages as
                   4431:           non-root.</p>
                   4432: 
                   4433:           <p>In case the defaults are not enough, you may want to
                   4434:           tune some other variables used. For example, if the
                   4435:           automatic user/group detection leads to incorrect values
                   4436:           (or not the ones you would like to use), you can change
                   4437:           them by setting <code class=
                   4438:           "varname">UNPRIVILEGED_USER</code> and <code class=
                   4439:           "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
                   4440: 
                   4441:           <p>As regards bootstrapping, please note that the
                   4442:           <span><strong class="command">bootstrap</strong></span>
                   4443:           script will ease non-root configuration when given the
                   4444:           &#8220;<span class=
                   4445:           "quote">--ignore-user-check</span>&#8221; flag, as it
                   4446:           will choose and use multiple default directories under
                   4447:           <code class="filename">~/pkg</code> as the installation
                   4448:           targets. These directories can be overriden by the
                   4449:           &#8220;<span class="quote">--prefix</span>&#8221; flag
                   4450:           provided by the script, as well as some others that allow
                   4451:           finer tuning of the tree layout.</p>
1.14      xtraeme  4452:         </div>
                   4453: 
                   4454:         <div class="sect1" lang="en" xml:lang="en">
                   4455:           <div class="titlepage">
                   4456:             <div>
                   4457:               <div>
                   4458:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4459:                 "resume-transfers" id=
                   4460:                 "resume-transfers"></a>6.5.&nbsp;How to resume
                   4461:                 transfers when fetching distfiles?</h2>
1.14      xtraeme  4462:               </div>
                   4463:             </div>
                   4464:           </div>
                   4465: 
1.15      xtraeme  4466:           <p>By default resuming transfers in pkgsrc is disabled,
                   4467:           but you can enable this feature by adding the option
                   4468:           <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
                   4469:           into <code class="filename">/etc/mk.conf</code>. If,
                   4470:           during a fetch step, an incomplete distfile is found,
                   4471:           pkgsrc will try to resume it.</p>
                   4472: 
                   4473:           <p>You can also use a different program than the default
1.24      wiz      4474:           <a href=
                   4475:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   4476:           <span class="citerefentry"><span class=
                   4477:           "refentrytitle">ftp</span>(1)</span></a> by changing the
                   4478:           <code class="varname">FETCH_CMD</code> variable. Don't
                   4479:           forget to set <code class=
                   4480:           "varname">FETCH_RESUME_ARGS</code> and <code class=
                   4481:           "varname">FETCH_OUTPUT_ARGS</code> if you are not using
                   4482:           default values.</p>
1.14      xtraeme  4483: 
                   4484:           <p>For example, if you want to use <code class=
                   4485:           "filename">wget</code> to resume downloads, you'll have
                   4486:           to use something like:</p>
                   4487:           <pre class="programlisting">
1.34      wiz      4488: FETCH_CMD=wget
                   4489: FETCH_BEFORE_ARGS=--passive-ftp
                   4490: FETCH_RESUME_ARGS=-c
                   4491: FETCH_OUTPUT_ARGS=-O
1.14      xtraeme  4492: </pre>
1.1       grant    4493:         </div>
                   4494: 
                   4495:         <div class="sect1" lang="en" xml:lang="en">
                   4496:           <div class="titlepage">
                   4497:             <div>
                   4498:               <div>
                   4499:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4500:                 "XFree86-from-pkgsrc" id=
                   4501:                 "XFree86-from-pkgsrc"></a>6.6.&nbsp;How can I
1.1       grant    4502:                 install/use XFree86 from pkgsrc?</h2>
                   4503:               </div>
                   4504:             </div>
                   4505:           </div>
                   4506: 
                   4507:           <p>If you want to use XFree86 from pkgsrc instead of your
1.14      xtraeme  4508:           system's own X11 (<code class=
                   4509:           "filename">/usr/X11R6</code>, <code class=
                   4510:           "filename">/usr/openwin</code>, ...), you will have to
                   4511:           add the following line into <code class=
1.15      xtraeme  4512:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4513:           <pre class="programlisting">
1.34      wiz      4514: X11_TYPE=XFree86
1.1       grant    4515: </pre>
                   4516:         </div>
                   4517: 
                   4518:         <div class="sect1" lang="en" xml:lang="en">
                   4519:           <div class="titlepage">
                   4520:             <div>
                   4521:               <div>
                   4522:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4523:                 "x.org-from-pkgsrc" id=
                   4524:                 "x.org-from-pkgsrc"></a>6.7.&nbsp;How can I
1.1       grant    4525:                 install/use X.org from pkgsrc?</h2>
                   4526:               </div>
                   4527:             </div>
                   4528:           </div>
                   4529: 
                   4530:           <p>If you want to use X.org from pkgsrc instead of your
1.14      xtraeme  4531:           system's own X11 (<code class=
                   4532:           "filename">/usr/X11R6</code>, <code class=
                   4533:           "filename">/usr/openwin</code>, ...) you will have to add
                   4534:           the following line into <code class=
1.15      xtraeme  4535:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4536:           <pre class="programlisting">
1.34      wiz      4537: X11_TYPE=xorg
1.1       grant    4538: </pre>
                   4539:         </div>
                   4540: 
                   4541:         <div class="sect1" lang="en" xml:lang="en">
                   4542:           <div class="titlepage">
                   4543:             <div>
                   4544:               <div>
                   4545:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4546:                 "fetch-behind-firewall" id=
                   4547:                 "fetch-behind-firewall"></a>6.8.&nbsp;How to fetch
                   4548:                 files from behind a firewall</h2>
1.1       grant    4549:               </div>
                   4550:             </div>
                   4551:           </div>
                   4552: 
                   4553:           <p>If you are sitting behind a firewall which does not
                   4554:           allow direct connections to Internet hosts (i.e.
                   4555:           non-NAT), you may specify the relevant proxy hosts. This
                   4556:           is done using an environment variable in the form of a
                   4557:           URL e.g. in Amdahl, the machine &#8220;<span class=
                   4558:           "quote">orpheus.amdahl.com</span>&#8221; is one of the
                   4559:           firewalls, and it uses port 80 as the proxy port number.
                   4560:           So the proxy environment variables are:</p>
                   4561:           <pre class="programlisting">
1.34      wiz      4562: ftp_proxy=ftp://orpheus.amdahl.com:80/
1.1       grant    4563: http_proxy=http://orpheus.amdahl.com:80/
                   4564: </pre>
                   4565:         </div>
                   4566: 
                   4567:         <div class="sect1" lang="en" xml:lang="en">
                   4568:           <div class="titlepage">
                   4569:             <div>
                   4570:               <div>
                   4571:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4572:                 "passive-ftp" id="passive-ftp"></a>6.9.&nbsp;How do
                   4573:                 I tell <span><strong class="command">make
1.14      xtraeme  4574:                 fetch</strong></span> to do passive FTP?</h2>
1.1       grant    4575:               </div>
                   4576:             </div>
                   4577:           </div>
                   4578: 
                   4579:           <p>This depends on which utility is used to retrieve
1.14      xtraeme  4580:           distfiles. From <code class="filename">bsd.pkg.mk</code>,
                   4581:           <code class="varname">FETCH_CMD</code> is assigned the
                   4582:           first available command from the following list:</p>
1.34      wiz      4583: 
                   4584:           <div class="itemizedlist">
                   4585:             <ul type="disc">
                   4586:               <li>
                   4587:                 <p><code class=
                   4588:                 "filename">${LOCALBASE}/bin/ftp</code></p>
                   4589:               </li>
                   4590: 
                   4591:               <li>
                   4592:                 <p><code class="filename">/usr/bin/ftp</code></p>
                   4593:               </li>
                   4594:             </ul>
                   4595:           </div>
1.1       grant    4596: 
                   4597:           <p>On a default NetBSD installation, this will be
1.14      xtraeme  4598:           <code class="filename">/usr/bin/ftp</code>, which
1.1       grant    4599:           automatically tries passive connections first, and falls
                   4600:           back to active connections if the server refuses to do
                   4601:           passive. For the other tools, add the following to your
1.14      xtraeme  4602:           <code class="filename">/etc/mk.conf</code> file:
                   4603:           <code class="varname">PASSIVE_FETCH=1</code>.</p>
1.1       grant    4604: 
1.14      xtraeme  4605:           <p>Having that option present will prevent <code class=
                   4606:           "filename">/usr/bin/ftp</code> from falling back to
                   4607:           active transfers.</p>
1.1       grant    4608:         </div>
                   4609: 
                   4610:         <div class="sect1" lang="en" xml:lang="en">
                   4611:           <div class="titlepage">
                   4612:             <div>
                   4613:               <div>
                   4614:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4615:                 "fetching-all-distfiles" id=
                   4616:                 "fetching-all-distfiles"></a>6.10.&nbsp;How to
1.1       grant    4617:                 fetch all distfiles at once</h2>
                   4618:               </div>
                   4619:             </div>
                   4620:           </div>
                   4621: 
                   4622:           <p>You would like to download all the distfiles in a
                   4623:           single batch from work or university, where you can't run
1.14      xtraeme  4624:           a <span><strong class="command">make
                   4625:           fetch</strong></span>. There is an archive of distfiles
                   4626:           on <a href=
1.1       grant    4627:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
                   4628:           target="_top">ftp.NetBSD.org</a>, but downloading the
                   4629:           entire directory may not be appropriate.</p>
                   4630: 
1.14      xtraeme  4631:           <p>The answer here is to do a <span><strong class=
                   4632:           "command">make fetch-list</strong></span> in <code class=
                   4633:           "filename">/usr/pkgsrc</code> or one of it's
1.1       grant    4634:           subdirectories, carry the resulting list to your machine
1.23      wiz      4635:           at work/school and use it there. If you don't have a
1.24      wiz      4636:           NetBSD-compatible <a href=
                   4637:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   4638:           <span class="citerefentry"><span class=
                   4639:           "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
                   4640:           at work, don't forget to set <code class=
                   4641:           "varname">FETCH_CMD</code> to something that fetches a
                   4642:           URL:</p>
1.1       grant    4643: 
                   4644:           <p>At home:</p>
                   4645:           <pre class="screen">
1.14      xtraeme  4646: <code class="prompt">%</code> <strong class=
                   4647: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   4648: <code class="prompt">%</code> <strong class=
                   4649: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles &gt;/tmp/fetch.sh</code></strong>
                   4650: <code class="prompt">%</code> <strong class=
                   4651: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1       grant    4652: </pre>
                   4653: 
                   4654:           <p>At work:</p>
                   4655:           <pre class="screen">
1.14      xtraeme  4656: <code class="prompt">%</code> <strong class=
                   4657: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1       grant    4658: </pre>
                   4659: 
1.14      xtraeme  4660:           <p>then tar up <code class=
                   4661:           "filename">/tmp/distfiles</code> and take it home.</p>
1.1       grant    4662: 
                   4663:           <p>If you have a machine running NetBSD, and you want to
                   4664:           get <span class="emphasis"><em>all</em></span> distfiles
                   4665:           (even ones that aren't for your machine architecture),
                   4666:           you can do so by using the above-mentioned
1.14      xtraeme  4667:           <span><strong class="command">make
                   4668:           fetch-list</strong></span> approach, or fetch the
                   4669:           distfiles directly by running:</p>
1.1       grant    4670:           <pre class="screen">
1.14      xtraeme  4671: <code class="prompt">%</code> <strong class=
                   4672: "userinput"><code>make mirror-distfiles</code></strong>
1.1       grant    4673: </pre>
                   4674: 
1.14      xtraeme  4675:           <p>If you even decide to ignore <code class=
                   4676:           "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
                   4677:           can get everything by running:</p>
1.1       grant    4678:           <pre class="screen">
1.14      xtraeme  4679: <code class="prompt">%</code> <strong class=
                   4680: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1       grant    4681: </pre>
                   4682:         </div>
                   4683: 
                   4684:         <div class="sect1" lang="en" xml:lang="en">
                   4685:           <div class="titlepage">
                   4686:             <div>
                   4687:               <div>
                   4688:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4689:                 "tmac.andoc-missing" id=
                   4690:                 "tmac.andoc-missing"></a>6.11.&nbsp;What does
1.1       grant    4691:                 &#8220;<span class="quote">Don't know how to make
                   4692:                 /usr/share/tmac/tmac.andoc</span>&#8221; mean?</h2>
                   4693:               </div>
                   4694:             </div>
                   4695:           </div>
                   4696: 
                   4697:           <p>When compiling the <a xmlns=
                   4698:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4699:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20      ben      4700:           class="pkgname">pkgtools/pkg_install</a> package, you get
                   4701:           the error from make that it doesn't know how to make
                   4702:           <code class="filename">/usr/share/tmac/tmac.andoc</code>?
                   4703:           This indicates that you don't have installed the
1.23      wiz      4704:           &#8220;<span class="quote">text</span>&#8221; set (nroff,
                   4705:           ...) from the NetBSD base distribution on your machine.
                   4706:           It is recommended to do that to format manpages.</p>
1.1       grant    4707: 
                   4708:           <p>In the case of the <a xmlns=
                   4709:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4710:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20      ben      4711:           class="pkgname">pkgtools/pkg_install</a> package, you can
                   4712:           get away with setting <code class=
                   4713:           "varname">NOMAN=YES</code> either in the environment or
                   4714:           in <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    4715:         </div>
                   4716: 
                   4717:         <div class="sect1" lang="en" xml:lang="en">
                   4718:           <div class="titlepage">
                   4719:             <div>
                   4720:               <div>
                   4721:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4722:                 "bsd.own.mk-missing" id=
                   4723:                 "bsd.own.mk-missing"></a>6.12.&nbsp;What does
1.1       grant    4724:                 &#8220;<span class="quote">Could not find
                   4725:                 bsd.own.mk</span>&#8221; mean?</h2>
                   4726:               </div>
                   4727:             </div>
                   4728:           </div>
                   4729: 
1.14      xtraeme  4730:           <p>You didn't install the compiler set, <code class=
                   4731:           "filename">comp.tgz</code>, when you installed your
                   4732:           NetBSD machine. Please get it and install it, by
                   4733:           extracting it in <code class="filename">/</code>:</p>
1.1       grant    4734:           <pre class="screen">
1.14      xtraeme  4735: <code class="prompt">#</code> <strong class=
                   4736: "userinput"><code>cd /</code></strong>
                   4737: <code class="prompt">#</code> <strong class=
                   4738: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1       grant    4739: </pre>
                   4740: 
1.14      xtraeme  4741:           <p><code class="filename">comp.tgz</code> is part of
                   4742:           every NetBSD release. Get the one that corresponds to
                   4743:           your release (determine via <span><strong class=
                   4744:           "command">uname -r</strong></span>).</p>
1.1       grant    4745:         </div>
                   4746: 
                   4747:         <div class="sect1" lang="en" xml:lang="en">
                   4748:           <div class="titlepage">
                   4749:             <div>
                   4750:               <div>
                   4751:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4752:                 "using-sudo-with-pkgsrc" id=
                   4753:                 "using-sudo-with-pkgsrc"></a>6.13.&nbsp;Using
1.1       grant    4754:                 'sudo' with pkgsrc</h2>
                   4755:               </div>
                   4756:             </div>
                   4757:           </div>
                   4758: 
                   4759:           <p>When installing packages as non-root user and using
1.24      wiz      4760:           the just-in-time <a href=
                   4761:           "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
                   4762:           <span class="citerefentry"><span class=
                   4763:           "refentrytitle">su</span>(1)</span></a> feature of
                   4764:           pkgsrc, it can become annoying to type in the root
                   4765:           password for each required package installed. To avoid
                   4766:           this, the sudo package can be used, which does password
                   4767:           caching over a limited time. To use it, install sudo
                   4768:           (either as binary package or from <a xmlns=
                   4769:           "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    4770:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.20      ben      4771:           class="pkgname">security/sudo</a>) and then put the
                   4772:           following into your <code class=
                   4773:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4774:           <pre class="programlisting">
1.34      wiz      4775: .if exists(${LOCALBASE}/bin/sudo)
                   4776: SU_CMD=${LOCALBASE}/bin/sudo /bin/sh -c
                   4777: .endif
1.1       grant    4778: </pre>
                   4779:         </div>
                   4780: 
                   4781:         <div class="sect1" lang="en" xml:lang="en">
                   4782:           <div class="titlepage">
                   4783:             <div>
                   4784:               <div>
                   4785:                 <h2 class="title" style="clear: both"><a name=
1.35      jmmv     4786:                 "faq.conf" id="faq.conf"></a>6.14.&nbsp;How do I
                   4787:                 change the location of configuration files?</h2>
1.1       grant    4788:               </div>
                   4789:             </div>
                   4790:           </div>
                   4791: 
1.35      jmmv     4792:           <p>As the system administrator, you can choose where
                   4793:           configuration files are installed. The default settings
                   4794:           make all these files go into <code class=
                   4795:           "filename">${PREFIX}/etc</code> or some of its
                   4796:           subdirectories; this may be suboptimal depending on your
                   4797:           expectations (e.g., a read-only, NFS-exported
                   4798:           <code class="varname">PREFIX</code> with a need of
                   4799:           per-machine configuration of the provided packages).</p>
                   4800: 
                   4801:           <p>In order to change the defaults, you can modify the
                   4802:           <code class="varname">PKG_SYSCONFBASE</code> variable (in
                   4803:           <code class="filename">/etc/mk.conf</code>) to point to
                   4804:           your preferred configuration directory; some common
                   4805:           examples include <code class="filename">/etc</code> or
                   4806:           <code class="filename">/etc/pkg</code>.</p>
                   4807: 
                   4808:           <p>Furthermore, you can change this value on a
                   4809:           per-package basis by setting the <code class=
                   4810:           "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   4811:           variable. <code class="varname">PKG_SYSCONFVAR</code>'s
                   4812:           value usually matches the name of the package you would
                   4813:           like to modify, that is, the contents of <code class=
                   4814:           "varname">PKGBASE</code>.</p>
1.1       grant    4815: 
1.35      jmmv     4816:           <p>Note that, after changing these settings, you must
                   4817:           rebuild and reinstall any affected packages.</p>
1.1       grant    4818:         </div>
                   4819: 
                   4820:         <div class="sect1" lang="en" xml:lang="en">
                   4821:           <div class="titlepage">
                   4822:             <div>
                   4823:               <div>
                   4824:                 <h2 class="title" style="clear: both"><a name=
                   4825:                 "audit-packages" id=
1.14      xtraeme  4826:                 "audit-packages"></a>6.15.&nbsp;Automated security
1.1       grant    4827:                 checks</h2>
                   4828:               </div>
                   4829:             </div>
                   4830:           </div>
                   4831: 
                   4832:           <p>Please be aware that there can often be bugs in
                   4833:           third-party software, and some of these bugs can leave a
                   4834:           machine vulnerable to exploitation by attackers. In an
                   4835:           effort to lessen the exposure, the NetBSD packages team
                   4836:           maintains a database of known-exploits to packages which
                   4837:           have at one time been included in pkgsrc. The database
                   4838:           can be downloaded automatically, and a security audit of
                   4839:           all packages installed on a system can take place. To do
                   4840:           this, install the <a xmlns=
                   4841:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4842:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.20      ben      4843:           class="pkgname">security/audit-packages</a> package. It
                   4844:           has two components:</p>
1.1       grant    4845: 
                   4846:           <div class="orderedlist">
                   4847:             <ol type="1">
                   4848:               <li>
1.34      wiz      4849:                 <p><span><strong class=
                   4850:                 "command">download-vulnerability-list</strong></span>,
1.1       grant    4851:                 an easy way to download a list of the security
                   4852:                 vulnerabilities information. This list is kept up
                   4853:                 to date by the NetBSD security officer and the
                   4854:                 NetBSD packages team, and is distributed from the
                   4855:                 NetBSD ftp server:</p>
                   4856: 
                   4857:                 <p><a href=
                   4858:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20      ben      4859:                 target=
                   4860:                 "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1       grant    4861:               </li>
                   4862: 
                   4863:               <li>
1.34      wiz      4864:                 <p><span><strong class=
                   4865:                 "command">audit-packages</strong></span>, an easy
                   4866:                 way to audit the current machine, checking each
1.1       grant    4867:                 vulnerability which is known. If a vulnerable
                   4868:                 package is installed, it will be shown by output to
                   4869:                 stdout, including a description of the type of
                   4870:                 vulnerability, and a URL containing more
                   4871:                 information.</p>
                   4872:               </li>
                   4873:             </ol>
                   4874:           </div>
                   4875: 
1.23      wiz      4876:           <p>Use of the <a xmlns=
                   4877:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4878:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
                   4879:           class="pkgname">security/audit-packages</a> package is
                   4880:           strongly recommended! After &#8220;<span class=
                   4881:           "quote">audit-packages</span>&#8221; is installed, please
                   4882:           read the package's message, which you can get by running
                   4883:           <strong class="userinput"><code>pkg_info -D
                   4884:           audit-package</code></strong>.</p>
1.1       grant    4885:         </div>
                   4886:       </div>
                   4887:     </div>
                   4888: 
                   4889:     <div class="part" lang="en" xml:lang="en">
                   4890:       <div class="titlepage">
                   4891:         <div>
                   4892:           <div>
                   4893:             <h1 class="title"><a name="developers-guide" id=
1.2       hubertf  4894:             "developers-guide"></a>The pkgsrc developer's
                   4895:             guide</h1>
1.1       grant    4896:           </div>
                   4897:         </div>
                   4898:       </div>
                   4899: 
                   4900:       <div class="toc">
                   4901:         <p><b>Table of Contents</b></p>
                   4902: 
                   4903:         <dl>
1.27      rillig   4904:           <dt><span class="chapter"><a href="#components">7.
                   4905:           Package components - files, directories and
                   4906:           contents</a></span></dt>
                   4907: 
                   4908:           <dd>
                   4909:             <dl>
                   4910:               <dt><span class="sect1"><a href=
                   4911:               "#components.Makefile">7.1. <code class=
                   4912:               "filename">Makefile</code></a></span></dt>
                   4913: 
                   4914:               <dt><span class="sect1"><a href=
                   4915:               "#components.distinfo">7.2. <code class=
                   4916:               "filename">distinfo</code></a></span></dt>
                   4917: 
                   4918:               <dt><span class="sect1"><a href=
                   4919:               "#components.patches">7.3. patches/*</a></span></dt>
                   4920: 
1.30      wiz      4921:               <dt><span class="sect1"><a href=
                   4922:               "#other-mandatory-files">7.4. Other mandatory
                   4923:               files</a></span></dt>
1.27      rillig   4924: 
                   4925:               <dt><span class="sect1"><a href=
                   4926:               "#components.optional">7.5. Optional
                   4927:               files</a></span></dt>
                   4928: 
1.30      wiz      4929:               <dt><span class="sect1"><a href="#work-dir">7.6.
1.27      rillig   4930:               <code class="filename">work*</code></a></span></dt>
                   4931: 
1.30      wiz      4932:               <dt><span class="sect1"><a href="#files-dir">7.7.
1.27      rillig   4933:               <code class="filename">files/*</code></a></span></dt>
                   4934:             </dl>
                   4935:           </dd>
                   4936: 
                   4937:           <dt><span class="chapter"><a href="#makefile">8.
1.25      rillig   4938:           Programming in <code class=
                   4939:           "filename">Makefile</code>s</a></span></dt>
                   4940: 
                   4941:           <dd>
                   4942:             <dl>
                   4943:               <dt><span class="sect1"><a href=
1.27      rillig   4944:               "#makefile.variables">8.1. <code class=
1.25      rillig   4945:               "filename">Makefile</code> variables</a></span></dt>
                   4946: 
1.27      rillig   4947:               <dd>
                   4948:                 <dl>
                   4949:                   <dt><span class="sect2"><a href=
                   4950:                   "#makefile.variables.names">8.1.1. Naming
                   4951:                   conventions</a></span></dt>
                   4952:                 </dl>
                   4953:               </dd>
                   4954: 
                   4955:               <dt><span class="sect1"><a href="#makefile.code">8.2.
1.25      rillig   4956:               Code snippets</a></span></dt>
                   4957: 
                   4958:               <dd>
                   4959:                 <dl>
                   4960:                   <dt><span class="sect2"><a href=
1.30      wiz      4961:                   "#adding-to-list">8.2.1. Adding things to a
1.25      rillig   4962:                   list</a></span></dt>
                   4963: 
                   4964:                   <dt><span class="sect2"><a href=
1.30      wiz      4965:                   "#converting-internal-to-external">8.2.2.
                   4966:                   Converting an internal list into an external
                   4967:                   list</a></span></dt>
1.25      rillig   4968: 
                   4969:                   <dt><span class="sect2"><a href=
1.30      wiz      4970:                   "#passing-variable-to-shell">8.2.3. Passing
                   4971:                   variables to a shell command</a></span></dt>
1.27      rillig   4972: 
                   4973:                   <dt><span class="sect2"><a href=
1.30      wiz      4974:                   "#quoting-guideline">8.2.4. Quoting
1.27      rillig   4975:                   guideline</a></span></dt>
                   4976: 
                   4977:                   <dt><span class="sect2"><a href=
1.30      wiz      4978:                   "#bsd-make-bug-workaround">8.2.5. Workaround for
                   4979:                   a bug in BSD Make</a></span></dt>
1.25      rillig   4980:                 </dl>
                   4981:               </dd>
                   4982:             </dl>
                   4983:           </dd>
                   4984: 
                   4985:           <dt><span class="chapter"><a href="#plist">9. PLIST
1.1       grant    4986:           issues</a></span></dt>
                   4987: 
                   4988:           <dd>
                   4989:             <dl>
1.30      wiz      4990:               <dt><span class="sect1"><a href="#rcs-id">9.1. RCS
1.1       grant    4991:               ID</a></span></dt>
                   4992: 
1.30      wiz      4993:               <dt><span class="sect1"><a href=
                   4994:               "#automatic-plist-generation">9.2. Semi-automatic
                   4995:               <code class="filename">PLIST</code>
1.14      xtraeme  4996:               generation</a></span></dt>
1.1       grant    4997: 
1.25      rillig   4998:               <dt><span class="sect1"><a href="#print-PLIST">9.3.
1.14      xtraeme  4999:               Tweaking output of <span><strong class="command">make
                   5000:               print-PLIST</strong></span></a></span></dt>
1.1       grant    5001: 
1.25      rillig   5002:               <dt><span class="sect1"><a href="#plist.misc">9.4.
1.1       grant    5003:               Variable substitution in PLIST</a></span></dt>
                   5004: 
1.30      wiz      5005:               <dt><span class="sect1"><a href=
                   5006:               "#manpage-compression">9.5.
1.1       grant    5007:               Manpage-compression</a></span></dt>
                   5008: 
1.30      wiz      5009:               <dt><span class="sect1"><a href=
                   5010:               "#using-PLIST_SRC">9.6. Changing PLIST source with
                   5011:               <code class=
1.14      xtraeme  5012:               "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    5013: 
1.30      wiz      5014:               <dt><span class="sect1"><a href=
                   5015:               "#platform-specific-plist">9.7. Platform specific and
                   5016:               differing PLISTs</a></span></dt>
1.1       grant    5017: 
                   5018:               <dt><span class="sect1"><a href=
1.25      rillig   5019:               "#faq.common-dirs">9.8. Sharing directories between
1.1       grant    5020:               packages</a></span></dt>
                   5021:             </dl>
                   5022:           </dd>
                   5023: 
1.25      rillig   5024:           <dt><span class="chapter"><a href="#buildlink">10.
1.1       grant    5025:           Buildlink methodology</a></span></dt>
                   5026: 
                   5027:           <dd>
                   5028:             <dl>
1.30      wiz      5029:               <dt><span class="sect1"><a href=
                   5030:               "#converting-to-buildlink3">10.1. Converting packages
                   5031:               to use buildlink3</a></span></dt>
1.1       grant    5032: 
1.30      wiz      5033:               <dt><span class="sect1"><a href=
                   5034:               "#creating-buildlink3.mk">10.2. Writing <code class=
                   5035:               "filename">buildlink3.mk</code> files</a></span></dt>
1.1       grant    5036: 
                   5037:               <dd>
                   5038:                 <dl>
                   5039:                   <dt><span class="sect2"><a href=
1.30      wiz      5040:                   "#anatomy-of-bl3">10.2.1. Anatomy of a
                   5041:                   buildlink3.mk file</a></span></dt>
1.1       grant    5042: 
                   5043:                   <dt><span class="sect2"><a href=
1.30      wiz      5044:                   "#updating-buildlink-depends">10.2.2. Updating
                   5045:                   <code class=
                   5046:                   "varname">BUILDLINK_DEPENDS.<em class="replaceable">
                   5047:                   <code>pkg</code></em></code> in <code class=
                   5048:                   "filename">buildlink3.mk</code>
1.1       grant    5049:                   files</a></span></dt>
                   5050:                 </dl>
                   5051:               </dd>
                   5052: 
1.30      wiz      5053:               <dt><span class="sect1"><a href=
                   5054:               "#writing-builtin.mk">10.3. Writing <code class=
                   5055:               "filename">builtin.mk</code> files</a></span></dt>
1.1       grant    5056: 
                   5057:               <dd>
                   5058:                 <dl>
                   5059:                   <dt><span class="sect2"><a href=
1.30      wiz      5060:                   "#anatomy-of-builtin.mk">10.3.1. Anatomy of a
                   5061:                   <code class="filename">builtin.mk</code>
                   5062:                   file</a></span></dt>
1.1       grant    5063: 
                   5064:                   <dt><span class="sect2"><a href=
1.30      wiz      5065:                   "#native-or-pkgsrc-preference">10.3.2. Global
                   5066:                   preferences for native or pkgsrc
                   5067:                   software</a></span></dt>
1.1       grant    5068:                 </dl>
                   5069:               </dd>
                   5070:             </dl>
                   5071:           </dd>
                   5072: 
1.35      jmmv     5073:           <dt><span class="chapter"><a href="#pkginstall">11. The
                   5074:           pkginstall framework</a></span></dt>
                   5075: 
                   5076:           <dd>
                   5077:             <dl>
                   5078:               <dt><span class="sect1"><a href=
                   5079:               "#files-and-dirs-outside-prefix">11.1. Files and
                   5080:               directories outside the installation
                   5081:               prefix</a></span></dt>
                   5082: 
                   5083:               <dd>
                   5084:                 <dl>
                   5085:                   <dt><span class="sect2"><a href=
                   5086:                   "#dirs-outside-prefix">11.1.1. Directory
                   5087:                   manipulation</a></span></dt>
                   5088: 
                   5089:                   <dt><span class="sect2"><a href=
                   5090:                   "#files-outside-prefix">11.1.2. File
                   5091:                   manipulation</a></span></dt>
                   5092:                 </dl>
                   5093:               </dd>
                   5094: 
                   5095:               <dt><span class="sect1"><a href="#conf-files">11.2.
                   5096:               Configuration files</a></span></dt>
                   5097: 
                   5098:               <dd>
                   5099:                 <dl>
                   5100:                   <dt><span class="sect2"><a href=
                   5101:                   "#conf-files-sysconfdir">11.2.1. How <code class=
                   5102:                   "varname">PKG_SYSCONFDIR</code> is
                   5103:                   set</a></span></dt>
                   5104: 
                   5105:                   <dt><span class="sect2"><a href=
                   5106:                   "#conf-files-configure">11.2.2. Telling the
                   5107:                   software were configuration files
                   5108:                   are</a></span></dt>
                   5109: 
                   5110:                   <dt><span class="sect2"><a href=
                   5111:                   "#conf-files-patching">11.2.3. Patching
                   5112:                   installations</a></span></dt>
                   5113: 
                   5114:                   <dt><span class="sect2"><a href=
                   5115:                   "#conf-files-disable">11.2.4. Disabling handling
                   5116:                   of configuration files</a></span></dt>
                   5117:                 </dl>
                   5118:               </dd>
                   5119: 
                   5120:               <dt><span class="sect1"><a href="#rcd-scripts">11.3.
                   5121:               System startup scripts</a></span></dt>
                   5122: 
                   5123:               <dd>
                   5124:                 <dl>
                   5125:                   <dt><span class="sect2"><a href=
                   5126:                   "#rcd-scripts-disable">11.3.1. Disabling handling
                   5127:                   of system startup scripts</a></span></dt>
                   5128:                 </dl>
                   5129:               </dd>
                   5130: 
                   5131:               <dt><span class="sect1"><a href=
                   5132:               "#users-and-groups">11.4. System users and
                   5133:               groups</a></span></dt>
                   5134: 
                   5135:               <dt><span class="sect1"><a href="#shells">11.5.
                   5136:               System shells</a></span></dt>
                   5137: 
                   5138:               <dd>
                   5139:                 <dl>
                   5140:                   <dt><span class="sect2"><a href=
                   5141:                   "#shells-disable">11.5.1. Disabling handling of
                   5142:                   configuration files</a></span></dt>
                   5143:                 </dl>
                   5144:               </dd>
                   5145:             </dl>
                   5146:           </dd>
                   5147: 
                   5148:           <dt><span class="chapter"><a href="#options">12. Options
1.1       grant    5149:           handling</a></span></dt>
                   5150: 
                   5151:           <dd>
                   5152:             <dl>
1.30      wiz      5153:               <dt><span class="sect1"><a href=
1.35      jmmv     5154:               "#global-default-options">12.1. Global default
1.30      wiz      5155:               options</a></span></dt>
1.1       grant    5156: 
1.30      wiz      5157:               <dt><span class="sect1"><a href=
1.35      jmmv     5158:               "#converting-to-options">12.2. Converting packages to
1.30      wiz      5159:               use <code class=
1.14      xtraeme  5160:               "filename">bsd.options.mk</code></a></span></dt>
1.1       grant    5161:             </dl>
                   5162:           </dd>
                   5163: 
1.35      jmmv     5164:           <dt><span class="chapter"><a href="#build">13. The build
1.1       grant    5165:           process</a></span></dt>
                   5166: 
                   5167:           <dd>
                   5168:             <dl>
1.35      jmmv     5169:               <dt><span class="sect1"><a href="#build.prefix">13.1.
1.1       grant    5170:               Program location</a></span></dt>
                   5171: 
1.35      jmmv     5172:               <dt><span class="sect1"><a href="#main-targets">13.2.
1.1       grant    5173:               Main targets</a></span></dt>
                   5174: 
                   5175:               <dt><span class="sect1"><a href=
1.35      jmmv     5176:               "#build.helpful-targets">13.3. Other helpful
1.1       grant    5177:               targets</a></span></dt>
                   5178:             </dl>
                   5179:           </dd>
                   5180: 
1.35      jmmv     5181:           <dt><span class="chapter"><a href="#fixes">14. Notes on
1.1       grant    5182:           fixes for packages</a></span></dt>
                   5183: 
                   5184:           <dd>
                   5185:             <dl>
1.30      wiz      5186:               <dt><span class="sect1"><a href=
1.35      jmmv     5187:               "#general-operation">14.1. General
1.30      wiz      5188:               operation</a></span></dt>
1.1       grant    5189: 
                   5190:               <dd>
                   5191:                 <dl>
                   5192:                   <dt><span class="sect2"><a href=
1.35      jmmv     5193:                   "#pulling-vars-from-etc-mk.conf">14.1.1. How to
1.30      wiz      5194:                   pull in variables from
                   5195:                   /etc/mk.conf</a></span></dt>
1.1       grant    5196: 
                   5197:                   <dt><span class="sect2"><a href=
1.35      jmmv     5198:                   "#where-to-install-documentation">14.1.2. Where
1.31      wiz      5199:                   to install documentation</a></span></dt>
                   5200: 
                   5201:                   <dt><span class="sect2"><a href=
1.35      jmmv     5202:                   "#restricted-packages">14.1.3. Restricted
1.1       grant    5203:                   packages</a></span></dt>
                   5204: 
                   5205:                   <dt><span class="sect2"><a href=
1.35      jmmv     5206:                   "#dependencies">14.1.4. Handling
1.1       grant    5207:                   dependencies</a></span></dt>
                   5208: 
                   5209:                   <dt><span class="sect2"><a href=
1.35      jmmv     5210:                   "#conflicts">14.1.5. Handling conflicts with
1.1       grant    5211:                   other packages</a></span></dt>
                   5212: 
                   5213:                   <dt><span class="sect2"><a href=
1.35      jmmv     5214:                   "#not-building-packages">14.1.6. Packages that
1.30      wiz      5215:                   cannot or should not be built</a></span></dt>
1.1       grant    5216: 
                   5217:                   <dt><span class="sect2"><a href=
1.35      jmmv     5218:                   "#undeletable-packages">14.1.7. Packages which
1.30      wiz      5219:                   should not be deleted, once
                   5220:                   installed</a></span></dt>
1.1       grant    5221: 
                   5222:                   <dt><span class="sect2"><a href=
1.35      jmmv     5223:                   "#security-handling">14.1.8. Handling packages
1.1       grant    5224:                   with security problems</a></span></dt>
                   5225: 
                   5226:                   <dt><span class="sect2"><a href=
1.35      jmmv     5227:                   "#compiler-bugs">14.1.9. How to handle compiler
1.1       grant    5228:                   bugs</a></span></dt>
                   5229: 
                   5230:                   <dt><span class="sect2"><a href=
1.35      jmmv     5231:                   "#bumping-pkgrevision">14.1.10. How to handle
1.30      wiz      5232:                   incrementing versions when fixing an existing
1.1       grant    5233:                   package</a></span></dt>
                   5234: 
                   5235:                   <dt><span class="sect2"><a href=
1.35      jmmv     5236:                   "#portability-of-packages">14.1.11. Portability
1.30      wiz      5237:                   of packages</a></span></dt>
1.1       grant    5238:                 </dl>
                   5239:               </dd>
                   5240: 
1.30      wiz      5241:               <dt><span class="sect1"><a href=
1.35      jmmv     5242:               "#downloading-issues">14.2. Possible downloading
1.30      wiz      5243:               issues</a></span></dt>
1.1       grant    5244: 
                   5245:               <dd>
                   5246:                 <dl>
                   5247:                   <dt><span class="sect2"><a href=
1.35      jmmv     5248:                   "#no-plain-download">14.2.1. Packages whose
1.30      wiz      5249:                   distfiles aren't available for plain
1.1       grant    5250:                   downloading</a></span></dt>
                   5251: 
                   5252:                   <dt><span class="sect2"><a href=
1.35      jmmv     5253:                   "#modified-distfiles-same-name">14.2.2. How to
1.30      wiz      5254:                   handle modified distfiles with the 'old'
                   5255:                   name</a></span></dt>
1.1       grant    5256:                 </dl>
                   5257:               </dd>
                   5258: 
1.30      wiz      5259:               <dt><span class="sect1"><a href=
1.35      jmmv     5260:               "#configuration-gotchas">14.3. Configuration
1.30      wiz      5261:               gotchas</a></span></dt>
1.1       grant    5262: 
                   5263:               <dd>
                   5264:                 <dl>
                   5265:                   <dt><span class="sect2"><a href=
1.35      jmmv     5266:                   "#fixes.libtool">14.3.1. Shared libraries -
1.1       grant    5267:                   libtool</a></span></dt>
                   5268: 
                   5269:                   <dt><span class="sect2"><a href=
1.35      jmmv     5270:                   "#using-libtool">14.3.2. Using libtool on GNU
1.1       grant    5271:                   packages that already support
                   5272:                   libtool</a></span></dt>
                   5273: 
                   5274:                   <dt><span class="sect2"><a href=
1.35      jmmv     5275:                   "#autoconf-automake">14.3.3. GNU
1.1       grant    5276:                   Autoconf/Automake</a></span></dt>
                   5277:                 </dl>
                   5278:               </dd>
                   5279: 
1.30      wiz      5280:               <dt><span class="sect1"><a href=
1.35      jmmv     5281:               "#building-considerations">14.4. Building
1.30      wiz      5282:               considerations</a></span></dt>
1.1       grant    5283: 
                   5284:               <dd>
                   5285:                 <dl>
                   5286:                   <dt><span class="sect2"><a href=
1.35      jmmv     5287:                   "#cpp-defines">14.4.1. CPP
1.30      wiz      5288:                   defines</a></span></dt>
1.1       grant    5289:                 </dl>
                   5290:               </dd>
                   5291: 
1.30      wiz      5292:               <dt><span class="sect1"><a href=
1.35      jmmv     5293:               "#package-specific-actions">14.5. Package specific
1.30      wiz      5294:               actions</a></span></dt>
1.1       grant    5295: 
                   5296:               <dd>
                   5297:                 <dl>
                   5298:                   <dt><span class="sect2"><a href=
1.35      jmmv     5299:                   "#user-interaction">14.5.1. User
1.2       hubertf  5300:                   interaction</a></span></dt>
1.1       grant    5301: 
                   5302:                   <dt><span class="sect2"><a href=
1.35      jmmv     5303:                   "#handling-licenses">14.5.2. Handling
1.1       grant    5304:                   licenses</a></span></dt>
                   5305: 
                   5306:                   <dt><span class="sect2"><a href=
1.35      jmmv     5307:                   "#installing-score-files">14.5.3. Installing
1.30      wiz      5308:                   score files</a></span></dt>
1.1       grant    5309: 
                   5310:                   <dt><span class="sect2"><a href=
1.35      jmmv     5311:                   "#perl-scripts">14.5.4. Packages containing perl
1.1       grant    5312:                   scripts</a></span></dt>
                   5313: 
                   5314:                   <dt><span class="sect2"><a href=
1.35      jmmv     5315:                   "#hardcoded-paths">14.5.5. Packages with
1.30      wiz      5316:                   hardcoded paths to other
                   5317:                   interpreters</a></span></dt>
1.1       grant    5318: 
                   5319:                   <dt><span class="sect2"><a href=
1.35      jmmv     5320:                   "#perl-modules">14.5.6. Packages installing perl
1.1       grant    5321:                   modules</a></span></dt>
                   5322: 
                   5323:                   <dt><span class="sect2"><a href=
1.35      jmmv     5324:                   "#faq.info-files">14.5.7. Packages installing
1.1       grant    5325:                   info files</a></span></dt>
                   5326: 
                   5327:                   <dt><span class="sect2"><a href=
1.35      jmmv     5328:                   "#gconf2-data-files">14.5.8. Packages installing
1.30      wiz      5329:                   GConf2 data files</a></span></dt>
1.1       grant    5330: 
                   5331:                   <dt><span class="sect2"><a href=
1.35      jmmv     5332:                   "#scrollkeeper-data-files">14.5.9. Packages
1.30      wiz      5333:                   installing scrollkeeper data
                   5334:                   files</a></span></dt>
1.1       grant    5335: 
                   5336:                   <dt><span class="sect2"><a href=
1.35      jmmv     5337:                   "#x11-fonts">14.5.10. Packages installing X11
1.1       grant    5338:                   fonts</a></span></dt>
                   5339: 
                   5340:                   <dt><span class="sect2"><a href=
1.35      jmmv     5341:                   "#gtk2-modules">14.5.11. Packages installing GTK2
1.1       grant    5342:                   modules</a></span></dt>
                   5343: 
                   5344:                   <dt><span class="sect2"><a href=
1.35      jmmv     5345:                   "#sgml-xml-data">14.5.12. Packages installing
1.30      wiz      5346:                   SGML or XML data</a></span></dt>
1.1       grant    5347: 
                   5348:                   <dt><span class="sect2"><a href=
1.35      jmmv     5349:                   "#mime-database">14.5.13. Packages installing
1.1       grant    5350:                   extensions to the MIME database</a></span></dt>
                   5351: 
                   5352:                   <dt><span class="sect2"><a href=
1.35      jmmv     5353:                   "#intltool">14.5.14. Packages using
1.1       grant    5354:                   intltool</a></span></dt>
1.18      xtraeme  5355: 
                   5356:                   <dt><span class="sect2"><a href=
1.35      jmmv     5357:                   "#startup-scripts">14.5.15. Packages installing
1.30      wiz      5358:                   startup scripts</a></span></dt>
1.1       grant    5359:                 </dl>
                   5360:               </dd>
                   5361: 
1.30      wiz      5362:               <dt><span class="sect1"><a href=
1.35      jmmv     5363:               "#feedback-to-author">14.6. Feedback to the
1.30      wiz      5364:               author</a></span></dt>
1.1       grant    5365:             </dl>
                   5366:           </dd>
                   5367: 
1.35      jmmv     5368:           <dt><span class="chapter"><a href="#debug">15.
1.1       grant    5369:           Debugging</a></span></dt>
                   5370: 
1.35      jmmv     5371:           <dt><span class="chapter"><a href="#submit">16.
1.1       grant    5372:           Submitting and Committing</a></span></dt>
                   5373: 
                   5374:           <dd>
                   5375:             <dl>
1.30      wiz      5376:               <dt><span class="sect1"><a href=
1.35      jmmv     5377:               "#submitting-your-package">16.1. Submitting your
1.30      wiz      5378:               packages</a></span></dt>
1.1       grant    5379: 
1.30      wiz      5380:               <dt><span class="sect1"><a href=
1.35      jmmv     5381:               "#committing-importing">16.2. Committing: Importing a
1.30      wiz      5382:               package into CVS</a></span></dt>
1.1       grant    5383: 
1.30      wiz      5384:               <dt><span class="sect1"><a href=
1.35      jmmv     5385:               "#updating-package">16.3. Updating a package to a
1.30      wiz      5386:               newer version</a></span></dt>
1.1       grant    5387: 
1.30      wiz      5388:               <dt><span class="sect1"><a href=
1.35      jmmv     5389:               "#moving-package">16.4. Moving a package in
1.30      wiz      5390:               pkgsrc</a></span></dt>
1.1       grant    5391:             </dl>
                   5392:           </dd>
                   5393:         </dl>
                   5394:       </div>
                   5395: 
                   5396:       <div class="chapter" lang="en" xml:lang="en">
                   5397:         <div class="titlepage">
                   5398:           <div>
                   5399:             <div>
1.27      rillig   5400:               <h2 class="title"><a name="components" id=
                   5401:               "components"></a>Chapter&nbsp;7.&nbsp;Package
                   5402:               components - files, directories and contents</h2>
1.25      rillig   5403:             </div>
                   5404:           </div>
                   5405:         </div>
                   5406: 
                   5407:         <div class="toc">
                   5408:           <p><b>Table of Contents</b></p>
                   5409: 
                   5410:           <dl>
                   5411:             <dt><span class="sect1"><a href=
1.27      rillig   5412:             "#components.Makefile">7.1. <code class=
                   5413:             "filename">Makefile</code></a></span></dt>
                   5414: 
                   5415:             <dt><span class="sect1"><a href=
                   5416:             "#components.distinfo">7.2. <code class=
                   5417:             "filename">distinfo</code></a></span></dt>
                   5418: 
                   5419:             <dt><span class="sect1"><a href=
                   5420:             "#components.patches">7.3. patches/*</a></span></dt>
1.25      rillig   5421: 
1.30      wiz      5422:             <dt><span class="sect1"><a href=
                   5423:             "#other-mandatory-files">7.4. Other mandatory
                   5424:             files</a></span></dt>
1.25      rillig   5425: 
1.27      rillig   5426:             <dt><span class="sect1"><a href=
                   5427:             "#components.optional">7.5. Optional
                   5428:             files</a></span></dt>
1.25      rillig   5429: 
1.30      wiz      5430:             <dt><span class="sect1"><a href="#work-dir">7.6.
1.27      rillig   5431:             <code class="filename">work*</code></a></span></dt>
1.25      rillig   5432: 
1.30      wiz      5433:             <dt><span class="sect1"><a href="#files-dir">7.7.
1.27      rillig   5434:             <code class="filename">files/*</code></a></span></dt>
1.25      rillig   5435:           </dl>
                   5436:         </div>
                   5437: 
1.27      rillig   5438:         <p>Whenever you're preparing a package, there are a number
                   5439:         of files involved which are described in the following
                   5440:         sections.</p>
1.25      rillig   5441: 
                   5442:         <div class="sect1" lang="en" xml:lang="en">
                   5443:           <div class="titlepage">
                   5444:             <div>
                   5445:               <div>
                   5446:                 <h2 class="title" style="clear: both"><a name=
1.27      rillig   5447:                 "components.Makefile" id=
                   5448:                 "components.Makefile"></a>7.1.&nbsp;<code class=
                   5449:                 "filename">Makefile</code></h2>
1.25      rillig   5450:               </div>
                   5451:             </div>
                   5452:           </div>
                   5453: 
1.27      rillig   5454:           <p>Building, installation and creation of a binary
                   5455:           package are all controlled by the package's <code class=
                   5456:           "filename">Makefile</code>. The <code class=
                   5457:           "filename">Makefile</code> describes various things about
                   5458:           a package, for example from where to get it, how to
                   5459:           configure, build, and install it.</p>
                   5460: 
                   5461:           <p>A package <code class="filename">Makefile</code>
                   5462:           contains several sections that describe the package.</p>
1.25      rillig   5463: 
1.27      rillig   5464:           <p>In the first section there are the following
                   5465:           variables, which should appear exactly in the order given
                   5466:           here.</p>
1.25      rillig   5467: 
                   5468:           <div class="itemizedlist">
                   5469:             <ul type="disc">
                   5470:               <li>
1.27      rillig   5471:                 <p><code class="varname">DISTNAME</code> is the
                   5472:                 basename of the distribution file to be downloaded
                   5473:                 from the package's website.</p>
                   5474:               </li>
                   5475: 
                   5476:               <li>
                   5477:                 <p><code class="varname">PKGNAME</code> is the name
                   5478:                 of the package, as used by pkgsrc. You only need to
                   5479:                 provide it if it differs from DISTNAME. Usually it
                   5480:                 is the directory name together with the version
                   5481:                 number. It must match the regular expression
                   5482:                 <code class=
                   5483:                 "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
                   5484:                 that is, it starts with a letter or digit, and
                   5485:                 contains only letters, digits, dashes, underscores,
                   5486:                 dots and plus signs.</p>
1.25      rillig   5487:               </li>
                   5488: 
                   5489:               <li>
1.27      rillig   5490:                 <p><code class="varname">CATEGORIES</code> is a
                   5491:                 list of categories which the package fits in. You
                   5492:                 can choose any of the top-level directories of
                   5493:                 pkgsrc for it.</p>
1.25      rillig   5494:               </li>
                   5495: 
                   5496:               <li>
1.27      rillig   5497:                 <p><code class="varname">MASTER_SITES</code> is a
                   5498:                 list of URLs where the distribution files can be
                   5499:                 downloaded. Each URL must end with a slash.</p>
1.25      rillig   5500:               </li>
                   5501:             </ul>
                   5502:           </div>
                   5503: 
1.27      rillig   5504:           <p>The second section contains the following
                   5505:           variables.</p>
1.25      rillig   5506: 
1.27      rillig   5507:           <div class="itemizedlist">
                   5508:             <ul type="disc">
                   5509:               <li>
                   5510:                 <p><code class="varname">MAINTAINER</code> is the
                   5511:                 mail address of the package's maintainer, which is
                   5512:                 the person you can contact when the package does
                   5513:                 not work.</p>
                   5514:               </li>
1.25      rillig   5515: 
1.27      rillig   5516:               <li>
                   5517:                 <p><code class="varname">HOMEPAGE</code> is a URL
                   5518:                 where users can find more information about the
1.23      wiz      5519:                 package.</p>
                   5520:               </li>
1.1       grant    5521: 
1.23      wiz      5522:               <li>
                   5523:                 <p><code class="varname">COMMENT</code> is a
                   5524:                 one-line comment about the purpose of the
                   5525:                 package.</p>
                   5526:               </li>
                   5527:             </ul>
                   5528:           </div>
1.1       grant    5529: 
1.14      xtraeme  5530:           <p>The <code class="varname">MASTER_SITES</code> may be
                   5531:           set to one of the predefined sites:</p>
1.1       grant    5532:           <pre class="programlisting">
                   5533:         ${MASTER_SITE_APACHE}
1.27      rillig   5534:         ${MASTER_SITE_BACKUP}
                   5535:         ${MASTER_SITE_CYGWIN}
1.1       grant    5536:         ${MASTER_SITE_DEBIAN}
1.27      rillig   5537:         ${MASTER_SITE_FREEBSD}
                   5538:         ${MASTER_SITE_FREEBSD_LOCAL}
1.1       grant    5539:         ${MASTER_SITE_GNOME}
                   5540:         ${MASTER_SITE_GNU}
                   5541:         ${MASTER_SITE_GNUSTEP}
1.9       dillo    5542:         ${MASTER_SITE_IFARCHIVE}
1.1       grant    5543:         ${MASTER_SITE_MOZILLA}
1.27      rillig   5544:         ${MASTER_SITE_OPENOFFICE}
1.1       grant    5545:         ${MASTER_SITE_PERL_CPAN}
1.27      rillig   5546:         ${MASTER_SITE_R_CRAN}
1.1       grant    5547:         ${MASTER_SITE_SOURCEFORGE}
                   5548:         ${MASTER_SITE_SUNSITE}
                   5549:         ${MASTER_SITE_SUSE}
                   5550:         ${MASTER_SITE_TEX_CTAN}
                   5551:         ${MASTER_SITE_XCONTRIB}
1.27      rillig   5552:         ${MASTER_SITE_XEMACS}
                   5553:     
1.1       grant    5554: </pre>
                   5555: 
                   5556:           <p>If one of these predefined sites is chosen, you may
                   5557:           require the ability to specify a subdirectory of that
                   5558:           site. Since these macros may expand to more than one
                   5559:           actual site, you <span class=
                   5560:           "emphasis"><em>must</em></span> use the following
                   5561:           construct to specify a subdirectory:</p>
                   5562:           <pre class="programlisting">
                   5563:         ${MASTER_SITE_GNU:=subdirectory/name/}
                   5564:         ${MASTER_SITE_SOURCEFORGE:=project_name/} 
                   5565: </pre>
                   5566: 
                   5567:           <p>Note the trailing slash after the subdirectory
                   5568:           name.</p>
                   5569: 
                   5570:           <div class="note" style=
                   5571:           "margin-left: 0.5in; margin-right: 0.5in;">
                   5572:             <h3 class="title">Note</h3>
                   5573: 
1.14      xtraeme  5574:             <p><code class="varname">MASTER_SITE_SUBDIR</code> has
                   5575:             been deprecated and <span class="emphasis"><em>should
                   5576:             no longer be used</em></span>.</p>
1.1       grant    5577:           </div>
                   5578: 
1.14      xtraeme  5579:           <p>If the package has multiple <code class=
                   5580:           "varname">DISTFILES</code> or multiple <code class=
                   5581:           "varname">PATCHFILES</code> from different sites, set
                   5582:           <code class="varname">SITES_foo</code> to a list of URI's
1.1       grant    5583:           where file &#8220;<span class="quote">foo</span>&#8221;
                   5584:           may be found. &#8220;<span class=
                   5585:           "quote">foo</span>&#8221; includes the suffix, e.g.</p>
                   5586:           <pre class="programlisting">
                   5587: DISTFILES=      ${DISTNAME}${EXTRACT_SUFX}
                   5588: DISTFILES+=     foo-file.tar.gz
                   5589: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
                   5590:         http://www.somewhereelse.com/mirror/somehow/
                   5591: </pre>
                   5592: 
1.14      xtraeme  5593:           <p>Note that the normal default setting of <code class=
                   5594:           "varname">DISTFILES</code> must be made explicit if you
1.1       grant    5595:           want to add to it (rather than replace it), as you
                   5596:           usually would.</p>
                   5597: 
                   5598:           <p>Currently the following values are available for
1.14      xtraeme  5599:           <code class="varname">CATEGORIES</code>. If more than one
                   5600:           is used, they need to be separated by spaces:</p>
1.1       grant    5601:           <pre class="programlisting">
                   5602: archivers     cross         geography     meta-pkgs     security
                   5603: audio         databases     graphics      misc          shells
                   5604: benchmarks    devel         ham           multimedia    sysutils
                   5605: biology       editors       inputmethod   net           textproc
                   5606: cad           emulators     lang          news          time
                   5607: chat          finance       mail          parallel      wm
                   5608: comms         fonts         math          pkgtools      www
                   5609: converters    games         mbone         print         x11
                   5610: </pre>
                   5611: 
                   5612:           <p>Please pay attention to the following gotchas:</p>
                   5613: 
                   5614:           <div class="itemizedlist">
                   5615:             <ul type="disc">
                   5616:               <li>
1.14      xtraeme  5617:                 <p>Add <code class="varname">MANCOMPRESSED</code>
                   5618:                 if manpages are installed in compressed form by the
                   5619:                 package; see comment in <code class=
                   5620:                 "filename">bsd.pkg.mk</code>.</p>
1.1       grant    5621:               </li>
                   5622: 
                   5623:               <li>
1.14      xtraeme  5624:                 <p>Replace <code class="filename">/usr/local</code>
1.1       grant    5625:                 with &#8220;<span class=
                   5626:                 "quote">${PREFIX}</span>&#8221; in all files (see
                   5627:                 patches, below).</p>
                   5628:               </li>
                   5629: 
                   5630:               <li>
                   5631:                 <p>If the package installs any info files, see
                   5632:                 <a href="#faq.info-files" title=
1.35      jmmv     5633:                 "14.5.7.&nbsp;Packages installing info files">Section
                   5634:                 14.5.7, &#8220;Packages installing info
1.1       grant    5635:                 files&#8221;</a>.</p>
                   5636:               </li>
                   5637: 
                   5638:               <li>
1.14      xtraeme  5639:                 <p>Set <code class="varname">MAINTAINER</code> to
                   5640:                 be yourself. If you really can't maintain the
                   5641:                 package for future updates, set it to <code class=
1.1       grant    5642:                 "email">&lt;<a href=
1.14      xtraeme  5643:                 "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>&gt;</code>.</p>
1.1       grant    5644:               </li>
                   5645: 
                   5646:               <li>
                   5647:                 <p>If a home page for the software in question
1.14      xtraeme  5648:                 exists, add the variable <code class=
                   5649:                 "varname">HOMEPAGE</code> right after <code class=
                   5650:                 "varname">MAINTAINER</code>. The value of this
1.1       grant    5651:                 variable should be the URL for the home page.</p>
                   5652:               </li>
                   5653: 
                   5654:               <li>
1.14      xtraeme  5655:                 <p>Be sure to set the <code class=
                   5656:                 "varname">COMMENT</code> variable to a short
1.1       grant    5657:                 description of the package, not containing the
                   5658:                 pkg's name.</p>
                   5659:               </li>
                   5660:             </ul>
                   5661:           </div>
                   5662:         </div>
                   5663: 
                   5664:         <div class="sect1" lang="en" xml:lang="en">
                   5665:           <div class="titlepage">
                   5666:             <div>
                   5667:               <div>
                   5668:                 <h2 class="title" style="clear: both"><a name=
                   5669:                 "components.distinfo" id=
1.27      rillig   5670:                 "components.distinfo"></a>7.2.&nbsp;<code class=
1.14      xtraeme  5671:                 "filename">distinfo</code></h2>
1.1       grant    5672:               </div>
                   5673:             </div>
                   5674:           </div>
                   5675: 
                   5676:           <p>Most important, the mandatory message digest, or
                   5677:           checksum, of all the distfiles needed for the package to
                   5678:           compile, confirming they match the original file
                   5679:           distributed by the author. This ensures that the distfile
                   5680:           retrieved from the Internet has not been corrupted during
                   5681:           transfer or altered by a malign force to introduce a
1.14      xtraeme  5682:           security hole. It is generated using the
                   5683:           <span><strong class="command">make
                   5684:           makesum</strong></span> command. The digest algorithm
                   5685:           used was, at one stage, md5, but that was felt lacking
                   5686:           compared to sha1, and so sha1 is now the default
1.1       grant    5687:           algorithm. The distfile size is also generated and stored
                   5688:           in new distinfo files. The <a xmlns=
                   5689:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5690:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.20      ben      5691:           class="pkgname">pkgtools/digest</a> utility calculates
                   5692:           all of the digests in the distinfo file, and it provides
                   5693:           various different algorithms. At the current time, the
                   5694:           algorithms provided are: <span class=
                   5695:           "emphasis"><em>md5</em></span>, <span class=
                   5696:           "emphasis"><em>rmd160</em></span>, <span class=
                   5697:           "emphasis"><em>sha1</em></span>, <span class=
                   5698:           "emphasis"><em>sha256</em></span>, <span class=
                   5699:           "emphasis"><em>sha384</em></span> and <span class=
                   5700:           "emphasis"><em>sha512</em></span>.</p>
1.1       grant    5701: 
                   5702:           <p>Some packages have different sets of distfiles on a
                   5703:           per architecture basis, for example <a xmlns=
                   5704:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5705:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.20      ben      5706:           class="pkgname">www/navigator</a>). These are kept in the
                   5707:           same distinfo file and care should be taken when
                   5708:           upgrading such a package to ensure distfile information
                   5709:           is not lost.</p>
1.1       grant    5710: 
                   5711:           <p>The message digest/checksum for all the official
1.14      xtraeme  5712:           patches found in the <code class=
                   5713:           "filename">patches/</code> directory (see <a href=
                   5714:           "#components.patches" title=
1.27      rillig   5715:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
1.1       grant    5716:           &#8220;patches/*&#8221;</a>) for the package is also
1.14      xtraeme  5717:           stored in the <code class="filename">distinfo</code>
                   5718:           file. This is a message digest/checksum of all lines in
                   5719:           the patch file except the NetBSD RCS Id. This file is
                   5720:           generated by invoking <span><strong class="command">make
                   5721:           makepatchsum</strong></span> (or <span><strong class=
                   5722:           "command">make mps</strong></span> if you're in a
                   5723:           hurry).</p>
1.1       grant    5724:         </div>
                   5725: 
                   5726:         <div class="sect1" lang="en" xml:lang="en">
                   5727:           <div class="titlepage">
                   5728:             <div>
                   5729:               <div>
                   5730:                 <h2 class="title" style="clear: both"><a name=
                   5731:                 "components.patches" id=
1.27      rillig   5732:                 "components.patches"></a>7.3.&nbsp;patches/*</h2>
1.1       grant    5733:               </div>
                   5734:             </div>
                   5735:           </div>
                   5736: 
                   5737:           <p>This directory contains files that are used by the
                   5738:           <a href=
                   5739:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   5740:           <span class="citerefentry"><span class=
                   5741:           "refentrytitle">patch</span>(1)</span></a> command to
                   5742:           modify the sources as distributed in the distribution
                   5743:           file into a form that will compile and run perfectly on
                   5744:           NetBSD. The files are applied successively in alphabetic
                   5745:           order (as returned by a shell &#8220;<span class=
                   5746:           "quote">patches/patch-*</span>&#8221; glob expansion), so
1.14      xtraeme  5747:           <code class="filename">patch-aa</code> is applied before
                   5748:           <code class="filename">patch-ab</code>, etc.</p>
1.1       grant    5749: 
1.14      xtraeme  5750:           <p>The <code class="filename">patch-*</code> files should
                   5751:           be in <span><strong class="command">diff
                   5752:           -bu</strong></span> format, and apply without a fuzz to
                   5753:           avoid problems. (To force patches to apply with fuzz you
                   5754:           can set <code class=
                   5755:           "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1       grant    5756:           not put changes for more than one file into a single
                   5757:           patch-file, as this will make future modifications more
                   5758:           difficult.</p>
                   5759: 
                   5760:           <p>Similar, a file should be patched at most once, not
                   5761:           several times by several different patches. If a file
                   5762:           needs several patches, they should be combined into one
                   5763:           file.</p>
                   5764: 
                   5765:           <p>One important thing to mention is to pay attention
                   5766:           that no RCS IDs get stored in the patch files, as these
                   5767:           will cause problems when later checked into the NetBSD
1.14      xtraeme  5768:           CVS tree. Use the <span><strong class=
                   5769:           "command">pkgdiff</strong></span> from the <a xmlns=
1.1       grant    5770:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5771:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20      ben      5772:           class="pkgname">pkgtools/pkgdiff</a> package to avoid
                   5773:           these problems.</p>
1.1       grant    5774: 
                   5775:           <p>For even more automation, we recommend using
1.14      xtraeme  5776:           <span><strong class="command">mkpatches</strong></span>
                   5777:           from the same package to make a whole set of patches. You
                   5778:           just have to backup files before you edit them to
                   5779:           <code class="filename">filename.orig</code>, e.g. with
                   5780:           <span><strong class="command">cp -p filename
                   5781:           filename.orig</strong></span> or, easier, by using
                   5782:           <span><strong class="command">pkgvi</strong></span> again
                   5783:           from the same package. If you upgrade a package this way,
                   5784:           you can easily compare the new set of patches with the
                   5785:           previously existing one with <span><strong class=
                   5786:           "command">patchdiff</strong></span>.</p>
1.1       grant    5787: 
                   5788:           <p>When you have finished a package, remember to generate
                   5789:           the checksums for the patch files by using the
1.14      xtraeme  5790:           <span><strong class="command">make
                   5791:           makepatchsum</strong></span> command, see <a href=
                   5792:           "#components.distinfo" title=
1.27      rillig   5793:           "7.2.&nbsp;distinfo">Section&nbsp;7.2,
1.14      xtraeme  5794:           &#8220;<code class="filename">distinfo</code>&#8221;</a>.</p>
1.1       grant    5795: 
                   5796:           <p>Patch files that are distributed by the author or
1.14      xtraeme  5797:           other maintainers can be listed in <code class=
                   5798:           "varname">$PATCHFILES</code>.</p>
1.1       grant    5799: 
                   5800:           <p>If it is desired to store any patches that should not
                   5801:           be committed into pkgsrc, they can be kept outside the
1.14      xtraeme  5802:           pkgsrc tree in the <code class=
                   5803:           "filename">$LOCALPATCHES</code> directory. The directory
1.1       grant    5804:           tree there is expected to have the same
                   5805:           &#8220;<span class="quote">category/package</span>&#8221;
                   5806:           structure as pkgsrc, and patches are expected to be
1.14      xtraeme  5807:           stored inside these dirs (also known as <code class=
                   5808:           "filename">$LOCALPATCHES/$PKGPATH</code>). For example if
                   5809:           you want to keep a private patch for <code class=
                   5810:           "filename">pkgsrc/graphics/png</code>, keep it in
                   5811:           <code class=
                   5812:           "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
                   5813:           files in the named directory are expected to be patch
1.1       grant    5814:           files, and <span class="emphasis"><em>they are applied
                   5815:           after pkgsrc patches are applied</em></span>.</p>
1.27      rillig   5816:         </div>
                   5817: 
                   5818:         <div class="sect1" lang="en" xml:lang="en">
                   5819:           <div class="titlepage">
                   5820:             <div>
                   5821:               <div>
                   5822:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      5823:                 "other-mandatory-files" id=
                   5824:                 "other-mandatory-files"></a>7.4.&nbsp;Other
1.27      rillig   5825:                 mandatory files</h2>
                   5826:               </div>
                   5827:             </div>
                   5828:           </div>
                   5829: 
                   5830:           <div class="variablelist">
                   5831:             <dl>
                   5832:               <dt><span class="term"><code class=
                   5833:               "filename">DESCR</code></span></dt>
                   5834: 
                   5835:               <dd>
                   5836:                 <p>A multi-line description of the piece of
                   5837:                 software. This should include any credits where
                   5838:                 they are due. Please bear in mind that others do
                   5839:                 not share your sense of humour (or spelling
                   5840:                 idiosyncrasies), and that others will read
                   5841:                 everything that you write here.</p>
                   5842:               </dd>
                   5843: 
                   5844:               <dt><span class="term"><code class=
                   5845:               "filename">PLIST</code></span></dt>
                   5846: 
                   5847:               <dd>
                   5848:                 <p>This file governs the files that are installed
                   5849:                 on your system: all the binaries, manual pages,
                   5850:                 etc. There are other directives which may be
                   5851:                 entered in this file, to control the creation and
                   5852:                 deletion of directories, and the location of
                   5853:                 inserted files. See <a href="#plist" title=
                   5854:                 "Chapter&nbsp;9.&nbsp;PLIST issues">Chapter&nbsp;9,
                   5855:                 <i>PLIST issues</i></a> for more information.</p>
                   5856:               </dd>
                   5857:             </dl>
                   5858:           </div>
                   5859:         </div>
                   5860: 
                   5861:         <div class="sect1" lang="en" xml:lang="en">
                   5862:           <div class="titlepage">
                   5863:             <div>
                   5864:               <div>
                   5865:                 <h2 class="title" style="clear: both"><a name=
                   5866:                 "components.optional" id=
                   5867:                 "components.optional"></a>7.5.&nbsp;Optional
                   5868:                 files</h2>
                   5869:               </div>
                   5870:             </div>
                   5871:           </div>
                   5872: 
                   5873:           <div class="variablelist">
                   5874:             <dl>
                   5875:               <dt><span class="term"><code class=
                   5876:               "filename">INSTALL</code></span></dt>
                   5877: 
                   5878:               <dd>
                   5879:                 <p>This shell script is invoked twice by <a href=
                   5880:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   5881:                 <span class="citerefentry"><span class=
                   5882:                 "refentrytitle">pkg_add</span>(1)</span></a>. First
                   5883:                 time after package extraction and before files are
                   5884:                 moved in place, the second time after the files to
                   5885:                 install are moved in place. This can be used to do
                   5886:                 any custom procedures not possible with @exec
                   5887:                 commands in <code class="filename">PLIST</code>.
                   5888:                 See <a href=
                   5889:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   5890:                 <span class="citerefentry"><span class=
                   5891:                 "refentrytitle">pkg_add</span>(1)</span></a> and
                   5892:                 <a href=
                   5893:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5894:                 <span class="citerefentry"><span class=
                   5895:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   5896:                 more information.</p>
                   5897:               </dd>
                   5898: 
                   5899:               <dt><span class="term"><code class=
                   5900:               "filename">DEINSTALL</code></span></dt>
                   5901: 
                   5902:               <dd>
                   5903:                 <p>This script is executed before and after any
                   5904:                 files are removed. It is this script's
                   5905:                 responsibility to clean up any additional messy
                   5906:                 details around the package's installation, since
                   5907:                 all pkg_delete knows is how to delete the files
                   5908:                 created in the original distribution. See <a href=
                   5909:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   5910:                 <span class="citerefentry"><span class=
                   5911:                 "refentrytitle">pkg_delete</span>(1)</span></a> and
                   5912:                 <a href=
                   5913:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5914:                 <span class="citerefentry"><span class=
                   5915:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   5916:                 more information.</p>
                   5917:               </dd>
                   5918: 
                   5919:               <dt><span class="term"><code class=
                   5920:               "filename">MESSAGE</code></span></dt>
                   5921: 
                   5922:               <dd>
                   5923:                 <p>Display this file after installation of the
                   5924:                 package. Useful for things like legal notices on
                   5925:                 almost-free software and hints for updating config
                   5926:                 files after installing modules for apache, PHP etc.
                   5927:                 Please note that you can modify variables in it
                   5928:                 easily by using <code class=
                   5929:                 "varname">MESSAGE_SUBST</code> in the package's
                   5930:                 <code class="filename">Makefile</code>:</p>
                   5931:                 <pre class="programlisting">
                   5932: MESSAGE_SUBST+=  SOMEVAR="somevalue"
                   5933: </pre>
                   5934: 
                   5935:                 <p>replaces "${SOMEVAR}" with &#8220;<span class=
                   5936:                 "quote">somevalue</span>&#8221; in <code class=
                   5937:                 "filename">MESSAGE</code>.</p>
                   5938:               </dd>
                   5939:             </dl>
                   5940:           </div>
                   5941:         </div>
                   5942: 
                   5943:         <div class="sect1" lang="en" xml:lang="en">
                   5944:           <div class="titlepage">
                   5945:             <div>
                   5946:               <div>
                   5947:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      5948:                 "work-dir" id="work-dir"></a>7.6.&nbsp;<code class=
1.27      rillig   5949:                 "filename">work*</code></h2>
                   5950:               </div>
                   5951:             </div>
                   5952:           </div>
                   5953: 
                   5954:           <p>When you type <span><strong class=
                   5955:           "command">make</strong></span> the distribution files are
                   5956:           unpacked into this directory. It can be removed by
                   5957:           running <span><strong class="command">make
                   5958:           clean</strong></span>. Besides the sources, this
                   5959:           directory is also used to keep various timestamp
                   5960:           files.</p>
                   5961: 
                   5962:           <p>If a package doesn't create a subdirectory for itself
                   5963:           (like GNU software does, for instance), but extracts
                   5964:           itself in the current directory, you should set
                   5965:           <code class="varname">WRKSRC</code> accordingly, e.g.
                   5966:           <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
                   5967:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
                   5968:           class="pkgname">editors/sam</a> again, but the quick
                   5969:           answer is:</p>
                   5970:           <pre class="programlisting">
                   5971: WRKSRC=             ${WRKDIR}
                   5972: </pre>
                   5973: 
                   5974:           <p>Please note that the old <code class=
                   5975:           "varname">NO_WRKSUBDIR</code> has been deprecated and
                   5976:           should not be used. Also, if your package doesn't create
                   5977:           a subdir with the name of <code class=
                   5978:           "varname">DISTNAME</code> but some different name, set
                   5979:           <code class="varname">WRKSRC</code> to point to the
                   5980:           proper name in <code class="filename">${WRKDIR}</code>.
                   5981:           See <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5982:           href=
                   5983:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
                   5984:           class="pkgname">lang/tcl</a> and <a xmlns=
                   5985:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5986:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
                   5987:           class="pkgname">x11/tk</a> for examples, and here is
                   5988:           another one:</p>
                   5989:           <pre class="programlisting">
                   5990: WRKSRC=         ${WRKDIR}/${DISTNAME}/unix
                   5991: </pre>
                   5992: 
                   5993:           <p>The name of the working directory created by pkgsrc is
                   5994:           <code class="filename">work</code> by default. If the
                   5995:           same pkgsrc tree should be used on several different
                   5996:           platforms, the variable <code class=
                   5997:           "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
                   5998:           attach the platform to the directory name, e.g.
                   5999:           <code class="filename">work.i386</code> or <code class=
                   6000:           "filename">work.sparc</code>.</p>
                   6001:         </div>
                   6002: 
                   6003:         <div class="sect1" lang="en" xml:lang="en">
                   6004:           <div class="titlepage">
                   6005:             <div>
                   6006:               <div>
                   6007:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      6008:                 "files-dir" id=
                   6009:                 "files-dir"></a>7.7.&nbsp;<code class=
1.27      rillig   6010:                 "filename">files/*</code></h2>
                   6011:               </div>
                   6012:             </div>
                   6013:           </div>
                   6014: 
                   6015:           <p>If you have any files that you wish to be placed in
                   6016:           the package prior to configuration or building, you could
                   6017:           place these files here and use a &#8220;<span class=
                   6018:           "quote">${CP}</span>&#8221; command in the
                   6019:           &#8220;<span class="quote">pre-configure</span>&#8221;
                   6020:           target to achieve this. Alternatively, you could simply
                   6021:           diff the file against <code class=
                   6022:           "filename">/dev/null</code> and use the patch mechanism
                   6023:           to manage the creation of this file.</p>
                   6024:         </div>
                   6025:       </div>
                   6026: 
                   6027:       <div class="chapter" lang="en" xml:lang="en">
                   6028:         <div class="titlepage">
                   6029:           <div>
                   6030:             <div>
                   6031:               <h2 class="title"><a name="makefile" id=
                   6032:               "makefile"></a>Chapter&nbsp;8.&nbsp;Programming in
                   6033:               <code class="filename">Makefile</code>s</h2>
                   6034:             </div>
                   6035:           </div>
                   6036:         </div>
                   6037: 
                   6038:         <div class="toc">
                   6039:           <p><b>Table of Contents</b></p>
                   6040: 
                   6041:           <dl>
                   6042:             <dt><span class="sect1"><a href=
                   6043:             "#makefile.variables">8.1. <code class=
                   6044:             "filename">Makefile</code> variables</a></span></dt>
                   6045: 
                   6046:             <dd>
                   6047:               <dl>
                   6048:                 <dt><span class="sect2"><a href=
                   6049:                 "#makefile.variables.names">8.1.1. Naming
                   6050:                 conventions</a></span></dt>
                   6051:               </dl>
                   6052:             </dd>
                   6053: 
                   6054:             <dt><span class="sect1"><a href="#makefile.code">8.2.
                   6055:             Code snippets</a></span></dt>
                   6056: 
                   6057:             <dd>
                   6058:               <dl>
1.30      wiz      6059:                 <dt><span class="sect2"><a href=
                   6060:                 "#adding-to-list">8.2.1. Adding things to a
                   6061:                 list</a></span></dt>
1.27      rillig   6062: 
1.30      wiz      6063:                 <dt><span class="sect2"><a href=
                   6064:                 "#converting-internal-to-external">8.2.2.
1.27      rillig   6065:                 Converting an internal list into an external
                   6066:                 list</a></span></dt>
                   6067: 
1.30      wiz      6068:                 <dt><span class="sect2"><a href=
                   6069:                 "#passing-variable-to-shell">8.2.3. Passing
                   6070:                 variables to a shell command</a></span></dt>
1.27      rillig   6071: 
1.30      wiz      6072:                 <dt><span class="sect2"><a href=
                   6073:                 "#quoting-guideline">8.2.4. Quoting
                   6074:                 guideline</a></span></dt>
1.27      rillig   6075: 
1.30      wiz      6076:                 <dt><span class="sect2"><a href=
                   6077:                 "#bsd-make-bug-workaround">8.2.5. Workaround for a
                   6078:                 bug in BSD Make</a></span></dt>
1.27      rillig   6079:               </dl>
                   6080:             </dd>
                   6081:           </dl>
                   6082:         </div>
                   6083: 
                   6084:         <p>Pkgsrc consists of many <code class=
                   6085:         "filename">Makefile</code> fragments, each of which forms a
                   6086:         well-defined part of the pkgsrc system. Using the <a href=
                   6087:         "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   6088:         <span class="citerefentry"><span class=
                   6089:         "refentrytitle">make</span>(1)</span></a> system as a
                   6090:         programming language for a big system like pkgsrc requires
                   6091:         some discipline to keep the code correct and
                   6092:         understandable.</p>
                   6093: 
                   6094:         <p>The basic ingredients for <code class=
                   6095:         "filename">Makefile</code> programming are variables (which
                   6096:         are actually macros) and shell commands. Among these shell
                   6097:         commands may even be more complex ones like <a href=
                   6098:         "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
                   6099:         <span class="citerefentry"><span class=
                   6100:         "refentrytitle">awk</span>(1)</span></a> programs. To make
                   6101:         sure that every shell command runs as intended it is
                   6102:         necessary to quote all variables correctly when they are
                   6103:         used.</p>
                   6104: 
                   6105:         <p>This chapter describes some patterns, that appear quite
                   6106:         often in <code class="filename">Makefile</code>s, including
                   6107:         the pitfalls that come along with them.</p>
                   6108: 
                   6109:         <div class="sect1" lang="en" xml:lang="en">
                   6110:           <div class="titlepage">
                   6111:             <div>
                   6112:               <div>
                   6113:                 <h2 class="title" style="clear: both"><a name=
                   6114:                 "makefile.variables" id=
                   6115:                 "makefile.variables"></a>8.1.&nbsp;<code class=
                   6116:                 "filename">Makefile</code> variables</h2>
                   6117:               </div>
                   6118:             </div>
                   6119:           </div>
                   6120: 
                   6121:           <p><code class="filename">Makefile</code> variables
                   6122:           contain strings that can be processed using the five
                   6123:           operators ``='', ``+='', ``?='', ``:='', and ``!='',
                   6124:           which are described in the <a href=
                   6125:           "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   6126:           <span class="citerefentry"><span class=
                   6127:           "refentrytitle">make</span>(1)</span></a> man page.</p>
                   6128: 
                   6129:           <p>When a variable's value is parsed from a <code class=
                   6130:           "filename">Makefile</code>, the hash character ``#'' and
                   6131:           the backslash character ``\'' are handled specially. If a
                   6132:           backslash is followed by a newline, any whitespace
                   6133:           immediately in front of the backslash, the backslash, the
                   6134:           newline, and any whitespace immediately behind the
                   6135:           newline are replaced with a single space. A backspace
                   6136:           character and an immediately following hash character are
                   6137:           replaced with a single hash character. Otherwise the
                   6138:           backslash is passed as is. In a variable assignment, any
                   6139:           hash character that is not preceded by a backslash starts
                   6140:           a comment that continues upto the end of the logical
                   6141:           line.</p>
                   6142: 
                   6143:           <p><span class="emphasis"><em>Note:</em></span> Because
                   6144:           of this parsing algorithm the only way to create a
                   6145:           variable consisting of a single backslash is using the
                   6146:           ``!='' operator, for example: <code class=
                   6147:           "varname">BACKSLASH!=echo "\\"</code>.</p>
                   6148: 
                   6149:           <p>So far for defining variables. The other thing you can
                   6150:           do with variables is evaluating them. A variable is
                   6151:           evaluated when it is part of the right side of the ``:=''
                   6152:           or the ``!='' operator, or directly before executing a
                   6153:           shell command which the variable is part of. In all other
                   6154:           cases <a href=
                   6155:           "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   6156:           <span class="citerefentry"><span class=
                   6157:           "refentrytitle">make</span>(1)</span></a> performs lazy
                   6158:           evaluation, that is, variables are not evaluated until
                   6159:           there's no other way. The ``modifiers'' mentioned in the
                   6160:           man page also evaluate the variable.</p>
                   6161: 
                   6162:           <p>Some of the modifiers split the string into words and
                   6163:           then operate on the words, others operate on the string
                   6164:           as a whole. When a string is splitted into words, it is
                   6165:           splitted as you would expect it from <a href=
                   6166:           "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
                   6167:           <span class="citerefentry"><span class=
                   6168:           "refentrytitle">sh</span>(1)</span></a>.</p>
                   6169: 
                   6170:           <p>No rule without exception&#8212;the
                   6171:           <span><strong class="command">.for</strong></span> loop
                   6172:           does not follow the shell quoting rules but splits at
                   6173:           sequences of whitespace.</p>
                   6174: 
                   6175:           <p>There are several types of variables that should be
                   6176:           handled differently. Strings and two types of lists.</p>
                   6177: 
                   6178:           <div class="itemizedlist">
                   6179:             <ul type="disc">
                   6180:               <li>
                   6181:                 <p><span class="emphasis"><em>Strings</em></span>
                   6182:                 can contain arbitrary characters. Nevertheless you
                   6183:                 should restrict yourself to only using printable
                   6184:                 characters. Examples are <code class=
                   6185:                 "varname">PREFIX</code> and <code class=
                   6186:                 "varname">COMMENT</code>.</p>
                   6187:               </li>
                   6188: 
                   6189:               <li>
                   6190:                 <p><span class="emphasis"><em>Internal
                   6191:                 lists</em></span> are lists that are never exported
                   6192:                 to any shell command. Their elements are separated
                   6193:                 by whitespace. Therefore the elements themselves
                   6194:                 cannot have embedded whitespace. Any other
                   6195:                 characters are allowed. Internal lists can be used
                   6196:                 in <span><strong class=
                   6197:                 "command">.for</strong></span> loops. Examples are
                   6198:                 <code class="varname">DEPENDS</code> and
                   6199:                 <code class="varname">BUILD_DEPENDS</code>.</p>
                   6200:               </li>
                   6201: 
                   6202:               <li>
                   6203:                 <p><span class="emphasis"><em>External
                   6204:                 lists</em></span> are lists that may be exported to
                   6205:                 a shell command. Their elements can contain any
                   6206:                 characters, including whitespace. That's why they
                   6207:                 cannot be used in <span><strong class=
                   6208:                 "command">.for</strong></span> loops. Examples are
                   6209:                 <code class="varname">DISTFILES</code> and
                   6210:                 <code class="varname">MASTER_SITES</code>.</p>
                   6211:               </li>
                   6212:             </ul>
                   6213:           </div>
                   6214: 
                   6215:           <div class="sect2" lang="en" xml:lang="en">
                   6216:             <div class="titlepage">
                   6217:               <div>
                   6218:                 <div>
                   6219:                   <h3 class="title"><a name=
                   6220:                   "makefile.variables.names" id=
                   6221:                   "makefile.variables.names"></a>8.1.1.&nbsp;Naming
                   6222:                   conventions</h3>
                   6223:                 </div>
                   6224:               </div>
                   6225:             </div>
                   6226: 
                   6227:             <div class="itemizedlist">
                   6228:               <ul type="disc">
                   6229:                 <li>
                   6230:                   <p>All variable names starting with an underscore
                   6231:                   are reserved for use by the pkgsrc
                   6232:                   infrastructure. They shall not be used by package
                   6233:                   <code class="filename">Makefile</code>s.</p>
                   6234:                 </li>
                   6235: 
                   6236:                 <li>
                   6237:                   <p>In <span><strong class=
                   6238:                   "command">.for</strong></span> loops you should
                   6239:                   use lowercase variable names for the iteration
                   6240:                   variables.</p>
                   6241:                 </li>
                   6242: 
                   6243:                 <li>
                   6244:                   <p>All list variables should have a ``plural''
                   6245:                   name, e.g. <code class=
                   6246:                   "varname">PKG_OPTIONS</code> or <code class=
                   6247:                   "varname">DISTFILES</code>.</p>
                   6248:                 </li>
                   6249:               </ul>
                   6250:             </div>
                   6251:           </div>
                   6252:         </div>
                   6253: 
                   6254:         <div class="sect1" lang="en" xml:lang="en">
                   6255:           <div class="titlepage">
                   6256:             <div>
                   6257:               <div>
                   6258:                 <h2 class="title" style="clear: both"><a name=
                   6259:                 "makefile.code" id=
                   6260:                 "makefile.code"></a>8.2.&nbsp;Code snippets</h2>
                   6261:               </div>
                   6262:             </div>
                   6263:           </div>
                   6264: 
                   6265:           <p>This section presents you with some code snippets you
                   6266:           should use in your own code. If you don't find anything
                   6267:           appropriate here, you should test your code and add it
                   6268:           here.</p>
                   6269: 
                   6270:           <div class="sect2" lang="en" xml:lang="en">
                   6271:             <div class="titlepage">
                   6272:               <div>
                   6273:                 <div>
1.30      wiz      6274:                   <h3 class="title"><a name="adding-to-list" id=
                   6275:                   "adding-to-list"></a>8.2.1.&nbsp;Adding things to
                   6276:                   a list</h3>
1.27      rillig   6277:                 </div>
                   6278:               </div>
                   6279:             </div>
                   6280:             <pre class="programlisting">
                   6281: STRING=                 foo * bar `date`
                   6282: INT_LIST=               # empty
                   6283: ANOTHER_INT_LIST=       apache-[0-9]*:../../www/apache
                   6284: EXT_LIST=               # empty
                   6285: ANOTHER_EXT_LIST=       a=b c=d
                   6286: 
                   6287: INT_LIST+=              ${STRING}               # 1
                   6288: INT_LIST+=              ${ANOTHER_INT_LIST}     # 2
                   6289: EXT_LIST+=              ${STRING:Q}             # 3
                   6290: EXT_LIST+=              ${ANOTHER_EXT_LIST}     # 4
                   6291:       
                   6292: </pre>
                   6293: 
                   6294:             <p>When you add a string to an external list (example
                   6295:             3), it must be quoted. In all other cases, you must not
                   6296:             add a quoting level. You must not merge internal and
                   6297:             external lists, unless you are sure that all entries
                   6298:             are correctly interpreted in both lists.</p>
                   6299:           </div>
                   6300: 
                   6301:           <div class="sect2" lang="en" xml:lang="en">
                   6302:             <div class="titlepage">
                   6303:               <div>
                   6304:                 <div>
1.30      wiz      6305:                   <h3 class="title"><a name=
                   6306:                   "converting-internal-to-external" id=
                   6307:                   "converting-internal-to-external"></a>8.2.2.&nbsp;Converting
                   6308:                   an internal list into an external list</h3>
1.27      rillig   6309:                 </div>
                   6310:               </div>
                   6311:             </div>
                   6312:             <pre class="programlisting">
                   6313: EXT_LIST=       # empty
                   6314: .for i in ${INT_LIST}
                   6315: EXT_LIST+=      ${i:Q}""
                   6316: .endfor
                   6317:       
                   6318: </pre>
                   6319: 
                   6320:             <p>This code converts the internal list <code class=
                   6321:             "varname">INT_LIST</code> into the external list
                   6322:             <code class="varname">EXT_LIST</code>. As the elements
                   6323:             of an internal list are unquoted they must be quoted
                   6324:             here. The reason for appending <code class=
                   6325:             "varname">""</code> is explained below.</p>
                   6326:           </div>
1.1       grant    6327: 
1.27      rillig   6328:           <div class="sect2" lang="en" xml:lang="en">
                   6329:             <div class="titlepage">
1.1       grant    6330:               <div>
1.27      rillig   6331:                 <div>
1.30      wiz      6332:                   <h3 class="title"><a name=
                   6333:                   "passing-variable-to-shell" id=
                   6334:                   "passing-variable-to-shell"></a>8.2.3.&nbsp;Passing
                   6335:                   variables to a shell command</h3>
1.27      rillig   6336:                 </div>
1.1       grant    6337:               </div>
                   6338:             </div>
1.27      rillig   6339:             <pre class="programlisting">
                   6340: STRING=         foo bar &lt;    &gt; * `date` $$HOME ' "
                   6341: EXT_LIST=       string=${STRING:Q} x=second\ item
                   6342: 
                   6343: all:
                   6344:         echo ${STRING}                  # 1
                   6345:         echo "${STRING}"                # 2
                   6346:         echo "${STRING:Q}"              # 3
                   6347:         echo ${STRING:Q}                # 4
                   6348:         echo x${STRING:Q} | sed 1s,.,,  # 5
                   6349:         env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
                   6350:       
                   6351: </pre>
                   6352: 
                   6353:             <p>Example 1 leads to a syntax error in the shell, as
                   6354:             the characters are just copied.</p>
                   6355: 
                   6356:             <p>Example 2 leads to a syntax error too, and if you
                   6357:             leave out the last " character from <code class=
                   6358:             "varname">${STRING}</code>, <a href=
                   6359:             "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
                   6360:             <span class="citerefentry"><span class=
                   6361:             "refentrytitle">date</span>(1)</span></a> will be
                   6362:             executed. The <code class="varname">$HOME</code> shell
                   6363:             variable would be evaluated, too.</p>
                   6364: 
                   6365:             <p>Example 3 outputs each space character preceded by a
                   6366:             backslash (or not), depending on the implementation of
                   6367:             the <a href=
                   6368:             "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   6369:             <span class="citerefentry"><span class=
                   6370:             "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1       grant    6371: 
1.27      rillig   6372:             <p>Example 4 handles correctly every string that does
                   6373:             not start with a dash. In that case, the result depends
                   6374:             on the implementation of the <a href=
                   6375:             "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   6376:             <span class="citerefentry"><span class=
                   6377:             "refentrytitle">echo</span>(1)</span></a> command. As
                   6378:             long as you can guarantee that your input does not
                   6379:             start with a dash this form is appropriate.</p>
1.1       grant    6380: 
1.27      rillig   6381:             <p>Example 5 handles even the case of a leading dash
                   6382:             correctly.</p>
1.1       grant    6383: 
1.27      rillig   6384:             <p>The <code class="varname">EXT_LIST</code> does not
                   6385:             need to be quoted because the quoting has already be
                   6386:             done when adding elements to the list.</p>
1.1       grant    6387: 
1.27      rillig   6388:             <p>As internal lists shall not be passed to the shell,
                   6389:             there is no example for it.</p>
1.1       grant    6390:           </div>
                   6391: 
1.27      rillig   6392:           <div class="sect2" lang="en" xml:lang="en">
                   6393:             <div class="titlepage">
1.1       grant    6394:               <div>
1.27      rillig   6395:                 <div>
1.30      wiz      6396:                   <h3 class="title"><a name="quoting-guideline" id=
                   6397:                   "quoting-guideline"></a>8.2.4.&nbsp;Quoting
1.27      rillig   6398:                   guideline</h3>
                   6399:                 </div>
1.1       grant    6400:               </div>
                   6401:             </div>
                   6402: 
1.27      rillig   6403:             <p>There are many possible sources of wrongly quoted
                   6404:             variables. This section lists some of the commonly
                   6405:             known ones.</p>
1.1       grant    6406: 
1.27      rillig   6407:             <div class="itemizedlist">
                   6408:               <ul type="disc">
                   6409:                 <li>
                   6410:                   <p>Whenever you use the value of a list, think
                   6411:                   about what happens to leading or trailing
                   6412:                   whitespace. If the list is a well-formed shell
                   6413:                   expression you can apply the <code class=
                   6414:                   "varname">:M*</code> modifier to strip leading
                   6415:                   and trailing whitespace from each word. The
                   6416:                   <code class="varname">:M</code> operator first
                   6417:                   splits its argument according to the rules of the
                   6418:                   shell, and then creates a new list consisting of
                   6419:                   all words that match the shell glob expression
                   6420:                   <code class="varname">*</code>, that is: all. One
                   6421:                   class of situations where this is needed is when
                   6422:                   adding a variable like <code class=
                   6423:                   "varname">CPPFLAGS</code> to <code class=
                   6424:                   "varname">CONFIGURE_ARGS</code>. If the configure
                   6425:                   script invokes other configure scripts it strips
                   6426:                   the leading and trailing whitespace from the
                   6427:                   variable and then passes it to the other
                   6428:                   configure scripts. But these configure scripts
                   6429:                   expect the (child) <code class=
                   6430:                   "varname">CPPFLAGS</code> variable to be the same
                   6431:                   as the parent <code class=
                   6432:                   "varname">CPPFLAGS</code>. That's why we better
                   6433:                   pass the <code class="varname">CPPFLAGS</code>
                   6434:                   value properly trimmed. And here is how we do
                   6435:                   it:</p>
                   6436:                   <pre class="programlisting">
                   6437: CPPFLAGS=               # empty
                   6438: CPPFLAGS+=              -Wundef -DPREFIX=\"${PREFIX:Q}\"
                   6439: CPPFLAGS+=              ${MY_CPPFLAGS}
1.1       grant    6440: 
1.27      rillig   6441: CONFIGURE_ARGS+=        CPPFLAGS=${CPPFLAGS:M*:Q}
1.1       grant    6442: 
1.27      rillig   6443: all:
                   6444:         echo x${CPPFLAGS:Q}x            # leading and trailing whitespace
                   6445:         echo x${CONFIGURE_ARGS}x        # properly trimmed
                   6446:         
                   6447: </pre>
                   6448:                 </li>
1.1       grant    6449: 
1.27      rillig   6450:                 <li>
                   6451:                   <p>The example above contains one bug: The
                   6452:                   <code class="varname">${PREFIX}</code> is a
                   6453:                   properly quoted shell expression, but there is
                   6454:                   the C compiler after it, which also expects a
                   6455:                   properly quoted string (this time in C syntax).
                   6456:                   The version above is therefore only correct if
                   6457:                   <code class="varname">${PREFIX}</code> does not
                   6458:                   have embedded backslashes or double quotes. If
                   6459:                   you want to allow these, you have to add another
                   6460:                   layer of quoting to each variable that is used as
                   6461:                   a C string literal. You cannot use the
                   6462:                   <code class="varname">:Q</code> operator for it,
                   6463:                   as this operator only works for the shell.</p>
                   6464:                 </li>
1.1       grant    6465: 
1.27      rillig   6466:                 <li>
                   6467:                   <p>Whenever a variable can be empty the
                   6468:                   <code class="varname">:Q</code> operator can have
                   6469:                   surprising results. Here are two completely
                   6470:                   different cases which can be solved with the same
                   6471:                   trick.</p>
                   6472:                   <pre class="programlisting">
                   6473: EMPTY=                  # empty
                   6474: empty_test:
                   6475:         for i in a ${EMPTY:Q} c; do \
                   6476:                 echo "$$i"; \
                   6477:         done
                   6478: 
                   6479: for_test:
                   6480: .for i in a:\ a:\test.txt
                   6481:         echo ${i:Q}
                   6482:         echo "foo"
                   6483: .endfor
                   6484:         
1.1       grant    6485: </pre>
                   6486: 
1.27      rillig   6487:                   <p>The first example will only print two of the
                   6488:                   three lines we might have expected. This is
                   6489:                   because <code class="varname">${EMPTY:Q}</code>
                   6490:                   expands to the empty string, which the shell
                   6491:                   cannot see. The workaround is to write
                   6492:                   <code class="varname">${EMPTY:Q}""</code>. This
                   6493:                   pattern can be often found as <code class=
                   6494:                   "varname">${TEST} -z ${VAR:Q}</code> or as
                   6495:                   <code class="varname">${TEST} -f
                   6496:                   ${FNAME:Q}</code> (both of these are wrong).</p>
                   6497: 
                   6498:                   <p>The second example will only print three lines
                   6499:                   instead of four. The first line looks like
                   6500:                   <code class="varname">a:\ echo foo</code>. This
                   6501:                   is because the backslash of the value
                   6502:                   <code class="varname">a:\</code> is interpreted
                   6503:                   as a line-continuation by <a href=
                   6504:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   6505:                   <span class="citerefentry"><span class=
                   6506:                   "refentrytitle">make</span>(1)</span></a>, which
                   6507:                   makes the second line the arguments of the
                   6508:                   <a href=
                   6509:                   "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   6510:                   <span class="citerefentry"><span class=
                   6511:                   "refentrytitle">echo</span>(1)</span></a> command
                   6512:                   from the first line. To avoid this, write
                   6513:                   <code class="varname">${i:Q}""</code>.</p>
                   6514:                 </li>
                   6515:               </ul>
                   6516:             </div>
1.1       grant    6517:           </div>
                   6518: 
1.27      rillig   6519:           <div class="sect2" lang="en" xml:lang="en">
                   6520:             <div class="titlepage">
1.1       grant    6521:               <div>
1.27      rillig   6522:                 <div>
1.30      wiz      6523:                   <h3 class="title"><a name=
                   6524:                   "bsd-make-bug-workaround" id=
                   6525:                   "bsd-make-bug-workaround"></a>8.2.5.&nbsp;Workaround
                   6526:                   for a bug in BSD Make</h3>
1.27      rillig   6527:                 </div>
1.1       grant    6528:               </div>
                   6529:             </div>
                   6530: 
1.27      rillig   6531:             <p>The pkgsrc bmake program does not handle the
                   6532:             following assignment correctly. In case <code class=
                   6533:             "varname">_othervar_</code> contains a ``-'' character,
                   6534:             one of the closing braces is included in <code class=
                   6535:             "varname">${VAR}</code> after this code executes.</p>
                   6536:             <pre class="programlisting">
                   6537:         VAR:= ${VAR:N${_othervar_:C/-//}}
                   6538:       
1.1       grant    6539: </pre>
                   6540: 
1.27      rillig   6541:             <p>For a more complex code snippet and a workaround,
                   6542:             see the package <a xmlns=
                   6543:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   6544:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
                   6545:             class="pkgname">regress/make-quoting</a>, testcase
                   6546:             <code class="varname">bug1</code>.</p>
1.1       grant    6547:           </div>
                   6548:         </div>
                   6549:       </div>
                   6550: 
                   6551:       <div class="chapter" lang="en" xml:lang="en">
                   6552:         <div class="titlepage">
                   6553:           <div>
                   6554:             <div>
                   6555:               <h2 class="title"><a name="plist" id=
1.25      rillig   6556:               "plist"></a>Chapter&nbsp;9.&nbsp;PLIST issues</h2>
1.1       grant    6557:             </div>
                   6558:           </div>
                   6559:         </div>
                   6560: 
                   6561:         <div class="toc">
                   6562:           <p><b>Table of Contents</b></p>
                   6563: 
                   6564:           <dl>
1.30      wiz      6565:             <dt><span class="sect1"><a href="#rcs-id">9.1. RCS
1.1       grant    6566:             ID</a></span></dt>
                   6567: 
1.30      wiz      6568:             <dt><span class="sect1"><a href=
                   6569:             "#automatic-plist-generation">9.2. Semi-automatic
                   6570:             <code class="filename">PLIST</code>
1.14      xtraeme  6571:             generation</a></span></dt>
1.1       grant    6572: 
1.25      rillig   6573:             <dt><span class="sect1"><a href="#print-PLIST">9.3.
1.14      xtraeme  6574:             Tweaking output of <span><strong class="command">make
                   6575:             print-PLIST</strong></span></a></span></dt>
1.1       grant    6576: 
1.25      rillig   6577:             <dt><span class="sect1"><a href="#plist.misc">9.4.
1.1       grant    6578:             Variable substitution in PLIST</a></span></dt>
                   6579: 
1.30      wiz      6580:             <dt><span class="sect1"><a href=
                   6581:             "#manpage-compression">9.5.
1.1       grant    6582:             Manpage-compression</a></span></dt>
                   6583: 
1.30      wiz      6584:             <dt><span class="sect1"><a href="#using-PLIST_SRC">9.6.
1.14      xtraeme  6585:             Changing PLIST source with <code class=
                   6586:             "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    6587: 
1.30      wiz      6588:             <dt><span class="sect1"><a href=
                   6589:             "#platform-specific-plist">9.7. Platform specific and
                   6590:             differing PLISTs</a></span></dt>
1.1       grant    6591: 
1.25      rillig   6592:             <dt><span class="sect1"><a href="#faq.common-dirs">9.8.
1.1       grant    6593:             Sharing directories between packages</a></span></dt>
                   6594:           </dl>
                   6595:         </div>
                   6596: 
1.14      xtraeme  6597:         <p>The <code class="filename">PLIST</code> file contains a
1.1       grant    6598:         package's &#8220;<span class="quote">packing
                   6599:         list</span>&#8221;, i.e. a list of files that belong to the
1.14      xtraeme  6600:         package (relative to the <code class=
                   6601:         "filename">${PREFIX}</code> directory it's been installed
                   6602:         in) plus some additional statements - see the <a href=
1.1       grant    6603:         "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   6604:         <span class="citerefentry"><span class=
                   6605:         "refentrytitle">pkg_create</span>(1)</span></a> manpage for
                   6606:         a full list. This chapter addresses some issues that need
1.14      xtraeme  6607:         attention when dealing with the <code class=
                   6608:         "filename">PLIST</code> file (or files, see below!).</p>
1.1       grant    6609: 
                   6610:         <div class="sect1" lang="en" xml:lang="en">
                   6611:           <div class="titlepage">
                   6612:             <div>
                   6613:               <div>
                   6614:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      6615:                 "rcs-id" id="rcs-id"></a>9.1.&nbsp;RCS ID</h2>
1.1       grant    6616:               </div>
                   6617:             </div>
                   6618:           </div>
                   6619: 
                   6620:           <p>Be sure to add a RCS ID line as the first thing in any
1.14      xtraeme  6621:           <code class="filename">PLIST</code> file you write:</p>
1.1       grant    6622:           <pre class="programlisting">
1.17      sketch   6623: @comment $NetBSD$
1.1       grant    6624: </pre>
                   6625:         </div>
                   6626: 
                   6627:         <div class="sect1" lang="en" xml:lang="en">
                   6628:           <div class="titlepage">
                   6629:             <div>
                   6630:               <div>
                   6631:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      6632:                 "automatic-plist-generation" id=
                   6633:                 "automatic-plist-generation"></a>9.2.&nbsp;Semi-automatic
1.14      xtraeme  6634:                 <code class="filename">PLIST</code> generation</h2>
1.1       grant    6635:               </div>
                   6636:             </div>
                   6637:           </div>
                   6638: 
1.14      xtraeme  6639:           <p>You can use the <span><strong class="command">make
                   6640:           print-PLIST</strong></span> command to output a PLIST
                   6641:           that matches any new files since the package was
                   6642:           extracted. See <a href="#build.helpful-targets" title=
1.35      jmmv     6643:           "13.3.&nbsp;Other helpful targets">Section&nbsp;13.3,
1.1       grant    6644:           &#8220;Other helpful targets&#8221;</a> for more
                   6645:           information on this target.</p>
                   6646:         </div>
                   6647: 
                   6648:         <div class="sect1" lang="en" xml:lang="en">
                   6649:           <div class="titlepage">
                   6650:             <div>
                   6651:               <div>
                   6652:                 <h2 class="title" style="clear: both"><a name=
                   6653:                 "print-PLIST" id=
1.25      rillig   6654:                 "print-PLIST"></a>9.3.&nbsp;Tweaking output of
1.14      xtraeme  6655:                 <span><strong class="command">make
                   6656:                 print-PLIST</strong></span></h2>
1.1       grant    6657:               </div>
                   6658:             </div>
                   6659:           </div>
                   6660: 
                   6661:           <p>If you have used any of the *-dirs packages, as
                   6662:           explained in <a href="#faq.common-dirs" title=
1.25      rillig   6663:           "9.8.&nbsp;Sharing directories between packages">Section&nbsp;9.8,
1.1       grant    6664:           &#8220;Sharing directories between packages&#8221;</a>,
1.14      xtraeme  6665:           you may have noticed that <span><strong class=
                   6666:           "command">make print-PLIST</strong></span> outputs a set
                   6667:           of <code class="varname">@comment</code>s instead of real
                   6668:           <code class="varname">@dirrm</code> lines. You can also
                   6669:           do this for specific directories and files, so that the
                   6670:           results of that command are very close to reality. This
                   6671:           helps <span class="emphasis"><em>a lot</em></span> during
                   6672:           the update of packages.</p>
                   6673: 
                   6674:           <p>The <code class="varname">PRINT_PLIST_AWK</code>
                   6675:           variable takes a set of AWK patterns and actions that are
                   6676:           used to filter the output of print-PLIST. You can
                   6677:           <span class="emphasis"><em>append</em></span> any chunk
                   6678:           of AWK scripting you like to it, but be careful with
1.1       grant    6679:           quoting.</p>
                   6680: 
1.14      xtraeme  6681:           <p>For example, to get all files inside the <code class=
                   6682:           "filename">libdata/foo</code> directory removed from the
1.1       grant    6683:           resulting PLIST:</p>
                   6684:           <pre class="programlisting">
                   6685:       PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
                   6686:     
                   6687: </pre>
                   6688: 
1.14      xtraeme  6689:           <p>And to get all the <code class="varname">@dirrm</code>
1.1       grant    6690:           lines referring to a specific (shared) directory
1.14      xtraeme  6691:           converted to <code class="varname">@comment</code>s:</p>
1.1       grant    6692:           <pre class="programlisting">
                   6693:       PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
                   6694:     
                   6695: </pre>
                   6696:         </div>
                   6697: 
                   6698:         <div class="sect1" lang="en" xml:lang="en">
                   6699:           <div class="titlepage">
                   6700:             <div>
                   6701:               <div>
                   6702:                 <h2 class="title" style="clear: both"><a name=
1.25      rillig   6703:                 "plist.misc" id="plist.misc"></a>9.4.&nbsp;Variable
1.1       grant    6704:                 substitution in PLIST</h2>
                   6705:               </div>
                   6706:             </div>
                   6707:           </div>
                   6708: 
                   6709:           <p>A number of variables are substituted automatically in
                   6710:           PLISTs when a package is installed on a system. This
                   6711:           includes the following variables:</p>
                   6712: 
                   6713:           <div class="variablelist">
                   6714:             <dl>
1.14      xtraeme  6715:               <dt><span class="term"><code class=
                   6716:               "varname">${MACHINE_ARCH}</code>, <code class=
                   6717:               "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1       grant    6718: 
                   6719:               <dd>
                   6720:                 <p>Some packages like emacs and perl embed
                   6721:                 information about which architecture they were
                   6722:                 built on into the pathnames where they install
                   6723:                 their file. To handle this case, PLIST will be
                   6724:                 preprocessed before actually used, and the symbol
1.14      xtraeme  6725:                 &#8220;<span class="quote"><code class=
                   6726:                 "varname">${MACHINE_ARCH}</code></span>&#8221; will
                   6727:                 be replaced by what <span><strong class=
                   6728:                 "command">uname -p</strong></span> gives. The same
                   6729:                 is done if the string <code class=
                   6730:                 "varname">${MACHINE_GNU_ARCH}</code> is embedded in
                   6731:                 PLIST somewhere - use this on packages that have
                   6732:                 GNU autoconf created configure scripts.</p>
1.1       grant    6733: 
                   6734:                 <div class="note" style=
                   6735:                 "margin-left: 0.5in; margin-right: 0.5in;">
                   6736:                   <h3 class="title">Legacy note</h3>
                   6737: 
                   6738:                   <p>There used to be a symbol &#8220;<span class=
1.14      xtraeme  6739:                   "quote"><code class=
                   6740:                   "varname">$ARCH</code></span>&#8221; that was
                   6741:                   replaced by the output of <span><strong class=
                   6742:                   "command">uname -m</strong></span>, but that's no
1.1       grant    6743:                   longer supported and has been removed.</p>
                   6744:                 </div>
                   6745:               </dd>
                   6746: 
1.14      xtraeme  6747:               <dt><span class="term"><code class=
                   6748:               "varname">${OPSYS}</code>, <code class=
                   6749:               "varname">${LOWER_OPSYS}</code>, <code class=
                   6750:               "varname">${OS_VERSION}</code></span></dt>
1.1       grant    6751: 
                   6752:               <dd>
                   6753:                 <p>Some packages want to embed the OS name and
                   6754:                 version into some paths. To do this, use these
1.14      xtraeme  6755:                 variables in the <code class=
                   6756:                 "filename">PLIST</code>:</p>
1.1       grant    6757: 
                   6758:                 <div class="itemizedlist">
                   6759:                   <ul type="disc">
                   6760:                     <li>
1.14      xtraeme  6761:                       <p><code class="varname">${OPSYS}</code> -
                   6762:                       output of &#8220;<span class=
                   6763:                       "quote"><span><strong class="command">uname
                   6764:                       -s</strong></span></span>&#8221;</p>
1.1       grant    6765:                     </li>
                   6766: 
                   6767:                     <li>
1.14      xtraeme  6768:                       <p><code class=
                   6769:                       "varname">${LOWER_OPSYS}</code> - lowercase
                   6770:                       common name (eg. &#8220;<span class=
                   6771:                       "quote">solaris</span>&#8221;)</p>
1.1       grant    6772:                     </li>
                   6773: 
                   6774:                     <li>
1.14      xtraeme  6775:                       <p><code class="varname">${OS_VERSION}</code>
                   6776:                       - &#8220;<span class=
                   6777:                       "quote"><span><strong class="command">uname
                   6778:                       -r</strong></span></span>&#8221;</p>
1.1       grant    6779:                     </li>
                   6780:                   </ul>
                   6781:                 </div>
                   6782:               </dd>
                   6783: 
1.14      xtraeme  6784:               <dt><span class="term"><code class=
                   6785:               "varname">${PKGLOCALEDIR}</code></span></dt>
1.1       grant    6786: 
                   6787:               <dd>
                   6788:                 <p>Packages that install locale files should list
                   6789:                 them in the PLIST as &#8220;<span class=
                   6790:                 "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>&#8221;
                   6791:                 instead of &#8220;<span class=
                   6792:                 "quote">share/locale/de/LC_MESSAGES/...</span>&#8221;.
                   6793:                 This properly handles the fact that different
                   6794:                 operating systems expect locale files to be either
1.14      xtraeme  6795:                 in <code class="filename">share</code> or
                   6796:                 <code class="filename">lib</code> by default.</p>
1.1       grant    6797:               </dd>
                   6798:             </dl>
                   6799:           </div>
                   6800: 
                   6801:           <p>For a complete list of values which are replaced by
1.14      xtraeme  6802:           default, please look in <code class=
                   6803:           "filename">bsd.pkg.mk</code> (and search for <span class=
1.1       grant    6804:           "emphasis"><em>PLIST_SUBST</em></span>).</p>
                   6805: 
                   6806:           <p>If you want to change other variables not listed
                   6807:           above, you can add variables and their expansions to this
1.14      xtraeme  6808:           variable in the following way, similar to <code class=
                   6809:           "varname">MESSAGE_SUBST</code> (see <a href=
1.1       grant    6810:           "#components.optional" title=
1.27      rillig   6811:           "7.5.&nbsp;Optional files">Section&nbsp;7.5,
1.1       grant    6812:           &#8220;Optional files&#8221;</a>):</p>
                   6813:           <pre class="programlisting">
                   6814: PLIST_SUBST+=    SOMEVAR="somevalue"
                   6815: </pre>
                   6816: 
                   6817:           <p>This replaces all occurrences of &#8220;<span class=
                   6818:           "quote">${SOMEVAR}</span>&#8221; in the PLIST with
                   6819:           &#8220;<span class="quote">somevalue</span>&#8221;.</p>
                   6820:         </div>
                   6821: 
                   6822:         <div class="sect1" lang="en" xml:lang="en">
                   6823:           <div class="titlepage">
                   6824:             <div>
                   6825:               <div>
                   6826:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      6827:                 "manpage-compression" id=
                   6828:                 "manpage-compression"></a>9.5.&nbsp;Manpage-compression</h2>
1.1       grant    6829:               </div>
                   6830:             </div>
                   6831:           </div>
                   6832: 
                   6833:           <p>Manpages should be installed in compressed form if
1.14      xtraeme  6834:           <code class="varname">MANZ</code> is set (in <code class=
                   6835:           "filename">bsd.own.mk</code>), and uncompressed
                   6836:           otherwise. To handle this in the <code class=
                   6837:           "filename">PLIST</code> file, the suffix
                   6838:           &#8220;<span class="quote">.gz</span>&#8221; is
                   6839:           appended/removed automatically for manpages according to
                   6840:           <code class="varname">MANZ</code> and <code class=
                   6841:           "varname">MANCOMPRESSED</code> being set or not, see
                   6842:           above for details. This modification of the <code class=
                   6843:           "filename">PLIST</code> file is done on a copy of it, not
                   6844:           <code class="filename">PLIST</code> itself.</p>
1.1       grant    6845:         </div>
                   6846: 
                   6847:         <div class="sect1" lang="en" xml:lang="en">
                   6848:           <div class="titlepage">
                   6849:             <div>
                   6850:               <div>
                   6851:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      6852:                 "using-PLIST_SRC" id=
                   6853:                 "using-PLIST_SRC"></a>9.6.&nbsp;Changing PLIST
                   6854:                 source with <code class=
1.14      xtraeme  6855:                 "varname">PLIST_SRC</code></h2>
1.1       grant    6856:               </div>
                   6857:             </div>
                   6858:           </div>
                   6859: 
1.14      xtraeme  6860:           <p>To use one or more files as source for the
                   6861:           <code class="filename">PLIST</code> used in generating
                   6862:           the binary package, set the variable <code class=
                   6863:           "varname">PLIST_SRC</code> to the names of that file(s).
1.24      wiz      6864:           The files are later concatenated using <a href=
                   6865:           "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
                   6866:           <span class="citerefentry"><span class=
                   6867:           "refentrytitle">cat</span>(1)</span></a>, and order of
                   6868:           things is important.</p>
1.1       grant    6869:         </div>
                   6870: 
                   6871:         <div class="sect1" lang="en" xml:lang="en">
                   6872:           <div class="titlepage">
                   6873:             <div>
                   6874:               <div>
                   6875:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      6876:                 "platform-specific-plist" id=
                   6877:                 "platform-specific-plist"></a>9.7.&nbsp;Platform
1.1       grant    6878:                 specific and differing PLISTs</h2>
                   6879:               </div>
                   6880:             </div>
                   6881:           </div>
                   6882: 
                   6883:           <p>Some packages decide to install a different set of
                   6884:           files based on the operating system being used. These
                   6885:           differences can be automatically handled by using the
                   6886:           following files:</p>
                   6887: 
                   6888:           <div class="itemizedlist">
                   6889:             <ul type="disc">
                   6890:               <li>
1.14      xtraeme  6891:                 <p><code class="filename">PLIST.common</code></p>
1.1       grant    6892:               </li>
                   6893: 
                   6894:               <li>
1.14      xtraeme  6895:                 <p><code class="filename">PLIST.${OPSYS}</code></p>
1.1       grant    6896:               </li>
                   6897: 
                   6898:               <li>
1.14      xtraeme  6899:                 <p><code class=
1.21      ben      6900:                 "filename">PLIST.${MACHINE_ARCH}</code></p>
                   6901:               </li>
                   6902: 
                   6903:               <li>
                   6904:                 <p><code class=
                   6905:                 "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
                   6906:               </li>
                   6907: 
                   6908:               <li>
                   6909:                 <p><code class=
1.14      xtraeme  6910:                 "filename">PLIST.common_end</code></p>
1.1       grant    6911:               </li>
                   6912:             </ul>
                   6913:           </div>
                   6914:         </div>
                   6915: 
                   6916:         <div class="sect1" lang="en" xml:lang="en">
                   6917:           <div class="titlepage">
                   6918:             <div>
                   6919:               <div>
                   6920:                 <h2 class="title" style="clear: both"><a name=
                   6921:                 "faq.common-dirs" id=
1.25      rillig   6922:                 "faq.common-dirs"></a>9.8.&nbsp;Sharing directories
1.1       grant    6923:                 between packages</h2>
                   6924:               </div>
                   6925:             </div>
                   6926:           </div>
                   6927: 
                   6928:           <p>A &#8220;<span class="quote">shared
                   6929:           directory</span>&#8221; is a directory where multiple
                   6930:           (and unrelated) packages install files. These directories
                   6931:           are problematic because you have to add special tricks in
                   6932:           the PLIST to conditionally remove them, or have some
                   6933:           centralized package handle them.</p>
                   6934: 
                   6935:           <p>Within pkgsrc, you'll find both approaches. If a
                   6936:           directory is shared by a few unrelated packages, it's
                   6937:           often not worth to add an extra package to remove it.
                   6938:           Therefore, one simply does:</p>
                   6939:           <pre class="programlisting">
                   6940:       @unexec ${RMDIR} %D/path/to/shared/directory 2&gt;/dev/null || ${TRUE}
                   6941:     
                   6942: </pre>
                   6943: 
                   6944:           <p>in the PLISTs of all affected packages, instead of the
                   6945:           regular "@dirrm" line.</p>
                   6946: 
                   6947:           <p>However, if the directory is shared across many
                   6948:           packages, two different solutions are available:</p>
                   6949: 
                   6950:           <div class="orderedlist">
                   6951:             <ol type="1">
                   6952:               <li>
                   6953:                 <p>If the packages have a common dependency, the
                   6954:                 directory can be removed in that. For example, see
                   6955:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6956:                 href=
                   6957:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.20      ben      6958:                 class="pkgname">textproc/scrollkeeper</a>, which
                   6959:                 removes the shared directory <code class=
                   6960:                 "filename">share/omf</code>.</p>
1.1       grant    6961:               </li>
                   6962: 
                   6963:               <li>
                   6964:                 <p>If the packages using the directory are not
                   6965:                 related at all (they have no common dependencies),
                   6966:                 a *-dirs package is used.</p>
                   6967:               </li>
                   6968:             </ol>
                   6969:           </div>
                   6970: 
                   6971:           <p>From now on, we'll discuss the second solution. To get
                   6972:           an idea of the *-dirs packages available, issue:</p>
                   6973:           <pre class="programlisting">
1.14      xtraeme  6974:       <code class="prompt">%</code> cd .../pkgsrc
                   6975:       <code class="prompt">%</code> ls -d */*-dirs
1.1       grant    6976:     
                   6977: </pre>
                   6978: 
                   6979:           <p>Their use from other packages is very simple. The
1.14      xtraeme  6980:           <code class="varname">USE_DIRS</code> variable takes a
                   6981:           list of package names (without the &#8220;<span class=
1.1       grant    6982:           "quote">-dirs</span>&#8221; part) together with the
                   6983:           required version number (always pick the latest one when
1.34      wiz      6984:           writing new packages).</p>
1.1       grant    6985: 
                   6986:           <p>For example, if a package installs files under
1.14      xtraeme  6987:           <code class="filename">share/applications</code>, it
                   6988:           should have the following line in it:</p>
1.1       grant    6989:           <pre class="programlisting">
                   6990:       USE_DIRS+= xdg-1.1
                   6991:     
                   6992: </pre>
                   6993: 
1.14      xtraeme  6994:           <p>After regenerating the PLIST using
                   6995:           <span><strong class="command">make
                   6996:           print-PLIST</strong></span>, you should get the right
                   6997:           (commented out) lines.</p>
1.1       grant    6998: 
1.14      xtraeme  6999:           <p>Note that, even if your package is using <code class=
                   7000:           "filename">$X11BASE</code>, it must not depend on the
1.1       grant    7001:           *-x11-dirs packages. Just specify the name without that
1.14      xtraeme  7002:           part and pkgsrc (in particular, <code class=
                   7003:           "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1       grant    7004:         </div>
                   7005:       </div>
                   7006: 
                   7007:       <div class="chapter" lang="en" xml:lang="en">
                   7008:         <div class="titlepage">
                   7009:           <div>
                   7010:             <div>
                   7011:               <h2 class="title"><a name="buildlink" id=
1.25      rillig   7012:               "buildlink"></a>Chapter&nbsp;10.&nbsp;Buildlink
1.1       grant    7013:               methodology</h2>
                   7014:             </div>
                   7015:           </div>
                   7016:         </div>
                   7017: 
                   7018:         <div class="toc">
                   7019:           <p><b>Table of Contents</b></p>
                   7020: 
                   7021:           <dl>
1.30      wiz      7022:             <dt><span class="sect1"><a href=
                   7023:             "#converting-to-buildlink3">10.1. Converting packages
                   7024:             to use buildlink3</a></span></dt>
1.1       grant    7025: 
1.30      wiz      7026:             <dt><span class="sect1"><a href=
                   7027:             "#creating-buildlink3.mk">10.2. Writing <code class=
                   7028:             "filename">buildlink3.mk</code> files</a></span></dt>
1.1       grant    7029: 
                   7030:             <dd>
                   7031:               <dl>
1.25      rillig   7032:                 <dt><span class="sect2"><a href=
1.30      wiz      7033:                 "#anatomy-of-bl3">10.2.1. Anatomy of a
                   7034:                 buildlink3.mk file</a></span></dt>
1.1       grant    7035: 
1.25      rillig   7036:                 <dt><span class="sect2"><a href=
1.30      wiz      7037:                 "#updating-buildlink-depends">10.2.2. Updating
                   7038:                 <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14      xtraeme  7039:                 "replaceable"><code>pkg</code></em></code> in
                   7040:                 <code class="filename">buildlink3.mk</code>
1.1       grant    7041:                 files</a></span></dt>
                   7042:               </dl>
                   7043:             </dd>
                   7044: 
1.30      wiz      7045:             <dt><span class="sect1"><a href=
                   7046:             "#writing-builtin.mk">10.3. Writing <code class=
                   7047:             "filename">builtin.mk</code> files</a></span></dt>
1.1       grant    7048: 
                   7049:             <dd>
                   7050:               <dl>
1.25      rillig   7051:                 <dt><span class="sect2"><a href=
1.30      wiz      7052:                 "#anatomy-of-builtin.mk">10.3.1. Anatomy of a
                   7053:                 <code class="filename">builtin.mk</code>
                   7054:                 file</a></span></dt>
1.1       grant    7055: 
1.25      rillig   7056:                 <dt><span class="sect2"><a href=
1.30      wiz      7057:                 "#native-or-pkgsrc-preference">10.3.2. Global
                   7058:                 preferences for native or pkgsrc
                   7059:                 software</a></span></dt>
1.1       grant    7060:               </dl>
                   7061:             </dd>
                   7062:           </dl>
                   7063:         </div>
                   7064: 
                   7065:         <p>Buildlink is a framework in pkgsrc that controls what
                   7066:         headers and libraries are seen by a package's configure and
                   7067:         build processes. This is implemented in a two step
                   7068:         process:</p>
                   7069: 
                   7070:         <div class="orderedlist">
                   7071:           <ol type="1">
                   7072:             <li>
                   7073:               <p>Symlink headers and libraries for dependencies
1.14      xtraeme  7074:               into <code class="varname">BUILDLINK_DIR</code>,
                   7075:               which by default is a subdirectory of <code class=
                   7076:               "varname">WRKDIR</code>.</p>
1.1       grant    7077:             </li>
                   7078: 
                   7079:             <li>
                   7080:               <p>Create wrapper scripts that are used in place of
1.14      xtraeme  7081:               the normal compiler tools that translate <code class=
                   7082:               "option">-I${LOCALBASE}/include</code> and
                   7083:               <code class="option">-L${LOCALBASE}/lib</code> into
                   7084:               references to <code class=
                   7085:               "varname">BUILDLINK_DIR</code>. The wrapper scripts
                   7086:               also make native compiler on some operating systems
                   7087:               look like GCC, so that packages that expect GCC won't
                   7088:               require modifications to build with those native
                   7089:               compilers.</p>
1.1       grant    7090:             </li>
                   7091:           </ol>
                   7092:         </div>
                   7093: 
                   7094:         <p>This normalizes the environment in which a package is
                   7095:         built so that the package may be built consistently despite
                   7096:         what other software may be installed. Please note that the
1.14      xtraeme  7097:         normal system header and library paths, e.g. <code class=
                   7098:         "filename">/usr/include</code>, <code class=
                   7099:         "filename">/usr/lib</code>, etc., are always searched --
1.1       grant    7100:         buildlink3 is designed to insulate the package build from
                   7101:         non-system-supplied software.</p>
                   7102: 
                   7103:         <div class="sect1" lang="en" xml:lang="en">
                   7104:           <div class="titlepage">
                   7105:             <div>
                   7106:               <div>
                   7107:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      7108:                 "converting-to-buildlink3" id=
                   7109:                 "converting-to-buildlink3"></a>10.1.&nbsp;Converting
                   7110:                 packages to use buildlink3</h2>
1.1       grant    7111:               </div>
                   7112:             </div>
                   7113:           </div>
                   7114: 
                   7115:           <p>The process of converting packages to use the
                   7116:           buildlink3 framework (&#8220;<span class=
                   7117:           "quote">bl3ifying</span>&#8221;) is fairly
                   7118:           straightforward. The things to keep in mind are:</p>
                   7119: 
                   7120:           <div class="orderedlist">
                   7121:             <ol type="1">
                   7122:               <li>
                   7123:                 <p>Ensure that the build always calls the wrapper
                   7124:                 scripts instead of the actual toolchain. Some
                   7125:                 packages are tricky, and the only way to know for
1.14      xtraeme  7126:                 sure is the check <code class=
                   7127:                 "filename">${WRKDIR}/.work.log</code> to see if the
1.1       grant    7128:                 wrappers are being invoked.</p>
                   7129:               </li>
                   7130: 
                   7131:               <li>
1.14      xtraeme  7132:                 <p>Don't override <code class=
                   7133:                 "varname">PREFIX</code> from within the package
                   7134:                 Makefile, e.g. Java VMs, standalone shells, etc.,
                   7135:                 because the code to symlink files into <code class=
                   7136:                 "filename">${BUILDLINK_DIR}</code> looks for files
1.1       grant    7137:                 relative to &#8220;<span class="quote">pkg_info -qp
1.14      xtraeme  7138:                 <em class=
                   7139:                 "replaceable"><code>pkgname</code></em></span>&#8221;.</p>
1.1       grant    7140:               </li>
                   7141: 
                   7142:               <li>
                   7143:                 <p>Remember that <span class=
1.14      xtraeme  7144:                 "emphasis"><em>only</em></span> the <code class=
                   7145:                 "filename">buildlink3.mk</code> files that you list
1.1       grant    7146:                 in a package's Makefile are added as dependencies
                   7147:                 for that package.</p>
                   7148:               </li>
                   7149:             </ol>
                   7150:           </div>
                   7151: 
                   7152:           <p>If a dependency on a particular package is required
                   7153:           for its libraries and headers, then we replace:</p>
                   7154:           <pre class="programlisting">
1.27      rillig   7155: DEPENDS+=   foo&gt;=1.1.0:../../category/foo
1.1       grant    7156: </pre>
                   7157: 
                   7158:           <p>with</p>
                   7159:           <pre class="programlisting">
                   7160: .include "../../category/foo/buildlink3.mk"
                   7161: </pre>
                   7162: 
1.14      xtraeme  7163:           <p>There are several <code class=
                   7164:           "filename">buildlink3.mk</code> files in <code class=
                   7165:           "filename">pkgsrc/mk</code> that handle special package
1.1       grant    7166:           issues:</p>
                   7167: 
                   7168:           <div class="itemizedlist">
                   7169:             <ul type="disc">
                   7170:               <li>
1.14      xtraeme  7171:                 <p><code class="filename">bdb.buildlink3.mk</code>
1.1       grant    7172:                 chooses either the native or a pkgsrc Berkeley DB
1.14      xtraeme  7173:                 implementation based on the values of <code class=
                   7174:                 "varname">BDB_ACCEPTED</code> and <code class=
                   7175:                 "varname">BDB_DEFAULT</code>.</p>
1.1       grant    7176:               </li>
                   7177: 
                   7178:               <li>
1.14      xtraeme  7179:                 <p><code class=
                   7180:                 "filename">curses.buildlink3.mk</code> If the
                   7181:                 system comes with neither Curses nor NCurses, this
                   7182:                 will take care to install the <a xmlns=
                   7183:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    7184:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.20      ben      7185:                 class="pkgname">devel/ncurses</a> package.</p>
1.1       grant    7186:               </li>
                   7187: 
                   7188:               <li>
1.14      xtraeme  7189:                 <p><code class="filename">krb5.buildlink3.mk</code>
                   7190:                 uses the value of <code class=
                   7191:                 "varname">KRB5_ACCEPTED</code> to choose between
1.1       grant    7192:                 adding a dependency on Heimdal or MIT-krb5 for
                   7193:                 packages that require a Kerberos 5
                   7194:                 implementation.</p>
                   7195:               </li>
                   7196: 
                   7197:               <li>
1.14      xtraeme  7198:                 <p><code class=
                   7199:                 "filename">motif.buildlink3.mk</code> checks for a
                   7200:                 system-provided Motif installation or adds a
                   7201:                 dependency on <a xmlns=
1.1       grant    7202:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7203:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.20      ben      7204:                 class="pkgname">x11/lesstif</a> or <a xmlns=
                   7205:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7206:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
                   7207:                 class="pkgname">x11/openmotif</a>;</p>
1.1       grant    7208:               </li>
                   7209: 
                   7210:               <li>
1.14      xtraeme  7211:                 <p><code class=
                   7212:                 "filename">ossaudio.buildlink3.mk</code> defines
                   7213:                 several variables that may be used by packages that
                   7214:                 use the Open Sound System (OSS) API;</p>
1.1       grant    7215:               </li>
                   7216: 
                   7217:               <li>
1.14      xtraeme  7218:                 <p><code class=
                   7219:                 "filename">pgsql.buildlink3.mk</code> will accept
                   7220:                 either Postgres 7.3 or 7.4, whichever is found
                   7221:                 installed. See the file for more information.</p>
1.1       grant    7222:               </li>
                   7223: 
                   7224:               <li>
1.14      xtraeme  7225:                 <p><code class=
                   7226:                 "filename">pthread.buildlink3.mk</code> uses the
                   7227:                 value of <code class="varname">PTHREAD_OPTS</code>
                   7228:                 and checks for native pthreads or adds a dependency
                   7229:                 on <a xmlns=
1.1       grant    7230:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7231:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.20      ben      7232:                 class="pkgname">devel/pth</a> as needed;</p>
1.1       grant    7233:               </li>
                   7234: 
                   7235:               <li>
1.14      xtraeme  7236:                 <p><code class="filename">xaw.buildlink3.mk</code>
                   7237:                 uses the value of <code class=
                   7238:                 "varname">XAW_TYPE</code> to choose a particular
                   7239:                 Athena widgets library.</p>
1.1       grant    7240:               </li>
                   7241:             </ul>
                   7242:           </div>
                   7243: 
1.14      xtraeme  7244:           <p>The comments in those <code class=
                   7245:           "filename">buildlink3.mk</code> files provide a more
1.1       grant    7246:           complete description of how to use them properly.</p>
                   7247:         </div>
                   7248: 
                   7249:         <div class="sect1" lang="en" xml:lang="en">
                   7250:           <div class="titlepage">
                   7251:             <div>
                   7252:               <div>
                   7253:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      7254:                 "creating-buildlink3.mk" id=
                   7255:                 "creating-buildlink3.mk"></a>10.2.&nbsp;Writing
1.14      xtraeme  7256:                 <code class="filename">buildlink3.mk</code>
                   7257:                 files</h2>
1.1       grant    7258:               </div>
                   7259:             </div>
                   7260:           </div>
                   7261: 
1.14      xtraeme  7262:           <p>A package's <code class=
                   7263:           "filename">buildlink3.mk</code> file is included by
                   7264:           Makefiles to indicate the need to compile and link
                   7265:           against header files and libraries provided by the
                   7266:           package. A <code class="filename">buildlink3.mk</code>
                   7267:           file should always provide enough information to add the
                   7268:           correct type of dependency relationship and include any
                   7269:           other <code class="filename">buildlink3.mk</code> files
                   7270:           that it needs to find headers and libraries that it needs
                   7271:           in turn.</p>
1.1       grant    7272: 
1.14      xtraeme  7273:           <p>To generate an initial <code class=
                   7274:           "filename">buildlink3.mk</code> file for further editing,
1.1       grant    7275:           Rene Hexel's <a xmlns=
                   7276:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   7277:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.20      ben      7278:           class="pkgname">pkgtools/createbuildlink</a> package is
                   7279:           highly recommended. For most packages, the following
                   7280:           command will generate a good starting point for
                   7281:           <code class="filename">buildlink3.mk</code> files:</p>
1.1       grant    7282:           <pre class="screen">
1.14      xtraeme  7283: <code class="prompt">%</code> <strong class=
                   7284: "userinput"><code>cd pkgsrc/<em class=
                   7285: "replaceable"><code>category</code></em>/<em class=
                   7286: "replaceable"><code>pkgdir</code></em>
                   7287: <code class=
                   7288: "prompt">%</code> createbuildlink -3 &gt;buildlink3.mk</code></strong>
1.1       grant    7289: </pre>
                   7290: 
                   7291:           <div class="sect2" lang="en" xml:lang="en">
                   7292:             <div class="titlepage">
                   7293:               <div>
                   7294:                 <div>
1.30      wiz      7295:                   <h3 class="title"><a name="anatomy-of-bl3" id=
                   7296:                   "anatomy-of-bl3"></a>10.2.1. Anatomy of a
1.25      rillig   7297:                   buildlink3.mk file</h3>
1.1       grant    7298:                 </div>
                   7299:               </div>
                   7300:             </div>
                   7301: 
1.14      xtraeme  7302:             <p>The following real-life example <code class=
                   7303:             "filename">buildlink3.mk</code> is taken from
                   7304:             <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1       grant    7305:             <pre class="programlisting">
1.17      sketch   7306: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1       grant    7307: 
                   7308: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH}+
                   7309: TIFF_BUILDLINK3_MK:=    ${TIFF_BUILDLINK3_MK}+
                   7310: 
                   7311: .if !empty(BUILDLINK_DEPTH:M+)
                   7312: BUILDLINK_DEPENDS+=     tiff
                   7313: .endif
                   7314: 
                   7315: BUILDLINK_PACKAGES:=    ${BUILDLINK_PACKAGES:Ntiff}
                   7316: BUILDLINK_PACKAGES+=    tiff
                   7317: 
                   7318: .if !empty(TIFF_BUILDLINK3_MK:M+)
                   7319: BUILDLINK_DEPENDS.tiff+=        tiff&gt;=3.6.1
                   7320: BUILDLINK_PKGSRCDIR.tiff?=      ../../graphics/tiff
                   7321: .endif  # TIFF_BUILDLINK3_MK
                   7322: 
                   7323: .include "../../devel/zlib/buildlink3.mk"
                   7324: .include "../../graphics/jpeg/buildlink3.mk"
                   7325: 
                   7326: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH:S/+$//} 
                   7327: </pre>
                   7328: 
1.14      xtraeme  7329:             <p>The header and footer manipulate <code class=
                   7330:             "varname">BUILDLINK_DEPTH</code>, which is common
                   7331:             across all <code class="filename">buildlink3.mk</code>
                   7332:             files and is used to track at what depth we are
                   7333:             including <code class="filename">buildlink3.mk</code>
                   7334:             files.</p>
1.1       grant    7335: 
                   7336:             <p>The first section controls if the dependency on
1.14      xtraeme  7337:             <em class="replaceable"><code>pkg</code></em> is added.
                   7338:             <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1       grant    7339:             global list of packages for which dependencies are
                   7340:             added by buildlink3.</p>
                   7341: 
                   7342:             <p>The second section advises pkgsrc that the
1.14      xtraeme  7343:             <code class="filename">buildlink3.mk</code> file for
                   7344:             <em class="replaceable"><code>pkg</code></em> has been
                   7345:             included at some point. <code class=
                   7346:             "varname">BUILDLINK_PACKAGES</code> is the global list
                   7347:             of packages for which <code class=
                   7348:             "filename">buildlink3.mk</code> files have been
                   7349:             included. It must <span class=
                   7350:             "emphasis"><em>always</em></span> be appended to within
                   7351:             a <code class="filename">buildlink3.mk</code> file.</p>
1.1       grant    7352: 
                   7353:             <p>The third section is protected from multiple
1.14      xtraeme  7354:             inclusion and controls how the dependency on <em class=
                   7355:             "replaceable"><code>pkg</code></em> is added. Several
1.1       grant    7356:             important variables are set in the section:</p>
                   7357: 
                   7358:             <div class="itemizedlist">
                   7359:               <ul type="disc">
                   7360:                 <li>
1.14      xtraeme  7361:                   <p><code class=
                   7362:                   "varname">BUILDLINK_DEPENDS.<em class=
                   7363:                   "replaceable"><code>pkg</code></em></code> is the
                   7364:                   actual dependency recorded in the installed
                   7365:                   package; this should always be set using
                   7366:                   <span><strong class="command">+=</strong></span>
                   7367:                   to ensure that we're appending to any
                   7368:                   pre-existing list of values. This variable should
                   7369:                   be set to the first version of the package that
                   7370:                   had the last change in the major number of a
                   7371:                   shared library or that had a major API
                   7372:                   change.</p>
1.1       grant    7373:                 </li>
                   7374: 
                   7375:                 <li>
1.14      xtraeme  7376:                   <p><code class=
                   7377:                   "varname">BUILDLINK_PKGSRCDIR.<em class=
                   7378:                   "replaceable"><code>pkg</code></em></code> is the
                   7379:                   location of the <em class=
                   7380:                   "replaceable"><code>pkg</code></em> pkgsrc
1.1       grant    7381:                   directory;</p>
                   7382:                 </li>
                   7383: 
                   7384:                 <li>
1.14      xtraeme  7385:                   <p><code class=
                   7386:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   7387:                   "replaceable"><code>pkg</code></em></code> (not
                   7388:                   shown above) controls whether we use <code class=
                   7389:                   "varname">BUILD_DEPENDS</code> or <code class=
                   7390:                   "varname">DEPENDS</code> to add the dependency on
                   7391:                   <em class="replaceable"><code>pkg</code></em>.
                   7392:                   The build dependency is selected by setting
                   7393:                   <code class=
                   7394:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   7395:                   "replaceable"><code>pkg</code></em></code> to
1.1       grant    7396:                   &#8220;<span class="quote">build</span>&#8221;.
                   7397:                   By default, the full dependency is used.</p>
                   7398:                 </li>
                   7399: 
                   7400:                 <li>
1.14      xtraeme  7401:                   <p><code class=
                   7402:                   "varname">BUILDLINK_INCDIRS.<em class=
                   7403:                   "replaceable"><code>pkg</code></em></code> and
                   7404:                   <code class=
                   7405:                   "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
                   7406:                   <code>pkg</code></em></code> (not shown above)
                   7407:                   are lists of subdirectories of <code class=
                   7408:                   "filename">${BUILDLINK_PREFIX.<em class=
                   7409:                   "replaceable"><code>pkg</code></em>}</code> to
                   7410:                   add to the header and library search paths. These
1.1       grant    7411:                   default to &#8220;<span class=
                   7412:                   "quote">include</span>&#8221; and
                   7413:                   &#8220;<span class="quote">lib</span>&#8221;
                   7414:                   respectively.</p>
                   7415:                 </li>
                   7416: 
                   7417:                 <li>
1.14      xtraeme  7418:                   <p><code class=
                   7419:                   "varname">BUILDLINK_CPPFLAGS.<em class=
                   7420:                   "replaceable"><code>pkg</code></em></code> (not
                   7421:                   shown above) is the list of preprocessor flags to
                   7422:                   add to <code class="varname">CPPFLAGS</code>,
                   7423:                   which are passed on to the configure and build
                   7424:                   phases. The &#8220;<span class=
                   7425:                   "quote">-I</span>&#8221; option should be avoided
                   7426:                   and instead be handled using <code class=
                   7427:                   "varname">BUILDLINK_INCDIRS.<em class=
                   7428:                   "replaceable"><code>pkg</code></em></code> as
                   7429:                   above.</p>
1.1       grant    7430:                 </li>
                   7431:               </ul>
                   7432:             </div>
                   7433: 
                   7434:             <p>The following variables are all optionally defined
                   7435:             within this second section (protected against multiple
                   7436:             inclusion) and control which package files are
1.14      xtraeme  7437:             symlinked into <code class=
                   7438:             "filename">${BUILDLINK_DIR}</code> and how their names
1.1       grant    7439:             are transformed during the symlinking:</p>
                   7440: 
                   7441:             <div class="itemizedlist">
                   7442:               <ul type="disc">
                   7443:                 <li>
1.14      xtraeme  7444:                   <p><code class=
                   7445:                   "varname">BUILDLINK_FILES.<em class=
                   7446:                   "replaceable"><code>pkg</code></em></code> (not
                   7447:                   shown above) is a shell glob pattern relative to
                   7448:                   <code class=
                   7449:                   "filename">${BUILDLINK_PREFIX.<em class=
                   7450:                   "replaceable"><code>pkg</code></em>}</code> to be
                   7451:                   symlinked into <code class=
                   7452:                   "filename">${BUILDLINK_DIR}</code>, e.g.
                   7453:                   <code class="filename">include/*.h</code>.</p>
1.1       grant    7454:                 </li>
                   7455: 
                   7456:                 <li>
1.14      xtraeme  7457:                   <p><code class=
                   7458:                   "varname">BUILDLINK_FILES_CMD.<em class=
                   7459:                   "replaceable"><code>pkg</code></em></code> (not
                   7460:                   shown above) is a shell pipeline that outputs to
                   7461:                   stdout a list of files relative to <code class=
                   7462:                   "filename">${BUILDLINK_PREFIX.<em class=
                   7463:                   "replaceable"><code>pkg</code></em>}</code>. The
1.1       grant    7464:                   resulting files are to be symlinked into
1.14      xtraeme  7465:                   <code class="filename">${BUILDLINK_DIR}</code>.
                   7466:                   By default, this takes the <code class=
                   7467:                   "filename">+CONTENTS</code> of a <em class=
                   7468:                   "replaceable"><code>pkg</code></em> and filters
                   7469:                   it through <code class=
                   7470:                   "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
                   7471:                   "replaceable"><code>pkg</code></em>}</code>.</p>
1.1       grant    7472:                 </li>
                   7473: 
                   7474:                 <li>
1.14      xtraeme  7475:                   <p><code class=
                   7476:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   7477:                   "replaceable"><code>pkg</code></em></code> (not
                   7478:                   shown above) is a filter command that filters
                   7479:                   <code class="filename">+CONTENTS</code> input
                   7480:                   into a list of files relative to <code class=
                   7481:                   "filename">${BUILDLINK_PREFIX.<em class=
                   7482:                   "replaceable"><code>pkg</code></em>}</code> on
                   7483:                   stdout. By default for overwrite packages,
                   7484:                   <code class=
                   7485:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   7486:                   "replaceable"><code>pkg</code></em></code>
                   7487:                   outputs the contents of the <code class=
                   7488:                   "filename">include</code> and <code class=
                   7489:                   "filename">lib</code> directories in the package
                   7490:                   <code class="filename">+CONTENTS</code>, and for
                   7491:                   pkgviews packages, it outputs any libtool
                   7492:                   archives in <code class="filename">lib</code>
1.1       grant    7493:                   directories.</p>
                   7494:                 </li>
                   7495: 
                   7496:                 <li>
1.14      xtraeme  7497:                   <p><code class=
                   7498:                   "varname">BUILDLINK_TRANSFORM.<em class=
                   7499:                   "replaceable"><code>pkg</code></em></code> (not
                   7500:                   shown above) is a list of sed arguments used to
1.1       grant    7501:                   transform the name of the source filename into a
1.14      xtraeme  7502:                   destination filename, e.g. <span><strong class=
1.1       grant    7503:                   "command">-e
1.14      xtraeme  7504:                   "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1       grant    7505:                 </li>
                   7506:               </ul>
                   7507:             </div>
                   7508: 
1.14      xtraeme  7509:             <p>The last section includes any <code class=
                   7510:             "filename">buildlink3.mk</code> needed for <em class=
                   7511:             "replaceable"><code>pkg</code></em>'s library
                   7512:             dependencies. Including these <code class=
                   7513:             "filename">buildlink3.mk</code> files means that the
                   7514:             headers and libraries for these dependencies are also
                   7515:             symlinked into <code class=
                   7516:             "filename">${BUILDLINK_DIR}</code> whenever the
                   7517:             <em class="replaceable"><code>pkg</code></em>
                   7518:             <code class="filename">buildlink3.mk</code> file is
                   7519:             included.</p>
1.1       grant    7520:           </div>
                   7521: 
                   7522:           <div class="sect2" lang="en" xml:lang="en">
                   7523:             <div class="titlepage">
                   7524:               <div>
                   7525:                 <div>
1.30      wiz      7526:                   <h3 class="title"><a name=
                   7527:                   "updating-buildlink-depends" id=
                   7528:                   "updating-buildlink-depends"></a>10.2.2. Updating
                   7529:                   <code class=
                   7530:                   "varname">BUILDLINK_DEPENDS.<em class="replaceable">
                   7531:                   <code>pkg</code></em></code> in <code class=
                   7532:                   "filename">buildlink3.mk</code> files</h3>
1.1       grant    7533:                 </div>
                   7534:               </div>
                   7535:             </div>
                   7536: 
                   7537:             <p>There are two situations that require increasing the
1.14      xtraeme  7538:             dependency listed in <code class=
                   7539:             "varname">BUILDLINK_DEPENDS.<em class=
                   7540:             "replaceable"><code>pkg</code></em></code> after a
                   7541:             package update:</p>
1.1       grant    7542: 
                   7543:             <div class="orderedlist">
                   7544:               <ol type="1">
                   7545:                 <li>
                   7546:                   <p>if the sonames (major number of the library
                   7547:                   version) of any installed shared libraries
                   7548:                   change;</p>
                   7549:                 </li>
                   7550: 
                   7551:                 <li>
                   7552:                   <p>if the API or interface to the header files
                   7553:                   change.</p>
                   7554:                 </li>
                   7555:               </ol>
                   7556:             </div>
                   7557: 
1.14      xtraeme  7558:             <p>In these cases, <code class=
                   7559:             "varname">BUILDLINK_DEPENDS.<em class=
                   7560:             "replaceable"><code>pkg</code></em></code> should be
                   7561:             adjusted to require at least the new package version.
                   7562:             In some cases, the packages that depend on this new
                   7563:             version may need their <code class=
                   7564:             "varname">PKGREVISION</code>s increased and, if they
                   7565:             have <code class="filename">buildlink3.mk</code> files,
                   7566:             their <code class=
                   7567:             "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>
                   7568:             pkg</code></em></code> adjusted, too. This is needed so
                   7569:             that binary packages made using it will require the
                   7570:             correct package dependency and not settle for an older
                   7571:             one which will not contain the necessary shared
                   7572:             libraries.</p>
1.1       grant    7573: 
                   7574:             <p>Please take careful consideration before adjusting
1.14      xtraeme  7575:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   7576:             "replaceable"><code>pkg</code></em></code> as we don't
                   7577:             want to cause unneeded package deletions and rebuilds.
                   7578:             In many cases, new versions of packages work just fine
                   7579:             with older dependencies. See <a href="#dependencies"
1.35      jmmv     7580:             title="14.1.4.&nbsp;Handling dependencies">Section
1.36      wiz      7581:             14.1.4, &#8220;Handling dependencies&#8221;</a> for
                   7582:             more information about dependencies on other packages,
1.25      rillig   7583:             including the <code class=
                   7584:             "varname">BUILDLINK_RECOMMENDED</code> and <code class=
                   7585:             "varname">RECOMMENDED</code> definitions.</p>
1.1       grant    7586:           </div>
                   7587:         </div>
                   7588: 
                   7589:         <div class="sect1" lang="en" xml:lang="en">
                   7590:           <div class="titlepage">
                   7591:             <div>
                   7592:               <div>
                   7593:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      7594:                 "writing-builtin.mk" id=
                   7595:                 "writing-builtin.mk"></a>10.3.&nbsp;Writing
1.14      xtraeme  7596:                 <code class="filename">builtin.mk</code> files</h2>
1.1       grant    7597:               </div>
                   7598:             </div>
                   7599:           </div>
                   7600: 
                   7601:           <p>Some packages in pkgsrc install headers and libraries
                   7602:           that coincide with headers and libraries present in the
1.14      xtraeme  7603:           base system. Aside from a <code class=
                   7604:           "filename">buildlink3.mk</code> file, these packages
                   7605:           should also include a <code class=
                   7606:           "filename">builtin.mk</code> file that includes the
                   7607:           necessary checks to decide whether using the built-in
                   7608:           software or the pkgsrc software is appropriate.</p>
1.1       grant    7609: 
                   7610:           <p>The only requirements of a builtin.mk file for
1.14      xtraeme  7611:           <em class="replaceable"><code>pkg</code></em> are:</p>
1.1       grant    7612: 
                   7613:           <div class="orderedlist">
                   7614:             <ol type="1">
                   7615:               <li>
1.14      xtraeme  7616:                 <p>It should set <code class=
                   7617:                 "varname">USE_BUILTIN.<em class=
                   7618:                 "replaceable"><code>pkg</code></em></code> to
                   7619:                 either &#8220;<span class="quote">yes</span>&#8221;
                   7620:                 or &#8220;<span class="quote">no</span>&#8221;
                   7621:                 after it is included.</p>
1.1       grant    7622:               </li>
                   7623: 
                   7624:               <li>
                   7625:                 <p>It should <span class=
                   7626:                 "emphasis"><em>not</em></span> override any
1.14      xtraeme  7627:                 <code class="varname">USE_BUILTIN.<em class=
                   7628:                 "replaceable"><code>pkg</code></em></code> which is
                   7629:                 already set before the <code class=
                   7630:                 "filename">builtin.mk</code> file is included.</p>
1.1       grant    7631:               </li>
                   7632: 
                   7633:               <li>
                   7634:                 <p>It should be written to allow multiple
                   7635:                 inclusion. This is <span class=
                   7636:                 "emphasis"><em>very</em></span> important and takes
1.14      xtraeme  7637:                 careful attention to <code class=
                   7638:                 "filename">Makefile</code> coding.</p>
1.1       grant    7639:               </li>
                   7640:             </ol>
                   7641:           </div>
                   7642: 
                   7643:           <div class="sect2" lang="en" xml:lang="en">
                   7644:             <div class="titlepage">
                   7645:               <div>
                   7646:                 <div>
1.30      wiz      7647:                   <h3 class="title"><a name="anatomy-of-builtin.mk"
                   7648:                   id=
                   7649:                   "anatomy-of-builtin.mk"></a>10.3.1.&nbsp;Anatomy
                   7650:                   of a <code class="filename">builtin.mk</code>
1.14      xtraeme  7651:                   file</h3>
1.1       grant    7652:                 </div>
                   7653:               </div>
                   7654:             </div>
                   7655: 
                   7656:             <p>The following is the recommended template for
                   7657:             builtin.mk files:</p>
                   7658:             <pre class="programlisting">
                   7659: .if !defined(IS_BUILTIN.foo)
                   7660: #
                   7661: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
                   7662: # genuinely exists in the system or not.
                   7663: #
                   7664: IS_BUILTIN.foo?=        no
                   7665: 
                   7666: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
                   7667: # version can be determined.
                   7668: #
                   7669: .  if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
                   7670: BUILTIN_PKG.foo?=       foo-1.0
                   7671: .  endif
                   7672: .endif  # IS_BUILTIN.foo
                   7673: 
                   7674: .if !defined(USE_BUILTIN.foo)
                   7675: USE_BUILTIN.foo?=       ${IS_BUILTIN.foo}
                   7676: .  if defined(BUILTIN_PKG.foo)
                   7677: .    for _depend_ in ${BUILDLINK_DEPENDS.foo}
                   7678: .      if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
                   7679: USE_BUILTIN.foo!=                                                       \
                   7680:       if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then     \
                   7681:               ${ECHO} "yes";                                            \
                   7682:       else                                                              \
                   7683:               ${ECHO} "no";                                             \
                   7684:       fi
                   7685: .      endif
                   7686: .    endfor
                   7687: .  endif
                   7688: .endif  # USE_BUILTIN.foo
                   7689: 
                   7690: CHECK_BUILTIN.foo?=     no
                   7691: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
                   7692: #
                   7693: # Here we place code that depends on whether USE_BUILTIN.foo is set to
                   7694: # "yes" or "no".
                   7695: #
                   7696: .endif  # CHECK_BUILTIN.foo
                   7697:       
                   7698: </pre>
                   7699: 
1.14      xtraeme  7700:             <p>The first section sets <code class=
                   7701:             "varname">IS_BUILTIN.<em class=
                   7702:             "replaceable"><code>pkg</code></em></code> depending on
                   7703:             if <em class="replaceable"><code>pkg</code></em> really
                   7704:             exists in the base system. This should not be a base
                   7705:             system software with similar functionality to
                   7706:             <em class="replaceable"><code>pkg</code></em>; it
                   7707:             should only be &#8220;<span class=
                   7708:             "quote">yes</span>&#8221; if the actual package is
                   7709:             included as part of the base system. This variable is
                   7710:             only used internally within the <code class=
                   7711:             "filename">builtin.mk</code> file.</p>
                   7712: 
                   7713:             <p>The second section sets <code class=
                   7714:             "varname">BUILTIN_PKG.<em class=
                   7715:             "replaceable"><code>pkg</code></em></code> to the
                   7716:             version of <em class=
                   7717:             "replaceable"><code>pkg</code></em> in the base system
                   7718:             if it exists (if <code class=
                   7719:             "varname">IS_BUILTIN.<em class=
                   7720:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    7721:             &#8220;<span class="quote">yes</span>&#8221;). This
1.14      xtraeme  7722:             variable is only used internally within the
                   7723:             <code class="filename">builtin.mk</code> file.</p>
1.1       grant    7724: 
1.14      xtraeme  7725:             <p>The third section sets <code class=
                   7726:             "varname">USE_BUILTIN.<em class=
                   7727:             "replaceable"><code>pkg</code></em></code> and is
                   7728:             <span class="emphasis"><em>required</em></span> in all
                   7729:             <code class="filename">builtin.mk</code> files. The
                   7730:             code in this section must make the determination
                   7731:             whether the built-in software is adequate to satisfy
                   7732:             the dependencies listed in <code class=
                   7733:             "varname">BUILDLINK_DEPENDS.<em class=
                   7734:             "replaceable"><code>pkg</code></em></code>. This is
                   7735:             typically done by comparing <code class=
                   7736:             "varname">BUILTIN_PKG.<em class=
                   7737:             "replaceable"><code>pkg</code></em></code> against each
                   7738:             of the dependencies in <code class=
                   7739:             "varname">BUILDLINK_DEPENDS.<em class=
                   7740:             "replaceable"><code>pkg</code></em></code>.
                   7741:             <code class="varname">USE_BUILTIN.<em class=
                   7742:             "replaceable"><code>pkg</code></em></code> <span class=
1.1       grant    7743:             "emphasis"><em>must</em></span> be set to the correct
1.14      xtraeme  7744:             value by the end of the <code class=
                   7745:             "filename">builtin.mk</code> file. Note that
                   7746:             <code class="varname">USE_BUILTIN.<em class=
                   7747:             "replaceable"><code>pkg</code></em></code> may be
1.1       grant    7748:             &#8220;<span class="quote">yes</span>&#8221; even if
1.14      xtraeme  7749:             <code class="varname">IS_BUILTIN.<em class=
                   7750:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    7751:             &#8220;<span class="quote">no</span>&#8221; because we
                   7752:             may make the determination that the built-in version of
                   7753:             the software is similar enough to be used as a
                   7754:             replacement.</p>
                   7755: 
1.14      xtraeme  7756:             <p>The last section is guarded by <code class=
                   7757:             "varname">CHECK_BUILTIN.<em class=
                   7758:             "replaceable"><code>pkg</code></em></code>, and
                   7759:             includes code that uses the value of <code class=
                   7760:             "varname">USE_BUILTIN.<em class=
                   7761:             "replaceable"><code>pkg</code></em></code> set in the
                   7762:             previous section. This typically includes, e.g., adding
1.1       grant    7763:             additional dependency restrictions and listing
1.14      xtraeme  7764:             additional files to symlink into <code class=
                   7765:             "filename">${BUILDLINK_DIR}</code> (via <code class=
                   7766:             "varname">BUILDLINK_FILES.<em class=
                   7767:             "replaceable"><code>pkg</code></em></code>).</p>
1.1       grant    7768:           </div>
                   7769: 
                   7770:           <div class="sect2" lang="en" xml:lang="en">
                   7771:             <div class="titlepage">
                   7772:               <div>
                   7773:                 <div>
1.30      wiz      7774:                   <h3 class="title"><a name=
                   7775:                   "native-or-pkgsrc-preference" id=
                   7776:                   "native-or-pkgsrc-preference"></a>10.3.2.&nbsp;Global
                   7777:                   preferences for native or pkgsrc software</h3>
1.1       grant    7778:                 </div>
                   7779:               </div>
                   7780:             </div>
                   7781: 
                   7782:             <p>When building packages, it's possible to choose
                   7783:             whether to set a global preference for using either the
                   7784:             built-in (native) version or the pkgsrc version of
                   7785:             software to satisfy a dependency. This is controlled by
1.14      xtraeme  7786:             setting <code class="varname">PREFER_PKGSRC</code> and
                   7787:             <code class="varname">PREFER_NATIVE</code>. These
                   7788:             variables take values of either &#8220;<span class=
1.1       grant    7789:             "quote">yes</span>&#8221;, &#8220;<span class=
                   7790:             "quote">no</span>&#8221;, or a list of packages.
1.14      xtraeme  7791:             <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
                   7792:             to use the pkgsrc versions of software, while
                   7793:             <code class="varname">PREFER_NATIVE</code> tells pkgsrc
                   7794:             to use the built-in versions. Preferences are
                   7795:             determined by the most specific instance of the package
                   7796:             in either <code class="varname">PREFER_PKGSRC</code> or
                   7797:             <code class="varname">PREFER_NATIVE</code>. If a
                   7798:             package is specified in neither or in both variables,
                   7799:             then <code class="varname">PREFER_PKGSRC</code> has
                   7800:             precedence over <code class=
                   7801:             "varname">PREFER_NATIVE</code>. For example, to require
                   7802:             using pkgsrc versions of software for all but the most
                   7803:             basic bits on a NetBSD system, you can set:</p>
1.1       grant    7804:             <pre class="programlisting">
                   7805:         PREFER_PKGSRC=  yes
                   7806:         PREFER_NATIVE=  getopt skey tcp_wrappers
                   7807:       
                   7808: </pre>
                   7809: 
                   7810:             <p>A package <span class=
1.14      xtraeme  7811:             "emphasis"><em>must</em></span> have a <code class=
                   7812:             "filename">builtin.mk</code> file to be listed in
                   7813:             <code class="varname">PREFER_NATIVE</code>, otherwise
                   7814:             it is simply ignored in that list.</p>
1.1       grant    7815:           </div>
                   7816:         </div>
                   7817:       </div>
                   7818: 
                   7819:       <div class="chapter" lang="en" xml:lang="en">
                   7820:         <div class="titlepage">
                   7821:           <div>
                   7822:             <div>
1.35      jmmv     7823:               <h2 class="title"><a name="pkginstall" id=
                   7824:               "pkginstall"></a>Chapter&nbsp;11.&nbsp;The pkginstall
                   7825:               framework</h2>
1.1       grant    7826:             </div>
                   7827:           </div>
                   7828:         </div>
                   7829: 
                   7830:         <div class="toc">
                   7831:           <p><b>Table of Contents</b></p>
                   7832: 
                   7833:           <dl>
1.30      wiz      7834:             <dt><span class="sect1"><a href=
1.35      jmmv     7835:             "#files-and-dirs-outside-prefix">11.1. Files and
                   7836:             directories outside the installation
                   7837:             prefix</a></span></dt>
                   7838: 
                   7839:             <dd>
                   7840:               <dl>
                   7841:                 <dt><span class="sect2"><a href=
                   7842:                 "#dirs-outside-prefix">11.1.1. Directory
                   7843:                 manipulation</a></span></dt>
                   7844: 
                   7845:                 <dt><span class="sect2"><a href=
                   7846:                 "#files-outside-prefix">11.1.2. File
                   7847:                 manipulation</a></span></dt>
                   7848:               </dl>
                   7849:             </dd>
                   7850: 
                   7851:             <dt><span class="sect1"><a href="#conf-files">11.2.
                   7852:             Configuration files</a></span></dt>
                   7853: 
                   7854:             <dd>
                   7855:               <dl>
                   7856:                 <dt><span class="sect2"><a href=
                   7857:                 "#conf-files-sysconfdir">11.2.1. How <code class=
                   7858:                 "varname">PKG_SYSCONFDIR</code> is
                   7859:                 set</a></span></dt>
                   7860: 
                   7861:                 <dt><span class="sect2"><a href=
                   7862:                 "#conf-files-configure">11.2.2. Telling the
                   7863:                 software were configuration files
                   7864:                 are</a></span></dt>
                   7865: 
                   7866:                 <dt><span class="sect2"><a href=
                   7867:                 "#conf-files-patching">11.2.3. Patching
                   7868:                 installations</a></span></dt>
                   7869: 
                   7870:                 <dt><span class="sect2"><a href=
                   7871:                 "#conf-files-disable">11.2.4. Disabling handling of
                   7872:                 configuration files</a></span></dt>
                   7873:               </dl>
                   7874:             </dd>
                   7875: 
                   7876:             <dt><span class="sect1"><a href="#rcd-scripts">11.3.
                   7877:             System startup scripts</a></span></dt>
                   7878: 
                   7879:             <dd>
                   7880:               <dl>
                   7881:                 <dt><span class="sect2"><a href=
                   7882:                 "#rcd-scripts-disable">11.3.1. Disabling handling
                   7883:                 of system startup scripts</a></span></dt>
                   7884:               </dl>
                   7885:             </dd>
1.1       grant    7886: 
1.30      wiz      7887:             <dt><span class="sect1"><a href=
1.35      jmmv     7888:             "#users-and-groups">11.4. System users and
                   7889:             groups</a></span></dt>
                   7890: 
                   7891:             <dt><span class="sect1"><a href="#shells">11.5. System
                   7892:             shells</a></span></dt>
                   7893: 
                   7894:             <dd>
                   7895:               <dl>
                   7896:                 <dt><span class="sect2"><a href=
                   7897:                 "#shells-disable">11.5.1. Disabling handling of
                   7898:                 configuration files</a></span></dt>
                   7899:               </dl>
                   7900:             </dd>
1.1       grant    7901:           </dl>
                   7902:         </div>
                   7903: 
1.35      jmmv     7904:         <p>This chapter describes the framework known as
                   7905:         <code class="literal">pkginstall</code>, whose key features
                   7906:         are:</p>
                   7907: 
                   7908:         <div class="itemizedlist">
                   7909:           <ul type="disc">
                   7910:             <li>
                   7911:               <p>Generic installation and manipulation of
                   7912:               directories and files outside the pkgsrc-handled
                   7913:               tree, <code class="varname">LOCALBASE</code>.</p>
                   7914:             </li>
                   7915: 
                   7916:             <li>
                   7917:               <p>Automatic handling of configuration files during
                   7918:               installation, provided that packages are correctly
                   7919:               designed.</p>
                   7920:             </li>
                   7921: 
                   7922:             <li>
                   7923:               <p>Generation and installation of system startup
                   7924:               scripts.</p>
                   7925:             </li>
                   7926: 
                   7927:             <li>
                   7928:               <p>Registration of system users and groups.</p>
                   7929:             </li>
                   7930: 
                   7931:             <li>
                   7932:               <p>Registration of system shells.</p>
                   7933:             </li>
                   7934:           </ul>
                   7935:         </div>
                   7936: 
                   7937:         <p>The following sections inspect each of the above points
                   7938:         in detail. Note that, in order to use any of the described
                   7939:         functionalities, you must add the following to your
                   7940:         package's <code class="filename">Makefile</code>:</p>
                   7941:         <pre class="programlisting">
                   7942: USE_PKGINSTALL=YES
                   7943: </pre>
                   7944: 
                   7945:         <p>You may be thinking that many of the things described
                   7946:         here could be easily done with simple code in the package's
                   7947:         post-installation target (<code class=
                   7948:         "literal">post-install</code>). <span class=
                   7949:         "emphasis"><em>This is incorrect</em></span>, as the code
                   7950:         in them is only executed when building from source.
                   7951:         Machines using binary packages could not benefit from it at
                   7952:         all (as the code itself could be unavailable). Therefore,
                   7953:         the only way to achieve any of the items described above is
                   7954:         by means of the installation scripts, which are
                   7955:         automatically generated by pkginstall.</p>
1.1       grant    7956: 
                   7957:         <div class="sect1" lang="en" xml:lang="en">
                   7958:           <div class="titlepage">
                   7959:             <div>
                   7960:               <div>
                   7961:                 <h2 class="title" style="clear: both"><a name=
1.35      jmmv     7962:                 "files-and-dirs-outside-prefix" id=
                   7963:                 "files-and-dirs-outside-prefix"></a>11.1. Files and
                   7964:                 directories outside the installation prefix</h2>
1.1       grant    7965:               </div>
                   7966:             </div>
                   7967:           </div>
                   7968: 
1.35      jmmv     7969:           <p>As you already know, the <code class=
                   7970:           "filename">PLIST</code> file holds a list of files and
                   7971:           directories that belong to a package. The names used in
                   7972:           it are relative to the installation prefix (<code class=
                   7973:           "filename">${PREFIX}</code>), which means that it cannot
                   7974:           register files outside this directory (absolute path
                   7975:           names are not allowed). Despite this restriction, some
                   7976:           packages need to install files outside this location;
                   7977:           e.g., under <code class="filename">${VARBASE}</code> or
                   7978:           <code class="filename">${PKG_SYSCONFDIR}</code>.</p>
                   7979: 
                   7980:           <p>The only way to achieve this is to create such files
                   7981:           during installation time by using the installation
                   7982:           scripts. These scripts can run arbitrary commands, so
                   7983:           they have the potential to create and manage files
                   7984:           anywhere in the filesystem. Here is where pkginstall
                   7985:           comes into play: it provides generic scripts to abstract
                   7986:           the manipulation of such files and directories based on
                   7987:           variables set in the package's <code class=
                   7988:           "filename">Makefile</code>. The rest of this section
                   7989:           describes which these variables are.</p>
1.1       grant    7990: 
1.35      jmmv     7991:           <div class="sect2" lang="en" xml:lang="en">
                   7992:             <div class="titlepage">
1.1       grant    7993:               <div>
1.35      jmmv     7994:                 <div>
                   7995:                   <h3 class="title"><a name="dirs-outside-prefix"
                   7996:                   id="dirs-outside-prefix"></a>11.1.1. Directory
                   7997:                   manipulation</h3>
                   7998:                 </div>
1.1       grant    7999:               </div>
                   8000:             </div>
                   8001: 
1.35      jmmv     8002:             <p>The following variables can be set to request the
                   8003:             creation of directories anywhere in the filesystem:</p>
1.27      rillig   8004: 
1.35      jmmv     8005:             <div class="itemizedlist">
                   8006:               <ul type="disc">
                   8007:                 <li>
                   8008:                   <p><code class="varname">MAKE_DIRS</code> and
                   8009:                   <code class="varname">OWN_DIRS</code> contain a
                   8010:                   list of directories that should be created and
                   8011:                   should attempt to be destroyed by the
                   8012:                   installation scripts. The difference between the
                   8013:                   two is that the latter prompts the administrator
                   8014:                   to remove any directories that may be left after
                   8015:                   deinstallation (because they were not empty),
                   8016:                   while the former does not.</p>
                   8017:                 </li>
1.1       grant    8018: 
1.35      jmmv     8019:                 <li>
                   8020:                   <p><code class="varname">MAKE_DIRS_PERMS</code>
                   8021:                   and <code class="varname">OWN_DIRS_PERMS</code>
                   8022:                   contain a list of tuples describing which
                   8023:                   directories should be created and should attempt
                   8024:                   to be destroyed by the installation scripts. Each
                   8025:                   tuple holds the following values, separated by
                   8026:                   spaces: the directory name, its owner, its group
                   8027:                   and its numerical mode. For example:</p>
                   8028:                   <pre class="programlisting">
                   8029: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
                   8030: </pre>
1.1       grant    8031: 
1.35      jmmv     8032:                   <p>The difference between the two is exactly the
                   8033:                   same as their non-<code class=
                   8034:                   "varname">PERMS</code> counterparts.</p>
                   8035:                 </li>
                   8036:               </ul>
                   8037:             </div>
                   8038:           </div>
                   8039: 
                   8040:           <div class="sect2" lang="en" xml:lang="en">
                   8041:             <div class="titlepage">
                   8042:               <div>
                   8043:                 <div>
                   8044:                   <h3 class="title"><a name="files-outside-prefix"
                   8045:                   id="files-outside-prefix"></a>11.1.2. File
                   8046:                   manipulation</h3>
                   8047:                 </div>
                   8048:               </div>
                   8049:             </div>
                   8050: 
                   8051:             <p>Creating non-empty files outside the installation
                   8052:             prefix is tricky because the <code class=
                   8053:             "filename">PLIST</code> forces all files to be inside
                   8054:             it. To overcome this problem, the only solution is to
                   8055:             extract the file in the known place (i.e., inside the
                   8056:             installation prefix) and copy it to the appropriate
                   8057:             location during installation (done by the installation
                   8058:             scripts generated by pkginstall). We will call the
                   8059:             former the <span class="emphasis"><em>master
                   8060:             file</em></span> in the following paragraphs, which
                   8061:             describe the variables that can be used to
                   8062:             automatically and consistently handle files outside the
                   8063:             installation prefix:</p>
                   8064: 
                   8065:             <div class="itemizedlist">
                   8066:               <ul type="disc">
                   8067:                 <li>
                   8068:                   <p><code class="varname">CONF_FILES</code> and
                   8069:                   <code class="varname">SUPPORT_FILES</code> are
                   8070:                   pairs of master and target files. During
                   8071:                   installation time, the master file is copied to
                   8072:                   the target one if and only if the latter does not
                   8073:                   exist. Upon deinstallation, the target file is
                   8074:                   removed provided that it was not modified by the
                   8075:                   installation.</p>
                   8076: 
                   8077:                   <p>The difference between the two is that the
                   8078:                   latter prompts the administrator to remove any
                   8079:                   files that may be left after deinstallation
                   8080:                   (because they were not empty), while the former
                   8081:                   does not.</p>
                   8082:                 </li>
                   8083: 
                   8084:                 <li>
                   8085:                   <p><code class="varname">CONF_FILES_PERMS</code>
                   8086:                   and <code class=
                   8087:                   "varname">SUPPORT_FILES_PERMS</code> contain
                   8088:                   tuples describing master files as well as their
                   8089:                   target locations. For each of them, it also
                   8090:                   specifies their owner, their group and their
                   8091:                   numeric permissions, in this order. For
                   8092:                   example:</p>
                   8093:                   <pre class="programlisting">
                   8094: SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
                   8095: </pre>
                   8096: 
                   8097:                   <p>The difference between the two is exactly the
                   8098:                   same as their non-<code class=
                   8099:                   "varname">PERMS</code> counterparts.</p>
                   8100:                 </li>
                   8101:               </ul>
                   8102:             </div>
                   8103:           </div>
                   8104:         </div>
                   8105: 
                   8106:         <div class="sect1" lang="en" xml:lang="en">
                   8107:           <div class="titlepage">
                   8108:             <div>
                   8109:               <div>
                   8110:                 <h2 class="title" style="clear: both"><a name=
                   8111:                 "conf-files" id="conf-files"></a>11.2.
                   8112:                 Configuration files</h2>
                   8113:               </div>
                   8114:             </div>
                   8115:           </div>
                   8116: 
                   8117:           <p>Configuration files are special in the sense that they
                   8118:           are installed in their own specific directory,
                   8119:           <code class="varname">PKG_SYSCONFDIR</code>, and need
                   8120:           special treatment during installation (most of which is
                   8121:           automated by pkginstall). The main concept you must bear
1.36      wiz      8122:           in mind is that files marked as configuration files are
1.35      jmmv     8123:           automatically copied to the right place (somewhere inside
                   8124:           <code class="varname">PKG_SYSCONFDIR</code>) during
                   8125:           installation <span class="emphasis"><em>if and only
                   8126:           if</em></span> they didn't exist before. Similarly, they
                   8127:           will not be removed if they have local modifications.
1.36      wiz      8128:           This ensures that administrators never lose any custom
1.35      jmmv     8129:           changes they may have made.</p>
                   8130: 
                   8131:           <div class="sect2" lang="en" xml:lang="en">
                   8132:             <div class="titlepage">
                   8133:               <div>
                   8134:                 <div>
                   8135:                   <h3 class="title"><a name="conf-files-sysconfdir"
                   8136:                   id="conf-files-sysconfdir"></a>11.2.1. How
                   8137:                   <code class="varname">PKG_SYSCONFDIR</code> is
                   8138:                   set</h3>
                   8139:                 </div>
                   8140:               </div>
                   8141:             </div>
                   8142: 
                   8143:             <p>As said before, the <code class=
                   8144:             "varname">PKG_SYSCONFDIR</code> variable specifies
                   8145:             where configuration files shall be installed. Its
                   8146:             contents are set based upon the following
                   8147:             variables:</p>
                   8148: 
                   8149:             <div class="itemizedlist">
                   8150:               <ul type="disc">
                   8151:                 <li>
                   8152:                   <p><code class="varname">PKG_SYSCONFBASE</code>:
                   8153:                   The configuration's root directory. Defaults to
                   8154:                   <code class="filename">${PREFIX}/etc</code>
1.36      wiz      8155:                   although it may be overridden by the user to
                   8156:                   point to his preferred location (e.g.,
                   8157:                   <code class="filename">/etc</code>, <code class=
1.35      jmmv     8158:                   "filename">/etc/pkg</code>, etc.). Packages must
                   8159:                   not use it directly.</p>
                   8160:                 </li>
                   8161: 
                   8162:                 <li>
                   8163:                   <p><code class=
                   8164:                   "varname">PKG_SYSCONFSUBDIR</code>: A
                   8165:                   subdirectory of <code class=
                   8166:                   "varname">PKG_SYSCONFBASE</code> under which the
                   8167:                   configuration files for the package being built
                   8168:                   shall be installed. The definition of this
                   8169:                   variable only makes sense in the package's
                   8170:                   <code class="filename">Makefile</code> (i.e., it
                   8171:                   is not user customizable).</p>
                   8172: 
                   8173:                   <p>As an example, consider the Apache package,
                   8174:                   <a xmlns=
                   8175:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   8176:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
                   8177:                   class="pkgname">www/apache2</a>, which places its
                   8178:                   configuration files under the <code class=
                   8179:                   "filename">httpd/</code> subdirectory of
                   8180:                   <code class="varname">PKG_SYSCONFBASE</code>.
                   8181:                   This should be set in the package Makefile.</p>
                   8182:                 </li>
                   8183: 
                   8184:                 <li>
                   8185:                   <p><code class="varname">PKG_SYSCONFVAR</code>:
                   8186:                   Specifies the name of the variable that holds
                   8187:                   this package's configuration directory (if
                   8188:                   different from <code class=
                   8189:                   "varname">PKG_SYSCONFBASE</code>). It defaults to
                   8190:                   <code class="varname">PKGBASE</code>'s value, and
                   8191:                   is always prefixed with <code class=
                   8192:                   "literal">PKG_SYSCONFDIR</code>.</p>
                   8193:                 </li>
                   8194: 
                   8195:                 <li>
                   8196:                   <p><code class=
                   8197:                   "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
                   8198:                   Holds the directory where the configuration files
                   8199:                   for the package identified by <code class=
                   8200:                   "varname">PKG_SYSCONFVAR</code>'s shall be
                   8201:                   placed.</p>
                   8202:                 </li>
                   8203:               </ul>
                   8204:             </div>
                   8205: 
                   8206:             <p>Based on the above variables, pkginstall determines
                   8207:             the value of <code class=
                   8208:             "varname">PKG_SYSCONFDIR</code>, which is the
                   8209:             <span class="emphasis"><em>only</em></span> variable
                   8210:             that can be used within a package to refer to its
                   8211:             configuration directory. The algorithm used to set its
                   8212:             value is basically the following:</p>
                   8213: 
                   8214:             <div class="orderedlist">
                   8215:               <ol type="1">
                   8216:                 <li>
                   8217:                   <p>If <code class=
                   8218:                   "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   8219:                   is set, its value is used.</p>
                   8220:                 </li>
                   8221: 
                   8222:                 <li>
                   8223:                   <p>If the previous variable is not defined but
                   8224:                   <code class="varname">PKG_SYSCONFSUBDIR</code> is
                   8225:                   set in the package's <code class=
                   8226:                   "filename">Makefile</code>, the resulting value
                   8227:                   is <code class=
                   8228:                   "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
                   8229:                 </li>
                   8230: 
                   8231:                 <li>
                   8232:                   <p>Otherwise, it is set to <code class=
                   8233:                   "filename">${PKG_SYSCONFBASE}</code>.</p>
                   8234:                 </li>
                   8235:               </ol>
                   8236:             </div>
                   8237: 
                   8238:             <p>It is worth mentioning that <code class=
                   8239:             "filename">${PKG_SYSCONFDIR}</code> is automatically
                   8240:             added to <code class="filename">OWN_DIRS</code>. See
                   8241:             <a href="#dirs-outside-prefix" title=
                   8242:             "11.1.1.&nbsp;Directory manipulation">Section 11.1.1,
                   8243:             &#8220;Directory manipulation&#8221;</a> what this
                   8244:             means.</p>
                   8245:           </div>
                   8246: 
                   8247:           <div class="sect2" lang="en" xml:lang="en">
                   8248:             <div class="titlepage">
                   8249:               <div>
                   8250:                 <div>
                   8251:                   <h3 class="title"><a name="conf-files-configure"
                   8252:                   id="conf-files-configure"></a>11.2.2. Telling the
                   8253:                   software were configuration files are</h3>
                   8254:                 </div>
                   8255:               </div>
                   8256:             </div>
                   8257: 
                   8258:             <p>Given that pkgsrc (and users!) expect configuration
                   8259:             files to be in a known place, you need to teach each
1.36      wiz      8260:             package where it shall install its files. In some cases
1.35      jmmv     8261:             you will have to patch the package Makefiles to achieve
                   8262:             it. If you are lucky, though, it may be as easy as
                   8263:             passing an extra flag to the configuration script; this
                   8264:             is the case of GNU Autoconf generated files:</p>
                   8265:             <pre class="programlisting">
                   8266: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
                   8267: </pre>
                   8268: 
                   8269:             <p>Note that this specifies where the package has to
                   8270:             <span class="emphasis"><em>look for</em></span> its
                   8271:             configuration files, not where they will be originally
                   8272:             installed (although the difference is never explicit,
                   8273:             unfortunately).</p>
                   8274:           </div>
                   8275: 
                   8276:           <div class="sect2" lang="en" xml:lang="en">
                   8277:             <div class="titlepage">
                   8278:               <div>
                   8279:                 <div>
                   8280:                   <h3 class="title"><a name="conf-files-patching"
                   8281:                   id="conf-files-patching"></a>11.2.3. Patching
                   8282:                   installations</h3>
                   8283:                 </div>
                   8284:               </div>
                   8285:             </div>
                   8286: 
                   8287:             <p>As said before, pkginstall automatically handles
                   8288:             configuration files. This means that <span class=
                   8289:             "strong"><strong>the packages themselves must not touch
                   8290:             the contents of <code class=
                   8291:             "filename">${PKG_SYSCONFDIR}</code>
1.36      wiz      8292:             directly</strong></span>. Bad news is that many
                   8293:             software installation scripts will, out of the box,
                   8294:             mess with the contents of that directory. So what is
                   8295:             the correct procedure to fix this issue?</p>
1.35      jmmv     8296: 
                   8297:             <p>You must teach the package (usually by manually
                   8298:             patching it) to install any configuration files under
                   8299:             the examples hierarchy, <code class=
                   8300:             "filename">share/examples/${PKGBASE}/</code>. This way,
                   8301:             the <code class="filename">PLIST</code> registers them
                   8302:             and the administrator always has the original copies
                   8303:             available.</p>
                   8304: 
                   8305:             <p>Once the required configuration files are in place
                   8306:             (i.e., under the examples hierarchy), the pkginstall
                   8307:             framework can use them as master copies during the
                   8308:             package installation to update what is in <code class=
                   8309:             "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
                   8310:             the variables <code class="varname">CONF_FILES</code>
                   8311:             and <code class="varname">CONF_FILES_PERMS</code> are
                   8312:             used. Check out <a href="#files-outside-prefix" title=
                   8313:             "11.1.2.&nbsp;File manipulation">Section 11.1.2,
                   8314:             &#8220;File manipulation&#8221;</a> for information
                   8315:             about their syntax and their purpose. Here is an
                   8316:             example, taken from the <a xmlns=
                   8317:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8318:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
                   8319:             class="pkgname">mail/mutt</a> package:</p>
                   8320:             <pre class="programlisting">
                   8321: EGDIR=        ${PREFIX}/share/doc/mutt/samples
                   8322: CONF_FILES=   ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
                   8323: </pre>
                   8324: 
                   8325:             <p>Note that the <code class="varname">EGDIR</code>
                   8326:             variable is specific to that package and has no meaning
                   8327:             outside it.</p>
                   8328:           </div>
                   8329: 
                   8330:           <div class="sect2" lang="en" xml:lang="en">
                   8331:             <div class="titlepage">
                   8332:               <div>
                   8333:                 <div>
                   8334:                   <h3 class="title"><a name="conf-files-disable"
                   8335:                   id="conf-files-disable"></a>11.2.4. Disabling
                   8336:                   handling of configuration files</h3>
                   8337:                 </div>
                   8338:               </div>
                   8339:             </div>
                   8340: 
                   8341:             <p>The automatic copying of config files can be toggled
                   8342:             by setting the environment variable <code class=
                   8343:             "varname">PKG_CONFIG</code> prior to package
                   8344:             installation.</p>
                   8345:           </div>
                   8346:         </div>
                   8347: 
                   8348:         <div class="sect1" lang="en" xml:lang="en">
                   8349:           <div class="titlepage">
                   8350:             <div>
                   8351:               <div>
                   8352:                 <h2 class="title" style="clear: both"><a name=
                   8353:                 "rcd-scripts" id="rcd-scripts"></a>11.3. System
                   8354:                 startup scripts</h2>
                   8355:               </div>
                   8356:             </div>
                   8357:           </div>
                   8358: 
                   8359:           <p>System startup scripts are special files because they
                   8360:           must be installed in a place known by the underlying OS,
                   8361:           usually outside the installation prefix. Therefore, the
                   8362:           same rules described in <a href=
                   8363:           "#files-and-dirs-outside-prefix" title=
                   8364:           "11.1.&nbsp;Files and directories outside the installation prefix">
                   8365:           Section 11.1, &#8220;Files and directories outside the
                   8366:           installation prefix&#8221;</a> apply, and the same
                   8367:           solutions can be used. However, pkginstall provides a
1.36      wiz      8368:           special mechanism to handle these files.</p>
1.35      jmmv     8369: 
                   8370:           <p>In order to provide system startup scripts, the
                   8371:           package has to:</p>
                   8372: 
                   8373:           <div class="orderedlist">
                   8374:             <ol type="1">
                   8375:               <li>
                   8376:                 <p>Store the script inside <code class=
                   8377:                 "filename">${FILESDIR}</code>, with the
                   8378:                 <code class="literal">.sh</code> suffix appended.
                   8379:                 Considering the <a xmlns=
                   8380:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8381:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
                   8382:                 class="pkgname">print/cups</a> package as an
1.36      wiz      8383:                 example, it has a <code class=
1.35      jmmv     8384:                 "filename">cupsd.sh</code> in its files
                   8385:                 directory.</p>
                   8386:               </li>
                   8387: 
                   8388:               <li>
                   8389:                 <p>Tell pkginstall to handle it, appending the name
                   8390:                 of the script, without its extension, to the
                   8391:                 <code class="varname">RCD_SCRIPTS</code> variable.
                   8392:                 Continuing the previous example:</p>
                   8393:                 <pre class="programlisting">
                   8394: RCD_SCRIPTS+= cupsd
                   8395: </pre>
                   8396:               </li>
                   8397:             </ol>
                   8398:           </div>
                   8399: 
                   8400:           <p>Once this is done, pkginstall will do the following
                   8401:           steps for each script in an automated fashion:</p>
                   8402: 
                   8403:           <div class="orderedlist">
                   8404:             <ol type="1">
                   8405:               <li>
                   8406:                 <p>Process the file found in the files directory
                   8407:                 applying all the substitutions described in the
                   8408:                 <code class="filename">FILES_SUBST</code>
                   8409:                 variable.</p>
                   8410:               </li>
                   8411: 
                   8412:               <li>
                   8413:                 <p>Copy the script from the files directory to the
                   8414:                 examples hierarchy, <code class=
                   8415:                 "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36      wiz      8416:                 Note that this master file must be explicitly
1.35      jmmv     8417:                 registered in the <code class=
                   8418:                 "filename">PLIST</code>.</p>
                   8419:               </li>
                   8420: 
                   8421:               <li>
                   8422:                 <p>Add code to the installation scripts to copy the
                   8423:                 startup script from the examples hierarchy into the
                   8424:                 system-wide startup scripts directory.</p>
                   8425:               </li>
                   8426:             </ol>
                   8427:           </div>
                   8428: 
                   8429:           <div class="sect2" lang="en" xml:lang="en">
                   8430:             <div class="titlepage">
                   8431:               <div>
                   8432:                 <div>
                   8433:                   <h3 class="title"><a name="rcd-scripts-disable"
                   8434:                   id="rcd-scripts-disable"></a>11.3.1. Disabling
                   8435:                   handling of system startup scripts</h3>
                   8436:                 </div>
                   8437:               </div>
                   8438:             </div>
                   8439: 
                   8440:             <p>The automatic copying of config files can be toggled
                   8441:             by setting the environment variable <code class=
                   8442:             "varname">PKG_RCD_SCRIPTS</code> prior to package
                   8443:             installation. Note that the scripts will be always
                   8444:             copied inside the examples hierarchy, <code class=
                   8445:             "filename">${PREFIX}/share/examples/rc.d/</code>, no
                   8446:             matter what the value of this variable is.</p>
                   8447:           </div>
                   8448:         </div>
                   8449: 
                   8450:         <div class="sect1" lang="en" xml:lang="en">
                   8451:           <div class="titlepage">
                   8452:             <div>
                   8453:               <div>
                   8454:                 <h2 class="title" style="clear: both"><a name=
                   8455:                 "users-and-groups" id="users-and-groups"></a>11.4.
                   8456:                 System users and groups</h2>
                   8457:               </div>
                   8458:             </div>
                   8459:           </div>
                   8460: 
                   8461:           <p>If a package needs to create special users and/or
                   8462:           groups during installation, it can do so by using the
                   8463:           pkginstall framework.</p>
                   8464: 
                   8465:           <p>Users can be created by adding entries to the
                   8466:           <code class="varname">PKG_USERS</code> variable. Each
                   8467:           entry has the following syntax, which mimics <code class=
                   8468:           "filename">/etc/passwd</code>:</p>
                   8469:           <pre class="programlisting">
                   8470: user:group[:[userid][:[descr][:[home][:shell]]]]
                   8471: </pre>
                   8472: 
                   8473:           <p>Only the user and group are required; everything else
                   8474:           is optional, but the colons must be in the right places
                   8475:           when specifying optional bits. By default, a new user
                   8476:           will have home directory <code class=
                   8477:           "filename">/nonexistent</code>, and login shell
                   8478:           <code class="filename">/sbin/nologin</code> unless they
                   8479:           are specified as part of the user element. Note that if
                   8480:           the description contains spaces, then spaces should be
                   8481:           double backslash-escaped, as in:</p>
                   8482:           <pre class="programlisting">
                   8483: foo:foogrp::The\\ Foomister
                   8484: </pre>
                   8485: 
                   8486:           <p>Similarly, groups can be created using the
                   8487:           <code class="varname">PKG_GROUPS</code> variable, whose
                   8488:           syntax is:</p>
                   8489:           <pre class="programlisting">
                   8490: group[:groupid]
                   8491: </pre>
                   8492: 
                   8493:           <p>As before, only the group name is required; the
                   8494:           numeric identifier is optional.</p>
                   8495:         </div>
                   8496: 
                   8497:         <div class="sect1" lang="en" xml:lang="en">
                   8498:           <div class="titlepage">
                   8499:             <div>
                   8500:               <div>
                   8501:                 <h2 class="title" style="clear: both"><a name=
                   8502:                 "shells" id="shells"></a>11.5. System shells</h2>
                   8503:               </div>
                   8504:             </div>
                   8505:           </div>
                   8506: 
                   8507:           <p>Packages that install system shells should register
                   8508:           them in the shell database, <code class=
                   8509:           "filename">/etc/shells</code>, to make things easier to
                   8510:           the administrator. This must be done from the
                   8511:           installation scripts to keep binary packages working on
                   8512:           any system. pkginstall provides an easy way to accomplish
                   8513:           this task.</p>
                   8514: 
                   8515:           <p>When a package provides a shell interpreter, it has to
                   8516:           set the <code class="varname">PKG_SHELL</code> variable
                   8517:           to its absolute file name. This will add some hooks to
                   8518:           the installation scripts to handle it. Consider the
                   8519:           following example, taken from <a xmlns=
                   8520:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   8521:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
                   8522:           class="pkgname">shells/zsh</a>:</p>
                   8523:           <pre class="programlisting">
                   8524: USE_PKGINSTALL= YES
                   8525: PKG_SHELL=      ${PREFIX}/bin/zsh
                   8526: </pre>
                   8527: 
                   8528:           <div class="sect2" lang="en" xml:lang="en">
                   8529:             <div class="titlepage">
                   8530:               <div>
                   8531:                 <div>
                   8532:                   <h3 class="title"><a name="shells-disable" id=
                   8533:                   "shells-disable"></a>11.5.1. Disabling handling
                   8534:                   of configuration files</h3>
                   8535:                 </div>
                   8536:               </div>
                   8537:             </div>
                   8538: 
                   8539:             <p>The automatic registration of shell interpreters can
                   8540:             be disabled by the administrator by setting the
                   8541:             <code class="filename">PKG_REGISTER_SHELLS</code>
                   8542:             environment variable to <code class=
                   8543:             "literal">NO</code>.</p>
                   8544:           </div>
                   8545:         </div>
                   8546:       </div>
                   8547: 
                   8548:       <div class="chapter" lang="en" xml:lang="en">
                   8549:         <div class="titlepage">
                   8550:           <div>
                   8551:             <div>
                   8552:               <h2 class="title"><a name="options" id=
                   8553:               "options"></a>Chapter&nbsp;12.&nbsp;Options
                   8554:               handling</h2>
                   8555:             </div>
                   8556:           </div>
                   8557:         </div>
                   8558: 
                   8559:         <div class="toc">
                   8560:           <p><b>Table of Contents</b></p>
                   8561: 
                   8562:           <dl>
                   8563:             <dt><span class="sect1"><a href=
                   8564:             "#global-default-options">12.1. Global default
                   8565:             options</a></span></dt>
                   8566: 
                   8567:             <dt><span class="sect1"><a href=
                   8568:             "#converting-to-options">12.2. Converting packages to
                   8569:             use <code class=
                   8570:             "filename">bsd.options.mk</code></a></span></dt>
                   8571:           </dl>
                   8572:         </div>
                   8573: 
                   8574:         <p>Many packages have the ability to be built to support
                   8575:         different sets of features. <code class=
                   8576:         "filename">bsd.options.mk</code> is a framework in pkgsrc
                   8577:         that provides generic handling of those options that
                   8578:         determine different ways in which the packages can be
                   8579:         built. It's possible for the user to specify exactly which
                   8580:         sets of options will be built into a package or to allow a
                   8581:         set of global default options apply.</p>
                   8582: 
                   8583:         <div class="sect1" lang="en" xml:lang="en">
                   8584:           <div class="titlepage">
                   8585:             <div>
                   8586:               <div>
                   8587:                 <h2 class="title" style="clear: both"><a name=
                   8588:                 "global-default-options" id=
                   8589:                 "global-default-options"></a>12.1.&nbsp;Global
                   8590:                 default options</h2>
                   8591:               </div>
                   8592:             </div>
                   8593:           </div>
                   8594: 
                   8595:           <p>Global default options are listed in <code class=
                   8596:           "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
                   8597:           the options that should be built into every package if
                   8598:           that option is supported. This variable should be set in
                   8599:           <code class="filename">/etc/mk.conf</code>.</p>
                   8600:         </div>
                   8601: 
                   8602:         <div class="sect1" lang="en" xml:lang="en">
                   8603:           <div class="titlepage">
                   8604:             <div>
                   8605:               <div>
                   8606:                 <h2 class="title" style="clear: both"><a name=
                   8607:                 "converting-to-options" id=
                   8608:                 "converting-to-options"></a>12.2.&nbsp;Converting
                   8609:                 packages to use <code class=
                   8610:                 "filename">bsd.options.mk</code></h2>
                   8611:               </div>
                   8612:             </div>
                   8613:           </div>
                   8614: 
                   8615:           <p>The following example shows how <code class=
                   8616:           "filename">bsd.options.mk</code> should be used by the
                   8617:           hypothetical ``wibble'' package, either in the package
                   8618:           <code class="filename">Makefile</code>, or in a file,
                   8619:           e.g. <code class="filename">options.mk</code>, that is
                   8620:           included by the main package <code class=
                   8621:           "filename">Makefile</code>.</p>
                   8622:           <pre class="programlisting">
1.37    ! dillo    8623: PKG_OPTIONS_VAR=                PKG_OPTIONS.wibble
        !          8624: PKG_SUPPORTED_OPTIONS=          wibble-foo ldap
        !          8625: PKG_OPTIONAL_GROUPS=            database
        !          8626: PKG_GROUP.database=             mysql pgsql
        !          8627: PKG_SUGGESTED_OPTIONS=          wibble-foo
        !          8628: PKG_OPTIONS_LEGACY_VARS+=       WIBBLE_USE_OPENLDAP:ldap
        !          8629: PKG_OPTIONS_LEGACY_OPTS+=       foo:wibble-foo
        !          8630: 
        !          8631: .include "../../mk/bsd.prefs.mk"
        !          8632: 
        !          8633: # this package was previously named wibble2
        !          8634: .if defined(PKG_OPTIONS.wibble2)
        !          8635: PKG_LEGACY_OPTIONS+=  ${PKG_OPTIONS.wibble2}
        !          8636: PKG_OPTIONS_LEGACY_WARNINGS+="Deprecated variable PKG_OPTIONS.wibble2 used, use "${PKG_OPTIONS_VAR:Q}" instead."
        !          8637: .endif
1.35      jmmv     8638: 
                   8639: .include "../../mk/bsd.options.mk"
                   8640: 
                   8641: # Package-specific option-handling
                   8642: 
                   8643: ###
1.37    ! dillo    8644: ### FOO support
        !          8645: ###
        !          8646: .if !empty(PKG_OPTIONS:Mwibble-foo)
        !          8647: CONFIGURE_ARGS+=        --enable-foo
        !          8648: .endif
        !          8649: 
        !          8650: ###
1.35      jmmv     8651: ### LDAP support
                   8652: ###
                   8653: .if !empty(PKG_OPTIONS:Mldap)
                   8654: .  include "../../databases/openldap/buildlink3.mk"
1.37    ! dillo    8655: CONFIGURE_ARGS+=        --enable-ldap=${BUILDLINK_PREFIX.openldap}
1.35      jmmv     8656: .endif
1.1       grant    8657: 
                   8658: ###
1.37    ! dillo    8659: ### database support
1.1       grant    8660: ###
1.37    ! dillo    8661: .if !empty(PKG_OPTIONS:Mmysql)
        !          8662: .  include "../../mk/mysql.buildlink3.mk"
        !          8663: .endif
        !          8664: .if !empty(PKG_OPTIONS:Mpgsql)
        !          8665: .  include "../../mk/pgsql.buildlink3.mk"
1.1       grant    8666: .endif
                   8667: </pre>
                   8668: 
1.28      rillig   8669:           <p>The first section contains the information about which
                   8670:           build options are supported by the package, and any
1.1       grant    8671:           default options settings if needed.</p>
                   8672: 
                   8673:           <div class="orderedlist">
                   8674:             <ol type="1">
                   8675:               <li>
1.14      xtraeme  8676:                 <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27      rillig   8677:                 the name of the <a href=
1.1       grant    8678:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   8679:                 <span class="citerefentry"><span class=
1.27      rillig   8680:                 "refentrytitle">make</span>(1)</span></a> variable
1.37    ! dillo    8681:                 that the user can set to override the default
        !          8682:                 options. It should be set to &#8220;<span class=
        !          8683:                 "quote">PKG_OPTIONS.<em class=
        !          8684:                 "replaceable"><code>pkgname</code></em></span>&#8221;.</p>
1.1       grant    8685:               </li>
                   8686: 
                   8687:               <li>
1.14      xtraeme  8688:                 <p><code class=
                   8689:                 "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37    ! dillo    8690:                 build options supported by the package.</p>
        !          8691:               </li>
        !          8692: 
        !          8693:               <li>
        !          8694:                 <p><code class=
        !          8695:                 "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
        !          8696:                 list of names of groups of mutually exclusive
        !          8697:                 options. The options in each group are listed in
        !          8698:                 <code class="varname">PKG_OPTIONS_GROUP.<em class=
        !          8699:                 "replaceable"><code>groupname</code></em></code>.
        !          8700:                 The most specific setting of any option from the
        !          8701:                 group takes precedence over all other options in
        !          8702:                 the group. Options from the groups will be
        !          8703:                 automatically added to <code class=
        !          8704:                 "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
        !          8705:               </li>
        !          8706: 
        !          8707:               <li>
        !          8708:                 <p><code class=
        !          8709:                 "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
        !          8710:                 like <code class=
        !          8711:                 "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
        !          8712:                 building the packages will fail if no option from
        !          8713:                 the group is selected.</p>
1.1       grant    8714:               </li>
                   8715: 
                   8716:               <li>
1.27      rillig   8717:                 <p><code class=
                   8718:                 "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
                   8719:                 build options which are enabled by default.</p>
                   8720:               </li>
                   8721: 
                   8722:               <li>
1.37    ! dillo    8723:                 <p><code class=
        !          8724:                 "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
        !          8725:                 of &#8220;<span class="quote"><em class=
        !          8726:                 "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable">
        !          8727:                 <code>option</code></em></span>&#8221; pairs that
        !          8728:                 map legacy <code class=
        !          8729:                 "filename">/etc/mk.conf</code> variables to their
        !          8730:                 option counterparts. Pairs should be added with
        !          8731:                 &#8220;<span class="quote">+=</span>&#8221; to keep
        !          8732:                 the listing of global legacy variables. A warning
        !          8733:                 will be issued if the user uses a legacy
        !          8734:                 variable.</p>
        !          8735:               </li>
1.1       grant    8736: 
1.37    ! dillo    8737:               <li>
        !          8738:                 <p><code class=
        !          8739:                 "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
        !          8740:                 of &#8220;<span class="quote"><em class=
        !          8741:                 "replaceable"><code>old-option</code></em>:<em class="replaceable">
        !          8742:                 <code>new-option</code></em></span>&#8221; pairs
        !          8743:                 that map options that have been renamed to their
        !          8744:                 new counterparts. Pairs should be added with
        !          8745:                 &#8220;<span class="quote">+=</span>&#8221; to keep
        !          8746:                 the listing of global legacy options. A warning
        !          8747:                 will be issued if the user uses a legacy
        !          8748:                 option.</p>
        !          8749:               </li>
1.1       grant    8750: 
1.37    ! dillo    8751:               <li>
        !          8752:                 <p><code class="varname">PKG_LEGACY_OPTIONS</code>
        !          8753:                 is a list of options implied by deprecated
        !          8754:                 variables used. This can be used for cases that
        !          8755:                 neither <code class=
        !          8756:                 "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
        !          8757:                 <code class=
        !          8758:                 "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
        !          8759:                 handle, e. g. when <code class=
        !          8760:                 "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1       grant    8761:               </li>
                   8762: 
                   8763:               <li>
1.37    ! dillo    8764:                 <p><code class=
        !          8765:                 "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
        !          8766:                 a list of warnings about deprecated variables or
        !          8767:                 options used, and what to use instead.</p>
1.1       grant    8768:               </li>
1.28      rillig   8769:             </ol>
1.1       grant    8770:           </div>
                   8771: 
1.37    ! dillo    8772:           <p>A package should never modify <code class=
        !          8773:           "varname">PKG_DEFAULT_OPTIONS</code> or the variable
        !          8774:           named in <code class="varname">PKG_OPTIONS_VAR</code>.
        !          8775:           These are strictly user-settable. To suggest a default
        !          8776:           set of options, use <code class=
        !          8777:           "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
        !          8778: 
        !          8779:           <p><code class="varname">PKG_OPTIONS_VAR</code> and at
        !          8780:           least one of <code class=
        !          8781:           "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
        !          8782:           "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
        !          8783:           <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
        !          8784:           must be defined before including <code class=
        !          8785:           "filename">bsd.options.mk</code>.</p>
        !          8786: 
        !          8787:           <p>After the inclusion of <code class=
        !          8788:           "filename">bsd.options.mk</code>, the variable
1.28      rillig   8789:           <code class="varname">PKG_OPTIONS</code> contains the
1.37    ! dillo    8790:           list of selected build options, properly filtered to
1.28      rillig   8791:           remove unsupported and duplicate options.</p>
                   8792: 
1.1       grant    8793:           <p>The remaining sections contain the logic that is
1.37    ! dillo    8794:           specific to each option. The correct way to check for an
        !          8795:           option is to check whether it is listed in <code class=
        !          8796:           "varname">PKG_OPTIONS</code>:</p>
        !          8797:           <pre class="programlisting">
        !          8798: .if !empty(PKG_OPTIONS:M<em class=
        !          8799: "replaceable"><code>option</code></em>)
        !          8800: </pre>
        !          8801: 
        !          8802:           <p>If another package already has an option with the same
        !          8803:           meaning, use the same name. For options applicable to
        !          8804:           multiple packages (like enabling support for a library),
        !          8805:           use short option names (like the name of the library).
        !          8806:           For options specific to this package, prefix the name
        !          8807:           with <code class="varname"><em class=
        !          8808:           "replaceable"><code>pkgname</code></em>-</code>. Document
        !          8809:           the option and its meaning in <code class=
        !          8810:           "filename">mk/defaults/options.description</code>.</p>
1.1       grant    8811:         </div>
                   8812:       </div>
                   8813: 
                   8814:       <div class="chapter" lang="en" xml:lang="en">
                   8815:         <div class="titlepage">
                   8816:           <div>
                   8817:             <div>
                   8818:               <h2 class="title"><a name="build" id=
1.35      jmmv     8819:               "build"></a>Chapter&nbsp;13.&nbsp;The build
1.1       grant    8820:               process</h2>
                   8821:             </div>
                   8822:           </div>
                   8823:         </div>
                   8824: 
                   8825:         <div class="toc">
                   8826:           <p><b>Table of Contents</b></p>
                   8827: 
                   8828:           <dl>
1.35      jmmv     8829:             <dt><span class="sect1"><a href="#build.prefix">13.1.
1.1       grant    8830:             Program location</a></span></dt>
                   8831: 
1.35      jmmv     8832:             <dt><span class="sect1"><a href="#main-targets">13.2.
1.30      wiz      8833:             Main targets</a></span></dt>
1.1       grant    8834: 
                   8835:             <dt><span class="sect1"><a href=
1.35      jmmv     8836:             "#build.helpful-targets">13.3. Other helpful
1.1       grant    8837:             targets</a></span></dt>
                   8838:           </dl>
                   8839:         </div>
                   8840: 
                   8841:         <p>The basic steps for building a program are always the
                   8842:         same. First the program's source (<span class=
                   8843:         "emphasis"><em>distfile</em></span>) must be brought to the
                   8844:         local system and then extracted. After any patches to
                   8845:         compile properly on NetBSD are applied, the software can be
                   8846:         configured, then built (usually by compiling), and finally
                   8847:         the generated binaries, etc. can be put into place on the
                   8848:         system. These are exactly the steps performed by the NetBSD
                   8849:         package system, which is implemented as a series of targets
1.14      xtraeme  8850:         in a central Makefile, <code class=
                   8851:         "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1       grant    8852: 
                   8853:         <div class="sect1" lang="en" xml:lang="en">
                   8854:           <div class="titlepage">
                   8855:             <div>
                   8856:               <div>
                   8857:                 <h2 class="title" style="clear: both"><a name=
                   8858:                 "build.prefix" id=
1.35      jmmv     8859:                 "build.prefix"></a>13.1.&nbsp;Program location</h2>
1.1       grant    8860:               </div>
                   8861:             </div>
                   8862:           </div>
                   8863: 
                   8864:           <p>Before outlining the process performed by the NetBSD
                   8865:           package system in the next section, here's a brief
                   8866:           discussion on where programs are installed, and which
                   8867:           variables influence this.</p>
                   8868: 
1.14      xtraeme  8869:           <p>The automatic variable <code class=
                   8870:           "varname">PREFIX</code> indicates where all files of the
                   8871:           final program shall be installed. It is usually set to
                   8872:           <code class="varname">LOCALBASE</code> (<code class=
                   8873:           "filename">/usr/pkg</code>), or <code class=
                   8874:           "varname">CROSSBASE</code> for pkgs in the
1.1       grant    8875:           &#8220;<span class="quote">cross</span>&#8221; category.
1.14      xtraeme  8876:           The value of <code class="varname">PREFIX</code> needs to
                   8877:           be put into the various places in the program's source
                   8878:           where paths to these files are encoded. See <a href=
1.1       grant    8879:           "#components.patches" title=
1.27      rillig   8880:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
1.1       grant    8881:           &#8220;patches/*&#8221;</a> and <a href="#fixes.libtool"
                   8882:           title=
1.35      jmmv     8883:           "14.3.1.&nbsp;Shared libraries - libtool">Section&nbsp;14.3.1,
1.1       grant    8884:           &#8220;Shared libraries - libtool&#8221;</a> for more
                   8885:           details.</p>
                   8886: 
                   8887:           <p>When choosing which of these variables to use, follow
                   8888:           the following rules:</p>
                   8889: 
                   8890:           <div class="itemizedlist">
                   8891:             <ul type="disc">
                   8892:               <li>
1.14      xtraeme  8893:                 <p><code class="varname">PREFIX</code> always
                   8894:                 points to the location where the current pkg will
                   8895:                 be installed. When referring to a pkg's own
1.1       grant    8896:                 installation path, use &#8220;<span class=
                   8897:                 "quote">${PREFIX}</span>&#8221;.</p>
                   8898:               </li>
                   8899: 
                   8900:               <li>
1.14      xtraeme  8901:                 <p><code class="varname">LOCALBASE</code> is where
                   8902:                 all non-X11 pkgs are installed. If you need to
1.1       grant    8903:                 construct a -I or -L argument to the compiler to
                   8904:                 find includes and libraries installed by another
                   8905:                 non-X11 pkg, use &#8220;<span class=
                   8906:                 "quote">${LOCALBASE}</span>&#8221;.</p>
                   8907:               </li>
                   8908: 
                   8909:               <li>
1.14      xtraeme  8910:                 <p><code class="varname">X11BASE</code> is where
                   8911:                 the actual X11 distribution (from xsrc, etc.) is
1.1       grant    8912:                 installed. When looking for <span class=
                   8913:                 "emphasis"><em>standard</em></span> X11 includes
                   8914:                 (not those installed by a pkg), use
                   8915:                 &#8220;<span class=
                   8916:                 "quote">${X11BASE}</span>&#8221;.</p>
                   8917:               </li>
                   8918: 
                   8919:               <li>
                   8920:                 <p>X11 based are special in that they may be
1.14      xtraeme  8921:                 installed in either <code class=
                   8922:                 "varname">X11BASE</code> or <code class=
                   8923:                 "varname">LOCALBASE</code>.</p>
1.1       grant    8924: 
                   8925:                 <p>Usually, X11 packages should be installed under
1.14      xtraeme  8926:                 <code class="varname">LOCALBASE</code> whenever
1.34      wiz      8927:                 possible. Note that you will need to include
                   8928:                 <code class=
                   8929:                 "filename">../../mk/x11.buildlink3.mk</code> in
                   8930:                 them to request the presence of X11 and to get the
                   8931:                 right compilation flags.</p>
1.1       grant    8932: 
                   8933:                 <p>Even though, there are some packages that cannot
1.14      xtraeme  8934:                 be installed under <code class=
                   8935:                 "varname">LOCALBASE</code>: those that come with
1.1       grant    8936:                 app-defaults files. These packages are special and
1.14      xtraeme  8937:                 they must be placed under <code class=
                   8938:                 "varname">X11BASE</code>. To accomplish this, set
                   8939:                 either <code class="varname">USE_X11BASE</code> or
                   8940:                 <code class="varname">USE_IMAKE</code> in your
1.1       grant    8941:                 package.</p>
                   8942: 
1.34      wiz      8943:                 <p>Some notes: If you need to find includes or
1.14      xtraeme  8944:                 libraries installed by a pkg that has <code class=
                   8945:                 "varname">USE_IMAKE</code> or <code class=
                   8946:                 "varname">USE_X11BASE</code> in its pkg
                   8947:                 <code class="filename">Makefile</code>, you need to
1.34      wiz      8948:                 look in <span class="emphasis"><em>both</em></span>
1.14      xtraeme  8949:                 <code class="filename">${X11BASE}</code> and
                   8950:                 <code class="filename">${LOCALBASE}</code>. To
                   8951:                 force installation of all X11 packages in
                   8952:                 <code class="varname">LOCALBASE</code>, the
                   8953:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8954:                 href=
1.1       grant    8955:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.34      wiz      8956:                 class="pkgname">pkgtools/xpkgwedge</a> package is
                   8957:                 enabled by default.</p>
1.1       grant    8958:               </li>
                   8959: 
                   8960:               <li>
1.14      xtraeme  8961:                 <p><code class="varname">X11PREFIX</code> should be
1.1       grant    8962:                 used to refer to the installed location of an X11
1.14      xtraeme  8963:                 package. <code class="varname">X11PREFIX</code>
                   8964:                 will be set to <code class="varname">X11BASE</code>
                   8965:                 if xpkgwedge is not installed, and to <code class=
                   8966:                 "varname">LOCALBASE</code> if xpkgwedge is
1.1       grant    8967:                 installed.</p>
                   8968:               </li>
                   8969: 
                   8970:               <li>
                   8971:                 <p>If xpkgwedge is installed, it is possible to
1.14      xtraeme  8972:                 have some packages installed in <code class=
                   8973:                 "varname">X11BASE</code> and some in <code class=
                   8974:                 "varname">LOCALBASE</code>. To determine the prefix
                   8975:                 of an installed package, the <code class=
                   8976:                 "varname">EVAL_PREFIX</code> definition can be
                   8977:                 used. It takes pairs in the format
                   8978:                 &#8220;<span class=
1.1       grant    8979:                 "quote">DIRNAME=&lt;package&gt;</span>&#8221;, and
1.24      wiz      8980:                 the <a href=
                   8981:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   8982:                 <span class="citerefentry"><span class=
                   8983:                 "refentrytitle">make</span>(1)</span></a> variable
                   8984:                 <code class="varname">DIRNAME</code> will be set to
                   8985:                 the prefix of the installed package
                   8986:                 &lt;package&gt;, or &#8220;<span class=
1.1       grant    8987:                 "quote">${X11PREFIX}</span>&#8221; if the package
                   8988:                 is not installed.</p>
                   8989: 
                   8990:                 <p>This is best illustrated by example.</p>
                   8991: 
1.14      xtraeme  8992:                 <p>The following lines are taken from <code class=
                   8993:                 "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1       grant    8994:                 <pre class="programlisting">
1.14      xtraeme  8995: EVAL_PREFIX+=           GTKDIR=gtk+
1.1       grant    8996: CONFIGURE_ARGS+=        --with-guile-prefix=${LOCALBASE}        \
                   8997:                         --with-gtk-prefix="${GTKDIR}"           \
                   8998:                         --enable-multibyte
                   8999: </pre>
                   9000: 
                   9001:                 <p>Specific defaults can be defined for the
1.14      xtraeme  9002:                 packages evaluated using <code class=
                   9003:                 "varname">EVAL_PREFIX</code>, by using a definition
1.1       grant    9004:                 of the form:</p>
                   9005:                 <pre class="programlisting">
                   9006: GTKDIR_DEFAULT= ${LOCALBASE}
                   9007: </pre>
                   9008: 
1.14      xtraeme  9009:                 <p>where <code class="varname">GTKDIR</code>
1.1       grant    9010:                 corresponds to the first definition in the
1.14      xtraeme  9011:                 <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1       grant    9012:               </li>
                   9013: 
                   9014:               <li>
1.14      xtraeme  9015:                 <p>Within <code class="filename">${PREFIX}</code>,
1.24      wiz      9016:                 packages should install files according to <a href=
                   9017:                 "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
                   9018:                 <span class="citerefentry"><span class=
                   9019:                 "refentrytitle">hier</span>(7)</span></a>, with the
                   9020:                 exception that manual pages go into <code class=
                   9021:                 "filename">${PREFIX}/man</code>, not <code class=
1.14      xtraeme  9022:                 "filename">${PREFIX}/share/man</code>.</p>
1.1       grant    9023:               </li>
                   9024:             </ul>
                   9025:           </div>
                   9026:         </div>
                   9027: 
                   9028:         <div class="sect1" lang="en" xml:lang="en">
                   9029:           <div class="titlepage">
                   9030:             <div>
                   9031:               <div>
                   9032:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      9033:                 "main-targets" id=
1.35      jmmv     9034:                 "main-targets"></a>13.2.&nbsp;Main targets</h2>
1.1       grant    9035:               </div>
                   9036:             </div>
                   9037:           </div>
                   9038: 
                   9039:           <p>The main targets used during the build process defined
1.14      xtraeme  9040:           in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1       grant    9041: 
                   9042:           <div class="variablelist">
                   9043:             <dl>
                   9044:               <dt><span class="term">fetch</span></dt>
                   9045: 
                   9046:               <dd>
                   9047:                 <p>This will check if the file(s) given in the
1.14      xtraeme  9048:                 variables <code class="varname">DISTFILES</code>
                   9049:                 and <code class="varname">PATCHFILES</code> (as
                   9050:                 defined in the package's Makefile) are present on
                   9051:                 the local system in <code class=
                   9052:                 "filename">/usr/pkgsrc/distfiles</code>. If they
                   9053:                 are not present, an attempt will be made to fetch
                   9054:                 them using commands of the form:</p>
1.1       grant    9055:                 <pre class="programlisting">
                   9056: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
                   9057: </pre>
                   9058: 
                   9059:                 <p>where ${site} varies through several
1.14      xtraeme  9060:                 possibilities in turn: first, <code class=
                   9061:                 "varname">MASTER_SITE_OVERRIDE</code> is tried,
                   9062:                 then the sites specified in either <code class=
                   9063:                 "varname">SITES_file</code> if defined, else
                   9064:                 <code class="varname">MASTER_SITES</code> or
                   9065:                 <code class="varname">PATCH_SITES</code>, as
                   9066:                 applies, then finally the value of <code class=
                   9067:                 "varname">MASTER_SITE_BACKUP</code>. The order of
                   9068:                 all except the first can be optionally sorted by
                   9069:                 the user, via setting either <code class=
                   9070:                 "varname">MASTER_SORT_AWK</code> or <code class=
                   9071:                 "varname">MASTER_SORT_REGEX</code>.</p>
1.1       grant    9072:               </dd>
                   9073: 
                   9074:               <dt><span class="term">checksum</span></dt>
                   9075: 
                   9076:               <dd>
                   9077:                 <p>After the distfile(s) are fetched, their
                   9078:                 checksum is generated and compared with the
                   9079:                 checksums stored in the distinfo file. If the
                   9080:                 checksums don't match, the build is aborted. This
                   9081:                 is to ensure the same distfile is used for
                   9082:                 building, and that the distfile wasn't changed,
                   9083:                 e.g. by some malign force, deliberately changed
                   9084:                 distfiles on the master distribution site or
                   9085:                 network lossage.</p>
                   9086:               </dd>
                   9087: 
                   9088:               <dt><span class="term">extract</span></dt>
                   9089: 
                   9090:               <dd>
                   9091:                 <p>When the distfiles are present on the local
                   9092:                 system, they need to be extracted, as they are
                   9093:                 usually in the form of some compressed archive
1.14      xtraeme  9094:                 format, most commonly <code class=
                   9095:                 "filename">.tar.gz</code>.</p>
1.1       grant    9096: 
                   9097:                 <p>If only some of the distfiles need to be
                   9098:                 uncompressed, the files to be uncompressed should
1.14      xtraeme  9099:                 be put into <code class=
                   9100:                 "varname">EXTRACT_ONLY</code>.</p>
1.1       grant    9101: 
1.14      xtraeme  9102:                 <p>If the distfiles are not in <code class=
                   9103:                 "filename">.tar.gz</code> format, they can be
                   9104:                 extracted by setting either <code class=
                   9105:                 "varname">EXTRACT_SUFX</code>, or <code class=
                   9106:                 "varname">EXTRACT_CMD</code>, <code class=
                   9107:                 "varname">EXTRACT_BEFORE_ARGS</code> and
                   9108:                 <code class="varname">EXTRACT_AFTER_ARGS</code>. In
                   9109:                 the former case, pkgsrc knows how to extract a
                   9110:                 number of suffixes (<code class=
                   9111:                 "filename">.tar.gz</code>, <code class=
                   9112:                 "filename">.tgz</code>, <code class=
                   9113:                 "filename">.tar.gz2</code>, <code class=
                   9114:                 "filename">.tbz</code>, <code class=
                   9115:                 "filename">.tar.Z</code>, <code class=
                   9116:                 "filename">.tar</code>, <code class=
                   9117:                 "filename">.shar.gz</code>, <code class=
                   9118:                 "filename">.shar.bz2</code>, <code class=
                   9119:                 "filename">.shar.Z</code>, <code class=
                   9120:                 "filename">.shar</code>, <code class=
                   9121:                 "filename">.Z</code>, <code class=
                   9122:                 "filename">.bz2</code> and <code class=
                   9123:                 "filename">.gz</code>; see the definition of the
                   9124:                 various <code class="varname">DECOMPRESS_CMD</code>
                   9125:                 variables <code class="filename">bsd.pkg.mk</code>
                   9126:                 for a complete list). Here's an example on how to
                   9127:                 use the other variables for a program that comes
                   9128:                 with a compressed shell archive whose name ends in
                   9129:                 <code class="filename">.msg.gz</code>:</p>
1.1       grant    9130:                 <pre class="programlisting">
                   9131:      EXTRACT_SUFX=   .msg.gz
                   9132:      EXTRACT_CMD=            zcat
                   9133:      EXTRACT_BEFORE_ARGS=
                   9134:      EXTRACT_AFTER_ARGS=     |sh
                   9135: </pre>
                   9136:               </dd>
                   9137: 
                   9138:               <dt><span class="term">patch</span></dt>
                   9139: 
                   9140:               <dd>
                   9141:                 <p>After extraction, all the patches named by the
1.14      xtraeme  9142:                 <code class="varname">PATCHFILES</code>, those
                   9143:                 present in the patches subdirectory of the package
                   9144:                 as well as in $LOCALPATCHES/$PKGPATH (e.g.
                   9145:                 <code class=
                   9146:                 "filename">/usr/local/patches/graphics/png</code>)
                   9147:                 are applied. Patchfiles ending in <code class=
                   9148:                 "filename">.Z</code> or <code class=
                   9149:                 "filename">.gz</code> are uncompressed before they
                   9150:                 are applied, files ending in <code class=
                   9151:                 "filename">.orig</code> or <code class=
                   9152:                 "filename">.rej</code> are ignored. Any special
1.24      wiz      9153:                 options to <a href=
                   9154:                 "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   9155:                 <span class="citerefentry"><span class=
                   9156:                 "refentrytitle">patch</span>(1)</span></a> can be
                   9157:                 handed in <code class=
1.14      xtraeme  9158:                 "varname">PATCH_DIST_ARGS</code>. See <a href=
                   9159:                 "#components.patches" title=
1.27      rillig   9160:                 "7.3.&nbsp;patches/*">Section&nbsp;7.3,
1.1       grant    9161:                 &#8220;patches/*&#8221;</a> for more details.</p>
                   9162: 
1.24      wiz      9163:                 <p>By default <a href=
                   9164:                 "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   9165:                 <span class="citerefentry"><span class=
                   9166:                 "refentrytitle">patch</span>(1)</span></a> is given
                   9167:                 special args to make it fail if the patches apply
                   9168:                 with some lines of fuzz. Please fix (regen) the
                   9169:                 patches so that they apply cleanly. The rationale
                   9170:                 behind this is that patches that don't apply
                   9171:                 cleanly may end up being applied in the wrong
                   9172:                 place, and cause severe harm there.</p>
1.1       grant    9173:               </dd>
                   9174: 
                   9175:               <dt><span class="term">configure</span></dt>
                   9176: 
                   9177:               <dd>
                   9178:                 <p>Most pieces of software need information on the
                   9179:                 header files, system calls, and library routines
                   9180:                 which are available in NetBSD. This is the process
                   9181:                 known as configuration, and is usually automated.
                   9182:                 In most cases, a script is supplied with the
                   9183:                 source, and its invocation results in generation of
                   9184:                 header files, Makefiles, etc.</p>
                   9185: 
                   9186:                 <p>If the program's distfile contains its own
                   9187:                 configure script, this can be invoked by setting
1.14      xtraeme  9188:                 <code class="varname">HAS_CONFIGURE</code>. If the
1.1       grant    9189:                 configure script is a GNU autoconf script,
1.14      xtraeme  9190:                 <code class="varname">GNU_CONFIGURE</code> should
                   9191:                 be specified instead. In either case, any arguments
                   9192:                 to the configure script can be specified in the
                   9193:                 <code class="varname">CONFIGURE_ARGS</code>
                   9194:                 variable, and the configure script's name can be
                   9195:                 set in <code class=
                   9196:                 "varname">CONFIGURE_SCRIPT</code> if it differs
                   9197:                 from the default &#8220;<span class=
1.1       grant    9198:                 "quote">configure</span>&#8221;. Here's an example
                   9199:                 from the <a xmlns=
                   9200:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   9201:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.20      ben      9202:                 class="pkgname">sysutils/top</a> package:</p>
1.1       grant    9203:                 <pre class="programlisting">
                   9204: HAS_CONFIGURE=          yes
                   9205: CONFIGURE_SCRIPT=       Configure
                   9206: CONFIGURE_ARGS+=        netbsd13
                   9207: </pre>
                   9208: 
                   9209:                 <p>If the program uses an Imakefile for
                   9210:                 configuration, the appropriate steps can be invoked
1.14      xtraeme  9211:                 by setting <code class="varname">USE_IMAKE</code>
                   9212:                 to &#8220;<span class="quote">YES</span>&#8221;.
                   9213:                 (If you only want the package installed in
                   9214:                 <code class="varname">$X11PREFIX</code> but xmkmf
                   9215:                 not being run, set <code class=
                   9216:                 "varname">USE_X11BASE</code> instead!)</p>
1.1       grant    9217:               </dd>
                   9218: 
                   9219:               <dt><span class="term">build</span></dt>
                   9220: 
                   9221:               <dd>
                   9222:                 <p>Once configuration has taken place, the software
1.14      xtraeme  9223:                 will be built by invoking <code class=
                   9224:                 "varname">$MAKE_PROGRAM</code> on <code class=
                   9225:                 "varname">$MAKEFILE</code> with <code class=
                   9226:                 "varname">$BUILD_TARGET</code> as the target to
                   9227:                 build. The default <code class=
                   9228:                 "varname">MAKE_PROGRAM</code> is
                   9229:                 &#8220;<span class="quote">gmake</span>&#8221; if
1.29      rillig   9230:                 <code class="varname">USE_TOOLS</code> contains
                   9231:                 &#8220;<span class="quote">gmake</span>&#8221;,
1.1       grant    9232:                 &#8220;<span class="quote">make</span>&#8221;
1.14      xtraeme  9233:                 otherwise. <code class="varname">MAKEFILE</code> is
                   9234:                 set to &#8220;<span class=
1.1       grant    9235:                 "quote">Makefile</span>&#8221; by default, and
1.14      xtraeme  9236:                 <code class="varname">BUILD_TARGET</code> defaults
                   9237:                 to &#8220;<span class="quote">all</span>&#8221;.
                   9238:                 Any of these variables can be set in the package's
1.1       grant    9239:                 Makefile to change the default build process.</p>
                   9240:               </dd>
                   9241: 
                   9242:               <dt><span class="term">install</span></dt>
                   9243: 
                   9244:               <dd>
                   9245:                 <p>Once the build stage has completed, the final
                   9246:                 step is to install the software in public
                   9247:                 directories, so users can access the programs and
1.14      xtraeme  9248:                 files. As in the build-target, <code class=
                   9249:                 "varname">$MAKE_PROGRAM</code> is invoked on
                   9250:                 <code class="varname">$MAKEFILE</code> here, but
                   9251:                 with the <code class=
                   9252:                 "varname">$INSTALL_TARGET</code> instead, the
                   9253:                 latter defaulting to &#8220;<span class=
                   9254:                 "quote">install</span>&#8221; (plus
                   9255:                 &#8220;<span class=
                   9256:                 "quote">install.man</span>&#8221;, if <code class=
                   9257:                 "varname">USE_IMAKE</code> is set).</p>
1.1       grant    9258:               </dd>
                   9259:             </dl>
                   9260:           </div>
                   9261: 
                   9262:           <p>If no target is specified, the default is
                   9263:           &#8220;<span class="quote">build</span>&#8221;. If a
                   9264:           subsequent stage is requested, all prior stages are made:
1.14      xtraeme  9265:           e.g. <span><strong class="command">make
                   9266:           build</strong></span> will also perform the equivalent
                   9267:           of:</p>
1.1       grant    9268:           <pre class="programlisting">
                   9269: make fetch
                   9270: make checksum
                   9271: make extract
                   9272: make patch
                   9273: make configure
                   9274: make build
                   9275: </pre>
                   9276:         </div>
                   9277: 
                   9278:         <div class="sect1" lang="en" xml:lang="en">
                   9279:           <div class="titlepage">
                   9280:             <div>
                   9281:               <div>
                   9282:                 <h2 class="title" style="clear: both"><a name=
                   9283:                 "build.helpful-targets" id=
1.35      jmmv     9284:                 "build.helpful-targets"></a>13.3.&nbsp;Other
1.1       grant    9285:                 helpful targets</h2>
                   9286:               </div>
                   9287:             </div>
                   9288:           </div>
                   9289: 
                   9290:           <div class="variablelist">
                   9291:             <dl>
                   9292:               <dt><span class="term">pre/post-*</span></dt>
                   9293: 
                   9294:               <dd>
                   9295:                 <p>For any of the main targets described in the
                   9296:                 previous section, two auxiliary targets exist with
                   9297:                 &#8220;<span class="quote">pre-</span>&#8221; and
                   9298:                 &#8220;<span class="quote">post-</span>&#8221; used
                   9299:                 as a prefix for the main target's name. These
                   9300:                 targets are invoked before and after the main
                   9301:                 target is called, allowing extra configuration or
                   9302:                 installation steps be performed from a package's
                   9303:                 Makefile, for example, which a program's configure
                   9304:                 script or install target omitted.</p>
                   9305:               </dd>
                   9306: 
                   9307:               <dt><span class="term">do-*</span></dt>
                   9308: 
                   9309:               <dd>
                   9310:                 <p>Should one of the main targets do the wrong
                   9311:                 thing, and should there be no variable to fix this,
                   9312:                 you can redefine it with the do-* target. (Note
                   9313:                 that redefining the target itself instead of the
                   9314:                 do-* target is a bad idea, as the pre-* and post-*
                   9315:                 targets won't be called anymore, etc.) You will not
                   9316:                 usually need to do this.</p>
                   9317:               </dd>
                   9318: 
                   9319:               <dt><span class="term">reinstall</span></dt>
                   9320: 
                   9321:               <dd>
1.14      xtraeme  9322:                 <p>If you did a <span><strong class="command">make
                   9323:                 install</strong></span> and you noticed some file
                   9324:                 was not installed properly, you can repeat the
1.1       grant    9325:                 installation with this target, which will ignore
                   9326:                 the &#8220;<span class="quote">already
                   9327:                 installed</span>&#8221; flag.</p>
                   9328:               </dd>
                   9329: 
                   9330:               <dt><span class="term">deinstall</span></dt>
                   9331: 
                   9332:               <dd>
1.24      wiz      9333:                 <p>This target does a <a href=
                   9334:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   9335:                 <span class="citerefentry"><span class=
                   9336:                 "refentrytitle">pkg_delete</span>(1)</span></a> in
                   9337:                 the current directory, effectively de-installing
                   9338:                 the package. The following variables can be used to
                   9339:                 tune the behaviour:</p>
1.1       grant    9340: 
                   9341:                 <div class="variablelist">
                   9342:                   <dl>
1.14      xtraeme  9343:                     <dt><span class="term"><code class=
                   9344:                     "varname">PKG_VERBOSE</code></span></dt>
1.1       grant    9345: 
                   9346:                     <dd>
                   9347:                       <p>Add a "-v" to the <a href=
                   9348:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   9349:                       <span class="citerefentry"><span class=
                   9350:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   9351:                       command.</p>
                   9352:                     </dd>
                   9353: 
1.14      xtraeme  9354:                     <dt><span class="term"><code class=
                   9355:                     "varname">DEINSTALLDEPENDS</code></span></dt>
1.1       grant    9356: 
                   9357:                     <dd>
                   9358:                       <p>Remove all packages that require (depend
                   9359:                       on) the given package. This can be used to
                   9360:                       remove any packages that may have been pulled
                   9361:                       in by a given package, e.g. if
1.14      xtraeme  9362:                       <span><strong class="command">make deinstall
                   9363:                       DEINSTALLDEPENDS=1</strong></span> is done in
                   9364:                       <code class="filename">pkgsrc/x11/kde</code>,
1.1       grant    9365:                       this is likely to remove whole KDE. Works by
                   9366:                       adding &#8220;<span class=
                   9367:                       "quote">-R</span>&#8221; to the <a href=
                   9368:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   9369:                       <span class="citerefentry"><span class=
                   9370:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   9371:                       command line.</p>
                   9372:                     </dd>
                   9373:                   </dl>
                   9374:                 </div>
                   9375:               </dd>
                   9376: 
                   9377:               <dt><span class="term">update</span></dt>
                   9378: 
                   9379:               <dd>
                   9380:                 <p>This target causes the current package to be
                   9381:                 updated to the latest version. The package and all
                   9382:                 depending packages first get de-installed, then
                   9383:                 current versions of the corresponding packages get
                   9384:                 compiled and installed. This is similar to manually
                   9385:                 noting which packages are currently installed, then
1.14      xtraeme  9386:                 performing a series of <span><strong class=
                   9387:                 "command">make deinstall</strong></span> and
                   9388:                 <span><strong class="command">make
                   9389:                 install</strong></span> (or whatever <code class=
                   9390:                 "varname">UPDATE_TARGET</code> is set to) for these
                   9391:                 packages.</p>
1.1       grant    9392: 
                   9393:                 <p>You can use the &#8220;<span class=
                   9394:                 "quote">update</span>&#8221; target to resume
1.14      xtraeme  9395:                 package updating in case a previous
                   9396:                 <span><strong class="command">make
                   9397:                 update</strong></span> was interrupted for some
                   9398:                 reason. However, in this case, make sure you don't
                   9399:                 call <span><strong class="command">make
                   9400:                 clean</strong></span> or otherwise remove the list
                   9401:                 of dependent packages in <code class=
                   9402:                 "varname">WRKDIR</code>. Otherwise you lose the
1.1       grant    9403:                 ability to automatically update the current package
                   9404:                 along with the dependent packages you have
                   9405:                 installed.</p>
                   9406: 
1.14      xtraeme  9407:                 <p>Resuming an interrupted <span><strong class=
                   9408:                 "command">make update</strong></span> will only
                   9409:                 work as long as the package tree remains unchanged.
                   9410:                 If the source code for one of the packages to be
                   9411:                 updated has been changed, resuming
                   9412:                 <span><strong class="command">make
                   9413:                 update</strong></span> will most certainly
                   9414:                 fail!</p>
1.1       grant    9415: 
                   9416:                 <p>The following variables can be used either on
1.14      xtraeme  9417:                 the command line or in <code class=
                   9418:                 "filename">/etc/mk.conf</code> to alter the
                   9419:                 behaviour of <span><strong class="command">make
                   9420:                 update</strong></span>:</p>
1.1       grant    9421: 
                   9422:                 <div class="variablelist">
                   9423:                   <dl>
1.14      xtraeme  9424:                     <dt><span class="term"><code class=
                   9425:                     "varname">UPDATE_TARGET</code></span></dt>
1.1       grant    9426: 
                   9427:                     <dd>
                   9428:                       <p>Install target to recursively use for the
                   9429:                       updated package and the dependent packages.
1.14      xtraeme  9430:                       Defaults to <code class=
                   9431:                       "varname">DEPENDS_TARGET</code> if set,
1.1       grant    9432:                       &#8220;<span class=
                   9433:                       "quote">install</span>&#8221; otherwise for
1.14      xtraeme  9434:                       <span><strong class="command">make
                   9435:                       update</strong></span>. e.g.
                   9436:                       <span><strong class="command">make update
                   9437:                       UPDATE_TARGET=package</strong></span></p>
1.1       grant    9438:                     </dd>
                   9439: 
1.14      xtraeme  9440:                     <dt><span class="term"><code class=
                   9441:                     "varname">NOCLEAN</code></span></dt>
1.1       grant    9442: 
                   9443:                     <dd>
                   9444:                       <p>Don't clean up after updating. Useful if
                   9445:                       you want to leave the work sources of the
                   9446:                       updated packages around for inspection or
                   9447:                       other purposes. Be sure you eventually clean
                   9448:                       up the source tree (see the
                   9449:                       &#8220;<span class=
                   9450:                       "quote">clean-update</span>&#8221; target
                   9451:                       below) or you may run into troubles with old
                   9452:                       source code still lying around on your next
1.14      xtraeme  9453:                       <span><strong class=
                   9454:                       "command">make</strong></span> or
                   9455:                       <span><strong class="command">make
                   9456:                       update</strong></span>.</p>
1.1       grant    9457:                     </dd>
                   9458: 
1.14      xtraeme  9459:                     <dt><span class="term"><code class=
                   9460:                     "varname">REINSTALL</code></span></dt>
1.1       grant    9461: 
                   9462:                     <dd>
                   9463:                       <p>Deinstall each package before installing
1.14      xtraeme  9464:                       (making <code class=
                   9465:                       "varname">DEPENDS_TARGET</code>). This may be
1.1       grant    9466:                       necessary if the &#8220;<span class=
                   9467:                       "quote">clean-update</span>&#8221; target
                   9468:                       (see below) was called after interrupting a
1.14      xtraeme  9469:                       running <span><strong class="command">make
                   9470:                       update</strong></span>.</p>
1.1       grant    9471:                     </dd>
                   9472: 
1.14      xtraeme  9473:                     <dt><span class="term"><code class=
                   9474:                     "varname">DEPENDS_TARGET</code></span></dt>
1.1       grant    9475: 
                   9476:                     <dd>
                   9477:                       <p>Allows you to disable recursion and
                   9478:                       hardcode the target for packages. The default
                   9479:                       is &#8220;<span class=
                   9480:                       "quote">update</span>&#8221; for the update
                   9481:                       target, facilitating a recursive update of
1.14      xtraeme  9482:                       prerequisite packages. Only set <code class=
                   9483:                       "varname">DEPENDS_TARGET</code> if you want
                   9484:                       to disable recursive updates. Use
                   9485:                       <code class="varname">UPDATE_TARGET</code>
                   9486:                       instead to just set a specific target for
                   9487:                       each package to be installed during
                   9488:                       <span><strong class="command">make
                   9489:                       update</strong></span> (see above).</p>
1.1       grant    9490:                     </dd>
                   9491:                   </dl>
                   9492:                 </div>
                   9493:               </dd>
                   9494: 
                   9495:               <dt><span class="term">clean-update</span></dt>
                   9496: 
                   9497:               <dd>
                   9498:                 <p>Clean the source tree for all packages that
1.14      xtraeme  9499:                 would get updated if <span><strong class=
                   9500:                 "command">make update</strong></span> was called
                   9501:                 from the current directory. This target should not
                   9502:                 be used if the current package (or any of its
                   9503:                 depending packages) have already been de-installed
                   9504:                 (e.g., after calling <span><strong class=
                   9505:                 "command">make update</strong></span>) or you may
                   9506:                 lose some packages you intended to update. As a
                   9507:                 rule of thumb: only use this target <span class=
                   9508:                 "emphasis"><em>before</em></span> the first time
                   9509:                 you run <span><strong class="command">make
                   9510:                 update</strong></span> and only if you have a dirty
                   9511:                 package tree (e.g., if you used <code class=
                   9512:                 "varname">NOCLEAN</code>).</p>
1.1       grant    9513: 
                   9514:                 <p>If you unsure about whether your tree is clean
1.14      xtraeme  9515:                 you can either perform a <span><strong class=
                   9516:                 "command">make clean</strong></span> at the top of
                   9517:                 the tree, or use the following sequence of commands
1.1       grant    9518:                 from the directory of the package you want to
                   9519:                 update (<span class=
                   9520:                 "emphasis"><em>before</em></span> running
1.14      xtraeme  9521:                 <span><strong class="command">make
                   9522:                 update</strong></span> for the first time,
                   9523:                 otherwise you lose all the packages you wanted to
                   9524:                 update!):</p>
1.1       grant    9525:                 <pre class="screen">
1.14      xtraeme  9526: <code class="prompt">#</code> <strong class=
                   9527: "userinput"><code>make clean-update</code></strong>
                   9528: <code class="prompt">#</code> <strong class=
                   9529: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
                   9530: <code class="prompt">#</code> <strong class=
                   9531: "userinput"><code>make update</code></strong>
1.1       grant    9532: </pre>
                   9533: 
                   9534:                 <p>The following variables can be used either on
1.14      xtraeme  9535:                 the command line or in <code class=
                   9536:                 "filename">/etc/mk.conf</code> to alter the
                   9537:                 behaviour of <span><strong class="command">make
                   9538:                 clean-update</strong></span>:</p>
1.1       grant    9539: 
                   9540:                 <div class="variablelist">
                   9541:                   <dl>
1.14      xtraeme  9542:                     <dt><span class="term"><code class=
                   9543:                     "varname">CLEAR_DIRLIST</code></span></dt>
1.1       grant    9544: 
                   9545:                     <dd>
1.14      xtraeme  9546:                       <p>After <span><strong class="command">make
                   9547:                       clean</strong></span>, do not reconstruct the
                   9548:                       list of directories to update for this
                   9549:                       package. Only use this if
                   9550:                       <span><strong class="command">make
                   9551:                       update</strong></span> successfully installed
                   9552:                       all packages you wanted to update. Normally,
                   9553:                       this is done automatically on
                   9554:                       <span><strong class="command">make
                   9555:                       update</strong></span>, but may have been
                   9556:                       suppressed by the <code class=
                   9557:                       "varname">NOCLEAN</code> variable (see
1.1       grant    9558:                       above).</p>
                   9559:                     </dd>
                   9560:                   </dl>
                   9561:                 </div>
                   9562:               </dd>
                   9563: 
                   9564:               <dt><span class="term">info</span></dt>
                   9565: 
                   9566:               <dd>
                   9567:                 <p>This target invokes <a href=
                   9568:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   9569:                 <span class="citerefentry"><span class=
                   9570:                 "refentrytitle">pkg_info</span>(1)</span></a> for
                   9571:                 the current package. You can use this to check
                   9572:                 which version of a package is installed.</p>
                   9573:               </dd>
                   9574: 
                   9575:               <dt><span class="term">readme</span></dt>
                   9576: 
                   9577:               <dd>
1.14      xtraeme  9578:                 <p>This target generates a <code class=
                   9579:                 "filename">README.html</code> file, which can be
1.1       grant    9580:                 viewed using a browser such as <a xmlns=
                   9581:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   9582:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20      ben      9583:                 class="pkgname">www/mozilla</a> or <a xmlns=
                   9584:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   9585:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
                   9586:                 class="pkgname">www/links</a>. The generated files
                   9587:                 contain references to any packages which are in the
                   9588:                 <code class="varname">PACKAGES</code> directory on
                   9589:                 the local host. The generated files can be made to
                   9590:                 refer to URLs based on <code class=
                   9591:                 "varname">FTP_PKG_URL_HOST</code> and <code class=
                   9592:                 "varname">FTP_PKG_URL_DIR</code>. For example, if I
                   9593:                 wanted to generate <code class=
                   9594:                 "filename">README.html</code> files which pointed
                   9595:                 to binary packages on the local machine, in the
                   9596:                 directory <code class=
                   9597:                 "filename">/usr/packages</code>, set <code class=
                   9598:                 "varname">FTP_PKG_URL_HOST=file://localhost</code>
                   9599:                 and <code class=
                   9600:                 "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
                   9601:                 <code class="varname">${PACKAGES}</code> directory
                   9602:                 and its subdirectories will be searched for all the
                   9603:                 binary packages.</p>
1.1       grant    9604:               </dd>
                   9605: 
                   9606:               <dt><span class="term">readme-all</span></dt>
                   9607: 
                   9608:               <dd>
1.14      xtraeme  9609:                 <p>Use this target to create a file <code class=
                   9610:                 "filename">README-all.html</code> which contains a
1.1       grant    9611:                 list of all packages currently available in the
                   9612:                 NetBSD Packages Collection, together with the
                   9613:                 category they belong to and a short description.
1.14      xtraeme  9614:                 This file is compiled from the <code class=
                   9615:                 "filename">pkgsrc/*/README.html</code> files, so be
1.1       grant    9616:                 sure to run this <span class=
1.14      xtraeme  9617:                 "emphasis"><em>after</em></span> a
                   9618:                 <span><strong class="command">make
                   9619:                 readme</strong></span>.</p>
1.1       grant    9620:               </dd>
                   9621: 
                   9622:               <dt><span class="term">cdrom-readme</span></dt>
                   9623: 
                   9624:               <dd>
                   9625:                 <p>This is very much the same as the
                   9626:                 &#8220;<span class="quote">readme</span>&#8221;
                   9627:                 target (see above), but is to be used when
                   9628:                 generating a pkgsrc tree to be written to a CD-ROM.
1.14      xtraeme  9629:                 This target also produces <code class=
                   9630:                 "filename">README.html</code> files, and can be
                   9631:                 made to refer to URLs based on <code class=
                   9632:                 "varname">CDROM_PKG_URL_HOST</code> and
                   9633:                 <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1       grant    9634:               </dd>
                   9635: 
                   9636:               <dt><span class="term">show-distfiles</span></dt>
                   9637: 
                   9638:               <dd>
                   9639:                 <p>This target shows which distfiles and patchfiles
1.14      xtraeme  9640:                 are needed to build the package. (<code class=
                   9641:                 "varname">DISTFILES</code> and <code class=
                   9642:                 "varname">PATCHFILES</code>, but not <code class=
                   9643:                 "filename">patches/*</code>)</p>
1.1       grant    9644:               </dd>
                   9645: 
                   9646:               <dt><span class="term">show-downlevel</span></dt>
                   9647: 
                   9648:               <dd>
                   9649:                 <p>This target shows nothing if the package is not
                   9650:                 installed. If a version of this package is
                   9651:                 installed, but is not the version provided in this
                   9652:                 version of pkgsrc, then a warning message is
                   9653:                 displayed. This target can be used to show which of
                   9654:                 your installed packages are downlevel, and so the
                   9655:                 old versions can be deleted, and the current ones
                   9656:                 added.</p>
                   9657:               </dd>
                   9658: 
                   9659:               <dt><span class="term">show-pkgsrc-dir</span></dt>
                   9660: 
                   9661:               <dd>
                   9662:                 <p>This target shows the directory in the pkgsrc
                   9663:                 hierarchy from which the package can be built and
                   9664:                 installed. This may not be the same directory as
                   9665:                 the one from which the package was installed. This
                   9666:                 target is intended to be used by people who may
                   9667:                 wish to upgrade many packages on a single host, and
                   9668:                 can be invoked from the top-level pkgsrc Makefile
                   9669:                 by using the &#8220;<span class=
                   9670:                 "quote">show-host-specific-pkgs</span>&#8221;
                   9671:                 target.</p>
                   9672:               </dd>
                   9673: 
                   9674:               <dt><span class=
                   9675:               "term">show-installed-depends</span></dt>
                   9676: 
                   9677:               <dd>
                   9678:                 <p>This target shows which installed packages match
1.14      xtraeme  9679:                 the current package's <code class=
                   9680:                 "varname">DEPENDS</code>. Useful if out of date
1.1       grant    9681:                 dependencies are causing build problems.</p>
                   9682:               </dd>
                   9683: 
                   9684:               <dt><span class="term">check-shlibs</span></dt>
                   9685: 
                   9686:               <dd>
                   9687:                 <p>After a package is installed, check all its
                   9688:                 binaries and (on ELF platforms) shared libraries to
                   9689:                 see if they find the shared libs they need. Run by
1.14      xtraeme  9690:                 default if <code class=
                   9691:                 "varname">PKG_DEVELOPER</code> is set in
                   9692:                 <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    9693:               </dd>
                   9694: 
                   9695:               <dt><span class="term">print-PLIST</span></dt>
                   9696: 
                   9697:               <dd>
                   9698:                 <p>After a &#8220;<span class="quote">make
                   9699:                 install</span>&#8221; from a new or upgraded pkg,
                   9700:                 this prints out an attempt to generate a new
1.14      xtraeme  9701:                 <code class="filename">PLIST</code> from a
                   9702:                 <span><strong class="command">find -newer
                   9703:                 work/.extract_done</strong></span>. An attempt is
                   9704:                 made to care for shared libs etc., but it is
1.1       grant    9705:                 <span class="emphasis"><em>strongly</em></span>
                   9706:                 recommended to review the result before putting it
1.14      xtraeme  9707:                 into <code class="filename">PLIST</code>. On
                   9708:                 upgrades, it's useful to diff the output of this
                   9709:                 command against an already existing <code class=
                   9710:                 "filename">PLIST</code> file.</p>
1.1       grant    9711: 
1.24      wiz      9712:                 <p>If the package installs files via <a href=
                   9713:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   9714:                 <span class="citerefentry"><span class=
                   9715:                 "refentrytitle">tar</span>(1)</span></a> or other
                   9716:                 methods that don't update file access times, be
                   9717:                 sure to add these files manually to your
1.14      xtraeme  9718:                 <code class="filename">PLIST</code>, as the
1.1       grant    9719:                 &#8220;<span class="quote">find
                   9720:                 -newer</span>&#8221; command used by this target
                   9721:                 won't catch them!</p>
                   9722: 
                   9723:                 <p>See <a href="#print-PLIST" title=
1.25      rillig   9724:                 "9.3.&nbsp;Tweaking output of make print-PLIST">Section&nbsp;9.3,
1.14      xtraeme  9725:                 &#8220;Tweaking output of <span><strong class=
                   9726:                 "command">make
                   9727:                 print-PLIST</strong></span>&#8221;</a> for more
                   9728:                 information on this target.</p>
1.1       grant    9729:               </dd>
                   9730: 
                   9731:               <dt><span class="term">bulk-package</span></dt>
                   9732: 
                   9733:               <dd>
                   9734:                 <p>Used to do bulk builds. If an appropriate binary
                   9735:                 package already exists, no action is taken. If not,
                   9736:                 this target will compile, install and package it
1.14      xtraeme  9737:                 (and it's depends, if <code class=
                   9738:                 "varname">PKG_DEPENDS</code> is set properly. See
1.1       grant    9739:                 <a href="#binary.configuration" title=
                   9740:                 "5.3.1.&nbsp;Configuration">Section&nbsp;5.3.1,
                   9741:                 &#8220;Configuration&#8221;</a>. After creating the
                   9742:                 binary package, the sources, the just-installed
                   9743:                 package and it's required packages are removed,
                   9744:                 preserving free disk space.</p>
                   9745: 
                   9746:                 <p><span class="emphasis"><em>Beware that this
                   9747:                 target may deinstall all packages installed on a
                   9748:                 system!</em></span></p>
                   9749:               </dd>
                   9750: 
                   9751:               <dt><span class="term">bulk-install</span></dt>
                   9752: 
                   9753:               <dd>
                   9754:                 <p>Used during bulk-installs to install required
                   9755:                 packages. If an upto-date binary package is
                   9756:                 available, it will be installed via <a href=
                   9757:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   9758:                 <span class="citerefentry"><span class=
                   9759:                 "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14      xtraeme  9760:                 not, <span><strong class="command">make
                   9761:                 bulk-package</strong></span> will be executed, but
                   9762:                 the installed binary not be removed.</p>
1.1       grant    9763: 
                   9764:                 <p>A binary package is considered
                   9765:                 &#8220;<span class="quote">upto-date</span>&#8221;
                   9766:                 to be installed via <a href=
                   9767:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   9768:                 <span class="citerefentry"><span class=
                   9769:                 "refentrytitle">pkg_add</span>(1)</span></a>
                   9770:                 if:</p>
                   9771: 
                   9772:                 <div class="itemizedlist">
                   9773:                   <ul type="disc">
                   9774:                     <li>
1.14      xtraeme  9775:                       <p>None of the package's files (<code class=
                   9776:                       "filename">Makefile</code>, ...) were
                   9777:                       modified since it was built.</p>
1.1       grant    9778:                     </li>
                   9779: 
                   9780:                     <li>
                   9781:                       <p>None of the package's required (binary)
                   9782:                       packages were modified since it was
                   9783:                       built.</p>
                   9784:                     </li>
                   9785:                   </ul>
                   9786:                 </div>
                   9787: 
                   9788:                 <p><span class="emphasis"><em>Beware that this
                   9789:                 target may deinstall all packages installed on a
                   9790:                 system!</em></span></p>
                   9791:               </dd>
                   9792:             </dl>
                   9793:           </div>
                   9794:         </div>
                   9795:       </div>
                   9796: 
                   9797:       <div class="chapter" lang="en" xml:lang="en">
                   9798:         <div class="titlepage">
                   9799:           <div>
                   9800:             <div>
                   9801:               <h2 class="title"><a name="fixes" id=
1.35      jmmv     9802:               "fixes"></a>Chapter&nbsp;14.&nbsp;Notes on fixes for
1.1       grant    9803:               packages</h2>
                   9804:             </div>
                   9805:           </div>
                   9806:         </div>
                   9807: 
                   9808:         <div class="toc">
                   9809:           <p><b>Table of Contents</b></p>
                   9810: 
                   9811:           <dl>
1.30      wiz      9812:             <dt><span class="sect1"><a href=
1.35      jmmv     9813:             "#general-operation">14.1. General
1.30      wiz      9814:             operation</a></span></dt>
1.1       grant    9815: 
                   9816:             <dd>
                   9817:               <dl>
                   9818:                 <dt><span class="sect2"><a href=
1.35      jmmv     9819:                 "#pulling-vars-from-etc-mk.conf">14.1.1. How to
1.30      wiz      9820:                 pull in variables from /etc/mk.conf</a></span></dt>
1.1       grant    9821: 
                   9822:                 <dt><span class="sect2"><a href=
1.35      jmmv     9823:                 "#where-to-install-documentation">14.1.2. Where to
1.31      wiz      9824:                 install documentation</a></span></dt>
                   9825: 
                   9826:                 <dt><span class="sect2"><a href=
1.35      jmmv     9827:                 "#restricted-packages">14.1.3. Restricted
1.1       grant    9828:                 packages</a></span></dt>
                   9829: 
                   9830:                 <dt><span class="sect2"><a href=
1.35      jmmv     9831:                 "#dependencies">14.1.4. Handling
1.1       grant    9832:                 dependencies</a></span></dt>
                   9833: 
                   9834:                 <dt><span class="sect2"><a href=
1.35      jmmv     9835:                 "#conflicts">14.1.5. Handling conflicts with other
1.1       grant    9836:                 packages</a></span></dt>
                   9837: 
                   9838:                 <dt><span class="sect2"><a href=
1.35      jmmv     9839:                 "#not-building-packages">14.1.6. Packages that
1.30      wiz      9840:                 cannot or should not be built</a></span></dt>
1.1       grant    9841: 
                   9842:                 <dt><span class="sect2"><a href=
1.35      jmmv     9843:                 "#undeletable-packages">14.1.7. Packages which
1.30      wiz      9844:                 should not be deleted, once
                   9845:                 installed</a></span></dt>
1.1       grant    9846: 
                   9847:                 <dt><span class="sect2"><a href=
1.35      jmmv     9848:                 "#security-handling">14.1.8. Handling packages with
1.1       grant    9849:                 security problems</a></span></dt>
                   9850: 
                   9851:                 <dt><span class="sect2"><a href=
1.35      jmmv     9852:                 "#compiler-bugs">14.1.9. How to handle compiler
1.1       grant    9853:                 bugs</a></span></dt>
                   9854: 
                   9855:                 <dt><span class="sect2"><a href=
1.35      jmmv     9856:                 "#bumping-pkgrevision">14.1.10. How to handle
1.30      wiz      9857:                 incrementing versions when fixing an existing
1.1       grant    9858:                 package</a></span></dt>
                   9859: 
                   9860:                 <dt><span class="sect2"><a href=
1.35      jmmv     9861:                 "#portability-of-packages">14.1.11. Portability of
1.1       grant    9862:                 packages</a></span></dt>
                   9863:               </dl>
                   9864:             </dd>
                   9865: 
1.30      wiz      9866:             <dt><span class="sect1"><a href=
1.35      jmmv     9867:             "#downloading-issues">14.2. Possible downloading
1.30      wiz      9868:             issues</a></span></dt>
1.1       grant    9869: 
                   9870:             <dd>
                   9871:               <dl>
                   9872:                 <dt><span class="sect2"><a href=
1.35      jmmv     9873:                 "#no-plain-download">14.2.1. Packages whose
1.30      wiz      9874:                 distfiles aren't available for plain
1.1       grant    9875:                 downloading</a></span></dt>
                   9876: 
                   9877:                 <dt><span class="sect2"><a href=
1.35      jmmv     9878:                 "#modified-distfiles-same-name">14.2.2. How to
1.30      wiz      9879:                 handle modified distfiles with the 'old'
                   9880:                 name</a></span></dt>
1.1       grant    9881:               </dl>
                   9882:             </dd>
                   9883: 
1.30      wiz      9884:             <dt><span class="sect1"><a href=
1.35      jmmv     9885:             "#configuration-gotchas">14.3. Configuration
1.30      wiz      9886:             gotchas</a></span></dt>
1.1       grant    9887: 
                   9888:             <dd>
                   9889:               <dl>
                   9890:                 <dt><span class="sect2"><a href=
1.35      jmmv     9891:                 "#fixes.libtool">14.3.1. Shared libraries -
1.1       grant    9892:                 libtool</a></span></dt>
                   9893: 
                   9894:                 <dt><span class="sect2"><a href=
1.35      jmmv     9895:                 "#using-libtool">14.3.2. Using libtool on GNU
1.30      wiz      9896:                 packages that already support
                   9897:                 libtool</a></span></dt>
1.1       grant    9898: 
                   9899:                 <dt><span class="sect2"><a href=
1.35      jmmv     9900:                 "#autoconf-automake">14.3.3. GNU
1.1       grant    9901:                 Autoconf/Automake</a></span></dt>
                   9902:               </dl>
                   9903:             </dd>
                   9904: 
1.30      wiz      9905:             <dt><span class="sect1"><a href=
1.35      jmmv     9906:             "#building-considerations">14.4. Building
1.30      wiz      9907:             considerations</a></span></dt>
1.1       grant    9908: 
                   9909:             <dd>
                   9910:               <dl>
                   9911:                 <dt><span class="sect2"><a href=
1.35      jmmv     9912:                 "#cpp-defines">14.4.1. CPP defines</a></span></dt>
1.1       grant    9913:               </dl>
                   9914:             </dd>
                   9915: 
1.30      wiz      9916:             <dt><span class="sect1"><a href=
1.35      jmmv     9917:             "#package-specific-actions">14.5. Package specific
1.30      wiz      9918:             actions</a></span></dt>
1.1       grant    9919: 
                   9920:             <dd>
                   9921:               <dl>
                   9922:                 <dt><span class="sect2"><a href=
1.35      jmmv     9923:                 "#user-interaction">14.5.1. User
1.2       hubertf  9924:                 interaction</a></span></dt>
1.1       grant    9925: 
                   9926:                 <dt><span class="sect2"><a href=
1.35      jmmv     9927:                 "#handling-licenses">14.5.2. Handling
1.1       grant    9928:                 licenses</a></span></dt>
                   9929: 
                   9930:                 <dt><span class="sect2"><a href=
1.35      jmmv     9931:                 "#installing-score-files">14.5.3. Installing score
1.1       grant    9932:                 files</a></span></dt>
                   9933: 
                   9934:                 <dt><span class="sect2"><a href=
1.35      jmmv     9935:                 "#perl-scripts">14.5.4. Packages containing perl
1.1       grant    9936:                 scripts</a></span></dt>
                   9937: 
                   9938:                 <dt><span class="sect2"><a href=
1.35      jmmv     9939:                 "#hardcoded-paths">14.5.5. Packages with hardcoded
1.30      wiz      9940:                 paths to other interpreters</a></span></dt>
1.1       grant    9941: 
                   9942:                 <dt><span class="sect2"><a href=
1.35      jmmv     9943:                 "#perl-modules">14.5.6. Packages installing perl
1.1       grant    9944:                 modules</a></span></dt>
                   9945: 
                   9946:                 <dt><span class="sect2"><a href=
1.35      jmmv     9947:                 "#faq.info-files">14.5.7. Packages installing info
1.1       grant    9948:                 files</a></span></dt>
                   9949: 
                   9950:                 <dt><span class="sect2"><a href=
1.35      jmmv     9951:                 "#gconf2-data-files">14.5.8. Packages installing
1.30      wiz      9952:                 GConf2 data files</a></span></dt>
1.1       grant    9953: 
                   9954:                 <dt><span class="sect2"><a href=
1.35      jmmv     9955:                 "#scrollkeeper-data-files">14.5.9. Packages
1.30      wiz      9956:                 installing scrollkeeper data files</a></span></dt>
1.1       grant    9957: 
                   9958:                 <dt><span class="sect2"><a href=
1.35      jmmv     9959:                 "#x11-fonts">14.5.10. Packages installing X11
1.1       grant    9960:                 fonts</a></span></dt>
                   9961: 
                   9962:                 <dt><span class="sect2"><a href=
1.35      jmmv     9963:                 "#gtk2-modules">14.5.11. Packages installing GTK2
1.1       grant    9964:                 modules</a></span></dt>
                   9965: 
                   9966:                 <dt><span class="sect2"><a href=
1.35      jmmv     9967:                 "#sgml-xml-data">14.5.12. Packages installing SGML
1.30      wiz      9968:                 or XML data</a></span></dt>
1.1       grant    9969: 
                   9970:                 <dt><span class="sect2"><a href=
1.35      jmmv     9971:                 "#mime-database">14.5.13. Packages installing
1.1       grant    9972:                 extensions to the MIME database</a></span></dt>
                   9973: 
                   9974:                 <dt><span class="sect2"><a href=
1.35      jmmv     9975:                 "#intltool">14.5.14. Packages using
1.1       grant    9976:                 intltool</a></span></dt>
1.18      xtraeme  9977: 
                   9978:                 <dt><span class="sect2"><a href=
1.35      jmmv     9979:                 "#startup-scripts">14.5.15. Packages installing
1.30      wiz      9980:                 startup scripts</a></span></dt>
1.1       grant    9981:               </dl>
                   9982:             </dd>
                   9983: 
1.30      wiz      9984:             <dt><span class="sect1"><a href=
1.35      jmmv     9985:             "#feedback-to-author">14.6. Feedback to the
1.30      wiz      9986:             author</a></span></dt>
1.1       grant    9987:           </dl>
                   9988:         </div>
                   9989: 
                   9990:         <div class="sect1" lang="en" xml:lang="en">
                   9991:           <div class="titlepage">
                   9992:             <div>
                   9993:               <div>
                   9994:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      9995:                 "general-operation" id=
1.35      jmmv     9996:                 "general-operation"></a>14.1.&nbsp;General
1.1       grant    9997:                 operation</h2>
                   9998:               </div>
                   9999:             </div>
                   10000:           </div>
                   10001: 
                   10002:           <div class="sect2" lang="en" xml:lang="en">
                   10003:             <div class="titlepage">
                   10004:               <div>
                   10005:                 <div>
1.30      wiz      10006:                   <h3 class="title"><a name=
                   10007:                   "pulling-vars-from-etc-mk.conf" id=
1.35      jmmv     10008:                   "pulling-vars-from-etc-mk.conf"></a>14.1.1.&nbsp;How
1.30      wiz      10009:                   to pull in variables from /etc/mk.conf</h3>
1.1       grant    10010:                 </div>
                   10011:               </div>
                   10012:             </div>
                   10013: 
                   10014:             <p>The problem with package-defined variables that can
1.14      xtraeme  10015:             be overridden via <code class="varname">MAKECONF</code>
                   10016:             or <code class="filename">/etc/mk.conf</code> is that
                   10017:             <a href=
1.1       grant    10018:             "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   10019:             <span class="citerefentry"><span class=
                   10020:             "refentrytitle">make</span>(1)</span></a> expands a
                   10021:             variable as it is used, but evaluates preprocessor like
                   10022:             statements (.if, .ifdef and .ifndef) as they are read.
1.14      xtraeme  10023:             So, to use any variable (which may be set in
                   10024:             <code class="filename">/etc/mk.conf</code>) in one of
                   10025:             the .if* statements, the file <code class=
                   10026:             "filename">/etc/mk.conf</code> must be included before
1.1       grant    10027:             that .if* statement.</p>
                   10028: 
                   10029:             <p>Rather than have a number of ad-hoc ways of
1.14      xtraeme  10030:             including <code class="filename">/etc/mk.conf</code>,
                   10031:             should it exist, or <code class=
                   10032:             "varname">MAKECONF</code>, should it exist, include the
                   10033:             <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
                   10034:             file in the package Makefile before any
                   10035:             preprocessor-like .if, .ifdef, or .ifndef
                   10036:             statements:</p>
1.1       grant    10037:             <pre class="programlisting">
                   10038: .include "../../mk/bsd.prefs.mk"
                   10039:     
                   10040:     .if defined(USE_MENUS)
                   10041:       ...
                   10042:     .endif
                   10043: </pre>
                   10044: 
1.14      xtraeme  10045:             <p>If you wish to set the <code class=
                   10046:             "varname">CFLAGS</code> variable in <code class=
                   10047:             "filename">/etc/mk.conf</code> please make sure to
1.1       grant    10048:             use:</p>
                   10049:             <pre class="programlisting">
                   10050: CFLAGS+=  -your -flags
                   10051: </pre>
                   10052: 
1.14      xtraeme  10053:             <p>Using <code class="varname">CFLAGS=</code> (i.e.
                   10054:             without the &#8220;<span class="quote">+</span>&#8221;)
                   10055:             may lead to problems with packages that need to add
                   10056:             their own flags. Also, you may want to take a look at
                   10057:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1       grant    10058:             href=
                   10059:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.20      ben      10060:             class="pkgname">devel/cpuflags</a> package if you're
                   10061:             interested in optimization for the current CPU.</p>
1.1       grant    10062:           </div>
                   10063: 
                   10064:           <div class="sect2" lang="en" xml:lang="en">
                   10065:             <div class="titlepage">
                   10066:               <div>
                   10067:                 <div>
1.31      wiz      10068:                   <h3 class="title"><a name=
                   10069:                   "where-to-install-documentation" id=
1.35      jmmv     10070:                   "where-to-install-documentation"></a>14.1.2.&nbsp;Where
1.31      wiz      10071:                   to install documentation</h3>
                   10072:                 </div>
                   10073:               </div>
                   10074:             </div>
                   10075: 
                   10076:             <p>Documentation should be installed into <code class=
                   10077:             "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
                   10078:             <code class=
                   10079:             "filename">${PREFIX}/share/doc/${PKGNAME}</code> (the
                   10080:             latter includes the version number of the package).</p>
                   10081:           </div>
                   10082: 
                   10083:           <div class="sect2" lang="en" xml:lang="en">
                   10084:             <div class="titlepage">
                   10085:               <div>
                   10086:                 <div>
1.30      wiz      10087:                   <h3 class="title"><a name="restricted-packages"
                   10088:                   id=
1.35      jmmv     10089:                   "restricted-packages"></a>14.1.3.&nbsp;Restricted
1.1       grant    10090:                   packages</h3>
                   10091:                 </div>
                   10092:               </div>
                   10093:             </div>
                   10094: 
                   10095:             <p>Some licenses restrict how software may be
                   10096:             re-distributed. In order to satisfy these restrictions,
                   10097:             the package system defines five make variables that can
                   10098:             be set to note these restrictions:</p>
                   10099: 
                   10100:             <div class="itemizedlist">
                   10101:               <ul type="disc">
                   10102:                 <li>
1.14      xtraeme  10103:                   <p><code class="varname">RESTRICTED</code></p>
1.1       grant    10104: 
                   10105:                   <p>This variable should be set whenever a
                   10106:                   restriction exists (regardless of its kind). Set
                   10107:                   this variable to a string containing the reason
                   10108:                   for the restriction.</p>
                   10109:                 </li>
                   10110: 
                   10111:                 <li>
1.14      xtraeme  10112:                   <p><code class=
                   10113:                   "varname">NO_BIN_ON_CDROM</code></p>
1.1       grant    10114: 
                   10115:                   <p>Binaries may not be placed on CD-ROM. Set this
1.14      xtraeme  10116:                   variable to <code class=
                   10117:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    10118:                   package may not be included on a CD-ROM.</p>
                   10119:                 </li>
                   10120: 
                   10121:                 <li>
1.14      xtraeme  10122:                   <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1       grant    10123: 
                   10124:                   <p>Binaries may not be placed on an FTP server.
1.14      xtraeme  10125:                   Set this variable to <code class=
                   10126:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    10127:                   package may not not be made available on the
                   10128:                   Internet.</p>
                   10129:                 </li>
                   10130: 
                   10131:                 <li>
1.14      xtraeme  10132:                   <p><code class=
                   10133:                   "varname">NO_SRC_ON_CDROM</code></p>
1.1       grant    10134: 
                   10135:                   <p>Distfiles may not be placed on CD-ROM. Set
1.14      xtraeme  10136:                   this variable to <code class=
                   10137:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    10138:                   of the source code or other distfile(s) is not
                   10139:                   allowed on CD-ROMs.</p>
                   10140:                 </li>
                   10141: 
                   10142:                 <li>
1.14      xtraeme  10143:                   <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1       grant    10144: 
                   10145:                   <p>Distfiles may not be placed on FTP. Set this
1.14      xtraeme  10146:                   variable to <code class=
                   10147:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    10148:                   of the source code or other distfile(s) via the
                   10149:                   Internet is not allowed.</p>
                   10150:                 </li>
                   10151:               </ul>
                   10152:             </div>
                   10153: 
1.14      xtraeme  10154:             <p>Please note that the use of <code class=
                   10155:             "varname">NO_PACKAGE</code>, <code class=
                   10156:             "varname">IGNORE</code>, <code class=
                   10157:             "varname">NO_CDROM</code>, or other generic make
1.1       grant    10158:             variables to denote restrictions is deprecated, because
                   10159:             they unconditionally prevent users from generating
                   10160:             binary packages!</p>
                   10161:           </div>
                   10162: 
                   10163:           <div class="sect2" lang="en" xml:lang="en">
                   10164:             <div class="titlepage">
                   10165:               <div>
                   10166:                 <div>
                   10167:                   <h3 class="title"><a name="dependencies" id=
1.35      jmmv     10168:                   "dependencies"></a>14.1.4.&nbsp;Handling
1.1       grant    10169:                   dependencies</h3>
                   10170:                 </div>
                   10171:               </div>
                   10172:             </div>
                   10173: 
                   10174:             <p>Your package may depend on some other package being
                   10175:             present - and there are various ways of expressing this
1.14      xtraeme  10176:             dependency. pkgsrc supports the <code class=
                   10177:             "varname">BUILD_DEPENDS</code> and <code class=
                   10178:             "varname">DEPENDS</code> definitions, as well as
                   10179:             dependencies via <code class=
                   10180:             "filename">buildlink3.mk</code>, which is the preferred
1.1       grant    10181:             way to handle dependencies, and which uses the
                   10182:             variables named above. See <a href="#buildlink" title=
1.25      rillig   10183:             "Chapter&nbsp;10.&nbsp;Buildlink methodology">Chapter&nbsp;10,
1.1       grant    10184:             <i>Buildlink methodology</i></a> for more
                   10185:             information.</p>
                   10186: 
                   10187:             <p>The basic difference between the two variables is as
1.14      xtraeme  10188:             follows: The <code class="varname">DEPENDS</code>
1.1       grant    10189:             definition registers that pre-requisite in the binary
                   10190:             package so it will be pulled in when the binary package
1.14      xtraeme  10191:             is later installed, whilst the <code class=
                   10192:             "varname">BUILD_DEPENDS</code> definition does not,
1.1       grant    10193:             marking a dependency that is only needed for building
                   10194:             the package.</p>
                   10195: 
                   10196:             <p>This means that if you only need a package present
                   10197:             whilst you are building, it should be noted as a
1.14      xtraeme  10198:             <code class="varname">BUILD_DEPENDS</code>.</p>
1.1       grant    10199: 
1.14      xtraeme  10200:             <p>The format for a <code class=
                   10201:             "varname">BUILD_DEPENDS</code> and a <code class=
                   10202:             "varname">DEPENDS</code> definition is:</p>
1.1       grant    10203:             <pre class="programlisting">
                   10204: &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
                   10205: </pre>
                   10206: 
                   10207:             <p>Please note that the &#8220;<span class=
                   10208:             "quote">pre-req-package-name</span>&#8221; may include
1.18      xtraeme  10209:             any of the wildcard version numbers recognized by
1.1       grant    10210:             <a href=
                   10211:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   10212:             <span class="citerefentry"><span class=
                   10213:             "refentrytitle">pkg_info</span>(1)</span></a>.</p>
                   10214: 
                   10215:             <div class="orderedlist">
                   10216:               <ol type="1">
                   10217:                 <li>
                   10218:                   <p>If your package needs another package's
                   10219:                   binaries or libraries to build or run, and if
1.14      xtraeme  10220:                   that package has a <code class=
                   10221:                   "filename">buildlink3.mk</code> file available,
                   10222:                   use it:</p>
1.1       grant    10223:                   <pre class="programlisting">
                   10224:     .include "../../graphics/jpeg/buildlink3.mk"
                   10225:     
                   10226: </pre>
                   10227:                 </li>
                   10228: 
                   10229:                 <li>
                   10230:                   <p>If your package needs to use another package
1.14      xtraeme  10231:                   to build itself and there is no <code class=
                   10232:                   "filename">buildlink3.mk</code> file available,
                   10233:                   use the <code class=
                   10234:                   "varname">BUILD_DEPENDS</code> definition:</p>
1.1       grant    10235:                   <pre class="programlisting">
                   10236: BUILD_DEPENDS+=  autoconf-2.13:../../devel/autoconf
                   10237: </pre>
                   10238:                 </li>
                   10239: 
                   10240:                 <li>
                   10241:                   <p>If your package needs a library with which to
1.14      xtraeme  10242:                   link and again there is no <code class=
                   10243:                   "filename">buildlink3.mk</code> file available,
                   10244:                   this is specified using the <code class=
                   10245:                   "varname">DEPENDS</code> definition. An example
                   10246:                   of this is the <a xmlns=
1.1       grant    10247:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   10248:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20      ben      10249:                   class="pkgname">print/lyx</a> package, which uses
                   10250:                   the xpm library, version 3.4j to build:</p>
1.1       grant    10251:                   <pre class="programlisting">
                   10252: DEPENDS+=       xpm-3.4j:../../graphics/xpm
                   10253: </pre>
                   10254: 
                   10255:                   <p>You can also use wildcards in package
                   10256:                   dependences:</p>
                   10257:                   <pre class="programlisting">
                   10258: DEPENDS+=       xpm-[0-9]*:../../graphics/xpm
                   10259: </pre>
                   10260: 
                   10261:                   <p>Note that such wildcard dependencies are
                   10262:                   retained when creating binary packages. The
                   10263:                   dependency is checked when installing the binary
                   10264:                   package and any package which matches the pattern
                   10265:                   will be used. Wildcard dependencies should be
                   10266:                   used with care.</p>
                   10267: 
                   10268:                   <p>The &#8220;<span class=
                   10269:                   "quote">-[0-9]*</span>&#8221; should be used
                   10270:                   instead of &#8220;<span class=
                   10271:                   "quote">-*</span>&#8221; to avoid potentially
                   10272:                   ambiguous matches such as &#8220;<span class=
                   10273:                   "quote">tk-postgresql</span>&#8221; matching a
                   10274:                   &#8220;<span class="quote">tk-*</span>&#8221;
1.14      xtraeme  10275:                   <code class="varname">DEPENDS</code>.</p>
1.1       grant    10276: 
                   10277:                   <p>Wildcards can also be used to specify that a
                   10278:                   package will only build against a certain minimum
                   10279:                   version of a pre-requisite:</p>
                   10280:                   <pre class="programlisting">
                   10281: DEPENDS+=       tiff&gt;=3.5.4:../../graphics/tiff
                   10282: </pre>
                   10283: 
                   10284:                   <p>This means that the package will build against
                   10285:                   version 3.5.4 of the tiff library or newer. Such
                   10286:                   a dependency may be warranted if, for example,
                   10287:                   the API of the library has changed with version
                   10288:                   3.5.4 and a package would not compile against an
                   10289:                   earlier version of tiff.</p>
                   10290: 
                   10291:                   <p>Please note that such dependencies should only
                   10292:                   be updated if a package requires a newer
                   10293:                   pre-requisite, but not to denote recommendations
                   10294:                   such as security updates or ABI changes that do
                   10295:                   not prevent a package from building correctly.
                   10296:                   Such recommendations can be expressed using
1.14      xtraeme  10297:                   <code class="varname">RECOMMENDED</code>:</p>
1.1       grant    10298:                   <pre class="programlisting">
                   10299: RECOMMENDED+=   tiff&gt;=3.6.1:../../graphics/tiff
                   10300: </pre>
                   10301: 
1.14      xtraeme  10302:                   <p>In addition to the above <code class=
                   10303:                   "varname">DEPENDS</code> line, this denotes that
1.1       grant    10304:                   while a package will build against
                   10305:                   tiff&gt;=3.5.4, at least version 3.6.1 is
1.14      xtraeme  10306:                   recommended. <code class=
                   10307:                   "varname">RECOMMENDED</code> entries will be
                   10308:                   turned into dependencies unless explicitly
                   10309:                   ignored (in which case a warning will be
1.36      wiz      10310:                   printed).</p>
                   10311: 
                   10312:                   <p>To ignore these dependency recommendations and
                   10313:                   just use the required <code class=
                   10314:                   "varname">DEPENDS</code>, set <code class=
                   10315:                   "varname">IGNORE_RECOMMENDED=YES</code>. This may
                   10316:                   make it easier and faster to update packages
                   10317:                   built using pkgsrc, since older compatible
                   10318:                   dependencies can continue to be used. This is
                   10319:                   useful for people who watch their rebuilds very
                   10320:                   carefully; it is not very good as a
                   10321:                   general-purpose hammer. If you use it, you need
                   10322:                   to be mindful of possible ABI changes, including
                   10323:                   those from the underlying OS.</p>
                   10324: 
                   10325:                   <p>Packages that are built with recommendations
                   10326:                   ignored may not be uploaded to ftp.NetBSD.org by
                   10327:                   developers and should not be used across
                   10328:                   different systems that may have different
                   10329:                   versions of binary packages installed.</p>
1.1       grant    10330: 
                   10331:                   <p>For security fixes, please update the package
                   10332:                   vulnerabilities file as well as setting
1.14      xtraeme  10333:                   <code class="varname">RECOMMENDED</code>, see
1.1       grant    10334:                   <a href="#security-handling" title=
1.35      jmmv     10335:                   "14.1.8.&nbsp;Handling packages with security problems">
                   10336:                   Section 14.1.8, &#8220;Handling packages with
1.1       grant    10337:                   security problems&#8221;</a> for more
                   10338:                   information.</p>
                   10339:                 </li>
                   10340: 
                   10341:                 <li>
                   10342:                   <p>If your package needs some executable to be
1.17      sketch   10343:                   able to run correctly and if there's no
1.14      xtraeme  10344:                   <code class="filename">buildlink3.mk</code> file,
                   10345:                   this is specified using the <code class=
                   10346:                   "varname">DEPENDS</code> variable. The <a xmlns=
1.1       grant    10347:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   10348:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20      ben      10349:                   class="pkgname">print/lyx</a> package needs to be
                   10350:                   able to execute the latex binary from the teTeX
                   10351:                   package when it runs, and that is specified:</p>
1.1       grant    10352:                   <pre class="programlisting">
                   10353: DEPENDS+=        teTeX-[0-9]*:../../print/teTeX
                   10354: </pre>
                   10355: 
                   10356:                   <p>The comment about wildcard dependencies from
                   10357:                   previous paragraph applies here, too.</p>
                   10358:                 </li>
                   10359:               </ol>
                   10360:             </div>
                   10361: 
                   10362:             <p>If your package needs files from another package to
                   10363:             build, see the first part of the &#8220;<span class=
                   10364:             "quote">do-configure</span>&#8221; target <a xmlns=
                   10365:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10366:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.20      ben      10367:             class="pkgname">print/ghostscript5</a> package (it
                   10368:             relies on the jpeg sources being present in source form
                   10369:             during the build):</p>
1.1       grant    10370:             <pre class="programlisting">
                   10371: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
                   10372:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} extract;              \
                   10373:     fi
                   10374: </pre>
                   10375: 
                   10376:             <p>If you build any other packages that way, please
                   10377:             make sure the working files are deleted too when this
                   10378:             package's working files are cleaned up. The easiest way
                   10379:             to do so is by adding a pre-clean target:</p>
                   10380:             <pre class="programlisting">
                   10381: pre-clean:
                   10382:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} clean
                   10383: </pre>
                   10384: 
1.14      xtraeme  10385:             <p>Please also note the <code class=
                   10386:             "varname">BUILD_USES_MSGFMT</code> and <code class=
                   10387:             "varname">BUILD_USES_GETTEXT_M4</code> definitions,
                   10388:             which are provided as convenience definitions. The
1.24      wiz      10389:             former works out whether <a href=
                   10390:             "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
                   10391:             <span class="citerefentry"><span class=
                   10392:             "refentrytitle">msgfmt</span>(1)</span></a> is part of
                   10393:             the base system, and, if it isn't, installs the
                   10394:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10395:             href=
1.1       grant    10396:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.20      ben      10397:             class="pkgname">devel/gettext</a> package. The latter
                   10398:             adds a build dependency on either an installed version
                   10399:             of an older gettext package, or if it isn't, installs
                   10400:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10401:             href=
                   10402:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
                   10403:             class="pkgname">devel/gettext-m4</a> package.</p>
1.1       grant    10404:           </div>
                   10405: 
                   10406:           <div class="sect2" lang="en" xml:lang="en">
                   10407:             <div class="titlepage">
                   10408:               <div>
                   10409:                 <div>
1.30      wiz      10410:                   <h3 class="title"><a name="conflicts" id=
1.35      jmmv     10411:                   "conflicts"></a>14.1.5.&nbsp;Handling conflicts
1.1       grant    10412:                   with other packages</h3>
                   10413:                 </div>
                   10414:               </div>
                   10415:             </div>
                   10416: 
                   10417:             <p>Your package may conflict with other packages a user
                   10418:             might already have installed on his system, e.g. if
                   10419:             your package installs the same set of files like
                   10420:             another package in our pkgsrc tree.</p>
                   10421: 
1.14      xtraeme  10422:             <p>In this case you can set <code class=
                   10423:             "varname">CONFLICTS</code> to a space separated list of
1.1       grant    10424:             packages (including version string) your package
                   10425:             conflicts with.</p>
                   10426: 
                   10427:             <p>For example <a xmlns=
                   10428:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10429:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.20      ben      10430:             class="pkgname">x11/Xaw3d</a> and <a xmlns=
                   10431:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10432:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
                   10433:             class="pkgname">x11/Xaw-Xpm</a> install provide the
                   10434:             same shared library, thus you set in <code class=
                   10435:             "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1       grant    10436:             <pre class="programlisting">
                   10437: CONFLICTS=      Xaw-Xpm-[0-9]*
                   10438: </pre>
                   10439: 
1.14      xtraeme  10440:             <p>and in <code class=
                   10441:             "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1       grant    10442:             <pre class="programlisting">
                   10443: CONFLICTS=      Xaw3d-[0-9]*
                   10444: </pre>
                   10445: 
                   10446:             <p>Packages will automatically conflict with other
                   10447:             packages with the name prefix and a different version
                   10448:             string. &#8220;<span class=
                   10449:             "quote">Xaw3d-1.5</span>&#8221; e.g. will automatically
                   10450:             conflict with the older version &#8220;<span class=
                   10451:             "quote">Xaw3d-1.3</span>&#8221;.</p>
                   10452:           </div>
                   10453: 
                   10454:           <div class="sect2" lang="en" xml:lang="en">
                   10455:             <div class="titlepage">
                   10456:               <div>
                   10457:                 <div>
1.30      wiz      10458:                   <h3 class="title"><a name="not-building-packages"
                   10459:                   id=
1.35      jmmv     10460:                   "not-building-packages"></a>14.1.6.&nbsp;Packages
1.30      wiz      10461:                   that cannot or should not be built</h3>
1.1       grant    10462:                 </div>
                   10463:               </div>
                   10464:             </div>
                   10465: 
                   10466:             <p>There are several reasons why a package might be
                   10467:             instructed to not build under certain circumstances. If
                   10468:             the package builds and runs on most platforms, the
1.14      xtraeme  10469:             exceptions should be noted with <code class=
                   10470:             "varname">NOT_FOR_PLATFORM</code>. If the package
                   10471:             builds and runs on a small handful of platforms, set
                   10472:             <code class="varname">ONLY_FOR_PLATFORM</code> instead.
                   10473:             If the package should be skipped (for example, because
                   10474:             it provides functionality already provided by the
                   10475:             system), set <code class=
                   10476:             "varname">PKG_SKIP_REASON</code> to a descriptive
                   10477:             message. If the package should fail because some
                   10478:             preconditions are not met, set <code class=
                   10479:             "varname">PKG_FAIL_REASON</code> to a descriptive
1.1       grant    10480:             message.</p>
                   10481: 
1.14      xtraeme  10482:             <p><code class="varname">IGNORE</code> is deprecated
1.1       grant    10483:             because it didn't provide enough information to
                   10484:             determine whether the build should fail.</p>
                   10485:           </div>
                   10486: 
                   10487:           <div class="sect2" lang="en" xml:lang="en">
                   10488:             <div class="titlepage">
                   10489:               <div>
                   10490:                 <div>
1.30      wiz      10491:                   <h3 class="title"><a name="undeletable-packages"
                   10492:                   id=
1.35      jmmv     10493:                   "undeletable-packages"></a>14.1.7.&nbsp;Packages
1.30      wiz      10494:                   which should not be deleted, once installed</h3>
1.1       grant    10495:                 </div>
                   10496:               </div>
                   10497:             </div>
                   10498: 
                   10499:             <p>To ensure that a package may not be deleted, once it
1.14      xtraeme  10500:             has been installed, the <code class=
                   10501:             "varname">PKG_PRESERVE</code> definition should be set
                   10502:             in the package Makefile. This will be carried into any
1.1       grant    10503:             binary package that is made from this pkgsrc entry. A
                   10504:             &#8220;<span class="quote">preserved</span>&#8221;
                   10505:             package will not be deleted using <a href=
                   10506:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   10507:             <span class="citerefentry"><span class=
                   10508:             "refentrytitle">pkg_delete</span>(1)</span></a> unless
                   10509:             the &#8220;<span class="quote">-f</span>&#8221; option
                   10510:             is used.</p>
                   10511:           </div>
                   10512: 
                   10513:           <div class="sect2" lang="en" xml:lang="en">
                   10514:             <div class="titlepage">
                   10515:               <div>
                   10516:                 <div>
                   10517:                   <h3 class="title"><a name="security-handling" id=
1.35      jmmv     10518:                   "security-handling"></a>14.1.8.&nbsp;Handling
1.1       grant    10519:                   packages with security problems</h3>
                   10520:                 </div>
                   10521:               </div>
                   10522:             </div>
                   10523: 
                   10524:             <p>When a vulnerability is found, this should be noted
1.14      xtraeme  10525:             in <code class=
                   10526:             "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.1       grant    10527:             and after the commit of that file, it should be copied
1.14      xtraeme  10528:             to both <code class=
                   10529:             "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</code>
                   10530:             and <code class=
                   10531:             "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</code>
                   10532:             on ftp.NetBSD.org using <code class=
                   10533:             "filename">localsrc/security/advisories/Makefile</code>.
                   10534:             In addition, if a <code class=
                   10535:             "filename">buildlink3.mk</code> file exists for an
                   10536:             affected package, bumping <code class=
                   10537:             "varname">PKGREVISION</code> and creating a
                   10538:             corresponding <code class=
                   10539:             "varname">BUILDLINK_RECOMMENDED.<em class=
                   10540:             "replaceable"><code>pkg</code></em></code> entry should
                   10541:             be considered. See <a href="#buildlink" title=
1.25      rillig   10542:             "Chapter&nbsp;10.&nbsp;Buildlink methodology">Chapter&nbsp;10,
1.1       grant    10543:             <i>Buildlink methodology</i></a> for more information
1.14      xtraeme  10544:             about writing <code class=
                   10545:             "filename">buildlink3.mk</code> files and <code class=
                   10546:             "varname">BUILDLINK_*</code> definitions.</p>
1.1       grant    10547: 
                   10548:             <p>Also, if the fix should be applied to the stable
                   10549:             pkgsrc branch, be sure to submit a pullup request!</p>
                   10550:           </div>
                   10551: 
                   10552:           <div class="sect2" lang="en" xml:lang="en">
                   10553:             <div class="titlepage">
                   10554:               <div>
                   10555:                 <div>
1.30      wiz      10556:                   <h3 class="title"><a name="compiler-bugs" id=
1.35      jmmv     10557:                   "compiler-bugs"></a>14.1.9.&nbsp;How to handle
1.1       grant    10558:                   compiler bugs</h3>
                   10559:                 </div>
                   10560:               </div>
                   10561:             </div>
                   10562: 
                   10563:             <p>Some source files trigger bugs in the compiler,
                   10564:             based on combinations of compiler version and
                   10565:             architecture and almost always relation to optimisation
                   10566:             being enabled. Common symptoms are gcc internal errors
                   10567:             or never finishing compiling a file.</p>
                   10568: 
                   10569:             <p>Typically a workaround involves testing the
1.14      xtraeme  10570:             <code class="varname">MACHINE_ARCH</code> and compiler
1.1       grant    10571:             version, disabling optimisation for that
1.14      xtraeme  10572:             file/<code class="varname">MACHINE_ARCH</code>/compiler
                   10573:             combination, and documenting it in <code class=
                   10574:             "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1       grant    10575:             number of examples!</p>
                   10576:           </div>
                   10577: 
                   10578:           <div class="sect2" lang="en" xml:lang="en">
                   10579:             <div class="titlepage">
                   10580:               <div>
                   10581:                 <div>
1.30      wiz      10582:                   <h3 class="title"><a name="bumping-pkgrevision"
1.35      jmmv     10583:                   id="bumping-pkgrevision"></a>14.1.10.&nbsp;How to
1.30      wiz      10584:                   handle incrementing versions when fixing an
                   10585:                   existing package</h3>
1.1       grant    10586:                 </div>
                   10587:               </div>
                   10588:             </div>
                   10589: 
                   10590:             <p>When making fixes to an existing package it can be
1.14      xtraeme  10591:             useful to change the version number in <code class=
                   10592:             "varname">PKGNAME</code>. To avoid conflicting with
1.1       grant    10593:             future versions by the original author, a
                   10594:             &#8220;<span class="quote">nb1</span>&#8221;,
                   10595:             &#8220;<span class="quote">nb2</span>&#8221;, ...
                   10596:             suffix can be used on package versions by setting
1.14      xtraeme  10597:             <code class="varname">PKGREVISION=1</code> (2, ...).
                   10598:             The &#8220;<span class="quote">nb</span>&#8221; is
                   10599:             treated like a &#8220;<span class=
                   10600:             "quote">.</span>&#8221; by the pkg tools. e.g.</p>
1.1       grant    10601:             <pre class="programlisting">
                   10602:   DISTNAME= foo-17.42
                   10603:     PKGREVISION=  9
                   10604: </pre>
                   10605: 
1.14      xtraeme  10606:             <p>will result in a <code class=
                   10607:             "varname">PKGNAME</code> of &#8220;<span class=
1.1       grant    10608:             "quote">foo-17.42nb9</span>&#8221;.</p>
                   10609: 
                   10610:             <p>When a new release of the package is released, the
1.14      xtraeme  10611:             <code class="varname">PKGREVISION</code> should be
                   10612:             removed. e.g. on a new minor release of the above
                   10613:             package, things should be like:</p>
1.1       grant    10614:             <pre class="programlisting">
                   10615: DISTNAME=   foo-17.43
                   10616: </pre>
                   10617:           </div>
                   10618: 
                   10619:           <div class="sect2" lang="en" xml:lang="en">
                   10620:             <div class="titlepage">
                   10621:               <div>
                   10622:                 <div>
1.30      wiz      10623:                   <h3 class="title"><a name=
                   10624:                   "portability-of-packages" id=
1.35      jmmv     10625:                   "portability-of-packages"></a>14.1.11.&nbsp;Portability
1.30      wiz      10626:                   of packages</h3>
1.1       grant    10627:                 </div>
                   10628:               </div>
                   10629:             </div>
                   10630: 
                   10631:             <p>One appealing feature of pkgsrc is that it runs on
                   10632:             many different platforms. As a result, it is important
                   10633:             to ensure, where possible, that packages in pkgsrc are
                   10634:             portable. There are some particular details you should
                   10635:             pay attention to while working on pkgsrc.</p>
                   10636: 
                   10637:             <div class="sect3" lang="en" xml:lang="en">
                   10638:               <div class="titlepage">
                   10639:                 <div>
                   10640:                   <div>
1.30      wiz      10641:                     <h4 class="title"><a name="install-scripts" id=
1.35      jmmv     10642:                     "install-scripts"></a>14.1.11.1.&nbsp;${INSTALL},
1.1       grant    10643:                     ${INSTALL_DATA_DIR}, ...</h4>
                   10644:                   </div>
                   10645:                 </div>
                   10646:               </div>
                   10647: 
1.14      xtraeme  10648:               <p>The BSD-compatible <span><strong class=
                   10649:               "command">install</strong></span> supplied with some
1.1       grant    10650:               operating systems will not perform more than one
                   10651:               operation at a time. As such, you should call
                   10652:               &#8220;<span class="quote">${INSTALL}</span>&#8221;,
                   10653:               etc. like this:</p>
                   10654:               <pre class="programlisting">
                   10655: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   10656: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
                   10657: </pre>
                   10658:             </div>
                   10659:           </div>
                   10660:         </div>
                   10661: 
                   10662:         <div class="sect1" lang="en" xml:lang="en">
                   10663:           <div class="titlepage">
                   10664:             <div>
                   10665:               <div>
                   10666:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      10667:                 "downloading-issues" id=
1.35      jmmv     10668:                 "downloading-issues"></a>14.2.&nbsp;Possible
1.1       grant    10669:                 downloading issues</h2>
                   10670:               </div>
                   10671:             </div>
                   10672:           </div>
                   10673: 
                   10674:           <div class="sect2" lang="en" xml:lang="en">
                   10675:             <div class="titlepage">
                   10676:               <div>
                   10677:                 <div>
1.30      wiz      10678:                   <h3 class="title"><a name="no-plain-download" id=
1.35      jmmv     10679:                   "no-plain-download"></a>14.2.1.&nbsp;Packages
1.30      wiz      10680:                   whose distfiles aren't available for plain
1.1       grant    10681:                   downloading</h3>
                   10682:                 </div>
                   10683:               </div>
                   10684:             </div>
                   10685: 
                   10686:             <p>If you need to download from a dynamic URL you can
1.14      xtraeme  10687:             set <code class="varname">DYNAMIC_MASTER_SITES</code>
                   10688:             and a <span><strong class="command">make
                   10689:             fetch</strong></span> will call <code class=
                   10690:             "filename">files/getsite.sh</code> with the name of
                   10691:             each file to download as an argument, expecting it to
                   10692:             output the URL of the directory from which to download
                   10693:             it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10694:             href=
1.1       grant    10695:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.20      ben      10696:             class="pkgname">graphics/ns-cult3d</a> is an example of
                   10697:             this usage.</p>
1.1       grant    10698: 
                   10699:             <p>If the download can't be automated, because the user
                   10700:             must submit personal information to apply for a
                   10701:             password, or must pay for the source, or whatever, you
1.14      xtraeme  10702:             can set <code class="varname">_FETCH_MESSAGE</code> to
                   10703:             a macro which displays a message explaining the
                   10704:             situation. <code class="varname">_FETCH_MESSAGE</code>
                   10705:             must be executable shell commands, not just a message.
                   10706:             (Generally, it executes <code class=
                   10707:             "varname">${ECHO}</code>). As of this writing, the
1.1       grant    10708:             following packages use this: <a xmlns=
                   10709:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10710:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.20      ben      10711:             class="pkgname">audio/realplayer</a>, <a xmlns=
                   10712:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10713:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
                   10714:             class="pkgname">cad/simian</a>, <a xmlns=
                   10715:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10716:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
                   10717:             class="pkgname">devel/ipv6socket</a>, <a xmlns=
                   10718:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10719:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
                   10720:             class="pkgname">emulators/vmware-module</a>, <a xmlns=
                   10721:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10722:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
                   10723:             class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
                   10724:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10725:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
                   10726:             class="pkgname">sysutils/storage-manager</a>, <a xmlns=
                   10727:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10728:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
                   10729:             class="pkgname">www/ap-aolserver</a>, <a xmlns=
                   10730:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10731:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
                   10732:             class="pkgname">www/openacs</a>. Try to be consistent
                   10733:             with them.</p>
1.1       grant    10734:           </div>
                   10735: 
                   10736:           <div class="sect2" lang="en" xml:lang="en">
                   10737:             <div class="titlepage">
                   10738:               <div>
                   10739:                 <div>
1.30      wiz      10740:                   <h3 class="title"><a name=
                   10741:                   "modified-distfiles-same-name" id=
1.35      jmmv     10742:                   "modified-distfiles-same-name"></a>14.2.2.&nbsp;How
1.30      wiz      10743:                   to handle modified distfiles with the 'old'
                   10744:                   name</h3>
1.1       grant    10745:                 </div>
                   10746:               </div>
                   10747:             </div>
                   10748: 
                   10749:             <p>Sometimes authors of a software package make some
                   10750:             modifications after the software was released, and they
                   10751:             put up a new distfile without changing the package's
                   10752:             version number. If a package is already in pkgsrc at
1.32      wiz      10753:             that time, the checksum will no longer match. The
                   10754:             contents of the new distfile should be compared against
                   10755:             the old one before changing anything, to make sure the
                   10756:             distfile was really updated on purpose, and that no
                   10757:             trojan horse or so crept in. Then, the correct way to
                   10758:             work around this is to set <code class=
                   10759:             "varname">DIST_SUBDIR</code> to a unique directory
                   10760:             name, usually based on <code class=
                   10761:             "varname">PKGNAME_NOREV</code>. In case this happens
                   10762:             more often, <code class="varname">PKGNAME</code> can be
                   10763:             used (thus including the <code class=
                   10764:             "filename">nbX</code> suffix) or a date stamp can be
                   10765:             appended, like <code class=
                   10766:             "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
                   10767:             forget regenerating the <code class=
                   10768:             "filename">distinfo</code> file after that, since it
                   10769:             contains the <code class="varname">DIST_SUBDIR</code>
                   10770:             path in the filenames. Furthermore, a mail to the
                   10771:             package's authors seems appropriate telling them that
                   10772:             changing distfiles after releases without changing the
                   10773:             file names is not good practice.</p>
1.1       grant    10774:           </div>
                   10775:         </div>
                   10776: 
                   10777:         <div class="sect1" lang="en" xml:lang="en">
                   10778:           <div class="titlepage">
                   10779:             <div>
                   10780:               <div>
                   10781:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      10782:                 "configuration-gotchas" id=
1.35      jmmv     10783:                 "configuration-gotchas"></a>14.3.&nbsp;Configuration
1.1       grant    10784:                 gotchas</h2>
                   10785:               </div>
                   10786:             </div>
                   10787:           </div>
                   10788: 
                   10789:           <div class="sect2" lang="en" xml:lang="en">
                   10790:             <div class="titlepage">
                   10791:               <div>
                   10792:                 <div>
                   10793:                   <h3 class="title"><a name="fixes.libtool" id=
1.35      jmmv     10794:                   "fixes.libtool"></a>14.3.1.&nbsp;Shared libraries
1.1       grant    10795:                   - libtool</h3>
                   10796:                 </div>
                   10797:               </div>
                   10798:             </div>
                   10799: 
                   10800:             <p>pkgsrc supports many different machines, with
                   10801:             different object formats like a.out and ELF, and
                   10802:             varying abilities to do shared library and dynamic
                   10803:             loading at all. To accompany this, varying commands and
                   10804:             options have to be passed to the compiler, linker, etc.
                   10805:             to get the Right Thing, which can be pretty annoying
                   10806:             especially if you don't have all the machines at your
                   10807:             hand to test things. The <a xmlns=
                   10808:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10809:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.20      ben      10810:             class="pkgname">devel/libtool</a> pkg can help here, as
                   10811:             it just &#8220;<span class="quote">knows</span>&#8221;
                   10812:             how to build both static and dynamic libraries from a
                   10813:             set of source files, thus being platform
                   10814:             independent.</p>
1.1       grant    10815: 
                   10816:             <p>Here's how to use libtool in a pkg in seven simple
                   10817:             steps:</p>
                   10818: 
                   10819:             <div class="orderedlist">
                   10820:               <ol type="1">
                   10821:                 <li>
1.14      xtraeme  10822:                   <p>Add <code class=
                   10823:                   "varname">USE_LIBTOOL=yes</code> to the package
                   10824:                   Makefile.</p>
1.1       grant    10825:                 </li>
                   10826: 
                   10827:                 <li>
                   10828:                   <p>For library objects, use &#8220;<span class=
                   10829:                   "quote">${LIBTOOL} --mode=compile
                   10830:                   ${CC}</span>&#8221; in place of
                   10831:                   &#8220;<span class="quote">${CC}</span>&#8221;.
                   10832:                   You could even add it to the definition of
1.14      xtraeme  10833:                   <code class="varname">CC</code>, if only
                   10834:                   libraries are being built in a given Makefile.
                   10835:                   This one command will build both PIC and non-PIC
                   10836:                   library objects, so you need not have separate
                   10837:                   shared and non-shared library rules.</p>
1.1       grant    10838:                 </li>
                   10839: 
                   10840:                 <li>
                   10841:                   <p>For the linking of the library, remove any
                   10842:                   &#8220;<span class="quote">ar</span>&#8221;,
                   10843:                   &#8220;<span class="quote">ranlib</span>&#8221;,
                   10844:                   and &#8220;<span class="quote">ld
                   10845:                   -Bshareable</span>&#8221; commands, and instead
                   10846:                   use:</p>
                   10847:                   <pre class="programlisting">
                   10848: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
                   10849: </pre>
                   10850: 
                   10851:                   <p>Note that the library is changed to have a
1.14      xtraeme  10852:                   <code class="filename">.la</code> extension, and
                   10853:                   the objects are changed to have a <code class=
                   10854:                   "filename">.lo</code> extension. Change
                   10855:                   <code class="varname">OBJS</code> as necessary.
                   10856:                   This automatically creates all of the
                   10857:                   <code class="filename">.a</code>, <code class=
                   10858:                   "filename">.so.major.minor</code>, and ELF
                   10859:                   symlinks (if necessary) in the build directory.
                   10860:                   Be sure to include &#8220;<span class=
1.1       grant    10861:                   "quote">-version-info</span>&#8221;, especially
                   10862:                   when major and minor are zero, as libtool will
                   10863:                   otherwise strip off the shared library
                   10864:                   version.</p>
                   10865: 
                   10866:                   <p>From the libtool manual:</p>
                   10867:                   <pre class="programlisting">
                   10868:      So, libtool library versions are described by three integers:
                   10869: 
                   10870: CURRENT
                   10871:        The most recent interface number that this library implements.
                   10872: 
                   10873: REVISION
                   10874:        The implementation number of the CURRENT interface.
                   10875: 
                   10876: AGE
                   10877:        The difference between the newest and oldest interfaces that this
                   10878:        library implements.  In other words, the library implements all the
                   10879:        interface numbers in the range from number `CURRENT - AGE' to
                   10880:        `CURRENT'.
                   10881:        
                   10882:      If two libraries have identical CURRENT and AGE numbers, then the
                   10883: dynamic linker chooses the library with the greater REVISION number. 
                   10884: </pre>
                   10885: 
                   10886:                   <p>The &#8220;<span class=
                   10887:                   "quote">-release</span>&#8221; option will
                   10888:                   produce different results for a.out and ELF
                   10889:                   (excluding symlinks) in only one case. An ELF
                   10890:                   library of the form &#8220;<span class=
                   10891:                   "quote">libfoo-release.so.<span class=
                   10892:                   "emphasis"><em>x</em></span>.<span class=
                   10893:                   "emphasis"><em>y</em></span></span>&#8221; will
                   10894:                   have a symlink of &#8220;<span class=
                   10895:                   "quote">libfoo.so.<span class=
                   10896:                   "emphasis"><em>x</em></span>.<span class=
                   10897:                   "emphasis"><em>y</em></span></span>&#8221; on an
                   10898:                   a.out platform. This is handled
                   10899:                   automatically.</p>
                   10900: 
                   10901:                   <p>The &#8220;<span class="quote">-rpath
                   10902:                   argument</span>&#8221; is the install directory
                   10903:                   of the library being built.</p>
                   10904: 
1.14      xtraeme  10905:                   <p>In the <code class="filename">PLIST</code>,
1.19      hubertf  10906:                   include only the <code class=
                   10907:                   "filename">.la</code> file, the other files will
                   10908:                   be added automatically.</p>
1.1       grant    10909:                 </li>
                   10910: 
                   10911:                 <li>
1.14      xtraeme  10912:                   <p>When linking shared object (<code class=
                   10913:                   "filename">.so</code>) files, i.e. files that are
1.24      wiz      10914:                   loaded via <a href=
                   10915:                   "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
                   10916:                   <span class="citerefentry"><span class=
                   10917:                   "refentrytitle">dlopen</span>(3)</span></a>, NOT
                   10918:                   shared libraries, use &#8220;<span class=
                   10919:                   "quote">-module -avoid-version</span>&#8221; to
                   10920:                   prevent them getting version tacked on.</p>
1.1       grant    10921: 
1.14      xtraeme  10922:                   <p>The <code class="filename">PLIST</code> file
                   10923:                   gets the <code class="filename">foo.so</code>
                   10924:                   entry.</p>
1.1       grant    10925:                 </li>
                   10926: 
                   10927:                 <li>
                   10928:                   <p>When linking programs that depend on these
                   10929:                   libraries <span class=
                   10930:                   "emphasis"><em>before</em></span> they are
                   10931:                   installed, preface the <a href=
                   10932:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
                   10933:                   <span class="citerefentry"><span class=
                   10934:                   "refentrytitle">cc</span>(1)</span></a> or
                   10935:                   <a href=
                   10936:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   10937:                   <span class="citerefentry"><span class=
                   10938:                   "refentrytitle">ld</span>(1)</span></a> line with
                   10939:                   &#8220;<span class="quote">${LIBTOOL}
                   10940:                   --mode=link</span>&#8221;, and it will find the
                   10941:                   correct libraries (static or shared), but please
                   10942:                   be aware that libtool will not allow you to
                   10943:                   specify a relative path in -L (such as
                   10944:                   &#8220;<span class=
                   10945:                   "quote">-L../somelib</span>&#8221;), because it
                   10946:                   expects you to change that argument to be the
1.14      xtraeme  10947:                   <code class="filename">.la</code> file. e.g.</p>
1.1       grant    10948:                   <pre class="programlisting">
                   10949: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
                   10950: </pre>
                   10951: 
                   10952:                   <p>should be changed to:</p>
                   10953:                   <pre class="programlisting">
1.14      xtraeme  10954: ${LIBTOOL} --mode=link ${CC} -o <em class=
                   10955: "replaceable"><code>someprog</code></em> <em class=
                   10956: "replaceable"><code>../somelib/somelib.la</code></em>
1.1       grant    10957: </pre>
                   10958: 
                   10959:                   <p>and it will do the right thing with the
                   10960:                   libraries.</p>
                   10961:                 </li>
                   10962: 
                   10963:                 <li>
                   10964:                   <p>When installing libraries, preface the
                   10965:                   <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   10966:                   <span class="citerefentry"><span class=
                   10967:                   "refentrytitle">install</span>(1)</span></a> or
                   10968:                   <a href=
                   10969:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
                   10970:                   <span class="citerefentry"><span class=
                   10971:                   "refentrytitle">cp</span>(1)</span></a> command
                   10972:                   with &#8220;<span class="quote">${LIBTOOL}
                   10973:                   --mode=install</span>&#8221;, and change the
1.14      xtraeme  10974:                   library name to <code class=
                   10975:                   "filename">.la</code>. e.g.</p>
1.1       grant    10976:                   <pre class="programlisting">
                   10977: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
                   10978: </pre>
                   10979: 
1.14      xtraeme  10980:                   <p>This will install the static <code class=
                   10981:                   "filename">.a</code>, shared library, any needed
1.1       grant    10982:                   symlinks, and run <a href=
                   10983:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
                   10984:                   <span class="citerefentry"><span class=
                   10985:                   "refentrytitle">ldconfig</span>(8)</span></a>.</p>
                   10986:                 </li>
                   10987: 
                   10988:                 <li>
1.14      xtraeme  10989:                   <p>In your <code class="filename">PLIST</code>,
1.23      wiz      10990:                   include only the <code class=
                   10991:                   "filename">.la</code> file (this is a change from
                   10992:                   previous behaviour).</p>
1.1       grant    10993:                 </li>
                   10994:               </ol>
                   10995:             </div>
                   10996:           </div>
                   10997: 
                   10998:           <div class="sect2" lang="en" xml:lang="en">
                   10999:             <div class="titlepage">
                   11000:               <div>
                   11001:                 <div>
1.30      wiz      11002:                   <h3 class="title"><a name="using-libtool" id=
1.35      jmmv     11003:                   "using-libtool"></a>14.3.2.&nbsp;Using libtool on
1.30      wiz      11004:                   GNU packages that already support libtool</h3>
1.1       grant    11005:                 </div>
                   11006:               </div>
                   11007:             </div>
                   11008: 
1.14      xtraeme  11009:             <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
                   11010:             the package Makefile. This will override the package's
                   11011:             own libtool in most cases. For older libtool using
1.1       grant    11012:             packages, libtool is made by ltconfig script during the
                   11013:             do-configure step; you can check the libtool script
1.14      xtraeme  11014:             location by doing <span><strong class="command">make
                   11015:             configure; find work*/ -name
                   11016:             libtool</strong></span>.</p>
                   11017: 
                   11018:             <p><code class="varname">LIBTOOL_OVERRIDE</code>
                   11019:             specifies which libtool scripts, relative to
                   11020:             <code class="varname">WRKSRC</code>, to override. By
                   11021:             default, it is set to &#8220;<span class=
                   11022:             "quote">libtool */libtool */*/libtool</span>&#8221;. If
                   11023:             this does not match the location of the package's
                   11024:             libtool script(s), set it as appropriate.</p>
1.13      hubertf  11025: 
1.14      xtraeme  11026:             <p>If you do not need <code class="filename">*.a</code>
1.1       grant    11027:             static libraries built and installed, then use
1.14      xtraeme  11028:             <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1       grant    11029:             instead.</p>
                   11030: 
                   11031:             <p>If your package makes use of the platform
                   11032:             independent library for loading dynamic shared objects,
                   11033:             that comes with libtool (libltdl), you should include
1.22      tv       11034:             devel/libltdl/buildlink3.mk.</p>
1.1       grant    11035: 
                   11036:             <p>Some packages use libtool incorrectly so that the
                   11037:             package may not work or build in some circumstances.
                   11038:             Some of the more common errors are:</p>
                   11039: 
                   11040:             <div class="itemizedlist">
                   11041:               <ul type="disc">
                   11042:                 <li>
                   11043:                   <p>The inclusion of a shared object (-module) as
                   11044:                   a dependent library in an executable or library.
                   11045:                   This in itself isn't a problem if one of two
                   11046:                   things has been done:</p>
                   11047: 
                   11048:                   <div class="orderedlist">
                   11049:                     <ol type="1">
                   11050:                       <li>
                   11051:                         <p>The shared object is named correctly,
1.14      xtraeme  11052:                         i.e. <code class=
                   11053:                         "filename">libfoo.la</code>, not
                   11054:                         <code class="filename">foo.la</code></p>
1.1       grant    11055:                       </li>
                   11056: 
                   11057:                       <li>
                   11058:                         <p>The -dlopen option is used when linking
                   11059:                         an executable.</p>
                   11060:                       </li>
                   11061:                     </ol>
                   11062:                   </div>
                   11063:                 </li>
                   11064: 
                   11065:                 <li>
                   11066:                   <p>The use of libltdl without the correct calls
                   11067:                   to initialisation routines. The function
                   11068:                   lt_dlinit() should be called and the macro
1.14      xtraeme  11069:                   <code class=
                   11070:                   "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1       grant    11071:                   included in executables.</p>
                   11072:                 </li>
                   11073:               </ul>
                   11074:             </div>
                   11075:           </div>
                   11076: 
                   11077:           <div class="sect2" lang="en" xml:lang="en">
                   11078:             <div class="titlepage">
                   11079:               <div>
                   11080:                 <div>
1.30      wiz      11081:                   <h3 class="title"><a name="autoconf-automake" id=
1.35      jmmv     11082:                   "autoconf-automake"></a>14.3.3.&nbsp;GNU
1.1       grant    11083:                   Autoconf/Automake</h3>
                   11084:                 </div>
                   11085:               </div>
                   11086:             </div>
                   11087: 
                   11088:             <p>If a package needs GNU autoconf or automake to be
                   11089:             executed to regenerate the configure script and
                   11090:             Makefile.in makefile templates, then they should be
1.35      jmmv     11091:             executed in a pre-configure target.</p>
1.1       grant    11092: 
                   11093:             <p>For packages that need only autoconf:</p>
                   11094:             <pre class="programlisting">
1.35      jmmv     11095: AUTOCONF_REQD=    2.50     # if default version is not good enough
                   11096: USE_TOOLS+=     autoconf   # use "autoconf213" for autoconf-2.13
1.1       grant    11097: ...
                   11098: 
                   11099: pre-configure:
1.35      jmmv     11100:           cd ${WRKSRC}; autoconf
1.1       grant    11101: 
                   11102: ...
                   11103: </pre>
                   11104: 
                   11105:             <p>and for packages that need automake and
                   11106:             autoconf:</p>
                   11107:             <pre class="programlisting">
1.35      jmmv     11108: AUTOMAKE_REQD=  1.7.1      # if default version is not good enough
1.36      wiz      11109: USE_TOOLS+=     automake   # use "automake14" for automake-1.4
1.1       grant    11110: ...
                   11111: 
                   11112: pre-configure:
                   11113:           cd ${WRKSRC};                                           \
1.35      jmmv     11114:           aclocal; autoheader;                                    \
                   11115:           automake -a --foreign -i; autoconf
1.1       grant    11116: 
                   11117: ...
                   11118: </pre>
                   11119: 
                   11120:             <p>Packages which use GNU Automake will almost
1.35      jmmv     11121:             certainly require GNU Make.</p>
1.1       grant    11122: 
                   11123:             <p>There are times when the configure process makes
                   11124:             additional changes to the generated files, which then
                   11125:             causes the build process to try to re-execute the
                   11126:             automake sequence. This is prevented by touching
                   11127:             various files in the configure stage. If this causes
1.14      xtraeme  11128:             problems with your package you can set <code class=
                   11129:             "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1       grant    11130:             Makefile.</p>
                   11131:           </div>
                   11132:         </div>
                   11133: 
                   11134:         <div class="sect1" lang="en" xml:lang="en">
                   11135:           <div class="titlepage">
                   11136:             <div>
                   11137:               <div>
                   11138:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      11139:                 "building-considerations" id=
1.35      jmmv     11140:                 "building-considerations"></a>14.4.&nbsp;Building
1.1       grant    11141:                 considerations</h2>
                   11142:               </div>
                   11143:             </div>
                   11144:           </div>
                   11145: 
                   11146:           <div class="sect2" lang="en" xml:lang="en">
                   11147:             <div class="titlepage">
                   11148:               <div>
                   11149:                 <div>
1.30      wiz      11150:                   <h3 class="title"><a name="cpp-defines" id=
1.35      jmmv     11151:                   "cpp-defines"></a>14.4.1.&nbsp;CPP defines</h3>
1.1       grant    11152:                 </div>
                   11153:               </div>
                   11154:             </div>
                   11155: 
                   11156:             <p>To port an application to NetBSD, it's usually
                   11157:             necessary for the compiler to be able to judge the
                   11158:             system on which it's compiling, and we use definitions
                   11159:             so that the C pre-processor can do this.</p>
                   11160: 
                   11161:             <p>To test whether you are working on a 4.4 BSD-derived
                   11162:             system, you should use the BSD definition, which is
1.14      xtraeme  11163:             defined in <code class=
                   11164:             "filename">&lt;sys/param.h&gt;</code> on said
1.1       grant    11165:             systems.</p>
                   11166:             <pre class="programlisting">
                   11167: #include &lt;sys/param.h&gt;
                   11168: </pre>
                   11169: 
                   11170:             <p>and then you can surround the BSD-specific parts of
                   11171:             your package's C/C++ code using this conditional:</p>
                   11172:             <pre class="programlisting">
                   11173: #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
                   11174:     ...
                   11175: #endif
                   11176: </pre>
                   11177: 
                   11178:             <p>Please use the &#8220;<span class=
                   11179:             "quote">__NetBSD__</span>&#8221; definition sparingly -
                   11180:             it should only apply to features of NetBSD that are not
                   11181:             present in other 4.4-lite derived BSDs.</p>
                   11182:           </div>
                   11183:         </div>
                   11184: 
                   11185:         <div class="sect1" lang="en" xml:lang="en">
                   11186:           <div class="titlepage">
                   11187:             <div>
                   11188:               <div>
                   11189:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      11190:                 "package-specific-actions" id=
1.35      jmmv     11191:                 "package-specific-actions"></a>14.5.&nbsp;Package
1.1       grant    11192:                 specific actions</h2>
                   11193:               </div>
                   11194:             </div>
                   11195:           </div>
                   11196: 
                   11197:           <div class="sect2" lang="en" xml:lang="en">
                   11198:             <div class="titlepage">
                   11199:               <div>
                   11200:                 <div>
1.30      wiz      11201:                   <h3 class="title"><a name="user-interaction" id=
1.35      jmmv     11202:                   "user-interaction"></a>14.5.1.&nbsp;User
1.2       hubertf  11203:                   interaction</h3>
1.1       grant    11204:                 </div>
                   11205:               </div>
                   11206:             </div>
                   11207: 
                   11208:             <p>Occasionally, packages require interaction from the
                   11209:             user, and this can be in a number of ways:</p>
                   11210: 
                   11211:             <div class="itemizedlist">
                   11212:               <ul type="disc">
                   11213:                 <li>
                   11214:                   <p>help in fetching the distfiles</p>
                   11215:                 </li>
                   11216: 
                   11217:                 <li>
                   11218:                   <p>help to configure the package before it is
                   11219:                   built</p>
                   11220:                 </li>
                   11221: 
                   11222:                 <li>
                   11223:                   <p>help during the build process</p>
                   11224:                 </li>
                   11225: 
                   11226:                 <li>
                   11227:                   <p>help during the installation of a package</p>
                   11228:                 </li>
                   11229:               </ul>
                   11230:             </div>
                   11231: 
1.14      xtraeme  11232:             <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1       grant    11233:             definition is provided to notify the pkgsrc mechanism
                   11234:             of an interactive stage which will be needed, and this
1.14      xtraeme  11235:             should be set in the package's <code class=
                   11236:             "filename">Makefile</code>. e.g.</p>
1.1       grant    11237:             <pre class="programlisting">
                   11238: INTERACTIVE_STAGE= build
                   11239: </pre>
                   11240: 
                   11241:             <p>Multiple interactive stages can be specified:</p>
                   11242:             <pre class="programlisting">
                   11243: INTERACTIVE_STAGE= configure install
                   11244: </pre>
                   11245:           </div>
                   11246: 
                   11247:           <div class="sect2" lang="en" xml:lang="en">
                   11248:             <div class="titlepage">
                   11249:               <div>
                   11250:                 <div>
1.30      wiz      11251:                   <h3 class="title"><a name="handling-licenses" id=
1.35      jmmv     11252:                   "handling-licenses"></a>14.5.2.&nbsp;Handling
1.1       grant    11253:                   licenses</h3>
                   11254:                 </div>
                   11255:               </div>
                   11256:             </div>
                   11257: 
                   11258:             <p>A package may underly a license which the user has
                   11259:             or has not agreed to accept. Usually, packages that
                   11260:             underly well-known Open Source licenses (e.g. the GNU
                   11261:             Public License, GPL) won't have any special license
                   11262:             tags added in pkgsrc which require special action by
                   11263:             the user of such packages, but there are quite a number
                   11264:             of other licenses out there that pkgsrc users may not
                   11265:             be able to follow, for whatever reasons. For these
                   11266:             cases, pkgsrc contains a mechanism to note that a
                   11267:             package underlies a certain license, and the user has
                   11268:             to accept the license before the package can be
                   11269:             installed.</p>
                   11270: 
                   11271:             <p>Placing a certain package under a certain license
1.14      xtraeme  11272:             works by setting the <code class=
                   11273:             "varname">LICENSE</code> variable to a string
                   11274:             identifying the license, e.g. in <a xmlns=
                   11275:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    11276:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.20      ben      11277:             class="pkgname">graphics/graphviz</a>:</p>
1.1       grant    11278:             <pre class="programlisting">
                   11279: LICENSE=        graphviz-license
                   11280: </pre>
                   11281: 
                   11282:             <p>When trying to build, the user will get a notice
                   11283:             that the package underlies a license which he hasn't
                   11284:             accepted (yet):</p>
                   11285:             <pre class="programlisting">
1.14      xtraeme  11286: <code class="prompt">%</code> <strong class=
                   11287: "userinput"><code>make</code></strong>
1.1       grant    11288: ===&gt; graphviz-1.12 has an unacceptable license: graphviz-license.
                   11289: ===&gt;     To build this package, add this line to your /etc/mk.conf:
                   11290: ===&gt;     ACCEPTABLE_LICENSES+=graphviz-license
                   11291: ===&gt;     To view the license, enter "/usr/bin/make show-license".
                   11292: *** Error code 1
                   11293: </pre>
                   11294: 
1.14      xtraeme  11295:             <p>The license can be viewed with <span><strong class=
                   11296:             "command">make show-license</strong></span>, and if it
                   11297:             is considered appropriate, the line printed above can
                   11298:             be added to <code class="filename">/etc/mk.conf</code>
                   11299:             to indicate acceptance of the particular license:</p>
1.1       grant    11300:             <pre class="programlisting">
                   11301: ACCEPTABLE_LICENSES+=graphviz-license
                   11302: </pre>
                   11303: 
                   11304:             <p>When adding a package with a new license, the
1.14      xtraeme  11305:             license text should be added to <code class=
                   11306:             "filename">pkgsrc/licenses</code> for displaying. A
                   11307:             list of known licenses can be seen in this directory as
                   11308:             well as by looking at the list of (commented out)
                   11309:             <code class="varname">ACCEPTABLE_LICENSES</code>
                   11310:             variable settings in <code class=
                   11311:             "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1       grant    11312: 
1.17      sketch   11313:             <p>If there is a <span class=
1.1       grant    11314:             "emphasis"><em>really</em></span> pressing need to
                   11315:             accept all licenses at once, like when trying to
                   11316:             download or mirror all distfiles or doing a bulk build
                   11317:             to test if all packages in pkgsrc build, this can be
1.14      xtraeme  11318:             done by setting <code class=
                   11319:             "varname">_ACCEPTABLE=yes</code>.</p>
1.1       grant    11320:           </div>
                   11321: 
                   11322:           <div class="sect2" lang="en" xml:lang="en">
                   11323:             <div class="titlepage">
                   11324:               <div>
                   11325:                 <div>
1.30      wiz      11326:                   <h3 class="title"><a name=
                   11327:                   "installing-score-files" id=
1.35      jmmv     11328:                   "installing-score-files"></a>14.5.3.&nbsp;Installing
1.30      wiz      11329:                   score files</h3>
1.1       grant    11330:                 </div>
                   11331:               </div>
                   11332:             </div>
                   11333: 
                   11334:             <p>Certain packages, most of them in the games
                   11335:             category, install a score file that allows all users on
                   11336:             the system to record their highscores. In order for
                   11337:             this to work, the binaries need to be installed setgid
                   11338:             and the score files owned by the appropriate group
                   11339:             and/or owner (traditionally the "games" user/group).
                   11340:             The following variables, documented in more detail in
1.14      xtraeme  11341:             <code class="filename">mk/defaults/mk.conf</code>,
                   11342:             control this behaviour: <code class=
                   11343:             "varname">SETGIDGAME</code>, <code class=
                   11344:             "varname">GAMEDATAMODE</code>, <code class=
                   11345:             "varname">GAMEGRP</code>, <code class=
                   11346:             "varname">GAMEMODE</code>, <code class=
                   11347:             "varname">GAMEOWN</code>.</p>
1.1       grant    11348: 
                   11349:             <p>Note that per default, setgid installation of games
1.14      xtraeme  11350:             is disabled; setting <code class=
                   11351:             "varname">SETGIDGAME=YES</code> will set all the other
1.1       grant    11352:             variables accordingly.</p>
                   11353: 
                   11354:             <p>A package should therefor never hard code file
1.14      xtraeme  11355:             ownership or access permissions but rely on
                   11356:             <code class="varname">INSTALL_GAME</code> and
                   11357:             <code class="varname">INSTALL_GAME_DATA</code> to set
                   11358:             these correctly.</p>
1.1       grant    11359:           </div>
                   11360: 
                   11361:           <div class="sect2" lang="en" xml:lang="en">
                   11362:             <div class="titlepage">
                   11363:               <div>
                   11364:                 <div>
1.30      wiz      11365:                   <h3 class="title"><a name="perl-scripts" id=
1.35      jmmv     11366:                   "perl-scripts"></a>14.5.4.&nbsp;Packages
1.30      wiz      11367:                   containing perl scripts</h3>
1.1       grant    11368:                 </div>
                   11369:               </div>
                   11370:             </div>
                   11371: 
                   11372:             <p>If your package contains interpreted perl scripts,
1.14      xtraeme  11373:             set <code class="varname">REPLACE_PERL</code> to ensure
                   11374:             that the proper interpreter path is set. <code class=
                   11375:             "varname">REPLACE_PERL</code> should contain a list of
                   11376:             scripts, relative to <code class=
                   11377:             "varname">WRKSRC</code>, that you want adjusted.</p>
1.1       grant    11378:           </div>
                   11379: 
                   11380:           <div class="sect2" lang="en" xml:lang="en">
                   11381:             <div class="titlepage">
                   11382:               <div>
                   11383:                 <div>
1.30      wiz      11384:                   <h3 class="title"><a name="hardcoded-paths" id=
1.35      jmmv     11385:                   "hardcoded-paths"></a>14.5.5.&nbsp;Packages with
1.1       grant    11386:                   hardcoded paths to other interpreters</h3>
                   11387:                 </div>
                   11388:               </div>
                   11389:             </div>
                   11390: 
                   11391:             <p>Your package may also contain scripts with hardcoded
                   11392:             paths to other interpreters besides (or as well as)
                   11393:             perl. To correct the full pathname to the script
                   11394:             interpreter, you need to set the following definitions
1.14      xtraeme  11395:             in your <code class="filename">Makefile</code> (we
                   11396:             shall use <span><strong class=
                   11397:             "command">tclsh</strong></span> in this example):</p>
1.1       grant    11398:             <pre class="programlisting">
                   11399:   REPLACE_INTERPRETER+=     tcl
                   11400:     _REPLACE.tcl.old=     .*/bin/tclsh
                   11401:     _REPLACE.tcl.new=     ${PREFIX}/bin/tclsh
                   11402:     _REPLACE_FILES.tcl=   ...list of tcl scripts which need to be fixed,
                   11403:                           relative to ${WRKSRC}, just as in REPLACE_PERL
                   11404: </pre>
                   11405:           </div>
                   11406: 
                   11407:           <div class="sect2" lang="en" xml:lang="en">
                   11408:             <div class="titlepage">
                   11409:               <div>
                   11410:                 <div>
1.30      wiz      11411:                   <h3 class="title"><a name="perl-modules" id=
1.35      jmmv     11412:                   "perl-modules"></a>14.5.6.&nbsp;Packages
1.30      wiz      11413:                   installing perl modules</h3>
1.1       grant    11414:                 </div>
                   11415:               </div>
                   11416:             </div>
                   11417: 
                   11418:             <p>Makefiles of packages providing perl5 modules should
1.14      xtraeme  11419:             include the Makefile fragment <code class=
                   11420:             "filename">../../lang/perl5/module.mk</code>. It
                   11421:             provides a <span><strong class=
                   11422:             "command">do-configure</strong></span> target for the
                   11423:             standard perl configuration for such modules as well as
                   11424:             various hooks to tune this configuration. See comments
                   11425:             in this file for details.</p>
1.1       grant    11426: 
                   11427:             <p>Perl5 modules will install into different places
                   11428:             depending on the version of perl used during the build
                   11429:             process. To address this, pkgsrc will append lines to
1.14      xtraeme  11430:             the <code class="filename">PLIST</code> corresponding
                   11431:             to the files listed in the installed <code class=
                   11432:             "filename">.packlist</code> file generated by most
                   11433:             perl5 modules. This is invoked by defining <code class=
                   11434:             "varname">PERL5_PACKLIST</code> to a space-separated
                   11435:             list of paths to packlist files, e.g.:</p>
1.1       grant    11436:             <pre class="programlisting">
                   11437: PERL5_PACKLIST=   ${PERL5_SITEARCH}/auto/Pg/.packlist
                   11438: </pre>
                   11439: 
1.14      xtraeme  11440:             <p>The variables <code class=
                   11441:             "varname">PERL5_SITELIB</code>, <code class=
                   11442:             "varname">PERL5_SITEARCH</code>, and <code class=
                   11443:             "varname">PERL5_ARCHLIB</code> represent the three
1.1       grant    11444:             locations in which perl5 modules may be installed, and
                   11445:             may be used by perl5 packages that don't have a
                   11446:             packlist. These three variables are also substituted
1.14      xtraeme  11447:             for in the <code class="filename">PLIST</code>.</p>
1.1       grant    11448:           </div>
                   11449: 
                   11450:           <div class="sect2" lang="en" xml:lang="en">
                   11451:             <div class="titlepage">
                   11452:               <div>
                   11453:                 <div>
                   11454:                   <h3 class="title"><a name="faq.info-files" id=
1.35      jmmv     11455:                   "faq.info-files"></a>14.5.7.&nbsp;Packages
1.1       grant    11456:                   installing info files</h3>
                   11457:                 </div>
                   11458:               </div>
                   11459:             </div>
                   11460: 
                   11461:             <p>Some packages install info files or use the
                   11462:             &#8220;<span class="quote">makeinfo</span>&#8221; or
                   11463:             &#8220;<span class="quote">install-info</span>&#8221;
                   11464:             commands. Each of the info files:</p>
                   11465: 
                   11466:             <div class="itemizedlist">
                   11467:               <ul type="disc">
                   11468:                 <li>
                   11469:                   <p>is considered to be installed in the directory
1.14      xtraeme  11470:                   <code class=
                   11471:                   "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1       grant    11472:                 </li>
                   11473: 
                   11474:                 <li>
                   11475:                   <p>is registered in the Info directory file
1.14      xtraeme  11476:                   <code class=
                   11477:                   "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1       grant    11478:                 </li>
                   11479: 
                   11480:                 <li>
                   11481:                   <p>and must be listed as a filename in the
1.14      xtraeme  11482:                   <code class="varname">INFO_FILES</code> variable
                   11483:                   in the package Makefile.</p>
1.1       grant    11484:                 </li>
                   11485:               </ul>
                   11486:             </div>
                   11487: 
1.14      xtraeme  11488:             <p><code class="varname">INFO_DIR</code> defaults to
1.1       grant    11489:             &#8220;<span class="quote">info</span>&#8221; and can
1.14      xtraeme  11490:             be overridden in the package Makefile. <code class=
                   11491:             "filename">INSTALL</code> and <code class=
                   11492:             "filename">DEINSTALL</code> scripts will be generated
                   11493:             to handle registration of the info files in the Info
1.1       grant    11494:             directory file. The &#8220;<span class=
                   11495:             "quote">install-info</span>&#8221; command used for the
                   11496:             info files registration is either provided by the
                   11497:             system, or by a special purpose package automatically
                   11498:             added as dependency if needed.</p>
                   11499: 
                   11500:             <p>A package which needs the &#8220;<span class=
                   11501:             "quote">makeinfo</span>&#8221; command at build time
1.14      xtraeme  11502:             must define the variable <code class=
                   11503:             "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1       grant    11504:             minimum version of the &#8220;<span class=
                   11505:             "quote">makeinfo</span>&#8221; command is needed it
1.14      xtraeme  11506:             should be noted with the <code class=
                   11507:             "varname">TEXINFO_REQD</code> variable in the package
                   11508:             <code class="filename">Makefile</code>. By default, a
1.1       grant    11509:             minimum version of 3.12 is required. If the system does
1.14      xtraeme  11510:             not provide a <span><strong class=
                   11511:             "command">makeinfo</strong></span> command or if it
                   11512:             does not match the required minimum, a build dependency
                   11513:             on the <a xmlns=
                   11514:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    11515:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.20      ben      11516:             class="pkgname">devel/gtexinfo</a> package will be
                   11517:             added automatically.</p>
1.1       grant    11518: 
                   11519:             <p>The build and installation process of the software
                   11520:             provided by the package should not use the
1.14      xtraeme  11521:             <span><strong class=
                   11522:             "command">install-info</strong></span> command as the
                   11523:             registration of info files is the task of the package
                   11524:             <code class="filename">INSTALL</code> script, and it
                   11525:             must use the appropriate <span><strong class=
                   11526:             "command">makeinfo</strong></span> command.</p>
1.1       grant    11527: 
                   11528:             <p>To achieve this goal the pkgsrc infrastructure
1.14      xtraeme  11529:             creates overriding scripts for the <span><strong class=
                   11530:             "command">install-info</strong></span> and
                   11531:             <span><strong class="command">makeinfo</strong></span>
                   11532:             commands in a directory listed early in <code class=
                   11533:             "varname">PATH</code>.</p>
1.1       grant    11534: 
1.14      xtraeme  11535:             <p>The script overriding <span><strong class=
                   11536:             "command">install-info</strong></span> has no effect
                   11537:             except the logging of a message. The script overriding
                   11538:             <span><strong class="command">makeinfo</strong></span>
                   11539:             logs a message and according to the value of
                   11540:             <code class="varname">USE_MAKEINFO</code> and
                   11541:             <code class="varname">TEXINFO_REQD</code> either run
                   11542:             the appropriate <span><strong class=
                   11543:             "command">makeinfo</strong></span> command or exit on
                   11544:             error.</p>
1.1       grant    11545:           </div>
                   11546: 
                   11547:           <div class="sect2" lang="en" xml:lang="en">
                   11548:             <div class="titlepage">
                   11549:               <div>
                   11550:                 <div>
1.30      wiz      11551:                   <h3 class="title"><a name="gconf2-data-files" id=
1.35      jmmv     11552:                   "gconf2-data-files"></a>14.5.8.&nbsp;Packages
1.30      wiz      11553:                   installing GConf2 data files</h3>
1.1       grant    11554:                 </div>
                   11555:               </div>
                   11556:             </div>
                   11557: 
1.14      xtraeme  11558:             <p>If a package installs <code class=
                   11559:             "filename">.schemas</code> or <code class=
                   11560:             "filename">.entries</code> files, used by GConf2, you
1.1       grant    11561:             need to take some extra steps to make sure they get
                   11562:             registered in the database:</p>
                   11563: 
                   11564:             <div class="orderedlist">
                   11565:               <ol type="1">
                   11566:                 <li>
1.14      xtraeme  11567:                   <p>Include <code class=
                   11568:                   "filename">../../devel/GConf2/schemas.mk</code>
                   11569:                   instead of its <code class=
                   11570:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    11571:                   care of rebuilding the GConf2 database at
                   11572:                   installation and deinstallation time, and tells
                   11573:                   the package where to install GConf2 data files
                   11574:                   using some standard configure arguments. It also
                   11575:                   disallows any access to the database directly
                   11576:                   from the package.</p>
                   11577:                 </li>
                   11578: 
                   11579:                 <li>
                   11580:                   <p>Ensure that the package installs its
1.14      xtraeme  11581:                   <code class="filename">.schemas</code> files
                   11582:                   under <code class=
                   11583:                   "filename">${PREFIX}/share/gconf/schemas</code>.
                   11584:                   If they get installed under <code class=
                   11585:                   "filename">${PREFIX}/etc</code>, you will need to
1.1       grant    11586:                   manually patch the package.</p>
                   11587:                 </li>
                   11588: 
                   11589:                 <li>
                   11590:                   <p>Check the PLIST and remove any entries under
                   11591:                   the etc/gconf directory, as they will be handled
                   11592:                   automatically. See <a href="#faq.conf" title=
1.35      jmmv     11593:                   "6.14.&nbsp;How do I change the location of configuration files?">
                   11594:                   Section&nbsp;6.14, &#8220;How do I change the
                   11595:                   location of configuration files?&#8221;</a> for
                   11596:                   more information.</p>
1.1       grant    11597:                 </li>
                   11598: 
                   11599:                 <li>
1.14      xtraeme  11600:                   <p>Define the <code class=
                   11601:                   "varname">GCONF2_SCHEMAS</code> variable in your
                   11602:                   <code class="filename">Makefile</code> with a
                   11603:                   list of all <code class=
                   11604:                   "filename">.schemas</code> files installed by the
                   11605:                   package, if any. Names must not contain any
                   11606:                   directories in them.</p>
1.1       grant    11607:                 </li>
                   11608: 
                   11609:                 <li>
1.14      xtraeme  11610:                   <p>Define the <code class=
                   11611:                   "varname">GCONF2_ENTRIES</code> variable in your
                   11612:                   <code class="filename">Makefile</code> with a
                   11613:                   list of all <code class=
                   11614:                   "filename">.entries</code> files installed by the
                   11615:                   package, if any. Names must not contain any
                   11616:                   directories in them.</p>
1.1       grant    11617:                 </li>
                   11618:               </ol>
                   11619:             </div>
                   11620:           </div>
                   11621: 
                   11622:           <div class="sect2" lang="en" xml:lang="en">
                   11623:             <div class="titlepage">
                   11624:               <div>
                   11625:                 <div>
1.30      wiz      11626:                   <h3 class="title"><a name=
                   11627:                   "scrollkeeper-data-files" id=
1.35      jmmv     11628:                   "scrollkeeper-data-files"></a>14.5.9.&nbsp;Packages
1.30      wiz      11629:                   installing scrollkeeper data files</h3>
1.1       grant    11630:                 </div>
                   11631:               </div>
                   11632:             </div>
                   11633: 
1.14      xtraeme  11634:             <p>If a package installs <code class=
                   11635:             "filename">.omf</code> files, used by scrollkeeper, you
                   11636:             need to take some extra steps to make sure they get
                   11637:             registered in the database:</p>
1.1       grant    11638: 
                   11639:             <div class="orderedlist">
                   11640:               <ol type="1">
                   11641:                 <li>
1.14      xtraeme  11642:                   <p>Include <code class=
                   11643:                   "filename">../../textproc/scrollkeeper/omf.mk</code>
                   11644:                   instead of its <code class=
                   11645:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    11646:                   care of rebuilding the scrollkeeper database at
                   11647:                   installation and deinstallation time, and
                   11648:                   disallows any access to it directly from the
                   11649:                   package.</p>
                   11650:                 </li>
                   11651: 
                   11652:                 <li>
                   11653:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  11654:                   the <code class=
                   11655:                   "filename">libdata/scrollkeeper</code> directory,
1.1       grant    11656:                   as they will be handled automatically.</p>
                   11657:                 </li>
                   11658: 
                   11659:                 <li>
1.14      xtraeme  11660:                   <p>Remove the <code class=
                   11661:                   "filename">share/omf</code> directory from the
                   11662:                   PLIST. It will be handled by scrollkeeper.</p>
1.1       grant    11663:                 </li>
                   11664:               </ol>
                   11665:             </div>
                   11666:           </div>
                   11667: 
                   11668:           <div class="sect2" lang="en" xml:lang="en">
                   11669:             <div class="titlepage">
                   11670:               <div>
                   11671:                 <div>
1.30      wiz      11672:                   <h3 class="title"><a name="x11-fonts" id=
1.35      jmmv     11673:                   "x11-fonts"></a>14.5.10.&nbsp;Packages installing
1.1       grant    11674:                   X11 fonts</h3>
                   11675:                 </div>
                   11676:               </div>
                   11677:             </div>
                   11678: 
                   11679:             <p>If a package installs font files, you will need to
                   11680:             rebuild the fonts database in the directory where they
                   11681:             get installed at installation and deinstallation time.
1.14      xtraeme  11682:             This can be automatically done by using <code class=
                   11683:             "filename">mk/fonts.mk</code>, which you need to
                   11684:             include in your <code class=
                   11685:             "filename">Makefile</code>.</p>
1.1       grant    11686: 
                   11687:             <p>When the file is included, you can list the
1.14      xtraeme  11688:             directories where fonts are installed in the
                   11689:             <code class="varname">FONTS_<em class=
                   11690:             "replaceable"><code>type</code></em>_DIRS</code>
                   11691:             variables, where <em class=
                   11692:             "replaceable"><code>type</code></em> can be one of
                   11693:             &#8220;<span class="quote">TTF</span>&#8221;,
1.1       grant    11694:             &#8220;<span class="quote">TYPE1</span>&#8221; or
                   11695:             &#8220;<span class="quote">X11</span>&#8221;. Also make
1.14      xtraeme  11696:             sure that the database file <code class=
                   11697:             "filename">fonts.dir</code> is not listed in the
1.1       grant    11698:             PLIST.</p>
                   11699: 
                   11700:             <p>Note that you should not create new directories for
                   11701:             fonts; instead use the standard ones to avoid that the
                   11702:             user needs to manually configure his X server to find
                   11703:             them.</p>
                   11704:           </div>
                   11705: 
                   11706:           <div class="sect2" lang="en" xml:lang="en">
                   11707:             <div class="titlepage">
                   11708:               <div>
                   11709:                 <div>
1.30      wiz      11710:                   <h3 class="title"><a name="gtk2-modules" id=
1.35      jmmv     11711:                   "gtk2-modules"></a>14.5.11.&nbsp;Packages
1.30      wiz      11712:                   installing GTK2 modules</h3>
1.1       grant    11713:                 </div>
                   11714:               </div>
                   11715:             </div>
                   11716: 
                   11717:             <p>If a package installs gtk2 immodules or loaders, you
                   11718:             need to take some extra steps to get them registered in
                   11719:             the GTK2 database properly:</p>
                   11720: 
                   11721:             <div class="orderedlist">
                   11722:               <ol type="1">
                   11723:                 <li>
1.14      xtraeme  11724:                   <p>Include <code class=
                   11725:                   "filename">../../x11/gtk2/modules.mk</code>
                   11726:                   instead of its <code class=
                   11727:                   "filename">buildlink3.mk</code> file. This takes
                   11728:                   care of rebuilding the database at installation
                   11729:                   and deinstallation time.</p>
1.1       grant    11730:                 </li>
                   11731: 
                   11732:                 <li>
1.14      xtraeme  11733:                   <p>Set <code class=
                   11734:                   "varname">GTK2_IMMODULES=YES</code> if your
                   11735:                   package installs GTK2 immodules.</p>
1.1       grant    11736:                 </li>
                   11737: 
                   11738:                 <li>
1.14      xtraeme  11739:                   <p>Set <code class=
                   11740:                   "varname">GTK2_LOADERS=YES</code> if your package
                   11741:                   installs GTK2 loaders.</p>
1.1       grant    11742:                 </li>
                   11743: 
                   11744:                 <li>
                   11745:                   <p>Patch the package to not touch any of the gtk2
                   11746:                   databases directly. These are:</p>
                   11747: 
                   11748:                   <div class="itemizedlist">
                   11749:                     <ul type="disc">
                   11750:                       <li>
1.14      xtraeme  11751:                         <p><code class=
                   11752:                         "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1       grant    11753:                       </li>
                   11754: 
                   11755:                       <li>
1.14      xtraeme  11756:                         <p><code class=
                   11757:                         "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1       grant    11758:                       </li>
                   11759:                     </ul>
                   11760:                   </div>
                   11761:                 </li>
                   11762: 
                   11763:                 <li>
                   11764:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  11765:                   the <code class="filename">libdata/gtk-2.0</code>
1.1       grant    11766:                   directory, as they will be handled
                   11767:                   automatically.</p>
                   11768:                 </li>
                   11769:               </ol>
                   11770:             </div>
                   11771:           </div>
                   11772: 
                   11773:           <div class="sect2" lang="en" xml:lang="en">
                   11774:             <div class="titlepage">
                   11775:               <div>
                   11776:                 <div>
1.30      wiz      11777:                   <h3 class="title"><a name="sgml-xml-data" id=
1.35      jmmv     11778:                   "sgml-xml-data"></a>14.5.12.&nbsp;Packages
1.30      wiz      11779:                   installing SGML or XML data</h3>
1.1       grant    11780:                 </div>
                   11781:               </div>
                   11782:             </div>
                   11783: 
                   11784:             <p>If a package installs SGML or XML data files that
                   11785:             need to be registered in system-wide catalogs (like
                   11786:             DTDs, sub-catalogs, etc.), you need to take some extra
                   11787:             steps:</p>
                   11788: 
                   11789:             <div class="orderedlist">
                   11790:               <ol type="1">
                   11791:                 <li>
1.14      xtraeme  11792:                   <p>Include <code class=
                   11793:                   "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
                   11794:                   in your <code class="filename">Makefile</code>,
                   11795:                   which takes care of registering those files in
1.1       grant    11796:                   system-wide catalogs at installation and
                   11797:                   deinstallation time.</p>
                   11798:                 </li>
                   11799: 
                   11800:                 <li>
1.14      xtraeme  11801:                   <p>Set <code class="varname">SGML_CATALOGS</code>
                   11802:                   to the full path of any SGML catalogs installed
                   11803:                   by the package.</p>
1.1       grant    11804:                 </li>
                   11805: 
                   11806:                 <li>
1.14      xtraeme  11807:                   <p>Set <code class="varname">XML_CATALOGS</code>
                   11808:                   to the full path of any XML catalogs installed by
1.1       grant    11809:                   the package.</p>
                   11810:                 </li>
                   11811: 
                   11812:                 <li>
1.14      xtraeme  11813:                   <p>Set <code class="varname">SGML_ENTRIES</code>
                   11814:                   to individual entries to be added to the SGML
1.1       grant    11815:                   catalog. These come in groups of three strings;
                   11816:                   see xmlcatmgr(1) for more information
                   11817:                   (specifically, arguments recognized by the 'add'
                   11818:                   action). Note that you will normally not use this
                   11819:                   variable.</p>
                   11820:                 </li>
                   11821: 
                   11822:                 <li>
1.14      xtraeme  11823:                   <p>Set <code class="varname">XML_ENTRIES</code>
                   11824:                   to individual entries to be added to the XML
1.1       grant    11825:                   catalog. These come in groups of three strings;
                   11826:                   see xmlcatmgr(1) for more information
                   11827:                   (specifically, arguments recognized by the 'add'
                   11828:                   action). Note that you will normally not use this
                   11829:                   variable.</p>
                   11830:                 </li>
                   11831:               </ol>
                   11832:             </div>
                   11833:           </div>
                   11834: 
                   11835:           <div class="sect2" lang="en" xml:lang="en">
                   11836:             <div class="titlepage">
                   11837:               <div>
                   11838:                 <div>
1.30      wiz      11839:                   <h3 class="title"><a name="mime-database" id=
1.35      jmmv     11840:                   "mime-database"></a>14.5.13.&nbsp;Packages
1.30      wiz      11841:                   installing extensions to the MIME database</h3>
1.1       grant    11842:                 </div>
                   11843:               </div>
                   11844:             </div>
                   11845: 
                   11846:             <p>If a package provides extensions to the MIME
1.14      xtraeme  11847:             database by installing <code class=
                   11848:             "filename">.xml</code> files inside <code class=
                   11849:             "filename">${PREFIX}/share/mime/packages</code>, you
                   11850:             need to take some extra steps to ensure that the
                   11851:             database is kept consistent with respect to these new
                   11852:             files:</p>
1.1       grant    11853: 
                   11854:             <div class="orderedlist">
                   11855:               <ol type="1">
                   11856:                 <li>
1.14      xtraeme  11857:                   <p>Include <code class=
                   11858:                   "filename">../../databases/shared-mime-info/mimedb.mk</code>
                   11859:                   (avoid using the <code class=
                   11860:                   "filename">buildlink3.mk</code> file from this
                   11861:                   same directory, which is reserved for inclusion
                   11862:                   from other <code class=
                   11863:                   "filename">buildlink3.mk</code> files). It takes
                   11864:                   care of rebuilding the MIME database at
                   11865:                   installation and deinstallation time, and
                   11866:                   disallows any access to it directly from the
1.1       grant    11867:                   package.</p>
                   11868:                 </li>
                   11869: 
                   11870:                 <li>
                   11871:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  11872:                   the <code class="filename">share/mime</code>
1.1       grant    11873:                   directory, <span class=
                   11874:                   "emphasis"><em>except</em></span> for files saved
1.14      xtraeme  11875:                   under <code class=
                   11876:                   "filename">share/mime/packages</code>. The former
1.1       grant    11877:                   are handled automatically by the
                   11878:                   update-mime-database program, but the later are
                   11879:                   package-dependent and must be removed by the
                   11880:                   package that installed them in the first
                   11881:                   place.</p>
                   11882:                 </li>
                   11883: 
                   11884:                 <li>
1.14      xtraeme  11885:                   <p>Remove any <code class=
                   11886:                   "filename">share/mime/*</code> directories from
                   11887:                   the PLIST. They will be handled by the
1.1       grant    11888:                   shared-mime-info package.</p>
                   11889:                 </li>
                   11890:               </ol>
                   11891:             </div>
                   11892:           </div>
                   11893: 
                   11894:           <div class="sect2" lang="en" xml:lang="en">
                   11895:             <div class="titlepage">
                   11896:               <div>
                   11897:                 <div>
1.30      wiz      11898:                   <h3 class="title"><a name="intltool" id=
1.35      jmmv     11899:                   "intltool"></a>14.5.14.&nbsp;Packages using
1.1       grant    11900:                   intltool</h3>
                   11901:                 </div>
                   11902:               </div>
                   11903:             </div>
                   11904: 
                   11905:             <p>If a package uses intltool during its build, include
1.14      xtraeme  11906:             the <code class=
                   11907:             "filename">../../textproc/intltool/buildlink3.mk</code>
1.1       grant    11908:             file, which forces it to use the intltool package
                   11909:             provided by pkgsrc, instead of the one bundled with the
                   11910:             distribution file.</p>
                   11911: 
                   11912:             <p>This tracks intltool's build-time dependencies and
                   11913:             uses the latest available version; this way, the
                   11914:             package benefits of any bug fixes that may have
                   11915:             appeared since it was released.</p>
                   11916:           </div>
1.18      xtraeme  11917: 
                   11918:           <div class="sect2" lang="en" xml:lang="en">
                   11919:             <div class="titlepage">
                   11920:               <div>
                   11921:                 <div>
1.30      wiz      11922:                   <h3 class="title"><a name="startup-scripts" id=
1.35      jmmv     11923:                   "startup-scripts"></a>14.5.15.&nbsp;Packages
1.30      wiz      11924:                   installing startup scripts</h3>
1.18      xtraeme  11925:                 </div>
                   11926:               </div>
                   11927:             </div>
                   11928: 
                   11929:             <p>If a package contains a rc.d script, it won't be
                   11930:             copied into the startup directory by default, but you
                   11931:             can enable it, by adding the option <code class=
                   11932:             "varname">PKG_RCD_SCRIPTS=YES</code> in <code class=
                   11933:             "filename">/etc/mk.conf</code>. This option will copy
                   11934:             the scripts into <code class=
                   11935:             "filename">/etc/rc.d</code> when a package is
                   11936:             installed, and it will automatically remove the scripts
                   11937:             when the package is deinstalled.</p>
                   11938:           </div>
1.1       grant    11939:         </div>
                   11940: 
                   11941:         <div class="sect1" lang="en" xml:lang="en">
                   11942:           <div class="titlepage">
                   11943:             <div>
                   11944:               <div>
                   11945:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      11946:                 "feedback-to-author" id=
1.35      jmmv     11947:                 "feedback-to-author"></a>14.6.&nbsp;Feedback to the
1.30      wiz      11948:                 author</h2>
1.1       grant    11949:               </div>
                   11950:             </div>
                   11951:           </div>
                   11952: 
                   11953:           <p>If you have found any bugs in the package you make
                   11954:           available, if you had to do special steps to make it run
                   11955:           under NetBSD or if you enhanced the software in various
                   11956:           other ways, be sure to report these changes back to the
                   11957:           original author of the program! With that kind of
                   11958:           support, the next release of the program can incorporate
                   11959:           these fixes, and people not using the NetBSD packages
                   11960:           system can win from your efforts.</p>
                   11961: 
                   11962:           <p>Support the idea of free software!</p>
                   11963:         </div>
                   11964:       </div>
                   11965: 
                   11966:       <div class="chapter" lang="en" xml:lang="en">
                   11967:         <div class="titlepage">
                   11968:           <div>
                   11969:             <div>
                   11970:               <h2 class="title"><a name="debug" id=
1.35      jmmv     11971:               "debug"></a>Chapter&nbsp;15.&nbsp;Debugging</h2>
1.1       grant    11972:             </div>
                   11973:           </div>
                   11974:         </div>
                   11975: 
                   11976:         <p>To check out all the gotchas when building a package,
                   11977:         here are the steps that I do in order to get a package
                   11978:         working. Please note this is basically the same as what was
                   11979:         explained in the previous sections, only with some
                   11980:         debugging aids.</p>
                   11981: 
                   11982:         <div class="itemizedlist">
                   11983:           <ul type="disc">
                   11984:             <li>
1.14      xtraeme  11985:               <p>Be sure to set <code class=
                   11986:               "varname">PKG_DEVELOPER=1</code> in <code class=
                   11987:               "filename">/etc/mk.conf</code></p>
1.1       grant    11988:             </li>
                   11989: 
                   11990:             <li>
                   11991:               <p>Install <a xmlns=
                   11992:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   11993:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.20      ben      11994:               class="pkgname">pkgtools/url2pkg</a>, create a
                   11995:               directory for a new package, change into it, then run
                   11996:               <span><strong class=
                   11997:               "command">url2pkg</strong></span>:</p>
1.1       grant    11998:               <pre class="screen">
1.14      xtraeme  11999: <code class="prompt">%</code> <strong class=
                   12000: "userinput"><code>mkdir /usr/pkgsrc/<em class=
                   12001: "replaceable"><code>category</code></em>/<em class=
                   12002: "replaceable"><code>examplepkg</code></em></code></strong>
                   12003: <code class="prompt">%</code> <strong class=
                   12004: "userinput"><code>cd /usr/pkgsrc/<em class=
                   12005: "replaceable"><code>category</code></em>/<em class=
                   12006: "replaceable"><code>examplepkg</code></em></code></strong>
                   12007: <code class="prompt">%</code> <strong class=
                   12008: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1       grant    12009: </pre>
                   12010:             </li>
                   12011: 
                   12012:             <li>
1.14      xtraeme  12013:               <p>Edit the <code class="filename">Makefile</code> as
1.1       grant    12014:               requested.</p>
                   12015:             </li>
                   12016: 
                   12017:             <li>
1.14      xtraeme  12018:               <p>Fill in the <code class="filename">DESCR</code>
1.1       grant    12019:               file</p>
                   12020:             </li>
                   12021: 
                   12022:             <li>
1.14      xtraeme  12023:               <p>Run <span><strong class="command">make
                   12024:               configure</strong></span></p>
1.1       grant    12025:             </li>
                   12026: 
                   12027:             <li>
                   12028:               <p>Add any dependencies glimpsed from documentation
1.14      xtraeme  12029:               and the configure step to the package's <code class=
                   12030:               "filename">Makefile</code>.</p>
1.1       grant    12031:             </li>
                   12032: 
                   12033:             <li>
                   12034:               <p>Make the package compile, doing multiple rounds
                   12035:               of</p>
                   12036:               <pre class="screen">
1.14      xtraeme  12037: <code class="prompt">%</code> <strong class=
                   12038: "userinput"><code>make</code></strong>
                   12039: <code class="prompt">%</code> <strong class=
                   12040: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
                   12041: <code class="prompt">%</code> <strong class=
                   12042: "userinput"><code>mkpatches</code></strong>
                   12043: <code class="prompt">%</code> <strong class=
                   12044: "userinput"><code>patchdiff</code></strong>
                   12045: <code class="prompt">%</code> <strong class=
                   12046: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
                   12047: <code class="prompt">%</code> <strong class=
                   12048: "userinput"><code>make mps</code></strong>
                   12049: <code class="prompt">%</code> <strong class=
                   12050: "userinput"><code>make clean</code></strong>
1.1       grant    12051: </pre>
                   12052: 
                   12053:               <p>Doing as non-root user will ensure that no files
                   12054:               are modified that shouldn't be, especially during the
1.14      xtraeme  12055:               build phase. <span><strong class=
                   12056:               "command">mkpatches</strong></span>,
                   12057:               <span><strong class=
                   12058:               "command">patchdiff</strong></span> and
                   12059:               <span><strong class="command">pkgvi</strong></span>
                   12060:               are from the <a xmlns=
1.1       grant    12061:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   12062:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20      ben      12063:               class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1       grant    12064:             </li>
                   12065: 
                   12066:             <li>
1.14      xtraeme  12067:               <p>Look at the <code class=
                   12068:               "filename">Makefile</code>, fix if necessary; see
                   12069:               <a href="#components.Makefile" title=
1.27      rillig   12070:               "7.1.&nbsp;Makefile">Section&nbsp;7.1,
1.14      xtraeme  12071:               &#8220;<code class=
                   12072:               "filename">Makefile</code>&#8221;</a>.</p>
1.1       grant    12073:             </li>
                   12074: 
                   12075:             <li>
1.14      xtraeme  12076:               <p>Generate a <code class=
                   12077:               "filename">PLIST</code>:</p>
1.1       grant    12078:               <pre class="screen">
1.14      xtraeme  12079: <code class="prompt">#</code> <strong class=
                   12080: "userinput"><code>make install</code></strong>
                   12081: <code class="prompt">#</code> <strong class=
                   12082: "userinput"><code>make print-PLIST &gt;PLIST</code></strong>
                   12083: <code class="prompt">#</code> <strong class=
                   12084: "userinput"><code>make deinstall</code></strong>
                   12085: <code class="prompt">#</code> <strong class=
                   12086: "userinput"><code>make install</code></strong>
                   12087: <code class="prompt">#</code> <strong class=
                   12088: "userinput"><code>make deinstall</code></strong>
1.1       grant    12089: </pre>
                   12090: 
1.14      xtraeme  12091:               <p>You usually need to be <code class=
                   12092:               "username">root</code> to do this. Look if there are
1.1       grant    12093:               any files left:</p>
                   12094:               <pre class="screen">
1.14      xtraeme  12095: <code class="prompt">#</code> <strong class=
                   12096: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    12097: </pre>
                   12098: 
                   12099:               <p>If this reveals any files that are missing in
1.14      xtraeme  12100:               <code class="filename">PLIST</code>, add them.</p>
1.1       grant    12101:             </li>
                   12102: 
                   12103:             <li>
1.14      xtraeme  12104:               <p>Now that the <code class="filename">PLIST</code>
                   12105:               is OK, install the package again and make a binary
1.1       grant    12106:               package:</p>
                   12107:               <pre class="screen">
1.14      xtraeme  12108: <code class="prompt">#</code> <strong class=
                   12109: "userinput"><code>make reinstall</code></strong>
                   12110: <code class="prompt">#</code> <strong class=
                   12111: "userinput"><code>make package</code></strong>
1.1       grant    12112: </pre>
                   12113:             </li>
                   12114: 
                   12115:             <li>
                   12116:               <p>Delete the installed package:</p>
                   12117:               <pre class="screen">
1.14      xtraeme  12118: <code class="prompt">#</code> <strong class=
                   12119: "userinput"><code>pkg_delete blub</code></strong>
1.1       grant    12120: </pre>
                   12121:             </li>
                   12122: 
                   12123:             <li>
1.14      xtraeme  12124:               <p>Repeat the above <span><strong class=
                   12125:               "command">make print-PLIST</strong></span> command,
                   12126:               which shouldn't find anything now:</p>
1.1       grant    12127:               <pre class="screen">
1.14      xtraeme  12128: <code class="prompt">#</code> <strong class=
                   12129: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    12130: </pre>
                   12131:             </li>
                   12132: 
                   12133:             <li>
                   12134:               <p>Reinstall the binary package:</p>
                   12135:               <pre class="screen">
1.14      xtraeme  12136: <code class="prompt">#</code> <strong class=
                   12137: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1       grant    12138: </pre>
                   12139:             </li>
                   12140: 
                   12141:             <li>
                   12142:               <p>Play with it. Make sure everything works.</p>
                   12143:             </li>
                   12144: 
                   12145:             <li>
1.14      xtraeme  12146:               <p>Run <span><strong class=
                   12147:               "command">pkglint</strong></span> from <a xmlns=
1.1       grant    12148:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   12149:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20      ben      12150:               class="pkgname">pkgtools/pkglint</a>, and fix the
                   12151:               problems it reports:</p>
1.1       grant    12152:               <pre class="screen">
1.14      xtraeme  12153: <code class="prompt">#</code> <strong class=
                   12154: "userinput"><code>pkglint</code></strong>
1.1       grant    12155: </pre>
                   12156:             </li>
                   12157: 
                   12158:             <li>
                   12159:               <p>Submit (or commit, if you have cvs access); see
                   12160:               <a href="#submit" title=
1.35      jmmv     12161:               "Chapter&nbsp;16.&nbsp;Submitting and Committing">Chapter&nbsp;16,
1.1       grant    12162:               <i>Submitting and Committing</i></a>.</p>
                   12163:             </li>
                   12164:           </ul>
                   12165:         </div>
                   12166:       </div>
                   12167: 
                   12168:       <div class="chapter" lang="en" xml:lang="en">
                   12169:         <div class="titlepage">
                   12170:           <div>
                   12171:             <div>
                   12172:               <h2 class="title"><a name="submit" id=
1.35      jmmv     12173:               "submit"></a>Chapter&nbsp;16.&nbsp;Submitting and
1.1       grant    12174:               Committing</h2>
                   12175:             </div>
                   12176:           </div>
                   12177:         </div>
                   12178: 
                   12179:         <div class="toc">
                   12180:           <p><b>Table of Contents</b></p>
                   12181: 
                   12182:           <dl>
1.30      wiz      12183:             <dt><span class="sect1"><a href=
1.35      jmmv     12184:             "#submitting-your-package">16.1. Submitting your
1.30      wiz      12185:             packages</a></span></dt>
1.1       grant    12186: 
1.30      wiz      12187:             <dt><span class="sect1"><a href=
1.35      jmmv     12188:             "#committing-importing">16.2. Committing: Importing a
1.30      wiz      12189:             package into CVS</a></span></dt>
1.1       grant    12190: 
1.30      wiz      12191:             <dt><span class="sect1"><a href=
1.35      jmmv     12192:             "#updating-package">16.3. Updating a package to a newer
1.30      wiz      12193:             version</a></span></dt>
1.1       grant    12194: 
1.35      jmmv     12195:             <dt><span class="sect1"><a href="#moving-package">16.4.
1.2       hubertf  12196:             Moving a package in pkgsrc</a></span></dt>
1.1       grant    12197:           </dl>
                   12198:         </div>
                   12199: 
                   12200:         <div class="sect1" lang="en" xml:lang="en">
                   12201:           <div class="titlepage">
                   12202:             <div>
                   12203:               <div>
                   12204:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      12205:                 "submitting-your-package" id=
1.35      jmmv     12206:                 "submitting-your-package"></a>16.1.&nbsp;Submitting
1.30      wiz      12207:                 your packages</h2>
1.1       grant    12208:               </div>
                   12209:             </div>
                   12210:           </div>
                   12211: 
                   12212:           <p>You have to separate between binary and
                   12213:           &#8220;<span class="quote">normal</span>&#8221; (source)
                   12214:           packages here:</p>
                   12215: 
                   12216:           <div class="itemizedlist">
                   12217:             <ul type="disc">
                   12218:               <li>
                   12219:                 <p>precompiled binary packages</p>
                   12220: 
                   12221:                 <p>Our policy is that we accept binaries only from
                   12222:                 pkgsrc developers to guarantee that the packages
                   12223:                 don't contain any trojan horses etc. This is not to
1.13      hubertf  12224:                 annoy anyone but rather to protect our users!
1.1       grant    12225:                 You're still free to put up your home-made binary
1.13      hubertf  12226:                 packages and tell the world where to get them.
                   12227:                 NetBSD developers doing bulk builds and wanting to
                   12228:                 upload them please see <a href="#bulk-upload"
                   12229:                 title="5.3.8.&nbsp;Uploading results of a bulk build">
                   12230:                 Section&nbsp;5.3.8, &#8220;Uploading results of a
                   12231:                 bulk build&#8221;</a>.</p>
1.1       grant    12232:               </li>
                   12233: 
                   12234:               <li>
                   12235:                 <p>packages</p>
                   12236: 
                   12237:                 <p>First, check that your package is complete,
                   12238:                 compiles and runs well; see <a href="#debug" title=
1.35      jmmv     12239:                 "Chapter&nbsp;15.&nbsp;Debugging">Chapter&nbsp;15,
1.1       grant    12240:                 <i>Debugging</i></a> and the rest of this document.
1.24      wiz      12241:                 Next, generate an uuencoded gzipped <a href=
                   12242:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   12243:                 <span class="citerefentry"><span class=
                   12244:                 "refentrytitle">tar</span>(1)</span></a> archive,
1.1       grant    12245:                 preferably with all files in a single directory.
1.14      xtraeme  12246:                 Finally, <span><strong class=
                   12247:                 "command">send-pr</strong></span> with category
1.1       grant    12248:                 &#8220;<span class="quote">pkg</span>&#8221;, a
                   12249:                 synopsis which includes the package name and
                   12250:                 version number, a short description of your package
                   12251:                 (contents of the COMMENT variable or DESCR file are
                   12252:                 OK) and attach the archive to your PR.</p>
                   12253: 
                   12254:                 <p>If you want to submit several packages, please
                   12255:                 send a separate PR for each one, it's easier for us
                   12256:                 to track things that way.</p>
                   12257: 
                   12258:                 <p>Alternatively, you can also import new packages
                   12259:                 into pkgsrc-wip (&#8220;<span class="quote">pkgsrc
                   12260:                 work-in-progress</span>&#8221;); see the homepage
                   12261:                 at <a href="http://pkgsrc-wip.sourceforge.net/"
                   12262:                 target=
                   12263:                 "_top">http://pkgsrc-wip.sourceforge.net/</a> for
                   12264:                 details.</p>
                   12265:               </li>
                   12266:             </ul>
                   12267:           </div>
                   12268:         </div>
                   12269: 
                   12270:         <div class="sect1" lang="en" xml:lang="en">
                   12271:           <div class="titlepage">
                   12272:             <div>
                   12273:               <div>
                   12274:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      12275:                 "committing-importing" id=
1.35      jmmv     12276:                 "committing-importing"></a>16.2.&nbsp;Committing:
1.30      wiz      12277:                 Importing a package into CVS</h2>
1.1       grant    12278:               </div>
                   12279:             </div>
                   12280:           </div>
                   12281: 
                   12282:           <p>This section is only of interest for pkgsrc developers
                   12283:           with write access to the pkgsrc repository. Please
                   12284:           remember that cvs imports files relative to the current
                   12285:           working directory, and that the pathname that you give
1.14      xtraeme  12286:           the <span><strong class="command">cvs
                   12287:           import</strong></span> command is so that it knows where
                   12288:           to place the files in the repository. Newly created
                   12289:           packages should be imported with a vendor tag of
                   12290:           &#8220;<span class="quote">TNF</span>&#8221; and a
                   12291:           release tag of &#8220;<span class=
                   12292:           "quote">pkgsrc-base</span>&#8221;, e.g:</p>
1.1       grant    12293:           <pre class="programlisting">
                   12294:   % cd .../pkgsrc/category/pkgname
                   12295:   % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
                   12296: </pre>
                   12297: 
                   12298:           <p>Remember to move the directory from which you imported
                   12299:           out of the way, or cvs will complain the next time you
                   12300:           &#8220;<span class="quote">cvs update</span>&#8221; your
                   12301:           source tree. Also don't forget to add the new package to
1.14      xtraeme  12302:           the category's <code class=
                   12303:           "filename">Makefile</code>.</p>
1.1       grant    12304: 
                   12305:           <p>The commit message of the initial import should
1.14      xtraeme  12306:           include part of the <code class="filename">DESCR</code>
                   12307:           file, so people reading the mailing lists know what the
                   12308:           package is/does.</p>
1.1       grant    12309: 
                   12310:           <p>Please note all package updates/additions in
1.14      xtraeme  12311:           <code class="filename">pkgsrc/doc/CHANGES</code>. It's
                   12312:           very important to keep this file up to date and
                   12313:           conforming to the existing format, because it will be
                   12314:           used by scripts to automatically update pages on <a href=
1.1       grant    12315:           "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
                   12316:           and other sites. Additionally, check the pkgsrc/doc/TODO
                   12317:           file and remove the entry for the package you updated, in
                   12318:           case it was mentioned there.</p>
                   12319: 
                   12320:           <p>For new packages, &#8220;<span class="quote">cvs
                   12321:           import</span>&#8221; is preferred to &#8220;<span class=
                   12322:           "quote">cvs add</span>&#8221; because the former gets
                   12323:           everything with a single command, and provides a
                   12324:           consistent tag.</p>
                   12325:         </div>
                   12326: 
                   12327:         <div class="sect1" lang="en" xml:lang="en">
                   12328:           <div class="titlepage">
                   12329:             <div>
                   12330:               <div>
                   12331:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      12332:                 "updating-package" id=
1.35      jmmv     12333:                 "updating-package"></a>16.3.&nbsp;Updating a
1.30      wiz      12334:                 package to a newer version</h2>
1.1       grant    12335:               </div>
                   12336:             </div>
                   12337:           </div>
                   12338: 
                   12339:           <p>Please always put a concise, appropriate and relevant
                   12340:           summary of the changes between old and new versions into
                   12341:           the commit log when updating a package. There are various
                   12342:           reasons for this:</p>
                   12343: 
                   12344:           <div class="itemizedlist">
                   12345:             <ul type="disc">
                   12346:               <li>
                   12347:                 <p>A URL is volatile, and can change over time. It
                   12348:                 may go away completely or its information may be
                   12349:                 overwritten by newer information.</p>
                   12350:               </li>
                   12351: 
                   12352:               <li>
                   12353:                 <p>Having the change information between old and
                   12354:                 new versions in our CVS repository is very useful
                   12355:                 for people who use either cvs or anoncvs.</p>
                   12356:               </li>
                   12357: 
                   12358:               <li>
                   12359:                 <p>Having the change information between old and
                   12360:                 new versions in our CVS repository is very useful
                   12361:                 for people who read the pkgsrc-changes mailing
                   12362:                 list, so that they can make tactical decisions
                   12363:                 about when to upgrade the package.</p>
                   12364:               </li>
                   12365:             </ul>
                   12366:           </div>
                   12367: 
1.18      xtraeme  12368:           <p>Please also recognize that, just because a new version
1.1       grant    12369:           of a package has been released, it should not
                   12370:           automatically be upgraded in the CVS repository. We
                   12371:           prefer to be conservative in the packages that are
                   12372:           included in pkgsrc - development or beta packages are not
                   12373:           really the best thing for most places in which pkgsrc is
                   12374:           used. Please use your judgement about what should go into
                   12375:           pkgsrc, and bear in mind that stability is to be
                   12376:           preferred above new and possibly untested features.</p>
                   12377:         </div>
                   12378: 
                   12379:         <div class="sect1" lang="en" xml:lang="en">
                   12380:           <div class="titlepage">
                   12381:             <div>
                   12382:               <div>
                   12383:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      12384:                 "moving-package" id=
1.35      jmmv     12385:                 "moving-package"></a>16.4.&nbsp;Moving a package in
1.30      wiz      12386:                 pkgsrc</h2>
1.1       grant    12387:               </div>
                   12388:             </div>
                   12389:           </div>
                   12390: 
                   12391:           <div class="orderedlist">
                   12392:             <ol type="1">
                   12393:               <li>
                   12394:                 <p>Make a copy of the directory somewhere else.</p>
                   12395:               </li>
                   12396: 
                   12397:               <li>
                   12398:                 <p>Remove all CVS dirs.</p>
                   12399: 
                   12400:                 <p>Alternatively to the first two steps you can
                   12401:                 also do:</p>
                   12402:                 <pre class="screen">
1.14      xtraeme  12403: <code class="prompt">%</code> <strong class=
                   12404: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1       grant    12405: </pre>
                   12406: 
                   12407:                 <p>and use that for further work.</p>
                   12408:               </li>
                   12409: 
                   12410:               <li>
1.14      xtraeme  12411:                 <p>Fix <code class="varname">CATEGORIES</code> and
                   12412:                 any <code class="varname">DEPENDS</code> paths that
                   12413:                 just did &#8220;<span class=
1.1       grant    12414:                 "quote">../package</span>&#8221; instead of
                   12415:                 &#8220;<span class=
                   12416:                 "quote">../../category/package</span>&#8221;.</p>
                   12417:               </li>
                   12418: 
                   12419:               <li>
1.14      xtraeme  12420:                 <p><span><strong class="command">cvs
                   12421:                 import</strong></span> the modified package in the
                   12422:                 new place.</p>
1.1       grant    12423:               </li>
                   12424: 
                   12425:               <li>
                   12426:                 <p>Check if any package depends on it:</p>
                   12427:                 <pre class="screen">
1.14      xtraeme  12428: <code class="prompt">%</code> <strong class=
                   12429: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   12430: <code class="prompt">%</code> <strong class=
                   12431: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1       grant    12432: </pre>
                   12433:               </li>
                   12434: 
                   12435:               <li>
                   12436:                 <p>Fix paths in packages from step 5 to point to
                   12437:                 new location.</p>
                   12438:               </li>
                   12439: 
                   12440:               <li>
1.14      xtraeme  12441:                 <p><span><strong class="command">cvs rm
                   12442:                 (-f)</strong></span> the package at the old
                   12443:                 location.</p>
1.1       grant    12444:               </li>
                   12445: 
                   12446:               <li>
1.14      xtraeme  12447:                 <p>Remove from <code class=
                   12448:                 "filename">oldcategory/Makefile</code>.</p>
1.1       grant    12449:               </li>
                   12450: 
                   12451:               <li>
1.14      xtraeme  12452:                 <p>Add to <code class=
                   12453:                 "filename">newcategory/Makefile</code>.</p>
1.1       grant    12454:               </li>
                   12455: 
                   12456:               <li>
                   12457:                 <p>Commit the changed and removed files:</p>
                   12458:                 <pre class="screen">
1.14      xtraeme  12459: <code class="prompt">%</code> <strong class=
                   12460: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1       grant    12461: </pre>
                   12462: 
                   12463:                 <p>(and any packages from step 5, of course).</p>
                   12464:               </li>
                   12465:             </ol>
                   12466:           </div>
                   12467:         </div>
                   12468:       </div>
                   12469:     </div>
                   12470: 
                   12471:     <div class="appendix" lang="en" xml:lang="en">
                   12472:       <div class="titlepage">
                   12473:         <div>
                   12474:           <div>
                   12475:             <h2 class="title"><a name="examples" id=
                   12476:             "examples"></a>Appendix&nbsp;A.&nbsp;A simple example
                   12477:             package: bison</h2>
                   12478:           </div>
                   12479:         </div>
                   12480:       </div>
                   12481: 
                   12482:       <div class="toc">
                   12483:         <p><b>Table of Contents</b></p>
                   12484: 
                   12485:         <dl>
1.30      wiz      12486:           <dt><span class="sect1"><a href="#example-files">A.1.
1.1       grant    12487:           files</a></span></dt>
                   12488: 
                   12489:           <dd>
                   12490:             <dl>
1.30      wiz      12491:               <dt><span class="sect2"><a href=
                   12492:               "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1       grant    12493: 
1.30      wiz      12494:               <dt><span class="sect2"><a href=
                   12495:               "#example-descr">A.1.2. DESCR</a></span></dt>
1.1       grant    12496: 
1.30      wiz      12497:               <dt><span class="sect2"><a href=
                   12498:               "#example-plist">A.1.3. PLIST</a></span></dt>
1.1       grant    12499: 
1.30      wiz      12500:               <dt><span class="sect2"><a href=
                   12501:               "#checking-package-with-pkglint">A.1.4. Checking a
                   12502:               package with <span><strong class=
1.14      xtraeme  12503:               "command">pkglint</strong></span></a></span></dt>
1.1       grant    12504:             </dl>
                   12505:           </dd>
                   12506: 
1.30      wiz      12507:           <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
                   12508:           Steps for building, installing, packaging</a></span></dt>
1.1       grant    12509:         </dl>
                   12510:       </div>
                   12511: 
                   12512:       <p>We checked to find a piece of software that wasn't in the
                   12513:       packages collection, and picked GNU bison. Quite why someone
1.14      xtraeme  12514:       would want to have <span><strong class=
                   12515:       "command">bison</strong></span> when Berkeley
                   12516:       <span><strong class="command">yacc</strong></span> is already
                   12517:       present in the tree is beyond us, but it's useful for the
                   12518:       purposes of this exercise.</p>
1.1       grant    12519: 
                   12520:       <div class="sect1" lang="en" xml:lang="en">
                   12521:         <div class="titlepage">
                   12522:           <div>
                   12523:             <div>
                   12524:               <h2 class="title" style="clear: both"><a name=
1.30      wiz      12525:               "example-files" id=
                   12526:               "example-files"></a>A.1.&nbsp;files</h2>
1.1       grant    12527:             </div>
                   12528:           </div>
                   12529:         </div>
                   12530: 
                   12531:         <div class="sect2" lang="en" xml:lang="en">
                   12532:           <div class="titlepage">
                   12533:             <div>
                   12534:               <div>
1.30      wiz      12535:                 <h3 class="title"><a name="example-Makefile" id=
                   12536:                 "example-Makefile"></a>A.1.1.&nbsp;Makefile</h3>
1.1       grant    12537:               </div>
                   12538:             </div>
                   12539:           </div>
                   12540:           <pre class="programlisting">
1.17      sketch   12541: # $NetBSD$
1.1       grant    12542: #
                   12543: 
                   12544: DISTNAME=       bison-1.25
                   12545: CATEGORIES=     devel
                   12546: MASTER_SITES=   ${MASTER_SITE_GNU}
                   12547: 
                   12548: MAINTAINER=     thorpej@NetBSD.org
                   12549: HOMEPAGE=       http://www.gnu.org/software/bison/bison.html
                   12550: COMMENT=        GNU yacc clone
                   12551: 
                   12552: GNU_CONFIGURE=  yes
                   12553: INFO_FILES=     bison.info
                   12554: 
                   12555: .include "../../mk/bsd.pkg.mk"
                   12556: </pre>
                   12557:         </div>
                   12558: 
                   12559:         <div class="sect2" lang="en" xml:lang="en">
                   12560:           <div class="titlepage">
                   12561:             <div>
                   12562:               <div>
1.30      wiz      12563:                 <h3 class="title"><a name="example-descr" id=
                   12564:                 "example-descr"></a>A.1.2.&nbsp;DESCR</h3>
1.1       grant    12565:               </div>
                   12566:             </div>
                   12567:           </div>
                   12568:           <pre class="programlisting">
                   12569: GNU version of yacc.  Can make re-entrant parsers, and numerous other
                   12570: improvements.  Why you would want this when Berkeley <a href=
                   12571: "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
                   12572: of the NetBSD source tree is beyond me.
                   12573: </pre>
                   12574:         </div>
                   12575: 
                   12576:         <div class="sect2" lang="en" xml:lang="en">
                   12577:           <div class="titlepage">
                   12578:             <div>
                   12579:               <div>
1.30      wiz      12580:                 <h3 class="title"><a name="example-plist" id=
                   12581:                 "example-plist"></a>A.1.3.&nbsp;PLIST</h3>
1.1       grant    12582:               </div>
                   12583:             </div>
                   12584:           </div>
                   12585:           <pre class="programlisting">
1.17      sketch   12586: @comment $NetBSD$
1.1       grant    12587: bin/bison
                   12588: man/man1/bison.1.gz
                   12589: share/bison.simple
                   12590: share/bison.hairy
                   12591: </pre>
                   12592:         </div>
                   12593: 
                   12594:         <div class="sect2" lang="en" xml:lang="en">
                   12595:           <div class="titlepage">
                   12596:             <div>
                   12597:               <div>
1.30      wiz      12598:                 <h3 class="title"><a name=
                   12599:                 "checking-package-with-pkglint" id=
                   12600:                 "checking-package-with-pkglint"></a>A.1.4.&nbsp;Checking
                   12601:                 a package with <span><strong class=
1.14      xtraeme  12602:                 "command">pkglint</strong></span></h3>
1.1       grant    12603:               </div>
                   12604:             </div>
                   12605:           </div>
                   12606: 
                   12607:           <p>The NetBSD package system comes with <a xmlns=
                   12608:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   12609:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20      ben      12610:           class="pkgname">pkgtools/pkglint</a> which helps to check
                   12611:           the contents of these files. After installation it is
                   12612:           quite easy to use, just change to the directory of the
                   12613:           package you wish to examine and execute
                   12614:           <span><strong class=
                   12615:           "command">pkglint</strong></span>:</p>
1.1       grant    12616:           <pre class="screen">
1.14      xtraeme  12617: <code class="prompt">$</code> <strong class=
                   12618: "userinput"><code>pkglint</code></strong>
1.1       grant    12619: looks fine.
                   12620: </pre>
                   12621: 
                   12622:           <p>Depending on the supplied command line arguments (see
                   12623:           pkglint(1)) more verbose checks will be performed. Use
1.14      xtraeme  12624:           e.g. <span><strong class="command">pkglint
                   12625:           -v</strong></span> for a very verbose check.</p>
1.1       grant    12626:         </div>
                   12627:       </div>
                   12628: 
                   12629:       <div class="sect1" lang="en" xml:lang="en">
                   12630:         <div class="titlepage">
                   12631:           <div>
                   12632:             <div>
                   12633:               <h2 class="title" style="clear: both"><a name=
1.30      wiz      12634:               "steps-for-b-i-p" id=
                   12635:               "steps-for-b-i-p"></a>A.2.&nbsp;Steps for building,
                   12636:               installing, packaging</h2>
1.1       grant    12637:             </div>
                   12638:           </div>
                   12639:         </div>
                   12640: 
                   12641:         <p>Create the directory where the package lives, plus any
                   12642:         auxiliary directories:</p>
                   12643:         <pre class="screen">
1.14      xtraeme  12644: <code class="prompt">#</code> <strong class=
                   12645: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
                   12646: <code class="prompt">#</code> <strong class=
                   12647: "userinput"><code>mkdir bison</code></strong>
                   12648: <code class="prompt">#</code> <strong class=
                   12649: "userinput"><code>cd bison</code></strong>
                   12650: <code class="prompt">#</code> <strong class=
                   12651: "userinput"><code>mkdir patches</code></strong>
1.1       grant    12652: </pre>
                   12653: 
1.14      xtraeme  12654:         <p>Create <code class="filename">Makefile</code>,
                   12655:         <code class="filename">DESCR</code> and <code class=
                   12656:         "filename">PLIST</code> (see <a href="#components" title=
1.27      rillig   12657:         "Chapter&nbsp;7.&nbsp;Package components - files, directories and contents">
                   12658:         Chapter 7, <i>Package components - files, directories and
1.1       grant    12659:         contents</i></a>) then continue with fetching the
                   12660:         distfile:</p>
                   12661:         <pre class="screen">
1.14      xtraeme  12662: <code class="prompt">#</code> <strong class=
                   12663: "userinput"><code>make fetch</code></strong>
1.1       grant    12664: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   12665: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   12666: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   12667: ftp: Error retrieving file: 500 Internal error
                   12668: 
                   12669: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   12670: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   12671: ftp: Error retrieving file: 500 Internal error
                   12672: 
                   12673: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   12674: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   12675: Successfully retrieved file.
                   12676: </pre>
                   12677: 
1.14      xtraeme  12678:         <p>Generate the checksum of the distfile into <code class=
                   12679:         "filename">distinfo</code>:</p>
1.1       grant    12680:         <pre class="screen">
1.14      xtraeme  12681: <code class="prompt">#</code> <strong class=
                   12682: "userinput"><code>make makesum</code></strong>
1.1       grant    12683: </pre>
                   12684: 
                   12685:         <p>Now compile:</p>
                   12686:         <pre class="screen">
1.14      xtraeme  12687: <code class="prompt">#</code> <strong class=
                   12688: "userinput"><code>make</code></strong>
1.1       grant    12689: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   12690: ===&gt;  Extracting for bison-1.25
                   12691: ===&gt;  Patching for bison-1.25
                   12692: ===&gt;   Ignoring empty patch directory
                   12693: ===&gt;  Configuring for bison-1.25
                   12694: creating cache ./config.cache
                   12695: checking for gcc... cc
                   12696: checking whether we are using GNU C... yes
                   12697: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   12698: checking how to run the C preprocessor... cc -E
                   12699: checking for minix/config.h... no
                   12700: checking for POSIXized ISC... no
                   12701: checking whether cross-compiling... no
                   12702: checking for ANSI C header files... yes
                   12703: checking for string.h... yes
                   12704: checking for stdlib.h... yes
                   12705: checking for memory.h... yes
                   12706: checking for working const... yes
                   12707: checking for working alloca.h... no
                   12708: checking for alloca... yes
                   12709: checking for strerror... yes
                   12710: updating cache ./config.cache
                   12711: creating ./config.status
                   12712: creating Makefile
                   12713: ===&gt;  Building for bison-1.25
                   12714: 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
                   12715: 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
                   12716: 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
                   12717: 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
                   12718: 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
                   12719: 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 
                   12720: 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
                   12721: 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
                   12722: 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
                   12723: 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
                   12724: 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
                   12725: 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
                   12726: 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
                   12727: 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
                   12728: 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
                   12729: 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
                   12730: 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
                   12731: 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
                   12732: 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
                   12733: 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
                   12734: 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
                   12735: 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
                   12736: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   12737: rm -f bison.s1
                   12738: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1
                   12739: </pre>
                   12740: 
                   12741:         <p>Everything seems OK, so install the files:</p>
                   12742:         <pre class="screen">
1.14      xtraeme  12743: <code class="prompt">#</code> <strong class=
                   12744: "userinput"><code>make install</code></strong>
1.1       grant    12745: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   12746: ===&gt;  Installing for bison-1.25
                   12747: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   12748: rm -f /usr/pkg/bin/bison
                   12749: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   12750: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   12751: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   12752: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   12753: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   12754: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   12755: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
                   12756: ===&gt;  Registering installation for bison-1.25
                   12757: </pre>
                   12758: 
                   12759:         <p>You can now use bison, and also - if you decide so -
1.14      xtraeme  12760:         remove it with <span><strong class="command">pkg_delete
                   12761:         bison</strong></span>. Should you decide that you want a
                   12762:         binary package, do this now:</p>
1.1       grant    12763:         <pre class="screen">
1.14      xtraeme  12764: <code class="prompt">#</code> <strong class=
                   12765: "userinput"><code>make package</code></strong>
1.1       grant    12766: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   12767: ===&gt;  Building package for bison-1.25
                   12768: Creating package bison-1.25.tgz
                   12769: Registering depends:.
                   12770: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
                   12771: </pre>
                   12772: 
                   12773:         <p>Now that you don't need the source and object files any
                   12774:         more, clean up:</p>
                   12775:         <pre class="screen">
1.14      xtraeme  12776: <code class="prompt">#</code> <strong class=
                   12777: "userinput"><code>make clean</code></strong>
1.1       grant    12778: ===&gt;  Cleaning for bison-1.25
                   12779: </pre>
                   12780:       </div>
                   12781:     </div>
                   12782: 
                   12783:     <div class="appendix" lang="en" xml:lang="en">
                   12784:       <div class="titlepage">
                   12785:         <div>
                   12786:           <div>
                   12787:             <h2 class="title"><a name="logs" id=
                   12788:             "logs"></a>Appendix&nbsp;B.&nbsp;Build logs</h2>
                   12789:           </div>
                   12790:         </div>
                   12791:       </div>
                   12792: 
                   12793:       <div class="toc">
                   12794:         <p><b>Table of Contents</b></p>
                   12795: 
                   12796:         <dl>
                   12797:           <dt><span class="sect1"><a href="#logs.building">B.1.
                   12798:           Building figlet</a></span></dt>
                   12799: 
                   12800:           <dt><span class="sect1"><a href="#logs.package">B.2.
                   12801:           Packaging figlet</a></span></dt>
                   12802:         </dl>
                   12803:       </div>
                   12804: 
                   12805:       <div class="sect1" lang="en" xml:lang="en">
                   12806:         <div class="titlepage">
                   12807:           <div>
                   12808:             <div>
                   12809:               <h2 class="title" style="clear: both"><a name=
                   12810:               "logs.building" id=
                   12811:               "logs.building"></a>B.1.&nbsp;Building figlet</h2>
                   12812:             </div>
                   12813:           </div>
                   12814:         </div>
                   12815:         <pre class="screen">
1.14      xtraeme  12816: <code class="prompt">#</code> <strong class=
                   12817: "userinput"><code>make</code></strong>
1.1       grant    12818: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   12819: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   12820: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   12821: =&gt; [172219 bytes]
                   12822: Connected to ftp.plig.net.
                   12823: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   12824: 331 Guest login ok, send your complete e-mail address as password.
                   12825: 230-You are user #5 of 500 simultaneous users allowed.
                   12826: 230-
                   12827: 230-  ___ _             _ _                   
                   12828: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___ 
                   12829: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   12830: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   12831: 230-         |_|   |_|     |___|         |___|
                   12832: 230-
                   12833: 230-** Welcome to ftp.plig.org **
                   12834: 230-
                   12835: 230-Please note that all transfers from this FTP site are logged. If you
                   12836: 230-do not like this, please disconnect now.
                   12837: 230-
                   12838: 230-This arhive is available via
                   12839: 230-
                   12840: 230-HTTP:  http://ftp.plig.org/
                   12841: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   12842: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   12843: 230-
                   12844: 230-Please email comments, bug reports and requests for packages to be
                   12845: 230-mirrored to ftp-admin@plig.org.   
                   12846: 230-
                   12847: 230-
                   12848: 230 Logged in anonymously.
                   12849: Remote system type is UNIX.
                   12850: Using binary mode to transfer files.
                   12851: 200 Type okay.
                   12852: 250 "/pub" is new cwd.
                   12853: 250-"/pub/figlet" is new cwd.
                   12854: 250-
                   12855: 250-Welcome to the figlet archive at ftp.figlet.org
                   12856: 250-    
                   12857: 250-    ftp://ftp.figlet.org/pub/figlet/
                   12858: 250-
                   12859: 250-The official FIGlet web page is:
                   12860: 250-    http://www.figlet.org/
                   12861: 250-
                   12862: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   12863: 250-contribute a font or something else, you can email us.
                   12864: 250 
                   12865: 250 "/pub/figlet/program" is new cwd.
                   12866: 250 "/pub/figlet/program/unix" is new cwd.
                   12867: local: figlet221.tar.gz remote: figlet221.tar.gz
                   12868: 502 Unimplemented command.
                   12869: 227 Entering Passive Mode (195,40,6,41,246,104)
                   12870: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   12871: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   12872: 226 Transfer completed.
                   12873: 172219 bytes received in 00:02 (75.99 KB/s)
                   12874: 221 Goodbye.
                   12875: =&gt; Checksum OK for figlet221.tar.gz.
                   12876: ===&gt; Extracting for figlet-2.2.1nb2
                   12877: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   12878: ===&gt; Patching for figlet-2.2.1nb2
                   12879: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   12880: ===&gt; Overriding tools for figlet-2.2.1nb2
                   12881: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   12882: ===&gt; Configuring for figlet-2.2.1nb2
                   12883: ===&gt; Building for figlet-2.2.1nb2
                   12884: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   12885: chmod a+x figlet
                   12886: gcc -O2 -o chkfont chkfont.c
                   12887: =&gt; Unwrapping files-to-be-installed.
1.14      xtraeme  12888: <code class="prompt">#</code>
                   12889: <code class="prompt">#</code> <strong class=
                   12890: "userinput"><code>make install</code></strong>
1.1       grant    12891: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   12892: ===&gt; Installing for figlet-2.2.1nb2
                   12893: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   12894: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   12895: mkdir -p /usr/pkg/share/figlet
                   12896: cp figlet /usr/pkg/bin
                   12897: cp chkfont /usr/pkg/bin
                   12898: chmod 555 figlist showfigfonts
                   12899: cp figlist /usr/pkg/bin
                   12900: cp showfigfonts /usr/pkg/bin
                   12901: cp fonts/*.flf /usr/pkg/share/figlet
                   12902: cp fonts/*.flc /usr/pkg/share/figlet
                   12903: cp figlet.6 /usr/pkg/man/man6
                   12904: ===&gt; Registering installation for figlet-2.2.1nb2
1.14      xtraeme  12905: <code class="prompt">#</code>
1.1       grant    12906: </pre>
                   12907:       </div>
                   12908: 
                   12909:       <div class="sect1" lang="en" xml:lang="en">
                   12910:         <div class="titlepage">
                   12911:           <div>
                   12912:             <div>
                   12913:               <h2 class="title" style="clear: both"><a name=
                   12914:               "logs.package" id=
                   12915:               "logs.package"></a>B.2.&nbsp;Packaging figlet</h2>
                   12916:             </div>
                   12917:           </div>
                   12918:         </div>
                   12919:         <pre class="screen">
1.14      xtraeme  12920: <code class="prompt">#</code> <strong class=
                   12921: "userinput"><code>make package</code></strong>
1.1       grant    12922: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   12923: ===&gt; Packaging figlet-2.2.1nb2
                   12924: ===&gt; Building binary package for figlet-2.2.1nb2
                   12925: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   12926: Using SrcDir value of /usr/pkg
                   12927: Registering depends:.  
1.14      xtraeme  12928: <code class="prompt">#</code>
1.1       grant    12929: </pre>
                   12930:       </div>
                   12931:     </div>
                   12932: 
                   12933:     <div class="appendix" lang="en" xml:lang="en">
                   12934:       <div class="titlepage">
                   12935:         <div>
                   12936:           <div>
                   12937:             <h2 class="title"><a name="ftp-layout" id=
                   12938:             "ftp-layout"></a>Appendix&nbsp;C.&nbsp;Layout of the
                   12939:             FTP server's package archive</h2>
                   12940:           </div>
                   12941:         </div>
                   12942:       </div>
                   12943: 
                   12944:       <p>Layout for precompiled binary packages on
                   12945:       ftp.NetBSD.org:</p>
                   12946:       <pre class="programlisting">
                   12947: /pub/NetBSD/packages/
                   12948:                 distfiles/
                   12949: 
                   12950:                 # Unpacked pkgsrc trees
                   12951:                 pkgsrc-current -&gt; /pub/NetBSD/NetBSD-current/pkgsrc
                   12952:                 pkgsrc-2003Q4 -&gt; N/A
                   12953:                 pkgsrc-2004Q1/pkgsrc
                   12954: 
                   12955:                 # pkgsrc archives
                   12956:                 pkgsrc-current.tar.gz -&gt; ../NetBSD-current/tar_files/pkgsrc.tar.gz
                   12957:                 pkgsrc-2003Q4.tar.gz -&gt; N/A
                   12958:                 pkgsrc-2004Q1.tar.gz -&gt; N/A
                   12959: 
                   12960:                 # Per pkgsrc-release/OS-release/arch package archives
                   12961:                 pkgsrc-2003Q4/
                   12962:                         NetBSD-1.6.2/
                   12963:                                 i386/
                   12964:                                         All/
                   12965:                                         archivers/
                   12966:                                                 foo -&gt; ../All/foo
                   12967:                                         ...
                   12968:                 pkgsrc-2004Q1/
                   12969:                         NetBSD-1.6.2/
                   12970:                                 i386/
                   12971:                                         All/
                   12972:                                         ...
                   12973:                         NetBSD-2.0/
                   12974:                                 i386/
                   12975:                                         All/
                   12976:                                         ...
                   12977:                         SunOS-5.9/
                   12978:                                 sparc/
                   12979:                                         All/
                   12980:                                         ...
                   12981:                                 x86/
                   12982:                                         All/
                   12983:                                         ...
                   12984: 
                   12985:                 # Per os-release package archive convenience links
                   12986:                 NetBSD-1.6.2 -&gt; 1.6.2
                   12987:                 1.6.2/
                   12988:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
                   12989:                         m68k/
                   12990:                                 All/
                   12991:                                 archivers/
                   12992:                                         foo -&gt; ../All/foo
                   12993:                                 ...
                   12994:                         amiga -&gt; m68k
                   12995:                         atari -&gt; m68k
                   12996:                         ...
                   12997: 
                   12998:                 2.0 -&gt; NetBSD-2.0       # backward compat, historic
                   12999:                 NetBSD-2.0/
                   13000:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-2.0/i386
                   13001:                 SunOS-5.9/
                   13002:                         sparc -&gt; ../pkgsrc-2004Q1/SunOS-5.9/sparc
                   13003:                         x86 -&gt; ../pkgsrc-2004Q1/SunOS-5.9/x86
                   13004:                         
                   13005: </pre>
                   13006: 
                   13007:       <p>To create:</p>
                   13008: 
                   13009:       <div class="orderedlist">
                   13010:         <ol type="1">
                   13011:           <li>
                   13012:             <p>Run bulk build, see <a href="#bulkbuild" title=
                   13013:             "5.3.&nbsp;Doing a bulk build of all packages">Section
                   13014:             5.3, &#8220;Doing a bulk build of all
                   13015:             packages&#8221;</a></p>
                   13016:           </li>
                   13017: 
                   13018:           <li>
                   13019:             <p>Upload /usr/pkgsrc/packages to</p>
                   13020:             <pre class="programlisting">
                   13021:     ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13      hubertf  13022:         pkgsrc-2004Q4/\                         # pkgsrc-branch
1.1       grant    13023:         `uname -s`-`uname -r`/                  # OS &amp; version
                   13024:         `uname -p`                              # architecture
                   13025:        
                   13026: </pre>
                   13027:           </li>
                   13028: 
                   13029:           <li>
1.14      xtraeme  13030:             <p>If necessary, create a symlink <span><strong class=
                   13031:             "command">ln -s `uname -m` `uname -p`</strong></span>
                   13032:             (amiga -&gt; m68k, ...)</p>
1.1       grant    13033:           </li>
                   13034:         </ol>
                   13035:       </div>
                   13036:     </div>
1.2       hubertf  13037: 
                   13038:     <div class="appendix" lang="en" xml:lang="en">
                   13039:       <div class="titlepage">
                   13040:         <div>
                   13041:           <div>
                   13042:             <h2 class="title"><a name="editing" id=
                   13043:             "editing"></a>Appendix&nbsp;D.&nbsp;Editing guidelines
                   13044:             for the pkgsrc guide</h2>
                   13045:           </div>
                   13046:         </div>
                   13047:       </div>
                   13048: 
                   13049:       <div class="toc">
                   13050:         <p><b>Table of Contents</b></p>
                   13051: 
                   13052:         <dl>
1.30      wiz      13053:           <dt><span class="sect1"><a href="#targets">D.1.
1.2       hubertf  13054:           Targets</a></span></dt>
                   13055: 
1.30      wiz      13056:           <dt><span class="sect1"><a href="#procedure">D.2.
1.2       hubertf  13057:           Procedure</a></span></dt>
                   13058:         </dl>
                   13059:       </div>
                   13060: 
                   13061:       <p>This section contains information on editing the pkgsrc
                   13062:       guide itself.</p>
                   13063: 
                   13064:       <div class="sect1" lang="en" xml:lang="en">
                   13065:         <div class="titlepage">
                   13066:           <div>
                   13067:             <div>
                   13068:               <h2 class="title" style="clear: both"><a name=
1.30      wiz      13069:               "targets" id="targets"></a>D.1.&nbsp;Targets</h2>
1.2       hubertf  13070:             </div>
                   13071:           </div>
                   13072:         </div>
                   13073: 
1.14      xtraeme  13074:         <p>The pkgsrc guide's source code is stored in <code class=
                   13075:         "filename">pkgsrc/doc/guide/files</code>, and several files
1.2       hubertf  13076:         are created from it:</p>
                   13077: 
                   13078:         <div class="itemizedlist">
                   13079:           <ul type="disc">
                   13080:             <li>
1.14      xtraeme  13081:               <p><code class=
1.23      wiz      13082:               "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2       hubertf  13083:             </li>
                   13084: 
                   13085:             <li>
1.14      xtraeme  13086:               <p><code class=
                   13087:               "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2       hubertf  13088:             </li>
                   13089: 
                   13090:             <li>
1.14      xtraeme  13091:               <p><code class=
                   13092:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2       hubertf  13093:               the documentation on the NetBSD website will be built
                   13094:               from pkgsrc and kept up to date on the web server
                   13095:               itself. This means you <span class=
                   13096:               "emphasis"><em>must</em></span> make sure that your
                   13097:               changes haven't broken the build!</p>
                   13098:             </li>
1.6       hubertf  13099: 
                   13100:             <li>
1.14      xtraeme  13101:               <p><code class=
                   13102:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6       hubertf  13103:               PDF version of the pkgsrc guide.</p>
                   13104:             </li>
                   13105: 
                   13106:             <li>
1.14      xtraeme  13107:               <p><code class=
                   13108:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6       hubertf  13109:               PostScript version of the pkgsrc guide.</p>
                   13110:             </li>
1.2       hubertf  13111:           </ul>
                   13112:         </div>
                   13113:       </div>
                   13114: 
                   13115:       <div class="sect1" lang="en" xml:lang="en">
                   13116:         <div class="titlepage">
                   13117:           <div>
                   13118:             <div>
                   13119:               <h2 class="title" style="clear: both"><a name=
1.30      wiz      13120:               "procedure" id=
                   13121:               "procedure"></a>D.2.&nbsp;Procedure</h2>
1.2       hubertf  13122:             </div>
                   13123:           </div>
                   13124:         </div>
                   13125: 
                   13126:         <p>The procedure to edit the pkgsrc guide is:</p>
                   13127: 
                   13128:         <div class="itemizedlist">
                   13129:           <ul type="disc">
                   13130:             <li>
1.6       hubertf  13131:               <p>Make sure you have the packages needed to
                   13132:               re-generate the pkgsrc guide (and other XML-based
                   13133:               NetBSD documentation) installed. These are
1.11      ben      13134:               &#8220;<span class="quote">netbsd-doc</span>&#8221;
1.6       hubertf  13135:               for creating the ASCII- and HTML-version, and
                   13136:               &#8220;<span class=
1.11      ben      13137:               "quote">netbsd-doc-print</span>&#8221;for the
1.6       hubertf  13138:               PostScript- and PDF version. You will need both
                   13139:               packages installed, to make sure documentation is
                   13140:               consistent across all formats. The packages can be
1.14      xtraeme  13141:               found in <code class=
                   13142:               "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
                   13143:               <code class=
                   13144:               "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6       hubertf  13145:             </li>
                   13146: 
                   13147:             <li>
1.14      xtraeme  13148:               <p>Edit the XML file(s) in <code class=
                   13149:               "filename">pkgsrc/doc/guide/files</code>.</p>
1.2       hubertf  13150:             </li>
                   13151: 
                   13152:             <li>
1.14      xtraeme  13153:               <p>Run <span><strong class="command">make extract
                   13154:               &amp;&amp; make do-lint</strong></span> in
                   13155:               <code class="filename">pkgsrc/doc/guide</code> to
                   13156:               check the XML syntax, and fix it if needed.</p>
1.4       hubertf  13157:             </li>
                   13158: 
                   13159:             <li>
1.14      xtraeme  13160:               <p>Run <span><strong class=
                   13161:               "command">make</strong></span> in <code class=
                   13162:               "filename">pkgsrc/doc/guide</code> to build the HTML
                   13163:               and ASCII version.</p>
1.2       hubertf  13164:             </li>
                   13165: 
                   13166:             <li>
1.14      xtraeme  13167:               <p>If all is well, run <span><strong class=
                   13168:               "command">make install-doc</strong></span> to put the
                   13169:               generated files into <code class=
                   13170:               "filename">pkgsrc/doc</code>.</p>
1.2       hubertf  13171:             </li>
                   13172: 
                   13173:             <li>
1.14      xtraeme  13174:               <p><span><strong class="command">cvs commit
                   13175:               pkgsrc/doc/guide/files</strong></span></p>
1.2       hubertf  13176:             </li>
                   13177: 
                   13178:             <li>
1.14      xtraeme  13179:               <p><span><strong class="command">cvs commit -m
                   13180:               re-generate
                   13181:               pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2       hubertf  13182:             </li>
1.4       hubertf  13183: 
                   13184:             <li>
                   13185:               <p>Until the webserver on www.NetBSD.org is really
                   13186:               updated automatically to pick up changes to the
1.14      xtraeme  13187:               pkgsrc guide automatically, also run
1.18      xtraeme  13188:               <span><strong class="command">make install-htdocs
1.14      xtraeme  13189:               HTDOCSDIR=../../../htdocs</strong></span> (or
                   13190:               similar, adjust <code class=
                   13191:               "varname">HTDOCSDIR</code>!).</p>
1.4       hubertf  13192:             </li>
                   13193: 
                   13194:             <li>
1.14      xtraeme  13195:               <p><span><strong class="command">cvs commit
                   13196:               htdocs/Documentation/pkgsrc</strong></span></p>
1.4       hubertf  13197:             </li>
1.2       hubertf  13198:           </ul>
                   13199:         </div>
                   13200:       </div>
                   13201:     </div>
1.1       grant    13202:   </div>
                   13203: </body>
                   13204: </html>

CVSweb <webmaster@jp.NetBSD.org>