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

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.30      wiz        69:           <p xmlns="" class="pubdate">$NetBSD: pkgsrc.xml,v 1.7
                     70:           2005/05/24 12:39:00 wiz 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
        !          7581:             14.1.4, &#8220;Handling dependencies&#8221;</a> and
1.14      xtraeme  7582:             <a href="#buildlink" title=
1.25      rillig   7583:             "Chapter&nbsp;10.&nbsp;Buildlink methodology">Chapter
                   7584:             10, <i>Buildlink methodology</i></a> for more
                   7585:             information about dependencies on other packages,
                   7586:             including the <code class=
                   7587:             "varname">BUILDLINK_RECOMMENDED</code> and <code class=
                   7588:             "varname">RECOMMENDED</code> definitions.</p>
1.1       grant    7589:           </div>
                   7590:         </div>
                   7591: 
                   7592:         <div class="sect1" lang="en" xml:lang="en">
                   7593:           <div class="titlepage">
                   7594:             <div>
                   7595:               <div>
                   7596:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      7597:                 "writing-builtin.mk" id=
                   7598:                 "writing-builtin.mk"></a>10.3.&nbsp;Writing
1.14      xtraeme  7599:                 <code class="filename">builtin.mk</code> files</h2>
1.1       grant    7600:               </div>
                   7601:             </div>
                   7602:           </div>
                   7603: 
                   7604:           <p>Some packages in pkgsrc install headers and libraries
                   7605:           that coincide with headers and libraries present in the
1.14      xtraeme  7606:           base system. Aside from a <code class=
                   7607:           "filename">buildlink3.mk</code> file, these packages
                   7608:           should also include a <code class=
                   7609:           "filename">builtin.mk</code> file that includes the
                   7610:           necessary checks to decide whether using the built-in
                   7611:           software or the pkgsrc software is appropriate.</p>
1.1       grant    7612: 
                   7613:           <p>The only requirements of a builtin.mk file for
1.14      xtraeme  7614:           <em class="replaceable"><code>pkg</code></em> are:</p>
1.1       grant    7615: 
                   7616:           <div class="orderedlist">
                   7617:             <ol type="1">
                   7618:               <li>
1.14      xtraeme  7619:                 <p>It should set <code class=
                   7620:                 "varname">USE_BUILTIN.<em class=
                   7621:                 "replaceable"><code>pkg</code></em></code> to
                   7622:                 either &#8220;<span class="quote">yes</span>&#8221;
                   7623:                 or &#8220;<span class="quote">no</span>&#8221;
                   7624:                 after it is included.</p>
1.1       grant    7625:               </li>
                   7626: 
                   7627:               <li>
                   7628:                 <p>It should <span class=
                   7629:                 "emphasis"><em>not</em></span> override any
1.14      xtraeme  7630:                 <code class="varname">USE_BUILTIN.<em class=
                   7631:                 "replaceable"><code>pkg</code></em></code> which is
                   7632:                 already set before the <code class=
                   7633:                 "filename">builtin.mk</code> file is included.</p>
1.1       grant    7634:               </li>
                   7635: 
                   7636:               <li>
                   7637:                 <p>It should be written to allow multiple
                   7638:                 inclusion. This is <span class=
                   7639:                 "emphasis"><em>very</em></span> important and takes
1.14      xtraeme  7640:                 careful attention to <code class=
                   7641:                 "filename">Makefile</code> coding.</p>
1.1       grant    7642:               </li>
                   7643:             </ol>
                   7644:           </div>
                   7645: 
                   7646:           <div class="sect2" lang="en" xml:lang="en">
                   7647:             <div class="titlepage">
                   7648:               <div>
                   7649:                 <div>
1.30      wiz      7650:                   <h3 class="title"><a name="anatomy-of-builtin.mk"
                   7651:                   id=
                   7652:                   "anatomy-of-builtin.mk"></a>10.3.1.&nbsp;Anatomy
                   7653:                   of a <code class="filename">builtin.mk</code>
1.14      xtraeme  7654:                   file</h3>
1.1       grant    7655:                 </div>
                   7656:               </div>
                   7657:             </div>
                   7658: 
                   7659:             <p>The following is the recommended template for
                   7660:             builtin.mk files:</p>
                   7661:             <pre class="programlisting">
                   7662: .if !defined(IS_BUILTIN.foo)
                   7663: #
                   7664: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
                   7665: # genuinely exists in the system or not.
                   7666: #
                   7667: IS_BUILTIN.foo?=        no
                   7668: 
                   7669: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
                   7670: # version can be determined.
                   7671: #
                   7672: .  if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
                   7673: BUILTIN_PKG.foo?=       foo-1.0
                   7674: .  endif
                   7675: .endif  # IS_BUILTIN.foo
                   7676: 
                   7677: .if !defined(USE_BUILTIN.foo)
                   7678: USE_BUILTIN.foo?=       ${IS_BUILTIN.foo}
                   7679: .  if defined(BUILTIN_PKG.foo)
                   7680: .    for _depend_ in ${BUILDLINK_DEPENDS.foo}
                   7681: .      if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
                   7682: USE_BUILTIN.foo!=                                                       \
                   7683:       if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then     \
                   7684:               ${ECHO} "yes";                                            \
                   7685:       else                                                              \
                   7686:               ${ECHO} "no";                                             \
                   7687:       fi
                   7688: .      endif
                   7689: .    endfor
                   7690: .  endif
                   7691: .endif  # USE_BUILTIN.foo
                   7692: 
                   7693: CHECK_BUILTIN.foo?=     no
                   7694: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
                   7695: #
                   7696: # Here we place code that depends on whether USE_BUILTIN.foo is set to
                   7697: # "yes" or "no".
                   7698: #
                   7699: .endif  # CHECK_BUILTIN.foo
                   7700:       
                   7701: </pre>
                   7702: 
1.14      xtraeme  7703:             <p>The first section sets <code class=
                   7704:             "varname">IS_BUILTIN.<em class=
                   7705:             "replaceable"><code>pkg</code></em></code> depending on
                   7706:             if <em class="replaceable"><code>pkg</code></em> really
                   7707:             exists in the base system. This should not be a base
                   7708:             system software with similar functionality to
                   7709:             <em class="replaceable"><code>pkg</code></em>; it
                   7710:             should only be &#8220;<span class=
                   7711:             "quote">yes</span>&#8221; if the actual package is
                   7712:             included as part of the base system. This variable is
                   7713:             only used internally within the <code class=
                   7714:             "filename">builtin.mk</code> file.</p>
                   7715: 
                   7716:             <p>The second section sets <code class=
                   7717:             "varname">BUILTIN_PKG.<em class=
                   7718:             "replaceable"><code>pkg</code></em></code> to the
                   7719:             version of <em class=
                   7720:             "replaceable"><code>pkg</code></em> in the base system
                   7721:             if it exists (if <code class=
                   7722:             "varname">IS_BUILTIN.<em class=
                   7723:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    7724:             &#8220;<span class="quote">yes</span>&#8221;). This
1.14      xtraeme  7725:             variable is only used internally within the
                   7726:             <code class="filename">builtin.mk</code> file.</p>
1.1       grant    7727: 
1.14      xtraeme  7728:             <p>The third section sets <code class=
                   7729:             "varname">USE_BUILTIN.<em class=
                   7730:             "replaceable"><code>pkg</code></em></code> and is
                   7731:             <span class="emphasis"><em>required</em></span> in all
                   7732:             <code class="filename">builtin.mk</code> files. The
                   7733:             code in this section must make the determination
                   7734:             whether the built-in software is adequate to satisfy
                   7735:             the dependencies listed in <code class=
                   7736:             "varname">BUILDLINK_DEPENDS.<em class=
                   7737:             "replaceable"><code>pkg</code></em></code>. This is
                   7738:             typically done by comparing <code class=
                   7739:             "varname">BUILTIN_PKG.<em class=
                   7740:             "replaceable"><code>pkg</code></em></code> against each
                   7741:             of the dependencies in <code class=
                   7742:             "varname">BUILDLINK_DEPENDS.<em class=
                   7743:             "replaceable"><code>pkg</code></em></code>.
                   7744:             <code class="varname">USE_BUILTIN.<em class=
                   7745:             "replaceable"><code>pkg</code></em></code> <span class=
1.1       grant    7746:             "emphasis"><em>must</em></span> be set to the correct
1.14      xtraeme  7747:             value by the end of the <code class=
                   7748:             "filename">builtin.mk</code> file. Note that
                   7749:             <code class="varname">USE_BUILTIN.<em class=
                   7750:             "replaceable"><code>pkg</code></em></code> may be
1.1       grant    7751:             &#8220;<span class="quote">yes</span>&#8221; even if
1.14      xtraeme  7752:             <code class="varname">IS_BUILTIN.<em class=
                   7753:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    7754:             &#8220;<span class="quote">no</span>&#8221; because we
                   7755:             may make the determination that the built-in version of
                   7756:             the software is similar enough to be used as a
                   7757:             replacement.</p>
                   7758: 
1.14      xtraeme  7759:             <p>The last section is guarded by <code class=
                   7760:             "varname">CHECK_BUILTIN.<em class=
                   7761:             "replaceable"><code>pkg</code></em></code>, and
                   7762:             includes code that uses the value of <code class=
                   7763:             "varname">USE_BUILTIN.<em class=
                   7764:             "replaceable"><code>pkg</code></em></code> set in the
                   7765:             previous section. This typically includes, e.g., adding
1.1       grant    7766:             additional dependency restrictions and listing
1.14      xtraeme  7767:             additional files to symlink into <code class=
                   7768:             "filename">${BUILDLINK_DIR}</code> (via <code class=
                   7769:             "varname">BUILDLINK_FILES.<em class=
                   7770:             "replaceable"><code>pkg</code></em></code>).</p>
1.1       grant    7771:           </div>
                   7772: 
                   7773:           <div class="sect2" lang="en" xml:lang="en">
                   7774:             <div class="titlepage">
                   7775:               <div>
                   7776:                 <div>
1.30      wiz      7777:                   <h3 class="title"><a name=
                   7778:                   "native-or-pkgsrc-preference" id=
                   7779:                   "native-or-pkgsrc-preference"></a>10.3.2.&nbsp;Global
                   7780:                   preferences for native or pkgsrc software</h3>
1.1       grant    7781:                 </div>
                   7782:               </div>
                   7783:             </div>
                   7784: 
                   7785:             <p>When building packages, it's possible to choose
                   7786:             whether to set a global preference for using either the
                   7787:             built-in (native) version or the pkgsrc version of
                   7788:             software to satisfy a dependency. This is controlled by
1.14      xtraeme  7789:             setting <code class="varname">PREFER_PKGSRC</code> and
                   7790:             <code class="varname">PREFER_NATIVE</code>. These
                   7791:             variables take values of either &#8220;<span class=
1.1       grant    7792:             "quote">yes</span>&#8221;, &#8220;<span class=
                   7793:             "quote">no</span>&#8221;, or a list of packages.
1.14      xtraeme  7794:             <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
                   7795:             to use the pkgsrc versions of software, while
                   7796:             <code class="varname">PREFER_NATIVE</code> tells pkgsrc
                   7797:             to use the built-in versions. Preferences are
                   7798:             determined by the most specific instance of the package
                   7799:             in either <code class="varname">PREFER_PKGSRC</code> or
                   7800:             <code class="varname">PREFER_NATIVE</code>. If a
                   7801:             package is specified in neither or in both variables,
                   7802:             then <code class="varname">PREFER_PKGSRC</code> has
                   7803:             precedence over <code class=
                   7804:             "varname">PREFER_NATIVE</code>. For example, to require
                   7805:             using pkgsrc versions of software for all but the most
                   7806:             basic bits on a NetBSD system, you can set:</p>
1.1       grant    7807:             <pre class="programlisting">
                   7808:         PREFER_PKGSRC=  yes
                   7809:         PREFER_NATIVE=  getopt skey tcp_wrappers
                   7810:       
                   7811: </pre>
                   7812: 
                   7813:             <p>A package <span class=
1.14      xtraeme  7814:             "emphasis"><em>must</em></span> have a <code class=
                   7815:             "filename">builtin.mk</code> file to be listed in
                   7816:             <code class="varname">PREFER_NATIVE</code>, otherwise
                   7817:             it is simply ignored in that list.</p>
1.1       grant    7818:           </div>
                   7819:         </div>
                   7820:       </div>
                   7821: 
                   7822:       <div class="chapter" lang="en" xml:lang="en">
                   7823:         <div class="titlepage">
                   7824:           <div>
                   7825:             <div>
1.35    ! jmmv     7826:               <h2 class="title"><a name="pkginstall" id=
        !          7827:               "pkginstall"></a>Chapter&nbsp;11.&nbsp;The pkginstall
        !          7828:               framework</h2>
1.1       grant    7829:             </div>
                   7830:           </div>
                   7831:         </div>
                   7832: 
                   7833:         <div class="toc">
                   7834:           <p><b>Table of Contents</b></p>
                   7835: 
                   7836:           <dl>
1.30      wiz      7837:             <dt><span class="sect1"><a href=
1.35    ! jmmv     7838:             "#files-and-dirs-outside-prefix">11.1. Files and
        !          7839:             directories outside the installation
        !          7840:             prefix</a></span></dt>
        !          7841: 
        !          7842:             <dd>
        !          7843:               <dl>
        !          7844:                 <dt><span class="sect2"><a href=
        !          7845:                 "#dirs-outside-prefix">11.1.1. Directory
        !          7846:                 manipulation</a></span></dt>
        !          7847: 
        !          7848:                 <dt><span class="sect2"><a href=
        !          7849:                 "#files-outside-prefix">11.1.2. File
        !          7850:                 manipulation</a></span></dt>
        !          7851:               </dl>
        !          7852:             </dd>
        !          7853: 
        !          7854:             <dt><span class="sect1"><a href="#conf-files">11.2.
        !          7855:             Configuration files</a></span></dt>
        !          7856: 
        !          7857:             <dd>
        !          7858:               <dl>
        !          7859:                 <dt><span class="sect2"><a href=
        !          7860:                 "#conf-files-sysconfdir">11.2.1. How <code class=
        !          7861:                 "varname">PKG_SYSCONFDIR</code> is
        !          7862:                 set</a></span></dt>
        !          7863: 
        !          7864:                 <dt><span class="sect2"><a href=
        !          7865:                 "#conf-files-configure">11.2.2. Telling the
        !          7866:                 software were configuration files
        !          7867:                 are</a></span></dt>
        !          7868: 
        !          7869:                 <dt><span class="sect2"><a href=
        !          7870:                 "#conf-files-patching">11.2.3. Patching
        !          7871:                 installations</a></span></dt>
        !          7872: 
        !          7873:                 <dt><span class="sect2"><a href=
        !          7874:                 "#conf-files-disable">11.2.4. Disabling handling of
        !          7875:                 configuration files</a></span></dt>
        !          7876:               </dl>
        !          7877:             </dd>
        !          7878: 
        !          7879:             <dt><span class="sect1"><a href="#rcd-scripts">11.3.
        !          7880:             System startup scripts</a></span></dt>
        !          7881: 
        !          7882:             <dd>
        !          7883:               <dl>
        !          7884:                 <dt><span class="sect2"><a href=
        !          7885:                 "#rcd-scripts-disable">11.3.1. Disabling handling
        !          7886:                 of system startup scripts</a></span></dt>
        !          7887:               </dl>
        !          7888:             </dd>
1.1       grant    7889: 
1.30      wiz      7890:             <dt><span class="sect1"><a href=
1.35    ! jmmv     7891:             "#users-and-groups">11.4. System users and
        !          7892:             groups</a></span></dt>
        !          7893: 
        !          7894:             <dt><span class="sect1"><a href="#shells">11.5. System
        !          7895:             shells</a></span></dt>
        !          7896: 
        !          7897:             <dd>
        !          7898:               <dl>
        !          7899:                 <dt><span class="sect2"><a href=
        !          7900:                 "#shells-disable">11.5.1. Disabling handling of
        !          7901:                 configuration files</a></span></dt>
        !          7902:               </dl>
        !          7903:             </dd>
1.1       grant    7904:           </dl>
                   7905:         </div>
                   7906: 
1.35    ! jmmv     7907:         <p>This chapter describes the framework known as
        !          7908:         <code class="literal">pkginstall</code>, whose key features
        !          7909:         are:</p>
        !          7910: 
        !          7911:         <div class="itemizedlist">
        !          7912:           <ul type="disc">
        !          7913:             <li>
        !          7914:               <p>Generic installation and manipulation of
        !          7915:               directories and files outside the pkgsrc-handled
        !          7916:               tree, <code class="varname">LOCALBASE</code>.</p>
        !          7917:             </li>
        !          7918: 
        !          7919:             <li>
        !          7920:               <p>Automatic handling of configuration files during
        !          7921:               installation, provided that packages are correctly
        !          7922:               designed.</p>
        !          7923:             </li>
        !          7924: 
        !          7925:             <li>
        !          7926:               <p>Generation and installation of system startup
        !          7927:               scripts.</p>
        !          7928:             </li>
        !          7929: 
        !          7930:             <li>
        !          7931:               <p>Registration of system users and groups.</p>
        !          7932:             </li>
        !          7933: 
        !          7934:             <li>
        !          7935:               <p>Registration of system shells.</p>
        !          7936:             </li>
        !          7937:           </ul>
        !          7938:         </div>
        !          7939: 
        !          7940:         <p>The following sections inspect each of the above points
        !          7941:         in detail. Note that, in order to use any of the described
        !          7942:         functionalities, you must add the following to your
        !          7943:         package's <code class="filename">Makefile</code>:</p>
        !          7944:         <pre class="programlisting">
        !          7945: USE_PKGINSTALL=YES
        !          7946: </pre>
        !          7947: 
        !          7948:         <p>You may be thinking that many of the things described
        !          7949:         here could be easily done with simple code in the package's
        !          7950:         post-installation target (<code class=
        !          7951:         "literal">post-install</code>). <span class=
        !          7952:         "emphasis"><em>This is incorrect</em></span>, as the code
        !          7953:         in them is only executed when building from source.
        !          7954:         Machines using binary packages could not benefit from it at
        !          7955:         all (as the code itself could be unavailable). Therefore,
        !          7956:         the only way to achieve any of the items described above is
        !          7957:         by means of the installation scripts, which are
        !          7958:         automatically generated by pkginstall.</p>
1.1       grant    7959: 
                   7960:         <div class="sect1" lang="en" xml:lang="en">
                   7961:           <div class="titlepage">
                   7962:             <div>
                   7963:               <div>
                   7964:                 <h2 class="title" style="clear: both"><a name=
1.35    ! jmmv     7965:                 "files-and-dirs-outside-prefix" id=
        !          7966:                 "files-and-dirs-outside-prefix"></a>11.1. Files and
        !          7967:                 directories outside the installation prefix</h2>
1.1       grant    7968:               </div>
                   7969:             </div>
                   7970:           </div>
                   7971: 
1.35    ! jmmv     7972:           <p>As you already know, the <code class=
        !          7973:           "filename">PLIST</code> file holds a list of files and
        !          7974:           directories that belong to a package. The names used in
        !          7975:           it are relative to the installation prefix (<code class=
        !          7976:           "filename">${PREFIX}</code>), which means that it cannot
        !          7977:           register files outside this directory (absolute path
        !          7978:           names are not allowed). Despite this restriction, some
        !          7979:           packages need to install files outside this location;
        !          7980:           e.g., under <code class="filename">${VARBASE}</code> or
        !          7981:           <code class="filename">${PKG_SYSCONFDIR}</code>.</p>
        !          7982: 
        !          7983:           <p>The only way to achieve this is to create such files
        !          7984:           during installation time by using the installation
        !          7985:           scripts. These scripts can run arbitrary commands, so
        !          7986:           they have the potential to create and manage files
        !          7987:           anywhere in the filesystem. Here is where pkginstall
        !          7988:           comes into play: it provides generic scripts to abstract
        !          7989:           the manipulation of such files and directories based on
        !          7990:           variables set in the package's <code class=
        !          7991:           "filename">Makefile</code>. The rest of this section
        !          7992:           describes which these variables are.</p>
1.1       grant    7993: 
1.35    ! jmmv     7994:           <div class="sect2" lang="en" xml:lang="en">
        !          7995:             <div class="titlepage">
1.1       grant    7996:               <div>
1.35    ! jmmv     7997:                 <div>
        !          7998:                   <h3 class="title"><a name="dirs-outside-prefix"
        !          7999:                   id="dirs-outside-prefix"></a>11.1.1. Directory
        !          8000:                   manipulation</h3>
        !          8001:                 </div>
1.1       grant    8002:               </div>
                   8003:             </div>
                   8004: 
1.35    ! jmmv     8005:             <p>The following variables can be set to request the
        !          8006:             creation of directories anywhere in the filesystem:</p>
1.27      rillig   8007: 
1.35    ! jmmv     8008:             <div class="itemizedlist">
        !          8009:               <ul type="disc">
        !          8010:                 <li>
        !          8011:                   <p><code class="varname">MAKE_DIRS</code> and
        !          8012:                   <code class="varname">OWN_DIRS</code> contain a
        !          8013:                   list of directories that should be created and
        !          8014:                   should attempt to be destroyed by the
        !          8015:                   installation scripts. The difference between the
        !          8016:                   two is that the latter prompts the administrator
        !          8017:                   to remove any directories that may be left after
        !          8018:                   deinstallation (because they were not empty),
        !          8019:                   while the former does not.</p>
        !          8020:                 </li>
1.1       grant    8021: 
1.35    ! jmmv     8022:                 <li>
        !          8023:                   <p><code class="varname">MAKE_DIRS_PERMS</code>
        !          8024:                   and <code class="varname">OWN_DIRS_PERMS</code>
        !          8025:                   contain a list of tuples describing which
        !          8026:                   directories should be created and should attempt
        !          8027:                   to be destroyed by the installation scripts. Each
        !          8028:                   tuple holds the following values, separated by
        !          8029:                   spaces: the directory name, its owner, its group
        !          8030:                   and its numerical mode. For example:</p>
        !          8031:                   <pre class="programlisting">
        !          8032: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
        !          8033: </pre>
1.1       grant    8034: 
1.35    ! jmmv     8035:                   <p>The difference between the two is exactly the
        !          8036:                   same as their non-<code class=
        !          8037:                   "varname">PERMS</code> counterparts.</p>
        !          8038:                 </li>
        !          8039:               </ul>
        !          8040:             </div>
        !          8041:           </div>
        !          8042: 
        !          8043:           <div class="sect2" lang="en" xml:lang="en">
        !          8044:             <div class="titlepage">
        !          8045:               <div>
        !          8046:                 <div>
        !          8047:                   <h3 class="title"><a name="files-outside-prefix"
        !          8048:                   id="files-outside-prefix"></a>11.1.2. File
        !          8049:                   manipulation</h3>
        !          8050:                 </div>
        !          8051:               </div>
        !          8052:             </div>
        !          8053: 
        !          8054:             <p>Creating non-empty files outside the installation
        !          8055:             prefix is tricky because the <code class=
        !          8056:             "filename">PLIST</code> forces all files to be inside
        !          8057:             it. To overcome this problem, the only solution is to
        !          8058:             extract the file in the known place (i.e., inside the
        !          8059:             installation prefix) and copy it to the appropriate
        !          8060:             location during installation (done by the installation
        !          8061:             scripts generated by pkginstall). We will call the
        !          8062:             former the <span class="emphasis"><em>master
        !          8063:             file</em></span> in the following paragraphs, which
        !          8064:             describe the variables that can be used to
        !          8065:             automatically and consistently handle files outside the
        !          8066:             installation prefix:</p>
        !          8067: 
        !          8068:             <div class="itemizedlist">
        !          8069:               <ul type="disc">
        !          8070:                 <li>
        !          8071:                   <p><code class="varname">CONF_FILES</code> and
        !          8072:                   <code class="varname">SUPPORT_FILES</code> are
        !          8073:                   pairs of master and target files. During
        !          8074:                   installation time, the master file is copied to
        !          8075:                   the target one if and only if the latter does not
        !          8076:                   exist. Upon deinstallation, the target file is
        !          8077:                   removed provided that it was not modified by the
        !          8078:                   installation.</p>
        !          8079: 
        !          8080:                   <p>The difference between the two is that the
        !          8081:                   latter prompts the administrator to remove any
        !          8082:                   files that may be left after deinstallation
        !          8083:                   (because they were not empty), while the former
        !          8084:                   does not.</p>
        !          8085:                 </li>
        !          8086: 
        !          8087:                 <li>
        !          8088:                   <p><code class="varname">CONF_FILES_PERMS</code>
        !          8089:                   and <code class=
        !          8090:                   "varname">SUPPORT_FILES_PERMS</code> contain
        !          8091:                   tuples describing master files as well as their
        !          8092:                   target locations. For each of them, it also
        !          8093:                   specifies their owner, their group and their
        !          8094:                   numeric permissions, in this order. For
        !          8095:                   example:</p>
        !          8096:                   <pre class="programlisting">
        !          8097: SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
        !          8098: </pre>
        !          8099: 
        !          8100:                   <p>The difference between the two is exactly the
        !          8101:                   same as their non-<code class=
        !          8102:                   "varname">PERMS</code> counterparts.</p>
        !          8103:                 </li>
        !          8104:               </ul>
        !          8105:             </div>
        !          8106:           </div>
        !          8107:         </div>
        !          8108: 
        !          8109:         <div class="sect1" lang="en" xml:lang="en">
        !          8110:           <div class="titlepage">
        !          8111:             <div>
        !          8112:               <div>
        !          8113:                 <h2 class="title" style="clear: both"><a name=
        !          8114:                 "conf-files" id="conf-files"></a>11.2.
        !          8115:                 Configuration files</h2>
        !          8116:               </div>
        !          8117:             </div>
        !          8118:           </div>
        !          8119: 
        !          8120:           <p>Configuration files are special in the sense that they
        !          8121:           are installed in their own specific directory,
        !          8122:           <code class="varname">PKG_SYSCONFDIR</code>, and need
        !          8123:           special treatment during installation (most of which is
        !          8124:           automated by pkginstall). The main concept you must bear
        !          8125:           in mind is that files marked as a configuration are
        !          8126:           automatically copied to the right place (somewhere inside
        !          8127:           <code class="varname">PKG_SYSCONFDIR</code>) during
        !          8128:           installation <span class="emphasis"><em>if and only
        !          8129:           if</em></span> they didn't exist before. Similarly, they
        !          8130:           will not be removed if they have local modifications.
        !          8131:           This ensures that administrators never loose any custom
        !          8132:           changes they may have made.</p>
        !          8133: 
        !          8134:           <div class="sect2" lang="en" xml:lang="en">
        !          8135:             <div class="titlepage">
        !          8136:               <div>
        !          8137:                 <div>
        !          8138:                   <h3 class="title"><a name="conf-files-sysconfdir"
        !          8139:                   id="conf-files-sysconfdir"></a>11.2.1. How
        !          8140:                   <code class="varname">PKG_SYSCONFDIR</code> is
        !          8141:                   set</h3>
        !          8142:                 </div>
        !          8143:               </div>
        !          8144:             </div>
        !          8145: 
        !          8146:             <p>As said before, the <code class=
        !          8147:             "varname">PKG_SYSCONFDIR</code> variable specifies
        !          8148:             where configuration files shall be installed. Its
        !          8149:             contents are set based upon the following
        !          8150:             variables:</p>
        !          8151: 
        !          8152:             <div class="itemizedlist">
        !          8153:               <ul type="disc">
        !          8154:                 <li>
        !          8155:                   <p><code class="varname">PKG_SYSCONFBASE</code>:
        !          8156:                   The configuration's root directory. Defaults to
        !          8157:                   <code class="filename">${PREFIX}/etc</code>
        !          8158:                   although may be overridden by the user to point
        !          8159:                   to his preferred location (e.g., <code class=
        !          8160:                   "filename">/etc</code>, <code class=
        !          8161:                   "filename">/etc/pkg</code>, etc.). Packages must
        !          8162:                   not use it directly.</p>
        !          8163:                 </li>
        !          8164: 
        !          8165:                 <li>
        !          8166:                   <p><code class=
        !          8167:                   "varname">PKG_SYSCONFSUBDIR</code>: A
        !          8168:                   subdirectory of <code class=
        !          8169:                   "varname">PKG_SYSCONFBASE</code> under which the
        !          8170:                   configuration files for the package being built
        !          8171:                   shall be installed. The definition of this
        !          8172:                   variable only makes sense in the package's
        !          8173:                   <code class="filename">Makefile</code> (i.e., it
        !          8174:                   is not user customizable).</p>
        !          8175: 
        !          8176:                   <p>As an example, consider the Apache package,
        !          8177:                   <a xmlns=
        !          8178:                   "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8179:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
        !          8180:                   class="pkgname">www/apache2</a>, which places its
        !          8181:                   configuration files under the <code class=
        !          8182:                   "filename">httpd/</code> subdirectory of
        !          8183:                   <code class="varname">PKG_SYSCONFBASE</code>.
        !          8184:                   This should be set in the package Makefile.</p>
        !          8185:                 </li>
        !          8186: 
        !          8187:                 <li>
        !          8188:                   <p><code class="varname">PKG_SYSCONFVAR</code>:
        !          8189:                   Specifies the name of the variable that holds
        !          8190:                   this package's configuration directory (if
        !          8191:                   different from <code class=
        !          8192:                   "varname">PKG_SYSCONFBASE</code>). It defaults to
        !          8193:                   <code class="varname">PKGBASE</code>'s value, and
        !          8194:                   is always prefixed with <code class=
        !          8195:                   "literal">PKG_SYSCONFDIR</code>.</p>
        !          8196:                 </li>
        !          8197: 
        !          8198:                 <li>
        !          8199:                   <p><code class=
        !          8200:                   "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
        !          8201:                   Holds the directory where the configuration files
        !          8202:                   for the package identified by <code class=
        !          8203:                   "varname">PKG_SYSCONFVAR</code>'s shall be
        !          8204:                   placed.</p>
        !          8205:                 </li>
        !          8206:               </ul>
        !          8207:             </div>
        !          8208: 
        !          8209:             <p>Based on the above variables, pkginstall determines
        !          8210:             the value of <code class=
        !          8211:             "varname">PKG_SYSCONFDIR</code>, which is the
        !          8212:             <span class="emphasis"><em>only</em></span> variable
        !          8213:             that can be used within a package to refer to its
        !          8214:             configuration directory. The algorithm used to set its
        !          8215:             value is basically the following:</p>
        !          8216: 
        !          8217:             <div class="orderedlist">
        !          8218:               <ol type="1">
        !          8219:                 <li>
        !          8220:                   <p>If <code class=
        !          8221:                   "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
        !          8222:                   is set, its value is used.</p>
        !          8223:                 </li>
        !          8224: 
        !          8225:                 <li>
        !          8226:                   <p>If the previous variable is not defined but
        !          8227:                   <code class="varname">PKG_SYSCONFSUBDIR</code> is
        !          8228:                   set in the package's <code class=
        !          8229:                   "filename">Makefile</code>, the resulting value
        !          8230:                   is <code class=
        !          8231:                   "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
        !          8232:                 </li>
        !          8233: 
        !          8234:                 <li>
        !          8235:                   <p>Otherwise, it is set to <code class=
        !          8236:                   "filename">${PKG_SYSCONFBASE}</code>.</p>
        !          8237:                 </li>
        !          8238:               </ol>
        !          8239:             </div>
        !          8240: 
        !          8241:             <p>It is worth mentioning that <code class=
        !          8242:             "filename">${PKG_SYSCONFDIR}</code> is automatically
        !          8243:             added to <code class="filename">OWN_DIRS</code>. See
        !          8244:             <a href="#dirs-outside-prefix" title=
        !          8245:             "11.1.1.&nbsp;Directory manipulation">Section 11.1.1,
        !          8246:             &#8220;Directory manipulation&#8221;</a> what this
        !          8247:             means.</p>
        !          8248:           </div>
        !          8249: 
        !          8250:           <div class="sect2" lang="en" xml:lang="en">
        !          8251:             <div class="titlepage">
        !          8252:               <div>
        !          8253:                 <div>
        !          8254:                   <h3 class="title"><a name="conf-files-configure"
        !          8255:                   id="conf-files-configure"></a>11.2.2. Telling the
        !          8256:                   software were configuration files are</h3>
        !          8257:                 </div>
        !          8258:               </div>
        !          8259:             </div>
        !          8260: 
        !          8261:             <p>Given that pkgsrc (and users!) expect configuration
        !          8262:             files to be in a known place, you need to teach each
        !          8263:             package where shall it install its files. In some cases
        !          8264:             you will have to patch the package Makefiles to achieve
        !          8265:             it. If you are lucky, though, it may be as easy as
        !          8266:             passing an extra flag to the configuration script; this
        !          8267:             is the case of GNU Autoconf generated files:</p>
        !          8268:             <pre class="programlisting">
        !          8269: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
        !          8270: </pre>
        !          8271: 
        !          8272:             <p>Note that this specifies where the package has to
        !          8273:             <span class="emphasis"><em>look for</em></span> its
        !          8274:             configuration files, not where they will be originally
        !          8275:             installed (although the difference is never explicit,
        !          8276:             unfortunately).</p>
        !          8277:           </div>
        !          8278: 
        !          8279:           <div class="sect2" lang="en" xml:lang="en">
        !          8280:             <div class="titlepage">
        !          8281:               <div>
        !          8282:                 <div>
        !          8283:                   <h3 class="title"><a name="conf-files-patching"
        !          8284:                   id="conf-files-patching"></a>11.2.3. Patching
        !          8285:                   installations</h3>
        !          8286:                 </div>
        !          8287:               </div>
        !          8288:             </div>
        !          8289: 
        !          8290:             <p>As said before, pkginstall automatically handles
        !          8291:             configuration files. This means that <span class=
        !          8292:             "strong"><strong>the packages themselves must not touch
        !          8293:             the contents of <code class=
        !          8294:             "filename">${PKG_SYSCONFDIR}</code>
        !          8295:             directly</strong></span>. Bad news is that the software
        !          8296:             they build will, out of the box, mess with the contents
        !          8297:             of that directory. So which is the correct procedure to
        !          8298:             fix this issue?</p>
        !          8299: 
        !          8300:             <p>You must teach the package (usually by manually
        !          8301:             patching it) to install any configuration files under
        !          8302:             the examples hierarchy, <code class=
        !          8303:             "filename">share/examples/${PKGBASE}/</code>. This way,
        !          8304:             the <code class="filename">PLIST</code> registers them
        !          8305:             and the administrator always has the original copies
        !          8306:             available.</p>
        !          8307: 
        !          8308:             <p>Once the required configuration files are in place
        !          8309:             (i.e., under the examples hierarchy), the pkginstall
        !          8310:             framework can use them as master copies during the
        !          8311:             package installation to update what is in <code class=
        !          8312:             "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
        !          8313:             the variables <code class="varname">CONF_FILES</code>
        !          8314:             and <code class="varname">CONF_FILES_PERMS</code> are
        !          8315:             used. Check out <a href="#files-outside-prefix" title=
        !          8316:             "11.1.2.&nbsp;File manipulation">Section 11.1.2,
        !          8317:             &#8220;File manipulation&#8221;</a> for information
        !          8318:             about their syntax and their purpose. Here is an
        !          8319:             example, taken from the <a xmlns=
        !          8320:             "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8321:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
        !          8322:             class="pkgname">mail/mutt</a> package:</p>
        !          8323:             <pre class="programlisting">
        !          8324: EGDIR=        ${PREFIX}/share/doc/mutt/samples
        !          8325: CONF_FILES=   ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
        !          8326: </pre>
        !          8327: 
        !          8328:             <p>Note that the <code class="varname">EGDIR</code>
        !          8329:             variable is specific to that package and has no meaning
        !          8330:             outside it.</p>
        !          8331:           </div>
        !          8332: 
        !          8333:           <div class="sect2" lang="en" xml:lang="en">
        !          8334:             <div class="titlepage">
        !          8335:               <div>
        !          8336:                 <div>
        !          8337:                   <h3 class="title"><a name="conf-files-disable"
        !          8338:                   id="conf-files-disable"></a>11.2.4. Disabling
        !          8339:                   handling of configuration files</h3>
        !          8340:                 </div>
        !          8341:               </div>
        !          8342:             </div>
        !          8343: 
        !          8344:             <p>The automatic copying of config files can be toggled
        !          8345:             by setting the environment variable <code class=
        !          8346:             "varname">PKG_CONFIG</code> prior to package
        !          8347:             installation.</p>
        !          8348:           </div>
        !          8349:         </div>
        !          8350: 
        !          8351:         <div class="sect1" lang="en" xml:lang="en">
        !          8352:           <div class="titlepage">
        !          8353:             <div>
        !          8354:               <div>
        !          8355:                 <h2 class="title" style="clear: both"><a name=
        !          8356:                 "rcd-scripts" id="rcd-scripts"></a>11.3. System
        !          8357:                 startup scripts</h2>
        !          8358:               </div>
        !          8359:             </div>
        !          8360:           </div>
        !          8361: 
        !          8362:           <p>System startup scripts are special files because they
        !          8363:           must be installed in a place known by the underlying OS,
        !          8364:           usually outside the installation prefix. Therefore, the
        !          8365:           same rules described in <a href=
        !          8366:           "#files-and-dirs-outside-prefix" title=
        !          8367:           "11.1.&nbsp;Files and directories outside the installation prefix">
        !          8368:           Section 11.1, &#8220;Files and directories outside the
        !          8369:           installation prefix&#8221;</a> apply, and the same
        !          8370:           solutions can be used. However, pkginstall provides a
        !          8371:           specific mechanism to handle these files, given that they
        !          8372:           are special.</p>
        !          8373: 
        !          8374:           <p>In order to provide system startup scripts, the
        !          8375:           package has to:</p>
        !          8376: 
        !          8377:           <div class="orderedlist">
        !          8378:             <ol type="1">
        !          8379:               <li>
        !          8380:                 <p>Store the script inside <code class=
        !          8381:                 "filename">${FILESDIR}</code>, with the
        !          8382:                 <code class="literal">.sh</code> suffix appended.
        !          8383:                 Considering the <a xmlns=
        !          8384:                 "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8385:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
        !          8386:                 class="pkgname">print/cups</a> package as an
        !          8387:                 example, it has the <code class=
        !          8388:                 "filename">cupsd.sh</code> in its files
        !          8389:                 directory.</p>
        !          8390:               </li>
        !          8391: 
        !          8392:               <li>
        !          8393:                 <p>Tell pkginstall to handle it, appending the name
        !          8394:                 of the script, without its extension, to the
        !          8395:                 <code class="varname">RCD_SCRIPTS</code> variable.
        !          8396:                 Continuing the previous example:</p>
        !          8397:                 <pre class="programlisting">
        !          8398: RCD_SCRIPTS+= cupsd
        !          8399: </pre>
        !          8400:               </li>
        !          8401:             </ol>
        !          8402:           </div>
        !          8403: 
        !          8404:           <p>Once this is done, pkginstall will do the following
        !          8405:           steps for each script in an automated fashion:</p>
        !          8406: 
        !          8407:           <div class="orderedlist">
        !          8408:             <ol type="1">
        !          8409:               <li>
        !          8410:                 <p>Process the file found in the files directory
        !          8411:                 applying all the substitutions described in the
        !          8412:                 <code class="filename">FILES_SUBST</code>
        !          8413:                 variable.</p>
        !          8414:               </li>
        !          8415: 
        !          8416:               <li>
        !          8417:                 <p>Copy the script from the files directory to the
        !          8418:                 examples hierarchy, <code class=
        !          8419:                 "filename">${PREFIX}/share/examples/rc.d/</code>.
        !          8420:                 Note that the master file must be explicitly
        !          8421:                 registered in the <code class=
        !          8422:                 "filename">PLIST</code>.</p>
        !          8423:               </li>
        !          8424: 
        !          8425:               <li>
        !          8426:                 <p>Add code to the installation scripts to copy the
        !          8427:                 startup script from the examples hierarchy into the
        !          8428:                 system-wide startup scripts directory.</p>
        !          8429:               </li>
        !          8430:             </ol>
        !          8431:           </div>
        !          8432: 
        !          8433:           <div class="sect2" lang="en" xml:lang="en">
        !          8434:             <div class="titlepage">
        !          8435:               <div>
        !          8436:                 <div>
        !          8437:                   <h3 class="title"><a name="rcd-scripts-disable"
        !          8438:                   id="rcd-scripts-disable"></a>11.3.1. Disabling
        !          8439:                   handling of system startup scripts</h3>
        !          8440:                 </div>
        !          8441:               </div>
        !          8442:             </div>
        !          8443: 
        !          8444:             <p>The automatic copying of config files can be toggled
        !          8445:             by setting the environment variable <code class=
        !          8446:             "varname">PKG_RCD_SCRIPTS</code> prior to package
        !          8447:             installation. Note that the scripts will be always
        !          8448:             copied inside the examples hierarchy, <code class=
        !          8449:             "filename">${PREFIX}/share/examples/rc.d/</code>, no
        !          8450:             matter what the value of this variable is.</p>
        !          8451:           </div>
        !          8452:         </div>
        !          8453: 
        !          8454:         <div class="sect1" lang="en" xml:lang="en">
        !          8455:           <div class="titlepage">
        !          8456:             <div>
        !          8457:               <div>
        !          8458:                 <h2 class="title" style="clear: both"><a name=
        !          8459:                 "users-and-groups" id="users-and-groups"></a>11.4.
        !          8460:                 System users and groups</h2>
        !          8461:               </div>
        !          8462:             </div>
        !          8463:           </div>
        !          8464: 
        !          8465:           <p>If a package needs to create special users and/or
        !          8466:           groups during installation, it can do so by using the
        !          8467:           pkginstall framework.</p>
        !          8468: 
        !          8469:           <p>Users can be created by adding entries to the
        !          8470:           <code class="varname">PKG_USERS</code> variable. Each
        !          8471:           entry has the following syntax, which mimics <code class=
        !          8472:           "filename">/etc/passwd</code>:</p>
        !          8473:           <pre class="programlisting">
        !          8474: user:group[:[userid][:[descr][:[home][:shell]]]]
        !          8475: </pre>
        !          8476: 
        !          8477:           <p>Only the user and group are required; everything else
        !          8478:           is optional, but the colons must be in the right places
        !          8479:           when specifying optional bits. By default, a new user
        !          8480:           will have home directory <code class=
        !          8481:           "filename">/nonexistent</code>, and login shell
        !          8482:           <code class="filename">/sbin/nologin</code> unless they
        !          8483:           are specified as part of the user element. Note that if
        !          8484:           the description contains spaces, then spaces should be
        !          8485:           double backslash-escaped, as in:</p>
        !          8486:           <pre class="programlisting">
        !          8487: foo:foogrp::The\\ Foomister
        !          8488: </pre>
        !          8489: 
        !          8490:           <p>Similarly, groups can be created using the
        !          8491:           <code class="varname">PKG_GROUPS</code> variable, whose
        !          8492:           syntax is:</p>
        !          8493:           <pre class="programlisting">
        !          8494: group[:groupid]
        !          8495: </pre>
        !          8496: 
        !          8497:           <p>As before, only the group name is required; the
        !          8498:           numeric identifier is optional.</p>
        !          8499:         </div>
        !          8500: 
        !          8501:         <div class="sect1" lang="en" xml:lang="en">
        !          8502:           <div class="titlepage">
        !          8503:             <div>
        !          8504:               <div>
        !          8505:                 <h2 class="title" style="clear: both"><a name=
        !          8506:                 "shells" id="shells"></a>11.5. System shells</h2>
        !          8507:               </div>
        !          8508:             </div>
        !          8509:           </div>
        !          8510: 
        !          8511:           <p>Packages that install system shells should register
        !          8512:           them in the shell database, <code class=
        !          8513:           "filename">/etc/shells</code>, to make things easier to
        !          8514:           the administrator. This must be done from the
        !          8515:           installation scripts to keep binary packages working on
        !          8516:           any system. pkginstall provides an easy way to accomplish
        !          8517:           this task.</p>
        !          8518: 
        !          8519:           <p>When a package provides a shell interpreter, it has to
        !          8520:           set the <code class="varname">PKG_SHELL</code> variable
        !          8521:           to its absolute file name. This will add some hooks to
        !          8522:           the installation scripts to handle it. Consider the
        !          8523:           following example, taken from <a xmlns=
        !          8524:           "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8525:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
        !          8526:           class="pkgname">shells/zsh</a>:</p>
        !          8527:           <pre class="programlisting">
        !          8528: USE_PKGINSTALL= YES
        !          8529: PKG_SHELL=      ${PREFIX}/bin/zsh
        !          8530: </pre>
        !          8531: 
        !          8532:           <div class="sect2" lang="en" xml:lang="en">
        !          8533:             <div class="titlepage">
        !          8534:               <div>
        !          8535:                 <div>
        !          8536:                   <h3 class="title"><a name="shells-disable" id=
        !          8537:                   "shells-disable"></a>11.5.1. Disabling handling
        !          8538:                   of configuration files</h3>
        !          8539:                 </div>
        !          8540:               </div>
        !          8541:             </div>
        !          8542: 
        !          8543:             <p>The automatic registration of shell interpreters can
        !          8544:             be disabled by the administrator by setting the
        !          8545:             <code class="filename">PKG_REGISTER_SHELLS</code>
        !          8546:             environment variable to <code class=
        !          8547:             "literal">NO</code>.</p>
        !          8548:           </div>
        !          8549:         </div>
        !          8550:       </div>
        !          8551: 
        !          8552:       <div class="chapter" lang="en" xml:lang="en">
        !          8553:         <div class="titlepage">
        !          8554:           <div>
        !          8555:             <div>
        !          8556:               <h2 class="title"><a name="options" id=
        !          8557:               "options"></a>Chapter&nbsp;12.&nbsp;Options
        !          8558:               handling</h2>
        !          8559:             </div>
        !          8560:           </div>
        !          8561:         </div>
        !          8562: 
        !          8563:         <div class="toc">
        !          8564:           <p><b>Table of Contents</b></p>
        !          8565: 
        !          8566:           <dl>
        !          8567:             <dt><span class="sect1"><a href=
        !          8568:             "#global-default-options">12.1. Global default
        !          8569:             options</a></span></dt>
        !          8570: 
        !          8571:             <dt><span class="sect1"><a href=
        !          8572:             "#converting-to-options">12.2. Converting packages to
        !          8573:             use <code class=
        !          8574:             "filename">bsd.options.mk</code></a></span></dt>
        !          8575:           </dl>
        !          8576:         </div>
        !          8577: 
        !          8578:         <p>Many packages have the ability to be built to support
        !          8579:         different sets of features. <code class=
        !          8580:         "filename">bsd.options.mk</code> is a framework in pkgsrc
        !          8581:         that provides generic handling of those options that
        !          8582:         determine different ways in which the packages can be
        !          8583:         built. It's possible for the user to specify exactly which
        !          8584:         sets of options will be built into a package or to allow a
        !          8585:         set of global default options apply.</p>
        !          8586: 
        !          8587:         <div class="sect1" lang="en" xml:lang="en">
        !          8588:           <div class="titlepage">
        !          8589:             <div>
        !          8590:               <div>
        !          8591:                 <h2 class="title" style="clear: both"><a name=
        !          8592:                 "global-default-options" id=
        !          8593:                 "global-default-options"></a>12.1.&nbsp;Global
        !          8594:                 default options</h2>
        !          8595:               </div>
        !          8596:             </div>
        !          8597:           </div>
        !          8598: 
        !          8599:           <p>Global default options are listed in <code class=
        !          8600:           "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
        !          8601:           the options that should be built into every package if
        !          8602:           that option is supported. This variable should be set in
        !          8603:           <code class="filename">/etc/mk.conf</code>.</p>
        !          8604:         </div>
        !          8605: 
        !          8606:         <div class="sect1" lang="en" xml:lang="en">
        !          8607:           <div class="titlepage">
        !          8608:             <div>
        !          8609:               <div>
        !          8610:                 <h2 class="title" style="clear: both"><a name=
        !          8611:                 "converting-to-options" id=
        !          8612:                 "converting-to-options"></a>12.2.&nbsp;Converting
        !          8613:                 packages to use <code class=
        !          8614:                 "filename">bsd.options.mk</code></h2>
        !          8615:               </div>
        !          8616:             </div>
        !          8617:           </div>
        !          8618: 
        !          8619:           <p>The following example shows how <code class=
        !          8620:           "filename">bsd.options.mk</code> should be used by the
        !          8621:           hypothetical ``wibble'' package, either in the package
        !          8622:           <code class="filename">Makefile</code>, or in a file,
        !          8623:           e.g. <code class="filename">options.mk</code>, that is
        !          8624:           included by the main package <code class=
        !          8625:           "filename">Makefile</code>.</p>
        !          8626:           <pre class="programlisting">
        !          8627: # Global and legacy options
        !          8628: PKG_OPTIONS_VAR=        PKG_OPTIONS.wibble
        !          8629: PKG_SUPPORTED_OPTIONS=  ldap sasl
        !          8630: PKG_SUGGESTED_OPTIONS=  sasl
        !          8631: PKG_OPTION_LEGACY_VARS= WIBBLE_USE_OPENLDAP:ldap USE_SASL2:sasl
        !          8632: 
        !          8633: .include "../../mk/bsd.options.mk"
        !          8634: 
        !          8635: # Package-specific option-handling
        !          8636: 
        !          8637: ###
        !          8638: ### LDAP support
        !          8639: ###
        !          8640: .if !empty(PKG_OPTIONS:Mldap)
        !          8641: .  include "../../databases/openldap/buildlink3.mk"
        !          8642: CONFIGURE_ARGS+=      --enable-ldap=${BUILDLINK_PREFIX.openldap}
        !          8643: .endif
1.1       grant    8644: 
                   8645: ###
                   8646: ### SASL authentication
                   8647: ###
                   8648: .if !empty(PKG_OPTIONS:Msasl)
                   8649: .  include "../../security/cyrus-sasl2/buildlink3.mk"
                   8650: CONFIGURE_ARGS+=        --enable-sasl=${BUILDLINK_PREFIX.sasl}
                   8651: .endif
                   8652:       
                   8653: </pre>
                   8654: 
1.28      rillig   8655:           <p>The first section contains the information about which
                   8656:           build options are supported by the package, and any
1.1       grant    8657:           default options settings if needed.</p>
                   8658: 
                   8659:           <div class="orderedlist">
                   8660:             <ol type="1">
                   8661:               <li>
1.14      xtraeme  8662:                 <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27      rillig   8663:                 the name of the <a href=
1.1       grant    8664:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   8665:                 <span class="citerefentry"><span class=
1.27      rillig   8666:                 "refentrytitle">make</span>(1)</span></a> variable
                   8667:                 that contains the options the user wishes to
                   8668:                 select. The recommended value is
                   8669:                 &#8220;<span class="quote">PKG_OPTIONS.<em class=
1.14      xtraeme  8670:                 "replaceable"><code>pkg</code></em></span>&#8221;
                   8671:                 but any package-specific value may be used. This
1.1       grant    8672:                 variable should be set in a package Makefile.</p>
                   8673:               </li>
                   8674: 
                   8675:               <li>
1.14      xtraeme  8676:                 <p><code class=
                   8677:                 "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
                   8678:                 build options supported by the package. This
                   8679:                 variable should be set in a package Makefile.</p>
1.1       grant    8680:               </li>
                   8681: 
                   8682:               <li>
1.27      rillig   8683:                 <p><code class=
                   8684:                 "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
                   8685:                 build options which are enabled by default.</p>
                   8686:               </li>
                   8687: 
                   8688:               <li>
1.14      xtraeme  8689:                 <p><code class="varname">${PKG_OPTIONS_VAR}</code>
1.27      rillig   8690:                 (the variable named in <code class=
                   8691:                 "varname">PKG_OPTIONS_VAR</code>) lists the
                   8692:                 selected build options and overrides any default
                   8693:                 options given in <code class=
1.14      xtraeme  8694:                 "varname">PKG_DEFAULT_OPTIONS</code>. If any of the
1.1       grant    8695:                 options begin with a &#8220;<span class=
                   8696:                 "quote">-</span>&#8221;, then that option is always
                   8697:                 removed from the selected build options, e.g.</p>
                   8698:                 <pre class="programlisting">
                   8699:         PKG_DEFAULT_OPTIONS=    kerberos ldap sasl
                   8700:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   8701:         WIBBLE_OPTIONS=         ${PKG_DEFAULT_OPTIONS} -sasl
1.28      rillig   8702:         # leads to PKG_OPTIONS = kerberos ldap
1.1       grant    8703:           
                   8704: </pre>
                   8705: 
                   8706:                 <p>or</p>
                   8707:                 <pre class="programlisting">
                   8708:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   8709:         WIBBLE_OPTIONS=         kerberos -ldap ldap
1.28      rillig   8710:         # leads to PKG_OPTIONS = kerberos
1.1       grant    8711:           
                   8712: </pre>
                   8713: 
1.14      xtraeme  8714:                 <p>This variable should be set in <code class=
                   8715:                 "filename">/etc/mk.conf</code>.</p>
1.1       grant    8716:               </li>
                   8717: 
                   8718:               <li>
1.28      rillig   8719:                 <p>The <code class=
                   8720:                 "varname">PKG_OPTIONS_LEGACY_VARS</code> is only
                   8721:                 needed if you are converting a package that had its
                   8722:                 own ad-hoc options handling to use <code class=
                   8723:                 "filename">bsd.options.mk</code>. It converts
                   8724:                 global or legacy options variables into an
                   8725:                 equivalent <code class=
                   8726:                 "varname">PKG_OPTIONS.<em class=
                   8727:                 "replaceable"><code>pkg</code></em></code>
                   8728:                 value.</p>
1.1       grant    8729:               </li>
1.28      rillig   8730:             </ol>
1.1       grant    8731:           </div>
                   8732: 
1.28      rillig   8733:           <p>After the inclusion of bsd.options.mk, the variable
                   8734:           <code class="varname">PKG_OPTIONS</code> contains the
                   8735:           list of the selected build options, properly filtered to
                   8736:           remove unsupported and duplicate options.</p>
                   8737: 
1.1       grant    8738:           <p>The remaining sections contain the logic that is
                   8739:           specific to each option. There should be a check for
1.14      xtraeme  8740:           every option listed in <code class=
                   8741:           "varname">PKG_SUPPORTED_OPTIONS</code>, and there should
                   8742:           be clear documentation on what turning on the option will
                   8743:           do in the comments preceding each section. The correct
                   8744:           way to check for an option is to check whether it is
                   8745:           listed in <code class="varname">PKG_OPTIONS</code>.</p>
1.1       grant    8746:         </div>
                   8747:       </div>
                   8748: 
                   8749:       <div class="chapter" lang="en" xml:lang="en">
                   8750:         <div class="titlepage">
                   8751:           <div>
                   8752:             <div>
                   8753:               <h2 class="title"><a name="build" id=
1.35    ! jmmv     8754:               "build"></a>Chapter&nbsp;13.&nbsp;The build
1.1       grant    8755:               process</h2>
                   8756:             </div>
                   8757:           </div>
                   8758:         </div>
                   8759: 
                   8760:         <div class="toc">
                   8761:           <p><b>Table of Contents</b></p>
                   8762: 
                   8763:           <dl>
1.35    ! jmmv     8764:             <dt><span class="sect1"><a href="#build.prefix">13.1.
1.1       grant    8765:             Program location</a></span></dt>
                   8766: 
1.35    ! jmmv     8767:             <dt><span class="sect1"><a href="#main-targets">13.2.
1.30      wiz      8768:             Main targets</a></span></dt>
1.1       grant    8769: 
                   8770:             <dt><span class="sect1"><a href=
1.35    ! jmmv     8771:             "#build.helpful-targets">13.3. Other helpful
1.1       grant    8772:             targets</a></span></dt>
                   8773:           </dl>
                   8774:         </div>
                   8775: 
                   8776:         <p>The basic steps for building a program are always the
                   8777:         same. First the program's source (<span class=
                   8778:         "emphasis"><em>distfile</em></span>) must be brought to the
                   8779:         local system and then extracted. After any patches to
                   8780:         compile properly on NetBSD are applied, the software can be
                   8781:         configured, then built (usually by compiling), and finally
                   8782:         the generated binaries, etc. can be put into place on the
                   8783:         system. These are exactly the steps performed by the NetBSD
                   8784:         package system, which is implemented as a series of targets
1.14      xtraeme  8785:         in a central Makefile, <code class=
                   8786:         "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1       grant    8787: 
                   8788:         <div class="sect1" lang="en" xml:lang="en">
                   8789:           <div class="titlepage">
                   8790:             <div>
                   8791:               <div>
                   8792:                 <h2 class="title" style="clear: both"><a name=
                   8793:                 "build.prefix" id=
1.35    ! jmmv     8794:                 "build.prefix"></a>13.1.&nbsp;Program location</h2>
1.1       grant    8795:               </div>
                   8796:             </div>
                   8797:           </div>
                   8798: 
                   8799:           <p>Before outlining the process performed by the NetBSD
                   8800:           package system in the next section, here's a brief
                   8801:           discussion on where programs are installed, and which
                   8802:           variables influence this.</p>
                   8803: 
1.14      xtraeme  8804:           <p>The automatic variable <code class=
                   8805:           "varname">PREFIX</code> indicates where all files of the
                   8806:           final program shall be installed. It is usually set to
                   8807:           <code class="varname">LOCALBASE</code> (<code class=
                   8808:           "filename">/usr/pkg</code>), or <code class=
                   8809:           "varname">CROSSBASE</code> for pkgs in the
1.1       grant    8810:           &#8220;<span class="quote">cross</span>&#8221; category.
1.14      xtraeme  8811:           The value of <code class="varname">PREFIX</code> needs to
                   8812:           be put into the various places in the program's source
                   8813:           where paths to these files are encoded. See <a href=
1.1       grant    8814:           "#components.patches" title=
1.27      rillig   8815:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
1.1       grant    8816:           &#8220;patches/*&#8221;</a> and <a href="#fixes.libtool"
                   8817:           title=
1.35    ! jmmv     8818:           "14.3.1.&nbsp;Shared libraries - libtool">Section&nbsp;14.3.1,
1.1       grant    8819:           &#8220;Shared libraries - libtool&#8221;</a> for more
                   8820:           details.</p>
                   8821: 
                   8822:           <p>When choosing which of these variables to use, follow
                   8823:           the following rules:</p>
                   8824: 
                   8825:           <div class="itemizedlist">
                   8826:             <ul type="disc">
                   8827:               <li>
1.14      xtraeme  8828:                 <p><code class="varname">PREFIX</code> always
                   8829:                 points to the location where the current pkg will
                   8830:                 be installed. When referring to a pkg's own
1.1       grant    8831:                 installation path, use &#8220;<span class=
                   8832:                 "quote">${PREFIX}</span>&#8221;.</p>
                   8833:               </li>
                   8834: 
                   8835:               <li>
1.14      xtraeme  8836:                 <p><code class="varname">LOCALBASE</code> is where
                   8837:                 all non-X11 pkgs are installed. If you need to
1.1       grant    8838:                 construct a -I or -L argument to the compiler to
                   8839:                 find includes and libraries installed by another
                   8840:                 non-X11 pkg, use &#8220;<span class=
                   8841:                 "quote">${LOCALBASE}</span>&#8221;.</p>
                   8842:               </li>
                   8843: 
                   8844:               <li>
1.14      xtraeme  8845:                 <p><code class="varname">X11BASE</code> is where
                   8846:                 the actual X11 distribution (from xsrc, etc.) is
1.1       grant    8847:                 installed. When looking for <span class=
                   8848:                 "emphasis"><em>standard</em></span> X11 includes
                   8849:                 (not those installed by a pkg), use
                   8850:                 &#8220;<span class=
                   8851:                 "quote">${X11BASE}</span>&#8221;.</p>
                   8852:               </li>
                   8853: 
                   8854:               <li>
                   8855:                 <p>X11 based are special in that they may be
1.14      xtraeme  8856:                 installed in either <code class=
                   8857:                 "varname">X11BASE</code> or <code class=
                   8858:                 "varname">LOCALBASE</code>.</p>
1.1       grant    8859: 
                   8860:                 <p>Usually, X11 packages should be installed under
1.14      xtraeme  8861:                 <code class="varname">LOCALBASE</code> whenever
1.34      wiz      8862:                 possible. Note that you will need to include
                   8863:                 <code class=
                   8864:                 "filename">../../mk/x11.buildlink3.mk</code> in
                   8865:                 them to request the presence of X11 and to get the
                   8866:                 right compilation flags.</p>
1.1       grant    8867: 
                   8868:                 <p>Even though, there are some packages that cannot
1.14      xtraeme  8869:                 be installed under <code class=
                   8870:                 "varname">LOCALBASE</code>: those that come with
1.1       grant    8871:                 app-defaults files. These packages are special and
1.14      xtraeme  8872:                 they must be placed under <code class=
                   8873:                 "varname">X11BASE</code>. To accomplish this, set
                   8874:                 either <code class="varname">USE_X11BASE</code> or
                   8875:                 <code class="varname">USE_IMAKE</code> in your
1.1       grant    8876:                 package.</p>
                   8877: 
1.34      wiz      8878:                 <p>Some notes: If you need to find includes or
1.14      xtraeme  8879:                 libraries installed by a pkg that has <code class=
                   8880:                 "varname">USE_IMAKE</code> or <code class=
                   8881:                 "varname">USE_X11BASE</code> in its pkg
                   8882:                 <code class="filename">Makefile</code>, you need to
1.34      wiz      8883:                 look in <span class="emphasis"><em>both</em></span>
1.14      xtraeme  8884:                 <code class="filename">${X11BASE}</code> and
                   8885:                 <code class="filename">${LOCALBASE}</code>. To
                   8886:                 force installation of all X11 packages in
                   8887:                 <code class="varname">LOCALBASE</code>, the
                   8888:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8889:                 href=
1.1       grant    8890:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.34      wiz      8891:                 class="pkgname">pkgtools/xpkgwedge</a> package is
                   8892:                 enabled by default.</p>
1.1       grant    8893:               </li>
                   8894: 
                   8895:               <li>
1.14      xtraeme  8896:                 <p><code class="varname">X11PREFIX</code> should be
1.1       grant    8897:                 used to refer to the installed location of an X11
1.14      xtraeme  8898:                 package. <code class="varname">X11PREFIX</code>
                   8899:                 will be set to <code class="varname">X11BASE</code>
                   8900:                 if xpkgwedge is not installed, and to <code class=
                   8901:                 "varname">LOCALBASE</code> if xpkgwedge is
1.1       grant    8902:                 installed.</p>
                   8903:               </li>
                   8904: 
                   8905:               <li>
                   8906:                 <p>If xpkgwedge is installed, it is possible to
1.14      xtraeme  8907:                 have some packages installed in <code class=
                   8908:                 "varname">X11BASE</code> and some in <code class=
                   8909:                 "varname">LOCALBASE</code>. To determine the prefix
                   8910:                 of an installed package, the <code class=
                   8911:                 "varname">EVAL_PREFIX</code> definition can be
                   8912:                 used. It takes pairs in the format
                   8913:                 &#8220;<span class=
1.1       grant    8914:                 "quote">DIRNAME=&lt;package&gt;</span>&#8221;, and
1.24      wiz      8915:                 the <a href=
                   8916:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   8917:                 <span class="citerefentry"><span class=
                   8918:                 "refentrytitle">make</span>(1)</span></a> variable
                   8919:                 <code class="varname">DIRNAME</code> will be set to
                   8920:                 the prefix of the installed package
                   8921:                 &lt;package&gt;, or &#8220;<span class=
1.1       grant    8922:                 "quote">${X11PREFIX}</span>&#8221; if the package
                   8923:                 is not installed.</p>
                   8924: 
                   8925:                 <p>This is best illustrated by example.</p>
                   8926: 
1.14      xtraeme  8927:                 <p>The following lines are taken from <code class=
                   8928:                 "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1       grant    8929:                 <pre class="programlisting">
1.14      xtraeme  8930: EVAL_PREFIX+=           GTKDIR=gtk+
1.1       grant    8931: CONFIGURE_ARGS+=        --with-guile-prefix=${LOCALBASE}        \
                   8932:                         --with-gtk-prefix="${GTKDIR}"           \
                   8933:                         --enable-multibyte
                   8934: </pre>
                   8935: 
                   8936:                 <p>Specific defaults can be defined for the
1.14      xtraeme  8937:                 packages evaluated using <code class=
                   8938:                 "varname">EVAL_PREFIX</code>, by using a definition
1.1       grant    8939:                 of the form:</p>
                   8940:                 <pre class="programlisting">
                   8941: GTKDIR_DEFAULT= ${LOCALBASE}
                   8942: </pre>
                   8943: 
1.14      xtraeme  8944:                 <p>where <code class="varname">GTKDIR</code>
1.1       grant    8945:                 corresponds to the first definition in the
1.14      xtraeme  8946:                 <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1       grant    8947:               </li>
                   8948: 
                   8949:               <li>
1.14      xtraeme  8950:                 <p>Within <code class="filename">${PREFIX}</code>,
1.24      wiz      8951:                 packages should install files according to <a href=
                   8952:                 "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
                   8953:                 <span class="citerefentry"><span class=
                   8954:                 "refentrytitle">hier</span>(7)</span></a>, with the
                   8955:                 exception that manual pages go into <code class=
                   8956:                 "filename">${PREFIX}/man</code>, not <code class=
1.14      xtraeme  8957:                 "filename">${PREFIX}/share/man</code>.</p>
1.1       grant    8958:               </li>
                   8959:             </ul>
                   8960:           </div>
                   8961:         </div>
                   8962: 
                   8963:         <div class="sect1" lang="en" xml:lang="en">
                   8964:           <div class="titlepage">
                   8965:             <div>
                   8966:               <div>
                   8967:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      8968:                 "main-targets" id=
1.35    ! jmmv     8969:                 "main-targets"></a>13.2.&nbsp;Main targets</h2>
1.1       grant    8970:               </div>
                   8971:             </div>
                   8972:           </div>
                   8973: 
                   8974:           <p>The main targets used during the build process defined
1.14      xtraeme  8975:           in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1       grant    8976: 
                   8977:           <div class="variablelist">
                   8978:             <dl>
                   8979:               <dt><span class="term">fetch</span></dt>
                   8980: 
                   8981:               <dd>
                   8982:                 <p>This will check if the file(s) given in the
1.14      xtraeme  8983:                 variables <code class="varname">DISTFILES</code>
                   8984:                 and <code class="varname">PATCHFILES</code> (as
                   8985:                 defined in the package's Makefile) are present on
                   8986:                 the local system in <code class=
                   8987:                 "filename">/usr/pkgsrc/distfiles</code>. If they
                   8988:                 are not present, an attempt will be made to fetch
                   8989:                 them using commands of the form:</p>
1.1       grant    8990:                 <pre class="programlisting">
                   8991: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
                   8992: </pre>
                   8993: 
                   8994:                 <p>where ${site} varies through several
1.14      xtraeme  8995:                 possibilities in turn: first, <code class=
                   8996:                 "varname">MASTER_SITE_OVERRIDE</code> is tried,
                   8997:                 then the sites specified in either <code class=
                   8998:                 "varname">SITES_file</code> if defined, else
                   8999:                 <code class="varname">MASTER_SITES</code> or
                   9000:                 <code class="varname">PATCH_SITES</code>, as
                   9001:                 applies, then finally the value of <code class=
                   9002:                 "varname">MASTER_SITE_BACKUP</code>. The order of
                   9003:                 all except the first can be optionally sorted by
                   9004:                 the user, via setting either <code class=
                   9005:                 "varname">MASTER_SORT_AWK</code> or <code class=
                   9006:                 "varname">MASTER_SORT_REGEX</code>.</p>
1.1       grant    9007:               </dd>
                   9008: 
                   9009:               <dt><span class="term">checksum</span></dt>
                   9010: 
                   9011:               <dd>
                   9012:                 <p>After the distfile(s) are fetched, their
                   9013:                 checksum is generated and compared with the
                   9014:                 checksums stored in the distinfo file. If the
                   9015:                 checksums don't match, the build is aborted. This
                   9016:                 is to ensure the same distfile is used for
                   9017:                 building, and that the distfile wasn't changed,
                   9018:                 e.g. by some malign force, deliberately changed
                   9019:                 distfiles on the master distribution site or
                   9020:                 network lossage.</p>
                   9021:               </dd>
                   9022: 
                   9023:               <dt><span class="term">extract</span></dt>
                   9024: 
                   9025:               <dd>
                   9026:                 <p>When the distfiles are present on the local
                   9027:                 system, they need to be extracted, as they are
                   9028:                 usually in the form of some compressed archive
1.14      xtraeme  9029:                 format, most commonly <code class=
                   9030:                 "filename">.tar.gz</code>.</p>
1.1       grant    9031: 
                   9032:                 <p>If only some of the distfiles need to be
                   9033:                 uncompressed, the files to be uncompressed should
1.14      xtraeme  9034:                 be put into <code class=
                   9035:                 "varname">EXTRACT_ONLY</code>.</p>
1.1       grant    9036: 
1.14      xtraeme  9037:                 <p>If the distfiles are not in <code class=
                   9038:                 "filename">.tar.gz</code> format, they can be
                   9039:                 extracted by setting either <code class=
                   9040:                 "varname">EXTRACT_SUFX</code>, or <code class=
                   9041:                 "varname">EXTRACT_CMD</code>, <code class=
                   9042:                 "varname">EXTRACT_BEFORE_ARGS</code> and
                   9043:                 <code class="varname">EXTRACT_AFTER_ARGS</code>. In
                   9044:                 the former case, pkgsrc knows how to extract a
                   9045:                 number of suffixes (<code class=
                   9046:                 "filename">.tar.gz</code>, <code class=
                   9047:                 "filename">.tgz</code>, <code class=
                   9048:                 "filename">.tar.gz2</code>, <code class=
                   9049:                 "filename">.tbz</code>, <code class=
                   9050:                 "filename">.tar.Z</code>, <code class=
                   9051:                 "filename">.tar</code>, <code class=
                   9052:                 "filename">.shar.gz</code>, <code class=
                   9053:                 "filename">.shar.bz2</code>, <code class=
                   9054:                 "filename">.shar.Z</code>, <code class=
                   9055:                 "filename">.shar</code>, <code class=
                   9056:                 "filename">.Z</code>, <code class=
                   9057:                 "filename">.bz2</code> and <code class=
                   9058:                 "filename">.gz</code>; see the definition of the
                   9059:                 various <code class="varname">DECOMPRESS_CMD</code>
                   9060:                 variables <code class="filename">bsd.pkg.mk</code>
                   9061:                 for a complete list). Here's an example on how to
                   9062:                 use the other variables for a program that comes
                   9063:                 with a compressed shell archive whose name ends in
                   9064:                 <code class="filename">.msg.gz</code>:</p>
1.1       grant    9065:                 <pre class="programlisting">
                   9066:      EXTRACT_SUFX=   .msg.gz
                   9067:      EXTRACT_CMD=            zcat
                   9068:      EXTRACT_BEFORE_ARGS=
                   9069:      EXTRACT_AFTER_ARGS=     |sh
                   9070: </pre>
                   9071:               </dd>
                   9072: 
                   9073:               <dt><span class="term">patch</span></dt>
                   9074: 
                   9075:               <dd>
                   9076:                 <p>After extraction, all the patches named by the
1.14      xtraeme  9077:                 <code class="varname">PATCHFILES</code>, those
                   9078:                 present in the patches subdirectory of the package
                   9079:                 as well as in $LOCALPATCHES/$PKGPATH (e.g.
                   9080:                 <code class=
                   9081:                 "filename">/usr/local/patches/graphics/png</code>)
                   9082:                 are applied. Patchfiles ending in <code class=
                   9083:                 "filename">.Z</code> or <code class=
                   9084:                 "filename">.gz</code> are uncompressed before they
                   9085:                 are applied, files ending in <code class=
                   9086:                 "filename">.orig</code> or <code class=
                   9087:                 "filename">.rej</code> are ignored. Any special
1.24      wiz      9088:                 options to <a href=
                   9089:                 "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   9090:                 <span class="citerefentry"><span class=
                   9091:                 "refentrytitle">patch</span>(1)</span></a> can be
                   9092:                 handed in <code class=
1.14      xtraeme  9093:                 "varname">PATCH_DIST_ARGS</code>. See <a href=
                   9094:                 "#components.patches" title=
1.27      rillig   9095:                 "7.3.&nbsp;patches/*">Section&nbsp;7.3,
1.1       grant    9096:                 &#8220;patches/*&#8221;</a> for more details.</p>
                   9097: 
1.24      wiz      9098:                 <p>By default <a href=
                   9099:                 "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   9100:                 <span class="citerefentry"><span class=
                   9101:                 "refentrytitle">patch</span>(1)</span></a> is given
                   9102:                 special args to make it fail if the patches apply
                   9103:                 with some lines of fuzz. Please fix (regen) the
                   9104:                 patches so that they apply cleanly. The rationale
                   9105:                 behind this is that patches that don't apply
                   9106:                 cleanly may end up being applied in the wrong
                   9107:                 place, and cause severe harm there.</p>
1.1       grant    9108:               </dd>
                   9109: 
                   9110:               <dt><span class="term">configure</span></dt>
                   9111: 
                   9112:               <dd>
                   9113:                 <p>Most pieces of software need information on the
                   9114:                 header files, system calls, and library routines
                   9115:                 which are available in NetBSD. This is the process
                   9116:                 known as configuration, and is usually automated.
                   9117:                 In most cases, a script is supplied with the
                   9118:                 source, and its invocation results in generation of
                   9119:                 header files, Makefiles, etc.</p>
                   9120: 
                   9121:                 <p>If the program's distfile contains its own
                   9122:                 configure script, this can be invoked by setting
1.14      xtraeme  9123:                 <code class="varname">HAS_CONFIGURE</code>. If the
1.1       grant    9124:                 configure script is a GNU autoconf script,
1.14      xtraeme  9125:                 <code class="varname">GNU_CONFIGURE</code> should
                   9126:                 be specified instead. In either case, any arguments
                   9127:                 to the configure script can be specified in the
                   9128:                 <code class="varname">CONFIGURE_ARGS</code>
                   9129:                 variable, and the configure script's name can be
                   9130:                 set in <code class=
                   9131:                 "varname">CONFIGURE_SCRIPT</code> if it differs
                   9132:                 from the default &#8220;<span class=
1.1       grant    9133:                 "quote">configure</span>&#8221;. Here's an example
                   9134:                 from the <a xmlns=
                   9135:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   9136:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.20      ben      9137:                 class="pkgname">sysutils/top</a> package:</p>
1.1       grant    9138:                 <pre class="programlisting">
                   9139: HAS_CONFIGURE=          yes
                   9140: CONFIGURE_SCRIPT=       Configure
                   9141: CONFIGURE_ARGS+=        netbsd13
                   9142: </pre>
                   9143: 
                   9144:                 <p>If the program uses an Imakefile for
                   9145:                 configuration, the appropriate steps can be invoked
1.14      xtraeme  9146:                 by setting <code class="varname">USE_IMAKE</code>
                   9147:                 to &#8220;<span class="quote">YES</span>&#8221;.
                   9148:                 (If you only want the package installed in
                   9149:                 <code class="varname">$X11PREFIX</code> but xmkmf
                   9150:                 not being run, set <code class=
                   9151:                 "varname">USE_X11BASE</code> instead!)</p>
1.1       grant    9152:               </dd>
                   9153: 
                   9154:               <dt><span class="term">build</span></dt>
                   9155: 
                   9156:               <dd>
                   9157:                 <p>Once configuration has taken place, the software
1.14      xtraeme  9158:                 will be built by invoking <code class=
                   9159:                 "varname">$MAKE_PROGRAM</code> on <code class=
                   9160:                 "varname">$MAKEFILE</code> with <code class=
                   9161:                 "varname">$BUILD_TARGET</code> as the target to
                   9162:                 build. The default <code class=
                   9163:                 "varname">MAKE_PROGRAM</code> is
                   9164:                 &#8220;<span class="quote">gmake</span>&#8221; if
1.29      rillig   9165:                 <code class="varname">USE_TOOLS</code> contains
                   9166:                 &#8220;<span class="quote">gmake</span>&#8221;,
1.1       grant    9167:                 &#8220;<span class="quote">make</span>&#8221;
1.14      xtraeme  9168:                 otherwise. <code class="varname">MAKEFILE</code> is
                   9169:                 set to &#8220;<span class=
1.1       grant    9170:                 "quote">Makefile</span>&#8221; by default, and
1.14      xtraeme  9171:                 <code class="varname">BUILD_TARGET</code> defaults
                   9172:                 to &#8220;<span class="quote">all</span>&#8221;.
                   9173:                 Any of these variables can be set in the package's
1.1       grant    9174:                 Makefile to change the default build process.</p>
                   9175:               </dd>
                   9176: 
                   9177:               <dt><span class="term">install</span></dt>
                   9178: 
                   9179:               <dd>
                   9180:                 <p>Once the build stage has completed, the final
                   9181:                 step is to install the software in public
                   9182:                 directories, so users can access the programs and
1.14      xtraeme  9183:                 files. As in the build-target, <code class=
                   9184:                 "varname">$MAKE_PROGRAM</code> is invoked on
                   9185:                 <code class="varname">$MAKEFILE</code> here, but
                   9186:                 with the <code class=
                   9187:                 "varname">$INSTALL_TARGET</code> instead, the
                   9188:                 latter defaulting to &#8220;<span class=
                   9189:                 "quote">install</span>&#8221; (plus
                   9190:                 &#8220;<span class=
                   9191:                 "quote">install.man</span>&#8221;, if <code class=
                   9192:                 "varname">USE_IMAKE</code> is set).</p>
1.1       grant    9193:               </dd>
                   9194:             </dl>
                   9195:           </div>
                   9196: 
                   9197:           <p>If no target is specified, the default is
                   9198:           &#8220;<span class="quote">build</span>&#8221;. If a
                   9199:           subsequent stage is requested, all prior stages are made:
1.14      xtraeme  9200:           e.g. <span><strong class="command">make
                   9201:           build</strong></span> will also perform the equivalent
                   9202:           of:</p>
1.1       grant    9203:           <pre class="programlisting">
                   9204: make fetch
                   9205: make checksum
                   9206: make extract
                   9207: make patch
                   9208: make configure
                   9209: make build
                   9210: </pre>
                   9211:         </div>
                   9212: 
                   9213:         <div class="sect1" lang="en" xml:lang="en">
                   9214:           <div class="titlepage">
                   9215:             <div>
                   9216:               <div>
                   9217:                 <h2 class="title" style="clear: both"><a name=
                   9218:                 "build.helpful-targets" id=
1.35    ! jmmv     9219:                 "build.helpful-targets"></a>13.3.&nbsp;Other
1.1       grant    9220:                 helpful targets</h2>
                   9221:               </div>
                   9222:             </div>
                   9223:           </div>
                   9224: 
                   9225:           <div class="variablelist">
                   9226:             <dl>
                   9227:               <dt><span class="term">pre/post-*</span></dt>
                   9228: 
                   9229:               <dd>
                   9230:                 <p>For any of the main targets described in the
                   9231:                 previous section, two auxiliary targets exist with
                   9232:                 &#8220;<span class="quote">pre-</span>&#8221; and
                   9233:                 &#8220;<span class="quote">post-</span>&#8221; used
                   9234:                 as a prefix for the main target's name. These
                   9235:                 targets are invoked before and after the main
                   9236:                 target is called, allowing extra configuration or
                   9237:                 installation steps be performed from a package's
                   9238:                 Makefile, for example, which a program's configure
                   9239:                 script or install target omitted.</p>
                   9240:               </dd>
                   9241: 
                   9242:               <dt><span class="term">do-*</span></dt>
                   9243: 
                   9244:               <dd>
                   9245:                 <p>Should one of the main targets do the wrong
                   9246:                 thing, and should there be no variable to fix this,
                   9247:                 you can redefine it with the do-* target. (Note
                   9248:                 that redefining the target itself instead of the
                   9249:                 do-* target is a bad idea, as the pre-* and post-*
                   9250:                 targets won't be called anymore, etc.) You will not
                   9251:                 usually need to do this.</p>
                   9252:               </dd>
                   9253: 
                   9254:               <dt><span class="term">reinstall</span></dt>
                   9255: 
                   9256:               <dd>
1.14      xtraeme  9257:                 <p>If you did a <span><strong class="command">make
                   9258:                 install</strong></span> and you noticed some file
                   9259:                 was not installed properly, you can repeat the
1.1       grant    9260:                 installation with this target, which will ignore
                   9261:                 the &#8220;<span class="quote">already
                   9262:                 installed</span>&#8221; flag.</p>
                   9263:               </dd>
                   9264: 
                   9265:               <dt><span class="term">deinstall</span></dt>
                   9266: 
                   9267:               <dd>
1.24      wiz      9268:                 <p>This target does a <a href=
                   9269:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   9270:                 <span class="citerefentry"><span class=
                   9271:                 "refentrytitle">pkg_delete</span>(1)</span></a> in
                   9272:                 the current directory, effectively de-installing
                   9273:                 the package. The following variables can be used to
                   9274:                 tune the behaviour:</p>
1.1       grant    9275: 
                   9276:                 <div class="variablelist">
                   9277:                   <dl>
1.14      xtraeme  9278:                     <dt><span class="term"><code class=
                   9279:                     "varname">PKG_VERBOSE</code></span></dt>
1.1       grant    9280: 
                   9281:                     <dd>
                   9282:                       <p>Add a "-v" to the <a href=
                   9283:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   9284:                       <span class="citerefentry"><span class=
                   9285:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   9286:                       command.</p>
                   9287:                     </dd>
                   9288: 
1.14      xtraeme  9289:                     <dt><span class="term"><code class=
                   9290:                     "varname">DEINSTALLDEPENDS</code></span></dt>
1.1       grant    9291: 
                   9292:                     <dd>
                   9293:                       <p>Remove all packages that require (depend
                   9294:                       on) the given package. This can be used to
                   9295:                       remove any packages that may have been pulled
                   9296:                       in by a given package, e.g. if
1.14      xtraeme  9297:                       <span><strong class="command">make deinstall
                   9298:                       DEINSTALLDEPENDS=1</strong></span> is done in
                   9299:                       <code class="filename">pkgsrc/x11/kde</code>,
1.1       grant    9300:                       this is likely to remove whole KDE. Works by
                   9301:                       adding &#8220;<span class=
                   9302:                       "quote">-R</span>&#8221; to the <a href=
                   9303:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   9304:                       <span class="citerefentry"><span class=
                   9305:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   9306:                       command line.</p>
                   9307:                     </dd>
                   9308:                   </dl>
                   9309:                 </div>
                   9310:               </dd>
                   9311: 
                   9312:               <dt><span class="term">update</span></dt>
                   9313: 
                   9314:               <dd>
                   9315:                 <p>This target causes the current package to be
                   9316:                 updated to the latest version. The package and all
                   9317:                 depending packages first get de-installed, then
                   9318:                 current versions of the corresponding packages get
                   9319:                 compiled and installed. This is similar to manually
                   9320:                 noting which packages are currently installed, then
1.14      xtraeme  9321:                 performing a series of <span><strong class=
                   9322:                 "command">make deinstall</strong></span> and
                   9323:                 <span><strong class="command">make
                   9324:                 install</strong></span> (or whatever <code class=
                   9325:                 "varname">UPDATE_TARGET</code> is set to) for these
                   9326:                 packages.</p>
1.1       grant    9327: 
                   9328:                 <p>You can use the &#8220;<span class=
                   9329:                 "quote">update</span>&#8221; target to resume
1.14      xtraeme  9330:                 package updating in case a previous
                   9331:                 <span><strong class="command">make
                   9332:                 update</strong></span> was interrupted for some
                   9333:                 reason. However, in this case, make sure you don't
                   9334:                 call <span><strong class="command">make
                   9335:                 clean</strong></span> or otherwise remove the list
                   9336:                 of dependent packages in <code class=
                   9337:                 "varname">WRKDIR</code>. Otherwise you lose the
1.1       grant    9338:                 ability to automatically update the current package
                   9339:                 along with the dependent packages you have
                   9340:                 installed.</p>
                   9341: 
1.14      xtraeme  9342:                 <p>Resuming an interrupted <span><strong class=
                   9343:                 "command">make update</strong></span> will only
                   9344:                 work as long as the package tree remains unchanged.
                   9345:                 If the source code for one of the packages to be
                   9346:                 updated has been changed, resuming
                   9347:                 <span><strong class="command">make
                   9348:                 update</strong></span> will most certainly
                   9349:                 fail!</p>
1.1       grant    9350: 
                   9351:                 <p>The following variables can be used either on
1.14      xtraeme  9352:                 the command line or in <code class=
                   9353:                 "filename">/etc/mk.conf</code> to alter the
                   9354:                 behaviour of <span><strong class="command">make
                   9355:                 update</strong></span>:</p>
1.1       grant    9356: 
                   9357:                 <div class="variablelist">
                   9358:                   <dl>
1.14      xtraeme  9359:                     <dt><span class="term"><code class=
                   9360:                     "varname">UPDATE_TARGET</code></span></dt>
1.1       grant    9361: 
                   9362:                     <dd>
                   9363:                       <p>Install target to recursively use for the
                   9364:                       updated package and the dependent packages.
1.14      xtraeme  9365:                       Defaults to <code class=
                   9366:                       "varname">DEPENDS_TARGET</code> if set,
1.1       grant    9367:                       &#8220;<span class=
                   9368:                       "quote">install</span>&#8221; otherwise for
1.14      xtraeme  9369:                       <span><strong class="command">make
                   9370:                       update</strong></span>. e.g.
                   9371:                       <span><strong class="command">make update
                   9372:                       UPDATE_TARGET=package</strong></span></p>
1.1       grant    9373:                     </dd>
                   9374: 
1.14      xtraeme  9375:                     <dt><span class="term"><code class=
                   9376:                     "varname">NOCLEAN</code></span></dt>
1.1       grant    9377: 
                   9378:                     <dd>
                   9379:                       <p>Don't clean up after updating. Useful if
                   9380:                       you want to leave the work sources of the
                   9381:                       updated packages around for inspection or
                   9382:                       other purposes. Be sure you eventually clean
                   9383:                       up the source tree (see the
                   9384:                       &#8220;<span class=
                   9385:                       "quote">clean-update</span>&#8221; target
                   9386:                       below) or you may run into troubles with old
                   9387:                       source code still lying around on your next
1.14      xtraeme  9388:                       <span><strong class=
                   9389:                       "command">make</strong></span> or
                   9390:                       <span><strong class="command">make
                   9391:                       update</strong></span>.</p>
1.1       grant    9392:                     </dd>
                   9393: 
1.14      xtraeme  9394:                     <dt><span class="term"><code class=
                   9395:                     "varname">REINSTALL</code></span></dt>
1.1       grant    9396: 
                   9397:                     <dd>
                   9398:                       <p>Deinstall each package before installing
1.14      xtraeme  9399:                       (making <code class=
                   9400:                       "varname">DEPENDS_TARGET</code>). This may be
1.1       grant    9401:                       necessary if the &#8220;<span class=
                   9402:                       "quote">clean-update</span>&#8221; target
                   9403:                       (see below) was called after interrupting a
1.14      xtraeme  9404:                       running <span><strong class="command">make
                   9405:                       update</strong></span>.</p>
1.1       grant    9406:                     </dd>
                   9407: 
1.14      xtraeme  9408:                     <dt><span class="term"><code class=
                   9409:                     "varname">DEPENDS_TARGET</code></span></dt>
1.1       grant    9410: 
                   9411:                     <dd>
                   9412:                       <p>Allows you to disable recursion and
                   9413:                       hardcode the target for packages. The default
                   9414:                       is &#8220;<span class=
                   9415:                       "quote">update</span>&#8221; for the update
                   9416:                       target, facilitating a recursive update of
1.14      xtraeme  9417:                       prerequisite packages. Only set <code class=
                   9418:                       "varname">DEPENDS_TARGET</code> if you want
                   9419:                       to disable recursive updates. Use
                   9420:                       <code class="varname">UPDATE_TARGET</code>
                   9421:                       instead to just set a specific target for
                   9422:                       each package to be installed during
                   9423:                       <span><strong class="command">make
                   9424:                       update</strong></span> (see above).</p>
1.1       grant    9425:                     </dd>
                   9426:                   </dl>
                   9427:                 </div>
                   9428:               </dd>
                   9429: 
                   9430:               <dt><span class="term">clean-update</span></dt>
                   9431: 
                   9432:               <dd>
                   9433:                 <p>Clean the source tree for all packages that
1.14      xtraeme  9434:                 would get updated if <span><strong class=
                   9435:                 "command">make update</strong></span> was called
                   9436:                 from the current directory. This target should not
                   9437:                 be used if the current package (or any of its
                   9438:                 depending packages) have already been de-installed
                   9439:                 (e.g., after calling <span><strong class=
                   9440:                 "command">make update</strong></span>) or you may
                   9441:                 lose some packages you intended to update. As a
                   9442:                 rule of thumb: only use this target <span class=
                   9443:                 "emphasis"><em>before</em></span> the first time
                   9444:                 you run <span><strong class="command">make
                   9445:                 update</strong></span> and only if you have a dirty
                   9446:                 package tree (e.g., if you used <code class=
                   9447:                 "varname">NOCLEAN</code>).</p>
1.1       grant    9448: 
                   9449:                 <p>If you unsure about whether your tree is clean
1.14      xtraeme  9450:                 you can either perform a <span><strong class=
                   9451:                 "command">make clean</strong></span> at the top of
                   9452:                 the tree, or use the following sequence of commands
1.1       grant    9453:                 from the directory of the package you want to
                   9454:                 update (<span class=
                   9455:                 "emphasis"><em>before</em></span> running
1.14      xtraeme  9456:                 <span><strong class="command">make
                   9457:                 update</strong></span> for the first time,
                   9458:                 otherwise you lose all the packages you wanted to
                   9459:                 update!):</p>
1.1       grant    9460:                 <pre class="screen">
1.14      xtraeme  9461: <code class="prompt">#</code> <strong class=
                   9462: "userinput"><code>make clean-update</code></strong>
                   9463: <code class="prompt">#</code> <strong class=
                   9464: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
                   9465: <code class="prompt">#</code> <strong class=
                   9466: "userinput"><code>make update</code></strong>
1.1       grant    9467: </pre>
                   9468: 
                   9469:                 <p>The following variables can be used either on
1.14      xtraeme  9470:                 the command line or in <code class=
                   9471:                 "filename">/etc/mk.conf</code> to alter the
                   9472:                 behaviour of <span><strong class="command">make
                   9473:                 clean-update</strong></span>:</p>
1.1       grant    9474: 
                   9475:                 <div class="variablelist">
                   9476:                   <dl>
1.14      xtraeme  9477:                     <dt><span class="term"><code class=
                   9478:                     "varname">CLEAR_DIRLIST</code></span></dt>
1.1       grant    9479: 
                   9480:                     <dd>
1.14      xtraeme  9481:                       <p>After <span><strong class="command">make
                   9482:                       clean</strong></span>, do not reconstruct the
                   9483:                       list of directories to update for this
                   9484:                       package. Only use this if
                   9485:                       <span><strong class="command">make
                   9486:                       update</strong></span> successfully installed
                   9487:                       all packages you wanted to update. Normally,
                   9488:                       this is done automatically on
                   9489:                       <span><strong class="command">make
                   9490:                       update</strong></span>, but may have been
                   9491:                       suppressed by the <code class=
                   9492:                       "varname">NOCLEAN</code> variable (see
1.1       grant    9493:                       above).</p>
                   9494:                     </dd>
                   9495:                   </dl>
                   9496:                 </div>
                   9497:               </dd>
                   9498: 
                   9499:               <dt><span class="term">info</span></dt>
                   9500: 
                   9501:               <dd>
                   9502:                 <p>This target invokes <a href=
                   9503:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   9504:                 <span class="citerefentry"><span class=
                   9505:                 "refentrytitle">pkg_info</span>(1)</span></a> for
                   9506:                 the current package. You can use this to check
                   9507:                 which version of a package is installed.</p>
                   9508:               </dd>
                   9509: 
                   9510:               <dt><span class="term">readme</span></dt>
                   9511: 
                   9512:               <dd>
1.14      xtraeme  9513:                 <p>This target generates a <code class=
                   9514:                 "filename">README.html</code> file, which can be
1.1       grant    9515:                 viewed using a browser such as <a xmlns=
                   9516:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   9517:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20      ben      9518:                 class="pkgname">www/mozilla</a> or <a xmlns=
                   9519:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   9520:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
                   9521:                 class="pkgname">www/links</a>. The generated files
                   9522:                 contain references to any packages which are in the
                   9523:                 <code class="varname">PACKAGES</code> directory on
                   9524:                 the local host. The generated files can be made to
                   9525:                 refer to URLs based on <code class=
                   9526:                 "varname">FTP_PKG_URL_HOST</code> and <code class=
                   9527:                 "varname">FTP_PKG_URL_DIR</code>. For example, if I
                   9528:                 wanted to generate <code class=
                   9529:                 "filename">README.html</code> files which pointed
                   9530:                 to binary packages on the local machine, in the
                   9531:                 directory <code class=
                   9532:                 "filename">/usr/packages</code>, set <code class=
                   9533:                 "varname">FTP_PKG_URL_HOST=file://localhost</code>
                   9534:                 and <code class=
                   9535:                 "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
                   9536:                 <code class="varname">${PACKAGES}</code> directory
                   9537:                 and its subdirectories will be searched for all the
                   9538:                 binary packages.</p>
1.1       grant    9539:               </dd>
                   9540: 
                   9541:               <dt><span class="term">readme-all</span></dt>
                   9542: 
                   9543:               <dd>
1.14      xtraeme  9544:                 <p>Use this target to create a file <code class=
                   9545:                 "filename">README-all.html</code> which contains a
1.1       grant    9546:                 list of all packages currently available in the
                   9547:                 NetBSD Packages Collection, together with the
                   9548:                 category they belong to and a short description.
1.14      xtraeme  9549:                 This file is compiled from the <code class=
                   9550:                 "filename">pkgsrc/*/README.html</code> files, so be
1.1       grant    9551:                 sure to run this <span class=
1.14      xtraeme  9552:                 "emphasis"><em>after</em></span> a
                   9553:                 <span><strong class="command">make
                   9554:                 readme</strong></span>.</p>
1.1       grant    9555:               </dd>
                   9556: 
                   9557:               <dt><span class="term">cdrom-readme</span></dt>
                   9558: 
                   9559:               <dd>
                   9560:                 <p>This is very much the same as the
                   9561:                 &#8220;<span class="quote">readme</span>&#8221;
                   9562:                 target (see above), but is to be used when
                   9563:                 generating a pkgsrc tree to be written to a CD-ROM.
1.14      xtraeme  9564:                 This target also produces <code class=
                   9565:                 "filename">README.html</code> files, and can be
                   9566:                 made to refer to URLs based on <code class=
                   9567:                 "varname">CDROM_PKG_URL_HOST</code> and
                   9568:                 <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1       grant    9569:               </dd>
                   9570: 
                   9571:               <dt><span class="term">show-distfiles</span></dt>
                   9572: 
                   9573:               <dd>
                   9574:                 <p>This target shows which distfiles and patchfiles
1.14      xtraeme  9575:                 are needed to build the package. (<code class=
                   9576:                 "varname">DISTFILES</code> and <code class=
                   9577:                 "varname">PATCHFILES</code>, but not <code class=
                   9578:                 "filename">patches/*</code>)</p>
1.1       grant    9579:               </dd>
                   9580: 
                   9581:               <dt><span class="term">show-downlevel</span></dt>
                   9582: 
                   9583:               <dd>
                   9584:                 <p>This target shows nothing if the package is not
                   9585:                 installed. If a version of this package is
                   9586:                 installed, but is not the version provided in this
                   9587:                 version of pkgsrc, then a warning message is
                   9588:                 displayed. This target can be used to show which of
                   9589:                 your installed packages are downlevel, and so the
                   9590:                 old versions can be deleted, and the current ones
                   9591:                 added.</p>
                   9592:               </dd>
                   9593: 
                   9594:               <dt><span class="term">show-pkgsrc-dir</span></dt>
                   9595: 
                   9596:               <dd>
                   9597:                 <p>This target shows the directory in the pkgsrc
                   9598:                 hierarchy from which the package can be built and
                   9599:                 installed. This may not be the same directory as
                   9600:                 the one from which the package was installed. This
                   9601:                 target is intended to be used by people who may
                   9602:                 wish to upgrade many packages on a single host, and
                   9603:                 can be invoked from the top-level pkgsrc Makefile
                   9604:                 by using the &#8220;<span class=
                   9605:                 "quote">show-host-specific-pkgs</span>&#8221;
                   9606:                 target.</p>
                   9607:               </dd>
                   9608: 
                   9609:               <dt><span class=
                   9610:               "term">show-installed-depends</span></dt>
                   9611: 
                   9612:               <dd>
                   9613:                 <p>This target shows which installed packages match
1.14      xtraeme  9614:                 the current package's <code class=
                   9615:                 "varname">DEPENDS</code>. Useful if out of date
1.1       grant    9616:                 dependencies are causing build problems.</p>
                   9617:               </dd>
                   9618: 
                   9619:               <dt><span class="term">check-shlibs</span></dt>
                   9620: 
                   9621:               <dd>
                   9622:                 <p>After a package is installed, check all its
                   9623:                 binaries and (on ELF platforms) shared libraries to
                   9624:                 see if they find the shared libs they need. Run by
1.14      xtraeme  9625:                 default if <code class=
                   9626:                 "varname">PKG_DEVELOPER</code> is set in
                   9627:                 <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    9628:               </dd>
                   9629: 
                   9630:               <dt><span class="term">print-PLIST</span></dt>
                   9631: 
                   9632:               <dd>
                   9633:                 <p>After a &#8220;<span class="quote">make
                   9634:                 install</span>&#8221; from a new or upgraded pkg,
                   9635:                 this prints out an attempt to generate a new
1.14      xtraeme  9636:                 <code class="filename">PLIST</code> from a
                   9637:                 <span><strong class="command">find -newer
                   9638:                 work/.extract_done</strong></span>. An attempt is
                   9639:                 made to care for shared libs etc., but it is
1.1       grant    9640:                 <span class="emphasis"><em>strongly</em></span>
                   9641:                 recommended to review the result before putting it
1.14      xtraeme  9642:                 into <code class="filename">PLIST</code>. On
                   9643:                 upgrades, it's useful to diff the output of this
                   9644:                 command against an already existing <code class=
                   9645:                 "filename">PLIST</code> file.</p>
1.1       grant    9646: 
1.24      wiz      9647:                 <p>If the package installs files via <a href=
                   9648:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   9649:                 <span class="citerefentry"><span class=
                   9650:                 "refentrytitle">tar</span>(1)</span></a> or other
                   9651:                 methods that don't update file access times, be
                   9652:                 sure to add these files manually to your
1.14      xtraeme  9653:                 <code class="filename">PLIST</code>, as the
1.1       grant    9654:                 &#8220;<span class="quote">find
                   9655:                 -newer</span>&#8221; command used by this target
                   9656:                 won't catch them!</p>
                   9657: 
                   9658:                 <p>See <a href="#print-PLIST" title=
1.25      rillig   9659:                 "9.3.&nbsp;Tweaking output of make print-PLIST">Section&nbsp;9.3,
1.14      xtraeme  9660:                 &#8220;Tweaking output of <span><strong class=
                   9661:                 "command">make
                   9662:                 print-PLIST</strong></span>&#8221;</a> for more
                   9663:                 information on this target.</p>
1.1       grant    9664:               </dd>
                   9665: 
                   9666:               <dt><span class="term">bulk-package</span></dt>
                   9667: 
                   9668:               <dd>
                   9669:                 <p>Used to do bulk builds. If an appropriate binary
                   9670:                 package already exists, no action is taken. If not,
                   9671:                 this target will compile, install and package it
1.14      xtraeme  9672:                 (and it's depends, if <code class=
                   9673:                 "varname">PKG_DEPENDS</code> is set properly. See
1.1       grant    9674:                 <a href="#binary.configuration" title=
                   9675:                 "5.3.1.&nbsp;Configuration">Section&nbsp;5.3.1,
                   9676:                 &#8220;Configuration&#8221;</a>. After creating the
                   9677:                 binary package, the sources, the just-installed
                   9678:                 package and it's required packages are removed,
                   9679:                 preserving free disk space.</p>
                   9680: 
                   9681:                 <p><span class="emphasis"><em>Beware that this
                   9682:                 target may deinstall all packages installed on a
                   9683:                 system!</em></span></p>
                   9684:               </dd>
                   9685: 
                   9686:               <dt><span class="term">bulk-install</span></dt>
                   9687: 
                   9688:               <dd>
                   9689:                 <p>Used during bulk-installs to install required
                   9690:                 packages. If an upto-date binary package is
                   9691:                 available, it will be installed via <a href=
                   9692:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   9693:                 <span class="citerefentry"><span class=
                   9694:                 "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14      xtraeme  9695:                 not, <span><strong class="command">make
                   9696:                 bulk-package</strong></span> will be executed, but
                   9697:                 the installed binary not be removed.</p>
1.1       grant    9698: 
                   9699:                 <p>A binary package is considered
                   9700:                 &#8220;<span class="quote">upto-date</span>&#8221;
                   9701:                 to be installed via <a href=
                   9702:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   9703:                 <span class="citerefentry"><span class=
                   9704:                 "refentrytitle">pkg_add</span>(1)</span></a>
                   9705:                 if:</p>
                   9706: 
                   9707:                 <div class="itemizedlist">
                   9708:                   <ul type="disc">
                   9709:                     <li>
1.14      xtraeme  9710:                       <p>None of the package's files (<code class=
                   9711:                       "filename">Makefile</code>, ...) were
                   9712:                       modified since it was built.</p>
1.1       grant    9713:                     </li>
                   9714: 
                   9715:                     <li>
                   9716:                       <p>None of the package's required (binary)
                   9717:                       packages were modified since it was
                   9718:                       built.</p>
                   9719:                     </li>
                   9720:                   </ul>
                   9721:                 </div>
                   9722: 
                   9723:                 <p><span class="emphasis"><em>Beware that this
                   9724:                 target may deinstall all packages installed on a
                   9725:                 system!</em></span></p>
                   9726:               </dd>
                   9727:             </dl>
                   9728:           </div>
                   9729:         </div>
                   9730:       </div>
                   9731: 
                   9732:       <div class="chapter" lang="en" xml:lang="en">
                   9733:         <div class="titlepage">
                   9734:           <div>
                   9735:             <div>
                   9736:               <h2 class="title"><a name="fixes" id=
1.35    ! jmmv     9737:               "fixes"></a>Chapter&nbsp;14.&nbsp;Notes on fixes for
1.1       grant    9738:               packages</h2>
                   9739:             </div>
                   9740:           </div>
                   9741:         </div>
                   9742: 
                   9743:         <div class="toc">
                   9744:           <p><b>Table of Contents</b></p>
                   9745: 
                   9746:           <dl>
1.30      wiz      9747:             <dt><span class="sect1"><a href=
1.35    ! jmmv     9748:             "#general-operation">14.1. General
1.30      wiz      9749:             operation</a></span></dt>
1.1       grant    9750: 
                   9751:             <dd>
                   9752:               <dl>
                   9753:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9754:                 "#pulling-vars-from-etc-mk.conf">14.1.1. How to
1.30      wiz      9755:                 pull in variables from /etc/mk.conf</a></span></dt>
1.1       grant    9756: 
                   9757:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9758:                 "#where-to-install-documentation">14.1.2. Where to
1.31      wiz      9759:                 install documentation</a></span></dt>
                   9760: 
                   9761:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9762:                 "#restricted-packages">14.1.3. Restricted
1.1       grant    9763:                 packages</a></span></dt>
                   9764: 
                   9765:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9766:                 "#dependencies">14.1.4. Handling
1.1       grant    9767:                 dependencies</a></span></dt>
                   9768: 
                   9769:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9770:                 "#conflicts">14.1.5. Handling conflicts with other
1.1       grant    9771:                 packages</a></span></dt>
                   9772: 
                   9773:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9774:                 "#not-building-packages">14.1.6. Packages that
1.30      wiz      9775:                 cannot or should not be built</a></span></dt>
1.1       grant    9776: 
                   9777:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9778:                 "#undeletable-packages">14.1.7. Packages which
1.30      wiz      9779:                 should not be deleted, once
                   9780:                 installed</a></span></dt>
1.1       grant    9781: 
                   9782:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9783:                 "#security-handling">14.1.8. Handling packages with
1.1       grant    9784:                 security problems</a></span></dt>
                   9785: 
                   9786:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9787:                 "#compiler-bugs">14.1.9. How to handle compiler
1.1       grant    9788:                 bugs</a></span></dt>
                   9789: 
                   9790:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9791:                 "#bumping-pkgrevision">14.1.10. How to handle
1.30      wiz      9792:                 incrementing versions when fixing an existing
1.1       grant    9793:                 package</a></span></dt>
                   9794: 
                   9795:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9796:                 "#portability-of-packages">14.1.11. Portability of
1.1       grant    9797:                 packages</a></span></dt>
                   9798:               </dl>
                   9799:             </dd>
                   9800: 
1.30      wiz      9801:             <dt><span class="sect1"><a href=
1.35    ! jmmv     9802:             "#downloading-issues">14.2. Possible downloading
1.30      wiz      9803:             issues</a></span></dt>
1.1       grant    9804: 
                   9805:             <dd>
                   9806:               <dl>
                   9807:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9808:                 "#no-plain-download">14.2.1. Packages whose
1.30      wiz      9809:                 distfiles aren't available for plain
1.1       grant    9810:                 downloading</a></span></dt>
                   9811: 
                   9812:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9813:                 "#modified-distfiles-same-name">14.2.2. How to
1.30      wiz      9814:                 handle modified distfiles with the 'old'
                   9815:                 name</a></span></dt>
1.1       grant    9816:               </dl>
                   9817:             </dd>
                   9818: 
1.30      wiz      9819:             <dt><span class="sect1"><a href=
1.35    ! jmmv     9820:             "#configuration-gotchas">14.3. Configuration
1.30      wiz      9821:             gotchas</a></span></dt>
1.1       grant    9822: 
                   9823:             <dd>
                   9824:               <dl>
                   9825:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9826:                 "#fixes.libtool">14.3.1. Shared libraries -
1.1       grant    9827:                 libtool</a></span></dt>
                   9828: 
                   9829:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9830:                 "#using-libtool">14.3.2. Using libtool on GNU
1.30      wiz      9831:                 packages that already support
                   9832:                 libtool</a></span></dt>
1.1       grant    9833: 
                   9834:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9835:                 "#autoconf-automake">14.3.3. GNU
1.1       grant    9836:                 Autoconf/Automake</a></span></dt>
                   9837:               </dl>
                   9838:             </dd>
                   9839: 
1.30      wiz      9840:             <dt><span class="sect1"><a href=
1.35    ! jmmv     9841:             "#building-considerations">14.4. Building
1.30      wiz      9842:             considerations</a></span></dt>
1.1       grant    9843: 
                   9844:             <dd>
                   9845:               <dl>
                   9846:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9847:                 "#cpp-defines">14.4.1. CPP defines</a></span></dt>
1.1       grant    9848:               </dl>
                   9849:             </dd>
                   9850: 
1.30      wiz      9851:             <dt><span class="sect1"><a href=
1.35    ! jmmv     9852:             "#package-specific-actions">14.5. Package specific
1.30      wiz      9853:             actions</a></span></dt>
1.1       grant    9854: 
                   9855:             <dd>
                   9856:               <dl>
                   9857:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9858:                 "#user-interaction">14.5.1. User
1.2       hubertf  9859:                 interaction</a></span></dt>
1.1       grant    9860: 
                   9861:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9862:                 "#handling-licenses">14.5.2. Handling
1.1       grant    9863:                 licenses</a></span></dt>
                   9864: 
                   9865:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9866:                 "#installing-score-files">14.5.3. Installing score
1.1       grant    9867:                 files</a></span></dt>
                   9868: 
                   9869:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9870:                 "#perl-scripts">14.5.4. Packages containing perl
1.1       grant    9871:                 scripts</a></span></dt>
                   9872: 
                   9873:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9874:                 "#hardcoded-paths">14.5.5. Packages with hardcoded
1.30      wiz      9875:                 paths to other interpreters</a></span></dt>
1.1       grant    9876: 
                   9877:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9878:                 "#perl-modules">14.5.6. Packages installing perl
1.1       grant    9879:                 modules</a></span></dt>
                   9880: 
                   9881:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9882:                 "#faq.info-files">14.5.7. Packages installing info
1.1       grant    9883:                 files</a></span></dt>
                   9884: 
                   9885:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9886:                 "#gconf2-data-files">14.5.8. Packages installing
1.30      wiz      9887:                 GConf2 data files</a></span></dt>
1.1       grant    9888: 
                   9889:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9890:                 "#scrollkeeper-data-files">14.5.9. Packages
1.30      wiz      9891:                 installing scrollkeeper data files</a></span></dt>
1.1       grant    9892: 
                   9893:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9894:                 "#x11-fonts">14.5.10. Packages installing X11
1.1       grant    9895:                 fonts</a></span></dt>
                   9896: 
                   9897:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9898:                 "#gtk2-modules">14.5.11. Packages installing GTK2
1.1       grant    9899:                 modules</a></span></dt>
                   9900: 
                   9901:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9902:                 "#sgml-xml-data">14.5.12. Packages installing SGML
1.30      wiz      9903:                 or XML data</a></span></dt>
1.1       grant    9904: 
                   9905:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9906:                 "#mime-database">14.5.13. Packages installing
1.1       grant    9907:                 extensions to the MIME database</a></span></dt>
                   9908: 
                   9909:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9910:                 "#intltool">14.5.14. Packages using
1.1       grant    9911:                 intltool</a></span></dt>
1.18      xtraeme  9912: 
                   9913:                 <dt><span class="sect2"><a href=
1.35    ! jmmv     9914:                 "#startup-scripts">14.5.15. Packages installing
1.30      wiz      9915:                 startup scripts</a></span></dt>
1.1       grant    9916:               </dl>
                   9917:             </dd>
                   9918: 
1.30      wiz      9919:             <dt><span class="sect1"><a href=
1.35    ! jmmv     9920:             "#feedback-to-author">14.6. Feedback to the
1.30      wiz      9921:             author</a></span></dt>
1.1       grant    9922:           </dl>
                   9923:         </div>
                   9924: 
                   9925:         <div class="sect1" lang="en" xml:lang="en">
                   9926:           <div class="titlepage">
                   9927:             <div>
                   9928:               <div>
                   9929:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      9930:                 "general-operation" id=
1.35    ! jmmv     9931:                 "general-operation"></a>14.1.&nbsp;General
1.1       grant    9932:                 operation</h2>
                   9933:               </div>
                   9934:             </div>
                   9935:           </div>
                   9936: 
                   9937:           <div class="sect2" lang="en" xml:lang="en">
                   9938:             <div class="titlepage">
                   9939:               <div>
                   9940:                 <div>
1.30      wiz      9941:                   <h3 class="title"><a name=
                   9942:                   "pulling-vars-from-etc-mk.conf" id=
1.35    ! jmmv     9943:                   "pulling-vars-from-etc-mk.conf"></a>14.1.1.&nbsp;How
1.30      wiz      9944:                   to pull in variables from /etc/mk.conf</h3>
1.1       grant    9945:                 </div>
                   9946:               </div>
                   9947:             </div>
                   9948: 
                   9949:             <p>The problem with package-defined variables that can
1.14      xtraeme  9950:             be overridden via <code class="varname">MAKECONF</code>
                   9951:             or <code class="filename">/etc/mk.conf</code> is that
                   9952:             <a href=
1.1       grant    9953:             "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   9954:             <span class="citerefentry"><span class=
                   9955:             "refentrytitle">make</span>(1)</span></a> expands a
                   9956:             variable as it is used, but evaluates preprocessor like
                   9957:             statements (.if, .ifdef and .ifndef) as they are read.
1.14      xtraeme  9958:             So, to use any variable (which may be set in
                   9959:             <code class="filename">/etc/mk.conf</code>) in one of
                   9960:             the .if* statements, the file <code class=
                   9961:             "filename">/etc/mk.conf</code> must be included before
1.1       grant    9962:             that .if* statement.</p>
                   9963: 
                   9964:             <p>Rather than have a number of ad-hoc ways of
1.14      xtraeme  9965:             including <code class="filename">/etc/mk.conf</code>,
                   9966:             should it exist, or <code class=
                   9967:             "varname">MAKECONF</code>, should it exist, include the
                   9968:             <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
                   9969:             file in the package Makefile before any
                   9970:             preprocessor-like .if, .ifdef, or .ifndef
                   9971:             statements:</p>
1.1       grant    9972:             <pre class="programlisting">
                   9973: .include "../../mk/bsd.prefs.mk"
                   9974:     
                   9975:     .if defined(USE_MENUS)
                   9976:       ...
                   9977:     .endif
                   9978: </pre>
                   9979: 
1.14      xtraeme  9980:             <p>If you wish to set the <code class=
                   9981:             "varname">CFLAGS</code> variable in <code class=
                   9982:             "filename">/etc/mk.conf</code> please make sure to
1.1       grant    9983:             use:</p>
                   9984:             <pre class="programlisting">
                   9985: CFLAGS+=  -your -flags
                   9986: </pre>
                   9987: 
1.14      xtraeme  9988:             <p>Using <code class="varname">CFLAGS=</code> (i.e.
                   9989:             without the &#8220;<span class="quote">+</span>&#8221;)
                   9990:             may lead to problems with packages that need to add
                   9991:             their own flags. Also, you may want to take a look at
                   9992:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1       grant    9993:             href=
                   9994:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.20      ben      9995:             class="pkgname">devel/cpuflags</a> package if you're
                   9996:             interested in optimization for the current CPU.</p>
1.1       grant    9997:           </div>
                   9998: 
                   9999:           <div class="sect2" lang="en" xml:lang="en">
                   10000:             <div class="titlepage">
                   10001:               <div>
                   10002:                 <div>
1.31      wiz      10003:                   <h3 class="title"><a name=
                   10004:                   "where-to-install-documentation" id=
1.35    ! jmmv     10005:                   "where-to-install-documentation"></a>14.1.2.&nbsp;Where
1.31      wiz      10006:                   to install documentation</h3>
                   10007:                 </div>
                   10008:               </div>
                   10009:             </div>
                   10010: 
                   10011:             <p>Documentation should be installed into <code class=
                   10012:             "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
                   10013:             <code class=
                   10014:             "filename">${PREFIX}/share/doc/${PKGNAME}</code> (the
                   10015:             latter includes the version number of the package).</p>
                   10016:           </div>
                   10017: 
                   10018:           <div class="sect2" lang="en" xml:lang="en">
                   10019:             <div class="titlepage">
                   10020:               <div>
                   10021:                 <div>
1.30      wiz      10022:                   <h3 class="title"><a name="restricted-packages"
                   10023:                   id=
1.35    ! jmmv     10024:                   "restricted-packages"></a>14.1.3.&nbsp;Restricted
1.1       grant    10025:                   packages</h3>
                   10026:                 </div>
                   10027:               </div>
                   10028:             </div>
                   10029: 
                   10030:             <p>Some licenses restrict how software may be
                   10031:             re-distributed. In order to satisfy these restrictions,
                   10032:             the package system defines five make variables that can
                   10033:             be set to note these restrictions:</p>
                   10034: 
                   10035:             <div class="itemizedlist">
                   10036:               <ul type="disc">
                   10037:                 <li>
1.14      xtraeme  10038:                   <p><code class="varname">RESTRICTED</code></p>
1.1       grant    10039: 
                   10040:                   <p>This variable should be set whenever a
                   10041:                   restriction exists (regardless of its kind). Set
                   10042:                   this variable to a string containing the reason
                   10043:                   for the restriction.</p>
                   10044:                 </li>
                   10045: 
                   10046:                 <li>
1.14      xtraeme  10047:                   <p><code class=
                   10048:                   "varname">NO_BIN_ON_CDROM</code></p>
1.1       grant    10049: 
                   10050:                   <p>Binaries may not be placed on CD-ROM. Set this
1.14      xtraeme  10051:                   variable to <code class=
                   10052:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    10053:                   package may not be included on a CD-ROM.</p>
                   10054:                 </li>
                   10055: 
                   10056:                 <li>
1.14      xtraeme  10057:                   <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1       grant    10058: 
                   10059:                   <p>Binaries may not be placed on an FTP server.
1.14      xtraeme  10060:                   Set this variable to <code class=
                   10061:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    10062:                   package may not not be made available on the
                   10063:                   Internet.</p>
                   10064:                 </li>
                   10065: 
                   10066:                 <li>
1.14      xtraeme  10067:                   <p><code class=
                   10068:                   "varname">NO_SRC_ON_CDROM</code></p>
1.1       grant    10069: 
                   10070:                   <p>Distfiles may not be placed on CD-ROM. Set
1.14      xtraeme  10071:                   this variable to <code class=
                   10072:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    10073:                   of the source code or other distfile(s) is not
                   10074:                   allowed on CD-ROMs.</p>
                   10075:                 </li>
                   10076: 
                   10077:                 <li>
1.14      xtraeme  10078:                   <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1       grant    10079: 
                   10080:                   <p>Distfiles may not be placed on FTP. Set this
1.14      xtraeme  10081:                   variable to <code class=
                   10082:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    10083:                   of the source code or other distfile(s) via the
                   10084:                   Internet is not allowed.</p>
                   10085:                 </li>
                   10086:               </ul>
                   10087:             </div>
                   10088: 
1.14      xtraeme  10089:             <p>Please note that the use of <code class=
                   10090:             "varname">NO_PACKAGE</code>, <code class=
                   10091:             "varname">IGNORE</code>, <code class=
                   10092:             "varname">NO_CDROM</code>, or other generic make
1.1       grant    10093:             variables to denote restrictions is deprecated, because
                   10094:             they unconditionally prevent users from generating
                   10095:             binary packages!</p>
                   10096:           </div>
                   10097: 
                   10098:           <div class="sect2" lang="en" xml:lang="en">
                   10099:             <div class="titlepage">
                   10100:               <div>
                   10101:                 <div>
                   10102:                   <h3 class="title"><a name="dependencies" id=
1.35    ! jmmv     10103:                   "dependencies"></a>14.1.4.&nbsp;Handling
1.1       grant    10104:                   dependencies</h3>
                   10105:                 </div>
                   10106:               </div>
                   10107:             </div>
                   10108: 
                   10109:             <p>Your package may depend on some other package being
                   10110:             present - and there are various ways of expressing this
1.14      xtraeme  10111:             dependency. pkgsrc supports the <code class=
                   10112:             "varname">BUILD_DEPENDS</code> and <code class=
                   10113:             "varname">DEPENDS</code> definitions, as well as
                   10114:             dependencies via <code class=
                   10115:             "filename">buildlink3.mk</code>, which is the preferred
1.1       grant    10116:             way to handle dependencies, and which uses the
                   10117:             variables named above. See <a href="#buildlink" title=
1.25      rillig   10118:             "Chapter&nbsp;10.&nbsp;Buildlink methodology">Chapter&nbsp;10,
1.1       grant    10119:             <i>Buildlink methodology</i></a> for more
                   10120:             information.</p>
                   10121: 
                   10122:             <p>The basic difference between the two variables is as
1.14      xtraeme  10123:             follows: The <code class="varname">DEPENDS</code>
1.1       grant    10124:             definition registers that pre-requisite in the binary
                   10125:             package so it will be pulled in when the binary package
1.14      xtraeme  10126:             is later installed, whilst the <code class=
                   10127:             "varname">BUILD_DEPENDS</code> definition does not,
1.1       grant    10128:             marking a dependency that is only needed for building
                   10129:             the package.</p>
                   10130: 
                   10131:             <p>This means that if you only need a package present
                   10132:             whilst you are building, it should be noted as a
1.14      xtraeme  10133:             <code class="varname">BUILD_DEPENDS</code>.</p>
1.1       grant    10134: 
1.14      xtraeme  10135:             <p>The format for a <code class=
                   10136:             "varname">BUILD_DEPENDS</code> and a <code class=
                   10137:             "varname">DEPENDS</code> definition is:</p>
1.1       grant    10138:             <pre class="programlisting">
                   10139: &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
                   10140: </pre>
                   10141: 
                   10142:             <p>Please note that the &#8220;<span class=
                   10143:             "quote">pre-req-package-name</span>&#8221; may include
1.18      xtraeme  10144:             any of the wildcard version numbers recognized by
1.1       grant    10145:             <a href=
                   10146:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   10147:             <span class="citerefentry"><span class=
                   10148:             "refentrytitle">pkg_info</span>(1)</span></a>.</p>
                   10149: 
                   10150:             <div class="orderedlist">
                   10151:               <ol type="1">
                   10152:                 <li>
                   10153:                   <p>If your package needs another package's
                   10154:                   binaries or libraries to build or run, and if
1.14      xtraeme  10155:                   that package has a <code class=
                   10156:                   "filename">buildlink3.mk</code> file available,
                   10157:                   use it:</p>
1.1       grant    10158:                   <pre class="programlisting">
                   10159:     .include "../../graphics/jpeg/buildlink3.mk"
                   10160:     
                   10161: </pre>
                   10162:                 </li>
                   10163: 
                   10164:                 <li>
                   10165:                   <p>If your package needs to use another package
1.14      xtraeme  10166:                   to build itself and there is no <code class=
                   10167:                   "filename">buildlink3.mk</code> file available,
                   10168:                   use the <code class=
                   10169:                   "varname">BUILD_DEPENDS</code> definition:</p>
1.1       grant    10170:                   <pre class="programlisting">
                   10171: BUILD_DEPENDS+=  autoconf-2.13:../../devel/autoconf
                   10172: </pre>
                   10173:                 </li>
                   10174: 
                   10175:                 <li>
                   10176:                   <p>If your package needs a library with which to
1.14      xtraeme  10177:                   link and again there is no <code class=
                   10178:                   "filename">buildlink3.mk</code> file available,
                   10179:                   this is specified using the <code class=
                   10180:                   "varname">DEPENDS</code> definition. An example
                   10181:                   of this is the <a xmlns=
1.1       grant    10182:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   10183:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20      ben      10184:                   class="pkgname">print/lyx</a> package, which uses
                   10185:                   the xpm library, version 3.4j to build:</p>
1.1       grant    10186:                   <pre class="programlisting">
                   10187: DEPENDS+=       xpm-3.4j:../../graphics/xpm
                   10188: </pre>
                   10189: 
                   10190:                   <p>You can also use wildcards in package
                   10191:                   dependences:</p>
                   10192:                   <pre class="programlisting">
                   10193: DEPENDS+=       xpm-[0-9]*:../../graphics/xpm
                   10194: </pre>
                   10195: 
                   10196:                   <p>Note that such wildcard dependencies are
                   10197:                   retained when creating binary packages. The
                   10198:                   dependency is checked when installing the binary
                   10199:                   package and any package which matches the pattern
                   10200:                   will be used. Wildcard dependencies should be
                   10201:                   used with care.</p>
                   10202: 
                   10203:                   <p>The &#8220;<span class=
                   10204:                   "quote">-[0-9]*</span>&#8221; should be used
                   10205:                   instead of &#8220;<span class=
                   10206:                   "quote">-*</span>&#8221; to avoid potentially
                   10207:                   ambiguous matches such as &#8220;<span class=
                   10208:                   "quote">tk-postgresql</span>&#8221; matching a
                   10209:                   &#8220;<span class="quote">tk-*</span>&#8221;
1.14      xtraeme  10210:                   <code class="varname">DEPENDS</code>.</p>
1.1       grant    10211: 
                   10212:                   <p>Wildcards can also be used to specify that a
                   10213:                   package will only build against a certain minimum
                   10214:                   version of a pre-requisite:</p>
                   10215:                   <pre class="programlisting">
                   10216: DEPENDS+=       tiff&gt;=3.5.4:../../graphics/tiff
                   10217: </pre>
                   10218: 
                   10219:                   <p>This means that the package will build against
                   10220:                   version 3.5.4 of the tiff library or newer. Such
                   10221:                   a dependency may be warranted if, for example,
                   10222:                   the API of the library has changed with version
                   10223:                   3.5.4 and a package would not compile against an
                   10224:                   earlier version of tiff.</p>
                   10225: 
                   10226:                   <p>Please note that such dependencies should only
                   10227:                   be updated if a package requires a newer
                   10228:                   pre-requisite, but not to denote recommendations
                   10229:                   such as security updates or ABI changes that do
                   10230:                   not prevent a package from building correctly.
                   10231:                   Such recommendations can be expressed using
1.14      xtraeme  10232:                   <code class="varname">RECOMMENDED</code>:</p>
1.1       grant    10233:                   <pre class="programlisting">
                   10234: RECOMMENDED+=   tiff&gt;=3.6.1:../../graphics/tiff
                   10235: </pre>
                   10236: 
1.14      xtraeme  10237:                   <p>In addition to the above <code class=
                   10238:                   "varname">DEPENDS</code> line, this denotes that
1.1       grant    10239:                   while a package will build against
                   10240:                   tiff&gt;=3.5.4, at least version 3.6.1 is
1.14      xtraeme  10241:                   recommended. <code class=
                   10242:                   "varname">RECOMMENDED</code> entries will be
                   10243:                   turned into dependencies unless explicitly
                   10244:                   ignored (in which case a warning will be
                   10245:                   printed). Packages that are built with
1.1       grant    10246:                   recommendations ignored may not be uploaded to
                   10247:                   ftp.NetBSD.org by developers and should not be
                   10248:                   used across different systems that may have
                   10249:                   different versions of binary packages
                   10250:                   installed.</p>
                   10251: 
                   10252:                   <p>For security fixes, please update the package
                   10253:                   vulnerabilities file as well as setting
1.14      xtraeme  10254:                   <code class="varname">RECOMMENDED</code>, see
1.1       grant    10255:                   <a href="#security-handling" title=
1.35    ! jmmv     10256:                   "14.1.8.&nbsp;Handling packages with security problems">
        !          10257:                   Section 14.1.8, &#8220;Handling packages with
1.1       grant    10258:                   security problems&#8221;</a> for more
                   10259:                   information.</p>
                   10260:                 </li>
                   10261: 
                   10262:                 <li>
                   10263:                   <p>If your package needs some executable to be
1.17      sketch   10264:                   able to run correctly and if there's no
1.14      xtraeme  10265:                   <code class="filename">buildlink3.mk</code> file,
                   10266:                   this is specified using the <code class=
                   10267:                   "varname">DEPENDS</code> variable. The <a xmlns=
1.1       grant    10268:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   10269:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20      ben      10270:                   class="pkgname">print/lyx</a> package needs to be
                   10271:                   able to execute the latex binary from the teTeX
                   10272:                   package when it runs, and that is specified:</p>
1.1       grant    10273:                   <pre class="programlisting">
                   10274: DEPENDS+=        teTeX-[0-9]*:../../print/teTeX
                   10275: </pre>
                   10276: 
                   10277:                   <p>The comment about wildcard dependencies from
                   10278:                   previous paragraph applies here, too.</p>
                   10279:                 </li>
                   10280:               </ol>
                   10281:             </div>
                   10282: 
                   10283:             <p>If your package needs files from another package to
                   10284:             build, see the first part of the &#8220;<span class=
                   10285:             "quote">do-configure</span>&#8221; target <a xmlns=
                   10286:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10287:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.20      ben      10288:             class="pkgname">print/ghostscript5</a> package (it
                   10289:             relies on the jpeg sources being present in source form
                   10290:             during the build):</p>
1.1       grant    10291:             <pre class="programlisting">
                   10292: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
                   10293:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} extract;              \
                   10294:     fi
                   10295: </pre>
                   10296: 
                   10297:             <p>If you build any other packages that way, please
                   10298:             make sure the working files are deleted too when this
                   10299:             package's working files are cleaned up. The easiest way
                   10300:             to do so is by adding a pre-clean target:</p>
                   10301:             <pre class="programlisting">
                   10302: pre-clean:
                   10303:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} clean
                   10304: </pre>
                   10305: 
1.14      xtraeme  10306:             <p>Please also note the <code class=
                   10307:             "varname">BUILD_USES_MSGFMT</code> and <code class=
                   10308:             "varname">BUILD_USES_GETTEXT_M4</code> definitions,
                   10309:             which are provided as convenience definitions. The
1.24      wiz      10310:             former works out whether <a href=
                   10311:             "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
                   10312:             <span class="citerefentry"><span class=
                   10313:             "refentrytitle">msgfmt</span>(1)</span></a> is part of
                   10314:             the base system, and, if it isn't, installs the
                   10315:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10316:             href=
1.1       grant    10317:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.20      ben      10318:             class="pkgname">devel/gettext</a> package. The latter
                   10319:             adds a build dependency on either an installed version
                   10320:             of an older gettext package, or if it isn't, installs
                   10321:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10322:             href=
                   10323:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
                   10324:             class="pkgname">devel/gettext-m4</a> package.</p>
1.1       grant    10325:           </div>
                   10326: 
                   10327:           <div class="sect2" lang="en" xml:lang="en">
                   10328:             <div class="titlepage">
                   10329:               <div>
                   10330:                 <div>
1.30      wiz      10331:                   <h3 class="title"><a name="conflicts" id=
1.35    ! jmmv     10332:                   "conflicts"></a>14.1.5.&nbsp;Handling conflicts
1.1       grant    10333:                   with other packages</h3>
                   10334:                 </div>
                   10335:               </div>
                   10336:             </div>
                   10337: 
                   10338:             <p>Your package may conflict with other packages a user
                   10339:             might already have installed on his system, e.g. if
                   10340:             your package installs the same set of files like
                   10341:             another package in our pkgsrc tree.</p>
                   10342: 
1.14      xtraeme  10343:             <p>In this case you can set <code class=
                   10344:             "varname">CONFLICTS</code> to a space separated list of
1.1       grant    10345:             packages (including version string) your package
                   10346:             conflicts with.</p>
                   10347: 
                   10348:             <p>For example <a xmlns=
                   10349:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10350:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.20      ben      10351:             class="pkgname">x11/Xaw3d</a> and <a xmlns=
                   10352:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10353:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
                   10354:             class="pkgname">x11/Xaw-Xpm</a> install provide the
                   10355:             same shared library, thus you set in <code class=
                   10356:             "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1       grant    10357:             <pre class="programlisting">
                   10358: CONFLICTS=      Xaw-Xpm-[0-9]*
                   10359: </pre>
                   10360: 
1.14      xtraeme  10361:             <p>and in <code class=
                   10362:             "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1       grant    10363:             <pre class="programlisting">
                   10364: CONFLICTS=      Xaw3d-[0-9]*
                   10365: </pre>
                   10366: 
                   10367:             <p>Packages will automatically conflict with other
                   10368:             packages with the name prefix and a different version
                   10369:             string. &#8220;<span class=
                   10370:             "quote">Xaw3d-1.5</span>&#8221; e.g. will automatically
                   10371:             conflict with the older version &#8220;<span class=
                   10372:             "quote">Xaw3d-1.3</span>&#8221;.</p>
                   10373:           </div>
                   10374: 
                   10375:           <div class="sect2" lang="en" xml:lang="en">
                   10376:             <div class="titlepage">
                   10377:               <div>
                   10378:                 <div>
1.30      wiz      10379:                   <h3 class="title"><a name="not-building-packages"
                   10380:                   id=
1.35    ! jmmv     10381:                   "not-building-packages"></a>14.1.6.&nbsp;Packages
1.30      wiz      10382:                   that cannot or should not be built</h3>
1.1       grant    10383:                 </div>
                   10384:               </div>
                   10385:             </div>
                   10386: 
                   10387:             <p>There are several reasons why a package might be
                   10388:             instructed to not build under certain circumstances. If
                   10389:             the package builds and runs on most platforms, the
1.14      xtraeme  10390:             exceptions should be noted with <code class=
                   10391:             "varname">NOT_FOR_PLATFORM</code>. If the package
                   10392:             builds and runs on a small handful of platforms, set
                   10393:             <code class="varname">ONLY_FOR_PLATFORM</code> instead.
                   10394:             If the package should be skipped (for example, because
                   10395:             it provides functionality already provided by the
                   10396:             system), set <code class=
                   10397:             "varname">PKG_SKIP_REASON</code> to a descriptive
                   10398:             message. If the package should fail because some
                   10399:             preconditions are not met, set <code class=
                   10400:             "varname">PKG_FAIL_REASON</code> to a descriptive
1.1       grant    10401:             message.</p>
                   10402: 
1.14      xtraeme  10403:             <p><code class="varname">IGNORE</code> is deprecated
1.1       grant    10404:             because it didn't provide enough information to
                   10405:             determine whether the build should fail.</p>
                   10406:           </div>
                   10407: 
                   10408:           <div class="sect2" lang="en" xml:lang="en">
                   10409:             <div class="titlepage">
                   10410:               <div>
                   10411:                 <div>
1.30      wiz      10412:                   <h3 class="title"><a name="undeletable-packages"
                   10413:                   id=
1.35    ! jmmv     10414:                   "undeletable-packages"></a>14.1.7.&nbsp;Packages
1.30      wiz      10415:                   which should not be deleted, once installed</h3>
1.1       grant    10416:                 </div>
                   10417:               </div>
                   10418:             </div>
                   10419: 
                   10420:             <p>To ensure that a package may not be deleted, once it
1.14      xtraeme  10421:             has been installed, the <code class=
                   10422:             "varname">PKG_PRESERVE</code> definition should be set
                   10423:             in the package Makefile. This will be carried into any
1.1       grant    10424:             binary package that is made from this pkgsrc entry. A
                   10425:             &#8220;<span class="quote">preserved</span>&#8221;
                   10426:             package will not be deleted using <a href=
                   10427:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   10428:             <span class="citerefentry"><span class=
                   10429:             "refentrytitle">pkg_delete</span>(1)</span></a> unless
                   10430:             the &#8220;<span class="quote">-f</span>&#8221; option
                   10431:             is used.</p>
                   10432:           </div>
                   10433: 
                   10434:           <div class="sect2" lang="en" xml:lang="en">
                   10435:             <div class="titlepage">
                   10436:               <div>
                   10437:                 <div>
                   10438:                   <h3 class="title"><a name="security-handling" id=
1.35    ! jmmv     10439:                   "security-handling"></a>14.1.8.&nbsp;Handling
1.1       grant    10440:                   packages with security problems</h3>
                   10441:                 </div>
                   10442:               </div>
                   10443:             </div>
                   10444: 
                   10445:             <p>When a vulnerability is found, this should be noted
1.14      xtraeme  10446:             in <code class=
                   10447:             "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.1       grant    10448:             and after the commit of that file, it should be copied
1.14      xtraeme  10449:             to both <code class=
                   10450:             "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</code>
                   10451:             and <code class=
                   10452:             "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</code>
                   10453:             on ftp.NetBSD.org using <code class=
                   10454:             "filename">localsrc/security/advisories/Makefile</code>.
                   10455:             In addition, if a <code class=
                   10456:             "filename">buildlink3.mk</code> file exists for an
                   10457:             affected package, bumping <code class=
                   10458:             "varname">PKGREVISION</code> and creating a
                   10459:             corresponding <code class=
                   10460:             "varname">BUILDLINK_RECOMMENDED.<em class=
                   10461:             "replaceable"><code>pkg</code></em></code> entry should
                   10462:             be considered. See <a href="#buildlink" title=
1.25      rillig   10463:             "Chapter&nbsp;10.&nbsp;Buildlink methodology">Chapter&nbsp;10,
1.1       grant    10464:             <i>Buildlink methodology</i></a> for more information
1.14      xtraeme  10465:             about writing <code class=
                   10466:             "filename">buildlink3.mk</code> files and <code class=
                   10467:             "varname">BUILDLINK_*</code> definitions.</p>
1.1       grant    10468: 
                   10469:             <p>Also, if the fix should be applied to the stable
                   10470:             pkgsrc branch, be sure to submit a pullup request!</p>
                   10471:           </div>
                   10472: 
                   10473:           <div class="sect2" lang="en" xml:lang="en">
                   10474:             <div class="titlepage">
                   10475:               <div>
                   10476:                 <div>
1.30      wiz      10477:                   <h3 class="title"><a name="compiler-bugs" id=
1.35    ! jmmv     10478:                   "compiler-bugs"></a>14.1.9.&nbsp;How to handle
1.1       grant    10479:                   compiler bugs</h3>
                   10480:                 </div>
                   10481:               </div>
                   10482:             </div>
                   10483: 
                   10484:             <p>Some source files trigger bugs in the compiler,
                   10485:             based on combinations of compiler version and
                   10486:             architecture and almost always relation to optimisation
                   10487:             being enabled. Common symptoms are gcc internal errors
                   10488:             or never finishing compiling a file.</p>
                   10489: 
                   10490:             <p>Typically a workaround involves testing the
1.14      xtraeme  10491:             <code class="varname">MACHINE_ARCH</code> and compiler
1.1       grant    10492:             version, disabling optimisation for that
1.14      xtraeme  10493:             file/<code class="varname">MACHINE_ARCH</code>/compiler
                   10494:             combination, and documenting it in <code class=
                   10495:             "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1       grant    10496:             number of examples!</p>
                   10497:           </div>
                   10498: 
                   10499:           <div class="sect2" lang="en" xml:lang="en">
                   10500:             <div class="titlepage">
                   10501:               <div>
                   10502:                 <div>
1.30      wiz      10503:                   <h3 class="title"><a name="bumping-pkgrevision"
1.35    ! jmmv     10504:                   id="bumping-pkgrevision"></a>14.1.10.&nbsp;How to
1.30      wiz      10505:                   handle incrementing versions when fixing an
                   10506:                   existing package</h3>
1.1       grant    10507:                 </div>
                   10508:               </div>
                   10509:             </div>
                   10510: 
                   10511:             <p>When making fixes to an existing package it can be
1.14      xtraeme  10512:             useful to change the version number in <code class=
                   10513:             "varname">PKGNAME</code>. To avoid conflicting with
1.1       grant    10514:             future versions by the original author, a
                   10515:             &#8220;<span class="quote">nb1</span>&#8221;,
                   10516:             &#8220;<span class="quote">nb2</span>&#8221;, ...
                   10517:             suffix can be used on package versions by setting
1.14      xtraeme  10518:             <code class="varname">PKGREVISION=1</code> (2, ...).
                   10519:             The &#8220;<span class="quote">nb</span>&#8221; is
                   10520:             treated like a &#8220;<span class=
                   10521:             "quote">.</span>&#8221; by the pkg tools. e.g.</p>
1.1       grant    10522:             <pre class="programlisting">
                   10523:   DISTNAME= foo-17.42
                   10524:     PKGREVISION=  9
                   10525: </pre>
                   10526: 
1.14      xtraeme  10527:             <p>will result in a <code class=
                   10528:             "varname">PKGNAME</code> of &#8220;<span class=
1.1       grant    10529:             "quote">foo-17.42nb9</span>&#8221;.</p>
                   10530: 
                   10531:             <p>When a new release of the package is released, the
1.14      xtraeme  10532:             <code class="varname">PKGREVISION</code> should be
                   10533:             removed. e.g. on a new minor release of the above
                   10534:             package, things should be like:</p>
1.1       grant    10535:             <pre class="programlisting">
                   10536: DISTNAME=   foo-17.43
                   10537: </pre>
                   10538:           </div>
                   10539: 
                   10540:           <div class="sect2" lang="en" xml:lang="en">
                   10541:             <div class="titlepage">
                   10542:               <div>
                   10543:                 <div>
1.30      wiz      10544:                   <h3 class="title"><a name=
                   10545:                   "portability-of-packages" id=
1.35    ! jmmv     10546:                   "portability-of-packages"></a>14.1.11.&nbsp;Portability
1.30      wiz      10547:                   of packages</h3>
1.1       grant    10548:                 </div>
                   10549:               </div>
                   10550:             </div>
                   10551: 
                   10552:             <p>One appealing feature of pkgsrc is that it runs on
                   10553:             many different platforms. As a result, it is important
                   10554:             to ensure, where possible, that packages in pkgsrc are
                   10555:             portable. There are some particular details you should
                   10556:             pay attention to while working on pkgsrc.</p>
                   10557: 
                   10558:             <div class="sect3" lang="en" xml:lang="en">
                   10559:               <div class="titlepage">
                   10560:                 <div>
                   10561:                   <div>
1.30      wiz      10562:                     <h4 class="title"><a name="install-scripts" id=
1.35    ! jmmv     10563:                     "install-scripts"></a>14.1.11.1.&nbsp;${INSTALL},
1.1       grant    10564:                     ${INSTALL_DATA_DIR}, ...</h4>
                   10565:                   </div>
                   10566:                 </div>
                   10567:               </div>
                   10568: 
1.14      xtraeme  10569:               <p>The BSD-compatible <span><strong class=
                   10570:               "command">install</strong></span> supplied with some
1.1       grant    10571:               operating systems will not perform more than one
                   10572:               operation at a time. As such, you should call
                   10573:               &#8220;<span class="quote">${INSTALL}</span>&#8221;,
                   10574:               etc. like this:</p>
                   10575:               <pre class="programlisting">
                   10576: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   10577: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
                   10578: </pre>
                   10579:             </div>
                   10580:           </div>
                   10581:         </div>
                   10582: 
                   10583:         <div class="sect1" lang="en" xml:lang="en">
                   10584:           <div class="titlepage">
                   10585:             <div>
                   10586:               <div>
                   10587:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      10588:                 "downloading-issues" id=
1.35    ! jmmv     10589:                 "downloading-issues"></a>14.2.&nbsp;Possible
1.1       grant    10590:                 downloading issues</h2>
                   10591:               </div>
                   10592:             </div>
                   10593:           </div>
                   10594: 
                   10595:           <div class="sect2" lang="en" xml:lang="en">
                   10596:             <div class="titlepage">
                   10597:               <div>
                   10598:                 <div>
1.30      wiz      10599:                   <h3 class="title"><a name="no-plain-download" id=
1.35    ! jmmv     10600:                   "no-plain-download"></a>14.2.1.&nbsp;Packages
1.30      wiz      10601:                   whose distfiles aren't available for plain
1.1       grant    10602:                   downloading</h3>
                   10603:                 </div>
                   10604:               </div>
                   10605:             </div>
                   10606: 
                   10607:             <p>If you need to download from a dynamic URL you can
1.14      xtraeme  10608:             set <code class="varname">DYNAMIC_MASTER_SITES</code>
                   10609:             and a <span><strong class="command">make
                   10610:             fetch</strong></span> will call <code class=
                   10611:             "filename">files/getsite.sh</code> with the name of
                   10612:             each file to download as an argument, expecting it to
                   10613:             output the URL of the directory from which to download
                   10614:             it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10615:             href=
1.1       grant    10616:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.20      ben      10617:             class="pkgname">graphics/ns-cult3d</a> is an example of
                   10618:             this usage.</p>
1.1       grant    10619: 
                   10620:             <p>If the download can't be automated, because the user
                   10621:             must submit personal information to apply for a
                   10622:             password, or must pay for the source, or whatever, you
1.14      xtraeme  10623:             can set <code class="varname">_FETCH_MESSAGE</code> to
                   10624:             a macro which displays a message explaining the
                   10625:             situation. <code class="varname">_FETCH_MESSAGE</code>
                   10626:             must be executable shell commands, not just a message.
                   10627:             (Generally, it executes <code class=
                   10628:             "varname">${ECHO}</code>). As of this writing, the
1.1       grant    10629:             following packages use this: <a xmlns=
                   10630:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10631:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.20      ben      10632:             class="pkgname">audio/realplayer</a>, <a xmlns=
                   10633:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10634:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
                   10635:             class="pkgname">cad/simian</a>, <a xmlns=
                   10636:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10637:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
                   10638:             class="pkgname">devel/ipv6socket</a>, <a xmlns=
                   10639:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10640:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
                   10641:             class="pkgname">emulators/vmware-module</a>, <a xmlns=
                   10642:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10643:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
                   10644:             class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
                   10645:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10646:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
                   10647:             class="pkgname">sysutils/storage-manager</a>, <a xmlns=
                   10648:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10649:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
                   10650:             class="pkgname">www/ap-aolserver</a>, <a xmlns=
                   10651:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10652:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
                   10653:             class="pkgname">www/openacs</a>. Try to be consistent
                   10654:             with them.</p>
1.1       grant    10655:           </div>
                   10656: 
                   10657:           <div class="sect2" lang="en" xml:lang="en">
                   10658:             <div class="titlepage">
                   10659:               <div>
                   10660:                 <div>
1.30      wiz      10661:                   <h3 class="title"><a name=
                   10662:                   "modified-distfiles-same-name" id=
1.35    ! jmmv     10663:                   "modified-distfiles-same-name"></a>14.2.2.&nbsp;How
1.30      wiz      10664:                   to handle modified distfiles with the 'old'
                   10665:                   name</h3>
1.1       grant    10666:                 </div>
                   10667:               </div>
                   10668:             </div>
                   10669: 
                   10670:             <p>Sometimes authors of a software package make some
                   10671:             modifications after the software was released, and they
                   10672:             put up a new distfile without changing the package's
                   10673:             version number. If a package is already in pkgsrc at
1.32      wiz      10674:             that time, the checksum will no longer match. The
                   10675:             contents of the new distfile should be compared against
                   10676:             the old one before changing anything, to make sure the
                   10677:             distfile was really updated on purpose, and that no
                   10678:             trojan horse or so crept in. Then, the correct way to
                   10679:             work around this is to set <code class=
                   10680:             "varname">DIST_SUBDIR</code> to a unique directory
                   10681:             name, usually based on <code class=
                   10682:             "varname">PKGNAME_NOREV</code>. In case this happens
                   10683:             more often, <code class="varname">PKGNAME</code> can be
                   10684:             used (thus including the <code class=
                   10685:             "filename">nbX</code> suffix) or a date stamp can be
                   10686:             appended, like <code class=
                   10687:             "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
                   10688:             forget regenerating the <code class=
                   10689:             "filename">distinfo</code> file after that, since it
                   10690:             contains the <code class="varname">DIST_SUBDIR</code>
                   10691:             path in the filenames. Furthermore, a mail to the
                   10692:             package's authors seems appropriate telling them that
                   10693:             changing distfiles after releases without changing the
                   10694:             file names is not good practice.</p>
1.1       grant    10695:           </div>
                   10696:         </div>
                   10697: 
                   10698:         <div class="sect1" lang="en" xml:lang="en">
                   10699:           <div class="titlepage">
                   10700:             <div>
                   10701:               <div>
                   10702:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      10703:                 "configuration-gotchas" id=
1.35    ! jmmv     10704:                 "configuration-gotchas"></a>14.3.&nbsp;Configuration
1.1       grant    10705:                 gotchas</h2>
                   10706:               </div>
                   10707:             </div>
                   10708:           </div>
                   10709: 
                   10710:           <div class="sect2" lang="en" xml:lang="en">
                   10711:             <div class="titlepage">
                   10712:               <div>
                   10713:                 <div>
                   10714:                   <h3 class="title"><a name="fixes.libtool" id=
1.35    ! jmmv     10715:                   "fixes.libtool"></a>14.3.1.&nbsp;Shared libraries
1.1       grant    10716:                   - libtool</h3>
                   10717:                 </div>
                   10718:               </div>
                   10719:             </div>
                   10720: 
                   10721:             <p>pkgsrc supports many different machines, with
                   10722:             different object formats like a.out and ELF, and
                   10723:             varying abilities to do shared library and dynamic
                   10724:             loading at all. To accompany this, varying commands and
                   10725:             options have to be passed to the compiler, linker, etc.
                   10726:             to get the Right Thing, which can be pretty annoying
                   10727:             especially if you don't have all the machines at your
                   10728:             hand to test things. The <a xmlns=
                   10729:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   10730:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.20      ben      10731:             class="pkgname">devel/libtool</a> pkg can help here, as
                   10732:             it just &#8220;<span class="quote">knows</span>&#8221;
                   10733:             how to build both static and dynamic libraries from a
                   10734:             set of source files, thus being platform
                   10735:             independent.</p>
1.1       grant    10736: 
                   10737:             <p>Here's how to use libtool in a pkg in seven simple
                   10738:             steps:</p>
                   10739: 
                   10740:             <div class="orderedlist">
                   10741:               <ol type="1">
                   10742:                 <li>
1.14      xtraeme  10743:                   <p>Add <code class=
                   10744:                   "varname">USE_LIBTOOL=yes</code> to the package
                   10745:                   Makefile.</p>
1.1       grant    10746:                 </li>
                   10747: 
                   10748:                 <li>
                   10749:                   <p>For library objects, use &#8220;<span class=
                   10750:                   "quote">${LIBTOOL} --mode=compile
                   10751:                   ${CC}</span>&#8221; in place of
                   10752:                   &#8220;<span class="quote">${CC}</span>&#8221;.
                   10753:                   You could even add it to the definition of
1.14      xtraeme  10754:                   <code class="varname">CC</code>, if only
                   10755:                   libraries are being built in a given Makefile.
                   10756:                   This one command will build both PIC and non-PIC
                   10757:                   library objects, so you need not have separate
                   10758:                   shared and non-shared library rules.</p>
1.1       grant    10759:                 </li>
                   10760: 
                   10761:                 <li>
                   10762:                   <p>For the linking of the library, remove any
                   10763:                   &#8220;<span class="quote">ar</span>&#8221;,
                   10764:                   &#8220;<span class="quote">ranlib</span>&#8221;,
                   10765:                   and &#8220;<span class="quote">ld
                   10766:                   -Bshareable</span>&#8221; commands, and instead
                   10767:                   use:</p>
                   10768:                   <pre class="programlisting">
                   10769: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
                   10770: </pre>
                   10771: 
                   10772:                   <p>Note that the library is changed to have a
1.14      xtraeme  10773:                   <code class="filename">.la</code> extension, and
                   10774:                   the objects are changed to have a <code class=
                   10775:                   "filename">.lo</code> extension. Change
                   10776:                   <code class="varname">OBJS</code> as necessary.
                   10777:                   This automatically creates all of the
                   10778:                   <code class="filename">.a</code>, <code class=
                   10779:                   "filename">.so.major.minor</code>, and ELF
                   10780:                   symlinks (if necessary) in the build directory.
                   10781:                   Be sure to include &#8220;<span class=
1.1       grant    10782:                   "quote">-version-info</span>&#8221;, especially
                   10783:                   when major and minor are zero, as libtool will
                   10784:                   otherwise strip off the shared library
                   10785:                   version.</p>
                   10786: 
                   10787:                   <p>From the libtool manual:</p>
                   10788:                   <pre class="programlisting">
                   10789:      So, libtool library versions are described by three integers:
                   10790: 
                   10791: CURRENT
                   10792:        The most recent interface number that this library implements.
                   10793: 
                   10794: REVISION
                   10795:        The implementation number of the CURRENT interface.
                   10796: 
                   10797: AGE
                   10798:        The difference between the newest and oldest interfaces that this
                   10799:        library implements.  In other words, the library implements all the
                   10800:        interface numbers in the range from number `CURRENT - AGE' to
                   10801:        `CURRENT'.
                   10802:        
                   10803:      If two libraries have identical CURRENT and AGE numbers, then the
                   10804: dynamic linker chooses the library with the greater REVISION number. 
                   10805: </pre>
                   10806: 
                   10807:                   <p>The &#8220;<span class=
                   10808:                   "quote">-release</span>&#8221; option will
                   10809:                   produce different results for a.out and ELF
                   10810:                   (excluding symlinks) in only one case. An ELF
                   10811:                   library of the form &#8220;<span class=
                   10812:                   "quote">libfoo-release.so.<span class=
                   10813:                   "emphasis"><em>x</em></span>.<span class=
                   10814:                   "emphasis"><em>y</em></span></span>&#8221; will
                   10815:                   have a symlink of &#8220;<span class=
                   10816:                   "quote">libfoo.so.<span class=
                   10817:                   "emphasis"><em>x</em></span>.<span class=
                   10818:                   "emphasis"><em>y</em></span></span>&#8221; on an
                   10819:                   a.out platform. This is handled
                   10820:                   automatically.</p>
                   10821: 
                   10822:                   <p>The &#8220;<span class="quote">-rpath
                   10823:                   argument</span>&#8221; is the install directory
                   10824:                   of the library being built.</p>
                   10825: 
1.14      xtraeme  10826:                   <p>In the <code class="filename">PLIST</code>,
1.19      hubertf  10827:                   include only the <code class=
                   10828:                   "filename">.la</code> file, the other files will
                   10829:                   be added automatically.</p>
1.1       grant    10830:                 </li>
                   10831: 
                   10832:                 <li>
1.14      xtraeme  10833:                   <p>When linking shared object (<code class=
                   10834:                   "filename">.so</code>) files, i.e. files that are
1.24      wiz      10835:                   loaded via <a href=
                   10836:                   "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
                   10837:                   <span class="citerefentry"><span class=
                   10838:                   "refentrytitle">dlopen</span>(3)</span></a>, NOT
                   10839:                   shared libraries, use &#8220;<span class=
                   10840:                   "quote">-module -avoid-version</span>&#8221; to
                   10841:                   prevent them getting version tacked on.</p>
1.1       grant    10842: 
1.14      xtraeme  10843:                   <p>The <code class="filename">PLIST</code> file
                   10844:                   gets the <code class="filename">foo.so</code>
                   10845:                   entry.</p>
1.1       grant    10846:                 </li>
                   10847: 
                   10848:                 <li>
                   10849:                   <p>When linking programs that depend on these
                   10850:                   libraries <span class=
                   10851:                   "emphasis"><em>before</em></span> they are
                   10852:                   installed, preface the <a href=
                   10853:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
                   10854:                   <span class="citerefentry"><span class=
                   10855:                   "refentrytitle">cc</span>(1)</span></a> or
                   10856:                   <a href=
                   10857:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   10858:                   <span class="citerefentry"><span class=
                   10859:                   "refentrytitle">ld</span>(1)</span></a> line with
                   10860:                   &#8220;<span class="quote">${LIBTOOL}
                   10861:                   --mode=link</span>&#8221;, and it will find the
                   10862:                   correct libraries (static or shared), but please
                   10863:                   be aware that libtool will not allow you to
                   10864:                   specify a relative path in -L (such as
                   10865:                   &#8220;<span class=
                   10866:                   "quote">-L../somelib</span>&#8221;), because it
                   10867:                   expects you to change that argument to be the
1.14      xtraeme  10868:                   <code class="filename">.la</code> file. e.g.</p>
1.1       grant    10869:                   <pre class="programlisting">
                   10870: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
                   10871: </pre>
                   10872: 
                   10873:                   <p>should be changed to:</p>
                   10874:                   <pre class="programlisting">
1.14      xtraeme  10875: ${LIBTOOL} --mode=link ${CC} -o <em class=
                   10876: "replaceable"><code>someprog</code></em> <em class=
                   10877: "replaceable"><code>../somelib/somelib.la</code></em>
1.1       grant    10878: </pre>
                   10879: 
                   10880:                   <p>and it will do the right thing with the
                   10881:                   libraries.</p>
                   10882:                 </li>
                   10883: 
                   10884:                 <li>
                   10885:                   <p>When installing libraries, preface the
                   10886:                   <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   10887:                   <span class="citerefentry"><span class=
                   10888:                   "refentrytitle">install</span>(1)</span></a> or
                   10889:                   <a href=
                   10890:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
                   10891:                   <span class="citerefentry"><span class=
                   10892:                   "refentrytitle">cp</span>(1)</span></a> command
                   10893:                   with &#8220;<span class="quote">${LIBTOOL}
                   10894:                   --mode=install</span>&#8221;, and change the
1.14      xtraeme  10895:                   library name to <code class=
                   10896:                   "filename">.la</code>. e.g.</p>
1.1       grant    10897:                   <pre class="programlisting">
                   10898: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
                   10899: </pre>
                   10900: 
1.14      xtraeme  10901:                   <p>This will install the static <code class=
                   10902:                   "filename">.a</code>, shared library, any needed
1.1       grant    10903:                   symlinks, and run <a href=
                   10904:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
                   10905:                   <span class="citerefentry"><span class=
                   10906:                   "refentrytitle">ldconfig</span>(8)</span></a>.</p>
                   10907:                 </li>
                   10908: 
                   10909:                 <li>
1.14      xtraeme  10910:                   <p>In your <code class="filename">PLIST</code>,
1.23      wiz      10911:                   include only the <code class=
                   10912:                   "filename">.la</code> file (this is a change from
                   10913:                   previous behaviour).</p>
1.1       grant    10914:                 </li>
                   10915:               </ol>
                   10916:             </div>
                   10917:           </div>
                   10918: 
                   10919:           <div class="sect2" lang="en" xml:lang="en">
                   10920:             <div class="titlepage">
                   10921:               <div>
                   10922:                 <div>
1.30      wiz      10923:                   <h3 class="title"><a name="using-libtool" id=
1.35    ! jmmv     10924:                   "using-libtool"></a>14.3.2.&nbsp;Using libtool on
1.30      wiz      10925:                   GNU packages that already support libtool</h3>
1.1       grant    10926:                 </div>
                   10927:               </div>
                   10928:             </div>
                   10929: 
1.14      xtraeme  10930:             <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
                   10931:             the package Makefile. This will override the package's
                   10932:             own libtool in most cases. For older libtool using
1.1       grant    10933:             packages, libtool is made by ltconfig script during the
                   10934:             do-configure step; you can check the libtool script
1.14      xtraeme  10935:             location by doing <span><strong class="command">make
                   10936:             configure; find work*/ -name
                   10937:             libtool</strong></span>.</p>
                   10938: 
                   10939:             <p><code class="varname">LIBTOOL_OVERRIDE</code>
                   10940:             specifies which libtool scripts, relative to
                   10941:             <code class="varname">WRKSRC</code>, to override. By
                   10942:             default, it is set to &#8220;<span class=
                   10943:             "quote">libtool */libtool */*/libtool</span>&#8221;. If
                   10944:             this does not match the location of the package's
                   10945:             libtool script(s), set it as appropriate.</p>
1.13      hubertf  10946: 
1.14      xtraeme  10947:             <p>If you do not need <code class="filename">*.a</code>
1.1       grant    10948:             static libraries built and installed, then use
1.14      xtraeme  10949:             <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1       grant    10950:             instead.</p>
                   10951: 
                   10952:             <p>If your package makes use of the platform
                   10953:             independent library for loading dynamic shared objects,
                   10954:             that comes with libtool (libltdl), you should include
1.22      tv       10955:             devel/libltdl/buildlink3.mk.</p>
1.1       grant    10956: 
                   10957:             <p>Some packages use libtool incorrectly so that the
                   10958:             package may not work or build in some circumstances.
                   10959:             Some of the more common errors are:</p>
                   10960: 
                   10961:             <div class="itemizedlist">
                   10962:               <ul type="disc">
                   10963:                 <li>
                   10964:                   <p>The inclusion of a shared object (-module) as
                   10965:                   a dependent library in an executable or library.
                   10966:                   This in itself isn't a problem if one of two
                   10967:                   things has been done:</p>
                   10968: 
                   10969:                   <div class="orderedlist">
                   10970:                     <ol type="1">
                   10971:                       <li>
                   10972:                         <p>The shared object is named correctly,
1.14      xtraeme  10973:                         i.e. <code class=
                   10974:                         "filename">libfoo.la</code>, not
                   10975:                         <code class="filename">foo.la</code></p>
1.1       grant    10976:                       </li>
                   10977: 
                   10978:                       <li>
                   10979:                         <p>The -dlopen option is used when linking
                   10980:                         an executable.</p>
                   10981:                       </li>
                   10982:                     </ol>
                   10983:                   </div>
                   10984:                 </li>
                   10985: 
                   10986:                 <li>
                   10987:                   <p>The use of libltdl without the correct calls
                   10988:                   to initialisation routines. The function
                   10989:                   lt_dlinit() should be called and the macro
1.14      xtraeme  10990:                   <code class=
                   10991:                   "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1       grant    10992:                   included in executables.</p>
                   10993:                 </li>
                   10994:               </ul>
                   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="autoconf-automake" id=
1.35    ! jmmv     11003:                   "autoconf-automake"></a>14.3.3.&nbsp;GNU
1.1       grant    11004:                   Autoconf/Automake</h3>
                   11005:                 </div>
                   11006:               </div>
                   11007:             </div>
                   11008: 
                   11009:             <p>If a package needs GNU autoconf or automake to be
                   11010:             executed to regenerate the configure script and
                   11011:             Makefile.in makefile templates, then they should be
1.35    ! jmmv     11012:             executed in a pre-configure target.</p>
1.1       grant    11013: 
                   11014:             <p>For packages that need only autoconf:</p>
                   11015:             <pre class="programlisting">
1.35    ! jmmv     11016: AUTOCONF_REQD=    2.50     # if default version is not good enough
        !          11017: USE_TOOLS+=     autoconf   # use "autoconf213" for autoconf-2.13
1.1       grant    11018: ...
                   11019: 
                   11020: pre-configure:
1.35    ! jmmv     11021:           cd ${WRKSRC}; autoconf
1.1       grant    11022: 
                   11023: ...
                   11024: </pre>
                   11025: 
                   11026:             <p>and for packages that need automake and
                   11027:             autoconf:</p>
                   11028:             <pre class="programlisting">
1.35    ! jmmv     11029: AUTOMAKE_REQD=  1.7.1      # if default version is not good enough
        !          11030: USE_TOOLS+=     automake   # use "automake14" for autoconf-1.4
1.1       grant    11031: ...
                   11032: 
                   11033: pre-configure:
                   11034:           cd ${WRKSRC};                                           \
1.35    ! jmmv     11035:           aclocal; autoheader;                                    \
        !          11036:           automake -a --foreign -i; autoconf
1.1       grant    11037: 
                   11038: ...
                   11039: </pre>
                   11040: 
                   11041:             <p>Packages which use GNU Automake will almost
1.35    ! jmmv     11042:             certainly require GNU Make.</p>
1.1       grant    11043: 
                   11044:             <p>There are times when the configure process makes
                   11045:             additional changes to the generated files, which then
                   11046:             causes the build process to try to re-execute the
                   11047:             automake sequence. This is prevented by touching
                   11048:             various files in the configure stage. If this causes
1.14      xtraeme  11049:             problems with your package you can set <code class=
                   11050:             "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1       grant    11051:             Makefile.</p>
                   11052:           </div>
                   11053:         </div>
                   11054: 
                   11055:         <div class="sect1" lang="en" xml:lang="en">
                   11056:           <div class="titlepage">
                   11057:             <div>
                   11058:               <div>
                   11059:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      11060:                 "building-considerations" id=
1.35    ! jmmv     11061:                 "building-considerations"></a>14.4.&nbsp;Building
1.1       grant    11062:                 considerations</h2>
                   11063:               </div>
                   11064:             </div>
                   11065:           </div>
                   11066: 
                   11067:           <div class="sect2" lang="en" xml:lang="en">
                   11068:             <div class="titlepage">
                   11069:               <div>
                   11070:                 <div>
1.30      wiz      11071:                   <h3 class="title"><a name="cpp-defines" id=
1.35    ! jmmv     11072:                   "cpp-defines"></a>14.4.1.&nbsp;CPP defines</h3>
1.1       grant    11073:                 </div>
                   11074:               </div>
                   11075:             </div>
                   11076: 
                   11077:             <p>To port an application to NetBSD, it's usually
                   11078:             necessary for the compiler to be able to judge the
                   11079:             system on which it's compiling, and we use definitions
                   11080:             so that the C pre-processor can do this.</p>
                   11081: 
                   11082:             <p>To test whether you are working on a 4.4 BSD-derived
                   11083:             system, you should use the BSD definition, which is
1.14      xtraeme  11084:             defined in <code class=
                   11085:             "filename">&lt;sys/param.h&gt;</code> on said
1.1       grant    11086:             systems.</p>
                   11087:             <pre class="programlisting">
                   11088: #include &lt;sys/param.h&gt;
                   11089: </pre>
                   11090: 
                   11091:             <p>and then you can surround the BSD-specific parts of
                   11092:             your package's C/C++ code using this conditional:</p>
                   11093:             <pre class="programlisting">
                   11094: #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
                   11095:     ...
                   11096: #endif
                   11097: </pre>
                   11098: 
                   11099:             <p>Please use the &#8220;<span class=
                   11100:             "quote">__NetBSD__</span>&#8221; definition sparingly -
                   11101:             it should only apply to features of NetBSD that are not
                   11102:             present in other 4.4-lite derived BSDs.</p>
                   11103:           </div>
                   11104:         </div>
                   11105: 
                   11106:         <div class="sect1" lang="en" xml:lang="en">
                   11107:           <div class="titlepage">
                   11108:             <div>
                   11109:               <div>
                   11110:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      11111:                 "package-specific-actions" id=
1.35    ! jmmv     11112:                 "package-specific-actions"></a>14.5.&nbsp;Package
1.1       grant    11113:                 specific actions</h2>
                   11114:               </div>
                   11115:             </div>
                   11116:           </div>
                   11117: 
                   11118:           <div class="sect2" lang="en" xml:lang="en">
                   11119:             <div class="titlepage">
                   11120:               <div>
                   11121:                 <div>
1.30      wiz      11122:                   <h3 class="title"><a name="user-interaction" id=
1.35    ! jmmv     11123:                   "user-interaction"></a>14.5.1.&nbsp;User
1.2       hubertf  11124:                   interaction</h3>
1.1       grant    11125:                 </div>
                   11126:               </div>
                   11127:             </div>
                   11128: 
                   11129:             <p>Occasionally, packages require interaction from the
                   11130:             user, and this can be in a number of ways:</p>
                   11131: 
                   11132:             <div class="itemizedlist">
                   11133:               <ul type="disc">
                   11134:                 <li>
                   11135:                   <p>help in fetching the distfiles</p>
                   11136:                 </li>
                   11137: 
                   11138:                 <li>
                   11139:                   <p>help to configure the package before it is
                   11140:                   built</p>
                   11141:                 </li>
                   11142: 
                   11143:                 <li>
                   11144:                   <p>help during the build process</p>
                   11145:                 </li>
                   11146: 
                   11147:                 <li>
                   11148:                   <p>help during the installation of a package</p>
                   11149:                 </li>
                   11150:               </ul>
                   11151:             </div>
                   11152: 
1.14      xtraeme  11153:             <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1       grant    11154:             definition is provided to notify the pkgsrc mechanism
                   11155:             of an interactive stage which will be needed, and this
1.14      xtraeme  11156:             should be set in the package's <code class=
                   11157:             "filename">Makefile</code>. e.g.</p>
1.1       grant    11158:             <pre class="programlisting">
                   11159: INTERACTIVE_STAGE= build
                   11160: </pre>
                   11161: 
                   11162:             <p>Multiple interactive stages can be specified:</p>
                   11163:             <pre class="programlisting">
                   11164: INTERACTIVE_STAGE= configure install
                   11165: </pre>
                   11166:           </div>
                   11167: 
                   11168:           <div class="sect2" lang="en" xml:lang="en">
                   11169:             <div class="titlepage">
                   11170:               <div>
                   11171:                 <div>
1.30      wiz      11172:                   <h3 class="title"><a name="handling-licenses" id=
1.35    ! jmmv     11173:                   "handling-licenses"></a>14.5.2.&nbsp;Handling
1.1       grant    11174:                   licenses</h3>
                   11175:                 </div>
                   11176:               </div>
                   11177:             </div>
                   11178: 
                   11179:             <p>A package may underly a license which the user has
                   11180:             or has not agreed to accept. Usually, packages that
                   11181:             underly well-known Open Source licenses (e.g. the GNU
                   11182:             Public License, GPL) won't have any special license
                   11183:             tags added in pkgsrc which require special action by
                   11184:             the user of such packages, but there are quite a number
                   11185:             of other licenses out there that pkgsrc users may not
                   11186:             be able to follow, for whatever reasons. For these
                   11187:             cases, pkgsrc contains a mechanism to note that a
                   11188:             package underlies a certain license, and the user has
                   11189:             to accept the license before the package can be
                   11190:             installed.</p>
                   11191: 
                   11192:             <p>Placing a certain package under a certain license
1.14      xtraeme  11193:             works by setting the <code class=
                   11194:             "varname">LICENSE</code> variable to a string
                   11195:             identifying the license, e.g. in <a xmlns=
                   11196:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    11197:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.20      ben      11198:             class="pkgname">graphics/graphviz</a>:</p>
1.1       grant    11199:             <pre class="programlisting">
                   11200: LICENSE=        graphviz-license
                   11201: </pre>
                   11202: 
                   11203:             <p>When trying to build, the user will get a notice
                   11204:             that the package underlies a license which he hasn't
                   11205:             accepted (yet):</p>
                   11206:             <pre class="programlisting">
1.14      xtraeme  11207: <code class="prompt">%</code> <strong class=
                   11208: "userinput"><code>make</code></strong>
1.1       grant    11209: ===&gt; graphviz-1.12 has an unacceptable license: graphviz-license.
                   11210: ===&gt;     To build this package, add this line to your /etc/mk.conf:
                   11211: ===&gt;     ACCEPTABLE_LICENSES+=graphviz-license
                   11212: ===&gt;     To view the license, enter "/usr/bin/make show-license".
                   11213: *** Error code 1
                   11214: </pre>
                   11215: 
1.14      xtraeme  11216:             <p>The license can be viewed with <span><strong class=
                   11217:             "command">make show-license</strong></span>, and if it
                   11218:             is considered appropriate, the line printed above can
                   11219:             be added to <code class="filename">/etc/mk.conf</code>
                   11220:             to indicate acceptance of the particular license:</p>
1.1       grant    11221:             <pre class="programlisting">
                   11222: ACCEPTABLE_LICENSES+=graphviz-license
                   11223: </pre>
                   11224: 
                   11225:             <p>When adding a package with a new license, the
1.14      xtraeme  11226:             license text should be added to <code class=
                   11227:             "filename">pkgsrc/licenses</code> for displaying. A
                   11228:             list of known licenses can be seen in this directory as
                   11229:             well as by looking at the list of (commented out)
                   11230:             <code class="varname">ACCEPTABLE_LICENSES</code>
                   11231:             variable settings in <code class=
                   11232:             "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1       grant    11233: 
1.17      sketch   11234:             <p>If there is a <span class=
1.1       grant    11235:             "emphasis"><em>really</em></span> pressing need to
                   11236:             accept all licenses at once, like when trying to
                   11237:             download or mirror all distfiles or doing a bulk build
                   11238:             to test if all packages in pkgsrc build, this can be
1.14      xtraeme  11239:             done by setting <code class=
                   11240:             "varname">_ACCEPTABLE=yes</code>.</p>
1.1       grant    11241:           </div>
                   11242: 
                   11243:           <div class="sect2" lang="en" xml:lang="en">
                   11244:             <div class="titlepage">
                   11245:               <div>
                   11246:                 <div>
1.30      wiz      11247:                   <h3 class="title"><a name=
                   11248:                   "installing-score-files" id=
1.35    ! jmmv     11249:                   "installing-score-files"></a>14.5.3.&nbsp;Installing
1.30      wiz      11250:                   score files</h3>
1.1       grant    11251:                 </div>
                   11252:               </div>
                   11253:             </div>
                   11254: 
                   11255:             <p>Certain packages, most of them in the games
                   11256:             category, install a score file that allows all users on
                   11257:             the system to record their highscores. In order for
                   11258:             this to work, the binaries need to be installed setgid
                   11259:             and the score files owned by the appropriate group
                   11260:             and/or owner (traditionally the "games" user/group).
                   11261:             The following variables, documented in more detail in
1.14      xtraeme  11262:             <code class="filename">mk/defaults/mk.conf</code>,
                   11263:             control this behaviour: <code class=
                   11264:             "varname">SETGIDGAME</code>, <code class=
                   11265:             "varname">GAMEDATAMODE</code>, <code class=
                   11266:             "varname">GAMEGRP</code>, <code class=
                   11267:             "varname">GAMEMODE</code>, <code class=
                   11268:             "varname">GAMEOWN</code>.</p>
1.1       grant    11269: 
                   11270:             <p>Note that per default, setgid installation of games
1.14      xtraeme  11271:             is disabled; setting <code class=
                   11272:             "varname">SETGIDGAME=YES</code> will set all the other
1.1       grant    11273:             variables accordingly.</p>
                   11274: 
                   11275:             <p>A package should therefor never hard code file
1.14      xtraeme  11276:             ownership or access permissions but rely on
                   11277:             <code class="varname">INSTALL_GAME</code> and
                   11278:             <code class="varname">INSTALL_GAME_DATA</code> to set
                   11279:             these correctly.</p>
1.1       grant    11280:           </div>
                   11281: 
                   11282:           <div class="sect2" lang="en" xml:lang="en">
                   11283:             <div class="titlepage">
                   11284:               <div>
                   11285:                 <div>
1.30      wiz      11286:                   <h3 class="title"><a name="perl-scripts" id=
1.35    ! jmmv     11287:                   "perl-scripts"></a>14.5.4.&nbsp;Packages
1.30      wiz      11288:                   containing perl scripts</h3>
1.1       grant    11289:                 </div>
                   11290:               </div>
                   11291:             </div>
                   11292: 
                   11293:             <p>If your package contains interpreted perl scripts,
1.14      xtraeme  11294:             set <code class="varname">REPLACE_PERL</code> to ensure
                   11295:             that the proper interpreter path is set. <code class=
                   11296:             "varname">REPLACE_PERL</code> should contain a list of
                   11297:             scripts, relative to <code class=
                   11298:             "varname">WRKSRC</code>, that you want adjusted.</p>
1.1       grant    11299:           </div>
                   11300: 
                   11301:           <div class="sect2" lang="en" xml:lang="en">
                   11302:             <div class="titlepage">
                   11303:               <div>
                   11304:                 <div>
1.30      wiz      11305:                   <h3 class="title"><a name="hardcoded-paths" id=
1.35    ! jmmv     11306:                   "hardcoded-paths"></a>14.5.5.&nbsp;Packages with
1.1       grant    11307:                   hardcoded paths to other interpreters</h3>
                   11308:                 </div>
                   11309:               </div>
                   11310:             </div>
                   11311: 
                   11312:             <p>Your package may also contain scripts with hardcoded
                   11313:             paths to other interpreters besides (or as well as)
                   11314:             perl. To correct the full pathname to the script
                   11315:             interpreter, you need to set the following definitions
1.14      xtraeme  11316:             in your <code class="filename">Makefile</code> (we
                   11317:             shall use <span><strong class=
                   11318:             "command">tclsh</strong></span> in this example):</p>
1.1       grant    11319:             <pre class="programlisting">
                   11320:   REPLACE_INTERPRETER+=     tcl
                   11321:     _REPLACE.tcl.old=     .*/bin/tclsh
                   11322:     _REPLACE.tcl.new=     ${PREFIX}/bin/tclsh
                   11323:     _REPLACE_FILES.tcl=   ...list of tcl scripts which need to be fixed,
                   11324:                           relative to ${WRKSRC}, just as in REPLACE_PERL
                   11325: </pre>
                   11326:           </div>
                   11327: 
                   11328:           <div class="sect2" lang="en" xml:lang="en">
                   11329:             <div class="titlepage">
                   11330:               <div>
                   11331:                 <div>
1.30      wiz      11332:                   <h3 class="title"><a name="perl-modules" id=
1.35    ! jmmv     11333:                   "perl-modules"></a>14.5.6.&nbsp;Packages
1.30      wiz      11334:                   installing perl modules</h3>
1.1       grant    11335:                 </div>
                   11336:               </div>
                   11337:             </div>
                   11338: 
                   11339:             <p>Makefiles of packages providing perl5 modules should
1.14      xtraeme  11340:             include the Makefile fragment <code class=
                   11341:             "filename">../../lang/perl5/module.mk</code>. It
                   11342:             provides a <span><strong class=
                   11343:             "command">do-configure</strong></span> target for the
                   11344:             standard perl configuration for such modules as well as
                   11345:             various hooks to tune this configuration. See comments
                   11346:             in this file for details.</p>
1.1       grant    11347: 
                   11348:             <p>Perl5 modules will install into different places
                   11349:             depending on the version of perl used during the build
                   11350:             process. To address this, pkgsrc will append lines to
1.14      xtraeme  11351:             the <code class="filename">PLIST</code> corresponding
                   11352:             to the files listed in the installed <code class=
                   11353:             "filename">.packlist</code> file generated by most
                   11354:             perl5 modules. This is invoked by defining <code class=
                   11355:             "varname">PERL5_PACKLIST</code> to a space-separated
                   11356:             list of paths to packlist files, e.g.:</p>
1.1       grant    11357:             <pre class="programlisting">
                   11358: PERL5_PACKLIST=   ${PERL5_SITEARCH}/auto/Pg/.packlist
                   11359: </pre>
                   11360: 
1.14      xtraeme  11361:             <p>The variables <code class=
                   11362:             "varname">PERL5_SITELIB</code>, <code class=
                   11363:             "varname">PERL5_SITEARCH</code>, and <code class=
                   11364:             "varname">PERL5_ARCHLIB</code> represent the three
1.1       grant    11365:             locations in which perl5 modules may be installed, and
                   11366:             may be used by perl5 packages that don't have a
                   11367:             packlist. These three variables are also substituted
1.14      xtraeme  11368:             for in the <code class="filename">PLIST</code>.</p>
1.1       grant    11369:           </div>
                   11370: 
                   11371:           <div class="sect2" lang="en" xml:lang="en">
                   11372:             <div class="titlepage">
                   11373:               <div>
                   11374:                 <div>
                   11375:                   <h3 class="title"><a name="faq.info-files" id=
1.35    ! jmmv     11376:                   "faq.info-files"></a>14.5.7.&nbsp;Packages
1.1       grant    11377:                   installing info files</h3>
                   11378:                 </div>
                   11379:               </div>
                   11380:             </div>
                   11381: 
                   11382:             <p>Some packages install info files or use the
                   11383:             &#8220;<span class="quote">makeinfo</span>&#8221; or
                   11384:             &#8220;<span class="quote">install-info</span>&#8221;
                   11385:             commands. Each of the info files:</p>
                   11386: 
                   11387:             <div class="itemizedlist">
                   11388:               <ul type="disc">
                   11389:                 <li>
                   11390:                   <p>is considered to be installed in the directory
1.14      xtraeme  11391:                   <code class=
                   11392:                   "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1       grant    11393:                 </li>
                   11394: 
                   11395:                 <li>
                   11396:                   <p>is registered in the Info directory file
1.14      xtraeme  11397:                   <code class=
                   11398:                   "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1       grant    11399:                 </li>
                   11400: 
                   11401:                 <li>
                   11402:                   <p>and must be listed as a filename in the
1.14      xtraeme  11403:                   <code class="varname">INFO_FILES</code> variable
                   11404:                   in the package Makefile.</p>
1.1       grant    11405:                 </li>
                   11406:               </ul>
                   11407:             </div>
                   11408: 
1.14      xtraeme  11409:             <p><code class="varname">INFO_DIR</code> defaults to
1.1       grant    11410:             &#8220;<span class="quote">info</span>&#8221; and can
1.14      xtraeme  11411:             be overridden in the package Makefile. <code class=
                   11412:             "filename">INSTALL</code> and <code class=
                   11413:             "filename">DEINSTALL</code> scripts will be generated
                   11414:             to handle registration of the info files in the Info
1.1       grant    11415:             directory file. The &#8220;<span class=
                   11416:             "quote">install-info</span>&#8221; command used for the
                   11417:             info files registration is either provided by the
                   11418:             system, or by a special purpose package automatically
                   11419:             added as dependency if needed.</p>
                   11420: 
                   11421:             <p>A package which needs the &#8220;<span class=
                   11422:             "quote">makeinfo</span>&#8221; command at build time
1.14      xtraeme  11423:             must define the variable <code class=
                   11424:             "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1       grant    11425:             minimum version of the &#8220;<span class=
                   11426:             "quote">makeinfo</span>&#8221; command is needed it
1.14      xtraeme  11427:             should be noted with the <code class=
                   11428:             "varname">TEXINFO_REQD</code> variable in the package
                   11429:             <code class="filename">Makefile</code>. By default, a
1.1       grant    11430:             minimum version of 3.12 is required. If the system does
1.14      xtraeme  11431:             not provide a <span><strong class=
                   11432:             "command">makeinfo</strong></span> command or if it
                   11433:             does not match the required minimum, a build dependency
                   11434:             on the <a xmlns=
                   11435:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    11436:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.20      ben      11437:             class="pkgname">devel/gtexinfo</a> package will be
                   11438:             added automatically.</p>
1.1       grant    11439: 
                   11440:             <p>The build and installation process of the software
                   11441:             provided by the package should not use the
1.14      xtraeme  11442:             <span><strong class=
                   11443:             "command">install-info</strong></span> command as the
                   11444:             registration of info files is the task of the package
                   11445:             <code class="filename">INSTALL</code> script, and it
                   11446:             must use the appropriate <span><strong class=
                   11447:             "command">makeinfo</strong></span> command.</p>
1.1       grant    11448: 
                   11449:             <p>To achieve this goal the pkgsrc infrastructure
1.14      xtraeme  11450:             creates overriding scripts for the <span><strong class=
                   11451:             "command">install-info</strong></span> and
                   11452:             <span><strong class="command">makeinfo</strong></span>
                   11453:             commands in a directory listed early in <code class=
                   11454:             "varname">PATH</code>.</p>
1.1       grant    11455: 
1.14      xtraeme  11456:             <p>The script overriding <span><strong class=
                   11457:             "command">install-info</strong></span> has no effect
                   11458:             except the logging of a message. The script overriding
                   11459:             <span><strong class="command">makeinfo</strong></span>
                   11460:             logs a message and according to the value of
                   11461:             <code class="varname">USE_MAKEINFO</code> and
                   11462:             <code class="varname">TEXINFO_REQD</code> either run
                   11463:             the appropriate <span><strong class=
                   11464:             "command">makeinfo</strong></span> command or exit on
                   11465:             error.</p>
1.1       grant    11466:           </div>
                   11467: 
                   11468:           <div class="sect2" lang="en" xml:lang="en">
                   11469:             <div class="titlepage">
                   11470:               <div>
                   11471:                 <div>
1.30      wiz      11472:                   <h3 class="title"><a name="gconf2-data-files" id=
1.35    ! jmmv     11473:                   "gconf2-data-files"></a>14.5.8.&nbsp;Packages
1.30      wiz      11474:                   installing GConf2 data files</h3>
1.1       grant    11475:                 </div>
                   11476:               </div>
                   11477:             </div>
                   11478: 
1.14      xtraeme  11479:             <p>If a package installs <code class=
                   11480:             "filename">.schemas</code> or <code class=
                   11481:             "filename">.entries</code> files, used by GConf2, you
1.1       grant    11482:             need to take some extra steps to make sure they get
                   11483:             registered in the database:</p>
                   11484: 
                   11485:             <div class="orderedlist">
                   11486:               <ol type="1">
                   11487:                 <li>
1.14      xtraeme  11488:                   <p>Include <code class=
                   11489:                   "filename">../../devel/GConf2/schemas.mk</code>
                   11490:                   instead of its <code class=
                   11491:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    11492:                   care of rebuilding the GConf2 database at
                   11493:                   installation and deinstallation time, and tells
                   11494:                   the package where to install GConf2 data files
                   11495:                   using some standard configure arguments. It also
                   11496:                   disallows any access to the database directly
                   11497:                   from the package.</p>
                   11498:                 </li>
                   11499: 
                   11500:                 <li>
                   11501:                   <p>Ensure that the package installs its
1.14      xtraeme  11502:                   <code class="filename">.schemas</code> files
                   11503:                   under <code class=
                   11504:                   "filename">${PREFIX}/share/gconf/schemas</code>.
                   11505:                   If they get installed under <code class=
                   11506:                   "filename">${PREFIX}/etc</code>, you will need to
1.1       grant    11507:                   manually patch the package.</p>
                   11508:                 </li>
                   11509: 
                   11510:                 <li>
                   11511:                   <p>Check the PLIST and remove any entries under
                   11512:                   the etc/gconf directory, as they will be handled
                   11513:                   automatically. See <a href="#faq.conf" title=
1.35    ! jmmv     11514:                   "6.14.&nbsp;How do I change the location of configuration files?">
        !          11515:                   Section&nbsp;6.14, &#8220;How do I change the
        !          11516:                   location of configuration files?&#8221;</a> for
        !          11517:                   more information.</p>
1.1       grant    11518:                 </li>
                   11519: 
                   11520:                 <li>
1.14      xtraeme  11521:                   <p>Define the <code class=
                   11522:                   "varname">GCONF2_SCHEMAS</code> variable in your
                   11523:                   <code class="filename">Makefile</code> with a
                   11524:                   list of all <code class=
                   11525:                   "filename">.schemas</code> files installed by the
                   11526:                   package, if any. Names must not contain any
                   11527:                   directories in them.</p>
1.1       grant    11528:                 </li>
                   11529: 
                   11530:                 <li>
1.14      xtraeme  11531:                   <p>Define the <code class=
                   11532:                   "varname">GCONF2_ENTRIES</code> variable in your
                   11533:                   <code class="filename">Makefile</code> with a
                   11534:                   list of all <code class=
                   11535:                   "filename">.entries</code> files installed by the
                   11536:                   package, if any. Names must not contain any
                   11537:                   directories in them.</p>
1.1       grant    11538:                 </li>
                   11539:               </ol>
                   11540:             </div>
                   11541:           </div>
                   11542: 
                   11543:           <div class="sect2" lang="en" xml:lang="en">
                   11544:             <div class="titlepage">
                   11545:               <div>
                   11546:                 <div>
1.30      wiz      11547:                   <h3 class="title"><a name=
                   11548:                   "scrollkeeper-data-files" id=
1.35    ! jmmv     11549:                   "scrollkeeper-data-files"></a>14.5.9.&nbsp;Packages
1.30      wiz      11550:                   installing scrollkeeper data files</h3>
1.1       grant    11551:                 </div>
                   11552:               </div>
                   11553:             </div>
                   11554: 
1.14      xtraeme  11555:             <p>If a package installs <code class=
                   11556:             "filename">.omf</code> files, used by scrollkeeper, you
                   11557:             need to take some extra steps to make sure they get
                   11558:             registered in the database:</p>
1.1       grant    11559: 
                   11560:             <div class="orderedlist">
                   11561:               <ol type="1">
                   11562:                 <li>
1.14      xtraeme  11563:                   <p>Include <code class=
                   11564:                   "filename">../../textproc/scrollkeeper/omf.mk</code>
                   11565:                   instead of its <code class=
                   11566:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    11567:                   care of rebuilding the scrollkeeper database at
                   11568:                   installation and deinstallation time, and
                   11569:                   disallows any access to it directly from the
                   11570:                   package.</p>
                   11571:                 </li>
                   11572: 
                   11573:                 <li>
                   11574:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  11575:                   the <code class=
                   11576:                   "filename">libdata/scrollkeeper</code> directory,
1.1       grant    11577:                   as they will be handled automatically.</p>
                   11578:                 </li>
                   11579: 
                   11580:                 <li>
1.14      xtraeme  11581:                   <p>Remove the <code class=
                   11582:                   "filename">share/omf</code> directory from the
                   11583:                   PLIST. It will be handled by scrollkeeper.</p>
1.1       grant    11584:                 </li>
                   11585:               </ol>
                   11586:             </div>
                   11587:           </div>
                   11588: 
                   11589:           <div class="sect2" lang="en" xml:lang="en">
                   11590:             <div class="titlepage">
                   11591:               <div>
                   11592:                 <div>
1.30      wiz      11593:                   <h3 class="title"><a name="x11-fonts" id=
1.35    ! jmmv     11594:                   "x11-fonts"></a>14.5.10.&nbsp;Packages installing
1.1       grant    11595:                   X11 fonts</h3>
                   11596:                 </div>
                   11597:               </div>
                   11598:             </div>
                   11599: 
                   11600:             <p>If a package installs font files, you will need to
                   11601:             rebuild the fonts database in the directory where they
                   11602:             get installed at installation and deinstallation time.
1.14      xtraeme  11603:             This can be automatically done by using <code class=
                   11604:             "filename">mk/fonts.mk</code>, which you need to
                   11605:             include in your <code class=
                   11606:             "filename">Makefile</code>.</p>
1.1       grant    11607: 
                   11608:             <p>When the file is included, you can list the
1.14      xtraeme  11609:             directories where fonts are installed in the
                   11610:             <code class="varname">FONTS_<em class=
                   11611:             "replaceable"><code>type</code></em>_DIRS</code>
                   11612:             variables, where <em class=
                   11613:             "replaceable"><code>type</code></em> can be one of
                   11614:             &#8220;<span class="quote">TTF</span>&#8221;,
1.1       grant    11615:             &#8220;<span class="quote">TYPE1</span>&#8221; or
                   11616:             &#8220;<span class="quote">X11</span>&#8221;. Also make
1.14      xtraeme  11617:             sure that the database file <code class=
                   11618:             "filename">fonts.dir</code> is not listed in the
1.1       grant    11619:             PLIST.</p>
                   11620: 
                   11621:             <p>Note that you should not create new directories for
                   11622:             fonts; instead use the standard ones to avoid that the
                   11623:             user needs to manually configure his X server to find
                   11624:             them.</p>
                   11625:           </div>
                   11626: 
                   11627:           <div class="sect2" lang="en" xml:lang="en">
                   11628:             <div class="titlepage">
                   11629:               <div>
                   11630:                 <div>
1.30      wiz      11631:                   <h3 class="title"><a name="gtk2-modules" id=
1.35    ! jmmv     11632:                   "gtk2-modules"></a>14.5.11.&nbsp;Packages
1.30      wiz      11633:                   installing GTK2 modules</h3>
1.1       grant    11634:                 </div>
                   11635:               </div>
                   11636:             </div>
                   11637: 
                   11638:             <p>If a package installs gtk2 immodules or loaders, you
                   11639:             need to take some extra steps to get them registered in
                   11640:             the GTK2 database properly:</p>
                   11641: 
                   11642:             <div class="orderedlist">
                   11643:               <ol type="1">
                   11644:                 <li>
1.14      xtraeme  11645:                   <p>Include <code class=
                   11646:                   "filename">../../x11/gtk2/modules.mk</code>
                   11647:                   instead of its <code class=
                   11648:                   "filename">buildlink3.mk</code> file. This takes
                   11649:                   care of rebuilding the database at installation
                   11650:                   and deinstallation time.</p>
1.1       grant    11651:                 </li>
                   11652: 
                   11653:                 <li>
1.14      xtraeme  11654:                   <p>Set <code class=
                   11655:                   "varname">GTK2_IMMODULES=YES</code> if your
                   11656:                   package installs GTK2 immodules.</p>
1.1       grant    11657:                 </li>
                   11658: 
                   11659:                 <li>
1.14      xtraeme  11660:                   <p>Set <code class=
                   11661:                   "varname">GTK2_LOADERS=YES</code> if your package
                   11662:                   installs GTK2 loaders.</p>
1.1       grant    11663:                 </li>
                   11664: 
                   11665:                 <li>
                   11666:                   <p>Patch the package to not touch any of the gtk2
                   11667:                   databases directly. These are:</p>
                   11668: 
                   11669:                   <div class="itemizedlist">
                   11670:                     <ul type="disc">
                   11671:                       <li>
1.14      xtraeme  11672:                         <p><code class=
                   11673:                         "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1       grant    11674:                       </li>
                   11675: 
                   11676:                       <li>
1.14      xtraeme  11677:                         <p><code class=
                   11678:                         "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1       grant    11679:                       </li>
                   11680:                     </ul>
                   11681:                   </div>
                   11682:                 </li>
                   11683: 
                   11684:                 <li>
                   11685:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  11686:                   the <code class="filename">libdata/gtk-2.0</code>
1.1       grant    11687:                   directory, as they will be handled
                   11688:                   automatically.</p>
                   11689:                 </li>
                   11690:               </ol>
                   11691:             </div>
                   11692:           </div>
                   11693: 
                   11694:           <div class="sect2" lang="en" xml:lang="en">
                   11695:             <div class="titlepage">
                   11696:               <div>
                   11697:                 <div>
1.30      wiz      11698:                   <h3 class="title"><a name="sgml-xml-data" id=
1.35    ! jmmv     11699:                   "sgml-xml-data"></a>14.5.12.&nbsp;Packages
1.30      wiz      11700:                   installing SGML or XML data</h3>
1.1       grant    11701:                 </div>
                   11702:               </div>
                   11703:             </div>
                   11704: 
                   11705:             <p>If a package installs SGML or XML data files that
                   11706:             need to be registered in system-wide catalogs (like
                   11707:             DTDs, sub-catalogs, etc.), you need to take some extra
                   11708:             steps:</p>
                   11709: 
                   11710:             <div class="orderedlist">
                   11711:               <ol type="1">
                   11712:                 <li>
1.14      xtraeme  11713:                   <p>Include <code class=
                   11714:                   "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
                   11715:                   in your <code class="filename">Makefile</code>,
                   11716:                   which takes care of registering those files in
1.1       grant    11717:                   system-wide catalogs at installation and
                   11718:                   deinstallation time.</p>
                   11719:                 </li>
                   11720: 
                   11721:                 <li>
1.14      xtraeme  11722:                   <p>Set <code class="varname">SGML_CATALOGS</code>
                   11723:                   to the full path of any SGML catalogs installed
                   11724:                   by the package.</p>
1.1       grant    11725:                 </li>
                   11726: 
                   11727:                 <li>
1.14      xtraeme  11728:                   <p>Set <code class="varname">XML_CATALOGS</code>
                   11729:                   to the full path of any XML catalogs installed by
1.1       grant    11730:                   the package.</p>
                   11731:                 </li>
                   11732: 
                   11733:                 <li>
1.14      xtraeme  11734:                   <p>Set <code class="varname">SGML_ENTRIES</code>
                   11735:                   to individual entries to be added to the SGML
1.1       grant    11736:                   catalog. These come in groups of three strings;
                   11737:                   see xmlcatmgr(1) for more information
                   11738:                   (specifically, arguments recognized by the 'add'
                   11739:                   action). Note that you will normally not use this
                   11740:                   variable.</p>
                   11741:                 </li>
                   11742: 
                   11743:                 <li>
1.14      xtraeme  11744:                   <p>Set <code class="varname">XML_ENTRIES</code>
                   11745:                   to individual entries to be added to the XML
1.1       grant    11746:                   catalog. These come in groups of three strings;
                   11747:                   see xmlcatmgr(1) for more information
                   11748:                   (specifically, arguments recognized by the 'add'
                   11749:                   action). Note that you will normally not use this
                   11750:                   variable.</p>
                   11751:                 </li>
                   11752:               </ol>
                   11753:             </div>
                   11754:           </div>
                   11755: 
                   11756:           <div class="sect2" lang="en" xml:lang="en">
                   11757:             <div class="titlepage">
                   11758:               <div>
                   11759:                 <div>
1.30      wiz      11760:                   <h3 class="title"><a name="mime-database" id=
1.35    ! jmmv     11761:                   "mime-database"></a>14.5.13.&nbsp;Packages
1.30      wiz      11762:                   installing extensions to the MIME database</h3>
1.1       grant    11763:                 </div>
                   11764:               </div>
                   11765:             </div>
                   11766: 
                   11767:             <p>If a package provides extensions to the MIME
1.14      xtraeme  11768:             database by installing <code class=
                   11769:             "filename">.xml</code> files inside <code class=
                   11770:             "filename">${PREFIX}/share/mime/packages</code>, you
                   11771:             need to take some extra steps to ensure that the
                   11772:             database is kept consistent with respect to these new
                   11773:             files:</p>
1.1       grant    11774: 
                   11775:             <div class="orderedlist">
                   11776:               <ol type="1">
                   11777:                 <li>
1.14      xtraeme  11778:                   <p>Include <code class=
                   11779:                   "filename">../../databases/shared-mime-info/mimedb.mk</code>
                   11780:                   (avoid using the <code class=
                   11781:                   "filename">buildlink3.mk</code> file from this
                   11782:                   same directory, which is reserved for inclusion
                   11783:                   from other <code class=
                   11784:                   "filename">buildlink3.mk</code> files). It takes
                   11785:                   care of rebuilding the MIME database at
                   11786:                   installation and deinstallation time, and
                   11787:                   disallows any access to it directly from the
1.1       grant    11788:                   package.</p>
                   11789:                 </li>
                   11790: 
                   11791:                 <li>
                   11792:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  11793:                   the <code class="filename">share/mime</code>
1.1       grant    11794:                   directory, <span class=
                   11795:                   "emphasis"><em>except</em></span> for files saved
1.14      xtraeme  11796:                   under <code class=
                   11797:                   "filename">share/mime/packages</code>. The former
1.1       grant    11798:                   are handled automatically by the
                   11799:                   update-mime-database program, but the later are
                   11800:                   package-dependent and must be removed by the
                   11801:                   package that installed them in the first
                   11802:                   place.</p>
                   11803:                 </li>
                   11804: 
                   11805:                 <li>
1.14      xtraeme  11806:                   <p>Remove any <code class=
                   11807:                   "filename">share/mime/*</code> directories from
                   11808:                   the PLIST. They will be handled by the
1.1       grant    11809:                   shared-mime-info package.</p>
                   11810:                 </li>
                   11811:               </ol>
                   11812:             </div>
                   11813:           </div>
                   11814: 
                   11815:           <div class="sect2" lang="en" xml:lang="en">
                   11816:             <div class="titlepage">
                   11817:               <div>
                   11818:                 <div>
1.30      wiz      11819:                   <h3 class="title"><a name="intltool" id=
1.35    ! jmmv     11820:                   "intltool"></a>14.5.14.&nbsp;Packages using
1.1       grant    11821:                   intltool</h3>
                   11822:                 </div>
                   11823:               </div>
                   11824:             </div>
                   11825: 
                   11826:             <p>If a package uses intltool during its build, include
1.14      xtraeme  11827:             the <code class=
                   11828:             "filename">../../textproc/intltool/buildlink3.mk</code>
1.1       grant    11829:             file, which forces it to use the intltool package
                   11830:             provided by pkgsrc, instead of the one bundled with the
                   11831:             distribution file.</p>
                   11832: 
                   11833:             <p>This tracks intltool's build-time dependencies and
                   11834:             uses the latest available version; this way, the
                   11835:             package benefits of any bug fixes that may have
                   11836:             appeared since it was released.</p>
                   11837:           </div>
1.18      xtraeme  11838: 
                   11839:           <div class="sect2" lang="en" xml:lang="en">
                   11840:             <div class="titlepage">
                   11841:               <div>
                   11842:                 <div>
1.30      wiz      11843:                   <h3 class="title"><a name="startup-scripts" id=
1.35    ! jmmv     11844:                   "startup-scripts"></a>14.5.15.&nbsp;Packages
1.30      wiz      11845:                   installing startup scripts</h3>
1.18      xtraeme  11846:                 </div>
                   11847:               </div>
                   11848:             </div>
                   11849: 
                   11850:             <p>If a package contains a rc.d script, it won't be
                   11851:             copied into the startup directory by default, but you
                   11852:             can enable it, by adding the option <code class=
                   11853:             "varname">PKG_RCD_SCRIPTS=YES</code> in <code class=
                   11854:             "filename">/etc/mk.conf</code>. This option will copy
                   11855:             the scripts into <code class=
                   11856:             "filename">/etc/rc.d</code> when a package is
                   11857:             installed, and it will automatically remove the scripts
                   11858:             when the package is deinstalled.</p>
                   11859:           </div>
1.1       grant    11860:         </div>
                   11861: 
                   11862:         <div class="sect1" lang="en" xml:lang="en">
                   11863:           <div class="titlepage">
                   11864:             <div>
                   11865:               <div>
                   11866:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      11867:                 "feedback-to-author" id=
1.35    ! jmmv     11868:                 "feedback-to-author"></a>14.6.&nbsp;Feedback to the
1.30      wiz      11869:                 author</h2>
1.1       grant    11870:               </div>
                   11871:             </div>
                   11872:           </div>
                   11873: 
                   11874:           <p>If you have found any bugs in the package you make
                   11875:           available, if you had to do special steps to make it run
                   11876:           under NetBSD or if you enhanced the software in various
                   11877:           other ways, be sure to report these changes back to the
                   11878:           original author of the program! With that kind of
                   11879:           support, the next release of the program can incorporate
                   11880:           these fixes, and people not using the NetBSD packages
                   11881:           system can win from your efforts.</p>
                   11882: 
                   11883:           <p>Support the idea of free software!</p>
                   11884:         </div>
                   11885:       </div>
                   11886: 
                   11887:       <div class="chapter" lang="en" xml:lang="en">
                   11888:         <div class="titlepage">
                   11889:           <div>
                   11890:             <div>
                   11891:               <h2 class="title"><a name="debug" id=
1.35    ! jmmv     11892:               "debug"></a>Chapter&nbsp;15.&nbsp;Debugging</h2>
1.1       grant    11893:             </div>
                   11894:           </div>
                   11895:         </div>
                   11896: 
                   11897:         <p>To check out all the gotchas when building a package,
                   11898:         here are the steps that I do in order to get a package
                   11899:         working. Please note this is basically the same as what was
                   11900:         explained in the previous sections, only with some
                   11901:         debugging aids.</p>
                   11902: 
                   11903:         <div class="itemizedlist">
                   11904:           <ul type="disc">
                   11905:             <li>
1.14      xtraeme  11906:               <p>Be sure to set <code class=
                   11907:               "varname">PKG_DEVELOPER=1</code> in <code class=
                   11908:               "filename">/etc/mk.conf</code></p>
1.1       grant    11909:             </li>
                   11910: 
                   11911:             <li>
                   11912:               <p>Install <a xmlns=
                   11913:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   11914:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.20      ben      11915:               class="pkgname">pkgtools/url2pkg</a>, create a
                   11916:               directory for a new package, change into it, then run
                   11917:               <span><strong class=
                   11918:               "command">url2pkg</strong></span>:</p>
1.1       grant    11919:               <pre class="screen">
1.14      xtraeme  11920: <code class="prompt">%</code> <strong class=
                   11921: "userinput"><code>mkdir /usr/pkgsrc/<em class=
                   11922: "replaceable"><code>category</code></em>/<em class=
                   11923: "replaceable"><code>examplepkg</code></em></code></strong>
                   11924: <code class="prompt">%</code> <strong class=
                   11925: "userinput"><code>cd /usr/pkgsrc/<em class=
                   11926: "replaceable"><code>category</code></em>/<em class=
                   11927: "replaceable"><code>examplepkg</code></em></code></strong>
                   11928: <code class="prompt">%</code> <strong class=
                   11929: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1       grant    11930: </pre>
                   11931:             </li>
                   11932: 
                   11933:             <li>
1.14      xtraeme  11934:               <p>Edit the <code class="filename">Makefile</code> as
1.1       grant    11935:               requested.</p>
                   11936:             </li>
                   11937: 
                   11938:             <li>
1.14      xtraeme  11939:               <p>Fill in the <code class="filename">DESCR</code>
1.1       grant    11940:               file</p>
                   11941:             </li>
                   11942: 
                   11943:             <li>
1.14      xtraeme  11944:               <p>Run <span><strong class="command">make
                   11945:               configure</strong></span></p>
1.1       grant    11946:             </li>
                   11947: 
                   11948:             <li>
                   11949:               <p>Add any dependencies glimpsed from documentation
1.14      xtraeme  11950:               and the configure step to the package's <code class=
                   11951:               "filename">Makefile</code>.</p>
1.1       grant    11952:             </li>
                   11953: 
                   11954:             <li>
                   11955:               <p>Make the package compile, doing multiple rounds
                   11956:               of</p>
                   11957:               <pre class="screen">
1.14      xtraeme  11958: <code class="prompt">%</code> <strong class=
                   11959: "userinput"><code>make</code></strong>
                   11960: <code class="prompt">%</code> <strong class=
                   11961: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
                   11962: <code class="prompt">%</code> <strong class=
                   11963: "userinput"><code>mkpatches</code></strong>
                   11964: <code class="prompt">%</code> <strong class=
                   11965: "userinput"><code>patchdiff</code></strong>
                   11966: <code class="prompt">%</code> <strong class=
                   11967: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
                   11968: <code class="prompt">%</code> <strong class=
                   11969: "userinput"><code>make mps</code></strong>
                   11970: <code class="prompt">%</code> <strong class=
                   11971: "userinput"><code>make clean</code></strong>
1.1       grant    11972: </pre>
                   11973: 
                   11974:               <p>Doing as non-root user will ensure that no files
                   11975:               are modified that shouldn't be, especially during the
1.14      xtraeme  11976:               build phase. <span><strong class=
                   11977:               "command">mkpatches</strong></span>,
                   11978:               <span><strong class=
                   11979:               "command">patchdiff</strong></span> and
                   11980:               <span><strong class="command">pkgvi</strong></span>
                   11981:               are from the <a xmlns=
1.1       grant    11982:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   11983:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20      ben      11984:               class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1       grant    11985:             </li>
                   11986: 
                   11987:             <li>
1.14      xtraeme  11988:               <p>Look at the <code class=
                   11989:               "filename">Makefile</code>, fix if necessary; see
                   11990:               <a href="#components.Makefile" title=
1.27      rillig   11991:               "7.1.&nbsp;Makefile">Section&nbsp;7.1,
1.14      xtraeme  11992:               &#8220;<code class=
                   11993:               "filename">Makefile</code>&#8221;</a>.</p>
1.1       grant    11994:             </li>
                   11995: 
                   11996:             <li>
1.14      xtraeme  11997:               <p>Generate a <code class=
                   11998:               "filename">PLIST</code>:</p>
1.1       grant    11999:               <pre class="screen">
1.14      xtraeme  12000: <code class="prompt">#</code> <strong class=
                   12001: "userinput"><code>make install</code></strong>
                   12002: <code class="prompt">#</code> <strong class=
                   12003: "userinput"><code>make print-PLIST &gt;PLIST</code></strong>
                   12004: <code class="prompt">#</code> <strong class=
                   12005: "userinput"><code>make deinstall</code></strong>
                   12006: <code class="prompt">#</code> <strong class=
                   12007: "userinput"><code>make install</code></strong>
                   12008: <code class="prompt">#</code> <strong class=
                   12009: "userinput"><code>make deinstall</code></strong>
1.1       grant    12010: </pre>
                   12011: 
1.14      xtraeme  12012:               <p>You usually need to be <code class=
                   12013:               "username">root</code> to do this. Look if there are
1.1       grant    12014:               any files left:</p>
                   12015:               <pre class="screen">
1.14      xtraeme  12016: <code class="prompt">#</code> <strong class=
                   12017: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    12018: </pre>
                   12019: 
                   12020:               <p>If this reveals any files that are missing in
1.14      xtraeme  12021:               <code class="filename">PLIST</code>, add them.</p>
1.1       grant    12022:             </li>
                   12023: 
                   12024:             <li>
1.14      xtraeme  12025:               <p>Now that the <code class="filename">PLIST</code>
                   12026:               is OK, install the package again and make a binary
1.1       grant    12027:               package:</p>
                   12028:               <pre class="screen">
1.14      xtraeme  12029: <code class="prompt">#</code> <strong class=
                   12030: "userinput"><code>make reinstall</code></strong>
                   12031: <code class="prompt">#</code> <strong class=
                   12032: "userinput"><code>make package</code></strong>
1.1       grant    12033: </pre>
                   12034:             </li>
                   12035: 
                   12036:             <li>
                   12037:               <p>Delete the installed package:</p>
                   12038:               <pre class="screen">
1.14      xtraeme  12039: <code class="prompt">#</code> <strong class=
                   12040: "userinput"><code>pkg_delete blub</code></strong>
1.1       grant    12041: </pre>
                   12042:             </li>
                   12043: 
                   12044:             <li>
1.14      xtraeme  12045:               <p>Repeat the above <span><strong class=
                   12046:               "command">make print-PLIST</strong></span> command,
                   12047:               which shouldn't find anything now:</p>
1.1       grant    12048:               <pre class="screen">
1.14      xtraeme  12049: <code class="prompt">#</code> <strong class=
                   12050: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    12051: </pre>
                   12052:             </li>
                   12053: 
                   12054:             <li>
                   12055:               <p>Reinstall the binary package:</p>
                   12056:               <pre class="screen">
1.14      xtraeme  12057: <code class="prompt">#</code> <strong class=
                   12058: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1       grant    12059: </pre>
                   12060:             </li>
                   12061: 
                   12062:             <li>
                   12063:               <p>Play with it. Make sure everything works.</p>
                   12064:             </li>
                   12065: 
                   12066:             <li>
1.14      xtraeme  12067:               <p>Run <span><strong class=
                   12068:               "command">pkglint</strong></span> from <a xmlns=
1.1       grant    12069:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   12070:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20      ben      12071:               class="pkgname">pkgtools/pkglint</a>, and fix the
                   12072:               problems it reports:</p>
1.1       grant    12073:               <pre class="screen">
1.14      xtraeme  12074: <code class="prompt">#</code> <strong class=
                   12075: "userinput"><code>pkglint</code></strong>
1.1       grant    12076: </pre>
                   12077:             </li>
                   12078: 
                   12079:             <li>
                   12080:               <p>Submit (or commit, if you have cvs access); see
                   12081:               <a href="#submit" title=
1.35    ! jmmv     12082:               "Chapter&nbsp;16.&nbsp;Submitting and Committing">Chapter&nbsp;16,
1.1       grant    12083:               <i>Submitting and Committing</i></a>.</p>
                   12084:             </li>
                   12085:           </ul>
                   12086:         </div>
                   12087:       </div>
                   12088: 
                   12089:       <div class="chapter" lang="en" xml:lang="en">
                   12090:         <div class="titlepage">
                   12091:           <div>
                   12092:             <div>
                   12093:               <h2 class="title"><a name="submit" id=
1.35    ! jmmv     12094:               "submit"></a>Chapter&nbsp;16.&nbsp;Submitting and
1.1       grant    12095:               Committing</h2>
                   12096:             </div>
                   12097:           </div>
                   12098:         </div>
                   12099: 
                   12100:         <div class="toc">
                   12101:           <p><b>Table of Contents</b></p>
                   12102: 
                   12103:           <dl>
1.30      wiz      12104:             <dt><span class="sect1"><a href=
1.35    ! jmmv     12105:             "#submitting-your-package">16.1. Submitting your
1.30      wiz      12106:             packages</a></span></dt>
1.1       grant    12107: 
1.30      wiz      12108:             <dt><span class="sect1"><a href=
1.35    ! jmmv     12109:             "#committing-importing">16.2. Committing: Importing a
1.30      wiz      12110:             package into CVS</a></span></dt>
1.1       grant    12111: 
1.30      wiz      12112:             <dt><span class="sect1"><a href=
1.35    ! jmmv     12113:             "#updating-package">16.3. Updating a package to a newer
1.30      wiz      12114:             version</a></span></dt>
1.1       grant    12115: 
1.35    ! jmmv     12116:             <dt><span class="sect1"><a href="#moving-package">16.4.
1.2       hubertf  12117:             Moving a package in pkgsrc</a></span></dt>
1.1       grant    12118:           </dl>
                   12119:         </div>
                   12120: 
                   12121:         <div class="sect1" lang="en" xml:lang="en">
                   12122:           <div class="titlepage">
                   12123:             <div>
                   12124:               <div>
                   12125:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      12126:                 "submitting-your-package" id=
1.35    ! jmmv     12127:                 "submitting-your-package"></a>16.1.&nbsp;Submitting
1.30      wiz      12128:                 your packages</h2>
1.1       grant    12129:               </div>
                   12130:             </div>
                   12131:           </div>
                   12132: 
                   12133:           <p>You have to separate between binary and
                   12134:           &#8220;<span class="quote">normal</span>&#8221; (source)
                   12135:           packages here:</p>
                   12136: 
                   12137:           <div class="itemizedlist">
                   12138:             <ul type="disc">
                   12139:               <li>
                   12140:                 <p>precompiled binary packages</p>
                   12141: 
                   12142:                 <p>Our policy is that we accept binaries only from
                   12143:                 pkgsrc developers to guarantee that the packages
                   12144:                 don't contain any trojan horses etc. This is not to
1.13      hubertf  12145:                 annoy anyone but rather to protect our users!
1.1       grant    12146:                 You're still free to put up your home-made binary
1.13      hubertf  12147:                 packages and tell the world where to get them.
                   12148:                 NetBSD developers doing bulk builds and wanting to
                   12149:                 upload them please see <a href="#bulk-upload"
                   12150:                 title="5.3.8.&nbsp;Uploading results of a bulk build">
                   12151:                 Section&nbsp;5.3.8, &#8220;Uploading results of a
                   12152:                 bulk build&#8221;</a>.</p>
1.1       grant    12153:               </li>
                   12154: 
                   12155:               <li>
                   12156:                 <p>packages</p>
                   12157: 
                   12158:                 <p>First, check that your package is complete,
                   12159:                 compiles and runs well; see <a href="#debug" title=
1.35    ! jmmv     12160:                 "Chapter&nbsp;15.&nbsp;Debugging">Chapter&nbsp;15,
1.1       grant    12161:                 <i>Debugging</i></a> and the rest of this document.
1.24      wiz      12162:                 Next, generate an uuencoded gzipped <a href=
                   12163:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   12164:                 <span class="citerefentry"><span class=
                   12165:                 "refentrytitle">tar</span>(1)</span></a> archive,
1.1       grant    12166:                 preferably with all files in a single directory.
1.14      xtraeme  12167:                 Finally, <span><strong class=
                   12168:                 "command">send-pr</strong></span> with category
1.1       grant    12169:                 &#8220;<span class="quote">pkg</span>&#8221;, a
                   12170:                 synopsis which includes the package name and
                   12171:                 version number, a short description of your package
                   12172:                 (contents of the COMMENT variable or DESCR file are
                   12173:                 OK) and attach the archive to your PR.</p>
                   12174: 
                   12175:                 <p>If you want to submit several packages, please
                   12176:                 send a separate PR for each one, it's easier for us
                   12177:                 to track things that way.</p>
                   12178: 
                   12179:                 <p>Alternatively, you can also import new packages
                   12180:                 into pkgsrc-wip (&#8220;<span class="quote">pkgsrc
                   12181:                 work-in-progress</span>&#8221;); see the homepage
                   12182:                 at <a href="http://pkgsrc-wip.sourceforge.net/"
                   12183:                 target=
                   12184:                 "_top">http://pkgsrc-wip.sourceforge.net/</a> for
                   12185:                 details.</p>
                   12186:               </li>
                   12187:             </ul>
                   12188:           </div>
                   12189:         </div>
                   12190: 
                   12191:         <div class="sect1" lang="en" xml:lang="en">
                   12192:           <div class="titlepage">
                   12193:             <div>
                   12194:               <div>
                   12195:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      12196:                 "committing-importing" id=
1.35    ! jmmv     12197:                 "committing-importing"></a>16.2.&nbsp;Committing:
1.30      wiz      12198:                 Importing a package into CVS</h2>
1.1       grant    12199:               </div>
                   12200:             </div>
                   12201:           </div>
                   12202: 
                   12203:           <p>This section is only of interest for pkgsrc developers
                   12204:           with write access to the pkgsrc repository. Please
                   12205:           remember that cvs imports files relative to the current
                   12206:           working directory, and that the pathname that you give
1.14      xtraeme  12207:           the <span><strong class="command">cvs
                   12208:           import</strong></span> command is so that it knows where
                   12209:           to place the files in the repository. Newly created
                   12210:           packages should be imported with a vendor tag of
                   12211:           &#8220;<span class="quote">TNF</span>&#8221; and a
                   12212:           release tag of &#8220;<span class=
                   12213:           "quote">pkgsrc-base</span>&#8221;, e.g:</p>
1.1       grant    12214:           <pre class="programlisting">
                   12215:   % cd .../pkgsrc/category/pkgname
                   12216:   % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
                   12217: </pre>
                   12218: 
                   12219:           <p>Remember to move the directory from which you imported
                   12220:           out of the way, or cvs will complain the next time you
                   12221:           &#8220;<span class="quote">cvs update</span>&#8221; your
                   12222:           source tree. Also don't forget to add the new package to
1.14      xtraeme  12223:           the category's <code class=
                   12224:           "filename">Makefile</code>.</p>
1.1       grant    12225: 
                   12226:           <p>The commit message of the initial import should
1.14      xtraeme  12227:           include part of the <code class="filename">DESCR</code>
                   12228:           file, so people reading the mailing lists know what the
                   12229:           package is/does.</p>
1.1       grant    12230: 
                   12231:           <p>Please note all package updates/additions in
1.14      xtraeme  12232:           <code class="filename">pkgsrc/doc/CHANGES</code>. It's
                   12233:           very important to keep this file up to date and
                   12234:           conforming to the existing format, because it will be
                   12235:           used by scripts to automatically update pages on <a href=
1.1       grant    12236:           "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
                   12237:           and other sites. Additionally, check the pkgsrc/doc/TODO
                   12238:           file and remove the entry for the package you updated, in
                   12239:           case it was mentioned there.</p>
                   12240: 
                   12241:           <p>For new packages, &#8220;<span class="quote">cvs
                   12242:           import</span>&#8221; is preferred to &#8220;<span class=
                   12243:           "quote">cvs add</span>&#8221; because the former gets
                   12244:           everything with a single command, and provides a
                   12245:           consistent tag.</p>
                   12246:         </div>
                   12247: 
                   12248:         <div class="sect1" lang="en" xml:lang="en">
                   12249:           <div class="titlepage">
                   12250:             <div>
                   12251:               <div>
                   12252:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      12253:                 "updating-package" id=
1.35    ! jmmv     12254:                 "updating-package"></a>16.3.&nbsp;Updating a
1.30      wiz      12255:                 package to a newer version</h2>
1.1       grant    12256:               </div>
                   12257:             </div>
                   12258:           </div>
                   12259: 
                   12260:           <p>Please always put a concise, appropriate and relevant
                   12261:           summary of the changes between old and new versions into
                   12262:           the commit log when updating a package. There are various
                   12263:           reasons for this:</p>
                   12264: 
                   12265:           <div class="itemizedlist">
                   12266:             <ul type="disc">
                   12267:               <li>
                   12268:                 <p>A URL is volatile, and can change over time. It
                   12269:                 may go away completely or its information may be
                   12270:                 overwritten by newer information.</p>
                   12271:               </li>
                   12272: 
                   12273:               <li>
                   12274:                 <p>Having the change information between old and
                   12275:                 new versions in our CVS repository is very useful
                   12276:                 for people who use either cvs or anoncvs.</p>
                   12277:               </li>
                   12278: 
                   12279:               <li>
                   12280:                 <p>Having the change information between old and
                   12281:                 new versions in our CVS repository is very useful
                   12282:                 for people who read the pkgsrc-changes mailing
                   12283:                 list, so that they can make tactical decisions
                   12284:                 about when to upgrade the package.</p>
                   12285:               </li>
                   12286:             </ul>
                   12287:           </div>
                   12288: 
1.18      xtraeme  12289:           <p>Please also recognize that, just because a new version
1.1       grant    12290:           of a package has been released, it should not
                   12291:           automatically be upgraded in the CVS repository. We
                   12292:           prefer to be conservative in the packages that are
                   12293:           included in pkgsrc - development or beta packages are not
                   12294:           really the best thing for most places in which pkgsrc is
                   12295:           used. Please use your judgement about what should go into
                   12296:           pkgsrc, and bear in mind that stability is to be
                   12297:           preferred above new and possibly untested features.</p>
                   12298:         </div>
                   12299: 
                   12300:         <div class="sect1" lang="en" xml:lang="en">
                   12301:           <div class="titlepage">
                   12302:             <div>
                   12303:               <div>
                   12304:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      12305:                 "moving-package" id=
1.35    ! jmmv     12306:                 "moving-package"></a>16.4.&nbsp;Moving a package in
1.30      wiz      12307:                 pkgsrc</h2>
1.1       grant    12308:               </div>
                   12309:             </div>
                   12310:           </div>
                   12311: 
                   12312:           <div class="orderedlist">
                   12313:             <ol type="1">
                   12314:               <li>
                   12315:                 <p>Make a copy of the directory somewhere else.</p>
                   12316:               </li>
                   12317: 
                   12318:               <li>
                   12319:                 <p>Remove all CVS dirs.</p>
                   12320: 
                   12321:                 <p>Alternatively to the first two steps you can
                   12322:                 also do:</p>
                   12323:                 <pre class="screen">
1.14      xtraeme  12324: <code class="prompt">%</code> <strong class=
                   12325: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1       grant    12326: </pre>
                   12327: 
                   12328:                 <p>and use that for further work.</p>
                   12329:               </li>
                   12330: 
                   12331:               <li>
1.14      xtraeme  12332:                 <p>Fix <code class="varname">CATEGORIES</code> and
                   12333:                 any <code class="varname">DEPENDS</code> paths that
                   12334:                 just did &#8220;<span class=
1.1       grant    12335:                 "quote">../package</span>&#8221; instead of
                   12336:                 &#8220;<span class=
                   12337:                 "quote">../../category/package</span>&#8221;.</p>
                   12338:               </li>
                   12339: 
                   12340:               <li>
1.14      xtraeme  12341:                 <p><span><strong class="command">cvs
                   12342:                 import</strong></span> the modified package in the
                   12343:                 new place.</p>
1.1       grant    12344:               </li>
                   12345: 
                   12346:               <li>
                   12347:                 <p>Check if any package depends on it:</p>
                   12348:                 <pre class="screen">
1.14      xtraeme  12349: <code class="prompt">%</code> <strong class=
                   12350: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   12351: <code class="prompt">%</code> <strong class=
                   12352: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1       grant    12353: </pre>
                   12354:               </li>
                   12355: 
                   12356:               <li>
                   12357:                 <p>Fix paths in packages from step 5 to point to
                   12358:                 new location.</p>
                   12359:               </li>
                   12360: 
                   12361:               <li>
1.14      xtraeme  12362:                 <p><span><strong class="command">cvs rm
                   12363:                 (-f)</strong></span> the package at the old
                   12364:                 location.</p>
1.1       grant    12365:               </li>
                   12366: 
                   12367:               <li>
1.14      xtraeme  12368:                 <p>Remove from <code class=
                   12369:                 "filename">oldcategory/Makefile</code>.</p>
1.1       grant    12370:               </li>
                   12371: 
                   12372:               <li>
1.14      xtraeme  12373:                 <p>Add to <code class=
                   12374:                 "filename">newcategory/Makefile</code>.</p>
1.1       grant    12375:               </li>
                   12376: 
                   12377:               <li>
                   12378:                 <p>Commit the changed and removed files:</p>
                   12379:                 <pre class="screen">
1.14      xtraeme  12380: <code class="prompt">%</code> <strong class=
                   12381: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1       grant    12382: </pre>
                   12383: 
                   12384:                 <p>(and any packages from step 5, of course).</p>
                   12385:               </li>
                   12386:             </ol>
                   12387:           </div>
                   12388:         </div>
                   12389:       </div>
                   12390:     </div>
                   12391: 
                   12392:     <div class="appendix" lang="en" xml:lang="en">
                   12393:       <div class="titlepage">
                   12394:         <div>
                   12395:           <div>
                   12396:             <h2 class="title"><a name="examples" id=
                   12397:             "examples"></a>Appendix&nbsp;A.&nbsp;A simple example
                   12398:             package: bison</h2>
                   12399:           </div>
                   12400:         </div>
                   12401:       </div>
                   12402: 
                   12403:       <div class="toc">
                   12404:         <p><b>Table of Contents</b></p>
                   12405: 
                   12406:         <dl>
1.30      wiz      12407:           <dt><span class="sect1"><a href="#example-files">A.1.
1.1       grant    12408:           files</a></span></dt>
                   12409: 
                   12410:           <dd>
                   12411:             <dl>
1.30      wiz      12412:               <dt><span class="sect2"><a href=
                   12413:               "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1       grant    12414: 
1.30      wiz      12415:               <dt><span class="sect2"><a href=
                   12416:               "#example-descr">A.1.2. DESCR</a></span></dt>
1.1       grant    12417: 
1.30      wiz      12418:               <dt><span class="sect2"><a href=
                   12419:               "#example-plist">A.1.3. PLIST</a></span></dt>
1.1       grant    12420: 
1.30      wiz      12421:               <dt><span class="sect2"><a href=
                   12422:               "#checking-package-with-pkglint">A.1.4. Checking a
                   12423:               package with <span><strong class=
1.14      xtraeme  12424:               "command">pkglint</strong></span></a></span></dt>
1.1       grant    12425:             </dl>
                   12426:           </dd>
                   12427: 
1.30      wiz      12428:           <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
                   12429:           Steps for building, installing, packaging</a></span></dt>
1.1       grant    12430:         </dl>
                   12431:       </div>
                   12432: 
                   12433:       <p>We checked to find a piece of software that wasn't in the
                   12434:       packages collection, and picked GNU bison. Quite why someone
1.14      xtraeme  12435:       would want to have <span><strong class=
                   12436:       "command">bison</strong></span> when Berkeley
                   12437:       <span><strong class="command">yacc</strong></span> is already
                   12438:       present in the tree is beyond us, but it's useful for the
                   12439:       purposes of this exercise.</p>
1.1       grant    12440: 
                   12441:       <div class="sect1" lang="en" xml:lang="en">
                   12442:         <div class="titlepage">
                   12443:           <div>
                   12444:             <div>
                   12445:               <h2 class="title" style="clear: both"><a name=
1.30      wiz      12446:               "example-files" id=
                   12447:               "example-files"></a>A.1.&nbsp;files</h2>
1.1       grant    12448:             </div>
                   12449:           </div>
                   12450:         </div>
                   12451: 
                   12452:         <div class="sect2" lang="en" xml:lang="en">
                   12453:           <div class="titlepage">
                   12454:             <div>
                   12455:               <div>
1.30      wiz      12456:                 <h3 class="title"><a name="example-Makefile" id=
                   12457:                 "example-Makefile"></a>A.1.1.&nbsp;Makefile</h3>
1.1       grant    12458:               </div>
                   12459:             </div>
                   12460:           </div>
                   12461:           <pre class="programlisting">
1.17      sketch   12462: # $NetBSD$
1.1       grant    12463: #
                   12464: 
                   12465: DISTNAME=       bison-1.25
                   12466: CATEGORIES=     devel
                   12467: MASTER_SITES=   ${MASTER_SITE_GNU}
                   12468: 
                   12469: MAINTAINER=     thorpej@NetBSD.org
                   12470: HOMEPAGE=       http://www.gnu.org/software/bison/bison.html
                   12471: COMMENT=        GNU yacc clone
                   12472: 
                   12473: GNU_CONFIGURE=  yes
                   12474: INFO_FILES=     bison.info
                   12475: 
                   12476: .include "../../mk/bsd.pkg.mk"
                   12477: </pre>
                   12478:         </div>
                   12479: 
                   12480:         <div class="sect2" lang="en" xml:lang="en">
                   12481:           <div class="titlepage">
                   12482:             <div>
                   12483:               <div>
1.30      wiz      12484:                 <h3 class="title"><a name="example-descr" id=
                   12485:                 "example-descr"></a>A.1.2.&nbsp;DESCR</h3>
1.1       grant    12486:               </div>
                   12487:             </div>
                   12488:           </div>
                   12489:           <pre class="programlisting">
                   12490: GNU version of yacc.  Can make re-entrant parsers, and numerous other
                   12491: improvements.  Why you would want this when Berkeley <a href=
                   12492: "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
                   12493: of the NetBSD source tree is beyond me.
                   12494: </pre>
                   12495:         </div>
                   12496: 
                   12497:         <div class="sect2" lang="en" xml:lang="en">
                   12498:           <div class="titlepage">
                   12499:             <div>
                   12500:               <div>
1.30      wiz      12501:                 <h3 class="title"><a name="example-plist" id=
                   12502:                 "example-plist"></a>A.1.3.&nbsp;PLIST</h3>
1.1       grant    12503:               </div>
                   12504:             </div>
                   12505:           </div>
                   12506:           <pre class="programlisting">
1.17      sketch   12507: @comment $NetBSD$
1.1       grant    12508: bin/bison
                   12509: man/man1/bison.1.gz
                   12510: share/bison.simple
                   12511: share/bison.hairy
                   12512: </pre>
                   12513:         </div>
                   12514: 
                   12515:         <div class="sect2" lang="en" xml:lang="en">
                   12516:           <div class="titlepage">
                   12517:             <div>
                   12518:               <div>
1.30      wiz      12519:                 <h3 class="title"><a name=
                   12520:                 "checking-package-with-pkglint" id=
                   12521:                 "checking-package-with-pkglint"></a>A.1.4.&nbsp;Checking
                   12522:                 a package with <span><strong class=
1.14      xtraeme  12523:                 "command">pkglint</strong></span></h3>
1.1       grant    12524:               </div>
                   12525:             </div>
                   12526:           </div>
                   12527: 
                   12528:           <p>The NetBSD package system comes with <a xmlns=
                   12529:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   12530:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20      ben      12531:           class="pkgname">pkgtools/pkglint</a> which helps to check
                   12532:           the contents of these files. After installation it is
                   12533:           quite easy to use, just change to the directory of the
                   12534:           package you wish to examine and execute
                   12535:           <span><strong class=
                   12536:           "command">pkglint</strong></span>:</p>
1.1       grant    12537:           <pre class="screen">
1.14      xtraeme  12538: <code class="prompt">$</code> <strong class=
                   12539: "userinput"><code>pkglint</code></strong>
1.1       grant    12540: looks fine.
                   12541: </pre>
                   12542: 
                   12543:           <p>Depending on the supplied command line arguments (see
                   12544:           pkglint(1)) more verbose checks will be performed. Use
1.14      xtraeme  12545:           e.g. <span><strong class="command">pkglint
                   12546:           -v</strong></span> for a very verbose check.</p>
1.1       grant    12547:         </div>
                   12548:       </div>
                   12549: 
                   12550:       <div class="sect1" lang="en" xml:lang="en">
                   12551:         <div class="titlepage">
                   12552:           <div>
                   12553:             <div>
                   12554:               <h2 class="title" style="clear: both"><a name=
1.30      wiz      12555:               "steps-for-b-i-p" id=
                   12556:               "steps-for-b-i-p"></a>A.2.&nbsp;Steps for building,
                   12557:               installing, packaging</h2>
1.1       grant    12558:             </div>
                   12559:           </div>
                   12560:         </div>
                   12561: 
                   12562:         <p>Create the directory where the package lives, plus any
                   12563:         auxiliary directories:</p>
                   12564:         <pre class="screen">
1.14      xtraeme  12565: <code class="prompt">#</code> <strong class=
                   12566: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
                   12567: <code class="prompt">#</code> <strong class=
                   12568: "userinput"><code>mkdir bison</code></strong>
                   12569: <code class="prompt">#</code> <strong class=
                   12570: "userinput"><code>cd bison</code></strong>
                   12571: <code class="prompt">#</code> <strong class=
                   12572: "userinput"><code>mkdir patches</code></strong>
1.1       grant    12573: </pre>
                   12574: 
1.14      xtraeme  12575:         <p>Create <code class="filename">Makefile</code>,
                   12576:         <code class="filename">DESCR</code> and <code class=
                   12577:         "filename">PLIST</code> (see <a href="#components" title=
1.27      rillig   12578:         "Chapter&nbsp;7.&nbsp;Package components - files, directories and contents">
                   12579:         Chapter 7, <i>Package components - files, directories and
1.1       grant    12580:         contents</i></a>) then continue with fetching the
                   12581:         distfile:</p>
                   12582:         <pre class="screen">
1.14      xtraeme  12583: <code class="prompt">#</code> <strong class=
                   12584: "userinput"><code>make fetch</code></strong>
1.1       grant    12585: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   12586: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   12587: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   12588: ftp: Error retrieving file: 500 Internal error
                   12589: 
                   12590: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   12591: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   12592: ftp: Error retrieving file: 500 Internal error
                   12593: 
                   12594: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   12595: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   12596: Successfully retrieved file.
                   12597: </pre>
                   12598: 
1.14      xtraeme  12599:         <p>Generate the checksum of the distfile into <code class=
                   12600:         "filename">distinfo</code>:</p>
1.1       grant    12601:         <pre class="screen">
1.14      xtraeme  12602: <code class="prompt">#</code> <strong class=
                   12603: "userinput"><code>make makesum</code></strong>
1.1       grant    12604: </pre>
                   12605: 
                   12606:         <p>Now compile:</p>
                   12607:         <pre class="screen">
1.14      xtraeme  12608: <code class="prompt">#</code> <strong class=
                   12609: "userinput"><code>make</code></strong>
1.1       grant    12610: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   12611: ===&gt;  Extracting for bison-1.25
                   12612: ===&gt;  Patching for bison-1.25
                   12613: ===&gt;   Ignoring empty patch directory
                   12614: ===&gt;  Configuring for bison-1.25
                   12615: creating cache ./config.cache
                   12616: checking for gcc... cc
                   12617: checking whether we are using GNU C... yes
                   12618: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   12619: checking how to run the C preprocessor... cc -E
                   12620: checking for minix/config.h... no
                   12621: checking for POSIXized ISC... no
                   12622: checking whether cross-compiling... no
                   12623: checking for ANSI C header files... yes
                   12624: checking for string.h... yes
                   12625: checking for stdlib.h... yes
                   12626: checking for memory.h... yes
                   12627: checking for working const... yes
                   12628: checking for working alloca.h... no
                   12629: checking for alloca... yes
                   12630: checking for strerror... yes
                   12631: updating cache ./config.cache
                   12632: creating ./config.status
                   12633: creating Makefile
                   12634: ===&gt;  Building for bison-1.25
                   12635: 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
                   12636: 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
                   12637: 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
                   12638: 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
                   12639: 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
                   12640: 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 
                   12641: 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
                   12642: 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
                   12643: 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
                   12644: 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
                   12645: 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
                   12646: 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
                   12647: 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
                   12648: 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
                   12649: 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
                   12650: 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
                   12651: 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
                   12652: 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
                   12653: 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
                   12654: 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
                   12655: 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
                   12656: 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
                   12657: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   12658: rm -f bison.s1
                   12659: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1
                   12660: </pre>
                   12661: 
                   12662:         <p>Everything seems OK, so install the files:</p>
                   12663:         <pre class="screen">
1.14      xtraeme  12664: <code class="prompt">#</code> <strong class=
                   12665: "userinput"><code>make install</code></strong>
1.1       grant    12666: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   12667: ===&gt;  Installing for bison-1.25
                   12668: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   12669: rm -f /usr/pkg/bin/bison
                   12670: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   12671: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   12672: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   12673: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   12674: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   12675: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   12676: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
                   12677: ===&gt;  Registering installation for bison-1.25
                   12678: </pre>
                   12679: 
                   12680:         <p>You can now use bison, and also - if you decide so -
1.14      xtraeme  12681:         remove it with <span><strong class="command">pkg_delete
                   12682:         bison</strong></span>. Should you decide that you want a
                   12683:         binary package, do this now:</p>
1.1       grant    12684:         <pre class="screen">
1.14      xtraeme  12685: <code class="prompt">#</code> <strong class=
                   12686: "userinput"><code>make package</code></strong>
1.1       grant    12687: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   12688: ===&gt;  Building package for bison-1.25
                   12689: Creating package bison-1.25.tgz
                   12690: Registering depends:.
                   12691: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
                   12692: </pre>
                   12693: 
                   12694:         <p>Now that you don't need the source and object files any
                   12695:         more, clean up:</p>
                   12696:         <pre class="screen">
1.14      xtraeme  12697: <code class="prompt">#</code> <strong class=
                   12698: "userinput"><code>make clean</code></strong>
1.1       grant    12699: ===&gt;  Cleaning for bison-1.25
                   12700: </pre>
                   12701:       </div>
                   12702:     </div>
                   12703: 
                   12704:     <div class="appendix" lang="en" xml:lang="en">
                   12705:       <div class="titlepage">
                   12706:         <div>
                   12707:           <div>
                   12708:             <h2 class="title"><a name="logs" id=
                   12709:             "logs"></a>Appendix&nbsp;B.&nbsp;Build logs</h2>
                   12710:           </div>
                   12711:         </div>
                   12712:       </div>
                   12713: 
                   12714:       <div class="toc">
                   12715:         <p><b>Table of Contents</b></p>
                   12716: 
                   12717:         <dl>
                   12718:           <dt><span class="sect1"><a href="#logs.building">B.1.
                   12719:           Building figlet</a></span></dt>
                   12720: 
                   12721:           <dt><span class="sect1"><a href="#logs.package">B.2.
                   12722:           Packaging figlet</a></span></dt>
                   12723:         </dl>
                   12724:       </div>
                   12725: 
                   12726:       <div class="sect1" lang="en" xml:lang="en">
                   12727:         <div class="titlepage">
                   12728:           <div>
                   12729:             <div>
                   12730:               <h2 class="title" style="clear: both"><a name=
                   12731:               "logs.building" id=
                   12732:               "logs.building"></a>B.1.&nbsp;Building figlet</h2>
                   12733:             </div>
                   12734:           </div>
                   12735:         </div>
                   12736:         <pre class="screen">
1.14      xtraeme  12737: <code class="prompt">#</code> <strong class=
                   12738: "userinput"><code>make</code></strong>
1.1       grant    12739: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   12740: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   12741: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   12742: =&gt; [172219 bytes]
                   12743: Connected to ftp.plig.net.
                   12744: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   12745: 331 Guest login ok, send your complete e-mail address as password.
                   12746: 230-You are user #5 of 500 simultaneous users allowed.
                   12747: 230-
                   12748: 230-  ___ _             _ _                   
                   12749: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___ 
                   12750: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   12751: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   12752: 230-         |_|   |_|     |___|         |___|
                   12753: 230-
                   12754: 230-** Welcome to ftp.plig.org **
                   12755: 230-
                   12756: 230-Please note that all transfers from this FTP site are logged. If you
                   12757: 230-do not like this, please disconnect now.
                   12758: 230-
                   12759: 230-This arhive is available via
                   12760: 230-
                   12761: 230-HTTP:  http://ftp.plig.org/
                   12762: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   12763: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   12764: 230-
                   12765: 230-Please email comments, bug reports and requests for packages to be
                   12766: 230-mirrored to ftp-admin@plig.org.   
                   12767: 230-
                   12768: 230-
                   12769: 230 Logged in anonymously.
                   12770: Remote system type is UNIX.
                   12771: Using binary mode to transfer files.
                   12772: 200 Type okay.
                   12773: 250 "/pub" is new cwd.
                   12774: 250-"/pub/figlet" is new cwd.
                   12775: 250-
                   12776: 250-Welcome to the figlet archive at ftp.figlet.org
                   12777: 250-    
                   12778: 250-    ftp://ftp.figlet.org/pub/figlet/
                   12779: 250-
                   12780: 250-The official FIGlet web page is:
                   12781: 250-    http://www.figlet.org/
                   12782: 250-
                   12783: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   12784: 250-contribute a font or something else, you can email us.
                   12785: 250 
                   12786: 250 "/pub/figlet/program" is new cwd.
                   12787: 250 "/pub/figlet/program/unix" is new cwd.
                   12788: local: figlet221.tar.gz remote: figlet221.tar.gz
                   12789: 502 Unimplemented command.
                   12790: 227 Entering Passive Mode (195,40,6,41,246,104)
                   12791: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   12792: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   12793: 226 Transfer completed.
                   12794: 172219 bytes received in 00:02 (75.99 KB/s)
                   12795: 221 Goodbye.
                   12796: =&gt; Checksum OK for figlet221.tar.gz.
                   12797: ===&gt; Extracting for figlet-2.2.1nb2
                   12798: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   12799: ===&gt; Patching for figlet-2.2.1nb2
                   12800: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   12801: ===&gt; Overriding tools for figlet-2.2.1nb2
                   12802: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   12803: ===&gt; Configuring for figlet-2.2.1nb2
                   12804: ===&gt; Building for figlet-2.2.1nb2
                   12805: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   12806: chmod a+x figlet
                   12807: gcc -O2 -o chkfont chkfont.c
                   12808: =&gt; Unwrapping files-to-be-installed.
1.14      xtraeme  12809: <code class="prompt">#</code>
                   12810: <code class="prompt">#</code> <strong class=
                   12811: "userinput"><code>make install</code></strong>
1.1       grant    12812: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   12813: ===&gt; Installing for figlet-2.2.1nb2
                   12814: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   12815: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   12816: mkdir -p /usr/pkg/share/figlet
                   12817: cp figlet /usr/pkg/bin
                   12818: cp chkfont /usr/pkg/bin
                   12819: chmod 555 figlist showfigfonts
                   12820: cp figlist /usr/pkg/bin
                   12821: cp showfigfonts /usr/pkg/bin
                   12822: cp fonts/*.flf /usr/pkg/share/figlet
                   12823: cp fonts/*.flc /usr/pkg/share/figlet
                   12824: cp figlet.6 /usr/pkg/man/man6
                   12825: ===&gt; Registering installation for figlet-2.2.1nb2
1.14      xtraeme  12826: <code class="prompt">#</code>
1.1       grant    12827: </pre>
                   12828:       </div>
                   12829: 
                   12830:       <div class="sect1" lang="en" xml:lang="en">
                   12831:         <div class="titlepage">
                   12832:           <div>
                   12833:             <div>
                   12834:               <h2 class="title" style="clear: both"><a name=
                   12835:               "logs.package" id=
                   12836:               "logs.package"></a>B.2.&nbsp;Packaging figlet</h2>
                   12837:             </div>
                   12838:           </div>
                   12839:         </div>
                   12840:         <pre class="screen">
1.14      xtraeme  12841: <code class="prompt">#</code> <strong class=
                   12842: "userinput"><code>make package</code></strong>
1.1       grant    12843: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   12844: ===&gt; Packaging figlet-2.2.1nb2
                   12845: ===&gt; Building binary package for figlet-2.2.1nb2
                   12846: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   12847: Using SrcDir value of /usr/pkg
                   12848: Registering depends:.  
1.14      xtraeme  12849: <code class="prompt">#</code>
1.1       grant    12850: </pre>
                   12851:       </div>
                   12852:     </div>
                   12853: 
                   12854:     <div class="appendix" lang="en" xml:lang="en">
                   12855:       <div class="titlepage">
                   12856:         <div>
                   12857:           <div>
                   12858:             <h2 class="title"><a name="ftp-layout" id=
                   12859:             "ftp-layout"></a>Appendix&nbsp;C.&nbsp;Layout of the
                   12860:             FTP server's package archive</h2>
                   12861:           </div>
                   12862:         </div>
                   12863:       </div>
                   12864: 
                   12865:       <p>Layout for precompiled binary packages on
                   12866:       ftp.NetBSD.org:</p>
                   12867:       <pre class="programlisting">
                   12868: /pub/NetBSD/packages/
                   12869:                 distfiles/
                   12870: 
                   12871:                 # Unpacked pkgsrc trees
                   12872:                 pkgsrc-current -&gt; /pub/NetBSD/NetBSD-current/pkgsrc
                   12873:                 pkgsrc-2003Q4 -&gt; N/A
                   12874:                 pkgsrc-2004Q1/pkgsrc
                   12875: 
                   12876:                 # pkgsrc archives
                   12877:                 pkgsrc-current.tar.gz -&gt; ../NetBSD-current/tar_files/pkgsrc.tar.gz
                   12878:                 pkgsrc-2003Q4.tar.gz -&gt; N/A
                   12879:                 pkgsrc-2004Q1.tar.gz -&gt; N/A
                   12880: 
                   12881:                 # Per pkgsrc-release/OS-release/arch package archives
                   12882:                 pkgsrc-2003Q4/
                   12883:                         NetBSD-1.6.2/
                   12884:                                 i386/
                   12885:                                         All/
                   12886:                                         archivers/
                   12887:                                                 foo -&gt; ../All/foo
                   12888:                                         ...
                   12889:                 pkgsrc-2004Q1/
                   12890:                         NetBSD-1.6.2/
                   12891:                                 i386/
                   12892:                                         All/
                   12893:                                         ...
                   12894:                         NetBSD-2.0/
                   12895:                                 i386/
                   12896:                                         All/
                   12897:                                         ...
                   12898:                         SunOS-5.9/
                   12899:                                 sparc/
                   12900:                                         All/
                   12901:                                         ...
                   12902:                                 x86/
                   12903:                                         All/
                   12904:                                         ...
                   12905: 
                   12906:                 # Per os-release package archive convenience links
                   12907:                 NetBSD-1.6.2 -&gt; 1.6.2
                   12908:                 1.6.2/
                   12909:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
                   12910:                         m68k/
                   12911:                                 All/
                   12912:                                 archivers/
                   12913:                                         foo -&gt; ../All/foo
                   12914:                                 ...
                   12915:                         amiga -&gt; m68k
                   12916:                         atari -&gt; m68k
                   12917:                         ...
                   12918: 
                   12919:                 2.0 -&gt; NetBSD-2.0       # backward compat, historic
                   12920:                 NetBSD-2.0/
                   12921:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-2.0/i386
                   12922:                 SunOS-5.9/
                   12923:                         sparc -&gt; ../pkgsrc-2004Q1/SunOS-5.9/sparc
                   12924:                         x86 -&gt; ../pkgsrc-2004Q1/SunOS-5.9/x86
                   12925:                         
                   12926: </pre>
                   12927: 
                   12928:       <p>To create:</p>
                   12929: 
                   12930:       <div class="orderedlist">
                   12931:         <ol type="1">
                   12932:           <li>
                   12933:             <p>Run bulk build, see <a href="#bulkbuild" title=
                   12934:             "5.3.&nbsp;Doing a bulk build of all packages">Section
                   12935:             5.3, &#8220;Doing a bulk build of all
                   12936:             packages&#8221;</a></p>
                   12937:           </li>
                   12938: 
                   12939:           <li>
                   12940:             <p>Upload /usr/pkgsrc/packages to</p>
                   12941:             <pre class="programlisting">
                   12942:     ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13      hubertf  12943:         pkgsrc-2004Q4/\                         # pkgsrc-branch
1.1       grant    12944:         `uname -s`-`uname -r`/                  # OS &amp; version
                   12945:         `uname -p`                              # architecture
                   12946:        
                   12947: </pre>
                   12948:           </li>
                   12949: 
                   12950:           <li>
1.14      xtraeme  12951:             <p>If necessary, create a symlink <span><strong class=
                   12952:             "command">ln -s `uname -m` `uname -p`</strong></span>
                   12953:             (amiga -&gt; m68k, ...)</p>
1.1       grant    12954:           </li>
                   12955:         </ol>
                   12956:       </div>
                   12957:     </div>
1.2       hubertf  12958: 
                   12959:     <div class="appendix" lang="en" xml:lang="en">
                   12960:       <div class="titlepage">
                   12961:         <div>
                   12962:           <div>
                   12963:             <h2 class="title"><a name="editing" id=
                   12964:             "editing"></a>Appendix&nbsp;D.&nbsp;Editing guidelines
                   12965:             for the pkgsrc guide</h2>
                   12966:           </div>
                   12967:         </div>
                   12968:       </div>
                   12969: 
                   12970:       <div class="toc">
                   12971:         <p><b>Table of Contents</b></p>
                   12972: 
                   12973:         <dl>
1.30      wiz      12974:           <dt><span class="sect1"><a href="#targets">D.1.
1.2       hubertf  12975:           Targets</a></span></dt>
                   12976: 
1.30      wiz      12977:           <dt><span class="sect1"><a href="#procedure">D.2.
1.2       hubertf  12978:           Procedure</a></span></dt>
                   12979:         </dl>
                   12980:       </div>
                   12981: 
                   12982:       <p>This section contains information on editing the pkgsrc
                   12983:       guide itself.</p>
                   12984: 
                   12985:       <div class="sect1" lang="en" xml:lang="en">
                   12986:         <div class="titlepage">
                   12987:           <div>
                   12988:             <div>
                   12989:               <h2 class="title" style="clear: both"><a name=
1.30      wiz      12990:               "targets" id="targets"></a>D.1.&nbsp;Targets</h2>
1.2       hubertf  12991:             </div>
                   12992:           </div>
                   12993:         </div>
                   12994: 
1.14      xtraeme  12995:         <p>The pkgsrc guide's source code is stored in <code class=
                   12996:         "filename">pkgsrc/doc/guide/files</code>, and several files
1.2       hubertf  12997:         are created from it:</p>
                   12998: 
                   12999:         <div class="itemizedlist">
                   13000:           <ul type="disc">
                   13001:             <li>
1.14      xtraeme  13002:               <p><code class=
1.23      wiz      13003:               "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2       hubertf  13004:             </li>
                   13005: 
                   13006:             <li>
1.14      xtraeme  13007:               <p><code class=
                   13008:               "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2       hubertf  13009:             </li>
                   13010: 
                   13011:             <li>
1.14      xtraeme  13012:               <p><code class=
                   13013:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2       hubertf  13014:               the documentation on the NetBSD website will be built
                   13015:               from pkgsrc and kept up to date on the web server
                   13016:               itself. This means you <span class=
                   13017:               "emphasis"><em>must</em></span> make sure that your
                   13018:               changes haven't broken the build!</p>
                   13019:             </li>
1.6       hubertf  13020: 
                   13021:             <li>
1.14      xtraeme  13022:               <p><code class=
                   13023:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6       hubertf  13024:               PDF version of the pkgsrc guide.</p>
                   13025:             </li>
                   13026: 
                   13027:             <li>
1.14      xtraeme  13028:               <p><code class=
                   13029:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6       hubertf  13030:               PostScript version of the pkgsrc guide.</p>
                   13031:             </li>
1.2       hubertf  13032:           </ul>
                   13033:         </div>
                   13034:       </div>
                   13035: 
                   13036:       <div class="sect1" lang="en" xml:lang="en">
                   13037:         <div class="titlepage">
                   13038:           <div>
                   13039:             <div>
                   13040:               <h2 class="title" style="clear: both"><a name=
1.30      wiz      13041:               "procedure" id=
                   13042:               "procedure"></a>D.2.&nbsp;Procedure</h2>
1.2       hubertf  13043:             </div>
                   13044:           </div>
                   13045:         </div>
                   13046: 
                   13047:         <p>The procedure to edit the pkgsrc guide is:</p>
                   13048: 
                   13049:         <div class="itemizedlist">
                   13050:           <ul type="disc">
                   13051:             <li>
1.6       hubertf  13052:               <p>Make sure you have the packages needed to
                   13053:               re-generate the pkgsrc guide (and other XML-based
                   13054:               NetBSD documentation) installed. These are
1.11      ben      13055:               &#8220;<span class="quote">netbsd-doc</span>&#8221;
1.6       hubertf  13056:               for creating the ASCII- and HTML-version, and
                   13057:               &#8220;<span class=
1.11      ben      13058:               "quote">netbsd-doc-print</span>&#8221;for the
1.6       hubertf  13059:               PostScript- and PDF version. You will need both
                   13060:               packages installed, to make sure documentation is
                   13061:               consistent across all formats. The packages can be
1.14      xtraeme  13062:               found in <code class=
                   13063:               "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
                   13064:               <code class=
                   13065:               "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6       hubertf  13066:             </li>
                   13067: 
                   13068:             <li>
1.14      xtraeme  13069:               <p>Edit the XML file(s) in <code class=
                   13070:               "filename">pkgsrc/doc/guide/files</code>.</p>
1.2       hubertf  13071:             </li>
                   13072: 
                   13073:             <li>
1.14      xtraeme  13074:               <p>Run <span><strong class="command">make extract
                   13075:               &amp;&amp; make do-lint</strong></span> in
                   13076:               <code class="filename">pkgsrc/doc/guide</code> to
                   13077:               check the XML syntax, and fix it if needed.</p>
1.4       hubertf  13078:             </li>
                   13079: 
                   13080:             <li>
1.14      xtraeme  13081:               <p>Run <span><strong class=
                   13082:               "command">make</strong></span> in <code class=
                   13083:               "filename">pkgsrc/doc/guide</code> to build the HTML
                   13084:               and ASCII version.</p>
1.2       hubertf  13085:             </li>
                   13086: 
                   13087:             <li>
1.14      xtraeme  13088:               <p>If all is well, run <span><strong class=
                   13089:               "command">make install-doc</strong></span> to put the
                   13090:               generated files into <code class=
                   13091:               "filename">pkgsrc/doc</code>.</p>
1.2       hubertf  13092:             </li>
                   13093: 
                   13094:             <li>
1.14      xtraeme  13095:               <p><span><strong class="command">cvs commit
                   13096:               pkgsrc/doc/guide/files</strong></span></p>
1.2       hubertf  13097:             </li>
                   13098: 
                   13099:             <li>
1.14      xtraeme  13100:               <p><span><strong class="command">cvs commit -m
                   13101:               re-generate
                   13102:               pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2       hubertf  13103:             </li>
1.4       hubertf  13104: 
                   13105:             <li>
                   13106:               <p>Until the webserver on www.NetBSD.org is really
                   13107:               updated automatically to pick up changes to the
1.14      xtraeme  13108:               pkgsrc guide automatically, also run
1.18      xtraeme  13109:               <span><strong class="command">make install-htdocs
1.14      xtraeme  13110:               HTDOCSDIR=../../../htdocs</strong></span> (or
                   13111:               similar, adjust <code class=
                   13112:               "varname">HTDOCSDIR</code>!).</p>
1.4       hubertf  13113:             </li>
                   13114: 
                   13115:             <li>
1.14      xtraeme  13116:               <p><span><strong class="command">cvs commit
                   13117:               htdocs/Documentation/pkgsrc</strong></span></p>
1.4       hubertf  13118:             </li>
1.2       hubertf  13119:           </ul>
                   13120:         </div>
                   13121:       </div>
                   13122:     </div>
1.1       grant    13123:   </div>
                   13124: </body>
                   13125: </html>

CVSweb <webmaster@jp.NetBSD.org>